root/trunk/inc/communities/events.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        $event_r = $db->query('SELECT id_event, title, date_event, city, country FROM community_event WHERE id_comm=? AND date_event>? ORDER BY date_event LIMIT 5', array($token[2], time()));
32        while($event = $event_r->fetchRow())
33                $community['events'][$event['id_event']] = $event;
34
35
36    /************* menu *******************/
37
38    $leftmenu["/communities/view/".$community['info']['id_comm']] = 'Return to community';
39
40    if($_SESSION['my_id'] != $community['info']['id'])
41        if(in_array($community['info']['id_comm'], $_SESSION['my_communities_id']) )
42        {
43            $leftmenu["/communities/unjoin/".$token[2]] = 'Unjoin';
44            $_SMARTY['is_member'] = 1;
45        }
46        else
47        {
48            $leftmenu["/communities/join/".$token[2]] = 'Join';
49            $_SMARTY['id_member'] = 0;
50        }
51    else
52    {
53        $leftmenu["/communities/edit/".$token[2]] = 'Edit';   
54        $_SMARTY['is_member'] = 1;
55    }
56
57    $leftmenu["/communities/forum/".$token[2]] = 'View forum';
58    $leftmenu["/communities/invite/".$token[2]] = 'Invite friends';
59
60    $_SMARTY['leftmenu'] = $leftmenu;
61
62    /************************************/
63
64
65    $_SMARTY['Title'] = 'Community';
66
67        if($_SMARTY['is_member'])
68        $db->query('UPDATE user_comm SET last_visit=? WHERE id=? AND id_comm=?', array(time(), $_SESSION['my_id'], $community['info']['id_comm']));
69
70    $_SMARTY['community'] = $community;
71}
72else
73{
74    header('Location: /communities');
75    exit();
76}
77?>
Note: See TracBrowser for help on using the browser.