| 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 | |
|---|
| 28 | $topic['info'] = $db->getRow('SELECT id_comm, id , title, sticky FROM community_topic WHERE id_topic=?', array($token[2])); |
|---|
| 29 | |
|---|
| 30 | $community['info'] = $db->getRow('SELECT id_comm, id, name, description, moderated, country, date, nb_members FROM community WHERE id_comm=?', array($topic['info']['id_comm'])); |
|---|
| 31 | $community['logo'] = build_logo_url($community['info']['id'], $topic['info']['id_comm']); |
|---|
| 32 | |
|---|
| 33 | $posts_r = $db->query('SELECT id_post, id, author, title, message, date FROM community_post WHERE id_topic=? ORDER BY date ASC', $token[2]); |
|---|
| 34 | while($post = $posts_r->fetchRow()) |
|---|
| 35 | { |
|---|
| 36 | $topic['posts'][$post['id_post']] = $post; |
|---|
| 37 | $topic['posts'][$post['id_post']]['author_photo'] = build_thumb_url($post['id']); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | $leftmenu["/communities/view/".$community['info']['id_comm']] = 'Return to community'; |
|---|
| 42 | $leftmenu["/communities/forum/".$community['info']['id_comm']] = 'View forum'; |
|---|
| 43 | $leftmenu["/communities/events/".$community['info']['id_comm']] = 'View events'; |
|---|
| 44 | |
|---|
| 45 | $_SMARTY['leftmenu'] = $leftmenu; |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | if($_SESSION['my_communities_id']) |
|---|
| 49 | { |
|---|
| 50 | if( in_array($community['info']['id_comm'], $_SESSION['my_communities_id']) ) |
|---|
| 51 | { |
|---|
| 52 | $db->query('UPDATE user_comm SET last_visit=? WHERE id=? AND id_comm=?', array(time(), $_SESSION['my_id'], $community['info']['id_comm'])); |
|---|
| 53 | $_SMARTY['is_member'] = true; |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | $_SMARTY['community'] = $community; |
|---|
| 58 | $_SMARTY['topic'] = $topic; |
|---|
| 59 | } |
|---|
| 60 | ?> |
|---|