module cleanup

This commit is contained in:
friendica 2014-11-16 19:08:10 -08:00
parent 18cedf4def
commit 591f10e235

View File

@ -52,7 +52,6 @@ function network_content(&$a, $update = 0, $load = false) {
} }
$datequery = $datequery2 = ''; $datequery = $datequery2 = '';
$group = 0; $group = 0;
@ -68,8 +67,11 @@ function network_content(&$a, $update = 0, $load = false) {
if($datequery) if($datequery)
$_GET['order'] = 'post'; $_GET['order'] = 'post';
// filter by collection (e.g. group)
if($gid) { 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($gid),
intval(local_user()) intval(local_user())
); );
@ -89,7 +91,6 @@ function network_content(&$a, $update = 0, $load = false) {
$o = ''; $o = '';
// if no tabs are selected, defaults to comments // if no tabs are selected, defaults to comments
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0); $cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
@ -208,7 +209,7 @@ function network_content(&$a, $update = 0, $load = false) {
$firehose = 0; $firehose = 0;
$o .= '<div id="live-network"></div>' . "\r\n"; $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( $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(), '$baseurl' => z_root(),
@ -246,18 +247,20 @@ 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_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); $sql_extra3 = (($nouveau) ? '' : $sql_extra3);
if(x($_GET,'search')) { if(x($_GET,'search')) {
$search = escape_tags($_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); $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 . '%')) dbesc(protect_sprintf('%' . $search . '%'))
); );
} }
}
if(strlen($file)) { if(strlen($file)) {
$sql_extra .= term_query('item',$file,TERM_FILE); $sql_extra .= term_query('item',$file,TERM_FILE);
@ -336,11 +339,11 @@ function network_content(&$a, $update = 0, $load = false) {
if($nouveau && $load) { if($nouveau && $load) {
// "New Item View" - show all items unthreaded in reverse created date order // "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 WHERE true $uids AND item_restrict = 0
$simple_update $simple_update
$sql_extra $sql_nets $sql_extra $sql_nets
ORDER BY `item`.`received` DESC $pager_sql " ORDER BY item.received DESC $pager_sql "
); );
require_once('include/items.php'); require_once('include/items.php');
@ -354,9 +357,9 @@ function network_content(&$a, $update = 0, $load = false) {
// Normal conversation view // Normal conversation view
if($order === 'post') if($order === 'post')
$ordering = "`created`"; $ordering = "created";
else else
$ordering = "`commented`"; $ordering = "commented";
if($load) { if($load) {
@ -396,9 +399,9 @@ function network_content(&$a, $update = 0, $load = false) {
$parents_str = ids_to_querystr($r,'item_id'); $parents_str = ids_to_querystr($r,'item_id');
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` $items = q("SELECT item.*, item.id AS item_id FROM item
WHERE true $uids AND `item`.`item_restrict` = 0 WHERE true $uids AND item.item_restrict = 0
AND `item`.`parent` IN ( %s ) AND item.parent IN ( %s )
$sql_extra ", $sql_extra ",
dbesc($parents_str) dbesc($parents_str)
); );
@ -417,8 +420,8 @@ function network_content(&$a, $update = 0, $load = false) {
} }
if(($update_unseen) && (! $firehose)) if(($update_unseen) && (! $firehose))
$r = q("UPDATE `item` SET item_flags = ( item_flags & ~%d) $r = q("UPDATE item SET item_flags = ( item_flags & ~%d)
WHERE (item_flags & %d)>0 AND `uid` = %d $update_unseen ", WHERE (item_flags & %d) > 0 AND uid = %d $update_unseen ",
intval(ITEM_UNSEEN), intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN), intval(ITEM_UNSEEN),
intval(local_user()) intval(local_user())