Example #1
0
File: Main.php Project: Alex300/brs
 public function clickAction()
 {
     $id = cot_import('id', 'G', 'INT');
     if (!$id) {
         cot_die_message(404);
     }
     $banner = brs_model_Banner::getById($id);
     if (!$banner) {
         cot_die_message(404);
     }
     $banner->click();
     if (!empty($banner->clickurl)) {
         header('Location: ' . $banner->clickurl);
     }
     exit;
 }
Example #2
0
 public function deleteAction()
 {
     $id = cot_import('id', 'G', 'INT');
     $d = cot_import('d', 'G', 'INT');
     $backUrlParams = array('m' => 'brs');
     if (!empty($d)) {
         $backUrlParams['d'] = $d;
     }
     // Фильтры из списка
     $f = cot_import('f', 'G', 'ARR');
     if (!empty($f)) {
         foreach ($f as $key => $val) {
             if ($key == 'id') {
                 continue;
             }
             $backUrlParams["f[{$key}]"] = $val;
         }
     }
     $sort = cot_import('s', 'G', 'ALP');
     // order field name
     $way = cot_import('w', 'G', 'ALP', 4);
     // order way (asc, desc)
     if ($sort != 'title') {
         $backUrlParams['s'] = $sort;
     }
     if ($way != 'asc') {
         $backUrlParams['w'] = $way;
     }
     if (!$id) {
         cot_error(cot::$L['brs_err_not_found']);
         cot_redirect(cot_url('admin', $backUrlParams));
     }
     $item = brs_model_Banner::getById($id);
     if (!$item) {
         cot_error(cot::$L['brs_err_not_found']);
         cot_redirect(cot_url('admin', $backUrlParams));
     }
     $title = $item->title;
     $item->delete();
     cot_message(sprintf(cot::$L['brs_deleted'], $title));
     cot_redirect(cot_url('admin', $backUrlParams, '', true));
 }