4 function community_content(&$a, $update = 0) {
8 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
9 notice( t('Public access denied.') . EOL);
13 if(get_config('system','no_community_page')) {
14 notice( t('Not available.') . EOL);
18 require_once("include/bbcode.php");
19 require_once('include/security.php');
20 require_once('include/conversation.php');
22 if(x($_SESSION,'theme'))
23 unset($_SESSION['theme']);
26 $o .= '<h3>' . t('Community') . '</h3>';
28 $o .= '<script> $(document).ready(function() { $(\'#nav-community-link\').addClass(\'nav-selected\'); });</script>';
29 $o .= '<div id="live-community"></div>' . "\r\n";
30 $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
33 if(x($a->data,'search'))
34 $search = notags(trim($a->data['search']));
36 $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
39 // Here is the way permissions work in this module...
40 // Only public wall posts can be shown
41 // OR your own posts if you are a logged in member
44 $r = q("SELECT COUNT(*) AS `total`
45 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
46 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
47 AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
48 AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0
49 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 "
53 $a->set_pager_total($r[0]['total']);
55 if(! $r[0]['total']) {
56 info( t('No results.') . EOL);
60 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
61 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
62 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
63 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
64 `user`.`nickname`, `user`.`hidewall`
65 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
66 LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
67 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
68 AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
69 AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0
70 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
71 ORDER BY `received` DESC LIMIT %d, %d ",
72 intval($a->pager['start']),
73 intval($a->pager['itemspage'])
77 // we behave the same in message lists as the search module
79 $o .= conversation($a,$r,'community',false);
83 $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';