Example #1
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));
}
Example #2
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));
}
Example #3
0
 protected function article()
 {
     if (file_exists(BASE_DATA_PATH . '/cache/index/article.php')) {
         include BASE_DATA_PATH . '/cache/index/article.php';
         Tpl::output('show_article', $show_article);
         Tpl::output('article_list', $article_list);
         return;
     }
     $model_article_class = Model('article_class');
     $model_article = Model('article');
     $show_article = array();
     //商城公告
     $article_list = array();
     //下方文章
     $notice_class = array('notice');
     $code_array = array('member', 'store', 'payment', 'sold', 'service', 'about');
     $notice_limit = 5;
     $faq_limit = 5;
     $class_condition = array();
     $class_condition['home_index'] = 'home_index';
     $class_condition['order'] = 'ac_sort asc';
     $article_class = $model_article_class->getClassList($class_condition);
     $class_list = array();
     if (!empty($article_class) && is_array($article_class)) {
         foreach ($article_class as $key => $val) {
             $ac_code = $val['ac_code'];
             $ac_id = $val['ac_id'];
             $val['list'] = array();
             //文章
             $class_list[$ac_id] = $val;
         }
     }
     $condition = array();
     $condition['article_show'] = '1';
     $condition['home_index'] = 'home_index';
     $condition['field'] = 'article.article_id,article.ac_id,article.article_url,article.article_title,article.article_time,article_class.ac_name,article_class.ac_parent_id';
     $condition['order'] = 'article_sort asc,article_time desc';
     $condition['limit'] = '300';
     $article_array = $model_article->getJoinList($condition);
     if (!empty($article_array) && is_array($article_array)) {
         foreach ($article_array as $key => $val) {
             $ac_id = $val['ac_id'];
             $ac_parent_id = $val['ac_parent_id'];
             if ($ac_parent_id == 0) {
                 //顶级分类
                 $class_list[$ac_id]['list'][] = $val;
             } else {
                 $class_list[$ac_parent_id]['list'][] = $val;
             }
         }
     }
     if (!empty($class_list) && is_array($class_list)) {
         foreach ($class_list as $key => $val) {
             $ac_code = $val['ac_code'];
             if (in_array($ac_code, $notice_class)) {
                 $list = $val['list'];
                 array_splice($list, $notice_limit);
                 $val['list'] = $list;
                 $show_article[$ac_code] = $val;
             }
             if (in_array($ac_code, $code_array)) {
                 $list = $val['list'];
                 $val['class']['ac_name'] = $val['ac_name'];
                 array_splice($list, $faq_limit);
                 $val['list'] = $list;
                 $article_list[] = $val;
             }
         }
     }
     $string = "<?php\n\$show_article=" . var_export($show_article, true) . ";\n";
     $string .= "\$article_list=" . var_export($article_list, true) . ";\n?>";
     file_put_contents(BASE_DATA_PATH . '/cache/index/article.php', compress_code($string));
     Tpl::output('show_article', $show_article);
     Tpl::output('article_list', $article_list);
 }
Example #4
0
/**
 * 内容写入文件
 *
 * @param string $filepath 待写入内容的文件路径
 * @param string/array $data 待写入的内容
 * @param  string $mode 写入模式,如果是追加,可传入“append”
 * @return bool
 */
function write_file($filepath, $data, $mode = null)
{
    if (is_array($data)) {
        $data = var_export($data, true);
    } elseif (!is_scalar($data)) {
        return false;
    }
    if ($data === '') {
        $data = '\'\'';
    }
    $data = "<?php defined('ZQ-SHOP') or exit('Access Invalid!'); return " . $data . "\n?>";
    $mode = $mode == 'append' ? FILE_APPEND : null;
    if (false === file_put_contents($filepath, compress_code($data), $mode)) {
        return false;
    } else {
        return true;
    }
}
Example #5
0
function write_file($filepath, $data, $mode = NULL)
{
    if (is_array($data)) {
        $data = var_export($data, TRUE);
    } else {
        if (!is_scalar($data)) {
            return FALSE;
        }
    }
    $data = "<?php defined('InShopNC') or exit('Access Invalid!'); return " . $data . "\n?>";
    $mode = $mode == "append" ? FILE_APPEND : NULL;
    if (FALSE === file_put_contents($filepath, compress_code($data), $mode)) {
        return FALSE;
    }
    return TRUE;
}