1
1
Fork 0

Searching for tags has been enabled in all places. The tag detection has been improved for imports with missing line feeds.

This commit is contained in:
Michael Vogel 2013-01-13 17:13:01 +01:00
parent b9afb38f4d
commit 5501dd0759
6 changed files with 112 additions and 51 deletions

View file

@ -523,7 +523,26 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$tags=array(); $tags=array();
$hashtags = array(); $hashtags = array();
$mentions = array(); $mentions = array();
foreach(explode(',',$item['tag']) as $tag){
$taglist = q("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` IN (%d, %d)",
intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION));
foreach($taglist as $tag) {
if ($tag["url"] == "")
$tag["url"] = $searchpath.strtolower($tag["term"]);
if ($tag["type"] == TERM_HASHTAG) {
$hashtags[] = "#<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
$prefix = "#";
} elseif ($tag["type"] == TERM_MENTION) {
$mentions[] = "@<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
$prefix = "@";
}
$tags[] = $prefix."<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
}
/*foreach(explode(',',$item['tag']) as $tag){
$tag = trim($tag); $tag = trim($tag);
if ($tag!="") { if ($tag!="") {
$t = bbcode($tag); $t = bbcode($tag);
@ -533,7 +552,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
elseif($t[0] == '@') elseif($t[0] == '@')
$mentions[] = $t; $mentions[] = $t;
} }
} }*/
$sp = false; $sp = false;
$profile_link = best_link_url($item,$sp); $profile_link = best_link_url($item,$sp);

View file

@ -89,7 +89,7 @@ class dba {
if(x($a->config,'system') && x($a->config['system'],'db_log')) { if(x($a->config,'system') && x($a->config['system'],'db_log')) {
$stamp2 = microtime(true); $stamp2 = microtime(true);
$duration = round($stamp2-$stamp1, 3); $duration = round($stamp2-$stamp1, 3);
if ($duration > $a->config["system"]["db_loglimit"]) { if (($duration > $a->config["system"]["db_loglimit"])) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log"], $duration."\t". @file_put_contents($a->config["system"]["db_log"], $duration."\t".
basename($backtrace[1]["file"])."\t". basename($backtrace[1]["file"])."\t".

View file

@ -918,7 +918,7 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure. * Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.
* Examples: $array = xml2array(file_get_contents('feed.xml')); * Examples: $array = xml2array(file_get_contents('feed.xml'));
* $array = xml2array(file_get_contents('feed.xml', true, 1, 'attribute')); * $array = xml2array(file_get_contents('feed.xml', true, 1, 'attribute'));
*/ */
function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = 'attribute') { function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = 'attribute') {
if(!$contents) return array(); if(!$contents) return array();
@ -976,7 +976,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
$result = array(); $result = array();
$attributes_data = array(); $attributes_data = array();
if(isset($value)) { if(isset($value)) {
if($priority == 'tag') $result = $value; if($priority == 'tag') $result = $value;
else $result['value'] = $value; // Put the value in a assoc array if we are in the 'Attribute' mode else $result['value'] = $value; // Put the value in a assoc array if we are in the 'Attribute' mode
@ -992,7 +992,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
// See tag status and do the needed. // See tag status and do the needed.
if($namespaces && strpos($tag,':')) { if($namespaces && strpos($tag,':')) {
$namespc = substr($tag,0,strrpos($tag,':')); $namespc = substr($tag,0,strrpos($tag,':'));
$tag = strtolower(substr($tag,strlen($namespc)+1)); $tag = strtolower(substr($tag,strlen($namespc)+1));
$result['@namespace'] = $namespc; $result['@namespace'] = $namespc;
} }
@ -1015,7 +1015,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
} else { // This section will make the value an array if multiple tags with the same name appear together } else { // This section will make the value an array if multiple tags with the same name appear together
$current[$tag] = array($current[$tag],$result); // This will combine the existing item and the new item together to make an array $current[$tag] = array($current[$tag],$result); // This will combine the existing item and the new item together to make an array
$repeated_tag_index[$tag.'_'.$level] = 2; $repeated_tag_index[$tag.'_'.$level] = 2;
if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well
$current[$tag]['0_attr'] = $current[$tag.'_attr']; $current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']); unset($current[$tag.'_attr']);
@ -1038,7 +1038,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
// ...push the new element into that array. // ...push the new element into that array.
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
if($priority == 'tag' and $get_attributes and $attributes_data) { if($priority == 'tag' and $get_attributes and $attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
} }
@ -1049,11 +1049,11 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
$repeated_tag_index[$tag.'_'.$level] = 1; $repeated_tag_index[$tag.'_'.$level] = 1;
if($priority == 'tag' and $get_attributes) { if($priority == 'tag' and $get_attributes) {
if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well
$current[$tag]['0_attr'] = $current[$tag.'_attr']; $current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']); unset($current[$tag.'_attr']);
} }
if($attributes_data) { if($attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
} }
@ -1066,6 +1066,6 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
$current = &$parent[$level-1]; $current = &$parent[$level-1];
} }
} }
return($xml_array); return($xml_array);
} }

View file

@ -562,11 +562,12 @@ function get_tags($s) {
$ret = array(); $ret = array();
// ignore anything in a code block // ignore anything in a code block
$s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s); $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
// ignore anything in a bbtag // Force line feeds at bbtags
$s = str_replace(array("[", "]"), array("\n[", "]\n"), $s);
// ignore anything in a bbtag
$s = preg_replace('/\[(.*?)\]/sm','',$s); $s = preg_replace('/\[(.*?)\]/sm','',$s);
// Match full names against @tags including the space between first and last // Match full names against @tags including the space between first and last

View file

@ -160,16 +160,26 @@ function content_content(&$a, $update = 0) {
$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);
$sql_table = "`item`";
if(x($_GET,'search')) { if(x($_GET,'search')) {
$search = escape_tags($_GET['search']); $search = escape_tags($_GET['search']);
if (get_config('system','use_fulltext_engine')) {
if(strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
if (get_config('system','only_tag_search'))
$tag = true;
/*if (get_config('system','use_fulltext_engine')) {
if(strpos($search,'#') === 0) if(strpos($search,'#') === 0)
$sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ", $sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('%s' in boolean mode)) ",
dbesc(protect_sprintf($search)) dbesc(protect_sprintf($search))
); );
else else
$sql_extra .= sprintf(" AND (MATCH(`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ", $sql_extra .= sprintf(" AND (MATCH(`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode)) ",
dbesc(protect_sprintf($search)), dbesc(protect_sprintf($search)),
dbesc(protect_sprintf($search)) dbesc(protect_sprintf($search))
); );
@ -178,7 +188,19 @@ function content_content(&$a, $update = 0) {
dbesc(protect_sprintf('%' . $search . '%')), dbesc(protect_sprintf('%' . $search . '%')),
dbesc(protect_sprintf('%]' . $search . '[%')) dbesc(protect_sprintf('%]' . $search . '[%'))
); );
}*/
if($tag) {
$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
} else {
if (get_config('system','use_fulltext_engine'))
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
else
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
} }
} }
if(strlen($file)) { if(strlen($file)) {
$sql_extra .= file_tag_file_query('item',unxmlify($file)); $sql_extra .= file_tag_file_query('item',unxmlify($file));
@ -189,38 +211,39 @@ function content_content(&$a, $update = 0) {
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace('www.','',$myurl); $myurl = str_replace('www.','',$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl);
if (get_config('system','use_fulltext_engine')) /*if (get_config('system','use_fulltext_engine'))
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where (MATCH(`author-link`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(`tag`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode))) ", $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from $sql_table where (MATCH(`author-link`, `tag`) AGAINST ('%s' in boolean mode) or MATCH(tag) AGAINST ('%s' in boolean mode))) ",
dbesc(protect_sprintf($myurl)), dbesc(protect_sprintf($myurl)),
dbesc(protect_sprintf($myurl)), dbesc(protect_sprintf($myurl)),
dbesc(protect_sprintf($diasp_url)) dbesc(protect_sprintf($diasp_url))
); );
else else
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ", $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from $sql_table where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ",
dbesc(protect_sprintf('%' . $myurl)), dbesc(protect_sprintf('%' . $myurl)),
dbesc(protect_sprintf('%' . $myurl . ']%')), dbesc(protect_sprintf('%' . $myurl . ']%')),
dbesc(protect_sprintf('%' . $diasp_url . ']%')) dbesc(protect_sprintf('%' . $diasp_url . ']%'))
); );*/
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where `author-link` IN ('https://%s', 'http://%s') OR `mention`)",
dbesc(protect_sprintf($myurl)),
dbesc(protect_sprintf($myurl))
);
} }
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
if($nouveau) { if($nouveau) {
// "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`, $items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 WHERE `item`.`uid` = %d AND `item`.`visible` = 1
AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
$simple_update $simple_update
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra $sql_nets $sql_extra $sql_nets
ORDER BY `item`.`received` DESC $pager_sql ", ORDER BY `item`.`received` DESC $pager_sql ",
@ -241,7 +264,7 @@ function content_content(&$a, $update = 0) {
$start = dba_timer(); $start = dba_timer();
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid` $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` = `item`.`id` AND `item`.`parent` = `item`.`id`
@ -268,9 +291,9 @@ function content_content(&$a, $update = 0) {
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`moderated` = 0 AND `contact`.`id` = `item`.`contact-id` AND `item`.`moderated` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` IN ( %s ) AND `item`.`parent` IN ( %s )
$sql_extra ", $sql_extra ",
@ -287,7 +310,7 @@ function content_content(&$a, $update = 0) {
} }
} }
logger('parent dba_timer: ' . sprintf('%01.4f',$first - $start)); logger('parent dba_timer: ' . sprintf('%01.4f',$first - $start));
logger('child dba_timer: ' . sprintf('%01.4f',$second - $first)); logger('child dba_timer: ' . sprintf('%01.4f',$second - $first));
@ -298,7 +321,7 @@ function content_content(&$a, $update = 0) {
$o = render_content($a,$items,$mode,false); $o = render_content($a,$items,$mode,false);
header('Content-type: application/json'); header('Content-type: application/json');
echo json_encode($o); echo json_encode($o);
killme(); killme();

View file

@ -6,7 +6,7 @@ function network_init(&$a) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
$is_a_date_query = false; $is_a_date_query = false;
if($a->argc > 1) { if($a->argc > 1) {
@ -17,12 +17,12 @@ function network_init(&$a) {
} }
} }
} }
// convert query string to array and remove first element (which is friendica args) // convert query string to array and remove first element (which is friendica args)
$query_array = array(); $query_array = array();
parse_str($a->query_string, $query_array); parse_str($a->query_string, $query_array);
array_shift($query_array); array_shift($query_array);
// fetch last used network view and redirect if needed // fetch last used network view and redirect if needed
if(! $is_a_date_query) { if(! $is_a_date_query) {
$sel_tabs = network_query_get_sel_tab($a); $sel_tabs = network_query_get_sel_tab($a);
@ -141,11 +141,11 @@ function network_init(&$a) {
if(x($_GET['nets']) && $_GET['nets'] === 'all') if(x($_GET['nets']) && $_GET['nets'] === 'all')
unset($_GET['nets']); unset($_GET['nets']);
$group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0);
set_pconfig(local_user(), 'network.view', 'group.selected', $group_id); set_pconfig(local_user(), 'network.view', 'group.selected', $group_id);
require_once('include/group.php'); require_once('include/group.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
require_once('include/items.php'); require_once('include/items.php');
@ -500,7 +500,7 @@ function network_content(&$a, $update = 0) {
$contact_id = $a->cid; $contact_id = $a->cid;
@ -645,16 +645,26 @@ function network_content(&$a, $update = 0) {
$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);
$sql_table = "`item`";
if(x($_GET,'search')) { if(x($_GET,'search')) {
$search = escape_tags($_GET['search']); $search = escape_tags($_GET['search']);
if (get_config('system','use_fulltext_engine')) {
if(strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
if (get_config('system','only_tag_search'))
$tag = true;
/*if (get_config('system','use_fulltext_engine')) {
if(strpos($search,'#') === 0) if(strpos($search,'#') === 0)
$sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ", $sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ",
dbesc(protect_sprintf($search)) dbesc(protect_sprintf($search))
); );
else else
$sql_extra .= sprintf(" AND (MATCH(`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ", $sql_extra .= sprintf(" AND (MATCH(`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode)) ",
dbesc(protect_sprintf($search)), dbesc(protect_sprintf($search)),
dbesc(protect_sprintf($search)) dbesc(protect_sprintf($search))
); );
@ -663,6 +673,17 @@ function network_content(&$a, $update = 0) {
dbesc(protect_sprintf('%' . $search . '%')), dbesc(protect_sprintf('%' . $search . '%')),
dbesc(protect_sprintf('%]' . $search . '[%')) dbesc(protect_sprintf('%]' . $search . '[%'))
); );
}*/
if($tag) {
$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
} else {
if (get_config('system','use_fulltext_engine'))
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
else
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
} }
} }
if(strlen($file)) { if(strlen($file)) {
@ -689,9 +710,7 @@ function network_content(&$a, $update = 0) {
dbesc(protect_sprintf('%' . $diasp_url . ']%')) dbesc(protect_sprintf('%' . $diasp_url . ']%'))
);*/ );*/
//$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where `author-link` IN ('https://%s', 'http://%s') OR `mention`)", $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where `author-link` IN ('https://%s', 'http://%s') OR `mention`)",
//$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where `mention`)",
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where `author-link` IN ('https://%s', 'http://%s'))",
dbesc(protect_sprintf($myurl)), dbesc(protect_sprintf($myurl)),
dbesc(protect_sprintf($myurl)) dbesc(protect_sprintf($myurl))
); );
@ -706,7 +725,7 @@ function network_content(&$a, $update = 0) {
else { else {
if( (! get_config('alt_pager', 'global')) && (! get_pconfig(local_user(),'system','alt_pager')) ) { if( (! get_config('alt_pager', 'global')) && (! get_pconfig(local_user(),'system','alt_pager')) ) {
$r = q("SELECT COUNT(*) AS `total` $r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra2 $sql_extra3 $sql_extra2 $sql_extra3
@ -737,11 +756,10 @@ function network_content(&$a, $update = 0) {
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 WHERE `item`.`uid` = %d AND `item`.`visible` = 1
AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
$simple_update $simple_update
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra $sql_nets $sql_extra $sql_nets
ORDER BY `item`.`received` DESC $pager_sql ", ORDER BY `item`.`received` DESC $pager_sql ",
@ -764,7 +782,7 @@ function network_content(&$a, $update = 0) {
if($update) { if($update) {
$r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid` $r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "') (`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
and `item`.`moderated` = 0 and `item`.`unseen` = 1 and `item`.`moderated` = 0 and `item`.`unseen` = 1
@ -775,7 +793,7 @@ function network_content(&$a, $update = 0) {
} }
else { else {
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid` $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` = `item`.`id` AND `item`.`parent` = `item`.`id`
@ -800,9 +818,9 @@ function network_content(&$a, $update = 0) {
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact` FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`moderated` = 0 AND `contact`.`id` = `item`.`contact-id` AND `item`.`moderated` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` IN ( %s ) AND `item`.`parent` IN ( %s )
$sql_extra ", $sql_extra ",
@ -824,7 +842,7 @@ function network_content(&$a, $update = 0) {
// We aren't going to try and figure out at the item, group, and page // We aren't going to try and figure out at the item, group, and page
// level which items you've seen and which you haven't. If you're looking // level which items you've seen and which you haven't. If you're looking
// at the top level network page just mark everything seen. // at the top level network page just mark everything seen.
// The $update_unseen is a bit unreliable if you have stuff coming into your stream from a new contact - // The $update_unseen is a bit unreliable if you have stuff coming into your stream from a new contact -
// and other feeds that bring in stuff from the past. One can't find it all. // and other feeds that bring in stuff from the past. One can't find it all.