public function deleteItem($id) { $imageurl = $this->getItemImageUrl($id); @chmod(PATH . "/images/catalog/{$imageurl}", 0777); @chmod(PATH . "/images/catalog/small/{$imageurl}", 0777); @chmod(PATH . "/images/catalog/medium/{$imageurl}", 0777); @unlink(PATH . '/images/catalog/' . $imageurl); @unlink(PATH . '/images/catalog/small/' . $imageurl); @unlink(PATH . '/images/catalog/medium/' . $imageurl); $this->inDB->query("DELETE FROM cms_uc_items WHERE id= '{$id}'"); $this->inDB->query("DELETE FROM cms_tags WHERE target='catalog' AND item_id = '{$id}'"); $this->inDB->query("DELETE FROM cms_uc_ratings WHERE item_id = '{$id}'"); cmsActions::removeObjectLog('add_catalog', $id); cmsCore::deleteComments('catalog', $id); }
/** * Удаляет пост в блоге * @param int $post_id * @return bool */ public function deletePost($post_id) { cmsCore::callEvent('DELETE_POST', $post_id); $post = $this->getPost($post_id); if (!$post) { return false; } // пересчитываем рейтинг блога $this->inDB->query("UPDATE cms_blogs SET rating = rating - ({$post['rating']}) WHERE id = '{$post['blog_id']}'"); $this->inDB->delete('cms_blog_posts', "id = '{$post_id}'", 1); cmsCore::deleteRatings($this->getTarget('rating'), $post_id); cmsCore::deleteComments($this->getTarget('comments'), $post_id); cmsClearTags($this->getTarget('tags'), $post_id); cmsCore::deleteUploadImages($post_id, 'blog_post'); cmsActions::removeObjectLog($this->getTarget('actions_post'), $post_id); return true; }
/** * Удаляет альбом * @param int $album_id * @param str $differ * @param obj $inUploadPhoto * @return bool */ public function deleteAlbum($album_id, $differ = '', $inUploadPhoto) { $album = cmsCore::c('db')->getNsCategory('cms_photo_albums', $album_id, $differ); if(!$album) { return false; } cmsCore::callEvent('DELETE_ALBUM', $album_id); //устанавливаем нужный альбом и все вложенные $this->whereThisAndNestedCats($album['NSLeft'], $album['NSRight']); cmsCore::c('db')->addJoin("INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.NSDiffer = '{$differ}'"); $photos = $this->getPhotos(true); if ($photos){ foreach($photos as $photo){ $this->deletePhoto($photo, $inUploadPhoto); } } cmsCore::deleteComments($this->getTarget('comments_album'), $album_id); cmsActions::removeTargetLog($this->getTarget('actions_photo'), $album_id); return cmsCore::c('db')->deleteNS('cms_photo_albums', $album_id, $differ); }
public function deletePhoto($photo_id) { cmsCore::loadLib('tags'); $sql = "SELECT imageurl FROM cms_user_photos WHERE id = '{$photo_id}'"; $result = $this->inDB->query($sql); if ($this->inDB->num_rows($result)){ $photo = $this->inDB->fetch_assoc($result); @unlink(PATH.'/images/users/photos/'.$photo['imageurl']); @unlink(PATH.'/images/users/photos/small/'.$photo['imageurl']); @unlink(PATH.'/images/users/photos/medium/'.$photo['imageurl']); $this->inDB->query("DELETE FROM cms_user_photos WHERE id = $photo_id") ; cmsCore::deleteComments('userphoto', $photo_id); cmsActions::removeObjectLog('add_user_photo', $photo_id); cmsClearTags('userphoto', $photo_id); } return true; }
/** * Удаляет статью * @return bool */ public function deleteArticle($id) { cmsCore::callEvent('DELETE_ARTICLE', $id); $this->inDB->delete('cms_content', "id='{$id}'", 1); $this->inDB->delete('cms_tags', "target='content' AND item_id='{$id}'"); cmsCore::clearAccess($id, 'material'); cmsActions::removeObjectLog('add_article', $id); @unlink(PATH . '/images/photos/small/article' . $id . '.jpg'); @unlink(PATH . '/images/photos/medium/article' . $id . '.jpg'); cmsCore::deleteRatings('content', $id); cmsCore::deleteComments('article', $id); translations::deleteTargetTranslation('content_content', $id); return true; }
/** * Удаляет статью * @return bool */ public function deleteArticle($id) { cmsCore::callEvent('DELETE_ARTICLE', $id); cmsCore::c('db')->delete('cms_content', "id='". $id ."'", 1); cmsCore::c('db')->delete('cms_tags', "target='content' AND item_id='". $id ."'"); cmsCore::clearAccess($id, 'material'); cmsActions::removeObjectLog('add_article', $id); @unlink(PATH .'/images/content/medium/'. ceil($id/100) .'/article'. $id .'.jpg'); @unlink(PATH .'/images/content/small/'. ceil($id/100) .'/article'. $id .'.jpg'); cmsCore::deleteUploadImages($id, '', 'content'); cmsCore::deleteRatings('content', $id); cmsCore::deleteComments('article', $id); return true; }
public function deleteRecord($item_id) { cmsCore::callEvent('DELETE_BOARD_RECORD', $item_id); $item = $this->getRecord($item_id); if (!$item) { return false; } @unlink(PATH . '/images/board/' . $item['file']); @unlink(PATH . '/images/board/small/' . $item['file']); @unlink(PATH . '/images/board/medium/' . $item['file']); $this->inDB->delete('cms_board_items', " id = '{$item_id}'", 1); cmsCore::deleteComments('boarditem', $item_id); cmsActions::removeObjectLog('add_board', $item_id); return true; }