<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Системные настройки
=============================================
Official website: http://shcms.ru
=============================================
Данный код защищен авторскими правами
=============================================
*/
defined('SHCMS') or die('Переход на данных раздел запрещено');
session_name("SHCMS");
session_start();
define("H", $_SERVER["DOCUMENT_ROOT"].'/');
include_once H.'system/inc/defined.php';
include_once H.'system/inc/ini_set.php';
version_compare(PHP_VERSION, '5.2', '>=') or die('Ваш хозяин должен использовать PHP 5.1 или выше для запуска данной версии SHCMS Engine!');
/*
-------------------------------
Соединение с базой
-------------------------------
*/
include_once 'config.php';
$user_db = DBUSER;
$user_user = DBNAME;
$user_localhost = DBHOST;
$user_pass = DBPASS;
/*
-----------------------------------------------
Автоматическая загрузка классов
-----------------------------------------------
*/
$opendirphp1=opendir(H.'/system/inc/classes/');
while ($open_files1=readdir($opendirphp1))
{
if (eregi('\.php$',$open_files1))
{
include_once(H.'/system/inc/classes/'.$open_files1);
}
}
/*
-----------------------------------------------
Загрузка файлов с папки /include/
-----------------------------------------------
*/
$opendirphp=opendir(H.'system/inc/include/');
while ($open_files=readdir($opendirphp))
{
if (eregi('\.php$',$open_files))
{
include_once(H.'system/inc/include/'.$open_files);
}
}
$resting = mysql_fetch_array(mysql_query("SELECT * FROM `settings_shcms`"));
$settings_shcms = mysql_fetch_array(mysql_query("SELECT * FROM `settings_shcms`"));
function shcms_sh_shcms($engine_str) {
$engine_str = htmlentities(trim($engine_str), ENT_QUOTES, 'UTF-8');
$engine_str = nl2br($engine_str);
$engine_str = strtr($engine_str, array (
chr(0)=> '', chr(1)=> '', chr(2)=> '', chr(3)=> '', chr(4)=> '', chr(5)=> '', chr(6)=> '', chr(7)=> '',
chr(8)=> '', chr(9)=> '', chr(10)=> '', chr(11)=> '', chr(12)=> '', chr(13)=> '', chr(14)=> '', chr(15)=> '',
chr(16)=> '', chr(17)=> '', chr(18)=> '', chr(19)=> '', chr(20)=> '', chr(21)=> '', chr(22)=> '', chr(23)=> '',
chr(24)=> '', chr(25)=> '', chr(26)=> '', chr(27)=> '', chr(28)=> '', chr(29)=> '', chr(30)=> '', chr(31)=> ''
));
$engine_str = str_replace("\'", "'", $engine_str);
$engine_str = str_replace('\\', "\", $engine_str);
$engine_str = mysql_real_escape_string($engine_str);
return $engine_str;
}
/* Переназначение функций */
function my_esc($str) {
return mysql_real_escape_string($str);
}
function rus_lat($engine_str)
{
$engine_str= strtr($engine_str, array (
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z',
'и' => 'i', 'й' => 'i', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch',
'ъ' => "", 'ы' => 'y', 'ь' => "", 'э' => 'ye', 'ю' => 'yu', 'я' => 'ya'
));
return $engine_str;
}
if (isset ($_SESSION['SESSION_ID']) && isset ($_SESSION['SESSION_PASS'])) {
$user_id = intval($_SESSION['SESSION_ID']);
$user_ps = $_SESSION['SESSION_PASS'];
}
elseif (isset ($_COOKIE['COOKIE_ID']) && isset ($_COOKIE['COOKIE_PASS'])) {
$user_id = intval(base64_decode($_COOKIE['COOKIE_ID']));
$_SESSION['SESSION_ID'] = $user_id;
$user_ps = md5($_COOKIE['COOKIE_PASS']);
$_SESSION['SESSION_PASS'] = $user_ps;
$cookauth = true;
}
if ($user_id && $user_ps) {
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '$user_id' LIMIT 1");
if (mysql_num_rows($req)) {
$datauser = mysql_fetch_assoc($req);
if ($user_ps === $datauser['password']) {
$login = $datauser['login'];
}
else {
unset ($_SESSION['SESSION_ID']);
unset ($_SESSION['SESSION_PASS']);
setcookie('COOKIE_ID', '');
setcookie('COOKIE_PASS', '');
$user_id = false;
$user_ps = false;
}
}
else {
unset ($_SESSION['SESSION_ID']);
unset ($_SESSION['SESSION_PASS']);
setcookie('COOKIE_ID', '');
setcookie('COOKIE_PASS', '');
$user_id = false;
$user_ps = false;
}
}
$user4 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$user_id'"));
$users_nav = mysql_fetch_array(mysql_query("SELECT * FROM `users`"));
$users_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$user_id'"));
/**
* Неавторизованные пользователи
* будут находится на стандарстных
* Web Wap темах
*/
$users_them = mysql_query(mysql_fetch_array("SELECT * FROM `users`"));
/**
* Определения браузера
* WEB WAP
*/
$h_ua = str_replace('windows ce', '', strtolower($_SERVER['HTTP_USER_AGENT']));
if (!$h_ua ||
strpos($h_ua, 'windows') !== false ||
strpos($h_ua, 'linux') !== false ||
strpos($h_ua, 'bsd') !== false ||
strpos($h_ua, 'x11') !== false ||
strpos($h_ua, 'unix') !== false ||
strpos($h_ua, 'macintosh') !== false ||
strpos($h_ua, 'macos') !== false)
{
$brodilka = "web";
}
else
{
$brodilka = "wap";
}
/**
* Проверка пользователя на бан
* Если пользователь в бане его перекинет
* на страницу ban.php
*/
if (!isset($list_bans) && mysql_result(mysql_query("SELECT COUNT(*) FROM `ban_users` WHERE `user_id` = '$user_id' AND (`time_1` > '".(time())."')"), 0))
{
header('Location: '.DIR_SHCMS.'ban.php?');
exit();
}
$act = isset ($_GET['act']) ? trim($_GET['act']) : '';
/**
* Функция определяет возрост пользователя
* @param getAge(год,месяц,день);
*/
function getAge($y, $m, $d)
{
if($m > date('m') || $m == date('m') && $d > date('d'))
return (date('Y') - $y - 1);
else
return (date('Y') - $y);
}
if(!$user_id)
{
$users_user['wap'] = 'shcms';
$users_user['web'] = 'shcms_web';
}
SHCMS_core::manual_output();
SHCMS_core::online_guest();
mysql_query("UPDATE `users` SET `datelast`= '".time()."' WHERE `id`='$user_id'");
mysql_query("DELETE FROM `reklama` WHERE `time_end` < '".time()."' AND `list` = 'Вверхняя часть'");
function CheckCanGzip() {
if( headers_sent() || connection_aborted() || ! function_exists( 'ob_gzhandler' ) || ini_get( 'zlib.output_compression' ) ) return 0;
if( strpos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip' ) !== false ) return "x-gzip";
if( strpos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) !== false ) return "gzip";
return 0;
}
?>