function delete($params)
 {
     if (Lms_User::getUser()->isAllowed($params["table"], 'delete')) {
         $dbProvider = new Lms_DataToolkit_Provider();
         $result = $dbProvider->delete($params["dbalias"], $params["table"], $params["conditions"]);
         return new Lms_Api_Response(200, 'OK', $result);
     } else {
         return new Lms_Api_Response(403, 'Forbidden');
     }
 }
 function setAcl($acl)
 {
     self::$_acl = $acl;
 }
 public static function getRandomText($params)
 {
     try {
         $db = Lms_Db::get('main');
         $user = Lms_User::getUser();
         return new Lms_Api_Response(200, null, $result);
     } catch (Exception $e) {
         return new Lms_Api_Response(500, $e->getMessage());
     }
 }
 public static function hitFilm($filmId)
 {
     if ($filmId) {
         $db = Lms_Db::get('main');
         $method = self::getConfig('hitmethod');
         switch ($method) {
             case 1:
                 $db->query('UPDATE films SET Hit=Hit+1 WHERE films.ID=?', $filmId);
                 break;
             case 2:
                 $ip = ip2long(Lms_Ip::getIp());
                 $c = $db->selectCell("SELECT count(*) FROM hits WHERE FilmID=?d AND UserID=?d", $filmId, $ip);
                 if ($c == 0) {
                     $db->query("INSERT INTO hits(FilmID,UserID,DateHit) VALUES(?d, ?d, NOW())", $filmId, $ip);
                     $db->query("UPDATE films SET Hit=Hit+1 WHERE films.ID=?d", $filmId);
                 }
                 break;
             case 3:
                 if (!isset($_SESSION['films'][$filmId])) {
                     $db->query("UPDATE films SET Hit=Hit+1 WHERE films.ID=?d", $filmId);
                     $_SESSION['films'][$filmId] = 1;
                 }
                 break;
             default:
                 $userId = Lms_User::getUser()->getId();
                 $db->query("UPDATE users SET PlayActivity=PlayActivity+1 WHERE ID=?d", $userId);
                 $c = $db->selectCell("SELECT count(*) FROM hits WHERE FilmID=?d AND UserID=?d", $filmId, $userId);
                 if ($c == 0) {
                     $db->query("INSERT INTO hits(FilmID,UserID,DateHit) VALUES(?d, ?d, NOW())", $filmId, $userId);
                     $db->query("UPDATE films SET Hit=Hit+1 WHERE films.ID=?d", $filmId);
                 }
         }
     }
 }