module cleanup
This commit is contained in:
parent
18cedf4def
commit
591f10e235
@ -52,7 +52,6 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
$datequery = $datequery2 = '';
|
||||
|
||||
$group = 0;
|
||||
@ -68,8 +67,11 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
if($datequery)
|
||||
$_GET['order'] = 'post';
|
||||
|
||||
|
||||
// filter by collection (e.g. group)
|
||||
|
||||
if($gid) {
|
||||
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($gid),
|
||||
intval(local_user())
|
||||
);
|
||||
@ -89,7 +91,6 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
$o = '';
|
||||
|
||||
|
||||
|
||||
// if no tabs are selected, defaults to comments
|
||||
|
||||
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
|
||||
@ -150,7 +151,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
|
||||
$sql_options = (($star)
|
||||
? " and (item_flags & " . intval(ITEM_STARRED) . ")>0"
|
||||
? " and (item_flags & " . intval(ITEM_STARRED) . ") > 0"
|
||||
: '');
|
||||
|
||||
$sql_nets = '';
|
||||
@ -184,7 +185,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
elseif($cid) {
|
||||
|
||||
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and not ( abook_flags & " . intval(ABOOK_FLAG_BLOCKED) . ")>0 limit 1",
|
||||
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and not ( abook_flags & " . intval(ABOOK_FLAG_BLOCKED) . ") > 0 limit 1",
|
||||
intval($cid),
|
||||
intval(local_user())
|
||||
);
|
||||
@ -208,7 +209,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
$firehose = 0;
|
||||
|
||||
$o .= '<div id="live-network"></div>' . "\r\n";
|
||||
$o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; var profile_page = " . $a->pager['page'] . ";</script>";
|
||||
$o .= "<script> var profile_uid = " . local_user() . "; var profile_page = " . $a->pager['page'] . ";</script>";
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
|
||||
'$baseurl' => z_root(),
|
||||
@ -246,25 +247,27 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
|
||||
}
|
||||
|
||||
$sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` ");
|
||||
$sql_extra2 = (($nouveau) ? '' : " AND item.parent = item.id ");
|
||||
$sql_extra3 = (($nouveau) ? '' : $sql_extra3);
|
||||
|
||||
if(x($_GET,'search')) {
|
||||
$search = escape_tags($_GET['search']);
|
||||
if(strpos($search,'#') === 0)
|
||||
if(strpos($search,'#') === 0) {
|
||||
$sql_extra .= term_query('item',substr($search,1),TERM_HASHTAG);
|
||||
else
|
||||
$sql_extra .= sprintf(" AND `item`.`body` like '%s' ",
|
||||
}
|
||||
else {
|
||||
$sql_extra .= sprintf(" AND item.body like '%s' ",
|
||||
dbesc(protect_sprintf('%' . $search . '%'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($file)) {
|
||||
$sql_extra .= term_query('item',$file,TERM_FILE);
|
||||
}
|
||||
|
||||
if($conv) {
|
||||
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d )>0)) ",
|
||||
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d ) > 0)) ",
|
||||
dbesc(protect_sprintf($channel['channel_hash'])),
|
||||
intval(ITEM_MENTIONSME)
|
||||
);
|
||||
@ -314,7 +317,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
$uids = " and item.uid = " . local_user() . " ";
|
||||
}
|
||||
|
||||
$simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " )>0 " : '');
|
||||
$simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : '');
|
||||
|
||||
// This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day
|
||||
// or three and look at your matrix page - after opening up your browser. The first page loads just as it
|
||||
@ -336,11 +339,11 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
if($nouveau && $load) {
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, received FROM `item`
|
||||
$items = q("SELECT item.*, item.id AS item_id, received FROM item
|
||||
WHERE true $uids AND item_restrict = 0
|
||||
$simple_update
|
||||
$sql_extra $sql_nets
|
||||
ORDER BY `item`.`received` DESC $pager_sql "
|
||||
ORDER BY item.received DESC $pager_sql "
|
||||
);
|
||||
|
||||
require_once('include/items.php');
|
||||
@ -354,9 +357,9 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
// Normal conversation view
|
||||
|
||||
if($order === 'post')
|
||||
$ordering = "`created`";
|
||||
$ordering = "created";
|
||||
else
|
||||
$ordering = "`commented`";
|
||||
$ordering = "commented";
|
||||
|
||||
if($load) {
|
||||
|
||||
@ -396,9 +399,9 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
$parents_str = ids_to_querystr($r,'item_id');
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
||||
WHERE true $uids AND `item`.`item_restrict` = 0
|
||||
AND `item`.`parent` IN ( %s )
|
||||
$items = q("SELECT item.*, item.id AS item_id FROM item
|
||||
WHERE true $uids AND item.item_restrict = 0
|
||||
AND item.parent IN ( %s )
|
||||
$sql_extra ",
|
||||
dbesc($parents_str)
|
||||
);
|
||||
@ -417,8 +420,8 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
}
|
||||
|
||||
if(($update_unseen) && (! $firehose))
|
||||
$r = q("UPDATE `item` SET item_flags = ( item_flags & ~%d)
|
||||
WHERE (item_flags & %d)>0 AND `uid` = %d $update_unseen ",
|
||||
$r = q("UPDATE item SET item_flags = ( item_flags & ~%d)
|
||||
WHERE (item_flags & %d) > 0 AND uid = %d $update_unseen ",
|
||||
intval(ITEM_UNSEEN),
|
||||
intval(ITEM_UNSEEN),
|
||||
intval(local_user())
|
||||
|
Reference in New Issue
Block a user