| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | if(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 | |
|---|
| 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 | } |
|---|
| 72 | else |
|---|
| 73 | { |
|---|
| 74 | header('Location: /communities'); |
|---|
| 75 | exit(); |
|---|
| 76 | } |
|---|
| 77 | ?> |
|---|