function saveabout() { $model = new Application_Models_Admin(); $res = $model->updateAbout(); if ($res) { $response = array("msg" => "Текст сохранен", "status" => "success"); } else { $response = array("msg" => "Текст по какой то причине не сохранен", "status" => "danger"); } echo json_encode($response); exit; }
function updateUser() { $model = new Application_Models_Admin(); $res = $model->updateUser(); if ($res) { $response = array("msg" => "Пользователь изменен!", "status" => "success"); } else { $response = array("msg" => "Не удалось изменен пользователя", "status" => "danger"); } echo json_encode($response); exit; }
function deleteRubish() { $formats = explode(',', VALID_FORMATS); $valid_formats = array(); foreach ($formats as $one) { $valid_formats[] = trim($one, ' '); } $searchdirectory = array('/uploads/', '/uploads/thumbnail/', '/uploads/slider/', '/uploads/carousel/', '/uploads/comments/'); foreach ($searchdirectory as $key => $value) { $dir = PATH_SITE . $value; $files = scandir($dir); array_shift($files); array_shift($files); $key = array(); for ($i = 0; $i < sizeof($files); $i++) { if ($files[$i] != 'Thumbs.db') { $name = strtolower($files[$i]); list($txt, $ext) = explode(".", $name); // разбиваем на имя и формат if (in_array($ext, $valid_formats)) { $key[] = $value . $name; } } } if ($value === '/uploads/') { $arr = $key; } else { $arr = array_merge($arr, $key); } } $model = new Application_Models_Admin(); $res = $model->getImages(); $to_del = array_diff($arr, $res); if ($to_del) { foreach ($to_del as $one) { @unlink(PATH_SITE . $one); } } }
<?php $model = new Application_Models_Admin(); $model->deleteVisits(); $in = $model->selectVisits(); if (!$in) { $model->insertVisits(); } if ($in['quantity'] == 1) { $model->updateVisits(); } if ($in['quantity'] == 2) { exit("Зайдите на административную часть через 15 минут!"); } $mod = $model->getAdmin(); if ($_POST['rememberme'] != '') { Lib_Admincookies::getInstance()->setAdminCookies(); } else { Lib_Admincookies::getInstance()->destroyCookies(); } header("Location: /admin"); exit;
function index() { $model = new Application_Models_Admin(); $about = $model->getAbout(); $this->about = htmlspecialchars_decode($about['about']); }
function editeSlider() { $model = new Application_Models_Admin(); $mod1 = $model->getSliderItem($_GET['id']); $this->mod1 = $mod1; }
function editecarousel() { $model = new Application_Models_Admin(); $mod1 = $model->getCarouselItem($_GET['id']); $this->mod1 = $mod1; }