View file engine/includes/compatibility.php

File size: 4.65Kb
<?php

   /**
    * Тут огромное количество гк, которое написано для совместимости модулей от dcms 6.4.4
    */

    @ini_set('display_errors', false);
    error_reporting(0);
    
    include_once H . 'engine/functions/delete_dir.php';

    function aut()
	{
        global $set, $sql;
        $meta_og = array();
        $user_id = Core::$user_id;
        $time = time();
        $show_theme = isset($_COOKIE['set_theme']) && ($_COOKIE['set_theme'] == 'default' || $_COOKIE['set_theme'] == 'web')
		? $_COOKIE['set_theme'] :
		(!empty($user['set_them']) ? $user['set_them'] : $set['theme']);
        if ($user_id)
        {
            $user = Core::get_user($user_id);
        }
        include incDir . 'head.php';
    }
    
    function title(){return '';}
    
    function rekl($sel)
    {
        $sql->query('SELECT `name`, `link`, `img`, `new_line` FROM `ads` WHERE `pos` = "'.($sel == 1 || $sel == 2 ? 'top' : 'bottom').'" AND `time` > '.$time.' AND `main` = "'. (int) ($sel == 3 && $_SERVER['PHP_SELF']!='/index.php').'"');
        while($ads = $sql->fetch())
        {
            if (!empty($ads['img']))
            {
                if (!empty($ads['new_line']))
                {
                    echo '<br />';
                }
                ?>
                <a href="<?=$ads['link']?>"><img src="<?=$ads['img']?>" alt="" title="<?=$ads['name']?>"/></a>
                <?php
            }
            else
            {
                ?>
                <div class="rekl"><a href="<?=$ads['link']?>"><?=$ads['name']?></a></div>
                <?php
            }
        }
        $sql->free();
    }
    
    function passgen($len, $types)
    {
        return text::passgen($len);
    }
    
    $passgen = text::passgen(12);
    
    function output_text($str,$br=1,$html=1,$smiles=1,$links=1,$bbcode=1)
    {
        return text::output($str, array('html' => $html, 'br' => $br, 'smiles' => $smiles, 'bbocde' => $bbcode));
    }
    
    function translit($str)
    {
        return $str;
    }
    
    function strlen2($str)
    {
        return mb_strlen($str);
    }
    
    function smiles($msg)
    {
        return text::smiles($msg);
    }
    
    function BBcode($msg)
    {
        return text::bbcode($msg);
    }
    
    function avatar($id)
    {
        return Core::user_avatar($id);
    }
    
    function status($user=NULL)
    {
        return Core::user_icon(Core::get_user($id));
    }
    
    function online()
    {
        return '';
    }
    
    function otkuda()
    {
        return '';
    }
    
    function user_access()
    {
        global $admin;
        return $admin;
    }
    
    function k_page($k_post=0,$k_p_str=10)
    {
        $page = new page($k_post, $k_p_str);
        return $page->k_page();
    }
    
    function page($k_page)
    {
        $page = 1;

        if (isset($_GET['page']))
        {
		    if ($_GET['page'] == 'end')
            {
			    $page = intval($k_page);
			}
            elseif (is_numeric($_GET['page']))
			{
			    $page = intval($_GET['page']);
			}
		}
			
		if ($page < 1)
            $page = 1;
			
		return $page;
    }
    
    function str($link, $page)
    {
        return $page->display($link);
    }
    
    function adm_check()
    {
        global $creator;
        return $creator;
    }
    
    function query($query)
    {
        global $sql;
        return $sql->query($query)->result;
    }
    
    function esc($text)
    {
        return $text;
    }

    function br($text)
    {
        return nl2br($text);
    }
    
    function get_user($user_id=0)
    {
        return Core::get_user($user_id);
    }
    
    function vremja($time=NULL)
    {
        return Core::time($time);
    }
    
    function only_reg($link = NULL) 
    {
        if (Core::$user_id == 0)
        {
            Core::stop($link);
        }
    }
    
    function only_unreg($link = NULL) 
    {
        if (Core::$user_id > 0)
        {
            Core::stop($link);
        }
    }
    
    function err()
    {
        global $err;
        echo Core::msg_show($err);
    }
    
    function msg($msg)
    {
        echo Core::msg_show($msg, 'msg');
    }
    
    function save_settings($set)
    {
        return Core::save_settings($set);
    }
    
    function admin_log(){}
    

    $db = mysql_connect($set['mysql_host'], $set['mysql_user'], $set['mysql_pass']);
    mysql_select_db($set['mysql_db_name'], $db);
    mysql_set_charset('utf8');