예제 #1
0
 function admin_delete($id)
 {
     if ($this->advert->delete((int) $id)) {
         tools::setFlash($this->l('Request processed'), 'success');
     } else {
         tools::setFlash($this->l('An error has occurred'), 'error');
     }
     tools::redirect('/admin/advert');
 }
예제 #2
0
 function admin_delete_image($id)
 {
     $image = $this->product->getImageById($id);
     $toDelete = array(_DIR_ . '/assets/img/product/' . $image['link'], _DIR_ . '/assets/img/product/thumb/' . $image['product_id'] . '/home_label.jpg', _DIR_ . '/assets/img/product/thumb/' . $image['product_id'] . '/home_list.jpg', _DIR_ . '/assets/img/product/thumb/' . $image['product_id'] . '/product_full.jpg', _DIR_ . '/assets/img/product/thumb/' . $image['product_id'] . '/product_gallery.jpg', _DIR_ . '/assets/img/product/thumb/' . $image['product_id'] . '/product_thumb.jpg');
     foreach ($toDelete as $name) {
         if (file_exists($name)) {
             unlink($name);
         }
     }
     if ($this->product->deleteImage($id)) {
         tools::setFlash($this->l('Request processed'), 'success');
     } else {
         tools::setFlash($this->l('An error has occurred'), 'error');
     }
     tools::redirect('/admin/product/images/' . $image['product_id']);
 }
예제 #3
0
 function admin_delete_extend($id)
 {
     if ($this->user->delete($id)) {
         tools::setFlash($this->l('Request processed'), 'success');
     } else {
         tools::setFlash($this->l('An error has occurred'), 'error');
     }
     tools::redirect('/admin/user/extends');
 }
예제 #4
0
 function admin_delete($id)
 {
     $this->exec("DELETE FROM " . DB_PREFIX . "testimonials WHERE id=" . $id . "");
     tools::setFlash($this->l('Request processed'), 'success');
     tools::redirect('/admin/testimonial');
 }
예제 #5
0
 function admin_do_selected()
 {
     if (!empty($_POST)) {
         switch ($type) {
             case 'delete_message':
                 foreach ($_POST as $message_id) {
                     $this->exec("DELETE FROM " . DB_PREFIX . "messages WHERE id=" . $message_id . "");
                 }
                 tools::setFlash($this->l('Request processed'), 'success');
                 tools::redirect('/admin/dashboard/messages');
                 break;
             default:
                 break;
         }
     }
 }
예제 #6
0
 function admin_edit($id)
 {
     if (!empty($_POST)) {
         $post_data = tools::filter($_POST);
         $this->exec("UPDATE " . DB_PREFIX . "payments SET account = '" . $post_data['account'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t fixed_fees = '" . $post_data['fixed_fees'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t variable_fees = '" . $post_data['variable_fees'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t active='" . $post_data['active'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE id = " . $id . "");
         tools::setFlash($this->l('Request processed'), 'success');
         tools::redirect('/admin/payment');
     }
     $payment = $this->exec_one("SELECT * FROM " . DB_PREFIX . "payments WHERE id=" . $id . "");
     $this->smarty->assign('payment', $payment);
     $this->smarty->display('admin/settings/edit_payment.tpl');
 }
예제 #7
0
 function admin_delete($id)
 {
     $this->exec("DELETE FROM " . DB_PREFIX . "auctions WHERE id=" . tools::filter($id));
     tools::setFlash($this->l('Request processed'), 'success');
     tools::redirect('/admin/auction');
 }
예제 #8
0
 function admin_edit($id)
 {
     if (!empty($_POST)) {
         $data = tools::filter($_POST);
         if ($data['name'] == 'auction_peak_start' || $data['name'] == 'auction_peak_end') {
             $data['value'] = $data['hours'] . ':' . $data['minutes'];
         } elseif ($data['name'] == 'bid_value') {
             if (strpos($data['value'], ',')) {
                 $data['value'] = str_replace(',', '.', $data['value']);
             }
         }
         $toUpdate = array('value' => $data['value']);
         if ($this->setting->update($id, $toUpdate)) {
             if (isset($data['theme'])) {
                 $dir = _DIR_ . '/data/smarty/compile';
                 $handle = opendir($dir);
                 while (false !== ($file = readdir($handle))) {
                     if ($file != "." && $file != "..") {
                         unlink($dir . '/' . $file);
                     }
                 }
                 closedir($dir);
             } elseif ($data['name'] == 'site_live') {
                 $filename = _DIR_ . '/data/site_live';
                 if (file_exists($filename)) {
                     unlink($filename);
                 }
             } elseif ($data['name'] == 'auction_peak_start') {
                 $filename = _DIR_ . '/data/auction_peak_start';
                 if (file_exists($filename)) {
                     unlink($filename);
                 }
             } elseif ($data['name'] == 'auction_peak_end') {
                 $filename = _DIR_ . '/data/auction_peak_end';
                 if (file_exists($filename)) {
                     unlink($filename);
                 }
             }
             tools::setFlash($this->l('Request processed'), 'success');
             tools::redirect('/admin/setting');
         }
     }
     $setting = $this->setting->getById($id);
     if ($setting['name'] == 'theme') {
         $dir = _DIR_ . '/app/view/';
         $files = scandir($dir);
         $themes = array();
         $i = 0;
         foreach ($files as $filename) {
             if (is_dir($dir . $filename)) {
                 if (!preg_match('[^0-9A-Za-z_-]', $filename) && $filename != 'admin') {
                     $themes[$i]['name'] = $filename;
                 }
             }
             $i++;
         }
     } else {
         $themes = null;
     }
     if ($setting['name'] == 'auction_peak_start' || $setting['name'] == 'auction_peak_end') {
         $explode = explode(':', $setting['value']);
         $setting['hours'] = $explode[0];
         $setting['minutes'] = $explode[1];
     }
     $hours = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
     $minutes = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59");
     $this->smarty->assign(array('setting' => $setting, 'themes' => $themes, 'hours' => $hours, 'minutes' => $minutes));
     $this->smarty->display('admin/settings/edit_setting.tpl');
 }
예제 #9
0
 function admin_delete($id)
 {
     $this->exec("DELETE FROM " . DB_PREFIX . "suppliers WHERE id=" . $id);
     tools::setFlash($this->l('Request processed'), 'success');
     tools::redirect('/admin/supplier');
 }
예제 #10
0
 function delete($id)
 {
     if (isset($_SESSION['user_id'])) {
         $autobid_id = tools::filter($id);
         $user_id = $_SESSION['user_id'];
         $this->exec("DELETE FROM " . _DB_PREFIX_ . "autobids WHERE id = " . $autobid_id . " AND user_id = " . $user_id . "");
         tools::setFlash(SUCCESS_AUTOBID_CANCEL, 'success');
         tools::redirect('/autobids');
     } else {
         tools::setFlash(ERROR_LOGIN, 'error');
         tools::redirect('/user/login');
     }
 }