public function execute(HTTPRequestCustom $request) { AppContext::get_session()->csrf_get_protect(); $this->get_downloadfile($request); $this->check_authorizations(); DownloadService::delete('WHERE id=:id', array('id' => $this->downloadfile->get_id())); DownloadService::get_keywords_manager()->delete_relations($this->downloadfile->get_id()); PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'download', 'id' => $this->downloadfile->get_id())); CommentsService::delete_comments_topic_module('download', $this->downloadfile->get_id()); NotationService::delete_notes_id_in_module('download', $this->downloadfile->get_id()); Feed::clear_cache('download'); DownloadCache::invalidate(); AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : DownloadUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('download.message.success.delete', 'common', 'download'), array('name' => $this->downloadfile->get_name()))); }
public function execute(HTTPRequestCustom $request) { AppContext::get_session()->csrf_get_protect(); $article = $this->get_article($request); if (!$article->is_authorized_to_delete()) { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } if (AppContext::get_current_user()->is_readonly()) { $controller = PHPBoostErrors::user_in_read_only(); DispatchManager::redirect($controller); } ArticlesService::delete('WHERE id=:id', array('id' => $article->get_id())); ArticlesService::get_keywords_manager()->delete_relations($article->get_id()); PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'articles', 'id' => $article->get_id())); CommentsService::delete_comments_topic_module('articles', $article->get_id()); NotationService::delete_notes_id_in_module('articles', $article->get_id()); Feed::clear_cache('articles'); AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : ArticlesUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('articles.message.success.delete', 'common', 'articles'), array('title' => $article->get_title()))); }
AppContext::get_session()->csrf_get_protect(); try { $media = PersistenceContext::get_querier()->select_single_row(PREFIX . 'media', array('*'), 'WHERE id=:id', array('id' => $delete)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } if (empty($media)) { $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $LANG['e_unexist_media']); DispatchManager::redirect($controller); } elseif (!MediaAuthorizationsService::check_authorizations($media['idcat'])->moderation()) { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } PersistenceContext::get_querier()->delete(PREFIX . 'media', 'WHERE id=:id', array('id' => $delete)); NotationService::delete_notes_id_in_module('media', $delete); CommentsService::delete_comments_topic_module('media', $delete); // Feeds Regeneration Feed::clear_cache('media'); $category = MediaService::get_categories_manager()->get_categories_cache()->get_category($media['idcat']); bread_crumb($media['idcat']); $Bread_crumb->add($MEDIA_LANG['delete_media'], url('media.php?cat=' . $media['idcat'], 'media-0-' . $media['idcat'] . '+' . $category->get_rewrited_name() . '.php')); define('TITLE', $MEDIA_LANG['delete_media']); require_once '../kernel/header.php'; AppContext::get_response()->redirect('media' . url('.php?cat=' . $media['idcat'], '-' . $media['idcat'] . '.php')); } elseif ($add >= 0 && !$submit || $edit > 0) { $editor = AppContext::get_content_formatting_service()->get_default_editor(); $editor->set_identifier('contents'); $tpl->put_all(array('C_ADD_MEDIA' => true, 'U_TARGET' => url('media_action.php'), 'L_TITLE' => $MEDIA_LANG['media_name'], 'L_WIDTH' => $MEDIA_LANG['media_width'], 'L_HEIGHT' => $MEDIA_LANG['media_height'], 'L_U_MEDIA' => $MEDIA_LANG['media_url'], 'L_CONTENTS' => $MEDIA_LANG['media_description'], 'KERNEL_EDITOR' => $editor->display(), 'L_APPROVED' => $MEDIA_LANG['media_approved'], 'L_CONTRIBUTION_LEGEND' => $LANG['contribution'], 'L_NOTICE_CONTRIBUTION' => $MEDIA_LANG['notice_contribution'], 'L_CONTRIBUTION_COUNTERPART' => $MEDIA_LANG['contribution_counterpart'], 'L_CONTRIBUTION_COUNTERPART_EXPLAIN' => $MEDIA_LANG['contribution_counterpart_explain'], 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_REQUIRE_NAME' => $MEDIA_LANG['require_name'], 'L_REQUIRE_URL' => $MEDIA_LANG['require_url'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_SUBMIT' => $edit > 0 ? $LANG['update'] : $LANG['submit'])); // Construction du tableau des catégories musicales. $categories = MediaService::get_categories_manager()->get_categories_cache()->get_categories();
public function Del_pics($id_pics) { try { $info_pics = PersistenceContext::get_querier()->select_single_row(GallerySetup::$gallery_table, array('path', 'idcat', 'aprob'), "WHERE id = :id", array('id' => $id_pics)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_element(); DispatchManager::redirect($error_controller); } if (!empty($info_pics['path'])) { PersistenceContext::get_querier()->delete(PREFIX . 'gallery', 'WHERE id=:id', array('id' => $id_pics)); //Suppression physique. $file = new File(PATH_TO_ROOT . '/gallery/pics/' . $info_pics['path']); $file->delete(); $file = new File(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $info_pics['path']); $file->delete(); NotationService::delete_notes_id_in_module('gallery', $id_pics); CommentsService::delete_comments_topic_module('gallery', $id_pics); } }