function __construct() { if ($this->getParamsObject()) { $params = $this->getParamsObject(); $this->_pid = $params->_get('treestart', $this->_pid, $this->getContentLangID()); $this->_pid_types = $params->_get('treestart_types', $this->_pid_types, $this->getContentLangID()); $this->_itemsPerPage = $params->itemsperpage; $this->_showImages = (bool) $params->showimages; $this->_have_spnews = (bool) $params->have_spnews; $this->_have_sp = (bool) $params->have_sp; $this->_have_spoffer = (bool) $params->have_spoffer; $this->_have_sphit = (bool) $params->have_sphit; $this->_have_downloads = (bool) $params->have_downloads; $this->_have_tags = (bool) $params->have_tags; $this->_have_brands = (bool) $params->have_brands; $this->setVar('params', $params); } $this->setVar('cat_id', (int) $this->request('cat_id')); $this->setVar('searchword', $this->request('searchword', '')); $this->setVar('hash', $this->hash()); if ($this->request('action')) { $this->setVar('action', $this->request('action')); switch ($this->request('action')) { case 'getTreeNodes': $this->getNodes(); break; case 'getjs_product': case 'getjs': $this->getJS(); break; case 'showEditNode': $this->showEditNode(); break; case 'addNode': $this->addNode(); break; case 'applyEditNode': $this->applyEditNode(); break; case 'deleteNode': $this->deleteNode(); break; //PRODUCTS LIST //PRODUCTS LIST case 'showProductsList': $this->showProductsList(); break; case 'productfileupload': include_once 'helpers' . DS . 'fileuploader.php'; $uploader = new fileuploader($this); $uploader->fileUpload(); $this->setVar('typ', 'AJAX'); break; case 'removefile': include_once 'helpers' . DS . 'fileuploader.php'; fileuploader::getInstance($this)->removeFile(); $this->setVar('typ', 'AJAX'); break; case 'addProductForm': $this->assignParams(); if ($this->request('action_sub')) { switch ($this->request('action_sub')) { case 'add': if (!$this->add()) { $this->setVar('try_again_add', true); $this->addProductForm(); } break; case 'edit': $this->edit(); break; default: $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); break; } //switch } else { $this->addProductForm(); $this->addBC('action', 'add'); } break; case 'getRemoteImg': $this->getRemoteImg(); break; case 'getjs_addeditproduct': $this->getJSAddEditProduct(); break; case 'getProductTypes': $this->getProductTypes(); break; case 'editform': $this->assignParams(); if ($this->request('action_sub')) { if ($this->request('action_sub') == 'edit') { $result = $this->edit(); if (!$result || $this->request('returntorefferer') == '1') { $this->editForm(); } } } else { $this->editForm(); $this->addBC('action', 'edit'); } break; case 'deleteproduct': $this->deleteProduct(); break; case 'deleteproducts': $this->deleteProductsInTree(); break; case 'deleteproductnojs': $this->deleteProductNoJS(); break; case 'searchproduct': $this->searchProduct(); break; case 'setactive': $this->setActiveJS(); break; case 'newcost': $this->newCost(); break; case 'newcur': $this->newCurrency(); break; case 'neworder': $this->newOrdering(); break; case 'newlngpid': $this->newLngPID(); break; case 'getcats': $this->getCats(); break; case 'gettypesed': $this->getTypesEd(); break; case '3dbin_genere': $this->genere3DBin(); break; case '3dbin_check': $this->check3DBin(); break; case '3dbin_refresh': if (!$this->request('cat_id')) { $this->redirect('404'); } $this->get3DBinItems((int) $this->request('cat_id')); break; default: $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); break; } //switch } else { $this->assignTree(); $this->setVar('pid', $this->_pid); } if (!rad_session::getVar('iterator_init')) { rad_session::setVar('iterator_init', 1); } $this->setVar('iterator_init', rad_session::getVar('iterator_init')); }
/** * Constructor * @param string $page - on What page the image is shows (location or alias or request) */ public function __construct($page = NULL) { $this->_kcaptchaFilename = __DIR__ . DS . 'kcaptcha' . DS . 'kcaptcha.php'; $this->_sessionName = $page ? $this->_sessionName . md5($page) : $this->_sessionName; $this->_keystring = rad_session::getVar($this->_sessionName, $this->_keystring); }
/** * Start order page - show the basket * */ function startPage() { model_corecatalog_currcalc::init(); $this->setVar('curr', model_corecatalog_currcalc::$_curcours); $model = rad_instances::get('model_corecatalog_bin'); $ct_showing = $this->getParamsObject() ? $this->getParamsObject()->ct_showing : NULL; $items = $model->getCartProducts(NULL, NULL, $ct_showing); $bin_pos = $model->getItemsCart(); $counts = array(); $bin_ids = array(); $total_count = 0; $total_costs = 0; if (count($bin_pos)) { foreach ($bin_pos as $id) { $counts[$id->bp_catid] = $id->bp_count; $bin_ids[$id->bp_catid] = $id->bp_id; } } $countElement = count($items); for ($i = 0; $i < $countElement; $i++) { $items[$i]->cost = $items[$i]->cat_cost; $items[$i]->cat_cost = model_corecatalog_currcalc::calcCours($items[$i]->cat_cost, $items[$i]->cat_currency_id); $items[$i]->cat_count = $counts[$items[$i]->cat_id]; $total_count += $items[$i]->cat_count; $total_costs += $items[$i]->cat_cost * $items[$i]->cat_count; $items[$i]->bp_id = $bin_ids[$items[$i]->cat_id]; } $this->setVar('items', $items); $this->setVar('total_count', $total_count); $this->setVar('total_costs', $total_costs); $this->setVar('hash', $this->hash()); $userInfo = rad_session::getVar('user_dump'); if (!empty($userInfo)) { $this->setVar('userInfo', $userInfo); } if ($this->_showDelivery) { $this->assignDelivery(); } }
/** * Get current langcode from session or set the default langcode * Also set current private LangID and currentLanguage * */ private static function _getCurrentLanguage() { $lngCode = self::getGetLngCode(); if (rad_config::getParam('lang.location_show') and !empty($lngCode) and in_array(self::getGetLngCode(), array_keys(self::$allLanguages))) { self::$currentLanguage = self::getGetLngCode(); } elseif (rad_config::getParam('lang.location_show') and !empty($lngCode) and !in_array(self::getGetLngCode(), array_keys(self::$allLanguages))) { /*Page not exists!*/ header(rad_config::getParam('header.404')); self::$currentLanguage = strlen(rad_session::getVar('currlang')) ? rad_session::getVar('currlang') : rad_config::getParam('lang.default'); //rad_input::redirect(rad_input::makeURL('alias='.rad_config::getParam('alias.404'))); } elseif (rad_session::getVar('currlang')) { self::$currentLanguage = rad_session::getVar('currlang'); } else { self::$currentLanguage = rad_config::getParam('lang.default'); } rad_session::setVar('currlang', self::$currentLanguage); if (rad_session::getVar('contentLng')) { self::$maincontentID = (int) rad_session::getVar('contentLng'); } $user = rad_session::$user; if (isset($user->u_id) and $user->u_id) { $paramsobject = rad_session::$user_params; self::$maincontentID = $paramsobject->_get('contentLng', self::$maincontentID); } if (!count(self::$allLanguages)) { throw new rad_exception('Languages in database not found! Please, insert any languages and try again!', 17134); } self::$langID = self::$allLanguages[self::$currentLanguage]->lng_id; self::$cacheLngValues[self::$langID] = array(); }