function admin_edit($id) { if (!empty($_POST)) { $post_data = tools::filter($_POST); $this->exec("UPDATE " . DB_PREFIX . "newsletters SET name='" . $post_data['name'] . "', \r\n\t\t\tobject='" . $post_data['object'] . "', content='" . $post_data['content'] . "' WHERE id=" . $id . ""); tools::setFlash($this->l('Request processed'), 'success'); tools::redirect('/admin/newsletter'); } $newsletter = $this->exec_one("SELECT * FROM " . DB_PREFIX . "newsletters WHERE id=" . $id . ""); $this->smarty->assign(array('newsletter' => $newsletter)); $this->smarty->display('admin/content/edit_newsletter.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $post_data = tools::filter($_POST); $this->exec("UPDATE " . DB_PREFIX . "suppliers SET company_name = '" . $post_data['company_name'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t contact_name = '" . $post_data['contact_name'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t address = '" . $post_data['address'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t postcode = '" . $post_data['postcode'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t city = '" . $post_data['city'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t country = '" . $post_data['country'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t phone = '" . $post_data['phone'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t fax = '" . $post_data['fax'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t email = '" . $post_data['email'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t details = '" . $post_data['details'] . "'\r\n\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/supplier'); } $supplier = $this->exec_one("SELECT * FROM " . DB_PREFIX . "suppliers WHERE id=" . $id); $this->smarty->assign('supplier', $supplier); $this->smarty->display('admin/settings/edit_supplier.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $post_data = tools::filter($_POST); $sql_request = $this->exec("UPDATE " . DB_PREFIX . "polls SET question='" . $post_data['question'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t response_1='" . $post_data['response_1'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t response_2='" . $post_data['response_2'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t response_3='" . $post_data['response_3'] . "', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t response_4='" . $post_data['response_4'] . "', \r\n\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\tWHERE id=" . $id . ""); tools::setFlash($this->l('Request processed'), 'success'); tools::redirect('/admin/poll'); } $poll = $this->exec_one("SELECT * FROM " . DB_PREFIX . "polls WHERE id=" . $id . ""); $this->smarty->assign('poll', $poll); $this->smarty->display('admin/content/edit_poll.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $post_data = tools::filter($_POST); $this->exec("UPDATE " . DB_PREFIX . "sources SET name='" . $post_data['name'] . "' WHERE id=" . $id . ""); tools::setFlash($this->l('Request processed'), 'success'); tools::redirect('/admin/sources'); } $source = $this->exec_one("SELECT * FROM " . DB_PREFIX . "sources WHERE id=" . $id . ""); $this->smarty->assign('source', $source); $this->smarty->display('admin/settings/edit_source.tpl'); }
public function admin_edit($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('name' => tools::filter($data['name'], 'accents'), 'title' => $data['title'], 'meta_description' => $data['meta_description'], 'meta_keywords' => $data['meta_keywords'], 'content' => $_POST['content']); if ($this->page->update((int) $id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/page'); } $this->smarty->assign('page', $this->page->getByID((int) $id)); $this->smarty->display('admin/content/edit_page.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('name' => $data['name']); if ($this->category->update((int) $id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/category'); } $this->smarty->assign('category', $this->category->getByID($id)); $this->smarty->display('admin/auctions/edit_category.tpl'); }
private function getLang() { if (isset($_GET['lang'])) { $language = tools::filter($_GET['lang'], 'string'); $_SESSION['lang'] = $language; } elseif (isset($_SESSION['lang'])) { $language = $_SESSION['lang']; } else { $language = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $_SESSION['lang'] = $language; } $lang_file = _DIR_ . '/app/lang/' . $language; require_once file_exists($lang_file) ? $lang_file : _DIR_ . '/app/lang/en'; $this->lang = $lang; }
function admin_edit($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('name' => $data['name'], 'category_id' => $data['category_id'], 'description' => $data['description'], 'price' => strpos($data['price'], ',') ? str_replace(',', '.', $data['price']) : $data['price'], 'delivery_cost' => strpos($data['delivery_cost'], ',') ? str_replace(',', '.', $data['delivery_cost']) : $data['delivery_cost'], 'delivery_information' => $data['delivery_information'], 'stock_number' => $data['stock_number']); if ($this->product->update($id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/product'); } $this->smarty->assign(array('product' => $this->product->get($id), 'categories' => $this->category->getAll())); $this->smarty->display('admin/auction/edit_product.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('name' => $data['name'], 'content' => $data['content'], 'active' => $data['active']); if ($this->advert->update((int) $id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/advert'); } $this->smarty->assign(array('advert' => $this->advert->getByID($id))); $this->smarty->display('admin/content/edit_advert.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('code' => $data['code'], 'saving' => $data['saving'], 'type' => $data['type'], 'description' => $data['description'], 'date_start' => $data['start_time_year'] . "-" . $data['start_time_month'] . "-" . $data['start_time_day'] . " " . $data['start_time_hour'] . ":" . $data['start_time_min'] . ":" . $data['start_time_sec'], 'date_end' => $data['end_time_year'] . "-" . $data['end_time_month'] . "-" . $data['end_time_day'] . " " . $data['end_time_hour'] . ":" . $data['end_time_min'] . ":" . $data['end_time_sec'], 'limit' => $data['limit']); if ($this->coupon->update((int) $id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/coupon'); } $coupon = $this->coupon->getByID((int) $id); $time_data = array(); $start_time_explode = explode(" ", $coupon['date_start']); $ymd_explode = explode("-", $start_time_explode[0]); $time_data['start_year'] = $ymd_explode[0]; $time_data['start_month'] = $ymd_explode[1]; $time_data['start_day'] = $ymd_explode[2]; $hms_explode = explode(":", $start_time_explode[1]); $time_data['start_hour'] = $hms_explode[0]; $time_data['start_minute'] = $hms_explode[1]; $time_data['start_second'] = $hms_explode[2]; $end_time_explode = explode(" ", $coupon['date_end']); $ymd_explode = explode("-", $end_time_explode[0]); $time_data['end_year'] = $ymd_explode[0]; $time_data['end_month'] = $ymd_explode[1]; $time_data['end_day'] = $ymd_explode[2]; $hms_explode = explode(":", $end_time_explode[1]); $time_data['end_hour'] = $hms_explode[0]; $time_data['end_minute'] = $hms_explode[1]; $time_data['end_second'] = $hms_explode[2]; $seconds = 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"); $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"); $hours = 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"); $days = array("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"); $years = array("2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025"); $this->smarty->assign(array('coupon' => $coupon, 'time_data' => $time_data, 'seconds' => $seconds, 'minutes' => $minutes, 'hours' => $hours, 'days' => $days, 'years' => $years)); $this->smarty->display('admin/settings/edit_coupon.tpl'); }
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'); } }
function admin_edit_extend($id) { if (!empty($_POST)) { $data = tools::filter($_POST); $toUpdate = array('username' => $data['username'], 'active' => $data['active']); if ($this->user->update($id, $toUpdate)) { tools::setFlash($this->l('Request processed'), 'success'); } else { tools::setFlash($this->l('An error has occurred'), 'error'); } tools::redirect('/admin/user/extends'); } $extend = $this->exec_one("SELECT id, username, active FROM " . DB_PREFIX . "users WHERE id=" . $id); $this->smarty->assign('extend', $extend); $this->smarty->display('admin/users/edit_extend.tpl'); }
function admin_edit($id) { if (!empty($_POST)) { // image upload if (isset($_FILES['image'])) { $image = tools::upload($_FILES['image']); } else { $image = null; } if (!empty($image)) { $this->exec("UPDATE " . DB_PREFIX . "testimonials SET image='" . $image . "' WHERE id=" . $id . ""); } // data edit $post_data = tools::filter($_POST); $sql_request = $this->exec("UPDATE " . DB_PREFIX . "testimonials SET text='" . $post_data['text'] . "', \r\n\t\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\tWHERE id=" . $id . ""); if ($sql_request) { tools::setFlash($this->l('Request processed'), 'success'); tools::redirect('/admin/testimonial'); } } $testimonial = $this->exec_one("SELECT * FROM " . DB_PREFIX . "testimonials WHERE id=" . $id . ""); $this->smarty->assign('testimonial', $testimonial); $this->smarty->display('admin/content/edit_testimonial.tpl'); }
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'); }
function admin_send_message($id) { if (isset($_POST['message'])) { $message = $this->exec_one("SELECT id, object, sender_id FROM " . DB_PREFIX . "messages WHERE id=" . $id . ""); if (!empty($message)) { $post_data = tools::filter($_POST); $sql_request = $this->exec("INSERT INTO " . DB_PREFIX . "messages (object, message, sender_id, receiver_id, discuss_id, created) \r\n\t\t\t\t\t\t\t\tVALUES('" . $message['object'] . "', '" . $_POST['message'] . "', '1', '" . $message['sender_id'] . "', '" . $message['id'] . "', '" . date("Y-m-d H:i:s") . "')"); $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'contact_response' AND language = '" . $this->settings['app']['language'] . "'"); $user = $this->exec_one("SELECT username, email FROM " . DB_PREFIX . "users WHERE id=" . $message['sender_id'] . ""); $message = str_replace("%username%", $user['username'], $email_template['content']); tools::sendMail($user['email'], $email_template['object'], $message); tools::setFlash(SUCCESS_SENT, 'success'); tools::redirect('/admin/dashboard/messages'); } } }
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'); }
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'); }