Вход Регистрация
Файл: adultscript-2.0.3-pro/files/libraries/framework/ajax.php
Строк: 70
<?php
defined
('_VALID') or die('Restricted Access!');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0'false);
header('Pragma: no-cache');
class 
VAjax
{
    public static function 
process()
    {
        
$process FALSE;
        
$script  = (isset($_GET['s']) && preg_match('/^[A-Za-z0-9_-]+$/'$_GET['s'])) ? $_GET['s'] : FALSE;
        if (
$script) {
            
$domain     = (isset($_GET['d'])) ? trim($_GET['d']) : 'frontend';
            if (
$domain == 'frontend') {
                
$template   VF::cfg_item('template');
                
$plugin_dir    BASE_DIR.'/templates/'.$template.'/extend/ajax';
            } elseif (
$domain == 'backend') {
                if (!
VAuth::group('Administrator')) {
                    die(
'Invalid permissions!');
                }
            
                
$template   VF::cfg_item('template_admin');
                
$plugin_dir BASE_DIR.'/admin/templates/'.$template.'/extend/ajax';
            } elseif (
$domain == 'profile') {
                
$template   = (isset($_GET['t']) && preg_match('/^[A-Za-z0-9-]+$/'$_GET['t'])) ? $_GET['t'] : FALSE;
                
$plugin_dir BASE_DIR.'/profile/templates/'.$template.'/extend/ajax';
            } elseif (
$domain == 'mobile') {
                
$template    'default';
                
$plugin_dir BASE_DIR.'/mobile/templates/'.$template.'/extend/ajax';
            }
            
            if (isset(
$template)) {
                
$plugin_path    $plugin_dir.'/'.$script.'.plugin.php';
                if (
file_exists($plugin_path)) {
                    
$process TRUE;
                }
            }
        }
        
        
VF::load('framework.compat.functions.json');
        
        if (
$process) {
            
ob_start();
            require 
$plugin_path;
            
ob_end_clean();
            
            
VLanguage::load('frontend.global');
            
            
$function_name  'ajax_plugin_'.$script;
            
$result         $function_name();
            if (
$result != '') {
                echo 
$result;
            }

            die();
        }
        
//        $data = array();
//        if (VF::cfg_item('debug') == '1') {
//            $data = array(
//                'status' => 0,
//                'msg' => 'Ajax plugin not found ('.$plugin_path.')! Aborting!',
//                'debug' => 'script: '.$script.', domain: '.$domain.', template: '.$template
//            );
//        }
        
        
header('HTTP/1.0 404 Not Found');
        
        if (
VF::cfg_item('debug') == '1') {
            
$data = array(
                
'status' => 0,
                
'msg'     => 'Ajax plugin not found ('.$plugin_path.')! Aborting...',
                
'debug'  => 'script: '.$script.', domain: '.$domain.', template: '.$template
            
);
            
            echo 
json_encode($data);
        }
        
        die();
    }
}
?>
Онлайн: 1
Реклама