aboutsummaryrefslogtreecommitdiffstats
path: root/mod/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-29 16:50:42 -0700
committerfriendica <info@friendica.com>2012-05-29 16:50:42 -0700
commit21d79e787ef6a1fd183a4f439c2488110841b530 (patch)
tree37af0898bb3ef5f39384d98aeae409a476b41aed /mod/network.php
parent419cf91aae555f6e42767765f476b1f1cc85e5df (diff)
parent43c185ce04051caa0ae7543d635fa0b015befc58 (diff)
downloadvolse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.tar.gz
volse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.tar.bz2
volse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.zip
Merge https://github.com/friendica/friendica into pull
Conflicts: mod/search.php
Diffstat (limited to 'mod/network.php')
-rw-r--r--mod/network.php38
1 files changed, 29 insertions, 9 deletions
diff --git a/mod/network.php b/mod/network.php
index fbfe2de4f..7c4c1ac04 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -402,10 +402,22 @@ function network_content(&$a, $update = 0) {
if(x($_GET,'search')) {
$search = escape_tags($_GET['search']);
- $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ",
- dbesc(protect_sprintf('%' . $search . '%')),
- dbesc(protect_sprintf('%]' . $search . '[%'))
- );
+ if (get_config('system','use_fulltext_engine')) {
+ if(strpos($search,'#') === 0)
+ $sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ",
+ dbesc(protect_sprintf($search))
+ );
+ else
+ $sql_extra .= sprintf(" AND (MATCH(`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ",
+ dbesc(protect_sprintf($search)),
+ dbesc(protect_sprintf($search))
+ );
+ } else {
+ $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ",
+ dbesc(protect_sprintf('%' . $search . '%')),
+ dbesc(protect_sprintf('%]' . $search . '[%'))
+ );
+ }
}
if(strlen($file)) {
$sql_extra .= file_tag_file_query('item',unxmlify($file));
@@ -416,11 +428,19 @@ function network_content(&$a, $update = 0) {
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace('www.','',$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
- $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' )) ",
- dbesc(protect_sprintf('%' . $myurl)),
- dbesc(protect_sprintf('%' . $myurl . ']%')),
- dbesc(protect_sprintf('%' . $diasp_url . ']%'))
- );
+ 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))) ",
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($diasp_url))
+ );
+ 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' )) ",
+ dbesc(protect_sprintf('%' . $myurl)),
+ dbesc(protect_sprintf('%' . $myurl . ']%')),
+ dbesc(protect_sprintf('%' . $diasp_url . ']%'))
+ );
+
}
if($update) {