├── .gitignore ├── Extend └── Package │ └── smarty │ ├── noted.txt │ ├── bootstrap.php │ ├── sysplugins │ ├── smartyexception.php │ ├── smarty_internal_compile_continue.php │ ├── smarty_undefined_variable.php │ ├── smarty_internal_method_getdebugtemplate.php │ ├── smarty_internal_method_getdefaultmodifiers.php │ ├── smarty_internal_method_clearallassign.php │ ├── smartycompilerexception.php │ ├── smarty_internal_parsetree_text.php │ ├── smarty_internal_compile_rdelim.php │ ├── smarty_internal_method_getconfigvariable.php │ ├── smarty_internal_parsetree_code.php │ ├── smarty_internal_method_compileallconfig.php │ ├── smarty_variable.php │ ├── smarty_internal_parsetree_dqcontent.php │ ├── smarty_internal_method_clearconfig.php │ ├── smarty_internal_parsetree.php │ ├── smarty_internal_method_clearallcache.php │ ├── smarty_internal_method_setdefaultmodifiers.php │ ├── smarty_internal_method_setdebugtemplate.php │ ├── smarty_internal_compile_ldelim.php │ ├── smarty_internal_method_unregisterresource.php │ ├── smarty_internal_method_unregisterobject.php │ ├── smarty_internal_method_clearassign.php │ ├── smarty_internal_method_unregistercacheresource.php │ ├── smarty_internal_compile_debug.php │ ├── smarty_internal_method_getglobal.php │ ├── smarty_internal_method_unregisterplugin.php │ ├── smarty_internal_method_adddefaultmodifiers.php │ ├── smarty_internal_method_assignbyref.php │ ├── smarty_internal_method_registercacheresource.php │ ├── smarty_internal_method_registerdefaultconfighandler.php │ ├── smarty_internal_method_clearcache.php │ ├── smarty_internal_method_registerdefaultpluginhandler.php │ ├── smarty_internal_method_getstreamvariable.php │ ├── smarty_internal_method_getautoloadfilters.php │ ├── smarty_internal_method_assignglobal.php │ ├── smarty_internal_method_createdata.php │ ├── smarty_internal_method_getregisteredobject.php │ ├── smarty_internal_compile_private_object_block_function.php │ ├── smarty_internal_method_unloadfilter.php │ ├── smarty_internal_method_registerclass.php │ ├── smarty_resource_uncompiled.php │ ├── smarty_internal_method_unregisterfilter.php │ ├── smarty_internal_method_registerresource.php │ ├── smarty_internal_method_getconfigvars.php │ ├── smarty_internal_compile_make_nocache.php │ ├── smarty_internal_nocache_insert.php │ ├── smarty_data.php │ ├── smarty_internal_method_mustcompile.php │ ├── smarty_internal_undefined.php │ ├── smarty_internal_method_appendbyref.php │ ├── smarty_internal_compile_append.php │ ├── smarty_internal_block.php │ ├── smarty_internal_compile_shared_inheritance.php │ ├── smarty_internal_parsetree_tag.php │ ├── smarty_internal_compile_eval.php │ ├── smarty_internal_method_registerplugin.php │ ├── smarty_internal_runtime_make_nocache.php │ ├── smarty_internal_method_gettags.php │ ├── smarty_internal_method_addautoloadfilters.php │ ├── smarty_internal_compile_nocache.php │ ├── smarty_internal_compile_setfilter.php │ ├── smarty_internal_method_loadfilter.php │ ├── smarty_internal_method_setautoloadfilters.php │ ├── smarty_resource_recompiled.php │ ├── smarty_internal_compile_private_function_plugin.php │ ├── smarty_internal_resource_stream.php │ ├── smarty_internal_method_registerfilter.php │ ├── smarty_internal_runtime_cachemodify.php │ ├── smarty_internal_method_append.php │ ├── smarty_internal_compile_config_load.php │ ├── smarty_internal_resource_eval.php │ ├── smarty_internal_compile_call.php │ ├── smarty_internal_runtime_filterhandler.php │ ├── smarty_internal_compile_private_registered_block.php │ ├── smarty_internal_method_registerdefaulttemplatehandler.php │ ├── smarty_resource_custom.php │ └── smarty_internal_method_literals.php │ └── plugins │ ├── modifiercompiler.noprint.php │ ├── variablefilter.htmlspecialchars.php │ ├── modifiercompiler.string_format.php │ ├── modifiercompiler.cat.php │ ├── modifiercompiler.count_paragraphs.php │ ├── modifiercompiler.upper.php │ ├── modifiercompiler.strip_tags.php │ ├── modifiercompiler.indent.php │ ├── modifiercompiler.lower.php │ ├── modifier.spacify.php │ ├── modifiercompiler.count_sentences.php │ ├── modifiercompiler.to_charset.php │ ├── modifiercompiler.from_charset.php │ ├── modifiercompiler.default.php │ ├── modifiercompiler.strip.php │ ├── modifiercompiler.count_characters.php │ ├── modifiercompiler.count_words.php │ ├── shared.escape_special_chars.php │ ├── modifier.replace.php │ ├── shared.literal_compiler_param.php │ ├── modifiercompiler.wordwrap.php │ ├── modifiercompiler.unescape.php │ ├── shared.make_timestamp.php │ ├── shared.mb_unicode.php │ ├── modifier.regex_replace.php │ ├── shared.mb_str_replace.php │ ├── function.counter.php │ ├── modifier.truncate.php │ ├── modifier.mb_wordwrap.php │ └── modifier.date_format.php ├── Web ├── Public │ └── system │ │ ├── noted.txt │ │ └── css │ │ └── zenburn.min.css ├── .htaccess └── index.php ├── Framework ├── Library │ ├── Process │ │ ├── Tpl │ │ │ └── php300.jpg │ │ ├── ReturnHandle.class.php │ │ ├── Cache.class.php │ │ ├── Session.class.php │ │ ├── Log.class.php │ │ ├── Db.class.php │ │ ├── Config.class.php │ │ └── Running.class.php │ └── Interfaces │ │ ├── RouterInterface.php │ │ ├── LogicExceptionsInterface.php │ │ ├── VisitInterface.php │ │ ├── LogInterface.php │ │ ├── ConfigInterface.php │ │ ├── ViewInterface.php │ │ ├── SessionInterface.php │ │ ├── CacheInterface.php │ │ └── DbInterface.php └── Config │ └── frame.cfg.php ├── Project ├── model │ └── UserModel.class.php ├── home │ └── Index.class.php └── config │ └── App.cfg.php ├── composer.json ├── composer.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /Extend/Package/smarty/noted.txt: -------------------------------------------------------------------------------- 1 | smarty为框架视图依赖项,切勿删除该包 -------------------------------------------------------------------------------- /Web/Public/system/noted.txt: -------------------------------------------------------------------------------- 1 | 友情提示:本目录不可被删除,如果被删除会导致异常反馈页显示错误 -------------------------------------------------------------------------------- /Framework/Library/Process/Tpl/php300.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xcg340122/PHP300Framework2x/HEAD/Framework/Library/Process/Tpl/php300.jpg -------------------------------------------------------------------------------- /Extend/Package/smarty/bootstrap.php: -------------------------------------------------------------------------------- 1 | 2 | Options +FollowSymlinks 3 | RewriteEngine On 4 | 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] 8 | -------------------------------------------------------------------------------- /Project/model/UserModel.class.php: -------------------------------------------------------------------------------- 1 | Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- '; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"php300/framework", 3 | "description":"Fast and efficient framework for development - php300", 4 | "keywords":["php300", "framework", "project"], 5 | "homepage":"https://framework.php300.cn", 6 | "license":"Apache-2.0", 7 | "type":"project", 8 | "authors": [{ 9 | "name":"Chungui", 10 | "email":"php300@qq.com", 11 | "homepage":"https://www.php300.cn" 12 | }], 13 | 14 | "require": { 15 | "php": ">=5.4.0" 16 | } 17 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.noprint.php: -------------------------------------------------------------------------------- 1 | PHP300:请将PHP版本切换至5.3以上运行!'); 7 | 8 | /** 引入框架文件 */ 9 | require '../Framework/frame.php'; 10 | 11 | /** @var object 实例化应用 $app */ 12 | $app = new Framework\App(); 13 | 14 | /** 设定默认访问(应用,控制器,方法) */ 15 | $app()->get('Visit')->bind(array('Home', 'Index', 'index')); 16 | 17 | /** 是否调试模式(true => 调试,false => 线上) */ 18 | $app()->get('Running')->isDev(true); 19 | 20 | /** 运行应用 */ 21 | $app()->run(); -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/variablefilter.htmlspecialchars.php: -------------------------------------------------------------------------------- 1 | data(['show' => 'PHP300Framework - 想象无极限', 'describe' => '每个人的生命都是一只小船,梦想是小船的风帆。'])->get(); 26 | } 27 | } -------------------------------------------------------------------------------- /Framework/Library/Interfaces/ConfigInterface.php: -------------------------------------------------------------------------------- 1 | =5.4.0" 17 | }, 18 | "platform-dev": [] 19 | } 20 | -------------------------------------------------------------------------------- /Web/Public/system/css/zenburn.min.css: -------------------------------------------------------------------------------- 1 | .hljs{display:block;overflow-x:auto;padding:0.5em;background:#3f3f3f;color:#dcdcdc}.hljs-keyword,.hljs-selector-tag,.hljs-tag{color:#e3ceab}.hljs-template-tag{color:#dcdcdc}.hljs-number{color:#8cd0d3}.hljs-variable,.hljs-template-variable,.hljs-attribute{color:#efdcbc}.hljs-literal{color:#efefaf}.hljs-subst{color:#8f8f8f}.hljs-title,.hljs-name,.hljs-selector-id,.hljs-selector-class,.hljs-section,.hljs-type{color:#efef8f}.hljs-symbol,.hljs-bullet,.hljs-link{color:#dca3a3}.hljs-deletion,.hljs-string,.hljs-built_in,.hljs-builtin-name{color:#cc9393}.hljs-addition,.hljs-comment,.hljs-quote,.hljs-meta{color:#7f9f7f}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold} -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.string_format.php: -------------------------------------------------------------------------------- 1 | ]*?>!', ' ', {$params[0]})"; 26 | } else { 27 | return 'strip_tags(' . $params[ 0 ] . ')'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Framework/Library/Interfaces/ViewInterface.php: -------------------------------------------------------------------------------- 1 | 17 | * @author Uwe Tews 18 | * 19 | * @param array $params parameters 20 | * 21 | * @return string with compiled code 22 | */ 23 | 24 | function smarty_modifiercompiler_lower($params) 25 | { 26 | if (Smarty::$_MBSTRING) { 27 | return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')'; 28 | } 29 | // no MBString fallback 30 | return 'strtolower(' . $params[ 0 ] . ')'; 31 | } 32 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.spacify.php: -------------------------------------------------------------------------------- 1 | 17 | * 18 | * @param string $string input string 19 | * @param string $spacify_char string to insert between characters. 20 | * 21 | * @return string 22 | */ 23 | function smarty_modifier_spacify($string, $spacify_char = ' ') 24 | { 25 | // well… what about charsets besides latin and UTF-8? 26 | return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY)); 27 | } 28 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.count_sentences.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 33 | return $smarty->debug_tpl; 34 | } 35 | } -------------------------------------------------------------------------------- /Framework/Library/Interfaces/SessionInterface.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 33 | return $smarty->default_modifiers; 34 | } 35 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.default.php: -------------------------------------------------------------------------------- 1 | tpl_vars = array(); 34 | 35 | return $data; 36 | } 37 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smartycompilerexception.php: -------------------------------------------------------------------------------- 1 | Smarty Compiler: ' . $this->message . ' <-- '; 16 | } 17 | 18 | /** 19 | * The line number of the template error 20 | * 21 | * @type int|null 22 | */ 23 | public $line = null; 24 | 25 | /** 26 | * The template source snippet relating to the error 27 | * 28 | * @type string|null 29 | */ 30 | public $source = null; 31 | 32 | /** 33 | * The raw text of the error message 34 | * 35 | * @type string|null 36 | */ 37 | public $desc = null; 38 | 39 | /** 40 | * The resource identifier or template name 41 | * 42 | * @type string|null 43 | */ 44 | public $template = null; 45 | } 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PHP300framework2x -想象无极限 2 | ==== 3 | ![image](https://github.com/xcg340122/PHP300Framework2x/blob/master/Framework/Library/Process/Tpl/php300.jpg) 4 | === 5 | [![](https://img.shields.io/badge/version-2.0-green.svg)](http://framework.php300.cn) 6 | [![](https://img.shields.io/badge/composer-2.0-brightgreen.svg)](https://packagist.org/packages/php300/framework) 7 | [![](https://img.shields.io/badge/group-480-brightgreen.svg)](https://jq.qq.com/?_wv=1027&k=5exsSYT) 8 | 9 | ### 介绍 10 |   PHP300Framework迎来2.0版本,随着时间的推移,我们将带来更多的技术集成点,不仅提高效,还综合提高质,您可以用它来构建开发PHP的WEB应用,因为它是通用的WEB开发框架,随着渐渐的理解它的做法,您将会体会到它带给您的方便和开发的乐趣,从小型企业站到大型门户网站它都是一个不错的选择,另外,我们在2.0版本注重于接口化,所以它将非常友好的支持对APP接口的编写和输出处理。另外您还可以通过Composer进行自由的扩展,系统将会自动的载入扩展的包或类,这里我们对异常处理和数据处理做出了非常多的工作,以便于开发中可以快速的发现并解决问题,祝您开发愉快! 11 | 这里展示部分文档,更多介绍请详见:[在线手册](https://www.kancloud.cn/fold/php300_2/content) 12 | 13 | ### 看点 14 | * MVC开发框架 15 | * 函数助手方便快捷 16 | * 支持CLI模式运行 17 | * 核心容器加载处理 18 | * 自动JSON编码 19 | * 自定义高可用扩展方法 20 | * `Composer`随意`DIY` 21 | * 自定义路由支持 22 | * 数据库驱动快速操作 23 | * 分离式入口更安全 24 | * 高速缓存扩展支持 25 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_parsetree_text.php: -------------------------------------------------------------------------------- 1 | data = $data; 27 | } 28 | 29 | /** 30 | * Return buffer content 31 | * 32 | * @param \Smarty_Internal_Templateparser $parser 33 | * 34 | * @return string text 35 | */ 36 | public function to_smarty_php(Smarty_Internal_Templateparser $parser) 37 | { 38 | return $this->data; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.count_characters.php: -------------------------------------------------------------------------------- 1 | smarty->right_delimiter; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getconfigvariable.php: -------------------------------------------------------------------------------- 1 | ext->configLoad->_getConfigVariable($data, $varName, $errorEnable); 33 | } 34 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_parsetree_code.php: -------------------------------------------------------------------------------- 1 | data = $data; 29 | } 30 | 31 | /** 32 | * Return buffer content in parentheses 33 | * 34 | * @param \Smarty_Internal_Templateparser $parser 35 | * 36 | * @return string content 37 | */ 38 | public function to_smarty_php(Smarty_Internal_Templateparser $parser) 39 | { 40 | return sprintf('(%s)', $this->data); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_compileallconfig.php: -------------------------------------------------------------------------------- 1 | compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true); 32 | } 33 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.count_words.php: -------------------------------------------------------------------------------- 1 | value = $value; 35 | $this->nocache = $nocache; 36 | } 37 | 38 | /** 39 | * <> String conversion 40 | * 41 | * @return string 42 | */ 43 | public function __toString() 44 | { 45 | return (string) $this->value; 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_parsetree_dqcontent.php: -------------------------------------------------------------------------------- 1 | data = $data; 29 | } 30 | 31 | /** 32 | * Return content as double quoted string 33 | * 34 | * @param \Smarty_Internal_Templateparser $parser 35 | * 36 | * @return string doubled quoted string 37 | */ 38 | public function to_smarty_php(Smarty_Internal_Templateparser $parser) 39 | { 40 | return '"' . $this->data . '"'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/shared.escape_special_chars.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @param string $string text that should by escaped 18 | * 19 | * @return string 20 | */ 21 | function smarty_function_escape_special_chars($string) 22 | { 23 | if (!is_array($string)) { 24 | if (version_compare(PHP_VERSION, '5.2.3', '>=')) { 25 | $string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false); 26 | } else { 27 | $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); 28 | $string = htmlspecialchars($string); 29 | $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); 30 | } 31 | } 32 | 33 | return $string; 34 | } 35 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_clearconfig.php: -------------------------------------------------------------------------------- 1 | config_vars[ $name ]); 36 | } else { 37 | $data->config_vars = array(); 38 | } 39 | return $data; 40 | } 41 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_parsetree.php: -------------------------------------------------------------------------------- 1 | data = null; 49 | $this->subtrees = null; 50 | } 51 | 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.replace.php: -------------------------------------------------------------------------------- 1 | 17 | * @author Uwe Tews 18 | * 19 | * @param string $string input string 20 | * @param string $search text to search for 21 | * @param string $replace replacement text 22 | * 23 | * @return string 24 | */ 25 | function smarty_modifier_replace($string, $search, $replace) 26 | { 27 | static $is_loaded = false; 28 | if (Smarty::$_MBSTRING) { 29 | if (!$is_loaded) { 30 | if (!is_callable('smarty_mb_str_replace')) { 31 | require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); 32 | } 33 | $is_loaded = true; 34 | } 35 | return smarty_mb_str_replace($search, $replace, $string); 36 | } 37 | 38 | return str_replace($search, $replace, $string); 39 | } 40 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_clearallcache.php: -------------------------------------------------------------------------------- 1 | _clearTemplateCache(); 37 | // load cache resource and call clearAll 38 | $_cache_resource = Smarty_CacheResource::load($smarty, $type); 39 | return $_cache_resource->clearAll($smarty, $exp_time); 40 | } 41 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_setdefaultmodifiers.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | $smarty->default_modifiers = (array) $modifiers; 36 | return $obj; 37 | } 38 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/shared.literal_compiler_param.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (!is_readable($tpl_name)) { 36 | throw new SmartyException("Unknown file '{$tpl_name}'"); 37 | } 38 | $smarty->debug_tpl = $tpl_name; 39 | return $obj; 40 | } 41 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_ldelim.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | if ($_attr[ 'nocache' ] === true) { 33 | $compiler->trigger_template_error('nocache option not allowed', null, true); 34 | } 35 | return $compiler->smarty->left_delimiter; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unregisterresource.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (isset($smarty->registered_resources[ $type ])) { 36 | unset($smarty->registered_resources[ $type ]); 37 | } 38 | return $obj; 39 | } 40 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unregisterobject.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (isset($smarty->registered_objects[ $object_name ])) { 36 | unset($smarty->registered_objects[ $object_name ]); 37 | } 38 | return $obj; 39 | } 40 | } -------------------------------------------------------------------------------- /Framework/Library/Process/Cache.class.php: -------------------------------------------------------------------------------- 1 | 'Drive\Cache\Memcache', 25 | 26 | 'redis' => 'Drive\Cache\Redis', 27 | 28 | 'file' => 'Drive\Cache\File' 29 | ]; 30 | 31 | /** 32 | * 初始化缓存配置 33 | */ 34 | public function init() 35 | { 36 | $CacheConfig = Config::$AppConfig['cache']; 37 | if (is_array($CacheConfig) && isset($CacheConfig['ip'])) { 38 | $this->object = App::$app->get($this->CacheType[strtolower($CacheConfig['cacheType'])]); 39 | if(strtolower($CacheConfig['cacheType']) != 'file'){ 40 | $this->object->connect($CacheConfig['ip'], $CacheConfig['port']); 41 | } 42 | } 43 | return $this; 44 | } 45 | 46 | /** 47 | * 获取操作对象实例 48 | * @return object 49 | */ 50 | public function getObj() 51 | { 52 | return $this->object; 53 | } 54 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_clearassign.php: -------------------------------------------------------------------------------- 1 | tpl_vars[ $curr_var ]); 37 | } 38 | } else { 39 | unset($data->tpl_vars[ $tpl_var ]); 40 | } 41 | 42 | return $data; 43 | } 44 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unregistercacheresource.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (isset($smarty->registered_cache_resources[ $name ])) { 36 | unset($smarty->registered_cache_resources[ $name ]); 37 | } 38 | return $obj; 39 | } 40 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.wordwrap.php: -------------------------------------------------------------------------------- 1 | getPlugin('mb_wordwrap','modifier'); 37 | } 38 | return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')'; 39 | } 40 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_debug.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | 33 | // compile always as nocache 34 | $compiler->tag_nocache = true; 35 | 36 | // display debug template 37 | $_output = 38 | "display_debug(\$_smarty_tpl);\n"; 39 | $_output .= "unset(\$_smarty_debug);\n?>"; 40 | return $_output; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getglobal.php: -------------------------------------------------------------------------------- 1 | value; 36 | } else { 37 | return ''; 38 | } 39 | } else { 40 | $_result = array(); 41 | foreach (Smarty::$global_tpl_vars AS $key => $var) { 42 | $_result[ $key ] = $var->value; 43 | } 44 | return $_result; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unregisterplugin.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 36 | if (isset($smarty->registered_plugins[ $type ][ $name ])) { 37 | unset($smarty->registered_plugins[ $type ][ $name ]); 38 | } 39 | return $obj; 40 | } 41 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_adddefaultmodifiers.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (is_array($modifiers)) { 36 | $smarty->default_modifiers = array_merge($smarty->default_modifiers, $modifiers); 37 | } else { 38 | $smarty->default_modifiers[] = $modifiers; 39 | } 40 | return $obj; 41 | } 42 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_assignbyref.php: -------------------------------------------------------------------------------- 1 | tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); 29 | $data->tpl_vars[ $tpl_var ]->value = &$value; 30 | if ($data->_isTplObj() && $data->scope) { 31 | $data->ext->_updateScope->_updateScope($data, $tpl_var); 32 | } 33 | } 34 | return $data; 35 | } 36 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registercacheresource.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 37 | $smarty->registered_cache_resources[ $name ] = $resource_handler; 38 | return $obj; 39 | } 40 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerdefaultconfighandler.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (is_callable($callback)) { 36 | $smarty->default_config_handler_func = $callback; 37 | } else { 38 | throw new SmartyException('Default config handler not callable'); 39 | } 40 | return $obj; 41 | } 42 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifiercompiler.unescape.php: -------------------------------------------------------------------------------- 1 | _clearTemplateCache(); 41 | // load cache resource and call clear 42 | $_cache_resource = Smarty_CacheResource::load($smarty, $type); 43 | return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time); 44 | } 45 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 36 | if (is_callable($callback)) { 37 | $smarty->default_plugin_handler_func = $callback; 38 | } else { 39 | throw new SmartyException("Default plugin handler '$callback' not callable"); 40 | } 41 | return $obj; 42 | } 43 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getstreamvariable.php: -------------------------------------------------------------------------------- 1 | smarty) ? $data->smarty : $data; 45 | if ($smarty->error_unassigned) { 46 | throw new SmartyException('Undefined stream variable "' . $variable . '"'); 47 | } else { 48 | return null; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getautoloadfilters.php: -------------------------------------------------------------------------------- 1 | array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type 25 | * was specified 26 | * @throws \SmartyException 27 | */ 28 | public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null) 29 | { 30 | $smarty = $obj->_getSmartyObj(); 31 | if ($type !== null) { 32 | $this->_checkFilterType($type); 33 | return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array(); 34 | } 35 | return $smarty->autoload_filters; 36 | } 37 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_assignglobal.php: -------------------------------------------------------------------------------- 1 | _isTplObj()) { 37 | $ptr->tpl_vars[ $varName ] = clone Smarty::$global_tpl_vars[ $varName ]; 38 | $ptr = $ptr->parent; 39 | } 40 | } 41 | return $data; 42 | } 43 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_createdata.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 38 | $dataObj = new Smarty_Data($parent, $smarty, $name); 39 | if ($smarty->debugging) { 40 | Smarty_Internal_Debug::register_data($dataObj); 41 | } 42 | return $dataObj; 43 | } 44 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getregisteredobject.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 36 | if (!isset($smarty->registered_objects[ $object_name ])) { 37 | throw new SmartyException("'$object_name' is not a registered object"); 38 | } 39 | if (!is_object($smarty->registered_objects[ $object_name ][ 0 ])) { 40 | throw new SmartyException("registered '$object_name' is not an object"); 41 | } 42 | return $smarty->registered_objects[ $object_name ][ 0 ]; 43 | } 44 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_private_object_block_function.php: -------------------------------------------------------------------------------- 1 | $_value) { 33 | if (is_int($_key)) { 34 | $_paramsArray[] = "$_key=>$_value"; 35 | } else { 36 | $_paramsArray[] = "'$_key'=>$_value"; 37 | } 38 | } 39 | $callback = array("\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]", "->{$method}"); 40 | return array($callback, $_paramsArray, "array(\$_block_plugin{$this->nesting}, '{$method}')"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/shared.make_timestamp.php: -------------------------------------------------------------------------------- 1 | 14 | * 15 | * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() 16 | * 17 | * @return int 18 | */ 19 | function smarty_make_timestamp($string) 20 | { 21 | if (empty($string)) { 22 | // use "now": 23 | return time(); 24 | } elseif ($string instanceof DateTime || 25 | (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) 26 | ) { 27 | return (int) $string->format('U'); // PHP 5.2 BC 28 | } elseif (strlen($string) === 14 && ctype_digit($string)) { 29 | // it is mysql timestamp format of YYYYMMDDHHMMSS? 30 | return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), 31 | substr($string, 6, 2), substr($string, 0, 4)); 32 | } elseif (is_numeric($string)) { 33 | // it is a numeric string, we handle it as timestamp 34 | return (int) $string; 35 | } else { 36 | // strtotime should handle it 37 | $time = strtotime($string); 38 | if ($time === - 1 || $time === false) { 39 | // strtotime() was not able to parse $string, use "now": 40 | return time(); 41 | } 42 | 43 | return $time; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unloadfilter.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 31 | $this->_checkFilterType($type); 32 | if (isset($smarty->registered_filters[ $type ])) { 33 | $_filter_name = "smarty_{$type}filter_{$name}"; 34 | if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) { 35 | unset ($smarty->registered_filters[ $type ][ $_filter_name ]); 36 | if (empty($smarty->registered_filters[ $type ])) { 37 | unset($smarty->registered_filters[ $type ]); 38 | } 39 | } 40 | } 41 | return $obj; 42 | } 43 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerclass.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 38 | // test if exists 39 | if (!class_exists($class_impl)) { 40 | throw new SmartyException("Undefined class '$class_impl' in register template class"); 41 | } 42 | // register the class 43 | $smarty->registered_classes[ $class_name ] = $class_impl; 44 | return $obj; 45 | } 46 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_resource_uncompiled.php: -------------------------------------------------------------------------------- 1 | filepath = $_template->source->filepath; 42 | $compiled->timestamp = $_template->source->timestamp; 43 | $compiled->exists = $_template->source->exists; 44 | if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) { 45 | $compiled->file_dependency[ $_template->source->uid ] = 46 | array($compiled->filepath, $compiled->timestamp, $_template->source->type,); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_unregisterfilter.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 31 | $this->_checkFilterType($type); 32 | if (isset($smarty->registered_filters[ $type ])) { 33 | $name = is_string($callback) ? $callback : $this->_getFilterName($callback); 34 | if (isset($smarty->registered_filters[ $type ][ $name ])) { 35 | unset($smarty->registered_filters[ $type ][ $name ]); 36 | if (empty($smarty->registered_filters[ $type ])) { 37 | unset($smarty->registered_filters[ $type ]); 38 | } 39 | } 40 | } 41 | return $obj; 42 | } 43 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/shared.mb_unicode.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 40 | $smarty->registered_resources[ $name ] = 41 | $resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false); 42 | return $obj; 43 | } 44 | } -------------------------------------------------------------------------------- /Framework/Library/Process/Session.class.php: -------------------------------------------------------------------------------- 1 | Name); 32 | ini_set('session.auto_start', '1'); 33 | ini_set('session.cookie_lifetime', $this->Second); 34 | session_start(); 35 | } 36 | } 37 | 38 | /** 39 | * 获取session 40 | * @param string $name 41 | * @return bool 42 | */ 43 | public function get($name = '') 44 | { 45 | if (!empty($name)) { 46 | return (!empty($_SESSION[$name])) ? ($_SESSION[$name]) : (FALSE); 47 | } 48 | return $_SESSION; 49 | } 50 | 51 | /** 52 | * 设置session 53 | * @param string $name 54 | * @param string $value 55 | * @return string 56 | */ 57 | public function set($name = 'php300', $value = '') 58 | { 59 | $_SESSION[$name] = $value; 60 | return true; 61 | } 62 | 63 | /** 64 | * 删除session 65 | * @param string $name 66 | * @return string 67 | */ 68 | public function del($name = '') 69 | { 70 | if (empty($name)) { 71 | session_destroy(); 72 | } else { 73 | $_SESSION[$name] = NULL; 74 | 75 | } 76 | return true; 77 | } 78 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_getconfigvars.php: -------------------------------------------------------------------------------- 1 | config_vars[ $varname ])) { 40 | return $_ptr->config_vars[ $varname ]; 41 | } 42 | } else { 43 | $var_array = array_merge($_ptr->config_vars, $var_array); 44 | } 45 | // not found, try at parent 46 | if ($search_parents) { 47 | $_ptr = $_ptr->parent; 48 | } else { 49 | $_ptr = null; 50 | } 51 | } 52 | if (isset($varname)) { 53 | return ''; 54 | } else { 55 | return $var_array; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.regex_replace.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @param string $string input string 20 | * @param string|array $search regular expression(s) to search for 21 | * @param string|array $replace string(s) that should be replaced 22 | * @param int $limit the maximum number of replacements 23 | * 24 | * @return string 25 | */ 26 | function smarty_modifier_regex_replace($string, $search, $replace, $limit = - 1) 27 | { 28 | if (is_array($search)) { 29 | foreach ($search as $idx => $s) { 30 | $search[ $idx ] = _smarty_regex_replace_check($s); 31 | } 32 | } else { 33 | $search = _smarty_regex_replace_check($search); 34 | } 35 | 36 | return preg_replace($search, $replace, $string, $limit); 37 | } 38 | 39 | /** 40 | * @param string $search string(s) that should be replaced 41 | * 42 | * @return string 43 | * @ignore 44 | */ 45 | function _smarty_regex_replace_check($search) 46 | { 47 | // null-byte injection detection 48 | // anything behind the first null-byte is ignored 49 | if (($pos = strpos($search, "\0")) !== false) { 50 | $search = substr($search, 0, $pos); 51 | } 52 | // remove eval-modifier from $search 53 | if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[ 1 ], 'e') !== false)) { 54 | $search = substr($search, 0, - strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]); 55 | } 56 | 57 | return $search; 58 | } 59 | -------------------------------------------------------------------------------- /Project/config/App.cfg.php: -------------------------------------------------------------------------------- 1 | [ 12 | /** 13 | * 默认连接 14 | */ 15 | 'default' => [ 16 | 17 | /** 目标IP/域名 */ 18 | 'host' => '127.0.0.1', 19 | 20 | /** 目标端口 */ 21 | 'port' => 3306, 22 | 23 | /** 数据库用户名 */ 24 | 'username' => 'root', 25 | 26 | /** 数据库密码 */ 27 | 'password' => 'root', 28 | 29 | /** 数据库名称 */ 30 | 'database' => 'test', 31 | 32 | /** 数据表前缀 */ 33 | 'tabprefix' => '', 34 | 35 | /** 数据库编码 */ 36 | 'char' => 'utf8', 37 | 38 | /** 39 | * 数据库驱动类型 40 | * mysqli 41 | * pdo 42 | */ 43 | 'dbType' => 'mysqli', 44 | 45 | /** 是否使用该数据库配置 */ 46 | 'connect' => false 47 | ] 48 | ], 49 | 50 | /** 51 | * 缓存配置 52 | */ 53 | 'cache' => [ 54 | /** 55 | * 缓存服务类型 56 | * memcache(默认端口:11211) 57 | * redis(默认端口:6379) 58 | * file 59 | */ 60 | 'cacheType' => 'file', 61 | 62 | /** 缓存服务器IP/域名(类型为file可忽略) */ 63 | 'ip' => '', 64 | 65 | /** 缓存服务器端口(类型为file可忽略) */ 66 | 'port' => '', 67 | ], 68 | 69 | /** 70 | * 路由配置 71 | */ 72 | 'router' => [ 73 | 74 | /** 75 | * 演示路由 76 | * 这里的实例名称和控制器名称全部小写 77 | */ 78 | '/home/index/test' => function () { 79 | 80 | //这里是自定义操作 81 | return '这是router配置中路由的测试'; 82 | }, 83 | ], 84 | 85 | /** 86 | * 安全配置 87 | */ 88 | 'safe' => [ 89 | 90 | /** 91 | * ajax域名白名单(默认只允许当前域名) 92 | */ 93 | 'ajax_domain' => [ /* 一行一个域名,需要带上协议,例如:https://www.baidu.com */ 94 | 95 | ] 96 | ] 97 | 98 | ]; -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_make_nocache.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 53 | if ($compiler->template->caching) { 54 | $output = "smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n"; 55 | $compiler->template->compiled->has_nocache_code = true; 56 | $compiler->suppressNocacheProcessing = true; 57 | return $output; 58 | } else { 59 | return true; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_nocache_insert.php: -------------------------------------------------------------------------------- 1 | assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . 41 | ',\$_smarty_tpl), true);?>'; 42 | } else { 43 | $_output .= "echo {$_function}(" . var_export($_attr, true) . ',$_smarty_tpl);?>'; 44 | } 45 | $_tpl = $_template; 46 | while ($_tpl->_isSubTpl()) { 47 | $_tpl = $_tpl->parent; 48 | } 49 | 50 | return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_data.php: -------------------------------------------------------------------------------- 1 | dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); 55 | $this->smarty = $smarty; 56 | if (is_object($_parent)) { 57 | // when object set up back pointer 58 | $this->parent = $_parent; 59 | } elseif (is_array($_parent)) { 60 | // set up variable values 61 | foreach ($_parent as $_key => $_val) { 62 | $this->tpl_vars[ $_key ] = new Smarty_Variable($_val); 63 | } 64 | } elseif ($_parent !== null) { 65 | throw new SmartyException('Wrong type for template variables'); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_mustcompile.php: -------------------------------------------------------------------------------- 1 | source->exists) { 34 | if ($_template->_isSubTpl()) { 35 | $parent_resource = " in '$_template->parent->template_resource}'"; 36 | } else { 37 | $parent_resource = ''; 38 | } 39 | throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); 40 | } 41 | if ($_template->mustCompile === null) { 42 | $_template->mustCompile = (!$_template->source->handler->uncompiled && 43 | ($_template->smarty->force_compile || $_template->source->handler->recompiled || 44 | !$_template->compiled->exists || ($_template->compile_check && 45 | $_template->compiled->getTimeStamp() < 46 | $_template->source->getTimeStamp()))); 47 | } 48 | 49 | return $_template->mustCompile; 50 | } 51 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_undefined.php: -------------------------------------------------------------------------------- 1 | class = $class; 30 | } 31 | 32 | /** 33 | * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled 34 | * 35 | * @param \Smarty_Internal_Template $tpl 36 | * @param array $properties special template properties 37 | * @param bool $cache flag if called from cache file 38 | * 39 | * @return bool false 40 | */ 41 | public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false) 42 | { 43 | if ($cache) { 44 | $tpl->cached->valid = false; 45 | } else { 46 | $tpl->mustCompile = true; 47 | } 48 | return false; 49 | } 50 | 51 | /** 52 | * Call error handler for undefined method 53 | * 54 | * @param string $name unknown method-name 55 | * @param array $args argument array 56 | * 57 | * @return mixed 58 | * @throws SmartyException 59 | */ 60 | public function __call($name, $args) 61 | { 62 | if (isset($this->class)) { 63 | throw new SmartyException("undefined extension class '{$this->class}'"); 64 | } else { 65 | throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method"); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/shared.mb_str_replace.php: -------------------------------------------------------------------------------- 1 | tpl_vars[ $tpl_var ])) { 32 | $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); 33 | } 34 | if (!is_array($data->tpl_vars[ $tpl_var ]->value)) { 35 | settype($data->tpl_vars[ $tpl_var ]->value, 'array'); 36 | } 37 | if ($merge && is_array($value)) { 38 | foreach ($value as $_key => $_val) { 39 | $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ]; 40 | } 41 | } else { 42 | $data->tpl_vars[ $tpl_var ]->value[] = &$value; 43 | } 44 | if ($data->_isTplObj() && $data->scope) { 45 | $data->ext->_updateScope->_updateScope($data, $tpl_var); 46 | } 47 | } 48 | return $data; 49 | } 50 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_append.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var', 'value'); 33 | $this->shorttag_order = array('var', 'value'); 34 | $this->optional_attributes = array('scope', 'index'); 35 | $this->mapCache = array(); 36 | // check and get attributes 37 | $_attr = $this->getAttributes($compiler, $args); 38 | // map to compile assign attributes 39 | if (isset($_attr[ 'index' ])) { 40 | $_params[ 'smarty_internal_index' ] = '[' . $_attr[ 'index' ] . ']'; 41 | unset($_attr[ 'index' ]); 42 | } else { 43 | $_params[ 'smarty_internal_index' ] = '[]'; 44 | } 45 | $_new_attr = array(); 46 | foreach ($_attr as $key => $value) { 47 | $_new_attr[] = array($key => $value); 48 | } 49 | // call compile assign 50 | return parent::compile($_new_attr, $compiler, $_params); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Framework/Library/Process/Log.class.php: -------------------------------------------------------------------------------- 1 | 0 ? '(' . $count . ')' : ''; 29 | $fileLine = $fileName . '_' . date('Y-m-d', time()) . $fileExt; 30 | $fileNames = $fileLine . $this->extend; 31 | if (file_exists($fileNames)) { 32 | $size = number_format(filesize($fileNames) / 1024 / 1024, 3); 33 | if ($size > 3) { 34 | $number = intval(substr($fileLine, -2, 1)) + 1; 35 | $this->Write($fileName, $Content, $number); 36 | } else { 37 | file_put_contents($fileNames, $Content, FILE_APPEND); 38 | } 39 | } else { 40 | file_put_contents($fileNames, $Content, FILE_APPEND); 41 | } 42 | } 43 | 44 | /** 45 | * 记录动作 46 | * @param $LogPath 47 | * @param $fileName 48 | * @param $Log 49 | * @return bool|mixed 50 | */ 51 | public function Record($LogPath, $fileName, $Log) 52 | { 53 | if (strpos($LogPath, '/') === false) $LogPath = Running::$framworkPath . '/Project/runtime/' . $LogPath . '/log'; 54 | if (!empty($Log)) { 55 | if (!file_exists($LogPath)) { 56 | Structure::createDir($LogPath); 57 | } 58 | $Log = "[" . date('Y-m-d H:i:s') . "]\r\n$Log\r\n------------------\r\n\r\n "; 59 | $this->Write($LogPath . '/' . $fileName, $Log); 60 | return true; 61 | } 62 | return false; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_block.php: -------------------------------------------------------------------------------- 1 | name = $name; 79 | $this->tplIndex = $tplIndex; 80 | } 81 | 82 | /** 83 | * Compiled block code overloaded by {block} class 84 | * 85 | * @param \Smarty_Internal_Template $tpl 86 | */ 87 | public function callBlock(Smarty_Internal_Template $tpl) 88 | { 89 | } 90 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_shared_inheritance.php: -------------------------------------------------------------------------------- 1 | prefixCompiledCode .= "_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " . 28 | var_export($initChildSequence, true) . ");\n?>\n"; 29 | } 30 | 31 | /** 32 | * Register post compile callback to compile inheritance initialization code 33 | * 34 | * @param \Smarty_Internal_TemplateCompilerBase $compiler 35 | * @param bool|false $initChildSequence if true force child template 36 | */ 37 | public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) 38 | { 39 | if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { 40 | $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), 41 | array($initChildSequence), 42 | 'inheritanceInit', 43 | $initChildSequence); 44 | 45 | $compiler->_cache['inheritanceInit'] = true; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_parsetree_tag.php: -------------------------------------------------------------------------------- 1 | data = $data; 38 | $this->saved_block_nesting = $parser->block_nesting_level; 39 | } 40 | 41 | /** 42 | * Return buffer content 43 | * 44 | * @param \Smarty_Internal_Templateparser $parser 45 | * 46 | * @return string content 47 | */ 48 | public function to_smarty_php(Smarty_Internal_Templateparser $parser) 49 | { 50 | return $this->data; 51 | } 52 | 53 | /** 54 | * Return complied code that loads the evaluated output of buffer content into a temporary variable 55 | * 56 | * @param \Smarty_Internal_Templateparser $parser 57 | * 58 | * @return string template code 59 | */ 60 | public function assign_to_var(Smarty_Internal_Templateparser $parser) 61 | { 62 | $var = $parser->compiler->getNewPrefixVariable(); 63 | $tmp = $parser->compiler->appendCode('', $this->data); 64 | $tmp = $parser->compiler->appendCode($tmp, ""); 65 | $parser->compiler->prefix_code[] = sprintf('%s', $tmp); 66 | 67 | return $var; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Framework/Library/Process/Db.class.php: -------------------------------------------------------------------------------- 1 | 'Drive\Db\Mysqli', 30 | 31 | 'pdo' => 'Drive\Db\Pdo' 32 | ]; 33 | 34 | /** 35 | * 构造方法 36 | * Db constructor 37 | */ 38 | public function __construct() 39 | { 40 | $this->init(Config::$AppConfig['db']); 41 | } 42 | 43 | /** 44 | * 初始化数据库连接 45 | * @param array $configArr 46 | */ 47 | public function init($configArr = []) 48 | { 49 | if (is_array($configArr)) { 50 | foreach ($configArr as $key => $value) { 51 | $this->addlink($key, $value); 52 | } 53 | } 54 | } 55 | 56 | /** 57 | * 添加连接信息 58 | * @param $name 59 | * @param $config 60 | */ 61 | private function addlink($name, $config) 62 | { 63 | if (!empty($name) && is_array($config) && $config['connect'] === true) { 64 | if (isset($config['dbType']) && isset($this->dbType[strtolower($config['dbType'])]) && isset($config['username'])) { 65 | if (!isset($this->link[$name])) { 66 | $this->db = \Framework\App::$app->get($this->dbType[strtolower($config['dbType'])]); 67 | $this->putlink($name, ['obj' => $this->db, 'link' => $this->db->connect($config)]); 68 | } 69 | } 70 | } 71 | } 72 | 73 | /** 74 | * 压入连接 75 | * @param $link 76 | */ 77 | private function putlink($name, $link) 78 | { 79 | $this->link[$name] = $link; 80 | } 81 | 82 | /** 83 | * 获取所有建立的连接 84 | * @return array 85 | */ 86 | public function getlink() 87 | { 88 | return $this->link; 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/function.counter.php: -------------------------------------------------------------------------------- 1 | 16 | * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} 17 | * (Smarty online manual) 18 | * 19 | * @param array $params parameters 20 | * @param Smarty_Internal_Template $template template object 21 | * 22 | * @return string|null 23 | */ 24 | function smarty_function_counter($params, $template) 25 | { 26 | static $counters = array(); 27 | 28 | $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default'; 29 | if (!isset($counters[ $name ])) { 30 | $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1); 31 | } 32 | $counter =& $counters[ $name ]; 33 | 34 | if (isset($params[ 'start' ])) { 35 | $counter[ 'start' ] = $counter[ 'count' ] = (int) $params[ 'start' ]; 36 | } 37 | 38 | if (!empty($params[ 'assign' ])) { 39 | $counter[ 'assign' ] = $params[ 'assign' ]; 40 | } 41 | 42 | if (isset($counter[ 'assign' ])) { 43 | $template->assign($counter[ 'assign' ], $counter[ 'count' ]); 44 | } 45 | 46 | if (isset($params[ 'print' ])) { 47 | $print = (bool) $params[ 'print' ]; 48 | } else { 49 | $print = empty($counter[ 'assign' ]); 50 | } 51 | 52 | if ($print) { 53 | $retval = $counter[ 'count' ]; 54 | } else { 55 | $retval = null; 56 | } 57 | 58 | if (isset($params[ 'skip' ])) { 59 | $counter[ 'skip' ] = $params[ 'skip' ]; 60 | } 61 | 62 | if (isset($params[ 'direction' ])) { 63 | $counter[ 'direction' ] = $params[ 'direction' ]; 64 | } 65 | 66 | if ($counter[ 'direction' ] === 'down') { 67 | $counter[ 'count' ] -= $counter[ 'skip' ]; 68 | } else { 69 | $counter[ 'count' ] += $counter[ 'skip' ]; 70 | } 71 | 72 | return $retval; 73 | } 74 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_eval.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 55 | if (isset($_attr[ 'assign' ])) { 56 | // output will be stored in a smarty variable instead of being displayed 57 | $_assign = $_attr[ 'assign' ]; 58 | } 59 | 60 | // create template object 61 | $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);"; 62 | //was there an assign attribute? 63 | if (isset($_assign)) { 64 | $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; 65 | } else { 66 | $_output .= 'echo $_template->fetch();'; 67 | } 68 | 69 | return ""; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerplugin.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 42 | if (isset($smarty->registered_plugins[ $type ][ $name ])) { 43 | throw new SmartyException("Plugin tag '{$name}' already registered"); 44 | } elseif (!is_callable($callback)) { 45 | throw new SmartyException("Plugin '{$name}' not callable"); 46 | } else { 47 | $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); 48 | } 49 | return $obj; 50 | } 51 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_runtime_make_nocache.php: -------------------------------------------------------------------------------- 1 | tpl_vars[ $var ])) { 26 | $export = 27 | preg_replace('/^Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true)); 28 | if (preg_match('/(\w+)::__set_state/', $export, $match)) { 29 | throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'"); 30 | } 31 | echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', ", '\\') . 33 | $export . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/"; 34 | } 35 | } 36 | 37 | /** 38 | * Store variable value saved while rendering compiled template in cached template context 39 | * 40 | * @param \Smarty_Internal_Template $tpl 41 | * @param string $var variable name 42 | * @param array $properties 43 | */ 44 | public function store(Smarty_Internal_Template $tpl, $var, $properties) 45 | { 46 | // do not overwrite existing nocache variables 47 | if (!isset($tpl->tpl_vars[ $var ]) || !$tpl->tpl_vars[ $var ]->nocache) { 48 | $newVar = new Smarty_Variable(); 49 | unset($properties[ 'nocache' ]); 50 | foreach ($properties as $k => $v) { 51 | $newVar->$k = $v; 52 | } 53 | $tpl->tpl_vars[ $var ] = $newVar; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_gettags.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 38 | if ($obj->_isTplObj() && !isset($template)) { 39 | $tpl = clone $obj; 40 | } elseif (isset($template) && $template->_isTplObj()) { 41 | $tpl = clone $template; 42 | } elseif (isset($template) && is_string($template)) { 43 | /* @var Smarty_Internal_Template $tpl */ 44 | $tpl = new $smarty->template_class($template, $smarty); 45 | // checks if template exists 46 | if (!$tpl->source->exists) { 47 | throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'"); 48 | } 49 | } 50 | if (isset($tpl)) { 51 | $tpl->smarty = clone $tpl->smarty; 52 | $tpl->smarty->_cache[ 'get_used_tags' ] = true; 53 | $tpl->_cache[ 'used_tags' ] = array(); 54 | $tpl->smarty->merge_compiled_includes = false; 55 | $tpl->smarty->disableSecurity(); 56 | $tpl->caching = Smarty::CACHING_OFF; 57 | $tpl->loadCompiler(); 58 | $tpl->compiler->compileTemplate($tpl); 59 | return $tpl->_cache[ 'used_tags' ]; 60 | } 61 | throw new SmartyException('Missing template specification'); 62 | } 63 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_addautoloadfilters.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 32 | if ($type !== null) { 33 | $this->_checkFilterType($type); 34 | if (!empty($smarty->autoload_filters[ $type ])) { 35 | $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters); 36 | } else { 37 | $smarty->autoload_filters[ $type ] = (array) $filters; 38 | } 39 | } else { 40 | foreach ((array) $filters as $type => $value) { 41 | $this->_checkFilterType($type); 42 | if (!empty($smarty->autoload_filters[ $type ])) { 43 | $smarty->autoload_filters[ $type ] = 44 | array_merge($smarty->autoload_filters[ $type ], (array) $value); 45 | } else { 46 | $smarty->autoload_filters[ $type ] = (array) $value; 47 | } 48 | } 49 | } 50 | return $obj; 51 | } 52 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.truncate.php: -------------------------------------------------------------------------------- 1 | 19 | * 20 | * @param string $string input string 21 | * @param integer $length length of truncated text 22 | * @param string $etc end string 23 | * @param boolean $break_words truncate at word boundary 24 | * @param boolean $middle truncate in the middle of text 25 | * 26 | * @return string truncated string 27 | */ 28 | function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) 29 | { 30 | if ($length === 0) { 31 | return ''; 32 | } 33 | 34 | if (Smarty::$_MBSTRING) { 35 | if (mb_strlen($string, Smarty::$_CHARSET) > $length) { 36 | $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET)); 37 | if (!$break_words && !$middle) { 38 | $string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', 39 | mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)); 40 | } 41 | if (!$middle) { 42 | return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc; 43 | } 44 | 45 | return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . 46 | mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET); 47 | } 48 | 49 | return $string; 50 | } 51 | 52 | // no MBString fallback 53 | if (isset($string[ $length ])) { 54 | $length -= min($length, strlen($etc)); 55 | if (!$break_words && !$middle) { 56 | $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1)); 57 | } 58 | if (!$middle) { 59 | return substr($string, 0, $length) . $etc; 60 | } 61 | 62 | return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2); 63 | } 64 | 65 | return $string; 66 | } 67 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_nocache.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 38 | $this->openTag($compiler, 'nocache', array($compiler->nocache)); 39 | // enter nocache mode 40 | $compiler->nocache = true; 41 | // this tag does not return compiled code 42 | $compiler->has_code = false; 43 | 44 | return true; 45 | } 46 | } 47 | 48 | /** 49 | * Smarty Internal Plugin Compile Nocacheclose Class 50 | * 51 | * @package Smarty 52 | * @subpackage Compiler 53 | */ 54 | class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase 55 | { 56 | /** 57 | * Compiles code for the {/nocache} tag 58 | * This tag does not generate compiled output. It only sets a compiler flag. 59 | * 60 | * @param array $args array with attributes from parser 61 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object 62 | * 63 | * @return bool 64 | */ 65 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) 66 | { 67 | $_attr = $this->getAttributes($compiler, $args); 68 | // leave nocache mode 69 | list($compiler->nocache) = $this->closeTag($compiler, array('nocache')); 70 | // this tag does not return compiled code 71 | $compiler->has_code = false; 72 | 73 | return true; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_setfilter.php: -------------------------------------------------------------------------------- 1 | variable_filter_stack[] = $compiler->variable_filters; 31 | $compiler->variable_filters = $parameter[ 'modifier_list' ]; 32 | // this tag does not return compiled code 33 | $compiler->has_code = false; 34 | 35 | return true; 36 | } 37 | } 38 | 39 | /** 40 | * Smarty Internal Plugin Compile Setfilterclose Class 41 | * 42 | * @package Smarty 43 | * @subpackage Compiler 44 | */ 45 | class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase 46 | { 47 | /** 48 | * Compiles code for the {/setfilter} tag 49 | * This tag does not generate compiled output. It resets variable filter. 50 | * 51 | * @param array $args array with attributes from parser 52 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object 53 | * 54 | * @return string compiled code 55 | */ 56 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) 57 | { 58 | $_attr = $this->getAttributes($compiler, $args); 59 | // reset variable filter to previous state 60 | if (count($compiler->variable_filter_stack)) { 61 | $compiler->variable_filters = array_pop($compiler->variable_filter_stack); 62 | } else { 63 | $compiler->variable_filters = array(); 64 | } 65 | // this tag does not return compiled code 66 | $compiler->has_code = false; 67 | 68 | return true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_loadfilter.php: -------------------------------------------------------------------------------- 1 | true, 'post' => true, 'output' => true, 'variable' => true); 27 | 28 | /** 29 | * load a filter of specified type and name 30 | * 31 | * @api Smarty::loadFilter() 32 | * 33 | * @link http://www.smarty.net/docs/en/api.load.filter.tpl 34 | * 35 | * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj 36 | * @param string $type filter type 37 | * @param string $name filter name 38 | * 39 | * @return bool 40 | * @throws SmartyException if filter could not be loaded 41 | */ 42 | public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name) 43 | { 44 | $smarty = $obj->_getSmartyObj(); 45 | $this->_checkFilterType($type); 46 | $_plugin = "smarty_{$type}filter_{$name}"; 47 | $_filter_name = $_plugin; 48 | if (is_callable($_plugin)) { 49 | $smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin; 50 | return true; 51 | } 52 | if ($smarty->loadPlugin($_plugin)) { 53 | if (class_exists($_plugin, false)) { 54 | $_plugin = array($_plugin, 'execute'); 55 | } 56 | if (is_callable($_plugin)) { 57 | $smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin; 58 | return true; 59 | } 60 | } 61 | throw new SmartyException("{$type}filter '{$name}' not found or callable"); 62 | } 63 | 64 | /** 65 | * Check if filter type is valid 66 | * 67 | * @param string $type 68 | * 69 | * @throws \SmartyException 70 | */ 71 | public function _checkFilterType($type) 72 | { 73 | if (!isset($this->filterTypes[ $type ])) { 74 | throw new SmartyException("Illegal filter type '{$type}'"); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_setautoloadfilters.php: -------------------------------------------------------------------------------- 1 | true, 'post' => true, 'output' => true, 'variable' => true); 27 | 28 | /** 29 | * Set autoload filters 30 | * 31 | * @api Smarty::setAutoloadFilters() 32 | * 33 | * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj 34 | * @param array $filters filters to load automatically 35 | * @param string $type "pre", "output", … specify the 36 | * filter type to set. Defaults to 37 | * none treating $filters' keys as 38 | * the appropriate types 39 | * 40 | * @return \Smarty|\Smarty_Internal_Template 41 | * @throws \SmartyException 42 | */ 43 | public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null) 44 | { 45 | $smarty = $obj->_getSmartyObj(); 46 | if ($type !== null) { 47 | $this->_checkFilterType($type); 48 | $smarty->autoload_filters[ $type ] = (array) $filters; 49 | } else { 50 | foreach ((array) $filters as $type => $value) { 51 | $this->_checkFilterType($type); 52 | } 53 | $smarty->autoload_filters = (array) $filters; 54 | } 55 | return $obj; 56 | } 57 | 58 | /** 59 | * Check if filter type is valid 60 | * 61 | * @param string $type 62 | * 63 | * @throws \SmartyException 64 | */ 65 | public function _checkFilterType($type) 66 | { 67 | if (!isset($this->filterTypes[ $type ])) { 68 | throw new SmartyException("Illegal filter type '{$type}'"); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /Framework/Library/Interfaces/CacheInterface.php: -------------------------------------------------------------------------------- 1 | [ 12 | 13 | /** 14 | * 是否开启日志记录 15 | */ 16 | 'error_switch' => true, 17 | 18 | /** 19 | * 记录错误级别(E_ERROR|E_WARNING|E_PARSE) 20 | * 全部错误(E_ALL) 21 | * 致命错误(E_ERROR) 22 | * 运行警告(E_WARNING) 23 | * 语法错误(E_PARSE) 24 | * 其他通知(E_NOTICE) 25 | * 更多错误级别请参照(http://php.net/manual/zh/errorfunc.constants.php) 26 | */ 27 | 'error_level' => 'E_ALL' 28 | ], 29 | 30 | /** 31 | * 异常处理配置 32 | */ 33 | 'Exception' => [ 34 | 35 | /** 36 | * 是否开启异常显示 37 | */ 38 | 'display_switch' => true, 39 | 40 | /** 41 | * 显示错误的级别(E_ERROR|E_WARNING|E_PARSE) 42 | * 全部错误(E_ALL) 43 | * 致命错误(E_ERROR) 44 | * 运行警告(E_WARNING) 45 | * 语法错误(E_PARSE) 46 | * 其他通知(E_NOTICE) 47 | * 更多错误级别请参照(http://php.net/manual/zh/errorfunc.constants.php) 48 | */ 49 | 'display_level' => 'E_ALL' 50 | ], 51 | 52 | /** 53 | * 访问信息配置 54 | */ 55 | 'Visit' => [ 56 | 57 | /** 58 | * 默认加载实例的命名空间前缀(不建议修改) 59 | */ 60 | 'namespace' => 'App', 61 | 62 | /** 63 | * 默认实例名称 64 | */ 65 | 'Project' => 'Home', 66 | 67 | /** 68 | * 默认控制器名称 69 | */ 70 | 'Controller' => 'Index', 71 | 72 | /** 73 | * 默认方法名称 74 | */ 75 | 'Function' => 'index', 76 | 77 | /** 78 | * 静态扩展名 79 | */ 80 | 'extend' => '.html' 81 | ], 82 | 83 | /** 84 | * 参数请求 85 | */ 86 | 'Parameter' => [ 87 | 88 | /** 89 | * 默认实例key 90 | */ 91 | 'Project' => 'p', 92 | 93 | /** 94 | * 默认控制器key 95 | */ 96 | 'Controller' => 'c', 97 | 98 | /** 99 | * 默认方法key 100 | */ 101 | 'Function' => 'f', 102 | ], 103 | 104 | 'View' => [ 105 | 106 | /** 107 | * 模板左标记 108 | */ 109 | 'left_delimiter' => '_{', 110 | 111 | /** 112 | * 模板右标记 113 | */ 114 | 'right_delimiter' => '}_', 115 | 116 | /** 117 | * 是否启用缓存 118 | */ 119 | 'is_cache' => true, 120 | 121 | /** 122 | * 缓存周期 123 | */ 124 | 'cache_lifetime' => '0', 125 | ] 126 | 127 | ]; -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.mb_wordwrap.php: -------------------------------------------------------------------------------- 1 | $width) { 38 | if ($cut) { 39 | $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, 40 | $_token, 41 | -1, 42 | PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); 43 | } 44 | } 45 | 46 | foreach ($_tokens as $token) { 47 | $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token); 48 | $token_length = mb_strlen($token, Smarty::$_CHARSET); 49 | $length += $token_length; 50 | 51 | if ($length > $width) { 52 | // remove space before inserted break 53 | if ($_previous) { 54 | $t = mb_substr($t, 0, -1, Smarty::$_CHARSET); 55 | } 56 | 57 | if (!$_space) { 58 | // add the break before the token 59 | if (!empty($t)) { 60 | $t .= $break; 61 | } 62 | $length = $token_length; 63 | } 64 | } else if ($token === "\n") { 65 | // hard break must reset counters 66 | $length = 0; 67 | } 68 | $_previous = $_space; 69 | // add the token 70 | $t .= $token; 71 | } 72 | } 73 | 74 | return $t; 75 | } 76 | -------------------------------------------------------------------------------- /Framework/Library/Interfaces/DbInterface.php: -------------------------------------------------------------------------------- 1 | ConfigPath = Running::$framworkPath . 'Project/config'; 38 | if (!file_exists($this->ConfigPath)) { 39 | App::$app->get('Structure')->createDir($this->ConfigPath); 40 | } else { 41 | $fileList = App::$app->get('Structure')->getDir($this->ConfigPath); 42 | if (is_array($fileList)) { 43 | foreach ($fileList as $key => $value) { 44 | if (strpos(strtolower($value), '.cfg.php')) { 45 | $this->read(str_replace('.cfg.php', '', $value), $this->ConfigPath . '/' . $value); 46 | } 47 | } 48 | if(isset($this->Config['App'])){ 49 | self::$AppConfig = $this->Config['App']; 50 | } 51 | } 52 | } 53 | $this->loadFrameconf(); 54 | } 55 | 56 | /** 57 | * 读取配置文件 58 | * @param string $configName 59 | * @param string $filePath 60 | */ 61 | private function read($configName = '', $filePath = '') 62 | { 63 | if (is_file($filePath)) $this->Config[$configName] = include_once $filePath; 64 | } 65 | 66 | /** 67 | * 获取配置项 68 | * @param $keys 69 | * @return mixed 70 | */ 71 | public function get($keys = null) 72 | { 73 | if (is_null($keys)) return $this->Config; 74 | if (count($this->Config) > 0 && !empty($keys) && isset($this->Config[$keys])) { 75 | return $this->Config[$keys]; 76 | } 77 | return false; 78 | } 79 | 80 | /** 81 | * 设置临时配置项 82 | * @param $key 83 | * @param $val 84 | */ 85 | public function set($key, $val) 86 | { 87 | if (!empty($key) && isset($val)) { 88 | $this->Config[] = [$key => $val]; 89 | } 90 | } 91 | 92 | /** 93 | * 加载框架配置文件 94 | */ 95 | private function loadFrameconf() 96 | { 97 | $this->read('frame', App::$app->corePath . 'Config/frame.cfg.php'); 98 | } 99 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_resource_recompiled.php: -------------------------------------------------------------------------------- 1 | compiled; 43 | $compiled->file_dependency = array(); 44 | $compiled->includes = array(); 45 | $compiled->nocache_hash = null; 46 | $compiled->unifunc = null; 47 | $level = ob_get_level(); 48 | ob_start(); 49 | $_smarty_tpl->loadCompiler(); 50 | // call compiler 51 | try { 52 | eval('?>' . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl)); 53 | } 54 | catch (Exception $e) { 55 | unset($_smarty_tpl->compiler); 56 | while (ob_get_level() > $level) { 57 | ob_end_clean(); 58 | } 59 | throw $e; 60 | } 61 | // release compiler object to free memory 62 | unset($_smarty_tpl->compiler); 63 | ob_get_clean(); 64 | $compiled->timestamp = time(); 65 | $compiled->exists = true; 66 | } 67 | 68 | /** 69 | * populate Compiled Object with compiled filepath 70 | * 71 | * @param Smarty_Template_Compiled $compiled compiled object 72 | * @param Smarty_Internal_Template $_template template object 73 | * 74 | * @return void 75 | */ 76 | public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) 77 | { 78 | $compiled->filepath = false; 79 | $compiled->timestamp = false; 80 | $compiled->exists = false; 81 | } 82 | 83 | /* 84 | * Disable timestamp checks for recompiled resource. 85 | * 86 | * @return bool 87 | */ 88 | /** 89 | * @return bool 90 | */ 91 | public function checkTimestamps() 92 | { 93 | return false; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_private_function_plugin.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 52 | 53 | unset($_attr[ 'nocache' ]); 54 | // convert attributes into parameter array string 55 | $_paramsArray = array(); 56 | foreach ($_attr as $_key => $_value) { 57 | if (is_int($_key)) { 58 | $_paramsArray[] = "$_key=>$_value"; 59 | } else { 60 | $_paramsArray[] = "'$_key'=>$_value"; 61 | } 62 | } 63 | $_params = 'array(' . implode(',', $_paramsArray) . ')'; 64 | // compile code 65 | $output = "{$function}({$_params},\$_smarty_tpl)"; 66 | if (!empty($parameter[ 'modifierlist' ])) { 67 | $output = $compiler->compileTag('private_modifier', array(), 68 | array('modifierlist' => $parameter[ 'modifierlist' ], 69 | 'value' => $output)); 70 | } 71 | $output = "\n"; 72 | return $output; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_resource_stream.php: -------------------------------------------------------------------------------- 1 | resource, '://') !== false) { 34 | $source->filepath = $source->resource; 35 | } else { 36 | $source->filepath = str_replace(':', '://', $source->resource); 37 | } 38 | $source->uid = false; 39 | $source->content = $this->getContent($source); 40 | $source->timestamp = $source->exists = !!$source->content; 41 | } 42 | 43 | /** 44 | * Load template's source from stream into current template object 45 | * 46 | * @param Smarty_Template_Source $source source object 47 | * 48 | * @return string template source 49 | * @throws SmartyException if source cannot be loaded 50 | */ 51 | public function getContent(Smarty_Template_Source $source) 52 | { 53 | $t = ''; 54 | // the availability of the stream has already been checked in Smarty_Resource::fetch() 55 | $fp = fopen($source->filepath, 'r+'); 56 | if ($fp) { 57 | while (!feof($fp) && ($current_line = fgets($fp)) !== false) { 58 | $t .= $current_line; 59 | } 60 | fclose($fp); 61 | 62 | return $t; 63 | } else { 64 | return false; 65 | } 66 | } 67 | 68 | /** 69 | * modify resource_name according to resource handlers specifications 70 | * 71 | * @param Smarty $smarty Smarty instance 72 | * @param string $resource_name resource_name to make unique 73 | * @param boolean $isConfig flag for config resource 74 | * 75 | * @return string unique resource name 76 | */ 77 | public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false) 78 | { 79 | return get_class($this) . '#' . $resource_name; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Framework/Library/Process/Running.class.php: -------------------------------------------------------------------------------- 1 | 调试模式,false=>线上模式) 27 | * @var bool 28 | */ 29 | static public $Debug; 30 | 31 | /** 32 | * 路径信息 33 | * @var string 34 | */ 35 | static public $framworkPath; 36 | 37 | /** 38 | * 监视运行参数 39 | * @var array 40 | */ 41 | public $param = []; 42 | 43 | /** 44 | * 运行构造 45 | * Running constructor. 46 | */ 47 | public function __construct() 48 | { 49 | self::$framworkPath = str_replace('Framework/', '', \Framework\App::$app->corePath); 50 | } 51 | 52 | /** 53 | * 预定义常量信息 54 | */ 55 | static public function setconstant() 56 | { 57 | $define = [ 58 | 'RES' => Tool::getPublic(), 59 | '_P' => Visit::$param['Project'], 60 | '_C' => Visit::$param['Controller'], 61 | '_F' => Visit::$param['Function'], 62 | '_T' => time(), 63 | '_V' => '2.5.3' 64 | ]; 65 | foreach ($define as $key => $value) { 66 | define($key, $value); 67 | } 68 | } 69 | 70 | /** 71 | * 设定开发模式 72 | * @param bool $status 73 | */ 74 | public function isDev($status = true) 75 | { 76 | self::$Debug = $status; 77 | } 78 | 79 | /** 80 | * 开始记录信息 81 | */ 82 | public function startRecord() 83 | { 84 | $this->param['startTime'] = microtime(true); 85 | $this->param['startRam'] = (function_exists('memory_get_usage')) ? (memory_get_usage()) : (0); 86 | } 87 | 88 | /** 89 | * 停止记录信息 90 | */ 91 | public function endRecord() 92 | { 93 | $this->param['endTime'] = microtime(true); 94 | $this->param['endRam'] = (function_exists('memory_get_usage')) ? (memory_get_usage()) : (0); 95 | $this->param['consumeRam'] = $this->consumeRam(($this->param['endRam'] - $this->param['startRam'])); 96 | } 97 | 98 | /** 99 | * 计算消耗的内存 100 | */ 101 | private function consumeRam($size) 102 | { 103 | $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); 104 | return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i]; 105 | } 106 | 107 | /** 108 | * 程序汇总处理 109 | * @return array 110 | */ 111 | public function TotalInfo() 112 | { 113 | return $this->param; 114 | } 115 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerfilter.php: -------------------------------------------------------------------------------- 1 | true, 'post' => true, 'output' => true, 'variable' => true); 27 | 28 | /** 29 | * Registers a filter function 30 | * 31 | * @api Smarty::registerFilter() 32 | * 33 | * @link http://www.smarty.net/docs/en/api.register.filter.tpl 34 | * 35 | * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj 36 | * @param string $type filter type 37 | * @param callback $callback 38 | * @param string|null $name optional filter name 39 | * 40 | * @return \Smarty|\Smarty_Internal_Template 41 | * @throws \SmartyException 42 | */ 43 | public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null) 44 | { 45 | $smarty = $obj->_getSmartyObj(); 46 | $this->_checkFilterType($type); 47 | $name = isset($name) ? $name : $this->_getFilterName($callback); 48 | if (!is_callable($callback)) { 49 | throw new SmartyException("{$type}filter '{$name}' not callable"); 50 | } 51 | $smarty->registered_filters[ $type ][ $name ] = $callback; 52 | return $obj; 53 | } 54 | 55 | /** 56 | * Return internal filter name 57 | * 58 | * @param callback $function_name 59 | * 60 | * @return string internal filter name 61 | */ 62 | public function _getFilterName($function_name) 63 | { 64 | if (is_array($function_name)) { 65 | $_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]); 66 | 67 | return $_class_name . '_' . $function_name[ 1 ]; 68 | } elseif (is_string($function_name)) { 69 | return $function_name; 70 | } else { 71 | return 'closure'; 72 | } 73 | } 74 | 75 | /** 76 | * Check if filter type is valid 77 | * 78 | * @param string $type 79 | * 80 | * @throws \SmartyException 81 | */ 82 | public function _checkFilterType($type) 83 | { 84 | if (!isset($this->filterTypes[ $type ])) { 85 | throw new SmartyException("Illegal filter type '{$type}'"); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_runtime_cachemodify.php: -------------------------------------------------------------------------------- 1 | isCached() && !$_template->compiled->has_nocache_code; 26 | $_last_modified_date = 27 | @substr($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 0, strpos($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 'GMT') + 3); 28 | if ($_isCached && $cached->timestamp <= strtotime($_last_modified_date)) { 29 | switch (PHP_SAPI) { 30 | case 'cgi': // php-cgi < 5.3 31 | case 'cgi-fcgi': // php-cgi >= 5.3 32 | case 'fpm-fcgi': // php-fpm >= 5.3.3 33 | header('Status: 304 Not Modified'); 34 | break; 35 | 36 | case 'cli': 37 | if ( /* ^phpunit */ 38 | !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ 39 | ) { 40 | $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; 41 | } 42 | break; 43 | 44 | default: 45 | if ( /* ^phpunit */ 46 | !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ 47 | ) { 48 | $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; 49 | } else { 50 | header($_SERVER[ 'SERVER_PROTOCOL' ] . ' 304 Not Modified'); 51 | } 52 | break; 53 | } 54 | } else { 55 | switch (PHP_SAPI) { 56 | case 'cli': 57 | if ( /* ^phpunit */ 58 | !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ 59 | ) { 60 | $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = 61 | 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'; 62 | } 63 | break; 64 | default: 65 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'); 66 | break; 67 | } 68 | echo $content; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Extend/Package/smarty/plugins/modifier.date_format.php: -------------------------------------------------------------------------------- 1 | 21 | * 22 | * @param string $string input date string 23 | * @param string $format strftime format for output 24 | * @param string $default_date default date if $string is empty 25 | * @param string $formatter either 'strftime' or 'auto' 26 | * 27 | * @return string |void 28 | * @uses smarty_make_timestamp() 29 | */ 30 | function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto') 31 | { 32 | if ($format === null) { 33 | $format = Smarty::$_DATE_FORMAT; 34 | } 35 | /** 36 | * require_once the {@link shared.make_timestamp.php} plugin 37 | */ 38 | static $is_loaded = false; 39 | if (!$is_loaded) { 40 | if (!is_callable('smarty_make_timestamp')) { 41 | require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); 42 | } 43 | $is_loaded = true; 44 | } 45 | if ($string !== '' && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') { 46 | $timestamp = smarty_make_timestamp($string); 47 | } elseif ($default_date !== '') { 48 | $timestamp = smarty_make_timestamp($default_date); 49 | } else { 50 | return; 51 | } 52 | if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) { 53 | if (Smarty::$_IS_WINDOWS) { 54 | $_win_from = array('%D', 55 | '%h', 56 | '%n', 57 | '%r', 58 | '%R', 59 | '%t', 60 | '%T'); 61 | $_win_to = array('%m/%d/%y', 62 | '%b', 63 | "\n", 64 | '%I:%M:%S %p', 65 | '%H:%M', 66 | "\t", 67 | '%H:%M:%S'); 68 | if (strpos($format, '%e') !== false) { 69 | $_win_from[] = '%e'; 70 | $_win_to[] = sprintf('%\' 2d', date('j', $timestamp)); 71 | } 72 | if (strpos($format, '%l') !== false) { 73 | $_win_from[] = '%l'; 74 | $_win_to[] = sprintf('%\' 2d', date('h', $timestamp)); 75 | } 76 | $format = str_replace($_win_from, $_win_to, $format); 77 | } 78 | 79 | return strftime($format, $timestamp); 80 | } else { 81 | return date($format, $timestamp); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_append.php: -------------------------------------------------------------------------------- 1 | $_val) { 41 | if ($_key !== '') { 42 | $this->append($data, $_key, $_val, $merge, $nocache); 43 | } 44 | } 45 | } else { 46 | if ($tpl_var !== '' && isset($value)) { 47 | if (!isset($data->tpl_vars[ $tpl_var ])) { 48 | $tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false); 49 | if ($tpl_var_inst instanceof Smarty_Undefined_Variable) { 50 | $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); 51 | } else { 52 | $data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst; 53 | } 54 | } 55 | if (!(is_array($data->tpl_vars[ $tpl_var ]->value) || 56 | $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess) 57 | ) { 58 | settype($data->tpl_vars[ $tpl_var ]->value, 'array'); 59 | } 60 | if ($merge && is_array($value)) { 61 | foreach ($value as $_mkey => $_mval) { 62 | $data->tpl_vars[ $tpl_var ]->value[ $_mkey ] = $_mval; 63 | } 64 | } else { 65 | $data->tpl_vars[ $tpl_var ]->value[] = $value; 66 | } 67 | } 68 | if ($data->_isTplObj() && $data->scope) { 69 | $data->ext->_updateScope->_updateScope($data, $tpl_var); 70 | } 71 | } 72 | return $data; 73 | } 74 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_config_load.php: -------------------------------------------------------------------------------- 1 | Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, 57 | 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, 58 | 'smarty' => Smarty::SCOPE_SMARTY, 'global' => Smarty::SCOPE_SMARTY); 59 | 60 | /** 61 | * Compiles code for the {config_load} tag 62 | * 63 | * @param array $args array with attributes from parser 64 | * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object 65 | * 66 | * @return string compiled code 67 | * @throws \SmartyCompilerException 68 | */ 69 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) 70 | { 71 | // check and get attributes 72 | $_attr = $this->getAttributes($compiler, $args); 73 | 74 | if ($_attr[ 'nocache' ] === true) { 75 | $compiler->trigger_template_error('nocache option not allowed', null, true); 76 | } 77 | 78 | // save possible attributes 79 | $conf_file = $_attr[ 'file' ]; 80 | if (isset($_attr[ 'section' ])) { 81 | $section = $_attr[ 'section' ]; 82 | } else { 83 | $section = 'null'; 84 | } 85 | // scope setup 86 | if ($_attr[ 'noscope' ]) { 87 | $_scope = - 1; 88 | } else { 89 | $_scope = $compiler->convertScope($_attr, $this->valid_scopes); 90 | } 91 | 92 | // create config object 93 | $_output = 94 | "smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n"; 95 | 96 | return $_output; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_resource_eval.php: -------------------------------------------------------------------------------- 1 | uid = $source->filepath = sha1($source->name); 32 | $source->timestamp = $source->exists = true; 33 | } 34 | 35 | /** 36 | * Load template's source from $resource_name into current template object 37 | * 38 | * @uses decode() to decode base64 and urlencoded template_resources 39 | * 40 | * @param Smarty_Template_Source $source source object 41 | * 42 | * @return string template source 43 | */ 44 | public function getContent(Smarty_Template_Source $source) 45 | { 46 | return $this->decode($source->name); 47 | } 48 | 49 | /** 50 | * decode base64 and urlencode 51 | * 52 | * @param string $string template_resource to decode 53 | * 54 | * @return string decoded template_resource 55 | */ 56 | protected function decode($string) 57 | { 58 | // decode if specified 59 | if (($pos = strpos($string, ':')) !== false) { 60 | if (!strncmp($string, 'base64', 6)) { 61 | return base64_decode(substr($string, 7)); 62 | } elseif (!strncmp($string, 'urlencode', 9)) { 63 | return urldecode(substr($string, 10)); 64 | } 65 | } 66 | 67 | return $string; 68 | } 69 | 70 | /** 71 | * modify resource_name according to resource handlers specifications 72 | * 73 | * @param Smarty $smarty Smarty instance 74 | * @param string $resource_name resource_name to make unique 75 | * @param boolean $isConfig flag for config resource 76 | * 77 | * @return string unique resource name 78 | */ 79 | public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false) 80 | { 81 | return get_class($this) . '#' . $this->decode($resource_name); 82 | } 83 | 84 | /** 85 | * Determine basename for compiled filename 86 | * 87 | * @param Smarty_Template_Source $source source object 88 | * 89 | * @return string resource's basename 90 | */ 91 | public function getBasename(Smarty_Template_Source $source) 92 | { 93 | return ''; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_call.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 55 | // save possible attributes 56 | if (isset($_attr[ 'assign' ])) { 57 | // output will be stored in a smarty variable instead of being displayed 58 | $_assign = $_attr[ 'assign' ]; 59 | } 60 | //$_name = trim($_attr['name'], "''"); 61 | $_name = $_attr[ 'name' ]; 62 | unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'nocache' ]); 63 | // set flag (compiled code of {function} must be included in cache file 64 | if (!$compiler->template->caching || $compiler->nocache || $compiler->tag_nocache) { 65 | $_nocache = 'true'; 66 | } else { 67 | $_nocache = 'false'; 68 | } 69 | $_paramsArray = array(); 70 | foreach ($_attr as $_key => $_value) { 71 | if (is_int($_key)) { 72 | $_paramsArray[] = "$_key=>$_value"; 73 | } else { 74 | $_paramsArray[] = "'$_key'=>$_value"; 75 | } 76 | } 77 | $_params = 'array(' . implode(',', $_paramsArray) . ')'; 78 | //$compiler->suppressNocacheProcessing = true; 79 | // was there an assign attribute 80 | if (isset($_assign)) { 81 | $_output = 82 | "smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; 83 | } else { 84 | $_output = 85 | "smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n"; 86 | } 87 | return $_output; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_runtime_filterhandler.php: -------------------------------------------------------------------------------- 1 | smarty->autoload_filters[ $type ])) { 37 | foreach ((array) $template->smarty->autoload_filters[ $type ] as $name) { 38 | $plugin_name = "Smarty_{$type}filter_{$name}"; 39 | if (function_exists($plugin_name)) { 40 | $callback = $plugin_name; 41 | } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) { 42 | $callback = array($plugin_name, 'execute'); 43 | } elseif ($template->smarty->loadPlugin($plugin_name, false)) { 44 | if (function_exists($plugin_name)) { 45 | // use loaded Smarty2 style plugin 46 | $callback = $plugin_name; 47 | } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) { 48 | // loaded class of filter plugin 49 | $callback = array($plugin_name, 'execute'); 50 | } else { 51 | throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable"); 52 | } 53 | } else { 54 | // nothing found, throw exception 55 | throw new SmartyException("Unable to auto load {$type}-filter plugin '{$plugin_name}'"); 56 | } 57 | $content = call_user_func($callback, $content, $template); 58 | } 59 | } 60 | // loop over registered filters of specified type 61 | if (!empty($template->smarty->registered_filters[ $type ])) { 62 | foreach ($template->smarty->registered_filters[ $type ] as $key => $name) { 63 | $content = call_user_func($template->smarty->registered_filters[ $type ][ $key ], $content, $template); 64 | } 65 | } 66 | // return filtered output 67 | return $content; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_compile_private_registered_block.php: -------------------------------------------------------------------------------- 1 | smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) { 32 | $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ]; 33 | $callback = $tag_info[ 0 ]; 34 | if (is_array($callback)) { 35 | if (is_object($callback[ 0 ])) { 36 | $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')"; 37 | $callback = 38 | array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}"); 39 | } else { 40 | $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')"; 41 | $callback = 42 | array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}"); 43 | } 44 | } else { 45 | $callable = "\$_block_plugin{$this->nesting}"; 46 | $callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", ''); 47 | } 48 | } else { 49 | $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ]; 50 | $callback = $tag_info[ 0 ]; 51 | if (is_array($callback)) { 52 | $callable = "array('{$callback[0]}', '{$callback[1]}')"; 53 | $callback = "{$callback[1]}::{$callback[1]}"; 54 | } else { 55 | $callable = null; 56 | } 57 | } 58 | $compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache; 59 | $_paramsArray = array(); 60 | foreach ($_attr as $_key => $_value) { 61 | if (is_int($_key)) { 62 | $_paramsArray[] = "$_key=>$_value"; 63 | } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { 64 | $_value = str_replace('\'', "^#^", $_value); 65 | $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; 66 | } else { 67 | $_paramsArray[] = "'$_key'=>$_value"; 68 | } 69 | } 70 | return array($callback, $_paramsArray, $callable); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 35 | if (is_callable($callback)) { 36 | $smarty->default_template_handler_func = $callback; 37 | } else { 38 | throw new SmartyException('Default template handler not callable'); 39 | } 40 | return $obj; 41 | } 42 | 43 | /** 44 | * get default content from template or config resource handler 45 | * 46 | * @param Smarty_Template_Source $source 47 | * 48 | * @throws \SmartyException 49 | */ 50 | public static function _getDefaultTemplate(Smarty_Template_Source $source) 51 | { 52 | if ($source->isConfig) { 53 | $default_handler = $source->smarty->default_config_handler_func; 54 | } else { 55 | $default_handler = $source->smarty->default_template_handler_func; 56 | } 57 | $_content = $_timestamp = null; 58 | $_return = call_user_func_array($default_handler, 59 | array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty)); 60 | if (is_string($_return)) { 61 | $source->exists = is_file($_return); 62 | if ($source->exists) { 63 | $source->timestamp = filemtime($_return); 64 | } else { 65 | throw new SmartyException('Default handler: Unable to load ' . 66 | ($source->isConfig ? 'config' : 'template') . 67 | " default file '{$_return}' for '{$source->type}:{$source->name}'"); 68 | } 69 | $source->name = $source->filepath = $_return; 70 | $source->uid = sha1($source->filepath); 71 | } elseif ($_return === true) { 72 | $source->content = $_content; 73 | $source->exists = true; 74 | $source->uid = $source->name = sha1($_content); 75 | $source->handler = Smarty_Resource::load($source->smarty, 'eval'); 76 | } else { 77 | $source->exists = false; 78 | throw new SmartyException('Default handler: No ' . ($source->isConfig ? 'config' : 'template') . 79 | " default content for '{$source->type}:{$source->name}'"); 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_resource_custom.php: -------------------------------------------------------------------------------- 1 | filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25); 51 | $source->uid = sha1($source->type . ':' . $source->name); 52 | 53 | $mtime = $this->fetchTimestamp($source->name); 54 | if ($mtime !== null) { 55 | $source->timestamp = $mtime; 56 | } else { 57 | $this->fetch($source->name, $content, $timestamp); 58 | $source->timestamp = isset($timestamp) ? $timestamp : false; 59 | if (isset($content)) { 60 | $source->content = $content; 61 | } 62 | } 63 | $source->exists = !!$source->timestamp; 64 | } 65 | 66 | /** 67 | * Load template's source into current template object 68 | * 69 | * @param Smarty_Template_Source $source source object 70 | * 71 | * @return string template source 72 | * @throws SmartyException if source cannot be loaded 73 | */ 74 | public function getContent(Smarty_Template_Source $source) 75 | { 76 | $this->fetch($source->name, $content, $timestamp); 77 | if (isset($content)) { 78 | return $content; 79 | } 80 | 81 | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 82 | } 83 | 84 | /** 85 | * Determine basename for compiled filename 86 | * 87 | * @param Smarty_Template_Source $source source object 88 | * 89 | * @return string resource's basename 90 | */ 91 | public function getBasename(Smarty_Template_Source $source) 92 | { 93 | return basename(substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Extend/Package/smarty/sysplugins/smarty_internal_method_literals.php: -------------------------------------------------------------------------------- 1 | _getSmartyObj(); 33 | return (array)$smarty->literals; 34 | } 35 | 36 | /** 37 | * Add literals 38 | * 39 | * @api Smarty::addLiterals() 40 | * 41 | * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj 42 | * @param array|string $literals literal or list of literals 43 | * to add 44 | * 45 | * @return \Smarty|\Smarty_Internal_Template 46 | * @throws \SmartyException 47 | */ 48 | public function addLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) 49 | { 50 | if (isset($literals)) { 51 | $this->set($obj->_getSmartyObj(), (array)$literals); 52 | } 53 | return $obj; 54 | } 55 | 56 | /** 57 | * Set literals 58 | * 59 | * @api Smarty::setLiterals() 60 | * 61 | * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj 62 | * @param array|string $literals literal or list of literals 63 | * to set 64 | * 65 | * @return \Smarty|\Smarty_Internal_Template 66 | * @throws \SmartyException 67 | */ 68 | public function setLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) 69 | { 70 | $smarty = $obj->_getSmartyObj(); 71 | $smarty->literals = array(); 72 | if (!empty($literals)) { 73 | $this->set($smarty, (array)$literals); 74 | } 75 | return $obj; 76 | } 77 | 78 | /** 79 | * common setter for literals for easier handling of duplicates the 80 | * Smarty::$literals array gets filled with identical key values 81 | * 82 | * @param \Smarty $smarty 83 | * @param array $literals 84 | * 85 | * @throws \SmartyException 86 | */ 87 | private function set(Smarty $smarty, $literals) 88 | { 89 | $literals = array_combine($literals, $literals); 90 | $error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array(); 91 | $error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error; 92 | if (!empty($error)) { 93 | throw new SmartyException('User defined literal(s) "' . $error . 94 | '" may not be identical with left or right delimiter'); 95 | } 96 | $smarty->literals = array_merge((array)$smarty->literals, (array)$literals); 97 | } 98 | } --------------------------------------------------------------------------------