예제 #1
0
 /**
  *
  * @param $type
  * @param $object_id   the object who owns the bookmark
  */
 public static function remove($type, $object_id, $owner = 0)
 {
     if (!is_numeric($type) || !is_numeric($object_id) || !is_numeric($owner)) {
         throw new \Exception('noo');
     }
     $session = SessionHandler::getInstance();
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE owner = ?' . ' AND value = ?' . ' AND type = ?';
     return Sql::pDelete($q, 'iii', $owner ? $owner : $session->id, $object_id, $type);
 }
예제 #2
0
 public static function removeFromGroup($user_id, $grp_id)
 {
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE groupId = ? AND userId = ?';
     Sql::pDelete($q, 'ii', $grp_id, $user_id);
     return true;
 }
예제 #3
0
 public static function deleteByReference($type, $reference)
 {
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE type = ? AND reference = ?';
     return Sql::pDelete($q, 'ii', $type, $reference);
 }
 /** Garbage Collection */
 public function gc($maxlifetime)
 {
     $q = 'DELETE FROM tblSessionData WHERE expires < NOW()';
     Sql::pDelete($q);
     return true;
 }
예제 #5
0
 public static function deleteById($id, $tblname, $field_name = 'id')
 {
     if (!is_alphanumeric($tblname) || !is_alphanumeric($field_name)) {
         throw new \Exception('very bad');
     }
     if (!is_numeric($id)) {
         throw new \Exception('bad data' . $id);
     }
     $q = 'DELETE FROM ' . $tblname . ' WHERE ' . $field_name . ' = ?';
     Sql::pDelete($q, 'i', $id);
 }
예제 #6
0
 public static function delete($type, $owner, $name)
 {
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE owner = ? AND type = ? AND name = ?';
     Sql::pDelete($q, 'iis', $owner, $type, $name);
     return true;
 }
예제 #7
0
 /**
  * Removes all chat messages from a chatroom
  */
 public static function deleteByRoom($id)
 {
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE room = ?';
     Sql::pDelete($q, 'i', $id);
 }