Exemple #1
0
 public function deleteFile($fid)
 {
     $fid = (int) $fid;
     $one = $this->get($fid);
     $filename = $one['name'];
     $filetype = $one['type'];
     switch ($filetype) {
         case 'audio':
             $folders = array($this->audioDir);
             break;
         case 'video':
             $folders = array($this->videoDir);
             break;
         case 'image':
             $folders = array($this->imgDir, $this->imgSmallDir);
             break;
         default:
             $folders = array();
     }
     if (empty($folders)) {
         return false;
     }
     parent::delete($fid);
     foreach ($folders as $folder) {
         $path = SITE_ROOT . '/' . $folder . $filename;
         if (file_exists($path)) {
             unlink($path);
         }
     }
     return true;
 }
Exemple #2
0
 public function delete($pk)
 {
     $pk = (int) $pk;
     $where = "aid = ?";
     $this->db->delete('poll_vote', $where, array($pk));
     return parent::delete($pk);
 }
Exemple #3
0
 public function delete_gallery($id_gallery)
 {
     $id_gallery = (int) $id_gallery;
     // удаляем файлы
     foreach ($this->get_images($id_gallery) as $image) {
         $this->delete_image($id_gallery, $image['fid']);
     }
     // чистим базу
     $this->db->Delete('gallery_mediafile', "gallery_id=?", array($id_gallery));
     parent::delete($id_gallery);
 }
Exemple #4
0
 public function delete($block_id)
 {
     if ($block_id <= 0) {
         return false;
     }
     if ($this->db->beginTransaction('block')) {
         $where = "block_id = ?";
         $this->db->Delete('regions_blocks', $where, array($block_id));
         if (parent::delete($block_id) == 1 && $this->db->commit('block')) {
         }
         return true;
         $this->db->rollBack('block');
     }
     return false;
 }
Exemple #5
0
 public function delete($pk)
 {
     $query = "SELECT count(*) c FROM menu_link WHERE menu_id = {$pk}";
     $children = $this->db->Select($query);
     if ($children[0]['c'] > 0) {
         $this->errors['has_children'] = "В меню находится" . $children[0]['c'] . "элемента(ов) ";
         die($this->errors['has_children']);
     }
     $menu = $this->get($pk);
     if ($this->db->beginTransaction('menu')) {
         if (parent::delete($pk) == 1) {
             M_Blocks::Instance()->delete($menu['block_id']);
             if ($this->db->commit('menu')) {
                 return true;
             }
         }
         $this->db->rollBack('menu');
     }
     return false;
 }
Exemple #6
0
 public function delete($post_id)
 {
     if ($post_id <= 0) {
         return false;
     }
     $mComments = new M_Comments();
     $sql = "SELECT mlid FROM posts WHERE post_id =" . (int) $post_id;
     $result = $this->db->Select($sql);
     $mlid = isset($result[0]['mlid']) ? $result[0]['mlid'] : 0;
     if ($mComments->deleteEntriesSubject($post_id) !== false && parent::delete($post_id) > 0) {
         unset($mComments);
         if ($mlid > 0) {
             M_MenuLink::Instance()->delete($mlid);
         }
         $path = $this->ckupload_dir . 'post_' . $post_id;
         if (is_dir($path)) {
             $this->removeDirectory($path);
         }
         return true;
     }
     return false;
 }
Exemple #7
0
 public function delete($pk)
 {
     $link = parent::get($pk);
     if (empty($link)) {
         return false;
     }
     parent::delete($pk);
     M_Posts::Instance()->unlink_menu($pk);
     $obj = array('plid' => $link['plid']);
     $where = 'plid = ? ';
     $this->db->Update($this->table, $obj, $where, array($pk));
     $this->listItems = array();
     $this->treeArray = array();
     return true;
 }
Exemple #8
0
 public function delete($role_id)
 {
     $role_id = (int) $role_id;
     $this->db->beginTransaction('role_delete');
     $this->db->Delete('privs_roles', 'role_id = ?', array($role_id));
     parent::delete($role_id);
     $this->db->commit('role_delete');
 }
Exemple #9
0
 public function delete($pk)
 {
     $pk = (int) $pk;
     $mPollAnswers = M_PollAnswers::Instance();
     $query = "SELECT pa.aid\n\t\t\t\t\t\t\t\tFROM poll p\n\t\t\t\t\t\t\tLEFT JOIN poll_answers pa\n\t\t\t\t\t\t\t\tUSING(pid) \n\t\t\t\t\t\t\tWHERE p.pid = ?";
     $result = $this->db->Select($query, array($pk), PDO::FETCH_COLUMN);
     if ($this->db->beginTransaction('poll_del')) {
         foreach ($result as $aid) {
             $mPollAnswers->delete($aid);
         }
         if (parent::delete($pk) && $this->db->commit('poll_del')) {
             return true;
         }
         $this->db->rollBack('poll_edit');
     }
     return false;
 }
Exemple #10
0
 public function delete_mail($listid, $mail_id)
 {
     $dir = SITE_ROOT . '/' . MAILING_DIR . (int) $listid . '/' . (int) $mail_id . '/';
     parent::delete($mail_id);
     if (file_exists($dir)) {
         M_Files::Instance()->remove_directory($dir);
     }
     return true;
 }