Ejemplo n.º 1
0
 function save($notice, $result)
 {
     $orig = null;
     $score = Spam_score::staticGet('notice_id', $notice->id);
     if (empty($score)) {
         $score = new Spam_score();
     } else {
         $orig = clone $score;
     }
     $score->notice_id = $notice->id;
     $score->score = $result->probability;
     $score->is_spam = $result->isSpam;
     $score->scaled = Spam_score::scale($score->score);
     $score->created = common_sql_now();
     $score->notice_created = $notice->created;
     if (empty($orig)) {
         $score->insert();
     } else {
         $score->update($orig);
     }
     self::blow('spam_score:notice_ids');
     return $score;
 }
Ejemplo n.º 2
0
 function onEndNoticeInScope($notice, $profile, &$bResult)
 {
     if ($this->hideSpam) {
         if ($bResult) {
             $score = Spam_score::staticGet('notice_id', $notice->id);
             if (!empty($score) && $score->is_spam) {
                 if (empty($profile) || $profile->id !== $notice->profile_id && !$profile->hasRight(self::REVIEWSPAM)) {
                     $bResult = false;
                 }
             }
         }
     }
     return true;
 }