public static function load($gid) { $cfg = $GLOBALS['ACL_PERMS']; self::$isAdmin = $gid == 1; self::$rights = $cfg['rights']; self::$groups = $cfg['groups']; self::setGroup($gid); // select group }
<?php if (!_acl::isAllow('profilesedit')) { die('Access denied'); } if (!isset($GLOBALS['REQAR'][1]) || !is_numeric($GLOBALS['REQAR'][1])) { header('Location: ' . $GLOBALS['URL_base'] . '404/'); exit; } $header = 'Редактирование профиля'; $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = 'Профили пользователей'; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/profiles/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; $id = (int) $GLOBALS['REQAR'][1]; $Profiles = new Profiles(); if (isset($_POST['smb'])) { $Profiles->Update($_POST); } $Profiles->SetFieldsByID($id); foreach ($Profiles->fields as $key => $value) { $_POST[$key] = $value; } $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_profiles_ae.tpl')); if ($parsed_res['issuccess'] == true) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('users')) { die("Access denied"); } $User = new Users(); $Supplier = new Suppliers(); // ---- center ---- unset($parsed_res); if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { $id_user = $GLOBALS['REQAR'][1]; } else { header('Location: ' . $GLOBALS['URL_base'] . '404/'); exit; } $tpl->Assign('h1', 'Удаление поставщика склада'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Пользователи"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/users/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = "Удаление поставщика склада"; if (!$Supplier->RemoveWarehouse($id_user)) { die('Ошибка при удалении поставщика склада.'); } else { header('Location: ' . $GLOBALS['URL_base'] . 'adm/warehouses/?success=true'); exit; } $tpl->Assign('msg', 'Поставщик удален.'); $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_message.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('product')) { die("Access denied"); } // ---- center ---- unset($parsed_res); if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { $id_product = $GLOBALS['REQAR'][1]; } else { header('Location: ' . $GLOBALS['URL_base'] . '404/'); exit; } $Products = new Products(); $tpl->Assign('h1', 'Удаление товара'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Каталог"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/cat/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = "Удаление товара"; if (!($res = $Products->DelProduct($id_product))) { die('Ошибка при удалении товара.'); } $tpl->Assign('msg', 'Товар удален.'); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_message.tpl')); if ($parsed_res['issuccess'] == true) { $tpl_center .= $parsed_res['html']; } // ---- right ----
<?php if (!_acl::isAllow('orders')) { die("Access denied"); } $Order = new Orders(); unset($parsed_res); $tpl->Assign('h1', 'Заказы'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Заказы"; $arr = false; if (isset($_GET['smb'])) { // unset($_GET); if (isset($_GET['filter_target_date']) && $_GET['filter_target_date'] !== '') { $arr['creation_date'] = $_GET['filter_target_date']; list($d, $m, $y) = explode(".", trim($arr['creation_date'])); $arr['creation_date'] = mktime(0, 0, 0, $m, $d, $y); } if (isset($_GET['filter_id_order']) && $_GET['filter_id_order'] !== '') { $arr['id_order'] = $_GET['filter_id_order']; } if (isset($_GET['id_order_status']) && $_GET['id_order_status'] !== '0') { $arr['id_order_status'] = $_GET['id_order_status']; } if (isset($_GET['filter_contragent_name']) && $_GET['filter_contragent_name'] !== '') { $arr['ca.name_c'] = $_GET['filter_contragent_name']; } if (isset($_GET['filter_email']) && $_GET['filter_email'] !== '') { $arr['u.email'] = $_GET['filter_email']; } if (isset($_GET['filter_customer_name']) && $_GET['filter_customer_name'] !== '') {
} else { $_SESSION['search']['newsearch'] = 0; } if (isset($_SESSION['search']['query']) && $_SESSION['search']['query'] != '' && (!isset($query) || $query == '')) { $query = $_SESSION['search']['query']; } elseif (isset($query) && $query != '' || !isset($_SESSION['search']['query']) || $_SESSION['search']['query'] == '') { if (isset($query)) { $_SESSION['search']['query'] = $query; } else { $_SESSION['search']['query'] = $query = ''; } } if (isset($_POST['dropfilters'])) { unset($_SESSION['filters']); } if (!_acl::isAdmin()) { $where_arr['p.visible'] = 1; } // Категория для поиска ==================================== if (isset($_POST['search_category']) && $_POST['search_category'] != 0 || isset($_GET['search_category']) && $_GET['search_category'] != 0) { $_SESSION['search']['search_category'] = isset($_POST['search_category']) ? $_POST['search_category'] : $_GET['search_category']; $where_arr['customs'][] = 'cp.id_category IN ( SELECT id_category FROM ' . _DB_PREFIX_ . 'category c WHERE c.pid = ' . $_SESSION['search']['search_category'] . ' OR c.pid IN ( SELECT id_category FROM ' . _DB_PREFIX_ . 'category c WHERE c.pid = ' . $_SESSION['search']['search_category'] . ' ) )';
<?php if (!_acl::isAllow('specifications')) { die("Access denied"); } $ObjName = "Specification"; ${$ObjName} = new Specification(); // ---- center ---- unset($parsed_res); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Характеристики"; $tpl->Assign('h1', $GLOBALS['IERA_LINKS'][$ii]['title']); if (isset($_POST['smb']) && isset($_POST['ord'])) { ${$ObjName}->Reorder($_POST); $tpl->Assign('msg', 'Сортировка выполнена успешно.'); } if (${$ObjName}->SetList()) { $tpl->Assign('list', ${$ObjName}->list); } $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_specification.tpl')); if (true == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
/** * [UpdateDemandChart description] * @param [type] $graph [description] * @param boolean $mode [description] */ public function UpdateDemandChart($chart, $mode = false) { $id_chart = $chart['id_chart']; $where = "id_chart = " . $id_chart; if ($mode == true) { $arr['moderation'] = $chart['moderation']; // if ($chart['mode'] == 'opt') { // $where = "opt = ".$id_chart; // } } else { $arr['id_author'] = $_SESSION['member']['id_user']; $arr['id_category'] = $chart['id_category']; //$arr['name_user'] = $chart['name_user']; $arr['comment'] = $chart['text']; $arr['moderation'] = 0; if (_acl::isAllow('admin_panel')) { $arr['moderation'] = 1; } $arr['opt'] = 0; if ($chart['opt'] == 1) { $arr['opt'] = $chart['opt']; } foreach ($chart['values'] as $k => $val) { $k++; $arr['value_' . $k] = $val; } } $this->db->StartTrans(); if (!$this->db->Update(_DB_PREFIX_ . "chart", $arr, $where)) { $this->db->FailTrans(); return false; } $this->db->CompleteTrans(); return true; }
<?php if (!_acl::isAllow('permissions')) { die('Access denied'); } $header = 'Права доступа'; $tpl->Assign('h1', $header); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; $current_id_profile = 0; if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { $current_id_profile = $GLOBALS['REQAR'][1]; } $Profiles = new Profiles(); $Profiles->SetList(); $profiles_list = $Profiles->list; $tpl->Assign('profiles_list', $profiles_list); $Profiles->SetFieldsById($current_id_profile); $tpl->Assign('current_profile', $Profiles->fields); $controllers = G::GetControllers($GLOBALS['PATH_contr']); foreach ($controllers as $val) { $list[] = preg_replace('/(?:edit|del|add)$/', '', $val); } $tpl->Assign('list', array_unique($list)); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_permissions.tpl')); if ($parsed_res['issuccess'] == true) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('pricelist')) { die("Access denied"); } $Products = new Products(); unset($parsed_res); $tpl->Assign('h1', 'Прайс-листы'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Прайс-листы"; if (isset($_POST['smb']) === true) { } $tpl->Assign('list', $Products->GetPricelistFullList()); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_pricelist.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('orders_category')) { die("Access denied"); } $Products = new Products(); unset($parsed_res); $header = 'Добавление категорий группе товаров'; $tpl->Assign('h1', $header); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; if (isset($_SESSION['fill_category'])) { $tpl->Assign('product_list', $Products->getArrayProductsById($_SESSION['fill_category'])); } $categories = $Products->generateCategory(); $tpl->Assign('categories', $categories); $tpl_center .= $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_orders_category.tpl');
<?php if (!_acl::isAllow('posts')) { die("Access denied"); } $Post = new Post(); unset($parsed_res); $header = 'Статьи'; $tpl->Assign('h1', $header); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; if (isset($_POST['smb']) && isset($_POST['ord'])) { $Post->Reorder($_POST); $tpl->Assign('msg', 'Сортировка выполнена успешно.'); } if ($Post->SetList(1)) { // die('Ошибка при формировании списка статей.'); $tpl->Assign('list', $Post->list); } $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_posts.tpl')); if ($parsed_res['issuccess'] == true) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('slides')) { die("Access denied"); } $Slides = new Slides(); unset($parsed_res); $tpl->Assign('h1', 'Слайды'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Слайды"; if (isset($_GET['upload'])) { $upload_handler = new UploadHandler(array('download_via_php' => true, 'upload_dir' => $_SERVER['DOCUMENT_ROOT'] . '/images/slides/', 'upload_url' => $_SERVER['DOCUMENT_ROOT'] . '/images/slides/', 'user_dirs' => false, 'param_name' => 'img', 'accept_file_types' => '/\\.(gif|jpe?g|jpg|png)$/i')); exit(0); } $Slides->SlidesList(1); $tpl->Assign('list', $Slides->list); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_slides.tpl')); if (true == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('remitters')) { die("Access denied"); } $ObjName = 'contragents'; ${$ObjName} = new Contragents(); unset($parsed_res); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Отправители"; $tpl->Assign('h1', $GLOBALS['IERA_LINKS'][$ii]['title']); if (${$ObjName}->SetRemittersList()) { $tpl->Assign('list', ${$ObjName}->list); } $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_remitters.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('parser')) { die('Access denied'); } unset($parsed_res); $header = 'Парсер сайтов'; $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = 'Каталог'; $GLOBALS['IERA_LINKS'][$ii++]['url'] = '/adm/cat/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; if (isset($_POST['parse'])) { if (!empty($_FILES) && is_uploaded_file($_FILES['urls']['tmp_name'])) { require $GLOBALS['PATH_sys'] . 'excel/Classes/PHPExcel/IOFactory.php'; $objPHPExcel = PHPExcel_IOFactory::load($_FILES['urls']['tmp_name']); $objPHPExcel->setActiveSheetIndex(0); $aSheet = $objPHPExcel->getActiveSheet(); //этот массив будет содержать массивы содержащие в себе значения ячеек каждой строки $array = array(); $ca = array('id', 'url', 'name'); //получим итератор строки и пройдемся по нему циклом foreach ($aSheet->getRowIterator() as $k => $row) { //получим итератор ячеек текущей строки $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); // Включить пустые ячейки //пройдемся циклом по ячейкам строки $item = array(); foreach ($cellIterator as $cell) { //заносим значения ячеек одной строки в отдельный массив array_push($item, $cell->getCalculatedValue());
<?php if (!_acl::isAllow('product_moderation')) { die("Access denied"); } unset($parsed_res); $dbtree = new dbtree(_DB_PREFIX_ . 'category', 'category', $db); $Products = new Products(); $suppliers = new Suppliers(); $tpl->Assign('h1', 'Товары на модерации'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Товары на модерации"; $prods = $Products->GetProductsOnModeration(); $list = $suppl = array(); foreach ($prods as $prod) { if ($prod['moderation_status'] != 2) { $suppliers->SetFieldsById($prod['id_supplier']); $suppl[$prod['id_supplier']] = $suppliers->fields; $list[$prod['id_supplier']][] = $prod; } } // Формирование списка категорий для выпадающего списка $category = $Products->generateCategory(); $tpl->Assign('category', $category); $tpl->Assign('list', $list); $tpl->Assign('suppliers', $suppl); $tpl_center .= $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_moderation.tpl');
<?php if (!_acl::isAllow('moderation_edit_product')) { die("Access denied"); } unset($parsed_res); if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { $id = $GLOBALS['REQAR'][1]; } else { header('Location: /adm/404/'); exit; } $Unit = new Unit(); $Products = new Products(); $Images = new Images(); $Users = new Users(); $header = "Редактирование товара на модерации"; array_push($GLOBALS['IERA_LINKS'], array('url' => '/adm/product_moderation', 'title' => 'Товары на модерации')); array_push($GLOBALS['IERA_LINKS'], array('url' => '/adm/moderation_edit_product', 'title' => $header)); $tpl->Assign('units', $Unit->GetUnitsList()); if (isset($_POST['smb'])) { //Физическое удаление файлов if (isset($_POST['removed_images'])) { foreach ($_POST['removed_images'] as $k => $path) { if ($Products->CheckPhotosOnModeration($path)) { $Images->remove($GLOBALS['PATH_root'] . '..' . $path); } } } $Products->AddSupplierProduct($_POST); }
<?php if (!_acl::isAllow('product_report')) { die("Access denied"); } $Products = new Products(); unset($parsed_res); $tpl->Assign('h1', 'Отчет неадекватных товаров'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Отчет неадекватных товаров"; $arr = false; if (isset($_POST['smb'])) { unset($_GET); if ($_POST['filter_target_date'] !== '') { $arr['target_date'] = mysql_real_escape_string($_POST['filter_target_date']); list($d, $m, $y) = explode(".", trim($arr['target_date'])); $arr['target_date'] = mktime(0, 0, 0, $m, $d, $y); } if ($_POST['filter_id_order'] !== '') { $arr['id_order'] = mysql_real_escape_string($_POST['filter_id_order']); } if ($_POST['id_order_status'] !== '0') { $arr['id_order_status'] = mysql_real_escape_string($_POST['id_order_status']); } if ($_POST['filter_contragent_name'] !== '') { $arr['contragent_name'] = mysql_real_escape_string($_POST['filter_contragent_name']); } if ($_POST['filter_customer_name'] !== '') { $arr['customer_name'] = mysql_real_escape_string($_POST['filter_customer_name']); } } else {
<?php ini_set("display_errors", 1); error_reporting(E_ALL); if (!_acl::isAllow('duplicates')) { die("Access denied"); } unset($parsed_res); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Дубли товаров"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = '/adm/duplicates/'; $Products = new Products(); $list = $Products->GetDuplicateProducts(); // === === === subcats $tpl->Assign('list', $list); $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_duplicates.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('segmentations')) { die("Access denied"); } $segmentation = new Segmentation(); // // ---- center ---- unset($parsed_res); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Сегментации"; $tpl->Assign('h1', $GLOBALS['IERA_LINKS'][$ii]['title']); $tpl->Assign('list_types', $segmentation->GetSegmentationType()); $tpl->Assign('list', $segmentation->GetSegmentation()); $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_segmentations.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
<?php if (!_acl::isAllow('news')) { die("Access denied"); } $News = new News(); unset($parsed_res); $tpl->Assign('h1', 'Новости'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Новости"; if (isset($_POST['smb']) && isset($_POST['ord'])) { $News->Reorder($_POST); $tpl->Assign('msg', 'Сортировка выполнена успешно.'); } if ($News->NewsList(1)) { // die('Ошибка при формировании списка новостей.'); $tpl->Assign('list', $News->list); } $tpl_center .= $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_news.tpl');
<?php if (!_acl::isAllow('supplier_prov')) { die("Access denied"); } $Order = new Orders(); // ---- center ---- unset($parsed_res); $tpl->Assign('h1', 'Позиции по поставщикам'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Позиции по поставщикам"; $arr = false; //$Order->Suplir_prov(); $order_statuses = $Order->Suplir_prov($arr); $tpl->Assign('list1', $order_statuses); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_suplir_prov.tpl')); if (true == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; } // ---- right ----
*/ if (empty($ma[1])) { $ma[1][0] = $GLOBALS['DefaultController']; } elseif (!in_array($ma[1][0], $GLOBALS['Controllers'])) { array_unshift($ma[1], '404'); } $GLOBALS['CurrentController'] = $ma[1][0]; $GLOBALS['REQAR'] = $ma[1]; //$GLOBALS['__graph'] = $tpl_graph; if (!G::IsLogged()) { $GLOBALS['CurrentController'] = 'login'; $GLOBALS['REQAR'] = array(); } else { $User = new Users(); $User->SetUser($_SESSION['member']) or exit('Ошибка пользователя.1'); _acl::load($User->fields['gid']); } /** * Для удобства некоторые переменные из REQUEST_URI объявляются в массиве $_GET */ foreach ($ma[1] as $item) { if (preg_match('/^p[0-9]+/', $item, $match)) { $GLOBALS['Page_id'] = (int) preg_replace('/^p/', '', $match[0]); } if (preg_match('#^p([\\d]+)$#is', $item, $ma1)) { $_GET['page_id'] = $ma1[1]; // $GLOBALS['Page_id'] = $ma1[1]; } } unset($ma); unset($ma1);
public function DBCart() { //Удаляет товар из корзины if (isset($_POST['id_prod_for_remove'])) { unset($_SESSION['cart']['products'][$_POST['id_prod_for_remove']]); if (G::IsLogged() && !_acl::isAdmin()) { $this->db->StartTrans(); if (!$this->db->DeleteRowsFrom(_DB_PREFIX_ . "cart_product", array("id_cart = " . $_SESSION['cart']['id'], "id_product = " . $_POST['id_prod_for_remove']))) { $this->db->FailTrans(); return false; } $this->db->CompleteTrans(); $this->RecalcCart(); } return $_SESSION['cart']; } if (isset($_SESSION['cart']['id']) && !empty($_SESSION['cart']['products'])) { //Меняем готовность заказа (ready=0) при изменении количества товаров в корзине if (isset($_SESSION['cart']['promo']) && $_SESSION['cart']['promo'] != '' && $_SESSION['cart']['adm'] == 0) { $f['ready'] = 0; $this->db->Update(_DB_PREFIX_ . "cart", $f, "id_cart = " . $_SESSION['cart']['id']); unset($f); } // Обновить корзину в БД по id foreach ($_SESSION['cart']['products'] as $key => &$product) { $f['quantity'] = $product['quantity']; $f['price'] = $product['base_price']; $f['note'] = $product['note']; $this->db->StartTrans(); if (isset($product['id_cart_product'])) { if (!$this->db->Update(_DB_PREFIX_ . "cart_product", $f, "id_cart_product = " . $product['id_cart_product'])) { $this->db->FailTrans(); return false; } } else { $f['id_product'] = $key; $f['id_cart'] = $_SESSION['cart']['id']; if (!$this->db->Insert(_DB_PREFIX_ . "cart_product", $f)) { $this->db->FailTrans(); return false; } $product['id_cart_product'] = $this->db->GetLastId(); } $this->db->CompleteTrans(); } if (isset($product)) { return $product['id_cart_product']; } } else { // добавить корзину в БД и записать ее id в $_SESSION['cart']['id'] if (G::IsLogged() && !_acl::isAdmin()) { $f['id_user'] = $_SESSION['member']['id_user']; $this->db->StartTrans(); if (!$this->db->Insert(_DB_PREFIX_ . 'cart', $f)) { $this->db->FailTrans(); return false; //Если не удалось записать в базу } unset($f); $_SESSION['cart']['id'] = $this->db->GetLastId(); $this->db->CompleteTrans(); foreach ($_SESSION['cart']['products'] as $key => &$product) { $f['id_product'] = $key; $f['quantity'] = $product['quantity']; $f['price'] = $product['base_price']; $f['id_cart'] = $_SESSION['cart']['id']; $this->db->StartTrans(); if (!$this->db->Insert(_DB_PREFIX_ . "cart_product", $f)) { $this->db->FailTrans(); return false; } $product['id_cart_product'] = $this->db->GetLastId(); $this->db->CompleteTrans(); unset($f); } return $product['id_cart_product']; } return false; } }
<?php if (!_acl::isAllow('catalog')) { die("Access denied"); } $dbtree = new dbtree(_DB_PREFIX_ . 'category', 'category', $db); // ---- center ---- unset($parsed_res); // -------------------------------------------------------------------------------------- if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { $id_category = $GLOBALS['REQAR'][1]; } else { header('Location: ' . $GLOBALS['URL_base'] . '404/'); exit; } $category = $dbtree->Full(array('id_category', 'category_level', 'name', 'translit', 'art', 'pid', 'content', 'visible'), array('and' => array('id_category = ' . $id_category))); $tpl->Assign('h1', 'Редактирование тегов категории'); // $dbtree->Parents($id_category, array('id_category', 'name', 'category_level')); // if (!empty($dbtree->ERRORS_MES)) { // print_r($dbtree->ERRORS_MES);die(); // } $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Каталог"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/cat/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = "Редактирование тегов категории"; foreach ($dbtree->GetTagsLevelsList($id_category) as $k => $l) { $level[$l['tag_level']] = $l; $level[$l['tag_level']]['tags'] = $dbtree->GetTagsList($id_category, $l['tag_level']); } $tpl->Assign('level', $level); if (!isset($_POST['smb'])) {
<?php if (G::IsLogged()) { header('Location: ' . $GLOBALS['URL_base']); exit; } $GLOBALS['__page_title'] = 'Вход'; $GLOBALS['MainTemplate'] = 'login.tpl'; $Page = new Page(); unset($parsed_res); if (isset($_POST['email']) && isset($_POST['passwd']) && $_POST['email'] && $_POST['passwd']) { $User = new Users(); if ($User->CheckUser($_POST)) { _acl::load($User->fields['gid']); if (_acl::isAllow('admin_panel')) { G::Login($User->fields); header('Location: ' . $GLOBALS['URL_base'] . 'adm/'); //$GLOBALS['URL_request'] exit; } else { $tpl->Assign('msg', 'Доступ запрещен.'); $tpl->Assign('errm', 1); } } else { $tpl->Assign('msg', 'Неверный email или пароль.'); $tpl->Assign('errm', 1); } unset($_POST); } $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_login.tpl')); if (TRUE == $parsed_res['issuccess']) {
<?php if (!_acl::isAllow('seotextformats')) { die("Access denied"); } $Seo = new Seo(); unset($parsed_res); $tpl->Assign('h1', 'Добавление формата сеотекста'); if (isset($_POST['smb'])) { if ($Seo->addSeotextFormats($_POST)) { $tpl->Assign('msg', 'Новый формат добавлен.'); unset($_POST); } else { $tpl->Assign('msg', 'Формат не добавлен.'); $tpl->Assign('errm', 1); } } if (!isset($_POST['smb'])) { $_POST['id'] = 0; } $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Формат сеотекстов"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/seotextformats/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = "Добавление формата сеотекста"; $tpl_center = $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_seotextformats_ae.tpl');
<?php if (!_acl::isAllow('seotext')) { die("Access denied"); } $Seo = new Seo(); unset($parsed_res); $tpl->Assign('h1', 'Добавление Seo-текста'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Seo-текст"; $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/seotext/'; $GLOBALS['IERA_LINKS'][$ii]['title'] = "Добавление Seo-текста"; if (isset($_POST['smb'])) { require_once $GLOBALS['PATH_block'] . 't_fnc.php'; // для ф-ции проверки формы list($err, $errm) = Seotext_form_validate(); if (!$err) { if ($id = $Seo->AddSeoText($_POST)) { $tpl->Assign('msg', 'Seo-текст добавлен.'); unset($_POST); } else { $tpl->Assign('msg', 'Seo-текст не добавлен.'); $tpl->Assign('errm', 1); } } else { // показываем все заново но с сообщениями об ошибках if (isset($_POST['date']) && !isset($errm['date'])) { list($d, $m, $y) = explode(".", trim($_POST['date'])); $_POST['date'] = mktime(0, 0, 0, $m, $d, $y); } $tpl->Assign('msg', 'Seo-текст не добавлен.');
<?php if (!_acl::isAllow('configs')) { die("Access denied"); } $ObjName = "Config"; ${$ObjName} = new Config(); // ---- center ---- unset($parsed_res); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Настройки"; $tpl->Assign('h1', $GLOBALS['IERA_LINKS'][$ii]['title']); if (isset($_POST['smb']) && isset($_POST['ord'])) { ${$ObjName}->Reorder($_POST); $tpl->Assign('msg', 'Сортировка выполнена успешно.'); } if (${$ObjName}->SetList()) { $tpl->Assign('list', ${$ObjName}->list); } $parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_config.tpl')); if (TRUE == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; } // ---- right ---- ?> S86 k_manager10@gmail.com
<?php if (!_acl::isAllow('profiles')) { die('Access denied'); } $header = 'Профили пользователей'; $tpl->Assign('h1', $header); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = $header; $Profiles = new Profiles(); $Profiles->SetList(); $list = $Profiles->list; foreach ($list as &$profile) { $res = $Profiles->GetUsersByProfileId($profile['id_profile']); $profile['users_count'] = is_array($res) ? count($res) : 0; } $tpl->Assign('list', $list); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_profiles.tpl')); if ($parsed_res['issuccess'] == true) { $tpl_center .= $parsed_res['html']; }