/** * Main function to init the loader * @access public */ public static function init() { self::$alias = rad_input::request('alias'); if (!self::$alias) { self::$alias = rad_config::getParam('defaultAlias'); self::$template = rad_config::getParam('defaultTemplate'); } self::$_alias = self::getAliasByName(self::$alias); if (is_null(self::$_alias)) { throw new rad_exception('Aliases not found! Even the default aliases and alias for the 404 error! Insert those aliases into database please and try again!'); } if (strlen(self::$_alias->input_class)) { rad_input::reparseGetWithPlug(self::$_alias->input_class); } self::parseIncludes(self::$_alias->includes); self::$_langContainer = new rad_lang_container(); self::parseController(); if (!rad_breadcrumbs::initandmake(self::$_alias)) { rad_dblogger::logerr('Can\'t create and init breadcrumbs! file: ' . __FILE__ . ' and line: ' . __LINE__); } }
function manage() { $this->setVar('alias_loginform', $this->config('alias.loginform')); if (!$this->request('logout') and $this->request('alias') == 'login' and $this->getCurrentUser() and $this->getCurrentUser()->u_id) { if ($this->getCurrentUser()->is_admin) { $this->redirect($this->makeURL('alias=admin')); } else { $this->redirect($this->makeURL('alias=' . $this->config('mainAlias'))); } return; } if ($this->request('login') and $this->request('pass')) { if ($user = rad_session::login(rad_input::request('login'), rad_input::request('pass'))) { rad_instances::get('model_corecatalog_bin')->mergeCart(); if (!$user->u_active) { $this->setVar('message_error', $this->lang('usernotacitve.session.error')); rad_session::logout(); } else { $this->setVar('message', 'Login sucersfull!'); if ($this->request('referer')) { $this->redirect($this->request('referer')); } elseif ($_SERVER['HTTP_REFERER']) { $this->redirect($_SERVER['HTTP_REFERER']); } else { $this->redirect($this->makeURL('alias=admin')); } } //there is needs to set up some variables lica $this->setVar($key,$value) } else { $this->setVar('message_error', $this->lang('loginpassincorrect.session.message')); } } elseif ($this->request('logout')) { $logout_url = $this->makeURL('alias=' . $this->config('alias.siteloginform')); rad_session::logout(); $this->redirect($logout_url); } else { //$this->setVar('message','Not enouph actual parametets!'); } }
/** * Constructor * @param mixed array $params */ public function __construct($params) { if (!isset($params['total'])) { throw new rad_exception('Param "total" in class ' . get_class($this) . ' is required!', __LINE__); } //текста по умолчанию $this->texts = array('first' => $this->lang('-first'), 'last' => $this->lang('-last'), 'next' => $this->lang('-next'), 'prev' => $this->lang('-prev'), 'ellipsis' => '...'); $this->totalRows = $params['total']; //Кол-во на странице записей $this->itemsPerPage = !empty($params['itemsperpage']) ? $params['itemsperpage'] : $this->itemsPerPage; //Показывать ссылку на первую страницу? $this->showFirst = (bool) (isset($params['showfirst']) ? $params['showfirst'] : $this->showFirst); $this->showLast = (bool) (isset($params['showlast']) ? $params['showlast'] : $this->showLast); //Имя параметра, содержащего номер страницы $this->getParam = !empty($params['getparam']) ? $params['getparam'] : $this->getParam; $this->getParams = (!empty($params['getparams']) and strlen($params['getparams'])) ? $params['getparams'] : ''; $this->addAliasXML = (bool) (isset($params['addAliasXML']) ? $params['addAliasXML'] : $this->addAliasXML); /* Calculation */ //Кол-во страниц $this->pagesCount = ceil($this->totalRows / $this->itemsPerPage); //Текущая страница $this->currentPage = rad_input::request($this->getParam, $this->currentPage); $this->currentPage = $this->currentPage < 1 ? 1 : $this->currentPage; $this->currentPage = $this->currentPage > $this->totalRows ? $this->totalRows : $this->currentPage; //Кол-во страниц слева $this->leftNeighbour = $this->currentPage - $this->neighbours; $this->leftNeighbour = $this->leftNeighbour < 1 ? 1 : $this->leftNeighbour; //Кол-во страниц справа $this->rightNeighbour = $this->currentPage + $this->neighbours; $this->rightNeighbour = $this->rightNeighbour > $this->pagesCount ? $this->pagesCount : $this->rightNeighbour; // $this->texts = ( (isset($params['texts']) and is_array($params['texts']))?array_merge($this->texts, $params['texts']):$this->texts); }
/** * alias for rad_input::request(); * @param $key string * @return string * @access public */ public function request($key = null, $defValue = NULL) { return rad_input::request($key, $defValue); }