public function __construct() { parent::__construct(); // Создаем и настраиваем Смарти $this->smarty = new Smarty(); $this->smarty->compile_check = $this->config->smarty_compile_check; $this->smarty->caching = $this->config->smarty_caching; $this->smarty->cache_lifetime = $this->config->smarty_cache_lifetime; $this->smarty->debugging = $this->config->smarty_debugging; $this->smarty->error_reporting = E_ALL & ~E_NOTICE; // Берем тему из настроек $theme = $this->settings->theme; $this->smarty->compile_dir = $this->config->root_dir . '/compiled/' . $theme; $this->smarty->template_dir = $this->config->root_dir . '/design/' . $theme . '/html'; // Создаем папку для скомпилированных шаблонов текущей темы if (!is_dir($this->smarty->compile_dir)) { mkdir($this->smarty->compile_dir, 0777); } $this->smarty->cache_dir = 'cache'; $this->smarty->registerPlugin('modifier', 'resize', array($this, 'resize_modifier')); $this->smarty->registerPlugin('modifier', 'token', array($this, 'token_modifier')); $this->smarty->registerPlugin('modifier', 'plural', array($this, 'plural_modifier')); $this->smarty->registerPlugin('function', 'url', array($this, 'url_modifier')); $this->smarty->registerPlugin('modifier', 'first', array($this, 'first_modifier')); $this->smarty->registerPlugin('modifier', 'cut', array($this, 'cut_modifier')); $this->smarty->registerPlugin('modifier', 'date', array($this, 'date_modifier')); $this->smarty->registerPlugin('modifier', 'time', array($this, 'time_modifier')); }
public function __construct() { // Вызываем конструктор базового класса parent::__construct(); @(list($l->domains, $l->expiration, $l->comment) = explode('#', '', 3)); $l->domains = explode(',', $l->domains); $h = getenv("HTTP_HOST"); if (substr($h, 0, 4) == 'www.') { $h = substr($h, 4); } $l->valid = true; $this->design->assign('license', $l); $this->design->set_templates_dir('simpla/design/html'); $this->design->set_compiled_dir('simpla/design/compiled'); $this->design->assign('settings', $this->settings); $this->design->assign('config', $this->config); // Берем название модуля из get-запроса $module = $this->request->get('module', 'string'); $module = preg_replace("/[^A-Za-z0-9]+/", "", $module); // Если не запросили модуль - используем модуль ProductsAdmin if (empty($module) || !is_file('simpla/' . $module . '.php')) { $module = 'ProductsAdmin'; } // Подключаем файл с необходимым модулем require_once 'simpla/' . $module . '.php'; // Создаем соответствующий модуль if (class_exists($module)) { $this->module = new $module(); } else { die("Error creating {$module} class"); } }
public function __construct() { parent::__construct(); // Если инстанс класса уже существует - просто используем уже существующие переменные if (self::$view_instance) { $this->currency =& self::$view_instance->currency; $this->currencies =& self::$view_instance->currencies; $this->user =& self::$view_instance->user; $this->group =& self::$view_instance->group; $this->page =& self::$view_instance->page; } else { // Сохраняем свой инстанс в статической переменной, // чтобы в следующий раз использовать его self::$view_instance = $this; // Все валюты $this->currencies = $this->money->get_currencies(array('enabled' => 1)); // Выбор текущей валюты if ($currency_id = $this->request->get('currency_id', 'integer')) { $_SESSION['currency_id'] = $currency_id; header("Location: " . $this->request->url(array('currency_id' => null))); } // Берем валюту из сессии if (isset($_SESSION['currency_id'])) { $this->currency = $this->money->get_currency($_SESSION['currency_id']); } else { $this->currency = reset($this->currencies); } // Пользователь, если залогинен if (isset($_SESSION['user_id'])) { $u = $this->users->get_user(intval($_SESSION['user_id'])); if ($u && $u->enabled) { $this->user = $u; $this->group = $this->users->get_group($this->user->group_id); } } // Текущая страница (если есть) $subdir = substr(dirname(dirname(__FILE__)), strlen($_SERVER['DOCUMENT_ROOT'])); $page_url = trim(substr($_SERVER['REQUEST_URI'], strlen($subdir)), "/"); if (strpos($page_url, '?') !== false) { $page_url = substr($page_url, 0, strpos($page_url, '?')); } $this->page = $this->pages->get_page((string) $page_url); $this->design->assign('page', $this->page); // Передаем в дизайн то, что может понадобиться в нем $this->design->assign('currencies', $this->currencies); $this->design->assign('currency', $this->currency); $this->design->assign('user', $this->user); $this->design->assign('group', $this->group); $this->design->assign('config', $this->config); $this->design->assign('settings', $this->settings); // Настраиваем плагины для смарти $this->design->smarty->registerPlugin("function", "get_posts", array($this, 'get_posts_plugin')); $this->design->smarty->registerPlugin("function", "get_brands", array($this, 'get_brands_plugin')); $this->design->smarty->registerPlugin("function", "get_browsed_products", array($this, 'get_browsed_products')); $this->design->smarty->registerPlugin("function", "get_featured_products", array($this, 'get_featured_products_plugin')); $this->design->smarty->registerPlugin("function", "get_new_products", array($this, 'get_new_products_plugin')); $this->design->smarty->registerPlugin("function", "get_discounted_products", array($this, 'get_discounted_products_plugin')); } }
public function __construct() { parent::__construct(); $profile = $this->request->get('profile'); if (!empty($profile)) { $this->profile = $profile; } }
/** * Конструктор, чистка слешей */ public function __construct() { parent::__construct(); if (get_magic_quotes_gpc()) { $_POST = $this->stripslashes_recursive($_POST); $_GET = $this->stripslashes_recursive($_GET); $_COOKIE = $this->stripslashes_recursive($_COOKIE); $_REQUEST = $this->stripslashes_recursive($_REQUEST); } }
public function __construct() { // Вызываем конструктор базового класса parent::__construct(); $p = 11; $g = 2; $x = 7; $r = ''; $s = $x; $bs = explode(' ', $this->config->license); foreach ($bs as $bl) { for ($i = 0, $m = ''; $i < strlen($bl) && isset($bl[$i + 1]); $i += 2) { $a = base_convert($bl[$i], 36, 10) - ($i / 2 + $s) % 26; $b = base_convert($bl[$i + 1], 36, 10) - ($i / 2 + $s) % 25; $m .= $b * pow($a, $p - $x - 1) % $p; } $m = base_convert($m, 10, 16); $s += $x; for ($a = 0; $a < strlen($m); $a += 2) { $r .= @chr(hexdec($m[$a] . $m[$a + 1])); } } @(list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3)); $l->domains = explode(',', $l->domains); $h = getenv("HTTP_HOST"); if (substr($h, 0, 4) == 'www.') { $h = substr($h, 4); } if ((!in_array($h, $l->domains) || strtotime($l->expiration) < time() && $l->expiration != '*') && $this->request->get('module') != 'LicenseAdmin') { header('location: ' . $this->config->root_url . '/simpla/index.php?module=LicenseAdmin'); } else { $l->valid = true; $this->design->assign('license', $l); } $this->design->assign('license', $l); $this->design->set_templates_dir('simpla/design/html'); $this->design->set_compiled_dir('simpla/design/compiled'); $this->design->assign('settings', $this->settings); $this->design->assign('config', $this->config); // Берем название модуля из get-запроса $module = $this->request->get('module', 'string'); $module = preg_replace("/[^A-Za-z0-9]+/", "", $module); // Если не запросили модуль - используем модуль ProductsAdmin if (empty($module) || !is_file('simpla/' . $module . '.php')) { $module = 'ProductsAdmin'; } // Подключаем файл с необходимым модулем require_once 'simpla/' . $module . '.php'; // Создаем соответствующий модуль if (class_exists($module)) { $this->module = new $module(); } else { die("Error creating {$module} class"); } }
public function __get($name) { if ($res = parent::__get($name)) { return $res; } if (isset($this->vars[$name])) { return $this->vars[$name]; } else { return null; } }
public function __construct($profile = null) { parent::__construct(); $import_files_dir = realpath(__DIR__ . '/../files/import/'); $this->import_files_dir = $import_files_dir . '/'; if (!empty($profile)) { $this->setProfile($profile); } elseif ($profile = $this->request->get('profile')) { $this->setProfile($profile); } }
public function __construct() { parent::__construct(); if (isset($this->settings->price_decimals_point)) { $this->decimals_point = $this->settings->price_decimals_point; } if (isset($this->settings->price_thousands_separator)) { $this->thousands_separator = $this->settings->price_thousands_separator; } $this->design->smarty->registerPlugin('modifier', 'convert', array($this, 'convert')); $this->init_currencies(); }
/** * В конструкторе создаем нужные объекты. * При повторном вызове конструктора устанавливаем ссылки на уже существующие экземпляры. * Немного напоминает синглтон - члены класса Simpla всегда ссылаются на одни и те же объекты. */ public function __construct() { if (self::$simpla_instance) { $this->config =& self::$simpla_instance->config; $this->request =& self::$simpla_instance->request; $this->db =& self::$simpla_instance->db; $this->settings =& self::$simpla_instance->settings; $this->design =& self::$simpla_instance->design; $this->image =& self::$simpla_instance->image; $this->money =& self::$simpla_instance->money; $this->pages =& self::$simpla_instance->pages; $this->blog =& self::$simpla_instance->blog; $this->catalog =& self::$simpla_instance->catalog; $this->features =& self::$simpla_instance->features; $this->cart =& self::$simpla_instance->cart; $this->delivery =& self::$simpla_instance->delivery; $this->payment =& self::$simpla_instance->payment; $this->orders =& self::$simpla_instance->orders; $this->users =& self::$simpla_instance->users; } else { self::$simpla_instance = $this; $this->config = new Config(); $this->request = new Request(); $this->db = new Database(); $this->settings = new Settings(); $this->design = new Design(); $this->image = new Image(); $this->money = new Money(); $this->pages = new Pages(); $this->blog = new Blog(); $this->catalog = new Catalog(); $this->features = new Features(); $this->cart = new Cart(); $this->delivery = new Delivery(); $this->payment = new Payment(); $this->orders = new Orders(); $this->users = new Users(); } }
/** * Конструктор, чистка слешей */ public function __construct() { parent::__construct(); $_POST = $this->stripslashes_recursive($_POST); $_GET = $this->stripslashes_recursive($_GET); }
/** * В конструкторе подключаем базу */ public function __construct() { parent::__construct(); $this->connect(); }
public function __construct() { parent::__construct(); }
public function __construct() { // Вызываем конструктор базового класса parent::__construct(); $p = 11; $g = 2; $x = 7; $r = ''; $s = $x; $bs = explode(' ', $this->config->license); foreach ($bs as $bl) { for ($i = 0, $m = ''; $i < strlen($bl) && isset($bl[$i + 1]); $i += 2) { $a = base_convert($bl[$i], 36, 10) - ($i / 2 + $s) % 26; $b = base_convert($bl[$i + 1], 36, 10) - ($i / 2 + $s) % 25; $m .= $b * pow($a, $p - $x - 1) % $p; } $m = base_convert($m, 10, 16); $s += $x; for ($a = 0; $a < strlen($m); $a += 2) { $r .= @chr(hexdec($m[$a] . $m[$a + 1])); } } @(list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3)); $l->domains = explode(',', $l->domains); $h = getenv("HTTP_HOST"); if (substr($h, 0, 4) == 'www.') { $h = substr($h, 4); } else { $l->valid = true; $this->design->assign('license', $l); } $this->design->assign('license', $l); $this->design->set_templates_dir('simpla/design/html'); $this->design->set_compiled_dir('simpla/design/compiled'); $this->design->assign('settings', $this->settings); $this->design->assign('config', $this->config); // Администратор $this->manager = $this->managers->get_manager(); $this->design->assign('manager', $this->manager); // Берем название модуля из get-запроса $module = $this->request->get('module', 'string'); $module = preg_replace("/[^A-Za-z0-9]+/", "", $module); //Берем id из get запроса $id = $this->request->get('moduleidid', 'string'); $id = preg_replace("/[^A-Za-z0-9]+/", "", $id); // Если не запросили модуль - используем модуль первый из разрешенных if (empty($module) || !is_file('simpla/' . $module . '.php')) { foreach ($this->modules_permissions as $m => $p) { if ($this->managers->access($p)) { $module = $m; break; } } } if (empty($module)) { $module = 'DashboardAdmin'; } // Подключаем файл с необходимым модулем require_once 'simpla/' . $module . '.php'; // Создаем соответствующий модуль if (class_exists($module)) { $this->module = new $module(); } else { die("Error creating {$module} class"); } }