public static function start() { if (self::$init == null) { self::$init = new self(); } return self::$init; }
public function setConfigs() { if ($lang = Libs_Session::start()->getParam($this->KEY_LANG)) { Config::$lang = $lang; return true; } else { return false; } }
public function getLayoutWithStyle() { $layout = $this->getTPL('main'); $style = Libs_Session::start()->getParam('style'); if (!$style) { $style = 'blue'; } $layout = str_replace('{style}', $style, $layout); return $layout; }
/** * @param $link * @return mixed */ public function routers($link) { $link = rtrim($link, '\\/'); $blocks = array(); if ($link == '/admin/exit') { Libs_Session::start()->deleteParam('admin_id'); header('Location: /admin'); exit; } if ($link == '/admin') { $blocks[] = array('name' => 'Blocks_Center', 'side' => 'center'); return $blocks; } return false; }
public function login() { $json = array(); $data = array('login' => strip_tags($_POST['name']), 'pass' => strip_tags($_POST['pass'])); $valid = array('login' => array('required' => true), 'pass' => array('required' => true)); $fields = array('login' => 'Логин', 'pass' => 'Пароль'); $validator = new Libs_Validator($fields); if ($validator->isValid($data, $valid)) { $res = DAO_Admin_Login::getUser($data['login'], md5($data['pass'])); if (empty($res)) { $json['error'] = true; $json['mess'] = 'Не верный логин или пароль'; } else { Libs_Session::start()->setParam('admin_id', $res['id']); $json['callback'] = 'function callback(){window.location.reload()}'; } } else { $json['error'] = true; $json['mess'] = $validator->getErrors(); } $this->putJSON($json); }
private function initHelpers() { require_once 'libs/helpers.php'; Libs_Session::start(); }
private function clearSpecialSession() { //after change language /*14Dec2012*/ Libs_Session::set('survey_data', false); Libs_Session::set('data_survey_package', false); }
public function setStyle() { $style = strip_tags($_POST['color']); Libs_Session::start()->setParam('style', $style); }