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();
     $news = $this->get_news($request);
     if (!$news->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);
     }
     NewsService::delete('WHERE id=:id', array('id' => $news->get_id()));
     NewsService::get_keywords_manager()->delete_relations($news->get_id());
     PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'news', 'id' => $news->get_id()));
     CommentsService::delete_comments_topic_module('news', $news->get_id());
     Feed::clear_cache('news');
     AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : NewsUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('news.message.success.delete', 'common', 'news'), array('name' => $news->get_name())));
 }
 private function delete_event($delete_all_serie_events = false)
 {
     $events_list = CalendarService::get_serie_events($this->event->get_content()->get_id());
     if ($delete_all_serie_events) {
         foreach ($events_list as $event) {
             //Delete event comments
             CommentsService::delete_comments_topic_module('calendar', $event->get_id());
             //Delete participants
             CalendarService::delete_all_participants($event->get_id());
         }
         CalendarService::delete_all_serie_events($this->event->get_content()->get_id());
         PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module = :module AND id_in_module = :id', array('module' => 'calendar', 'id' => !$this->event->get_parent_id() ? $this->event->get_id() : $this->event->get_parent_id()));
     } else {
         if (!$this->event->belongs_to_a_serie() || count($events_list) == 1) {
             CalendarService::delete_event_content('WHERE id = :id', array('id' => $this->event->get_parent_id()));
         }
         //Delete event
         CalendarService::delete_event('WHERE id_event = :id', array('id' => $this->event->get_id()));
         if (!$this->event->get_parent_id()) {
             PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'calendar', 'id' => $this->event->get_id()));
         }
         //Delete event comments
         CommentsService::delete_comments_topic_module('calendar', $this->event->get_id());
         //Delete participants
         CalendarService::delete_all_participants($this->event->get_id());
     }
     Feed::clear_cache('calendar');
     CalendarCurrentMonthEventsCache::invalidate();
 }
Ejemplo n.º 4
0
    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();
    $js_id_music = array();
Ejemplo n.º 5
0
     if ($report_cat > 0 && in_array($report_cat, $sub_cats) || $report_cat == $article_infos['id_cat']) {
         //Si on veut reporter dans une catégorie parente
         AppContext::get_response()->redirect('/wiki/' . url('property.php?del=' . $del_to_remove . '&error=e_cat_contains_cat#message_helper', '', '&'));
     }
 }
 //Quoi qu'il arrive on supprime l'article associé
 $db_querier->delete(PREFIX . 'wiki_contents', 'WHERE id_article=:id', array('id' => $del_to_remove));
 $db_querier->delete(PREFIX . 'wiki_articles', 'WHERE id=:id', array('id' => $del_to_remove));
 $db_querier->delete(PREFIX . 'wiki_cats', 'WHERE id=:id', array('id' => $del_to_remove));
 CommentsService::delete_comments_topic_module('wiki', $del_to_remove);
 if ($remove_action == 'remove_all') {
     foreach ($sub_cats as $id) {
         $result = $db_querier->select("SELECT id\n\t\t\t\tFROM " . PREFIX . "wiki_articles\n\t\t\t\tWHERE id_cat = :id", array('id' => $id));
         while ($row = $result->fetch()) {
             $db_querier->delete(PREFIX . 'wiki_contents', 'WHERE id_article=:id', array('id' => $row['id']));
             CommentsService::delete_comments_topic_module('wiki', $row['id']);
         }
         $result->dispose();
         $db_querier->delete(PREFIX . 'wiki_articles', 'WHERE id_cat=:id', array('id' => $id));
         $db_querier->delete(PREFIX . 'wiki_cats', 'WHERE id=:id', array('id' => $id));
     }
     WikiCategoriesCache::invalidate();
     // Feeds Regeneration
     Feed::clear_cache('wiki');
     //On redirige soit vers l'article parent soit vers la catégorie
     if (array_key_exists($article_infos['id_cat'], $categories) && $categories[$article_infos['id_cat']]['id_parent'] > 0) {
         $title = stripslashes($categories[$categories[$article_infos['id_cat']]['id_parent']]['title']);
         AppContext::get_response()->redirect('/wiki/' . url('wiki.php?title=' . Url::encode_rewrite($title), Url::encode_rewrite($title), '&'));
     } else {
         AppContext::get_response()->redirect('/wiki/' . url('wiki.php', '', '&'));
     }
Ejemplo n.º 6
0
        $page_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . 'pages', array('id', 'title', 'encoded_title', 'contents', 'auth', 'count_hits', 'activ_com', 'id_cat', 'is_cat', 'display_print_link'), 'WHERE id = :id', array('id' => $del_article));
    } catch (RowNotFoundException $e) {
        $error_controller = PHPBoostErrors::unexisting_page();
        DispatchManager::redirect($error_controller);
    }
    //Autorisation particulière ?
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
    }
    //la page existe bien, on supprime
    if (!empty($page_infos['title'])) {
        PersistenceContext::get_querier()->delete(PREFIX . 'pages', 'WHERE id=:id', array('id' => $del_article));
        PersistenceContext::get_querier()->delete(PREFIX . 'pages', 'WHERE redirect=:redirect', array('redirect' => $del_article));
        CommentsService::delete_comments_topic_module('pages', $del_article);
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=delete_success', '', '&'));
    } else {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=delete_failure', '', '&'));
    }
}
$tpl = new FileTemplate('pages/post.tpl');
if ($id_edit > 0) {
    //Autorisation particulière ?
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    //Vérification de l'autorisation d'éditer la page
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
    }
    //Erreur d'enregistrement ?
Ejemplo n.º 7
0
 //On fait un tableau contenant la liste des sous catégories de cette catégorie
 pages_find_subcats($sub_cats, $page_infos['id_cat']);
 $sub_cats[] = $page_infos['id_cat'];
 //On rajoute la catégorie que l'on supprime
 $id_to_delete = implode($sub_cats, ', ');
 if ($remove_action == 'move_all') {
     //Si on ne la déplace pas dans une de ses catégories filles
     if ($report_cat > 0 && in_array($report_cat, $sub_cats) || $report_cat == $page_infos['id_cat']) {
         AppContext::get_response()->redirect('/pages/' . url('action.php?del_cat=' . $del_cat_post . '&error=e_cat_contains_cat#message_helper', '', '&'));
     }
 }
 if ($remove_action == 'remove_all') {
     //Suppression des pages contenues par cette catégorie
     $db_querier->delete(PREFIX . 'pages', 'WHERE id_cat=:id', array('id' => $id_to_delete));
     $db_querier->delete(PREFIX . 'pages_cats', 'WHERE id=:id', array('id' => $id_to_delete));
     CommentsService::delete_comments_topic_module('pages', $id_to_delete);
     PagesCategoriesCache::invalidate();
     //On redirige soit vers l'article parent soit vers la catégorie
     if (array_key_exists($page_infos['id_cat'], $categories) && $categories[$categories['id_cat']]['id_parent'] > 0) {
         $title = $categories[$categories[$page_infos['id_cat']]['id_parent']]['title'];
         AppContext::get_response()->redirect('/pages/' . url('pages.php?title=' . Url::encode_rewrite($title), Url::encode_rewrite($title), '&'));
     } else {
         AppContext::get_response()->redirect('/pages/' . url('pages.php', '', '&'));
     }
 } elseif ($remove_action == 'move_all') {
     //Quoi qu'il arrive on supprime l'article associé
     $db_querier->delete(PREFIX . 'pages', 'WHERE id_cat=:id', array('id' => $del_cat_post));
     $db_querier->delete(PREFIX . 'pages_cats', 'WHERE id_cat=:id', array('id' => $page_infos['id_cat']));
     $db_querier->update(PREFIX . 'pages', array('id_cat' => $report_cat), 'WHERE id_cat = :id', array('id' => $page_infos['id_cat']));
     $db_querier->update(PREFIX . 'pages_cats', array('id_parent' => $report_cat), 'WHERE id_parent = :id', array('id' => $page_infos['id_cat']));
     PagesCategoriesCache::invalidate();
 private function save()
 {
     $now = new Date();
     $current_user = AppContext::get_current_user();
     if ($this->config->are_pm_enabled() && $this->config->are_pm_delete_enabled()) {
         //Add comment if needed
         $comment = !$this->form->field_is_disabled('comments_message') ? $this->form->get_value('comments_message', '') : '';
         //Send PM with comment to updaters if the option is enabled
         BugtrackerPMService::send_PM_to_updaters('delete', $this->bug->get_id(), $comment);
     }
     //Delete bug
     BugtrackerService::delete("WHERE id=:id", array('id' => $this->bug->get_id()));
     //Delete bug history
     BugtrackerService::delete_history("WHERE bug_id=:id", array('id' => $this->bug->get_id()));
     //Delete comments
     CommentsService::delete_comments_topic_module('bugtracker', $this->bug->get_id());
     //Delete admin alert
     if ($this->config->are_admin_alerts_enabled()) {
         $alerts = AdministratorAlertService::find_by_criteria($this->bug->get_id(), 'bugtracker');
         if (!empty($alerts)) {
             AdministratorAlertService::delete_alert($alerts[0]);
         }
     }
     BugtrackerStatsCache::invalidate();
     Feed::clear_cache('bugtracker');
 }
Ejemplo n.º 9
0
 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);
     }
 }