X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=339efc92db5750a075851e428424615aea91686e;hb=836058c47745f502890a209dfd6efcb3596ace84;hp=b9bad6405928097c2ce328ea693f08a0cd025826;hpb=ea06a1ec4584c298a1d71c139bed196a0e54dcec;p=friendica.git diff --git a/mod/search.php b/mod/search.php index b9bad64059..339efc92db 100644 --- a/mod/search.php +++ b/mod/search.php @@ -7,7 +7,7 @@ function search_saved_searches() { if(! feature_enabled(local_user(),'savedsearch')) return $o; - $r = q("select `id`,`term` from `search` WHERE `uid` = %d", + $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d", intval(local_user()) ); @@ -15,11 +15,11 @@ function search_saved_searches() { $saved = array(); foreach($r as $rr) { $saved[] = array( - 'id' => $rr['id'], - 'term' => $rr['term'], - 'encodedterm' => urlencode($rr['term']), - 'delete' => t('Remove term'), - 'selected' => ($search==$rr['term']), + 'id' => $rr['id'], + 'term' => $rr['term'], + 'encodedterm' => urlencode($rr['term']), + 'delete' => t('Remove term'), + 'selected' => ($search==$rr['term']), ); } @@ -27,10 +27,10 @@ function search_saved_searches() { $tpl = get_markup_template("saved_searches_aside.tpl"); $o .= replace_macros($tpl, array( - '$title' => t('Saved Searches'), - '$add' => '', - '$searchbox' => '', - '$saved' => $saved, + '$title' => t('Saved Searches'), + '$add' => '', + '$searchbox' => '', + '$saved' => $saved, )); } @@ -45,12 +45,12 @@ function search_init(&$a) { if(local_user()) { if(x($_GET,'save') && $search) { - $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1", + $r = q("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1", intval(local_user()), dbesc($search) ); if(! count($r)) { - q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ", + q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')", intval(local_user()), dbesc($search) ); @@ -135,7 +135,7 @@ function search_content(&$a) { if($tag) { logger("Start tag search for '".$search."'", LOGGER_DEBUG); - $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, + $r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` @@ -156,7 +156,7 @@ function search_content(&$a) { $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search)))); } - $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, + $r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` @@ -177,9 +177,13 @@ function search_content(&$a) { if($tag) - $o .= '

Items tagged with: ' . $search . '

'; + $title = sprintf( t('Items tagged with: %s'), $search); else - $o .= '

Search results for: ' . $search . '

'; + $title = sprintf( t('Search results for: %s'), $search); + + $o .= replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => $title + )); logger("Start Conversation for '".$search."'", LOGGER_DEBUG); $o .= conversation($a,$r,'search',false);