function __construct() { //Заполняем uri $sql = 'SELECT valto FROM {{redirects}} WHERE valfrom=\'' . $_SERVER['REQUEST_URI'] . '\''; $valto = DB::getOne($sql); if ($valto) { header('HTTP/1.1 301 Moved Permanently'); if (substr($valto, 0, 7) == 'http://') { header('Location: ' . $valto); } else { header('Location: http://' . $_SERVER['HTTP_HOST'] . $valto); } die; } if (strpos($_SERVER['REQUEST_URI'], '?') !== false) { $uri = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); } else { $uri = $_SERVER['REQUEST_URI']; } self::$uri = explode('/', substr(str_replace('.html', '', $uri), 1, strlen($uri))); if (SITE_LANG_TYPE == 'subdomain') { $st = explode('.', $_SERVER['HTTP_HOST']); } else { $st[0] = self::$uri[0]; } if (self::$uri[count(self::$uri) - 1] == '') { unset(self::$uri[count(self::$uri) - 1]); } if (Funcs::$uri[0] == 'catalog' && is_numeric(end(Funcs::$uri))) { //unset(Funcs::$uri[count(Funcs::$uri)-2]); $uri = Funcs::$uri; Funcs::$uri = array(); foreach ($uri as $item) { Funcs::$uri[] = $item; } } elseif (Funcs::$uri[0] == 'catalog' && !is_numeric(end(Funcs::$uri))) { $sql = 'SELECT id FROM {{reference}} WHERE visible=1 AND parent=0 AND path=\'vendor\''; $parent = DB::getOne($sql); if ($parent) { $sql = 'SELECT * FROM {{reference}} WHERE visible=1 AND parent=' . $parent . ' AND path=\'' . end(Funcs::$uri) . '\''; $vendor = DB::getRow($sql); if ($vendor['id']) { unset(Funcs::$uri[count(Funcs::$uri) - 1]); $uri = Funcs::$uri; Funcs::$uri = array(); foreach ($uri as $item) { Funcs::$uri[] = $item; } $_GET['ve'] = $vendor['id']; } } } $dir = explode('/', $_SERVER['PHP_SELF']); self::$cdir = $dir[1]; self::$sites = Funcs::getSites(); if (Funcs::$uri[0] == ONESSA_DIR) { self::$sitesMenu = Funcs::getSitesMenu(); if (is_numeric($_GET['site'])) { $_SESSION['OneSSA']['site'] = $_GET['site']; } elseif (!$_SESSION['OneSSA']['site']) { $_SESSION['OneSSA']['site'] = self::$sites[1]['id']; } Funcs::$site = self::$sites[$_SESSION['OneSSA']['site']]['domain']; Funcs::$lang = self::$sites[$_SESSION['OneSSA']['site']]['lvalue']; } else { foreach (self::$sites as $item) { $sites[$item['domain']] = $item; } if (key_exists($st[0], $sites)) { $_SESSION['site'] = $sites[$st[0]]['id']; Funcs::$site = $sites[$st[0]]['domain']; Funcs::$lang = $sites[$st[0]]['lvalue']; $sql = 'SELECT id FROM {{tree}} WHERE visible=1 AND parent=0'; Funcs::$siteDB = DB::getOne($sql); } else { Funcs::$siteDB = 1; $_SESSION['site'] = 1; Funcs::$site = self::$sites[1]['domain']; Funcs::$lang = self::$sites[1]['lvalue']; } if (!Funcs::$OneSSA) { if (Funcs::$site != 'www') { Funcs::$path = '/' . Funcs::$site; } else { Funcs::$path = ''; } } if (!Funcs::$OneSSA && OneSSA::$settings['useMultiView'] == true) { Funcs::$vpr = '/' . $sites[$st[0]]['domain']; } if (key_exists(self::$uri[0], $sites)) { unset(self::$uri[0]); $uri = self::$uri; self::$uri = array(); foreach ($uri as $item) { self::$uri[] = $item; } } //Funcs::$parent=3; } //заполняем переменную $getstr $getstr = ''; if (count($_GET) != 0) { foreach ($_GET as $key => $item) { $getstr .= '&' . $key . '=' . $item; } $_SESSION['getstr'] = substr($getstr, 1, strlen($getstr)); } self::$seo_title = SITE_NAME; if ($_SESSION['goods'] == '') { $_SESSION['goods'] = array(); } self::$conf = Funcs::getConfig(); self::$reference = Funcs::getReference(); self::$referenceId = Funcs::getReference(1); self::$infoblock = Funcs::getInfoblock(); self::$infoblockNum = Funcs::getInfoblock(2); Funcs::getProperties(); if (!isset($_SESSION['perpage'])) { $_SESSION['perpage'] = array(); foreach (self::$conf['perpage'] as $path => $item) { if ($_SESSION['perpage'][$path] == '') { $_SESSION['perpage'][$path] = $item; } } } if (isset($_GET['pp']) && isset($_SESSION['perpage'][Funcs::$uri[0]])) { $_SESSION['perpage'][Funcs::$uri[0]] = $_GET['pp']; } elseif (isset($_GET['pp']) && isset($_SESSION['perpage'][Funcs::$uri[1]])) { $_SESSION['perpage'][Funcs::$uri[1]] = $_GET['pp']; } if ($_SESSION['perpage'][Funcs::$uri[0]] == 'all') { $_SESSION['perpage'][Funcs::$uri[0]] = 500000; } file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/u/onessa.txt', 'oneSSA © Studio oneTOUCH'); self::getRegions(); require_once $_SERVER['DOCUMENT_ROOT'] . '/' . ONESSA_DIR . '/lib/mobile.inc.php'; $m = new Mobile_Detect(); self::$mobile = $m->isMobile(); self::setSEO(); $dir = explode('/', $_SERVER['PHP_SELF']); self::$OneSSA = $dir[1]; if (self::$OneSSA != ONESSA_DIR) { self::$OneSSA = ''; } else { self::$OneSSA = '/' . self::$OneSSA; } if (Funcs::$prop['sitedir'] == 0) { $userdir = UPLOAD_DIR . Funcs::$site; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $userdir)) { mkdir($_SERVER['DOCUMENT_ROOT'] . $userdir, 0777); chmod($_SERVER['DOCUMENT_ROOT'] . $userdir, 0777); mkdir($_SERVER['DOCUMENT_ROOT'] . $userdir . PHOTO_DIR, 0777); chmod($_SERVER['DOCUMENT_ROOT'] . $userdir . PHOTO_DIR, 0777); mkdir($_SERVER['DOCUMENT_ROOT'] . $userdir . FILES_DIR, 0777); chmod($_SERVER['DOCUMENT_ROOT'] . $userdir . FILES_DIR, 0777); } $_SESSION['uploaddir'] = $userdir . '/'; } else { $_SESSION['uploaddir'] = UPLOAD_DIR; } }