root/trunk/inc/friends/fans.inc.php

Revision 15, 3.3 KB (checked in by alexx, 7 years ago)
  • fix last bug in communities (see [14])
  • execute a "conversion smarty style" script ;) : for i in find . -type f | grep "\.php$" | grep -v "\.svn"; do perl -pi -e "s/\\\$smarty->assign\((.*),(.*)\);/\\\$_SMARTY\[\$1\] = \$2;/" $i; done
Line 
1<?php
2/****************************************************** Open .node ***
3 * Description:   
4 * Status:        Stable.
5 * Author:        Alexandre Dath <alexandre@dotnode.com>
6 * $Id$
7 *
8 * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************** http://opensource.ikse.net/projects/dotnode ***/
24
25$_SMARTY['Title'] =  'Fans';
26
27$user['info'] = get_cache_user_info($url_id);
28$user['photo'] = build_image_url($url_id);
29
30
31$fans_r = $db->query('SELECT cache_user.id, fname, lname, relationship_status, gender, country, here_for FROM cache_user LEFT JOIN relation USING (id) WHERE relation.id_friend=? AND relation.fan=?', array($url_id, 1));
32while($fan = $fans_r->fetchRow())
33{
34    $fans[$fan['id']]['info'] = $fan;
35    $fans[$fan['id']]['info']['gender_t'] = translate_list($fan['gender'], $labels['profile']['gender']);
36    $fans[$fan['id']]['info']['here_for_t'] = translate_list($fan['here_for'], $labels['profile']['here_for']);
37    $fans[$fan['id']]['info']['relationship_status_t'] = translate_list($fan['relationship_status'], $labels['profile']['relationship_status']);
38    $fans[$fan['id']]['photo'] = build_thumb_url($fan['id']);
39}
40
41
42/********** determination du chemain *****************/
43$user['path'] = array();
44
45if($url_id == $_SESSION['my_id'])
46{
47        $user['relation_type'] = 'myself';
48}
49elseif(in_array($url_id, $_SESSION['my_friends_id']) )
50{
51        $user['relation_type'] = 'friends';
52        $user['path'][$_SESSION['my_id']] = $_SESSION['my_fname'];
53        $user['path'][$url_id] = $user['info']['fname'];
54}
55elseif($intermediaire = array_intersect($_SESSION['my_friends_id'], $user['info']['friends_id']))
56{
57    sort($intermediaire);
58        $user['relation_type'] = 'friends_of_friends';
59        $user['path'][$_SESSION['my_id']] = $_SESSION['my_fname'];
60        $user['path'][$intermediaire[0]] = $db->getOne('SELECT fname FROM user WHERE id=?', array($intermediaire[0]));
61        $user['path'][$url_id] = $user['info']['fname'];
62}
63else
64        $user['relation_type'] = 'members';
65
66
67
68/************** menu ***************************/
69$leftmenu["/profile/$url_id"] = 'Profile';
70
71if($user['info']['nb_photos'] > 0)
72        $leftmenu["/album/$url_id"] = 'Album';
73
74if($user['info']['nb_blogs'] > 0)
75        $leftmenu["/blog/$url_id"] = 'Blog';
76
77if($user['info']['nb_bookmarks'] > 0)
78        $leftmenu["/bookmarks/$url_id"] = 'Bookmarks';
79
80$_SMARTY['leftmenu'] = $leftmenu;
81
82/************************************************/
83$_SMARTY['tr_attr'] = array("class='odd' style='vertical-align:top'", "class='even' style='vertical-align:top'");
84$_SMARTY['user'] =  $user;
85$_SMARTY['fans'] =  $fans;
86
87?>
Note: See TracBrowser for help on using the browser.