请高手指点,PHP问题,解密出一个文件,不知道这个是什么用的,怎么使用,谢谢好友指点

 请高手指点,PHP问题,解密出一个文件,不知道这个是什么用的,怎么使用,谢谢好友指点


这个文件怎么使用才行


<?php
 
class kernel
{
    public $__setting;
    public $_funcPkg;
    public $models;
    public $_app_version = '2.0';
    public $__call_libs;
    public $_co_depth = 0;
    public $memcache = false;

    public function kernel()
    {
        set_error_handler(array(&$this, 'errorHandler'));
        $this->_halt_err_level = 1 | 256 | 16 | 4;
        $this->_start = $this->microtime();
        $GLOBALS['system'] = &$this;

        if (!get_magic_quotes_gpc()) {
            safevar($_GET);
            safevar($_POST);
            safevar($_COOKIE);
        }

        set_include_path(CORE_DIR . '/include' . PATH_SEPARATOR . '.');
        require 'defined.php';
        error_reporting(30719);
        if (defined('WITH_MEMCACHE') && WITH_MEMCACHE) {
            $this->init_memcache();
        }

        if (!defined('HOME_DIR') || (defined('WITHOUT_CACHE') && WITHOUT_CACHE)) {
            $this->cache = new nocache();
        }
        else {
            require 'cachemgr.php';
            if (defined('WITH_MEMCACHE') && WITH_MEMCACHE) {
                require PLUGIN_DIR . '/functions/cache_memcache.php';
                $this->cache = new cache_memcache();
            }
            else if (defined('CACHE_METHOD')) {
                require PLUGIN_DIR . '/functions/' . CACHE_METHOD . '.php';
                $cache_method = CACHE_METHOD;
                $this->cache = new $cache_method();
            }
            else if (php_sapi_name() == 'isapi') {
                require 'secache.php';
                require 'secache_no_flock.php';
                $this->cache = new secache_no_flock();
            }
            else {
                require 'secache.php';
                $this->cache = new secache();
            }
        }

        require 'setmgr.php';
        $this->__setting = new setmgr();
        $this->set_timezone(SERVER_TIMEZONE);
    }

    public function init_memcache()
    {
        if (!$this->memcache) {
            $this->memcache = new Memcache();
            $ports = explode(',', MEMCACHED_PORT);

            foreach (explode(',', MEMCACHED_HOST) as $i => $M) {
                $this->memcache->addServer($M, $ports[$i]);
            }

            $this->memcache->pconnect();
        }
    }

    public function set_timezone($tz)
    {
        if (function_exists('date_default_timezone_set')) {
            $tz = 0 - $tz;
            if ((12 < $tz) || ($tz < -12)) {
                $tz = 0;
            }

            date_default_timezone_set('Etc/GMT' . (0 < $tz ? '+' . $tz : $tz));
        }
    }

    public function base_url()
    {
        if (!isset($this->_base_url)) {
            if ($url = $this->getConf('store.shop_url')) {
                $this->_base_url = substr($url, -1, 1) == '/' ? $url : $url . '/';
            }
            else {
                $this->_base_url = 'http://' . $_SERVER['HTTP_HOST'] . substr(PHP_SELF, 0, strrpos(PHP_SELF, '/') + 1);
                $this->setConf('store.shop_url', $this->_base_url);
            }
        }

        return $this->_base_url;
    }

    public function call($method, $args)
    {
        if (!$method) {
            return false;
        }

        if (!$this->__call_libs[$method]) {
            if ($s = strpos($method, '.')) {
                $class = substr($method, 0, $s);
                $func = substr($method, $s + 1);
                require_once PLUGIN_DIR . '/functions/' . $class . '.php';

                if (!$this->__call_obj[$class]) {
                    $this->__call_obj[$class] = new $class();
                }

                $this->__call_libs[$method] = array($this->__call_obj[$class], $func);
            }
            else {
                require_once PLUGIN_DIR . '/functions/' . $method . '.php';
                $this->__call_libs[$method] = $method;
            }
        }

        return call_user_func_array($this->__call_libs[$method], $args);
    }

    public function microtime()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $usec + (double) $sec;
    }

    public function realUrl($ctl, $act = 'index', $args = NULL, $extName = 'html', $base_url = NULL)
    {
        if (!isset($this->__emu_static)) {
            $this->__emu_static = !$this->getConf('system.seo.emuStatic');
            $this->__link_builder = $this->getConf('system.seo.mklink');
        }

        if (!isset($this->_base_link)) {
            $this->_base_link = $base_url;

            if ($this->__emu_static) {
                $this->_base_link .= APP_ROOT_PHP . '?';
            }
        }

        if (($ctl == 'page') && ($act == 'index')) {
            return $this->_base_link;
        }
        else {
            return $this->_base_link . $this->call($this->__link_builder, array($ctl ? $ctl : $this->request['action']['controller'], $act ? $act : $this->request['action']['method'], $args, $extName));
        }
    }

    public function shutdown()
    {
    }

    public function errorHandler($errno, $errstr, $errfile, $errline)
    {
        return $errno == $this->_halt_err_level & $errno ? false : true;
    }

    public function log($message, $level = E_NOTICE, $code = 0)
    {
        if (defined('LOG_LEVEL') && is_int(LOG_LEVEL)) {
            if ($level == LOG_LEVEL & $level) {
                if (!isset($this->_log)) {
                    include 'dazuiLog.php';
                    $this->_log = new dazuiLog();
                }

                $this->_log->log($code, $message);
            }
        }
    }

    public function co_start()
    {
        $this->_co_depth++;
    }

    public function co_end()
    {
        return array_keys($this->_cacheObjects[$this->_co_depth--]);
    }

    public function checkExpries($cname)
    {
             for ($i = $this->_co_depth; 0 < $i; $i--) {
                foreach ($cname as $obj) {
                    $this->_cacheObjects[$i][strtoupper($obj)] = 1;
                }
            }
        
    }

    public function template($clone = false)
    {
        if (!isset($this->_smarty) || $clone) {
            include_once CORE_DIR . '/lib/smarty/Smarty.class.php';
            $smarty = new smarty();
            $smarty->debug = false;
            $smarty->system = &$this;

            if ($clone) {
                return $smarty;
            }
            else {
                $this->_smarty = &$smarty;
            }
        }

        return $this->_smarty;
    }

    public function network()
    {
        if (!isset($this->_network)) {
            include_once CORE_DIR . '/lib/Snoopy.class.php';
            $this->_network = new Snoopy();
        }

        return $this->_network;
    }

    public function incomming()
    {
        if (!isset($this->_in)) {
            ini_get('magic_quotes_gpc');
            $this->_in = ini_get('magic_quotes_gpc') ? $_REQUEST : $this->_safe_var($_REQUEST);
        }

        return $this->_in;
    }

    public function _safe_var($var)
    {
        foreach ($var as $k => $v) {
            if (is_array($v)) {
                $var[$k] = $this->_safe_var($v);
            }
            else {
                $var[$k] = addslashes($v);
            }
        }

        return $var;
    }

    public function database()
    {
        if (!isset($this->__db)) {
            require_once CORE_DIR . '/lib/adodb_lite/adodb.inc.php';
            require_once 'AloneDB.php';
            $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC;
            $this->__db = new AloneDB();
            $this->__db->prefix = DB_PREFIX;
        }

        return $this->__db;
    }

    public function cache()
    {
        if (!isset($this->__cache)) {
            require_once 'smartCache.php';
            $this->__cache = new smartCache($this, HOME_DIR . '/cache/data');
        }

        return $this->__cache;
    }

    public function event($hookevent, &$arg0, &$arg1, &$arg2)
    {
        if (!isset($this->__hookslist)) {
        }

        if (is_array($this->__hookslist[$hookevent])) {
            foreach ($this->__hookslist[$hookevent] as $i => $hook) {
                if ($hook['pkg']) {
                    $hookfile = $this->pkgPath($hook['pkg']) . '/hooks/' . $hook['pkg'] . '.' . $hook['method'] . '.php';
                    $hookObjName = 'hook_' . $hook['pkg'] . '_' . $hook['method'];
                }
                else {
                    $hookfile = CORE_DIR . '/admin/hooks/hook.' . $hook['object'] . '.php';
                    $hookObjName = 'hook_' . $hook['object'];
                }

                if (file_exists($hookfile)) {
                    require $hookfile;
                    $hookObj = new $hookObjName();
                    $hookObj->shopId = $_SESSION['SHOP_ID'];
                    $hookObj->db = &$this->database();

                    if (!$hookObj->$hook['method']($arg0, $arg1, $arg2)) {
                        return false;
                    }
                }
                else {
                    unset($this->__hookslist[$i]);
                }
            }
        }

        return true;
    }

    public function error($errcode = 404, $errmsg = NULL)
    {
        if ($errcode == 404) {
            $this->responseCode(404);
        }

        header('X-JSON: ' . json_encode(array('code' => $errcode, 'id' => time())));
        exit('<h1>Error:' . $errcode . '</h1><p>' . $errmsg . '</p>');
    }

    public function pkgPath($pkg_name)
    {
        if (is_dir(PLUGIN_DIR . '/packages/' . $pkg_name)) {
            return PLUGIN_DIR . '/packages/' . $pkg_name;
        }
        else {
            return false;
        }
    }

    public function throwit($errtype, $errmsg, $errcode)
    {
        $this->errors[] = array('type' => $errtype, 'msg' => $errmsg, 'code' => $errcode);
    }

    public function popErrors($num = 1)
    {
        if ($num == 1) {
            return array_pop($this->errors);
        }
        else if (1 < $num) {
            $ret = array_slice($this->errors, 0 - $num);
            $this->errors = array_slice($this->errors, $num);
            return $ret;
        }
    }

    public function loadModel($modelName, $single = true)
    {
        if (isset($this->models[strtolower($modelName)])) {
            return $this->models[strtolower($modelName)];
        }

        require_once 'modelFactory.php';
        require_once CORE_DIR . '/model/' . dirname($modelName) . '/mdl.' . basename($modelName) . '.php';
        $className = 'mdl_' . basename($modelName);

        if (defined('CUSTOM_CORE_DIR')) {
            $cusinc = CUSTOM_CORE_DIR . '/model/' . dirname($modelName) . '/cmd.' . basename($modelName) . '.php';

            if (file_exists($cusinc)) {
                require_once $cusinc;
                $className = 'cmd_' . basename($modelName);
            }
        }

        $object = new $className();
        $object->modelName = $modelName;
        $this->models[strtolower($modelName)] = &$object;
        return $object;
    }

    public function loadSchema($schema_id)
    {
        if (include_once PLUGIN_DIR . '/schema/' . $schema_id . '/schema.php') {
            $className = 'schema_' . $schema_id;
            $obj = new $className($this);
            return $obj;
        }
        else {
            return false;
        }
    }

    public function callAction(&$objCtl, $act_method, $args = NULL)
    {
        if (isset($objCtl->_call)) {
            array_unshift($args, $act_method);
            $act_method = $objCtl->_call;
        }

        if (($act_method[0] !== '_') && method_exists($objCtl, $act_method)) {
            if (0 < count($args)) {
                call_user_func_array(array(&$objCtl, $act_method), $args);
            }
            else {
                call_user_func_array(array(&$objCtl, $act_method), array());
            }

            return true;
        }
        else {
            return false;
        }
    }

    public function output($content, $expired_time = 0, $mime_type = MIME_HTML, $headers = false, $filename = NULL)
    {
        $lastmodified = gmdate('D, d M Y H:i:s');
        $expires = gmdate('D, d M Y H:i:s', time() + 20);
        header('Last-Modified: ' . $lastmodified . ' GMT');
        header('Expires: ' . $expires . ' GMT');

        if (is_array($headers)) {
            foreach ($headers as $theheader) {
                header($theheader);
            }
        }

        if ($mime_type == MIME_HTML) {
            header('Content-Type: text/html; charset=utf-8');
            echo $content;
        }
        else {
            header('Content-Type: ' . $mime_type . '; charset=utf-8');

            if ($filename) {
                header('Content-Disposition: inline; filename="' . $filename . '"');
            }

            flush();
            echo $content;
        }
    }

    public function getConf($key)
    {
        return $this->__setting->get($key, $var);
    }

    public function setConf($key, $data, $immediately = false)
    {
        return $this->__setting->set($key, $data, $immediately);
    }

    public function sprintf()
    {
        $args = func_get_args();
        $str = $args[0];
        unset($args[0]);
        $str = preg_replace_callback('/\\$([a-z\\.\\_0-9]+)\\$/is', array(&$this, '_rep_conf'), $str);

        foreach ($args as $k => $v) {
            $str = str_replace('%' . $k, $v, $str);
        }

        return $str;
    }

    public function _rep_conf($matches)
    {
        return $this->getConf($matches[1]);
    }

    public function sfile($file, $file_bak = NULL, $head_redect = false)
    {
        if (!file_exists($file)) {
            $file = $file_bak;
        }

        $etag = md5_file($file);
        header('Etag: ' . $etag);
        if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag)) {
            header('HTTP/1.1 304 Not Modified', true, 304);
            exit(0);
        }
        else {
            set_time_limit(0);
            header('Expires: ' . $expires . ' GMT');
            header('Cache-Control: public');
            session_cache_limiter('public');
            sendfile($file);
        }
    }

    public function responseCode($code)
    {
        $codeArr = array(100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported');
        header('HTTP/1.1 ' . $code . ' ' . $codeArr[$code], true, $code);
    }

    public function version()
    {
        if (!file_exists(CORE_DIR . '/version.txt')) {
            $return = array();
        }
        else {
            $return = parse_ini_file(CORE_DIR . '/version.txt');
        }

        $return['app'] = $this->_app_version;
        return $return;
    }

    public function api_call($instance, $host, $file, $port = 80, $tolken)
    {
        require_once API_DIR . '/include/api_utility.php';

        if (!$this->intance_api[$instance]) {
            $this->intance_api[$instance] = new api_utility($host, $file, $port, $tolken);
        }

        return $this->intance_api[$instance];
    }
}

class nocache
{
    public function set($key, $value)
    {
        return true;
    }

    public function get($key, $value)
    {
        return false;
    }

    public function setModified()
    {
    }

    public function status()
    {
    }

    public function clear()
    {
    }

    public function exec()
    {
    }
}

function safeVar(&$data)
{
    if (is_array($data)) {
        foreach ($data as $key => $value) {
            safevar($data[$key]);
        }
    }
    else {
        $data = addslashes($data);
    }
}


?>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风云幻变

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值