Exemplo n.º 1
0
 function insert_vote($user = 0, $value = 10)
 {
     global $anon_karma;
     require_once mnminclude . 'votes.php';
     if (!is_numeric($this->id)) {
         return false;
     }
     $vote = new Vote();
     $vote->type = 'comments';
     $vote->user = $user;
     $vote->link = $this->id;
     $vote->value = $value;
     if ($vote->insert()) {
         $vote = new Vote();
         $vote->type = 'comments';
         $vote->link = $this->id;
         $this->votes = $vote->count() - $vote->count('<0');
         if (comment_buries_spam > 0 && $vote->count_all("<0") >= comment_buries_spam) {
             $this->status = 'discard';
             $this->store();
             $vars = array('comment_id' => $this->id);
             check_actions('comment_spam', $vars);
             require_once mnminclude . 'link.php';
             $link = new Link();
             $link->id = $this->link;
             $link->read();
             $link->recalc_comments();
             $link->store();
         }
         $vars = array('vote' => $this);
         check_actions('comment_insert_vote_post', $vars);
         return $vote->sum();
     }
     return false;
 }
Exemplo n.º 2
0
 function insert_vote($user = 0, $value = 10)
 {
     global $anon_karma;
     require_once mnminclude . 'votes.php';
     if (!is_numeric($this->id)) {
         return false;
     }
     $vote = new Vote();
     $vote->type = 'comments';
     $vote->user = $user;
     $vote->link = $this->id;
     $vote->value = $value;
     if ($vote->insert()) {
         $vote = new Vote();
         $vote->type = 'comments';
         $vote->link = $this->id;
         $this->votes = $vote->count();
         $vars = array('vote' => $this);
         check_actions('comment_insert_vote_post', $vars);
         return $vote->sum();
     }
     return false;
 }
Exemplo n.º 3
0
 function insert_vote($user = 0, $value = 10)
 {
     global $anon_karma;
     require_once mnminclude . 'votes.php';
     $vote = new Vote();
     $vote->type = 'comments';
     $vote->user = $user;
     $vote->link = $this->id;
     $vote->value = $value;
     if ($vote->insert()) {
         $vote = new Vote();
         $vote->type = 'comments';
         $vote->link = $this->id;
         $this->votes = $vote->count();
         return $vote->sum();
     }
     return false;
 }
Exemplo n.º 4
0
 function insert_vote($user = 0, $value = 10)
 {
     global $anon_karma;
     require_once mnminclude . 'votes.php';
     if ($value > 10) {
         $value = 10;
     }
     $vote = new Vote();
     $vote->type = 'links';
     $vote->user = $user;
     $vote->link = $this->id;
     $vote->value = $value;
     if ($value < 10) {
         $vote->value = $anon_karma / 10 * $value;
     }
     if ($user > 0) {
         require_once mnminclude . 'user.php';
         $dbuser = new User($user);
         if ($dbuser->id > 0) {
             if ($value < 10) {
                 $vote->value = $dbuser->karma / 10 * $value;
             }
         }
     } else {
         if (!anonymous_vote) {
             return;
         }
     }
     if ($vote->insert()) {
         $vote = new Vote();
         $vote->type = 'links';
         $vote->link = $this->id;
         if (Voting_Method == 1) {
             $this->votes = $vote->sum();
         }
         if (Voting_Method == 2) {
             $this->votes = $vote->rating();
             $this->votecount = $vote->sum();
         }
         $this->store_basic();
         /*********
         			//
         			// check karma
         			//
         			***********/
         $this->check_should_publish();
         return true;
     }
     return false;
 }