public function deletenewsAction() { global $mySession; $db = new Db(); if ($_REQUEST['Id'] != "") { $arrId = explode("|", $_REQUEST['Id']); if (count($arrId) > 0) { foreach ($arrId as $key => $Id) { if ($Id > 1) { $myObj = new News(); $Result = $myObj->deleteNews($Id); } } } } exit; }
function deleteNews() { $news = new News(); $admin->setId($_REQUEST['id']); if ($news->deleteNews()) { Common::jsonSuccess("News Deleted Successfully"); } else { Common::jsonError("Error"); } }
<?php include "../../../classes/Database.php"; include "../../../classes/Connection.php"; include_once "../../../includes/bootstrap.php"; include "../../../classes/News.php"; include "../../../classes/AdminAction.php"; include "../../../includes/security.funcs.inc"; include_once "../../../includes/Pagination.php"; //delete photo if (isset($_REQUEST['delete'])) { News::deleteNews($_REQUEST['delete']); $updates = 'Delete news and events content'; AdminAction::addAdminAction($_SESSION['admin_name'], $updates); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/core3.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/modules.css" /> </head>
<?php require_once "../../helper.php"; require_once "../../classes/News.class.php"; $helper = new Helper(); $newsObj = new News(); $result = $newsObj->deleteNews($_POST); echo json_encode($result);