]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
incorrect use of match results
authorEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 04:02:24 +0000 (23:02 -0500)
committerEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 04:02:24 +0000 (23:02 -0500)
darcs-hash:20081124040224-84dde-ca5e732949bf2f837b4d99f7fe705f0fd74b9a48.gz

lib/util.php

index 44ed185fe44c8e8e4a8bcb7289daaedd08ae00a9..36030c77ce845caa08a8451a6fa1fb3fc7790d55 100644 (file)
@@ -1326,24 +1326,26 @@ function common_save_replies($notice) {
                        $replied[$recipient->id] = 1;
                }
        }
+       
        # Hash format replies, too
        $cnt = preg_match_all('/(?:^|\s)@#([a-z0-9]{1,64})/', $notice->content, $match);
-       foreach ($match as $tag) {
-               $tagged = Profile_tag::getTagged($sender->id, $tag);
-               foreach ($tagged as $t) {
-                       if (!$replied[$t->id]) {
-                               $reply = new Reply();
-                               $reply->notice_id = $notice->id;
-                               $reply->profile_id = $t->id;
-                               $id = $reply->insert();
-                               if (!$id) {
-                                       common_log_db_error($reply, 'INSERT', __FILE__);
-                                       return;
+       if ($cnt) {
+               foreach ($match[1] as $tag) {
+                       $tagged = Profile_tag::getTagged($sender->id, $tag);
+                       foreach ($tagged as $t) {
+                               if (!$replied[$t->id]) {
+                                       $reply = new Reply();
+                                       $reply->notice_id = $notice->id;
+                                       $reply->profile_id = $t->id;
+                                       $id = $reply->insert();
+                                       if (!$id) {
+                                               common_log_db_error($reply, 'INSERT', __FILE__);
+                                               return;
+                                       }
                                }
                        }
                }
        }
-       
 }
 
 function common_broadcast_notice($notice, $remote=false) {