View file system/inc/basic_settings.php

File size: 7.67Kb
<?
/*
=============================================
 Движок:  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';

/*
 * Проверка версии 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;

		
/*
 * Автоматическая загрузка классов /classes/
*/		
    $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`"));
	
    $get_OS = SHCMS_core::GET_OS($_SERVER['HTTP_USER_AGENT']);
				
		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("\'", "&#39;", $engine_str);
            $engine_str = str_replace('\\', "&#92;", $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'"));
		
		
	
		 $users_them = mysql_query(mysql_fetch_array("SELECT * FROM `users`"));
	 
     /*
	  * Проверка пользователя на бан
	  * Если пользователь в бане его перекинет
	  * на страницу 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']) : '';
	$admin = isset ($_GET['admin']) ? trim($_GET['admin']) : '';
	 	if($user_id == false){
            $users_user['wap'] = 'shcms';
            $users_user['web'] = 'shcms_web';
			$users_user['itouch'] = 'shcms_itouch';
		}
		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` = 'Вверхняя часть'");
	//Определение языка для гостя и для пользователя
	if(isset($user_id)) {
	    Lang::setLang($user4['language']);
	}else {
	    Lang::setLang($settings_shcms['language']);
	}
	
	function browser(){
if ( stristr($_SERVER['HTTP_USER_AGENT'], 'Firefox') ) $browser = 'firefox';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'Chrome') ) $browser = 'chrome';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'Safari') ) $browser = 'safari';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'Opera') ) $browser = 'opera';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0') ) $browser = 'ie6';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0') ) $browser = 'ie7';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0') ) $browser = 'ie8';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') ) $browser = 'Opera Mini';
elseif ( stristr($_SERVER['HTTP_USER_AGENT'], 'ucweb') ) $browser = 'ucweb';
else $browser = 'Неизвестно'; 
return $browser;
}

if($settings_shcms['show'] == 1) {
echo '<script type="text/javascript" src="/template/show.js"></script>';
}

	?>