Minde/Klaidos/JustPageIT/index.php

Iš PHP, MySQL.
Peršokti į: navigaciją, paiešką
<?php
function smarty_block_dynamic( $param, $content, &$smarty )
{
    return $content;
}

function strip( $tpl_output, &$smarty )
{
    return preg_replace( "!\\s+!", " ", $tpl_output );
}

if ( isset( $setupdata['setup'] ) )
{
    echo "SYSTEM ERROR!";
    exit( );
}
if ( $setupdata['setup'] != 9 )
{
    echo "SYSTEM ERROR!";
    exit( );
}
error_reporting( E_ALL ^ E_NOTICE );
ini_set( "error_reporting", E_ALL ^ E_NOTICE );
if ( isset( $_GET['auth'] ) )
{
    $auth = NULL;
}
else
{
    $auth = $_GET['auth'];
}
if ( $auth == NULL )
{
    if ( isset( $_POST['auth'] ) )
    {
        $auth = NULL;
    }
    else
    {
        $auth = $_POST['auth'];
    }
}
if ( isset( $_GET['admin'] ) )
{
    $admin = NULL;
}
else
{
    $admin = $_GET['admin'];
}
if ( $admin == NULL )
{
    if ( isset( $_POST['admin'] ) )
    {
        $admin = NULL;
    }
    else
    {
        $admin = $_POST['admin'];
    }
}
include( $setupdata['core_dir']."/setup.php" );
include( $setupdata['core_dir']."/translate.php" );
$setupdata['default_languages'] = strtolower( $setupdata['default_languages'] );
include( $setupdata['core_dir']."/classes/mysql.php" );
$mysqlclass = new mysqlclass( );
$mysqlclass->connect_db( $setupdata['HostName'], $setupdata['UserName'], $setupdata['Password'], $setupdata['DBName'] );
include( $setupdata['core_dir']."/classes/errors.php" );
$err = new errorsclass( );
include( $setupdata['core_dir']."/classes/classes.php" );
$treeclass = new treecatalog( );
if ( function_exists( "register_shutdown_function" ) )
{
    register_shutdown_function( array( "TreeCatalog", "shutdownscript" ) );
}
if ( function_exists( "http_build_query" ) )
{
    function http_build_query( $data, $prefix = null, $sep = "", $key = "" )
    {
        $ret = array( );
        foreach ( ( array ) as $k => $v )
        {
            $k = urlencode( $k );
            if ( is_int( $k ) && $prefix != null )
            {
                $k = $prefix.$k;
            }
            if ( empty( $key ) )
            {
                $k = $key."[".$k."]";
            }
            if ( is_array( $v ) || is_object( $v ) )
            {
                array_push( $ret, http_build_query( $v, "", $sep, $k ) );
            }
            else
            {
                array_push( $ret, $k."=".urlencode( $v ) );
            }
        }
        if ( empty( $sep ) )
        {
            $sep = ini_get( "arg_separator.output" );
        }
        return implode( $sep, $ret );
    }
}
$is_xajax = false;
if ( isset( $admin ) || $admin == "1" )
{
    include( $setupdata['core_dir']."/xajax/xajax.inc.php" );
    $xajax = new xajax( $setupdata['base_href']."/index.php?".http_build_query( $_GET ) );
    $xajax->cleanbufferon( );
    $xajax->bDebug = false;
    $xajax->registerexternalfunctiondir( $setupdata['core_dir']."/xajax/plugins" );
    $xajax->registerexternalfunctiondir( $setupdata['xajax_user_plugins_dir'] );
    $is_xajax = true;
}
else if ( isset( $setupdata['xajax'] ) )
{
    include( $setupdata['core_dir']."/xajax/xajax.inc.php" );
    $xajax = new xajax( $setupdata['base_href']."/index.php?corexajax=1" );
    $xajax->cleanbufferon( );
    $xajax->bDebug = false;
    $xajax->registerexternalfunctiondir( $setupdata['xajax_user_plugins_dir'] );
    $is_xajax = true;
}
include( $setupdata['core_dir']."/classes/session.php" );
$ses = new sessions( );
include( $setupdata['core_dir']."/classes/images.php" );
$imageclass = new imagesclass( );
include( $setupdata['core_dir']."/classes/files.php" );
$fileclass = new filesclass( );
include( $setupdata['core_dir']."/classes/users.php" );
$usersclass = new usersclass( );
include( $setupdata['core_dir']."/classes/xml.php" );
$xmlclass = new xmlclass( );
require( $setupdata['core_dir']."/smarty/Smarty.class.php" );
require( $setupdata['core_dir']."/ext/smarty_ext.php" );
$smarty_ext = new smarty_ext( );
if ( isset( $setupdata['mysql']['character'] ) )
{
    $mysqlclass->mysql_my_query( "SET CHARACTER SET ".$setupdata['mysql']['character'], 85, __FILE__ );
    $mysqlclass->mysql_my_query( "SET NAMES ".$setupdata['mysql']['character'], 86, __FILE__ );
}
$system_id = 9999999;
if ( session_id( ) == "" )
{
    @session_name( "tvs_session_id" );
    @session_start( );
}
$ses->save_ses( );
$smarty = new smarty( );
$smarty->compile_dir = $setupdata['smarty_compile_dir'];
$smarty->config_dir = $setupdata['core_dir']."/smarty/configs";
$smarty->cache_dir = $setupdata['smarty_cache_dir'];
$smarty->register_object( "ext", $smarty_ext );
$smarty->register_object( "error", $err );
$smarty->debugging = false;
if ( isset( $setupdata['smarty_ext_template_dir'] ) )
{
    $smarty->ext_template_dir = $setupdata['smarty_ext_template_dir'];
}
if ( isset( $setupdata['smarty_user_plugins_dir'] ) )
{
    $setupdata['smarty_user_plugins_dir'] = "plugins/smarty";
}
if ( is_dir( $setupdata['site_dir'].$setupdata['smarty_user_plugins_dir'] ) )
{
    $smarty_plugins_dirs[] = $setupdata['site_dir'].$setupdata['smarty_user_plugins_dir'];
}
else if ( is_dir( getcwd( )."/".$setupdata['smarty_user_plugins_dir'] ) )
{
    $smarty_plugins_dirs[] = getcwd( )."/".$setupdata['smarty_user_plugins_dir'];
}
if ( is_dir( $setupdata['core_dir']."/smarty/tvs_plugins" ) )
{
    $smarty_plugins_dirs[] = $setupdata['core_dir']."/smarty/tvs_plugins";
}
$smarty_plugins_dirs[] = $setupdata['core_dir']."/smarty/plugins";
$smarty->plugins_dir = $smarty_plugins_dirs;
if ( isset( $_GET['clear_smarty_cache'] ) && $_GET['clear_smarty_cache'] == 1 )
{
    $smarty->clear_all_cache( );
    $smarty->clear_compiled_tpl( );
    print_r( "CLEAR CACHE" );
}
if ( isset( $setupdata['smarty_force_compile'] ) )
{
    $smarty->force_compile = $setupdata['smarty_force_compile'];
}
else
{
    $smarty->force_compile = false;
}
if ( isset( $setupdata['smarty_cache_modified_check'] ) )
{
    $smarty->cache_modified_check = $setupdata['smarty_cache_modified_check'];
}
else
{
    $smarty->cache_modified_check = true;
}
$smarty_ext->smarty = $smarty;
if ( isset( $setupdata['smarty_cache_modified_check'] ) )
{
    if ( isset( $setupdata['modules'], $setupdata['modules']['plugins']['path'] ) )
    {
        $plugin_dir_tmp = explode( "/", $setupdata['modules']['plugins']['path'] );
        unset( $plugin_dir_tmp[count( $plugin_dir_tmp ) - 1] );
        $plugin_dir = implode( "/", $plugin_dir_tmp );
    }
    foreach ( $setupdata['modules'] as $key => $sub_array )
    {
        if ( isset( $setupdata['modules']['plugins']['path'] ) && file_exists( $plugin_dir."/modules/".$key ) )
        {
            $dir = $plugin_dir."/modules/".$key;
            if ( $is_xajax !== false )
            {
                $xajax->registerexternalfunctiondir( $dir."/xajax" );
            }
            if ( file_exists( $dir."/".$key."class.php" ) )
            {
                include( $dir."/".$key."class.php" );
            }
            if ( file_exists( $dir."/smarty_ext_".$key.".php" ) )
            {
                require( $dir."/smarty_ext_".$key.".php" );
            }
        }
        else
        {
            $dir = $setupdata['core_dir']."/modules/".$key;
            if ( $is_xajax !== false )
            {
                $xajax->registerexternalfunctiondir( $dir."/xajax" );
            }
            if ( file_exists( $dir."/".$key."class.php" ) )
            {
                include( $dir."/".$key."class.php" );
            }
            if ( file_exists( $dir."/smarty_ext_".$key.".php" ) )
            {
                require( $dir."/smarty_ext_".$key.".php" );
            }
        }
        $var = $key."class";
        eval( "\$".$var." = new {$var};" );
        $var = "smarty_ext_".$key;
        eval( "\$".$var." = new {$var};" );
    }
}
if ( isset( $setupdata['modules']['plugins']['path'] ) )
{
    $plugins = $pluginsclass->get_all_plugins( );
    foreach ( $plugins as $plugin )
    {
        $dir = $setupdata['modules']['plugins']['path']."/".$plugin;
        if ( file_exists( $dir."/config.php" ) )
        {
            include( $dir."/config.php" );
        }
        if ( file_exists( $dir."/class.php" ) )
        {
            include( $dir."/class.php" );
        }
        if ( file_exists( $dir."/smarty.php" ) )
        {
            require( $dir."/smarty.php" );
        }
        $var = "plugin_class_".$plugin;
        eval( "\$".$var." = new {$var};" );
        $var = "plugin_smarty_".$plugin;
        eval( "\$".$var." = new {$var};" );
        $smarty->register_object( $var, $$var );
    }
}
if ( isset( $_GET['aerr'] ) )
{
    $aerr = NULL;
}
else
{
    $aerr = $_GET['aerr'];
}
if ( $aerr == NULL )
{
    if ( isset( $_POST['aerr'] ) )
    {
        $aerr = NULL;
    }
    else
    {
        $aerr = $_POST['aerr'];
    }
}
if ( isset( $_GET['inspic'] ) )
{
    $inspic = NULL;
}
else
{
    $inspic = $_GET['inspic'];
}
if ( $inspic == NULL )
{
    if ( isset( $_POST['inspic'] ) )
    {
        $inspic = NULL;
    }
    else
    {
        $inspic = $_POST['inspic'];
    }
}
if ( isset( $_GET['instab'] ) )
{
    $instab = NULL;
}
else
{
    $instab = $_GET['instab'];
}
if ( $instab == NULL )
{
    if ( isset( $_POST['instab'] ) )
    {
        $instab = NULL;
    }
    else
    {
        $instab = $_POST['instab'];
    }
}
if ( isset( $_GET['insfil'] ) )
{
    $insfil = NULL;
}
else
{
    $insfil = $_GET['insfil'];
}
if ( $insfil == NULL )
{
    if ( isset( $_POST['insfil'] ) )
    {
        $insfil = NULL;
    }
    else
    {
        $insfil = $_POST['insfil'];
    }
}
if ( isset( $_GET['insflash'] ) )
{
    $insflash = NULL;
}
else
{
    $insflash = $_GET['insflash'];
}
if ( $insflash == NULL )
{
    if ( isset( $_POST['insflash'] ) )
    {
        $insflash = NULL;
    }
    else
    {
        $insflash = $_POST['insflash'];
    }
}
if ( isset( $_GET['copys'] ) )
{
    $copys = NULL;
}
else
{
    $copys = $_GET['copys'];
}
if ( $copys == NULL )
{
    if ( isset( $_POST['copys'] ) )
    {
        $copys = NULL;
    }
    else
    {
        $copys = $_POST['copys'];
    }
}
if ( isset( $_GET['inslnk'] ) )
{
    $inslnk = NULL;
}
else
{
    $inslnk = $_GET['inslnk'];
}
if ( $inslnk == NULL )
{
    if ( isset( $_POST['inslnk'] ) )
    {
        $inslnk = NULL;
    }
    else
    {
        $inslnk = $_POST['inslnk'];
    }
}
if ( isset( $_GET['cart_add'] ) )
{
    $cart_add = NULL;
}
else
{
    $cart_add = $_GET['cart_add'];
}
if ( $cart_add == NULL )
{
    if ( isset( $_POST['cart_add'] ) )
    {
        $cart_add = NULL;
    }
    else
    {
        $cart_add = $_POST['cart_add'];
    }
}
if ( isset( $_GET['cart_module'] ) )
{
    $cart_module = NULL;
}
else
{
    $cart_module = $_GET['cart_module'];
}
if ( $cart_module == NULL )
{
    if ( isset( $_POST['cart_module'] ) )
    {
        $cart_module = NULL;
    }
    else
    {
        $cart_module = $_POST['cart_module'];
    }
}
$sql = $mysqlclass->mysql_my_query( "SELECT * FROM `".$setupdata['table_prefix']."local_vars`", 191, __FILE__ );
while ( $row = $mysqlclass->mysql_my_fetch_array( $sql, MYSQL_ASSOC ) )
{
    $setupdata['local_vars'][$row['name']] = $row['value'];
}
if ( $auth != NULL )
{
    include( $setupdata['core_dir']."/includes/auth.php" );
}
if ( isset( $setupdata['modules']['clients']['is'], $_COOKIE['client_username'], $_COOKIE['client_password'] ) && 0 < strlen( $_COOKIE['client_username'] ) && 0 < strlen( $_COOKIE['client_password'] ) )
{
    $result = $mysqlclass->mysql_my_query( "SELECT `parent` FROM `".$setupdata['table_prefix']."client_data` WHERE `name`='id_login' && '".$_COOKIE['client_username']."'=`value`", 198, __FILE__ );
    if ( 0 < $mysqlclass->mysql_my_num_rows( $result ) )
    {
        $row1 = $mysqlclass->mysql_my_fetch_array( $result, MYSQL_ASSOC );
        $result = $mysqlclass->mysql_my_query( "SELECT `value` FROM `".$setupdata['table_prefix']."client_data` WHERE `name`='id_pass' && `parent`=".$row1['parent'], 201, __FILE__ );
        if ( $mysqlclass->mysql_my_num_rows( $result ) == 1 )
        {
            $row2 = $mysqlclass->mysql_my_fetch_array( $result, MYSQL_ASSOC );
            if ( strtoupper( $row2['value'] ) == $_COOKIE['client_password'] )
            {
                $_SESSION['client_login_id'] = $row1['parent'];
                $mysqlclass->mysql_my_query( "DELETE FROM `".$setupdata['table_prefix']."sessions` WHERE `sesid` = '".session_id( )."' AND `status`='client'", 206, __FILE__ );
                $mysqlclass->mysql_my_query( "DELETE FROM `".$setupdata['table_prefix']."sessions` WHERE `userid` = '".$_SESSION['client_login_id']."'", 207, __FILE__ );
                $mysqlclass->mysql_my_query( "INSERT INTO `".$setupdata['table_prefix']."sessions` values('".session_id( )."', '".$_SESSION['client_login_id']."', '".$_SERVER['REMOTE_ADDR']."', '".date( "YmdHis" )."', '".date( "YmdHis" )."', 'client')", 208, __FILE__ );
                $_SESSION['client_havesess'] = 1;
                $ses->save_ses( );
            }
            else
            {
                setcookie( "client_username", "", time( ) - 3600 );
                setcookie( "client_password", "", time( ) - 3600 );
            }
        }
        else
        {
            setcookie( "client_username", "", time( ) - 3600 );
            setcookie( "client_password", "", time( ) - 3600 );
        }
    }
}
if ( isset( $admin ) || $admin == "1" )
{
    $result = $mysqlclass->mysql_my_query( "SELECT `userid`, `status` FROM `".$setupdata['table_prefix']."sessions` WHERE `sesid`='".session_id( )."' AND `status`='admin'", 224, __FILE__ );
    $w_status_a = $mysqlclass->mysql_my_fetch_row( $result )[1];
    $w_u_a = $mysqlclass->mysql_my_fetch_row( $result )[0];
    if ( !isset( $_SESSION['login_user'] ) || ( $_SESSION['login_user'] != $w_u_a || !$w_u_a ) && $_SESSION['login_user'] != $system_id )
    {
        include( $setupdata['core_dir']."/includes/_admin_.php" );
    }
    else
    {
        if ( $w_status_a == "admin" )
        {
            function login_ex( )
            {
            }
            if ( $inspic == "1" )
            {
                include( $setupdata['core_dir']."/includes/inspic.php" );
            }
            else
            {
                if ( $insfil == "1" )
                {
                    include( $setupdata['core_dir']."/includes/insfil.php" );
                }
                else
                {
                    if ( $insflash == "1" )
                    {
                        include( $setupdata['core_dir']."/includes/insflash.php" );
                    }
                    else
                    {
                        if ( $copys == "1" )
                        {
                            include( $setupdata['core_dir']."/includes/copy.php" );
                        }
                        else
                        {
                            include( $setupdata['core_dir']."/includes/_admin_.php" );
                        }
                    }
                }
            }
        }
        else
        {
            include( $setupdata['core_dir']."/includes/_admin_.php" );
        }
    }
}
else
{
    if ( isset( $setupdata['modules']['clients']['is'] ) )
    {
        $result = $mysqlclass->mysql_my_query( "SELECT `userid`, `status` FROM `".$setupdata['table_prefix']."sessions` WHERE `sesid`='".session_id( )."' AND `status`='client'", 240, __FILE__ );
        $w_status_c = $mysqlclass->mysql_my_fetch_row( $result )[1];
        $w_u_c = $mysqlclass->mysql_my_fetch_row( $result )[0];
        if ( !isset( $_SESSION['client_login_id'] ) || $_SESSION['client_login_id'] != $w_u_c || !$w_u_c )
        {
            $_SESSION['client_login_id'] = "";
            if ( isset( $_SESSION['client_havesess'] ) )
            {
                unset( $_SESSION['client_havesess'] );
            }
        }
        else
        {
            $_SESSION['client_login_id'] = $w_u_c;
        }
    }
    include( $setupdata['core_dir']."/includes/_guest_.php" );
}
if ( !isset( $_GET['show'] ) && isset( $_GET['benchmark'] ) )
{
    echo $treeclass->get_debug_info( );
}
$mysqlclass->close_db( );
exit( );
?>