Suggestions::delete PHP Method

delete() public method

public delete ( $id )
    public function delete($id)
    {
        if ($this->user->getClass() < User::CLASS_ADMIN) {
            throw new Exception(L::get("PERMISSION_DENIED"), 401);
        }
        $sth = $this->db->prepare("DELETE FROM suggestions WHERE id = ?");
        $sth->bindParam(1, $id, PDO::PARAM_INT);
        $sth->execute();
        $sth = $this->db->prepare("DELETE FROM suggestions_votes WHERE suggestionId = ?");
        $sth->bindParam(1, $id, PDO::PARAM_INT);
        $sth->execute();
    }

Usage Example

コード例 #1
0
ファイル: api-v1.php プロジェクト: swetorrentking/rartracker
     $arr = $suggestions->vote($params[1], $postdata["direction"]);
     httpResponse($arr);
     break;
 case validateRoute('POST', 'suggestions'):
     $forum = new Forum($db, $user);
     $suggestions = new Suggestions($db, $user, $forum);
     httpResponse($suggestions->create($postdata));
     break;
 case validateRoute('PATCH', 'suggestions/\\d+'):
     $forum = new Forum($db, $user);
     $suggestions = new Suggestions($db, $user, $forum);
     httpResponse($suggestions->update($params[1], $postdata));
     break;
 case validateRoute('DELETE', 'suggestions/\\d+'):
     $suggestions = new Suggestions($db, $user);
     httpResponse($suggestions->delete($params[1]));
     break;
 case validateRoute('GET', 'sweTvGuide'):
     $week = (int) $_GET["week"];
     $cacheId = 'swetvguide-' . $week;
     if ($memcached && ($cached = $memcached->get($cacheId))) {
         if ($week == 0) {
             $user->updateLastTorrentViewAccess('last_tvbrowse');
         }
         httpResponse($cached);
     } else {
         $torrent = new Torrent($db, $user);
         if ($week > 3) {
             $week = 4;
         }
         $array = array();