Файл: Kagao-v3.0/upload/classes/init.php
Строк: 58
<?php
/*
 * (c) Kogao Software
 */
class InitLoader extends Session
{
    
    protected static $db;
    public static $dbCall;
    public static function dbconnect($config_controller){
        
        try{
            self::$db = new PDO('mysql:host='.$config_controller['db_host'].';dbname='.$config_controller['db_name'].';charset=utf8', $config_controller['db_user'], $config_controller['db_pass'],
            array(
                PDO::ATTR_PERSISTENT => true
            ));
        } catch( PDOException $e ){
            self::$db = NULL;
            die( $e->getMessage() );    
        }
            
    }
    
    public static function dbclose(){ self::$db = NULL; }
    public static function insertId(){ return self::$db->lastInsertId(); }
    public static function query( $sql ){ return self::$db->query( $sql ); }
    
    /*
     * @info module.on.off.controller
    */
    
    public static $module = array(
        "modul_mobile"    => true
    );
    public static function _GET( $key = false ){
        
        if( isset ( $_GET[$key] ) ){
            return htmlspecialchars($_GET[$key]);    
        }else{
            return false;    
        }
        
    }
    
    public static function issetGet( $key = false ){
        
        if( isset( $_GET[$key] ) ){
            return true;    
        }else{
            return false;
        }
            
    }
    public static function location( $requestURL = NULL ){
        
        ?><script type="text/javascript">location.href='<?php echo $requestURL; ?>';</script><?php
        
    }
    
}
class Init extends InitLoader{
    
    public function __construct(){
        
    }
    
    public static function db( $arg = NULL ){
        
        if( is_null( self::$dbCall ) ){
        
            self::$dbCall = new self();
            
        }
        
        return self::$dbCall;
            
    }
        
}
?>