root/trunk/inc/communities/forum.inc.php

Revision 14, 2.7 KB (checked in by alexx, 7 years ago)

* fix #16 (add include of country list)
* fux bug in owned communities ("New Topic/event" not displayed)
* fix sample db data
* change strstr to strpos in includes/functions.inc.php (strpos is faster)

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
25if(is_numeric($token[2]) )
26{
27    $community['info'] = $db->getRow('SELECT  id_comm, id, community.name as name, community.description as description, moderated, country, date, nb_members, community_cat.name as category FROM community LEFT JOIN community_cat USING(id_cat) WHERE id_comm=?', array($token[2]));
28    $community['logo'] = build_logo_url($community['info']['id'], $token[2]);
29
30
31    $topic_r = $db->query('SELECT id_topic, title, id, author, nb_posts, last_post_date FROM community_topic WHERE id_comm=? ORDER BY date DESC LIMIT 100', $token[2]);
32        while($topic = $topic_r->fetchRow())
33                $community['topics'][$topic['id_topic']] = $topic;
34
35    /************* menu *******************/
36
37    $leftmenu["/communities/view/".$community['info']['id_comm']] = 'Return to community';
38
39    if($_SESSION['my_id'] != $community['info']['id'])
40        if(in_array($community['info']['id_comm'], $_SESSION['my_communities_id']) )
41        {
42            $leftmenu["/communities/unjoin/".$token[2]] = 'Unjoin';
43            $_SMARTY['is_member'] = 1;
44        }
45        else
46        {
47            $leftmenu["/communities/join/".$token[2]] = 'Join';
48            $_SMARTY['is_member'] = 0;
49        }
50    else
51    {
52        $leftmenu["/communities/edit/".$token[2]] = 'Edit';   
53        $_SMARTY['is_member'] = 1;
54    }
55
56    $leftmenu["/communities/events/".$token[2]] = 'View events';
57    $leftmenu["/communities/invite/".$token[2]] = 'Invite friends';
58
59    $_SMARTY['leftmenu'] = $leftmenu;
60
61
62    /************************************/
63
64
65
66    $_SMARTY['Title'] = 'Community';
67   
68
69    if($_SMARTY['is_member'])
70        $db->query('UPDATE user_comm SET last_visit=? WHERE id=? AND id_comm=?', array(time(), $_SESSION['my_id'], $community['info']['id_comm']));
71
72    $_SMARTY['community'] = $community;
73}
74else
75{
76    header('Location: /communities');
77    exit();
78}
79?>
Note: See TracBrowser for help on using the browser.