function delete($id) { if ($id) { $poll = new Poll($id); $poll->delete(); set_notify('success', lang('delete_data_complete')); } redirect('polls/admin/polls'); }
public static function delete($id) { self::check_logged_in(); $curruser = self::get_user_logged_in(); if (!$curruser->admin) { Redirect::to('/user/' . $curruser->id, array('warning' => 'Pääsy kielletty ilman ylläpito-oikeutta!')); } $poll = new Poll(array('id' => $id)); $poll->delete(); Redirect::to('/poll', array('message' => 'Äänestys poistettiin onnistuneesti.')); }
<?php camp_load_translation_strings("plugin_poll"); if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } // Check permissions if (!$g_user->hasPermission('plugin_poll')) { camp_html_display_error(getGS('You do not have the right to manage polls.')); exit; } $f_poll_nr = Input::Get('f_poll_nr', 'int'); $f_fk_language_id = Input::Get('f_fk_language_id', 'int'); $poll = new Poll($f_fk_language_id, $f_poll_nr); $poll->delete(); header('Location: index.php'); ?>
<?php /* * Bluethrust Clan Scripts v4 * Copyright 2014 * * Author: Bluethrust Web Development * E-mail: support@bluethrust.com * Website: http://www.bluethrust.com * * License: http://www.bluethrust.com/license.php * */ include_once "../../../../_setup.php"; include_once "../../../../classes/member.php"; include_once "../../../../classes/poll.php"; // Start Page $consoleObj = new ConsoleOption($mysqli); $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $managePollsCID = $consoleObj->findConsoleIDByName("Manage Polls"); $consoleObj->select($managePollsCID); $pollObj = new Poll($mysqli); // Check Login $LOGIN_FAIL = true; if ($member->authorizeLogin($_SESSION['btPassword']) && $pollObj->select($_POST['pollID']) && $member->hasAccess($consoleObj)) { $pollInfo = $pollObj->get_info_filtered(); $pollObj->delete(); define("SHOW_POLLLIST", true); include "polllist.php"; }