some tagging fixes - including old bugs which were never reported

This commit is contained in:
friendica 2014-02-03 19:54:32 -08:00
parent 876f5d4de0
commit 9ce3dac479
2 changed files with 6 additions and 6 deletions

View File

@ -442,7 +442,7 @@ function item_message_id() {
$mid = $hash . '@' . get_app()->get_hostname(); $mid = $hash . '@' . get_app()->get_hostname();
$r = q("SELECT `id` FROM `item` WHERE `mid` = '%s' LIMIT 1", $r = q("SELECT id FROM item WHERE mid = '%s' LIMIT 1",
dbesc($mid)); dbesc($mid));
if(count($r)) if(count($r))
$dups = true; $dups = true;
@ -459,7 +459,7 @@ function photo_new_resource() {
do { do {
$found = false; $found = false;
$resource = hash('md5',uniqid(mt_rand(),true)); $resource = hash('md5',uniqid(mt_rand(),true));
$r = q("SELECT `id` FROM `photo` WHERE `resource_id` = '%s' LIMIT 1", $r = q("SELECT id FROM photo WHERE resource_id = '%s' LIMIT 1",
dbesc($resource) dbesc($resource)
); );
if(count($r)) if(count($r))
@ -1651,10 +1651,10 @@ function item_post_type($item) {
function undo_post_tagging($s) { function undo_post_tagging($s) {
$matches = null; $matches = null;
$cnt = preg_match_all('/([@#])\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER); $cnt = preg_match_all('/([@#])(\!*)\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s); $s = str_replace($mtch[0], $mtch[1] . $mtch[2] . str_replace(' ','_',$mtch[4]),$s);
} }
} }
return $s; return $s;

View File

@ -972,7 +972,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$newname = str_replace('_',' ',$name); $newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name //select someone from this user's contacts by name
$r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1", WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
dbesc($newname), dbesc($newname),
intval($profile_uid) intval($profile_uid)
@ -980,7 +980,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
if(! $r) { if(! $r) {
//select someone by attag or nick and the name passed in //select someone by attag or nick and the name passed in
$r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_addr like ('%s') AND abook_channel = %d LIMIT 1", WHERE xchan_addr like ('%s') AND abook_channel = %d LIMIT 1",
dbesc($newname . '@%'), dbesc($newname . '@%'),
intval($profile_uid) intval($profile_uid)