Exemplo n.º 1
0
 function Del_alert_topic($id_alert)
 {
     PersistenceContext::get_querier()->delete(PREFIX . 'forum_alerts', 'WHERE id=:id', array('id' => $id_alert));
     //Si la contribution associée n'est pas réglée, on la règle
     $corresponding_contributions = ContributionService::find_by_criteria('forum', $id_alert, 'alert');
     if (count($corresponding_contributions) > 0) {
         $file_contribution = $corresponding_contributions[0];
         //We delete the contribution
         ContributionService::delete_contribution($file_contribution);
     }
     //Insertion de l'action dans l'historique.
     forum_history_collector(H_DEL_ALERT);
 }
Exemplo n.º 2
0
        //Enregistrement en base de données
        ContributionService::save_contribution($contribution);
        AppContext::get_response()->redirect(UserUrlBuilder::contribution_panel($contribution->get_id()));
    } else {
        AppContext::get_response()->redirect(UserUrlBuilder::contribution_panel());
    }
} elseif ($id_to_delete > 0) {
    //Vérification de la validité du jeton
    AppContext::get_session()->csrf_get_protect();
    $contribution = new Contribution();
    //Loading the contribution into an object from the database and checking if the user is authorizes to read it
    if (($contribution = ContributionService::find_by_id($id_to_delete)) == null || !AppContext::get_current_user()->check_auth($contribution->get_auth(), Contribution::CONTRIBUTION_AUTH_BIT)) {
        $error_controller = PHPBoostErrors::unexisting_page();
        DispatchManager::redirect($error_controller);
    }
    ContributionService::delete_contribution($contribution);
    AppContext::get_response()->redirect(UserUrlBuilder::contribution_panel());
} else {
    $Bread_crumb->add($LANG['member_area'], UserUrlBuilder::home()->rel());
    $Bread_crumb->add($LANG['contribution_panel'], url('contribution_panel.php'));
    define('TITLE', $LANG['contribution_panel']);
}
require_once '../kernel/header.php';
$template = new FileTemplate('user/contribution_panel.tpl');
if ($contribution_id > 0) {
    $template->put_all(array('C_CONSULT_CONTRIBUTION' => true));
    $comments_topic = new UserEventsCommentsTopic();
    $comments_topic->set_id_in_module($contribution_id);
    $comments_topic->set_url(new Url('/user/contribution_panel.php?id=' . $contribution_id));
    //For PHP 4 :(
    $contribution_creation_date = $contribution->get_creation_date();
Exemplo n.º 3
0
 function Del_alert_topic($id_alert)
 {
     global $Sql;
     $Sql->query_inject("DELETE FROM " . PREFIX . "forum_alerts WHERE id = '" . $id_alert . "'", __LINE__, __FILE__);
     import('events/contribution');
     import('events/contribution_service');
     $corresponding_contributions = ContributionService::find_by_criteria('forum', $id_alert, 'alert');
     if (count($corresponding_contributions) > 0) {
         $file_contribution = $corresponding_contributions[0];
         ContributionService::delete_contribution($file_contribution);
     }
     forum_history_collector(H_DEL_ALERT);
 }