Ejemplo n.º 1
0
 /**	 
  * vote for a content
  * @param string $format
  * @param string $content
  * @param string $vote
  * @return string xml/json
  */
 private function contentvote($format, $content, $vote)
 {
     $user = $this->checkpassword(true);
     $this->checktrafficlimit($user);
     $con = new OCSContent();
     // fetch data
     $content = addslashes($content);
     $vote = addslashes($vote);
     // check data
     if (!$con->load($content)) {
         $txt = $this->generatexml($format, 'failed', 101, 'content not found');
     } else {
         if ($user != '') {
             $con->set_score($vote);
         }
         $txt = $this->generatexml($format, 'ok', 100, '');
     }
     echo $txt;
 }