Esempio n. 1
1
function Crypt_Decode($String, $Key = HOST_ID)
{
    /****************************************************************************/
    $__args_types = array('string', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $String = Base64_Decode($String);
    #-----------------------------------------------------------------------------
    if (empty($String)) {
        return $String;
    }
    #-----------------------------------------------------------------------------
    if (Extension_Loaded('mcrypt')) {
        #---------------------------------------------------------------------------
        $Module =& Link_Get('Crypt');
        #---------------------------------------------------------------------------
        if (!Is_Resource($Module)) {
            #-------------------------------------------------------------------------
            $Module = @MCrypt_Module_Open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
            if (!Is_Resource($Module)) {
                return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось открыть дескриптор');
            }
            #-------------------------------------------------------------------------
            $Iv = @MCrypt_Create_Iv(MCrypt_Enc_Get_Iv_Size($Module), MCRYPT_RAND);
            if (!$Iv) {
                return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось создать IV');
            }
            #-------------------------------------------------------------------------
            $Key = SubStr($Key, 0, MCrypt_Enc_Get_Key_Size($Module));
            #Debug(SPrintF("[system/libs/auto/Crypt]: Decode Key = %s",$Key));
            #-------------------------------------------------------------------------
            $IsInit = @MCrypt_Generic_Init($Module, $Key, $Iv);
            if (!Is_Integer($IsInit)) {
                return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось инициализовать модуль дешифрования');
            }
        }
        #---------------------------------------------------------------------------
        $String = @MDecrypt_Generic($Module, $String);
        if (!Is_String($String)) {
            return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось дешифровать данные');
        }
        #---------------------------------------------------------------------------
        $String = Trim($String);
        #---------------------------------------------------------------------------
    }
    #-----------------------------------------------------------------------------
    return $String;
}
Esempio n. 2
0
 public function twip($options = null)
 {
     $this->parse_variables($options);
     ob_start();
     $compressed = $this->compress && Extension_Loaded('zlib') && ob_start("ob_gzhandler");
     if ($this->mode == 't') {
         $this->transparent_mode();
     } else {
         if ($this->mode == 'o') {
             $this->override_mode();
         } else {
             if ($this->mode == 'i') {
                 $this->override_mode(true);
             } else {
                 header('HTTP/1.0 400 Bad Request');
             }
         }
     }
     $str = ob_get_contents();
     if ($compressed) {
         ob_end_flush();
     }
     header('Content-Length: ' . ob_get_length());
     ob_flush();
     if ($this->debug) {
         print_r($this);
         print_r($_SERVER);
         file_put_contents('debug', ob_get_contents() . $str);
         ob_clean();
     }
     if ($this->dolog) {
         file_put_contents('log', $this->method . ' ' . $this->request_uri . "\n", FILE_APPEND);
     }
 }
Esempio n. 3
0
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     if ($action->id != 'error' && Extension_Loaded('zlib')) {
         Ob_End_Flush();
     }
     return $result;
 }
Esempio n. 4
0
 static function stop()
 {
     self::$stopTime = microtime(true);
     //将获取的时间赋给成员属性$stopTime
     if (Config::config('debug')) {
         //显示DEBUG信息
         debug::message();
     }
     if (Extension_Loaded('zlib') && Config::config('gzip')) {
         @Ob_End_Flush();
     }
 }
Esempio n. 5
0
 public static function init()
 {
     #-------------------------------------------------------------------------------
     if (self::$instance === NULL) {
         #-------------------------------------------------------------------------------
         try {
             #-------------------------------------------------------------------------------
             Debug("[system/classes/auto/CacheManager.class.php]: Start initializing cache system.");
             #-------------------------------------------------------------------------------
             if (Extension_Loaded(MemcachedCache::EXT_NAME) && File_Exists(SPrintF('%s/.memcached', SYSTEM_PATH))) {
                 #-------------------------------------------------------------------------------
                 Debug('[system/classes/auto/CacheManager.class.php]: Force load MemcachedCache');
                 #-------------------------------------------------------------------------------
                 self::$instance = MemcachedCache::getInstance();
                 #-------------------------------------------------------------------------------
             } else {
                 if (Extension_Loaded(APCCache::EXT_NAME)) {
                     #-------------------------------------------------------------------------------
                     Debug('[system/classes/auto/CacheManager.class.php]: Load APCCache');
                     #-------------------------------------------------------------------------------
                     self::$instance = APCCache::getInstance();
                     #-------------------------------------------------------------------------------
                 } else {
                     if (Extension_Loaded(MemcachedCache::EXT_NAME)) {
                         #-------------------------------------------------------------------------------
                         Debug('[system/classes/auto/CacheManager.class.php]: Load MemcachedCache');
                         #-------------------------------------------------------------------------------
                         self::$instance = MemcachedCache::getInstance();
                         #-------------------------------------------------------------------------------
                     } else {
                         #-------------------------------------------------------------------------------
                         throw new Exception("Any supported cache not installed in your sysytem.");
                     }
                 }
             }
             #-------------------------------------------------------------------------------
             Debug("Cache system has been initialized.");
             #-------------------------------------------------------------------------------
         } catch (Exception $e) {
             #-------------------------------------------------------------------------------
             Debug("Cache system has not been installed: " . $e->getTraceAsString());
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     return self::$instance;
     #-------------------------------------------------------------------------------
 }
 public static function setHeader()
 {
     //CORS header
     if (preg_match('/\\([^)]*OS\\s*[^)]*6/i', $_SERVER['HTTP_USER_AGENT'])) {
         header('Cache-Control:no-cache,no-store,must-revalidate');
     }
     header("Content-type: text/javascript");
     //Gzip压缩 ,不能同时使用 ob_gzhandler() 和 zlib.output_compression。
     if (Extension_Loaded('zlib') && !ini_get('zlib.output_compression')) {
         //解决PHP开启Gzip页面没有输出的故障
         if (strnatcasecmp(PHP_VERSION, '5.3') <= 0 && ini_get('output_buffering') == "4096") {
             ini_set('output_buffering', 0);
         }
         //如果zlib扩展已经加载到PHP中,用php的内置压缩函数
         ob_start('ob_gzhandler');
     }
 }
Esempio n. 7
0
    } else {
        $Test = array('Status' => 'Не найдено', 'IsOk' => FALSE, 'Comment' => 'Приложение mysql не найдено. Пожалуйста, воспользуйтесь менеджером пакетов для установки данной программы <A target="blank" href="http://wiki.joonte.com/?title=Документация:Подготовка_к_установке">[подробнее...]</A>');
    }
    #-----------------------------------------------------------------------------
    $Test['Name'] = 'Версия клиента базы данных MySQL';
    #-----------------------------------------------------------------------------
    $Tests[] = $Test;
    #-----------------------------------------------------------------------------
    #-----------------------------------------------------------------------------
    $Tests[] = 'Проверка модулей PHP';
    #-----------------------------------------------------------------------------
    $Extensions = array('gd', 'json', 'libxml', 'mbstring', 'mysqli', 'mysql', 'openssl', 'xml', 'iconv');
    #-----------------------------------------------------------------------------
    foreach ($Extensions as $Extension) {
        #---------------------------------------------------------------------------
        $IsLoaded = Extension_Loaded($Extension);
        #---------------------------------------------------------------------------
        $Tests[] = array('Name' => SPrintF('Модуль %s', $Extension), 'Status' => $IsLoaded ? 'Установлен' : 'Не найден', 'IsOk' => $IsLoaded, 'Comment' => SPrintF('Модуль <U>%s</U> не установлен в системе. Для его установки воспользуйтесь возможностями менеджера пакетов операционной системы или утилиты phpize, <A target="blank" href="http://wiki.joonte.com/?title=Документация:Подготовка_к_установке">[подробнее...]</A>', $Extension));
    }
    #-----------------------------------------------------------------------------
    echo '<FORM method="POST">';
    #-----------------------------------------------------------------------------
    $IsError = FALSE;
    #-----------------------------------------------------------------------------
    foreach ($Tests as $Test) {
        #---------------------------------------------------------------------------
        if (Is_Scalar($Test)) {
            #-------------------------------------------------------------------------------
            $Echo = <<<EOD
<TR>
 <TD colspan="2" class="Separator">%s</TD>
Esempio n. 8
0
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE);
//date_default_timezone_set (PRC);
@ini_set('date.timezone', 'Asia/Shanghai');
@Extension_Loaded('zlib') ? ob_start('ob_gzhandler') : ob_start();
ob_implicit_flush(1);
if (function_exists(session_cache_limiter)) {
    session_cache_limiter('private, must-revalidate');
}
session_start();
set_magic_quotes_runtime(0);
define('IN_ONEZ', TRUE);
define('ONEZ_ROOT', substr(dirname(__FILE__), 0, -7));
if (PHP_VERSION < '4.1.0') {
    $_GET =& $HTTP_GET_VARS;
    $_POST =& $HTTP_POST_VARS;
    $_COOKIE =& $HTTP_COOKIE_VARS;
    $_SERVER =& $HTTP_SERVER_VARS;
    $_ENV =& $HTTP_ENV_VARS;
    $_FILES =& $HTTP_POST_FILES;
}
require_once ONEZ_ROOT . './include/global.func.php';
require_once ONEZ_ROOT . './include/cache.func.php';
$magic_quotes_gpc = @get_magic_quotes_gpc();
if ($magic_quotes_gpc) {
    $_POST = ostripslashes($_POST);
    $_GET = ostripslashes($_GET);
}
require_once ONEZ_ROOT . './config.inc.php';
include_once ONEZ_ROOT . './onezdata/setting.php';
Esempio n. 9
0
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Settings = $Config['Tasks']['Types']['CheckEmail'];
#-------------------------------------------------------------------------------
$KeyPrefix = $Config['Tasks']['Types']['TicketsMessages']['KeyPrefix'];
#-------------------------------------------------------------------------------
# проверяем необходимые для работы расширения
$Extensions = array('imap', 'mailparse');
#-------------------------------------------------------------------------------
foreach ($Extensions as $Extension) {
    #-------------------------------------------------------------------------------
    if (!Extension_Loaded($Extension)) {
        #-------------------------------------------------------------------------------
        Debug(SPrintF('[comp/Tasks/GC/CheckSoftWare]: Extensions not found: %s', $Extension));
        #-------------------------------------------------------------------------------
        $GLOBALS['TaskReturnInfo'] = SPrintF('not found php extension: %s, sleep 1 hour', $Extension);
        #-------------------------------------------------------------------------------
        return 3600;
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$ExecuteTime = Comp_Load('Formats/Task/ExecuteTime', array('ExecutePeriod' => $Settings['ExecutePeriod']));
if (Is_Error($ExecuteTime)) {
    return ERROR | @Trigger_Error(500);
}
Esempio n. 10
0
<?php

//更新用户访问信息
if ($user->uid != '') {
    $SqlStr = 'UPDATE `' . DB_TABLE_PRE . 'user_ext` SET thisvisit=' . TIMESTAMP . ' WHERE uid=' . $user->uid;
    $MyDatabase->SqlStr = $SqlStr;
    if ($MyDatabase->ExecuteQuery()) {
    } else {
        ErrorMsg($SqlStr . '文件:' . __FILE__ . '<br />行数:' . __LINE__ . '<br />原因:更新用户状态失败!');
    }
}
//Gzip是否启用
$str_gzip = '<font color=red>disable</font>';
if (Extension_Loaded('zlib')) {
    $str_gzip = '<font color=green>enable</font>';
}
//SQL查询次数
$str_sqlcount = $MyDatabase->QueryCount;
//代码执行时间
$str_processtime = getprocesstime($startime);
require TP . 'foot.php';