Beispiel #1
0
function build_runtime()
{
    // 加载常量定义文件
    require THINK_PATH . '/Common/defines.php';
    // 加载路径定义文件
    require defined('PATH_DEFINE_FILE') ? PATH_DEFINE_FILE : THINK_PATH . '/Common/paths.php';
    // 定义核心编译的文件
    $runtime[] = THINK_PATH . '/Common/functions.php';
    // 系统函数
    if (version_compare(PHP_VERSION, '5.2.0', '<')) {
        // 加载兼容函数
        $runtime[] = THINK_PATH . '/Common/compat.php';
    }
    // 核心基类必须加载
    $runtime[] = THINK_PATH . '/Lib/Think/Core/Think.class.php';
    // 读取核心编译文件列表
    if (is_file(CONFIG_PATH . 'core.php')) {
        // 加载项目自定义的核心编译文件列表
        $list = (include CONFIG_PATH . 'core.php');
    } else {
        if (defined('THINK_MODE')) {
            // 根据设置的运行模式加载不同的核心编译文件
            $list = (include THINK_PATH . '/Mode/' . strtolower(THINK_MODE) . '.php');
        } else {
            // 默认核心
            $list = (include THINK_PATH . '/Common/core.php');
        }
    }
    $runtime = array_merge($runtime, $list);
    // 加载核心编译文件列表
    foreach ($runtime as $key => $file) {
        if (is_file($file)) {
            require $file;
        }
    }
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(RUNTIME_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } else {
        // 检查缓存目录
        check_runtime();
    }
    // 生成核心编译缓存 去掉文件空白以减少大小
    if (!defined('NO_CACHE_RUNTIME')) {
        echo "gggggg";
        $compile = defined('RUNTIME_ALLINONE');
        $content = compile(THINK_PATH . '/Common/defines.php', $compile);
        $content .= compile(defined('PATH_DEFINE_FILE') ? PATH_DEFINE_FILE : THINK_PATH . '/Common/paths.php', $compile);
        foreach ($runtime as $file) {
            $content .= compile($file, $compile);
        }
        if (defined('STRIP_RUNTIME_SPACE') && STRIP_RUNTIME_SPACE == false) {
            file_put_contents(RUNTIME_PATH . '~runtime.php', '<?php' . $content);
        } else {
            file_put_contents(RUNTIME_PATH . '~runtime.php', strip_whitespace('<?php' . $content));
        }
        unset($content);
    }
}
Beispiel #2
0
 /**
  * 应用程序初始化
  */
 public static function start()
 {
     // 注册AUTOLOAD方法
     spl_autoload_register('Think\\Think::autoLoad');
     // 设定错误和异常处理
     register_shutdown_function('Think\\Think::fatalError');
     set_error_handler('Think\\Think::appError');
     set_exception_handler('Think\\Think::appException');
     // 初始化文件存储方式
     Storage::connect(STORAGE_TYPE);
     $runtimeFile = RUNTIME_PATH . APP_MODE . '~runtime.php';
     if (!APP_DEBUG && Storage::has($runtimeFile)) {
         Storage::load($runtimeFile);
     } else {
         $content = '';
         // 读取应用模式
         $mode = (include is_file(CONF_PATH . 'core.php') ? CONF_PATH . 'core.php' : MODE_PATH . APP_MODE . '.php');
         // 加载核心文件
         foreach ($mode['core'] as $file) {
             if (is_file($file)) {
                 include $file;
                 if (!APP_DEBUG) {
                     $content .= compile($file);
                 }
             }
         }
         // 加载应用模式配置文件
         foreach ($mode['config'] as $key => $file) {
             is_numeric($key) ? C(load_config($file)) : C($key, load_config($file));
         }
     }
 }
function build_runtime()
{
    // 加载常量定义文件
    require CORE_PATH . '/sociax/defines.php';
    // 加载路径定义文件
    require CORE_PATH . '/sociax/paths.php';
    // 定义核心编译的文件
    $runtime[] = CORE_PATH . '/sociax/functions.php';
    // 系统函数
    $runtime[] = CORE_PATH . '/sociax/extend.php';
    // 扩展函数库
    if (version_compare(PHP_VERSION, '5.2.0', '<')) {
        // 加载兼容函数
        $runtime[] = THINK_PATH . '/Common/compat.php';
    }
    // 核心基类必须加载
    $runtime[] = THINK_PATH . '/Core/Think.class.php';
    // 读取核心编译文件列表
    if (is_file(CONFIG_PATH . 'core.php')) {
        // 加载项目自定义的核心编译文件列表
        $list = (include CONFIG_PATH . 'core.php');
    } else {
        // 加载核心编译文件
        $list = (include CORE_PATH . '/sociax/core.php');
    }
    $runtime = array_merge($runtime, $list);
    // 加载核心编译文件列表
    foreach ($runtime as $key => $file) {
        if (is_file($file)) {
            require $file;
        }
    }
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(RUNTIME_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } else {
        // 检查缓存目录
        check_runtime();
    }
    // 生成核心编译缓存 去掉文件空白以减少大小
    // ALL_IN_ONE模式时, NO_CACHE_RUNTIME无效
    if (!defined('NO_CACHE_RUNTIME')) {
        define('NO_CACHE_RUNTIME', false);
    }
    if (RUNTIME_ALLINONE || !NO_CACHE_RUNTIME) {
        $compile = RUNTIME_ALLINONE;
        $content = compile(CORE_PATH . '/sociax/defines.php', $compile);
        $content .= compile(CORE_PATH . '/sociax/paths.php', $compile);
        foreach ($runtime as $file) {
            $content .= compile($file, $compile);
        }
        if (defined('STRIP_RUNTIME_SPACE') && STRIP_RUNTIME_SPACE == false) {
            file_put_contents(RUNTIME_PATH . '/~runtime.php', '<?php' . $content);
        } else {
            file_put_contents(RUNTIME_PATH . '/~runtime.php', strip_whitespace('<?php' . $content));
        }
        unset($content);
    }
}
Beispiel #4
0
/**
 * 压缩框架文件
 *
 */
function build()
{
    $args = func_get_args();
    extract($args[0]);
    $compile = '';
    $list = array(BASE_PATH . '/framework/core/runtime.php', BASE_PATH . '/framework/core/base.php', BASE_PATH . '/framework/core/model.php', BASE_PATH . '/framework/cache/cache.php', BASE_PATH . '/framework/cache/cache.file.php', BASE_PATH . '/framework/db/' . strtolower($dbdriver) . '.php', BASE_PATH . '/framework/function/goods.php', BASE_PATH . '/framework/libraries/email.php', BASE_PATH . '/framework/libraries/language.php', BASE_PATH . '/framework/libraries/log.php', BASE_PATH . '/framework/libraries/page.php', BASE_PATH . '/framework/libraries/security.php', BASE_PATH . '/framework/libraries/validate.php', BASE_PATH . '/framework/libraries/upload.php', BASE_PATH . '/framework/function/core.php', BASE_PATH . '/framework/tpl/nc.php', BASE_PATH . '/control/control.php', BASE_PATH . '/language/' . $lang_type . '/core_lang_index.php', BASE_PATH . '/classes/process.class.php');
    if (!empty($cache_type) && strtolower($cache_type) != 'file') {
        $list[] = BASE_PATH . '/framework/cache/cache.' . strtolower($cache_type) . '.php';
    }
    foreach ($list as $file) {
        if (file_exists($file)) {
            $compile .= compile($file);
        } else {
            exit(str_replace(BASE_PATH, '', $file) . " isn't exists!");
        }
    }
    //加载核心语言包
    //	$lang_file = BASE_PATH.'/language/'.$lang_type.'/core_lang_index.php';
    //	if (!file_exists($lang_file)){
    //		exit(str_replace(BASE_PATH,'',$lang_file)." isn't exists!");
    //	}
    $compile .= compile($lang_file);
    $compile .= "\nLanguage::appendLanguage(\$lang);";
    $compile .= "\nBase::run();";
    file_put_contents(RUNCOREPATH, compress_code("<?php defined('InShopNC') or exit('Access Invalid!');" . $compile));
}
 public function run(&$params)
 {
     if (!defined('BUILD_LITE_FILE')) {
         return;
     }
     $litefile = C('RUNTIME_LITE_FILE', null, RUNTIME_PATH . 'lite.php');
     if (is_file($litefile)) {
         return;
     }
     $defs = get_defined_constants(true);
     $content = 'namespace {$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
     if (MEMORY_LIMIT_ON) {
         $content .= '$GLOBALS[\'_startUseMems\'] = memory_get_usage();';
     }
     // 生成数组定义
     unset($defs['user']['BUILD_LITE_FILE']);
     $content .= $this->buildArrayDefine($defs['user']) . '}';
     // 读取编译列表文件
     $filelist = is_file(CONF_PATH . 'lite.php') ? include CONF_PATH . 'lite.php' : array(THINK_PATH . 'Common/functions.php', COMMON_PATH . 'Common/function.php', CORE_PATH . 'Think' . EXT, CORE_PATH . 'Hook' . EXT, CORE_PATH . 'App' . EXT, CORE_PATH . 'Dispatcher' . EXT, CORE_PATH . 'Log' . EXT, CORE_PATH . 'Log/Driver/File' . EXT, CORE_PATH . 'Route' . EXT, CORE_PATH . 'Controller' . EXT, CORE_PATH . 'View' . EXT, CORE_PATH . 'Storage' . EXT, CORE_PATH . 'Storage/Driver/File' . EXT, CORE_PATH . 'Exception' . EXT, BEHAVIOR_PATH . 'ParseTemplateBehavior' . EXT, BEHAVIOR_PATH . 'ContentReplaceBehavior' . EXT);
     // 编译文件
     foreach ($filelist as $file) {
         if (is_file($file)) {
             $content .= compile($file);
         }
     }
     // 处理Think类的start方法
     $content = preg_replace('/\\$runtimefile = RUNTIME_PATH(.+?)(if\\(APP_STATUS)/', '\\2', $content, 1);
     $content .= "\nnamespace { Think\\Think::addMap(" . var_export(\Think\Think::getMap(), true) . ");";
     $content .= "\nL(" . var_export(L(), true) . ");\nC(" . var_export(C(), true) . ');Think\\Hook::import(' . var_export(\Think\Hook::get(), true) . ');Think\\Think::start();}';
     // 生成运行Lite文件
     file_put_contents($litefile, strip_whitespace('<?php ' . $content));
 }
Beispiel #6
0
 /**
  * показ топа по пвп очкам
  *
  * @return void
  * @author NetSoul
  **/
 function index()
 {
     $world = get_world();
     $this->data['title'] = 'Топ голосов за смс';
     include APPPATH . "config/mmotop.php";
     $all_data = file_get_contents($config['logfile']);
     $rows = explode("\n", $all_data);
     $chars = array();
     foreach ($rows as $row) {
         $cols = explode("\t", $row);
         if (isset($cols[3]) && $cols[3] !== '') {
             if ($cols[4] == 2) {
                 $chars[] = iconv('UTF-8', 'CP1251', $cols[3]);
             }
         }
     }
     $top = array_count_values($chars);
     arsort($top);
     $i = 1;
     $this->table->set_heading('#', 'Имя персонажа');
     foreach ($top as $key => $value) {
         $this->table->add_row($i, $key);
         $i++;
         if ($i > 100) {
             break;
         }
     }
     $this->data['content'] = $this->table->generate();
     compile('', false);
 }
Beispiel #7
0
function compileAll($compressedFiles, $app, $nameInclude, $compile, $delete)
{
    if ($nameInclude == "ALL") {
        foreach ($compressedFiles->files as $key => $fileNameInclude) {
            compile($compressedFiles, $app, $key, $compile, $delete);
        }
    } else {
        compile($compressedFiles, $app, $nameInclude, $compile, $delete);
    }
}
function less_compiler($theme, $override = array())
{
    global $CFG;
    $swatch = $theme->settings->subtheme;
    $responsive = $theme->settings->responsive;
    $awesome = $theme->settings->awesome;
    // TODO: add setting for padding between breadcrumb and fixed navbar.
    $extra_padding = 0;
    $padding = 0;
    $icon_color = 'inherit';
    $icon_opacity = 1;
    if ($swatch == 'random') {
        $colors = array('inherit', 'red', 'yellow', 'pink', 'purple', 'orange', 'blue', 'green');
        $color_key = array_rand($colors);
        $icon_color = $colors[$color_key];
        $opacities = array(0.2, 0.4, 0.6, 0.8, 1);
        $opacity_key = array_rand($opacities);
        $icon_opacity = $colors[$opacity_key];
        $swatches = array('amelia', 'cerulean', 'cosmo', 'cyborg', 'journal', 'readable', 'simplex', 'slate', 'spacelab', 'spruce', 'superhero', 'united');
        $swatch = $swatches[array_rand($swatches)];
        $responsive = rand(0, 1);
        $awesome = rand(0, 1);
        $extra_padding = rand(0, 1);
        if ($extra_padding == 1) {
            $padding = 20;
        }
    }
    $cache_name = md5(serialize(array($swatch, $responsive, $awesome, $extra_padding, $icon_color, $icon_opacity)));
    $current_theme = current_theme();
    $cachedir = "{$CFG->cachedir}/theme/{$current_theme}";
    $cachefile = "{$cachedir}/{$cache_name}.css";
    $themedir = $theme->dir;
    $themewww = $current_theme;
    if (isset($CFG->themewww)) {
        $themewww = "{$CFG->themewww}/{$current_theme}";
    }
    $less_variables = array('swatch' => "'{$swatch}'", 'navbarMargin' => $padding, 'php_fontAwesomePath' => "'{$themewww}/pix/font'", 'iconColor' => $icon_color, 'iconOpacity' => $icon_opacity, 'php_iconSpritePath' => "'{$themewww}/pix/glyphicons-halflings.png'", 'php_iconWhiteSpritePath' => "'{$themewww}/pix/glyphicons-halflings-white.png'", 'php_horizontalComponentOffset' => '200px');
    if ($awesome) {
        $import_dirs[] = "{$themedir}/style/font-awesome";
    } else {
        $import_dirs[] = "{$themedir}/style/glyphicons";
    }
    $import_dirs[] = "{$themedir}/style";
    $less_input = less_input($swatch, $responsive);
    $output = compile($less_input, $less_variables, $import_dirs);
    $search[] = 'fonts/';
    $replace[] = $less_variables['php_fontAwesomePath'] . '/';
    $output = str_replace($search, $replace, $output);
    return $output;
}
 public function run(&$content)
 {
     if (!APP_DEBUG && C('BUILD_LITE_RUNTIME')) {
         $litefile = RUNTIME_PATH . APP_MODE . '~lite.php';
         $runtimefile = RUNTIME_PATH . APP_MODE . '~runtime.php';
         if (!Storage::has($litefile)) {
             $defs = get_defined_constants(TRUE);
             $content = Storage::read($runtimefile);
             // $content   .=   'namespace { $GLOBALS[\'_beginTime\'] = microtime(TRUE);';
             $content .= compile(CORE_PATH . 'Think' . EXT);
             $content .= 'namespace {' . $this->array_define($defs['user']) . 'Think\\Think::start();}';
             Storage::put($litefile, $content);
         }
     }
 }
Beispiel #10
0
function mcp_process($fifo) {
  $todo=trim(fgets($fifo));
  $todo=explode(" ", $todo);

  switch($todo[0]) {
    case "restart":
      call_hooks("mcp_restart");
      break;
    case "compile":
      compile($todo[1]);
      break;
    default:
      print "didn't understand ".implode(" ", $todo)."\n";
  }
  return 1;
}
Beispiel #11
0
/**
 * 
 *
 * Framework ºËÐÄ¿ò¼Ü
 * 
 *
 * @copyright  Copyright (c) 2007-2013 ShopNC Inc. (http://www.shopnc.net)
 * @license    http://www.shopnc.net/
 * @link       http://www.shopnc.net/
 * @since      File available since Release v1.1
 */
function build()
{
    $args = func_get_args();
    extract($args[0]);
    $compile = "";
    $list = array(BasePath . "/framework/core/runtime.php", BasePath . "/framework/core/base.php", BasePath . "/framework/core/db.php", BasePath . "/framework/core/model.php", BasePath . "/framework/cache/cache.php", BasePath . "/framework/cache/cache.file.php", BasePath . "/framework/db/" . strtolower($dbdriver) . ".php", BasePath . "/framework/function/goods.php", BasePath . "/framework/function/seccode.php", BasePath . "/framework/libraries/email.php", BasePath . "/framework/libraries/language.php", BasePath . "/framework/libraries/log.php", BasePath . "/framework/libraries/page.php", BasePath . "/framework/libraries/security.php", BasePath . "/framework/libraries/validate.php", BasePath . "/framework/libraries/upload.php", BasePath . "/framework/function/core.php", BasePath . "/framework/tpl/nc.php", BasePath . "/control/control.php", BasePath . "/language/" . $lang_type . "/core_lang_index.php");
    if (!empty($cache_type) || strtolower($cache_type) != "file") {
        $list[] = BasePath . "/framework/cache/cache." . strtolower($cache_type) . ".php";
    }
    foreach ($list as $file) {
        if (file_exists($file)) {
            $compile .= compile($file);
        } else {
            exit(str_replace(BasePath, "", $file) . " isn't exists!");
        }
    }
    $compile .= compile($lang_file);
    $compile .= "\nLanguage::appendLanguage(\$lang);";
    $compile .= "\nBase::run();";
    file_put_contents(RUNCOREPATH, compress_code("<?php defined('InShopNC') or exit('Access Invalid!');" . $compile));
}
Beispiel #12
0
 * {@link http://www.websharks-inc.com XDaRk}
 *
 * @author JasWSInc
 * @package XDaRk\Core
 * @since 120318
 *
 * @note This compiler requires that you have SASS installed.
 *    e.g. `brew install sass`
 *
 * @note This compiler requires that you have the YUI Compressor installed also.
 *    e.g. `brew install yuicompressor`
 */
namespace xd_dev_utilities;

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/.dev-utilities/core.php';
compile(!empty($GLOBALS['argv'][1]) && $GLOBALS['argv'][1] === 'all');
#compile('all'); // To recompile all; or pass `all` via CLI.
/*
 * Compile
 */
function compile($all = FALSE)
{
    $core = core();
    // Core.
    $core->©env->prep_for_cli_dev_procedure();
    if ($all) {
        compile_font_awesome();
    }
    if ($all) {
        compile_bootstrap_themes();
    }
Beispiel #13
0
 private static function build()
 {
     C(include THINK_PATH . '/Common/convention.php');
     if (is_file(CONFIG_PATH . 'config.php')) {
         C(include CONFIG_PATH . 'config.php');
     }
     $runtime = defined('RUNTIME_ALLINONE');
     $common = '';
     $debug = C('APP_DEBUG') && !$runtime;
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         if (!$debug) {
             $common .= compile(COMMON_PATH . 'common.php', $runtime);
         }
     }
     if (is_file(CONFIG_PATH . 'app.php')) {
         $list = (include CONFIG_PATH . 'app.php');
         foreach ($list as $file) {
             require $file;
             if (!$debug) {
                 $common .= compile($file, $runtime);
             }
         }
     }
     $list = C('APP_CONFIG_LIST');
     foreach ($list as $val) {
         if (is_file(CONFIG_PATH . $val . '.php')) {
             C('_' . $val . '_', array_change_key_case(include CONFIG_PATH . $val . '.php'));
         }
     }
     if ($debug) {
         C(include THINK_PATH . '/Common/debug.php');
         if (is_file(CONFIG_PATH . 'debug.php')) {
             C(include CONFIG_PATH . 'debug.php');
         }
     } else {
         if (defined('RUNTIME_ALLINONE')) {
             $defs = get_defined_constants(TRUE);
             $content = array_define($defs['user']);
             $content .= substr(file_get_contents(RUNTIME_PATH . '~runtime.php'), 5);
             $content .= $common . "\nreturn " . var_export(C(), true) . ';';
             file_put_contents(RUNTIME_PATH . '~allinone.php', strip_whitespace('<?php ' . $content));
         } else {
             $content = "<?php " . $common . "\nreturn " . var_export(C(), true) . ";\n?>";
             file_put_contents(RUNTIME_PATH . '~app.php', strip_whitespace($content));
         }
     }
     return;
 }
 /**
 +----------------------------------------------------------
 * 读取配置信息 编译项目
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 private static function build()
 {
     // 加载惯例配置文件
     if (file_exists(THINK_PATH . '/Common/convention.php')) {
         C(include THINK_PATH . '/Common/convention.php');
     }
     // 加载项目配置文件
     if (file_exists(SITE_PATH . '/config.inc.php')) {
         C(include SITE_PATH . '/config.inc.php');
     }
     // 加载项目配置文件
     if (file_exists(CONFIG_PATH . 'config.php')) {
         C(include CONFIG_PATH . 'config.php');
     }
     $runtime = defined('RUNTIME_ALLINONE');
     $common = '';
     //是否调试模式 ALL_IN_ONE模式下面调试模式无效
     $debug = C('APP_DEBUG') && !$runtime;
     // 加载项目公共文件
     if (file_exists(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         if (!$debug) {
             // 编译文件
             $common .= compile(COMMON_PATH . 'common.php', $runtime);
         }
     }
     // 加载项目编译文件列表
     if (file_exists(CONFIG_PATH . 'app.php')) {
         $list = (include CONFIG_PATH . 'app.php');
         foreach ($list as $file) {
             // 加载并编译文件
             require $file;
             if (!$debug) {
                 $common .= compile($file, $runtime);
             }
         }
     }
     // 读取扩展配置文件
     $list = C('APP_CONFIG_LIST');
     foreach ($list as $val) {
         if (file_exists(CONFIG_PATH . $val . '.php')) {
             C('_' . $val . '_', array_change_key_case(include CONFIG_PATH . $val . '.php'));
         }
     }
     // 如果是调试模式加载调试模式配置文件
     if ($debug) {
         // 加载系统默认的开发模式配置文件
         C(include THINK_PATH . '/Common/debug.php');
         if (is_file(CONFIG_PATH . 'debug.php')) {
             // 允许项目增加开发模式配置定义
             C(include CONFIG_PATH . 'debug.php');
         }
     } else {
         // 部署模式下面生成编译文件
         // 下次直接加载项目编译文件
         if (defined('RUNTIME_ALLINONE')) {
             // 获取用户自定义变量
             $defs = get_defined_constants(TRUE);
             unset($defs['user']['SITE_PATH']);
             unset($defs['user']['CORE_PATH']);
             unset($defs['user']['APPS_PATH']);
             unset($defs['user']['ADDONS_PATH']);
             unset($defs['user']['HAS_ONE']);
             unset($defs['user']['BELONGS_TO']);
             unset($defs['user']['HAS_MANY']);
             unset($defs['user']['MANY_TO_MANY']);
             unset($defs['user']['CLIENT_MULTI_RESULTS']);
             $content = array_define($defs['user']);
             $content .= substr(file_get_contents(RUNTIME_PATH . '~runtime.php'), 5);
             $content .= $common . "\nreturn " . var_export(C(), true) . ";\n?>";
             file_put_contents(RUNTIME_PATH . '~allinone.php', strip_whitespace('<?php ' . $content));
         } else {
             $content = "<?php " . $common . "\nreturn " . var_export(C(), true) . ";\n?>";
             file_put_contents(RUNTIME_PATH . '~app.php', strip_whitespace($content));
         }
     }
     return;
 }
Beispiel #15
0
 /**
 +----------------------------------------------------------
 * 读取配置信息 编译项目
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 private static function build()
 {
     // 加载惯例配置文件
     C(include THINK_PATH . '/Common/convention.php');
     // 加载项目配置文件
     if (is_file(CONFIG_PATH . 'config.php')) {
         C(include CONFIG_PATH . 'config.php');
     }
     $runtime = defined('RUNTIME_ALLINONE');
     $common = '';
     //是否调试模式 ALL_IN_ONE模式下面调试模式无效
     $debug = C('APP_DEBUG') && !$runtime;
     // 加载项目公共文件
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         // 编译文件
         if (!$debug) {
             $common .= compile(COMMON_PATH . 'common.php', $runtime);
         }
     }
     // 加载项目编译文件列表
     if (is_file(CONFIG_PATH . 'app.php')) {
         $list = (include CONFIG_PATH . 'app.php');
         foreach ($list as $file) {
             // 加载并编译文件
             require $file;
             if (!$debug) {
                 $common .= compile($file, $runtime);
             }
         }
     }
     // 读取扩展配置文件
     $list = C('APP_CONFIG_LIST');
     foreach ($list as $val) {
         if (is_file(CONFIG_PATH . $val . '.php')) {
             C('_' . $val . '_', array_change_key_case(include CONFIG_PATH . $val . '.php'));
         }
     }
     // 如果是调试模式加载调试模式配置文件
     if ($debug) {
         // 加载系统默认的开发模式配置文件
         C(include THINK_PATH . '/Common/debug.php');
         if (is_file(CONFIG_PATH . 'debug.php')) {
             // 允许项目增加开发模式配置定义
             C(include CONFIG_PATH . 'debug.php');
         }
     } else {
         // 部署模式下面生成编译文件
         // 下次直接加载项目编译文件
         if ($runtime) {
             // 获取用户自定义变量
             $defs = get_defined_constants(TRUE);
             $content = array_define($defs['user']);
             $runtimefile = defined('THINK_MODE') ? '~' . strtolower(THINK_MODE) . '_runtime.php' : '~runtime.php';
             $content .= substr(file_get_contents(RUNTIME_PATH . $runtimefile), 5);
             $content .= $common . "\nreturn " . var_export(C(), true) . ';';
             file_put_contents(RUNTIME_PATH . '~allinone.php', strip_whitespace('<?php ' . $content));
         } else {
             $content = "<?php " . $common . "\nreturn " . var_export(C(), true) . ";\n?>";
             file_put_contents(RUNTIME_PATH . '~' . APP_CACHE_NAME . '.php', strip_whitespace($content));
         }
     }
     return;
 }
Beispiel #16
0
 function smskey()
 {
     if (!is_logged()) {
         redirect(base_url());
     }
     $this->config->load('rf_sms', FALSE, TRUE);
     $this->data['title'] = lang('off_votesms');
     $s_pair = office_secure(trim($this->input->post('s_pair')));
     #http://rf.mmotop.ru/sms/2650/?s_pair=dds34fr&votes_charname=&votes_server=167
     $link = config('link') . '?s_pair=' . $s_pair . '&votes_charname=&votes_server=' . config('vote_server');
     $html_page = file_get_contents($link);
     $html_page = iconv('UTF-8', 'CP1251', $html_page);
     $pos = strpos($html_page, 'Ваш голос учтен');
     if ($pos == TRUE) {
         bonus_add(Get_AccountSerial(), config('pay'));
         $this->data['content'] = icon('32x32/accept.png') . lang('off_votesms_ok');
         log_in_history('Получены бонусы за SMS голосование');
     } else {
         log_in_history('Неудачная попытка получения бонуса за SMS');
         $this->data['content'] = icon('32x32/delete.png') . lang('off_votesms_err') . go_back();
     }
     compile();
 }
Beispiel #17
0
 /**
 +----------------------------------------------------------
 * 读取配置信息 编译项目
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 private static function buildApp()
 {
     // 加载底层惯例配置文件
     C(include THINK_PATH . 'Conf/convention.php');
     // 读取运行模式
     if (defined('MODE_NAME')) {
         // 模式的设置并入核心模式
         $mode = (include MODE_PATH . strtolower(MODE_NAME) . '.php');
     } else {
         $mode = array();
     }
     // 加载模式配置文件
     if (isset($mode['config'])) {
         C(is_array($mode['config']) ? $mode['config'] : (include $mode['config']));
     }
     // 加载项目配置文件
     if (is_file(CONF_PATH . 'config.php')) {
         C(include CONF_PATH . 'config.php');
     }
     // 加载框架底层语言包
     L(include THINK_PATH . 'Lang/' . strtolower(C('DEFAULT_LANG')) . '.php');
     // 加载模式系统行为定义
     if (C('APP_TAGS_ON')) {
         if (isset($mode['extends'])) {
             C('extends', is_array($mode['extends']) ? $mode['extends'] : (include $mode['extends']));
         } else {
             // 默认加载系统行为扩展定义
             C('extends', include THINK_PATH . 'Conf/tags.php');
         }
     }
     // 加载应用行为定义
     if (isset($mode['tags'])) {
         C('tags', is_array($mode['tags']) ? $mode['tags'] : (include $mode['tags']));
     } elseif (is_file(CONF_PATH . 'tags.php')) {
         // 默认加载项目配置目录的tags文件定义
         C('tags', include CONF_PATH . 'tags.php');
     }
     $compile = '';
     // 读取核心编译文件列表
     if (isset($mode['core'])) {
         $list = $mode['core'];
     } else {
         $list = array(THINK_PATH . 'Common/functions.php', CORE_PATH . 'Core/Log.class.php', CORE_PATH . 'Core/Dispatcher.class.php', CORE_PATH . 'Core/App.class.php', CORE_PATH . 'Core/Action.class.php', CORE_PATH . 'Core/View.class.php');
     }
     // 项目追加核心编译列表文件
     if (is_file(CONF_PATH . 'core.php')) {
         $list = array_merge($list, include CONF_PATH . 'core.php');
     }
     foreach ($list as $file) {
         if (is_file($file)) {
             require_cache($file);
             if (!APP_DEBUG) {
                 $compile .= compile($file);
             }
         }
     }
     // 加载项目公共文件
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         // 编译文件
         if (!APP_DEBUG) {
             $compile .= compile(COMMON_PATH . 'common.php');
         }
     }
     // 加载模式别名定义
     if (isset($mode['alias'])) {
         $alias = is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']);
         alias_import($alias);
         if (!APP_DEBUG) {
             $compile .= 'alias_import(' . var_export($alias, true) . ');';
         }
     }
     // 加载项目别名定义
     if (is_file(CONF_PATH . 'alias.php')) {
         $alias = (include CONF_PATH . 'alias.php');
         alias_import($alias);
         if (!APP_DEBUG) {
             $compile .= 'alias_import(' . var_export($alias, true) . ');';
         }
     }
     if (APP_DEBUG) {
         // 调试模式加载系统默认的配置文件
         C(include THINK_PATH . 'Conf/debug.php');
         // 读取调试模式的应用状态
         $status = C('APP_STATUS');
         // 加载对应的项目配置文件
         if (is_file(CONF_PATH . $status . '.php')) {
             // 允许项目增加开发模式配置定义
             C(include CONF_PATH . $status . '.php');
         }
     } else {
         // 部署模式下面生成编译文件
         build_runtime_cache($compile);
     }
     return;
 }
Beispiel #18
0
/**
 * Dumps a CSS/JS file
 *
 * @param $name
 * @param $mimetype
 */
function dump($name, $mimetype, $cachekey)
{
    global $cachedirdrupal;
    global $nocache;
    global $config;
    $starttime = microtime(true);
    $excludes = array();
    $dependencies = array();
    $patterns = array();
    $filetype = substr(strrchr($name, '.'), 1);
    $output = '';
    $minify = isset($_REQUEST['min']);
    $debugjavascript = $filetype === 'js' && isset($_REQUEST['debug']);
    if ($debugjavascript) {
        $output .= '// load js files in a synchronous way' . PHP_EOL;
    }
    // check whether the file is in drupal cache
    if (!is_dir($cachedirdrupal)) {
        mkdir($cachedirdrupal, 0755);
    }
    $cachefile = $cachedirdrupal . '/terrific-' . $cachekey . '-' . $name;
    if ($nocache || !is_file($cachefile)) {
        // collect excluded pattern & (less/scss) dependencies & patterns
        foreach ($config->assets->{$name} as $pattern) {
            $firstchar = substr($pattern, 0, 1);
            if ($firstchar === '!') {
                $excludes[] = substr($pattern, 1);
            } else {
                if ($firstchar === '+') {
                    $dependencies[] = substr($pattern, 1);
                } else {
                    $patterns[] = $pattern;
                }
            }
        }
        $dependencies = get_files($dependencies);
        $excludes = array_merge($dependencies, $excludes);
        $files = get_files($patterns, $excludes);
        foreach ($files as $entry) {
            if (!$debugjavascript) {
                $format = substr(strrchr($entry, '.'), 1);
                $output .= compile(BASE . $entry, $format, $dependencies);
            } else {
                $output .= "document.write('<script type=\"text/javascript\" src=\"{$entry}\"><\\/script>');" . PHP_EOL;
            }
        }
        if ($minify) {
            switch ($filetype) {
                case 'css':
                    require BASE . 'app/library/cssmin/cssmin.php';
                    $output = CssMin::minify($output);
                    break;
                case 'js':
                    require BASE . 'app/library/jshrink/Minifier.php';
                    $output = \JShrink\Minifier::minify($output);
                    break;
            }
        }
        $time_taken = microtime(TRUE) - $starttime;
        $output = get_asset_banner($name, $filetype, $minify, $time_taken) . $output;
        file_put_contents($cachefile, $output);
    } else {
        $output = file_get_contents($cachefile);
    }
    ob_start("ob_gzhandler");
    header('Content-Type: ' . $mimetype);
    echo $output;
    ob_end_flush();
}
Beispiel #19
0
/* DO WORK */
$options = getopt('f:o:h');
/* Handle -h switch, for help */
if (array_key_exists('h', $options) || $argc == 1) {
    ?>
Usage: <?php 
    echo $program;
    ?>
 -f<file> [-ho<file>]
  -f<file>   TextMate theme to convert
  -o<file>   Name of the output file
  -h         Display this message
<?php 
    exit(0);
}
/* Handle -f switch, for input file */
if (!array_key_exists('f', $options)) {
    error('No input file provided, specify with -f switch');
}
$infile = $options['f'];
if (!file_exists($infile)) {
    error("Could not find `{$infile}'");
}
/* Handle -o switch, for output file */
$outfile = array_key_exists('o', $options) ? $options['o'] : 'php://stdout';
/* Build and output the TextAdept theme partial */
$intermediate = compile($infile);
$result = build($intermediate, $outfile);
if (!$result) {
    exit(1);
}
 /**
 +----------------------------------------------------------
 * 读取配置信息 编译项目
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 private static function build()
 {
     // 加载惯例配置文件
     C(include THINK_PATH . '/Common/convention.php');
     // 加载项目配置文件
     if (is_file(CONFIG_PATH . 'config.php')) {
         C(include CONFIG_PATH . 'config.php');
     }
     $common = '';
     // 加载项目公共文件
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         // 编译文件
         if (!C('APP_DEBUG')) {
             $common .= compile(COMMON_PATH . 'common.php');
         }
     }
     // 加载项目编译文件列表
     if (is_file(CONFIG_PATH . 'app.php')) {
         $list = (include CONFIG_PATH . 'app.php');
         foreach ($list as $file) {
             // 加载并编译文件
             require_cache($file);
             if (!$debug) {
                 $common .= compile($file, $runtime);
             }
         }
     }
     // 加载动态配置文件
     $configs = C('APP_CONFIG_LIST');
     if (is_string($configs)) {
         $configs = explode(',', $configs);
     }
     foreach ($configs as $config) {
         $file = CONFIG_PATH . $config . '.php';
         if (is_file($file)) {
             C($config, array_change_key_case(include $file));
         }
     }
     C('APP_CONFIG_LIST', '');
     // 清除配置参数
     if (C('APP_DEBUG')) {
         // 调试模式加载系统默认的开发模式配置文件
         C(include THINK_PATH . '/Common/debug.php');
         if (is_file(CONFIG_PATH . 'debug.php')) {
             // 允许项目增加开发模式配置定义
             C(include CONFIG_PATH . 'debug.php');
         }
     } else {
         // 部署模式下面生成编译文件
         build_runtime_cache($common);
     }
     return;
 }
<?php

//Import the SDK
require_once __DIR__ . '\\..\\sdk\\index.php';
//Setting up the Hackerearth API
$hackerearth = array('client_secret' => '**********', 'time_limit' => '5', 'memory_limit' => '262144');
//Feeding Data Into Hackerearth API
$config = array();
$config['time'] = '5';
//(OPTIONAL) Your time limit in integer and in unit seconds
$config['memory'] = '262144';
//(OPTIONAL) Your memory limit in integer and in unit kb
$config['source'] = '';
//(REQUIRED) Your properly formatted source code for which you want to use hackerEarth api
$config['input'] = '';
//(OPTIONAL) Properly Formatted Input against which you have to test your source code, leave this empty if you are using file
$config['language'] = 'PYTHON';
//(REQUIRED) Choose any one of the below
// C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY
//Sending request to the API to compile and run and record JSON responses
$response = compile($hackerearth, $config);
// Use this $response the way you want , it consists data in PHP Array
//Printing the response
echo "<pre>" . print_r($response, 1) . "</pre>";
Beispiel #22
0
function import($file)
{
    if (file_exists($file)) {
        $GLOBALS['_FileCount']++;
        compile($file);
        require_once $file;
        return true;
    }
    return false;
}
Beispiel #23
0
function compile_macro($expr, &$oob)
{
    list($_, $name, $fn) = $expr;
    $m = array();
    $e = compile($fn, $m);
    eval($m[0]);
    $e = explode("\"", $e);
    array_pop($e);
    $nam = array_pop($e);
    array_shift($fn);
    $args = array_shift($fn);
    $fn = array(array(), $args, $nam);
    $oob["macros"][symbol_str($name)] = $fn;
}
}
$GLOBALS["MYPID"] = getmypid();
if ($argv[1] == "--ufdbcheck") {
    CoherenceRepertoiresUfdb();
    die;
}
if ($argv[1] == "--mysqlcheck") {
    CoherenceBase();
    die;
}
if ($argv[1] == "--localcheck") {
    CoherenceOffiels();
    die;
}
if ($argv[1] == "--compile") {
    compile();
    die;
}
if ($argv[1] == "--status") {
    BuildDatabaseStatus();
    die;
}
if ($argv[1] == "--refresh-index") {
    GET_MD5S_REMOTE();
    die;
}
Execute();
function build_progress($text, $pourc)
{
    ufdbevents("{$pourc}% {$text}");
    $GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/toulouse-unversity.progress";
Beispiel #25
0
 /**
 +----------------------------------------------------------
 * 读取配置信息 编译项目
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 */
 private static function build()
 {
     // 加载惯例配置文件
     C(include THINK_PATH . '/Common/convention.php');
     // 加载项目配置文件
     if (is_file(CONFIG_PATH . 'config.php')) {
         C(include CONFIG_PATH . 'config.php');
     }
     $common = '';
     $debug = C('APP_DEBUG');
     //  是否调试模式
     // 加载项目公共文件
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         if (!$debug) {
             // 编译文件
             $common .= compile(COMMON_PATH . 'common.php');
         }
     }
     // 加载项目编译文件列表
     if (is_file(CONFIG_PATH . 'app.php')) {
         $list = (include CONFIG_PATH . 'app.php');
         foreach ($list as $key => $file) {
             // 加载并编译文件
             require $file;
             if (!$debug) {
                 $common .= compile($file);
             }
         }
     }
     // 如果是调试模式加载调试模式配置文件
     if ($debug) {
         // 加载系统默认的开发模式配置文件
         C(include THINK_PATH . '/Common/debug.php');
         if (is_file(CONFIG_PATH . 'debug.php')) {
             // 允许项目增加开发模式配置定义
             C(include CONFIG_PATH . 'debug.php');
         }
     } else {
         // 部署模式下面生成编译文件
         // 下次直接加载项目编译文件
         if (defined('RUNTIME_ALLINONE')) {
             // 获取用户自定义变量
             $defs = get_defined_constants(TRUE);
             $content = array_define($defs['user']);
             $content .= substr(file_get_contents(RUNTIME_PATH . '~runtime.php'), 5);
             $content .= $common . "\nreturn " . var_export(C(), true) . ';';
             file_put_contents(RUNTIME_PATH . '~allinone.php', strip_whitespace('<?php ' . $content));
         } else {
             $content = "<?php " . $common . "\nreturn " . var_export(C(), true) . ";\n?>";
             file_put_contents(RUNTIME_PATH . '~app.php', strip_whitespace($content));
         }
     }
     return;
 }
Beispiel #26
0
        $tpl = compile("templates/" . $cfgrow['template'] . "/image_" . $language_abr . "_template.html");
    }
    if ($cfgrow['display_sort_by'] == 'headline') {
        $cfgrow['display_sort_by'] = 'alt_headline';
    }
    if ($cfgrow['display_sort_by'] == 'body') {
        $cfgrow['display_sort_by'] = 'alt_body';
    }
}
if (isset($_GET['popup']) && $_GET['popup'] == "comment") {
    // additional language file for comment template
    if (file_exists("templates/" . $cfgrow['template'] . "/comment_" . $language_abr . "_template.html")) {
        $tpl = compile("templates/" . $cfgrow['template'] . "/comment_" . $language_abr . "_template.html");
    } else {
        // if not existing or no additional language chosen, default template file is called without error
        $tpl = compile("templates/" . $cfgrow['template'] . "/comment_template.html");
    }
}
// if showimage=badstuff or email, hijack!
if (isset($_GET['showimage']) && !is_numeric($_GET['showimage'])) {
    header("HTTP/1.0 404 Not Found");
    header("Status: 404 File Not Found!");
    echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nDon't do that! go back to index.php! \n</BODY></HTML>";
    exit;
}
// Added ability to use header and footers for templates.  They are not needed but used if included in the template
if (isset($header)) {
    $tpl = $header . $tpl;
}
if (isset($footer)) {
    $tpl = $tpl . $footer;
Beispiel #27
0
function build_tags_cache()
{
    $tags = C('extends');
    $content = '';
    foreach ($tags as $tag => $item) {
        foreach ($item as $key => $name) {
            $content .= is_int($key) ? compile(CORE_PATH . 'Behavior/' . $name . 'Behavior.class.php') : compile($name);
        }
    }
    return $content;
}
Beispiel #28
0
/**
 * Handle request, compile and execute junit test
 *
 * @return array result
 */
function compile_execute()
{
    global $memory_xmx, $memory_limit_output, $timeoutreal;
    // create unique directory
    $temp_folder = DATAROOT . 'javaunittest_tmp_' . intval($_POST['attemptid']);
    if (file_exists($temp_folder)) {
        delTree($temp_folder);
    }
    mkdir_recursive($temp_folder);
    try {
        // write testfile
        $testclassname = $_POST['testclassname'];
        if (!preg_match('/^[a-zA-Z0-9_]+$/', $testclassname)) {
            throw new Exception('testclassname contains not allowed characters');
        }
        $testfile = $temp_folder . '/' . $testclassname . '.java';
        $fd_testfile = fopen($testfile, 'w');
        if ($fd_testfile === false) {
            throw new Exception('could not create testfile');
        }
        fwrite($fd_testfile, $_POST['junitcode']);
        fclose($fd_testfile);
        // try to get the name of the student's class
        $studentscode = $_POST['studentscode'];
        $matches = array();
        preg_match('/^(?:\\s*public)?\\s*class\\s+(\\w[a-zA-Z0-9_]+)/m', $studentscode, $matches);
        $studentsclassname = !empty($matches[1]) && $matches[1] != $testclassname ? $matches[1] : 'Xy';
        // write student's file
        $studentsfile = $temp_folder . '/' . $studentsclassname . '.java';
        $fd_studentsfile = fopen($studentsfile, 'w');
        if ($fd_studentsfile === false) {
            throw new Exception('could not create studentsfile');
        }
        fwrite($fd_studentsfile, $studentscode);
        fclose($fd_studentsfile);
        // compile student's response
        $compiler = compile($studentsfile);
        $compiletime = $compiler['time'];
        // compiler error
        if (!empty($compiler['compileroutput'])) {
            $compileroutput = str_replace($temp_folder, '', $compiler['compileroutput']);
            //#TODO BM
            delTree($temp_folder);
            write_log('[questionattemptid ' . intval($_POST['attemptid']) . '] compile student error');
            return array('error' => true, 'errortype' => 'COMPILE_STUDENT_ERROR', 'compileroutput' => $compileroutput);
        }
        // compile testfile
        $compiler = compile($testfile);
        $compiletime += $compiler['time'];
        // compiler error
        if (!empty($compiler['compileroutput'])) {
            delTree($temp_folder);
            write_log('[questionattemptid ' . intval($_POST['attemptid']) . '] compile testfile error');
            return array('error' => true, 'errortype' => 'COMPILE_TESTFILE_ERROR');
        }
        // run test
        $command = PATH_TO_JAVA . ' -Xmx' . $memory_xmx . 'm -Djava.security.manager=default -Djava.security.policy=' . PATH_TO_POLICY . ' -cp ' . PATH_TO_JUNIT . ':' . PATH_TO_HAMCREST . ':' . $temp_folder . ' org.junit.runner.JUnitCore ' . $testclassname;
        $output = '';
        $testruntime = 0;
        $ret_proc = open_process(PRECOMMAND . '; exec ' . escapeshellcmd($command), $timeoutreal, $memory_limit_output * 1024, $output, $testruntime);
        if (!DEBUG_NOCLEANUP) {
            delTree($temp_folder);
        }
        if ($ret_proc == OPEN_PROCESS_TIMEOUT || $ret_proc == OPEN_PROCESS_UNCAUGHT_SIGNAL) {
            write_log('[questionattemptid ' . intval($_POST['attemptid']) . '] uncaught signal (timeout)');
            return array('error' => true, 'errortype' => 'TIMEOUT_RUNNING');
        }
        return array('junitoutput' => $output, 'error' => false, 'compiletime' => $compiletime, 'testruntime' => $testruntime);
    } catch (Exception $e) {
        if (!DEBUG_NOCLEANUP) {
            delTree($temp_folder);
        }
        header("HTTP/1.1 500 Internal Server Error");
        write_log('[questionattemptid ' . intval($_POST['attemptid']) . '] Exception occured: ' . $e->getMessage());
        die('Internal Server Error: ' . $e->getMessage());
    }
}
Beispiel #29
0
 /**
  * 应用程序初始化
  * @access public
  * @return void
  */
 public static function start()
 {
     // 注册AUTOLOAD方法
     spl_autoload_register('Think\\Think::autoload');
     // 设定错误和异常处理
     register_shutdown_function('Think\\Think::fatalError');
     set_error_handler('Think\\Think::appError');
     set_exception_handler('Think\\Think::appException');
     // 初始化文件存储方式
     Storage::connect(STORAGE_TYPE);
     $runtimefile = RUNTIME_PATH . APP_MODE . '~runtime.php';
     if (!APP_DEBUG && Storage::has($runtimefile)) {
         Storage::load($runtimefile);
     } else {
         if (Storage::has($runtimefile)) {
             Storage::unlink($runtimefile);
         }
         $content = '';
         // 读取应用模式
         $mode = (include is_file(CONF_PATH . 'core.php') ? CONF_PATH . 'core.php' : MODE_PATH . APP_MODE . '.php');
         // 加载核心文件
         foreach ($mode['core'] as $file) {
             if (is_file($file)) {
                 include $file;
                 if (!APP_DEBUG) {
                     $content .= compile($file);
                 }
             }
         }
         // 加载应用模式配置文件
         foreach ($mode['config'] as $key => $file) {
             is_numeric($key) ? C(include $file) : C($key, include $file);
         }
         // 读取当前应用模式对应的配置文件
         if ('common' != APP_MODE && is_file(CONF_PATH . 'config_' . APP_MODE . '.php')) {
             C(include CONF_PATH . 'config_' . APP_MODE . '.php');
         }
         // 加载模式别名定义
         if (isset($mode['alias'])) {
             self::addMap(is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']));
         }
         // 加载应用别名定义文件
         if (is_file(CONF_PATH . 'alias.php')) {
             self::addMap(include CONF_PATH . 'alias.php');
         }
         // 加载模式行为定义
         if (isset($mode['tags'])) {
             Hook::import(is_array($mode['tags']) ? $mode['tags'] : (include $mode['tags']));
         }
         // 加载应用行为定义
         if (is_file(CONF_PATH . 'tags.php')) {
             // 允许应用增加开发模式配置定义
             Hook::import(include CONF_PATH . 'tags.php');
         }
         // 加载框架底层语言包
         L(include THINK_PATH . 'Lang/' . strtolower(C('DEFAULT_LANG')) . '.php');
         if (!APP_DEBUG) {
             $content .= "\nnamespace { Think\\Think::addMap(" . var_export(self::$_map, true) . ");";
             $content .= "\nL(" . var_export(L(), true) . ");\nC(" . var_export(C(), true) . ');Think\\Hook::import(' . var_export(Hook::get(), true) . ');}';
             Storage::put($runtimefile, strip_whitespace('<?php ' . $content));
         } else {
             // 调试模式加载系统默认的配置文件
             C(include THINK_PATH . 'Conf/debug.php');
             // 读取应用调试配置文件
             if (is_file(CONF_PATH . 'debug.php')) {
                 C(include CONF_PATH . 'debug.php');
             }
         }
     }
     // 读取当前应用状态对应的配置文件
     if (APP_STATUS && is_file(CONF_PATH . APP_STATUS . '.php')) {
         C(include CONF_PATH . APP_STATUS . '.php');
     }
     // 设置系统时区
     date_default_timezone_set(C('DEFAULT_TIMEZONE'));
     // 检查应用目录结构 如果不存在则自动创建
     if (C('CHECK_APP_DIR') && !is_dir(LOG_PATH)) {
         // 创建应用目录结构
         require THINK_PATH . 'Common/build.php';
     }
     // 记录加载文件时间
     G('loadTime');
     // 运行应用
     App::run();
 }
 /**
  * Read configuration information Compile the project
  * @access private
  * @return string
  */
 private static function buildApp()
 {
     // Read operating mode
     if (defined('MODE_NAME')) {
         // Read mode setting
         $mode = (include MODE_PATH . strtolower(MODE_NAME) . '.php');
     } else {
         $mode = array();
     }
     // Core Conventions configuration file to load
     C(include SEN_PATH . 'Conf/convention.php');
     if (isset($mode['config'])) {
         // Load mode profile
         C(is_array($mode['config']) ? $mode['config'] : (include $mode['config']));
     }
     // Load project configuration file
     if (is_file(CONF_PATH . 'config.php')) {
         C(include CONF_PATH . 'config.php');
     }
     // Loading framework underlying language pack
     L(include SEN_PATH . 'Lang/' . strtolower(C('DEFAULT_LANG')) . '.php');
     // Load model system behavior definition
     if (C('APP_TAGS_ON')) {
         if (isset($mode['extends'])) {
             C('extends', is_array($mode['extends']) ? $mode['extends'] : (include $mode['extends']));
         } else {
             // Addonsed definition of default load behavior of the system
             C('extends', include SEN_PATH . 'Conf/tags.php');
         }
     }
     // Load application behavior definition
     if (isset($mode['tags'])) {
         C('tags', is_array($mode['tags']) ? $mode['tags'] : (include $mode['tags']));
     } elseif (is_file(CONF_PATH . 'tags.php')) {
         // Default load the project file defines the configuration directory tags
         C('tags', include CONF_PATH . 'tags.php');
     }
     $compile = '';
     // Core reading list compiled file
     if (isset($mode['core'])) {
         $list = $mode['core'];
     } else {
         $list = array(SEN_PATH . 'Common/functions.php', CORE_PATH . 'Core/Log.class.php', CORE_PATH . 'Core/Dispatcher.class.php', CORE_PATH . 'Core/App.class.php', CORE_PATH . 'Core/Action.class.php', CORE_PATH . 'Core/View.class.php');
     }
     // Compile a list of additional core project documents
     if (is_file(CONF_PATH . 'core.php')) {
         $list = array_merge($list, include CONF_PATH . 'core.php');
     }
     foreach ($list as $file) {
         if (is_file($file)) {
             require_cache($file);
             if (!APP_DEBUG) {
                 $compile .= compile($file);
             }
         }
     }
     // Load the project public documents
     if (is_file(COMMON_PATH . 'common.php')) {
         include COMMON_PATH . 'common.php';
         // Compiled file
         if (!APP_DEBUG) {
             $compile .= compile(COMMON_PATH . 'common.php');
         }
     }
     // Loading mode alias definitions
     if (isset($mode['alias'])) {
         $alias = is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']);
         alias_import($alias);
         if (!APP_DEBUG) {
             $compile .= 'alias_import(' . var_export($alias, true) . ');';
         }
     }
     // Loading a project alias definitions
     if (is_file(CONF_PATH . 'alias.php')) {
         $alias = (include CONF_PATH . 'alias.php');
         alias_import($alias);
         if (!APP_DEBUG) {
             $compile .= 'alias_import(' . var_export($alias, true) . ');';
         }
     }
     if (APP_DEBUG) {
         // Debug mode to load the system default configuration file
         C(include SEN_PATH . 'Conf/debug.php');
         // Read the debug mode application status
         $status = C('APP_STATUS');
         // Project configuration file to load the corresponding
         if (is_file(CONF_PATH . $status . '.php')) {
             // Allow the project to increase the development mode configuration definition
             C(include CONF_PATH . $status . '.php');
         }
     } else {
         // Deployment model generates compiled files below
         build_runtime_cache($compile);
     }
     return;
 }