mirror of
https://github.com/friendica/friendica
synced 2024-12-23 08:00:16 +00:00
Merge pull request #4160 from annando/community
We now are having a global items page
This commit is contained in:
commit
6e71a84075
10 changed files with 213 additions and 76 deletions
3
boot.php
3
boot.php
|
@ -228,9 +228,10 @@ define('ACCOUNT_TYPE_COMMUNITY', 3);
|
||||||
* Type of the community page
|
* Type of the community page
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
define('CP_NO_COMMUNITY_PAGE', -1);
|
define('CP_NO_COMMUNITY_PAGE', -1);
|
||||||
define('CP_USERS_ON_SERVER', 0);
|
define('CP_USERS_ON_SERVER', 0);
|
||||||
define('CP_GLOBAL_COMMUNITY', 1);
|
define('CP_GLOBAL_COMMUNITY', 1);
|
||||||
|
define('CP_USERS_AND_GLOBAL', 2);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -490,7 +490,6 @@ function item_condition() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function conversation(App $a, $items, $mode, $update, $preview = false) {
|
function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
|
|
||||||
require_once 'include/bbcode.php';
|
require_once 'include/bbcode.php';
|
||||||
require_once 'mod/proxy.php';
|
require_once 'mod/proxy.php';
|
||||||
|
|
||||||
|
@ -575,10 +574,14 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
. " var profile_page = 1; </script>";
|
. " var profile_page = 1; </script>";
|
||||||
}
|
}
|
||||||
} elseif ($mode === 'community') {
|
} elseif ($mode === 'community') {
|
||||||
|
if (!$community_readonly) {
|
||||||
|
$items = community_add_items($items);
|
||||||
|
}
|
||||||
$profile_owner = 0;
|
$profile_owner = 0;
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$live_update_div = '<div id="live-community"></div>' . "\r\n"
|
$live_update_div = '<div id="live-community"></div>' . "\r\n"
|
||||||
. "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
. "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 10)
|
||||||
|
."/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||||
}
|
}
|
||||||
} elseif ($mode === 'search') {
|
} elseif ($mode === 'search') {
|
||||||
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
||||||
|
@ -613,14 +616,25 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
$page_template = get_markup_template("conversation.tpl");
|
$page_template = get_markup_template("conversation.tpl");
|
||||||
|
|
||||||
if ($items && count($items)) {
|
if ($items && count($items)) {
|
||||||
|
$community_readonly = ($mode === 'community');
|
||||||
|
|
||||||
// Currently behind a config value. This allows the commenting and sharing of every public item.
|
// Currently behind a config value. This allows the commenting and sharing of every public item.
|
||||||
if (Config::get('system', 'comment_public') && local_user()) {
|
if (Config::get('system', 'comment_public')) {
|
||||||
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA));
|
if ($mode === 'community') {
|
||||||
|
$community_readonly = false;
|
||||||
|
$writable = true;
|
||||||
|
} else {
|
||||||
|
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$writable = false;
|
$writable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
|
if (!local_user()) {
|
||||||
|
$writable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode === 'network-new' || $mode === 'search' || $community_readonly) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "New Item View" on network page or search page results
|
* "New Item View" on network page or search page results
|
||||||
|
@ -891,6 +905,55 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add comments to top level entries that had been fetched before
|
||||||
|
*
|
||||||
|
* The system will fetch the comments for the local user whenever possible.
|
||||||
|
* This behaviour is currently needed to allow commenting on Friendica posts.
|
||||||
|
*
|
||||||
|
* @param array $parents Parent items
|
||||||
|
*
|
||||||
|
* @return array items with parents and comments
|
||||||
|
*/
|
||||||
|
function community_add_items($parents) {
|
||||||
|
$max_comments = Config::get("system", "max_comments", 100);
|
||||||
|
|
||||||
|
$items = array();
|
||||||
|
|
||||||
|
foreach ($parents AS $parent) {
|
||||||
|
$thread_items = dba::p(item_query()." AND `item`.`uid` = ?
|
||||||
|
AND `item`.`parent-uri` = ?
|
||||||
|
ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
|
||||||
|
local_user(),
|
||||||
|
$parent['uri']
|
||||||
|
);
|
||||||
|
$comments = dba::inArray($thread_items);
|
||||||
|
|
||||||
|
if (count($comments) == 0) {
|
||||||
|
$thread_items = dba::p(item_query()." AND `item`.`uid` = 0
|
||||||
|
AND `item`.`parent-uri` = ?
|
||||||
|
ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
|
||||||
|
$parent['uri']
|
||||||
|
);
|
||||||
|
$comments = dba::inArray($thread_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($comments) != 0) {
|
||||||
|
$items = array_merge($items, $comments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($items as $index => $item) {
|
||||||
|
if ($item['uid'] == 0) {
|
||||||
|
$items[$index]['writable'] = in_array($item['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = conv_sort($items, "`commented`");
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
function best_link_url($item, &$sparkle, $url = '') {
|
function best_link_url($item, &$sparkle, $url = '') {
|
||||||
|
|
||||||
$best_url = '';
|
$best_url = '';
|
||||||
|
|
|
@ -147,10 +147,10 @@ function nav_info(App $a)
|
||||||
if (strlen($gdir)) {
|
if (strlen($gdir)) {
|
||||||
$gdirpath = zrl($gdir, true);
|
$gdirpath = zrl($gdir, true);
|
||||||
}
|
}
|
||||||
} elseif (Config::get('system', 'community_page_style') == CP_USERS_ON_SERVER) {
|
}
|
||||||
$nav['community'] = array('community', t('Community'), '', t('Conversations on this site'));
|
|
||||||
} elseif (Config::get('system', 'community_page_style') == CP_GLOBAL_COMMUNITY) {
|
if (local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) {
|
||||||
$nav['community'] = array('community', t('Community'), '', t('Conversations on the network'));
|
$nav['community'] = array('community', t('Community'), '', t('Conversations on this and other servers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
|
@ -230,6 +230,7 @@ function nav_info(App $a)
|
||||||
function nav_set_selected($item){
|
function nav_set_selected($item){
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$a->nav_sel = array(
|
$a->nav_sel = array(
|
||||||
|
'global' => null,
|
||||||
'community' => null,
|
'community' => null,
|
||||||
'network' => null,
|
'network' => null,
|
||||||
'home' => null,
|
'home' => null,
|
||||||
|
|
|
@ -1176,7 +1176,8 @@ function admin_page_site(App $a)
|
||||||
$community_page_style_choices = array(
|
$community_page_style_choices = array(
|
||||||
CP_NO_COMMUNITY_PAGE => t("No community page"),
|
CP_NO_COMMUNITY_PAGE => t("No community page"),
|
||||||
CP_USERS_ON_SERVER => t("Public postings from users of this site"),
|
CP_USERS_ON_SERVER => t("Public postings from users of this site"),
|
||||||
CP_GLOBAL_COMMUNITY => t("Global community page")
|
CP_GLOBAL_COMMUNITY => t("Public postings from the federated network"),
|
||||||
|
CP_USERS_AND_GLOBAL => t("Public postings from local users and the federated network")
|
||||||
);
|
);
|
||||||
|
|
||||||
/* OStatus conversation poll choices */
|
/* OStatus conversation poll choices */
|
||||||
|
@ -1311,7 +1312,7 @@ function admin_page_site(App $a)
|
||||||
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), Config::get('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
|
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), Config::get('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
|
||||||
'$no_openid' => array('no_openid', t("OpenID support"), !Config::get('system','no_openid'), t("OpenID support for registration and logins.")),
|
'$no_openid' => array('no_openid', t("OpenID support"), !Config::get('system','no_openid'), t("OpenID support for registration and logins.")),
|
||||||
'$no_regfullname' => array('no_regfullname', t("Fullname check"), !Config::get('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
|
'$no_regfullname' => array('no_regfullname', t("Fullname check"), !Config::get('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
|
||||||
'$community_page_style' => array('community_page_style', t("Community Page Style"), Config::get('system','community_page_style'), t("Type of community page to show. 'Global community' shows every public posting from an open distributed network that arrived on this server."), $community_page_style_choices),
|
'$community_page_style' => array('community_page_style', t("Community pages for visitors"), Config::get('system','community_page_style'), t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices),
|
||||||
'$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
|
'$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
|
||||||
'$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
|
'$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
|
||||||
'$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
|
'$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
|
||||||
function community_init(App $a) {
|
function community_init(App $a) {
|
||||||
if (! local_user()) {
|
if (!local_user()) {
|
||||||
unset($_SESSION['theme']);
|
unset($_SESSION['theme']);
|
||||||
unset($_SESSION['mobile-theme']);
|
unset($_SESSION['mobile-theme']);
|
||||||
}
|
}
|
||||||
|
@ -14,44 +15,102 @@ function community_init(App $a) {
|
||||||
function community_content(App $a, $update = 0) {
|
function community_content(App $a, $update = 0) {
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if ((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
|
if (Config::get('system','block_public') && !local_user() && !remote_user()) {
|
||||||
notice( t('Public access denied.') . EOL);
|
notice(t('Public access denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::get('system','community_page_style') == CP_NO_COMMUNITY_PAGE) {
|
$page_style = Config::get('system','community_page_style');
|
||||||
notice( t('Not available.') . EOL);
|
|
||||||
|
if ($a->argc > 1) {
|
||||||
|
$content = $a->argv[1];
|
||||||
|
} else {
|
||||||
|
// When only the global community is allowed, we use this as default
|
||||||
|
$content = $page_style == CP_GLOBAL_COMMUNITY ? 'global' : 'local';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($content, ['local', 'global'])) {
|
||||||
|
notice(t('Community option not available.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once("include/bbcode.php");
|
// Check if we are allowed to display the content to visitors
|
||||||
require_once('include/security.php');
|
if (!local_user()) {
|
||||||
require_once('include/conversation.php');
|
$available = $page_style == CP_USERS_AND_GLOBAL;
|
||||||
|
|
||||||
|
if (!$available) {
|
||||||
|
$available = ($page_style == CP_USERS_ON_SERVER) && ($content == 'local');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$available) {
|
||||||
|
$available = ($page_style == CP_GLOBAL_COMMUNITY) && ($content == 'global');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$available) {
|
||||||
|
notice(t('Not available.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'include/bbcode.php';
|
||||||
|
require_once 'include/security.php';
|
||||||
|
require_once 'include/conversation.php';
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
$tabs = [];
|
||||||
|
|
||||||
|
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) {
|
||||||
|
$tabs[] = array('label'=>t('Community'),
|
||||||
|
'url' => 'community/local',
|
||||||
|
'sel' => $content == 'local' ? 'active' : '',
|
||||||
|
'title' => t('Posts from local users on this server'),
|
||||||
|
'id' => 'community-local-tab',
|
||||||
|
'accesskey' => 'l');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
||||||
|
$tabs[] = array('label' => t('Global Timeline'),
|
||||||
|
'url' => 'community/global',
|
||||||
|
'sel' => $content == 'global' ? 'active' : '',
|
||||||
|
'title' => t('Posts from users of the federated network'),
|
||||||
|
'id' => 'community-global-tab',
|
||||||
|
'accesskey' => 'g');
|
||||||
|
}
|
||||||
|
|
||||||
|
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||||
|
$o .= replace_macros($tab_tpl, array('$tabs' => $tabs));
|
||||||
|
|
||||||
if (! $update) {
|
|
||||||
nav_set_selected('community');
|
nav_set_selected('community');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($a->data,'search')) {
|
if (Config::get('system', 'comment_public')) {
|
||||||
$search = notags(trim($a->data['search']));
|
// check if we serve a mobile device and get the user settings
|
||||||
} else {
|
// accordingly
|
||||||
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
|
if ($a->is_mobile) {
|
||||||
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_mobile_network', 20);
|
||||||
|
} else {
|
||||||
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now that we have the user settings, see if the theme forces
|
||||||
|
// a maximum item number which is lower then the user choice
|
||||||
|
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
||||||
|
$itemspage_network = $a->force_max_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
$a->set_pager_itemspage($itemspage_network);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here is the way permissions work in this module...
|
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
|
||||||
// Only public posts can be shown
|
|
||||||
// OR your own posts if you are a logged in member
|
|
||||||
|
|
||||||
$r = community_getitems($a->pager['start'], $a->pager['itemspage']);
|
if (!DBM::is_result($r)) {
|
||||||
|
info(t('No results.') . EOL);
|
||||||
if (! DBM::is_result($r)) {
|
|
||||||
info( t('No results.') . EOL);
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxpostperauthor = Config::get('system','max_author_posts_community_page');
|
$maxpostperauthor = Config::get('system','max_author_posts_community_page');
|
||||||
|
|
||||||
if ($maxpostperauthor != 0) {
|
if (($maxpostperauthor != 0) && ($content == 'local')) {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$previousauthor = "";
|
$previousauthor = "";
|
||||||
$numposts = 0;
|
$numposts = 0;
|
||||||
|
@ -70,53 +129,52 @@ function community_content(App $a, $update = 0) {
|
||||||
$s[] = $item;
|
$s[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((sizeof($s) < $a->pager['itemspage'])) {
|
if (sizeof($s) < $a->pager['itemspage']) {
|
||||||
$r = community_getitems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage']);
|
$r = community_getitems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage'], $content);
|
||||||
}
|
}
|
||||||
} while ((sizeof($s) < $a->pager['itemspage']) && (++$count < 50) && (sizeof($r) > 0));
|
} while ((sizeof($s) < $a->pager['itemspage']) && (++$count < 50) && (sizeof($r) > 0));
|
||||||
} else {
|
} else {
|
||||||
$s = $r;
|
$s = $r;
|
||||||
}
|
}
|
||||||
// we behave the same in message lists as the search module
|
|
||||||
|
|
||||||
$o .= conversation($a, $s, 'community', $update);
|
$o .= conversation($a, $s, 'community', $update);
|
||||||
|
|
||||||
$o .= alt_pager($a, count($r));
|
if (!$update) {
|
||||||
|
$o .= alt_pager($a, count($r));
|
||||||
|
}
|
||||||
|
|
||||||
$t = get_markup_template("community.tpl");
|
$t = get_markup_template("community.tpl");
|
||||||
return replace_macros($t, array(
|
return replace_macros($t, array(
|
||||||
'$content' => $o,
|
'$content' => $o,
|
||||||
'$header' => t("Community"),
|
'$header' => '',
|
||||||
'$show_global_community_hint' => (Config::get('system', 'community_page_style') == CP_GLOBAL_COMMUNITY && Config::get('system', 'show_global_community_hint')),
|
'$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'),
|
||||||
'$global_community_hint' => t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
|
'$global_community_hint' => t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function community_getitems($start, $itemspage) {
|
function community_getitems($start, $itemspage, $content) {
|
||||||
if (Config::get('system','community_page_style') == CP_GLOBAL_COMMUNITY) {
|
if ($content == 'local') {
|
||||||
return(community_getpublicitems($start, $itemspage));
|
$r = dba::p("SELECT ".item_fieldlists()." FROM `thread`
|
||||||
|
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
||||||
|
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||||
|
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||||
|
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''".
|
||||||
|
item_joins()." AND `contact`.`self`
|
||||||
|
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
||||||
|
AND NOT `thread`.`private` AND `thread`.`wall`
|
||||||
|
ORDER BY `thread`.`received` DESC LIMIT ".intval($start).", ".intval($itemspage)
|
||||||
|
);
|
||||||
|
return dba::inArray($r);
|
||||||
|
} elseif ($content == 'global') {
|
||||||
|
$r = dba::p("SELECT ".item_fieldlists()." FROM `thread`
|
||||||
|
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` ".item_joins().
|
||||||
|
"WHERE `thread`.`uid` = 0 AND `verb` = ?
|
||||||
|
ORDER BY `thread`.`created` DESC LIMIT ".intval($start).", ".intval($itemspage),
|
||||||
|
ACTIVITY_POST
|
||||||
|
);
|
||||||
|
return dba::inArray($r);
|
||||||
}
|
}
|
||||||
$r = dba::p("SELECT ".item_fieldlists()." FROM `thread`
|
|
||||||
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
|
||||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
|
||||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
|
||||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''".
|
|
||||||
item_joins()." AND `contact`.`self`
|
|
||||||
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
|
||||||
AND NOT `thread`.`private` AND `thread`.`wall`
|
|
||||||
ORDER BY `thread`.`received` DESC LIMIT ".intval($start).", ".intval($itemspage)
|
|
||||||
);
|
|
||||||
|
|
||||||
return dba::inArray($r);
|
// Should never happen
|
||||||
}
|
return array();
|
||||||
|
|
||||||
function community_getpublicitems($start, $itemspage) {
|
|
||||||
$r = dba::p("SELECT ".item_fieldlists()." FROM `thread`
|
|
||||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` ".item_joins().
|
|
||||||
"WHERE `thread`.`uid` = 0 AND `verb` = ?
|
|
||||||
ORDER BY `thread`.`created` DESC LIMIT ".intval($start).", ".intval($itemspage),
|
|
||||||
ACTIVITY_POST
|
|
||||||
);
|
|
||||||
|
|
||||||
return dba::inArray($r);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,16 @@ use Friendica\Core\PConfig;
|
||||||
require_once("mod/community.php");
|
require_once("mod/community.php");
|
||||||
|
|
||||||
function update_community_content(App $a) {
|
function update_community_content(App $a) {
|
||||||
|
|
||||||
header("Content-type: text/html");
|
header("Content-type: text/html");
|
||||||
echo "<!DOCTYPE html><html><body>\r\n";
|
echo "<!DOCTYPE html><html><body>\r\n";
|
||||||
echo "<section>";
|
echo "<section>";
|
||||||
|
|
||||||
$text = community_content($a, true);
|
if ($_GET["force"] == 1) {
|
||||||
|
$text = community_content($a, true);
|
||||||
|
} else {
|
||||||
|
$text = '';
|
||||||
|
}
|
||||||
|
|
||||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||||
$replace = "<img\${1} dst=\"\${2}\"";
|
$replace = "<img\${1} dst=\"\${2}\"";
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
@ -34,4 +38,4 @@ function update_community_content(App $a) {
|
||||||
echo "</section>";
|
echo "</section>";
|
||||||
echo "</body></html>\r\n";
|
echo "</body></html>\r\n";
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,6 +285,12 @@ class Post extends BaseObject
|
||||||
if ($shareable) {
|
if ($shareable) {
|
||||||
$buttons['share'] = array(t('Share this'), t('share'));
|
$buttons['share'] = array(t('Share this'), t('share'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a contact isn't writable, we cannot send a like or dislike to it
|
||||||
|
if (!$item['writable']) {
|
||||||
|
unset($buttons["like"]);
|
||||||
|
unset($buttons["dislike"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment = $this->getCommentBox($indent);
|
$comment = $this->getCommentBox($indent);
|
||||||
|
|
|
@ -66,6 +66,10 @@ class Thread extends BaseObject
|
||||||
$this->profile_owner = $a->profile['uid'];
|
$this->profile_owner = $a->profile['uid'];
|
||||||
$this->writable = can_write_wall($a, $this->profile_owner) || $writable;
|
$this->writable = can_write_wall($a, $this->profile_owner) || $writable;
|
||||||
break;
|
break;
|
||||||
|
case 'community':
|
||||||
|
$this->profile_owner = local_user();
|
||||||
|
$this->writable = $writable;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logger('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', LOGGER_DEBUG);
|
logger('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,26 +19,27 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $nav.community}}
|
{{if $nav.community}}
|
||||||
<li id="nav-community-link" class="nav-menu {{$sel.community}}">
|
<li id="nav-community-link" class="nav-menu {{$sel.community}}">
|
||||||
<a class="{{$nav.community.2}}" href="{{$nav.community.0}}" title="{{$nav.community.3}}" >{{$nav.community.1}}</a>
|
<a class="{{$nav.community.2}}" href="{{$nav.community.0}}" title="{{$nav.community.3}}" >{{$nav.community.1}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $nav.network}}
|
{{if $nav.network}}
|
||||||
<li id="nav-network-link" class="nav-menu {{$sel.network}}">
|
<li id="nav-network-link" class="nav-menu {{$sel.network}}">
|
||||||
<a accesskey="n" class="{{$nav.network.2}}" href="{{$nav.network.0}}" title="{{$nav.network.3}}" >{{$nav.network.1}}</a>
|
<a accesskey="n" class="{{$nav.network.2}}" href="{{$nav.network.0}}" title="{{$nav.network.3}}" >{{$nav.network.1}}</a>
|
||||||
<span id="net-update" class="nav-notify"></span>
|
<span id="net-update" class="nav-notify"></span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $nav.home}}
|
{{if $nav.home}}
|
||||||
<li id="nav-home-link" class="nav-menu {{$sel.home}}">
|
<li id="nav-home-link" class="nav-menu {{$sel.home}}">
|
||||||
<a accesskey="p" class="{{$nav.home.2}}" href="{{$nav.home.0}}" title="{{$nav.home.3}}" >{{$nav.home.1}}</a>
|
<a accesskey="p" class="{{$nav.home.2}}" href="{{$nav.home.0}}" title="{{$nav.home.3}}" >{{$nav.home.1}}</a>
|
||||||
<span id="home-update" class="nav-notify"></span>
|
<span id="home-update" class="nav-notify"></span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $nav.introductions}}
|
{{if $nav.introductions}}
|
||||||
<li id="nav-introductions-link" class="nav-menu-icon {{$sel.introductions}}">
|
<li id="nav-introductions-link" class="nav-menu-icon {{$sel.introductions}}">
|
||||||
<a class="{{$nav.introductions.2}}" href="{{$nav.introductions.0}}" title="{{$nav.introductions.3}}" >
|
<a class="{{$nav.introductions.2}}" href="{{$nav.introductions.0}}" title="{{$nav.introductions.3}}" >
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
<span id="intro-update" class="nav-notify"></span>
|
<span id="intro-update" class="nav-notify"></span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $nav.messages}}
|
{{if $nav.messages}}
|
||||||
<li id="nav-messages-link" class="nav-menu-icon {{$sel.messages}}">
|
<li id="nav-messages-link" class="nav-menu-icon {{$sel.messages}}">
|
||||||
<a class="{{$nav.messages.2}}" href="{{$nav.messages.0}}" title="{{$nav.messages.3}}" >
|
<a class="{{$nav.messages.2}}" href="{{$nav.messages.0}}" title="{{$nav.messages.3}}" >
|
||||||
|
@ -57,8 +58,6 @@
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{if $nav.notifications}}
|
{{if $nav.notifications}}
|
||||||
<li id="nav-notifications-linkmenu" class="nav-menu-icon"><a accesskey="f" href="{{$nav.notifications.0}}" rel="#nav-notifications-menu" title="{{$nav.notifications.1}}"><span class="icon s22 notify">{{$nav.notifications.1}}</span></a>
|
<li id="nav-notifications-linkmenu" class="nav-menu-icon"><a accesskey="f" href="{{$nav.notifications.0}}" rel="#nav-notifications-menu" title="{{$nav.notifications.1}}"><span class="icon s22 notify">{{$nav.notifications.1}}</span></a>
|
||||||
<span id="notify-update" class="nav-notify"></span>
|
<span id="notify-update" class="nav-notify"></span>
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
{{if $nav.network}}<li><a id="nav-network-link" class="nav-commlink {{$nav.network.2}}" href="{{$nav.network.0}}">{{$nav.network.1}}</a></li>{{/if}}
|
{{if $nav.network}}<li><a id="nav-network-link" class="nav-commlink {{$nav.network.2}}" href="{{$nav.network.0}}">{{$nav.network.1}}</a></li>{{/if}}
|
||||||
|
|
||||||
{{if $nav.community}}
|
{{if $nav.community}}
|
||||||
<li><a id="nav-community-link" class="nav-commlink {{$nav.community.2}}" href="{{$nav.community.0}}">{{$nav.community.1}}</a></li>
|
<li><a id="nav-community-link" class="nav-commlink {{$nav.community.2}}" href="{{$nav.community.0}}">{{$nav.community.1}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<li><a id="nav-search-link" class="nav-link {{$nav.search.2}}" href="{{$nav.search.0}}">{{$nav.search.1}}</a></li>
|
<li><a id="nav-search-link" class="nav-link {{$nav.search.2}}" href="{{$nav.search.0}}">{{$nav.search.1}}</a></li>
|
||||||
<li><a id="nav-directory-link" class="nav-link {{$nav.directory.2}}" href="{{$nav.directory.0}}">{{$nav.directory.1}}</a></li>
|
<li><a id="nav-directory-link" class="nav-link {{$nav.directory.2}}" href="{{$nav.directory.0}}">{{$nav.directory.1}}</a></li>
|
||||||
|
|
Loading…
Reference in a new issue