Ejemplo n.º 1
0
 /**
  * (Web service method) Undo vote for current track (for this nick)
  * @param  mixed[] $args nick
  * @return mixed[] status; error_message; output (what to announce in IRC chat room)
  */
 private function web_undo_vote($args)
 {
     $nick = $args['nick'];
     $vote = Vote::get_undoable_vote($nick);
     $opt = Options::get_instance();
     if ($vote == NULL) {
         $this->fail($nick . ': Can\'t delete last vote if it is over 10 minutes old.');
     }
     if ($vote->deleted == 1) {
         $this->fail($nick . ': Your most recent vote has already been deleted.');
     }
     Vote::delete($vote->id);
     Track::update_vote($vote->track_id);
     $out = str_ireplace('${stream_title}', $vote->stream_title, $opt->txt_unvote_response);
     $out = str_ireplace('${nick}', $nick, $out);
     $out = str_ireplace('${value}', $num_txt, $out);
     return array('status' => 'ok', 'error_message' => '', 'output' => $out, 'private' => $opt->txt_unvote_response_switch);
 }