diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/item.php | 12 | ||||
-rw-r--r-- | mod/photos.php | 13 | ||||
-rw-r--r-- | mod/search.php | 3 |
3 files changed, 25 insertions, 3 deletions
diff --git a/mod/item.php b/mod/item.php index 0e855d54d..2c8704a31 100644 --- a/mod/item.php +++ b/mod/item.php @@ -407,7 +407,17 @@ function item_post(&$a) { else { $newname = $name; $alias = ''; - if(strstr($name,'_') || strstr($name,' ')) { + $tagcid = 0; + if(strrpos($newname,'+')) + $tagcid = intval(substr($newname,strrpos($newname,'+') + 1)); + + if($tagcid) { + $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($tagcid), + intval($profile_uid) + ); + } + elseif(strstr($name,'_') || strstr($name,' ')) { $newname = str_replace('_',' ',$name); $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", dbesc($newname), diff --git a/mod/photos.php b/mod/photos.php index 663d0a40c..63bd46a6c 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -408,7 +408,18 @@ function photos_post(&$a) { } else { $newname = $name; - if(strstr($name,'_') || strstr($name,' ')) { + $alias = ''; + $tagcid = 0; + if(strrpos($newname,'+')) + $tagcid = intval(substr($newname,strrpos($newname,'+') + 1)); + + if($tagcid) { + $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($tagcid), + intval($profile_uid) + ); + } + elseif(strstr($name,'_') || strstr($name,' ')) { $newname = str_replace('_',' ',$name); $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", dbesc($newname), diff --git a/mod/search.php b/mod/search.php index e2c365fd3..819100204 100644 --- a/mod/search.php +++ b/mod/search.php @@ -96,10 +96,11 @@ function search_content(&$a) { // Only public wall posts can be shown // OR your own posts if you are a logged in member + $escaped_search = str_replace(array('[',']'),array('\\[','\\]'),$search); // $s_bool = sprintf("AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )", dbesc($search)); $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", - dbesc($search), dbesc('\\]' . $search . '\\[')); + dbesc($escaped_search), dbesc('\\]' . $escaped_search . '\\[')); // if(mb_strlen($search) >= 3) // $search_alg = $s_bool; |