├── .gitignore ├── .htaccess ├── Application ├── README.md └── index.html ├── Public └── README.md ├── README.md ├── ThinkPHP ├── Common │ └── functions.php ├── Conf │ ├── convention.php │ └── debug.php ├── LICENSE.txt ├── Lang │ ├── en-us.php │ ├── pt-br.php │ ├── zh-cn.php │ └── zh-tw.php ├── Library │ ├── Behavior │ │ ├── AgentCheckBehavior.class.php │ │ ├── BorisBehavior.class.php │ │ ├── BrowserCheckBehavior.class.php │ │ ├── BuildLiteBehavior.class.php │ │ ├── CheckActionRouteBehavior.class.php │ │ ├── CheckLangBehavior.class.php │ │ ├── ChromeShowPageTraceBehavior.class.php │ │ ├── ContentReplaceBehavior.class.php │ │ ├── CronRunBehavior.class.php │ │ ├── FireShowPageTraceBehavior.class.php │ │ ├── ParseTemplateBehavior.class.php │ │ ├── ReadHtmlCacheBehavior.class.php │ │ ├── RobotCheckBehavior.class.php │ │ ├── ShowPageTraceBehavior.class.php │ │ ├── ShowRuntimeBehavior.class.php │ │ ├── TokenBuildBehavior.class.php │ │ ├── UpgradeNoticeBehavior.class.php │ │ └── WriteHtmlCacheBehavior.class.php │ ├── Org │ │ ├── Net │ │ │ ├── Http.class.php │ │ │ └── IpLocation.class.php │ │ └── Util │ │ │ ├── ArrayList.class.php │ │ │ ├── CodeSwitch.class.php │ │ │ ├── Date.class.php │ │ │ ├── Rbac.class.php │ │ │ ├── Stack.class.php │ │ │ └── String.class.php │ ├── Think │ │ ├── App.class.php │ │ ├── Auth.class.php │ │ ├── Behavior.class.php │ │ ├── Build.class.php │ │ ├── Cache.class.php │ │ ├── Cache │ │ │ └── Driver │ │ │ │ ├── Apachenote.class.php │ │ │ │ ├── Apc.class.php │ │ │ │ ├── Db.class.php │ │ │ │ ├── Eaccelerator.class.php │ │ │ │ ├── File.class.php │ │ │ │ ├── Memcache.class.php │ │ │ │ ├── Memcached.class.php │ │ │ │ ├── Memcachesae.class.php │ │ │ │ ├── Redis.class.php │ │ │ │ ├── Shmop.class.php │ │ │ │ ├── Sqlite.class.php │ │ │ │ ├── Wincache.class.php │ │ │ │ └── Xcache.class.php │ │ ├── Controller.class.php │ │ ├── Controller │ │ │ ├── HproseController.class.php │ │ │ ├── JsonRpcController.class.php │ │ │ ├── RestController.class.php │ │ │ ├── RpcController.class.php │ │ │ └── YarController.class.php │ │ ├── Crypt.class.php │ │ ├── Crypt │ │ │ └── Driver │ │ │ │ ├── Base64.class.php │ │ │ │ ├── Crypt.class.php │ │ │ │ ├── Des.class.php │ │ │ │ ├── Think.class.php │ │ │ │ └── Xxtea.class.php │ │ ├── Db.class.php │ │ ├── Db │ │ │ ├── Driver.class.php │ │ │ ├── Driver │ │ │ │ ├── Firebird.class.php │ │ │ │ ├── Mongo.class.php │ │ │ │ ├── Mysql.class.php │ │ │ │ ├── Oracle.class.php │ │ │ │ ├── Pgsql.class.php │ │ │ │ ├── Sqlite.class.php │ │ │ │ └── Sqlsrv.class.php │ │ │ └── Lite.class.php │ │ ├── Dispatcher.class.php │ │ ├── Exception.class.php │ │ ├── Hook.class.php │ │ ├── Image.class.php │ │ ├── Image │ │ │ └── Driver │ │ │ │ ├── GIF.class.php │ │ │ │ ├── Gd.class.php │ │ │ │ └── Imagick.class.php │ │ ├── Log.class.php │ │ ├── Log │ │ │ └── Driver │ │ │ │ ├── File.class.php │ │ │ │ └── Sae.class.php │ │ ├── Model.class.php │ │ ├── Model │ │ │ ├── AdvModel.class.php │ │ │ ├── MergeModel.class.php │ │ │ ├── MongoModel.class.php │ │ │ ├── RelationModel.class.php │ │ │ └── ViewModel.class.php │ │ ├── Page.class.php │ │ ├── Route.class.php │ │ ├── Session │ │ │ └── Driver │ │ │ │ ├── Db.class.php │ │ │ │ ├── Memcache.class.php │ │ │ │ └── Mysqli.class.php │ │ ├── Storage.class.php │ │ ├── Storage │ │ │ └── Driver │ │ │ │ ├── File.class.php │ │ │ │ └── Sae.class.php │ │ ├── Template.class.php │ │ ├── Template │ │ │ ├── Driver │ │ │ │ ├── Ease.class.php │ │ │ │ ├── Lite.class.php │ │ │ │ ├── Mobile.class.php │ │ │ │ ├── Smart.class.php │ │ │ │ └── Smarty.class.php │ │ │ ├── TagLib.class.php │ │ │ └── TagLib │ │ │ │ ├── Cx.class.php │ │ │ │ └── Html.class.php │ │ ├── Think.class.php │ │ ├── Upload.class.php │ │ ├── Upload │ │ │ └── Driver │ │ │ │ ├── Bcs.class.php │ │ │ │ ├── Bcs │ │ │ │ ├── bcs.class.php │ │ │ │ ├── mimetypes.class.php │ │ │ │ └── requestcore.class.php │ │ │ │ ├── Ftp.class.php │ │ │ │ ├── Local.class.php │ │ │ │ ├── Qiniu.class.php │ │ │ │ ├── Qiniu │ │ │ │ └── QiniuStorage.class.php │ │ │ │ ├── Sae.class.php │ │ │ │ └── Upyun.class.php │ │ ├── Verify.class.php │ │ ├── Verify │ │ │ ├── bgs │ │ │ │ ├── 1.jpg │ │ │ │ ├── 2.jpg │ │ │ │ ├── 3.jpg │ │ │ │ ├── 4.jpg │ │ │ │ ├── 5.jpg │ │ │ │ ├── 6.jpg │ │ │ │ ├── 7.jpg │ │ │ │ └── 8.jpg │ │ │ ├── ttfs │ │ │ │ ├── 1.ttf │ │ │ │ ├── 2.ttf │ │ │ │ ├── 3.ttf │ │ │ │ ├── 4.ttf │ │ │ │ ├── 5.ttf │ │ │ │ └── 6.ttf │ │ │ └── zhttfs │ │ │ │ └── 1.ttf │ │ └── View.class.php │ └── Vendor │ │ ├── Boris │ │ ├── Boris.php │ │ ├── CLIOptionsHandler.php │ │ ├── ColoredInspector.php │ │ ├── Config.php │ │ ├── DumpInspector.php │ │ ├── EvalWorker.php │ │ ├── ExportInspector.php │ │ ├── Inspector.php │ │ ├── ReadlineClient.php │ │ └── ShallowParser.php │ │ ├── EaseTemplate │ │ ├── template.core.php │ │ └── template.ease.php │ │ ├── Hprose │ │ ├── HproseClassManager.php │ │ ├── HproseClient.php │ │ ├── HproseCommon.php │ │ ├── HproseFormatter.php │ │ ├── HproseHttpClient.php │ │ ├── HproseHttpServer.php │ │ ├── HproseIO.php │ │ ├── HproseIOStream.php │ │ ├── HproseReader.php │ │ ├── HproseTags.php │ │ └── HproseWriter.php │ │ ├── README.txt │ │ ├── SmartTemplate │ │ ├── class.smarttemplate.php │ │ ├── class.smarttemplatedebugger.php │ │ └── class.smarttemplateparser.php │ │ ├── Smarty │ │ ├── Smarty.class.php │ │ ├── SmartyBC.class.php │ │ ├── debug.tpl │ │ ├── plugins │ │ │ ├── block.textformat.php │ │ │ ├── function.counter.php │ │ │ ├── function.cycle.php │ │ │ ├── function.fetch.php │ │ │ ├── function.html_checkboxes.php │ │ │ ├── function.html_image.php │ │ │ ├── function.html_options.php │ │ │ ├── function.html_radios.php │ │ │ ├── function.html_select_date.php │ │ │ ├── function.html_select_time.php │ │ │ ├── function.html_table.php │ │ │ ├── function.mailto.php │ │ │ ├── function.math.php │ │ │ ├── modifier.capitalize.php │ │ │ ├── modifier.date_format.php │ │ │ ├── modifier.debug_print_var.php │ │ │ ├── modifier.escape.php │ │ │ ├── modifier.regex_replace.php │ │ │ ├── modifier.replace.php │ │ │ ├── modifier.spacify.php │ │ │ ├── modifier.truncate.php │ │ │ ├── modifiercompiler.cat.php │ │ │ ├── modifiercompiler.count_characters.php │ │ │ ├── modifiercompiler.count_paragraphs.php │ │ │ ├── modifiercompiler.count_sentences.php │ │ │ ├── modifiercompiler.count_words.php │ │ │ ├── modifiercompiler.default.php │ │ │ ├── modifiercompiler.escape.php │ │ │ ├── modifiercompiler.from_charset.php │ │ │ ├── modifiercompiler.indent.php │ │ │ ├── modifiercompiler.lower.php │ │ │ ├── modifiercompiler.noprint.php │ │ │ ├── modifiercompiler.string_format.php │ │ │ ├── modifiercompiler.strip.php │ │ │ ├── modifiercompiler.strip_tags.php │ │ │ ├── modifiercompiler.to_charset.php │ │ │ ├── modifiercompiler.unescape.php │ │ │ ├── modifiercompiler.upper.php │ │ │ ├── modifiercompiler.wordwrap.php │ │ │ ├── outputfilter.trimwhitespace.php │ │ │ ├── shared.escape_special_chars.php │ │ │ ├── shared.literal_compiler_param.php │ │ │ ├── shared.make_timestamp.php │ │ │ ├── shared.mb_str_replace.php │ │ │ ├── shared.mb_unicode.php │ │ │ ├── shared.mb_wordwrap.php │ │ │ └── variablefilter.htmlspecialchars.php │ │ └── sysplugins │ │ │ ├── smarty_cacheresource.php │ │ │ ├── smarty_cacheresource_custom.php │ │ │ ├── smarty_cacheresource_keyvaluestore.php │ │ │ ├── smarty_config_source.php │ │ │ ├── smarty_internal_cacheresource_file.php │ │ │ ├── smarty_internal_compile_append.php │ │ │ ├── smarty_internal_compile_assign.php │ │ │ ├── smarty_internal_compile_block.php │ │ │ ├── smarty_internal_compile_break.php │ │ │ ├── smarty_internal_compile_call.php │ │ │ ├── smarty_internal_compile_capture.php │ │ │ ├── smarty_internal_compile_config_load.php │ │ │ ├── smarty_internal_compile_continue.php │ │ │ ├── smarty_internal_compile_debug.php │ │ │ ├── smarty_internal_compile_eval.php │ │ │ ├── smarty_internal_compile_extends.php │ │ │ ├── smarty_internal_compile_for.php │ │ │ ├── smarty_internal_compile_foreach.php │ │ │ ├── smarty_internal_compile_function.php │ │ │ ├── smarty_internal_compile_if.php │ │ │ ├── smarty_internal_compile_include.php │ │ │ ├── smarty_internal_compile_include_php.php │ │ │ ├── smarty_internal_compile_insert.php │ │ │ ├── smarty_internal_compile_ldelim.php │ │ │ ├── smarty_internal_compile_nocache.php │ │ │ ├── smarty_internal_compile_private_block_plugin.php │ │ │ ├── smarty_internal_compile_private_function_plugin.php │ │ │ ├── smarty_internal_compile_private_modifier.php │ │ │ ├── smarty_internal_compile_private_object_block_function.php │ │ │ ├── smarty_internal_compile_private_object_function.php │ │ │ ├── smarty_internal_compile_private_print_expression.php │ │ │ ├── smarty_internal_compile_private_registered_block.php │ │ │ ├── smarty_internal_compile_private_registered_function.php │ │ │ ├── smarty_internal_compile_private_special_variable.php │ │ │ ├── smarty_internal_compile_rdelim.php │ │ │ ├── smarty_internal_compile_section.php │ │ │ ├── smarty_internal_compile_setfilter.php │ │ │ ├── smarty_internal_compile_while.php │ │ │ ├── smarty_internal_compilebase.php │ │ │ ├── smarty_internal_config.php │ │ │ ├── smarty_internal_config_file_compiler.php │ │ │ ├── smarty_internal_configfilelexer.php │ │ │ ├── smarty_internal_configfileparser.php │ │ │ ├── smarty_internal_data.php │ │ │ ├── smarty_internal_debug.php │ │ │ ├── smarty_internal_filter_handler.php │ │ │ ├── smarty_internal_function_call_handler.php │ │ │ ├── smarty_internal_get_include_path.php │ │ │ ├── smarty_internal_nocache_insert.php │ │ │ ├── smarty_internal_parsetree.php │ │ │ ├── smarty_internal_resource_eval.php │ │ │ ├── smarty_internal_resource_extends.php │ │ │ ├── smarty_internal_resource_file.php │ │ │ ├── smarty_internal_resource_php.php │ │ │ ├── smarty_internal_resource_registered.php │ │ │ ├── smarty_internal_resource_stream.php │ │ │ ├── smarty_internal_resource_string.php │ │ │ ├── smarty_internal_smartytemplatecompiler.php │ │ │ ├── smarty_internal_template.php │ │ │ ├── smarty_internal_templatebase.php │ │ │ ├── smarty_internal_templatecompilerbase.php │ │ │ ├── smarty_internal_templatelexer.php │ │ │ ├── smarty_internal_templateparser.php │ │ │ ├── smarty_internal_utility.php │ │ │ ├── smarty_internal_write_file.php │ │ │ ├── smarty_resource.php │ │ │ ├── smarty_resource_custom.php │ │ │ ├── smarty_resource_recompiled.php │ │ │ ├── smarty_resource_uncompiled.php │ │ │ └── smarty_security.php │ │ ├── TemplateLite │ │ ├── class.compiler.php │ │ ├── class.config.php │ │ ├── class.template.php │ │ └── internal │ │ │ ├── compile.compile_config.php │ │ │ ├── compile.compile_custom_block.php │ │ │ ├── compile.compile_custom_function.php │ │ │ ├── compile.compile_if.php │ │ │ ├── compile.generate_compiler_debug_output.php │ │ │ ├── compile.include.php │ │ │ ├── compile.parse_is_expr.php │ │ │ ├── compile.section_start.php │ │ │ ├── debug.tpl │ │ │ ├── template.build_dir.php │ │ │ ├── template.config_loader.php │ │ │ ├── template.destroy_dir.php │ │ │ ├── template.fetch_compile_include.php │ │ │ └── template.generate_debug_output.php │ │ ├── jsonRPC │ │ ├── jsonRPCClient.php │ │ └── jsonRPCServer.php │ │ ├── phpRPC │ │ ├── bigint.php │ │ ├── compat.php │ │ ├── dhparams.php │ │ ├── dhparams │ │ │ ├── 1024.dhp │ │ │ ├── 128.dhp │ │ │ ├── 1536.dhp │ │ │ ├── 160.dhp │ │ │ ├── 192.dhp │ │ │ ├── 2048.dhp │ │ │ ├── 256.dhp │ │ │ ├── 3072.dhp │ │ │ ├── 4096.dhp │ │ │ ├── 512.dhp │ │ │ ├── 768.dhp │ │ │ └── 96.dhp │ │ ├── pecl │ │ │ └── xxtea │ │ │ │ ├── CREDITS │ │ │ │ ├── INSTALL │ │ │ │ ├── LICENSE │ │ │ │ ├── README │ │ │ │ ├── config.m4 │ │ │ │ ├── config.w32 │ │ │ │ ├── php_xxtea.c │ │ │ │ ├── php_xxtea.dsp │ │ │ │ ├── php_xxtea.h │ │ │ │ ├── php_xxtea.sln │ │ │ │ ├── php_xxtea.vcproj │ │ │ │ ├── test │ │ │ │ └── test.php │ │ │ │ ├── xxtea.c │ │ │ │ └── xxtea.h │ │ ├── phprpc_client.php │ │ ├── phprpc_date.php │ │ ├── phprpc_server.php │ │ └── xxtea.php │ │ └── spyc │ │ ├── COPYING │ │ ├── README.md │ │ ├── Spyc.php │ │ ├── composer.json │ │ ├── examples │ │ ├── yaml-dump.php │ │ └── yaml-load.php │ │ ├── php4 │ │ ├── 5to4.php │ │ ├── spyc.php4 │ │ └── test.php4 │ │ ├── spyc.yaml │ │ └── tests │ │ ├── DumpTest.php │ │ ├── IndentTest.php │ │ ├── ParseTest.php │ │ ├── RoundTripTest.php │ │ ├── comments.yaml │ │ ├── failing1.yaml │ │ ├── indent_1.yaml │ │ └── quotes.yaml ├── Mode │ ├── Api │ │ ├── App.class.php │ │ ├── Controller.class.php │ │ ├── Dispatcher.class.php │ │ └── functions.php │ ├── Lite │ │ ├── App.class.php │ │ ├── Controller.class.php │ │ ├── Dispatcher.class.php │ │ ├── Model.class.php │ │ ├── View.class.php │ │ ├── convention.php │ │ └── functions.php │ ├── Sae │ │ └── convention.php │ ├── api.php │ ├── common.php │ ├── lite.php │ └── sae.php ├── ThinkPHP.php ├── Tpl │ ├── dispatch_jump.tpl │ ├── page_trace.tpl │ └── think_exception.tpl └── logo.png ├── composer.json └── index.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Application/README.md: -------------------------------------------------------------------------------- 1 | 项目目录 -------------------------------------------------------------------------------- /Application/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Public/README.md: -------------------------------------------------------------------------------- 1 | 资源文件目录 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **3.2版本已经过了维护生命周期,官方已经不再维护,请及时更新至5.0或者5.1版本** 2 | 3 | ## 简介 4 | 5 | ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。 6 | 7 | ## 全面的WEB开发特性支持 8 | 9 | 最新的ThinkPHP为WEB应用开发提供了强有力的支持,这些支持包括: 10 | 11 | * MVC支持-基于多层模型(M)、视图(V)、控制器(C)的设计模式 12 | * ORM支持-提供了全功能和高性能的ORM支持,支持大部分数据库 13 | * 模板引擎支持-内置了高性能的基于标签库和XML标签的编译型模板引擎 14 | * RESTFul支持-通过REST控制器扩展提供了RESTFul支持,为你打造全新的URL设计和访问体验 15 | * 云平台支持-提供了对新浪SAE平台和百度BAE平台的强力支持,具备“横跨性”和“平滑性”,支持本地化开发和调试以及部署切换,让你轻松过渡,打造全新的开发体验。 16 | * CLI支持-支持基于命令行的应用开发 17 | * RPC支持-提供包括PHPRpc、HProse、jsonRPC和Yar在内远程调用解决方案 18 | * MongoDb支持-提供NoSQL的支持 19 | * 缓存支持-提供了包括文件、数据库、Memcache、Xcache、Redis等多种类型的缓存支持 20 | 21 | ## 大道至简的开发理念 22 | 23 | ThinkPHP从诞生以来一直秉承大道至简的开发理念,无论从底层实现还是应用开发,我们都倡导用最少的代码完成相同的功能,正是由于对简单的执着和代码的修炼,让我们长期保持出色的性能和极速的开发体验。在主流PHP开发框架的评测数据中表现卓越,简单和快速开发是我们不变的宗旨。 24 | 25 | ## 安全性 26 | 27 | 框架在系统层面提供了众多的安全特性,确保你的网站和产品安全无忧。这些特性包括: 28 | 29 | * XSS安全防护 30 | * 表单自动验证 31 | * 强制数据类型转换 32 | * 输入数据过滤 33 | * 表单令牌验证 34 | * 防SQL注入 35 | * 图像上传检测 36 | 37 | ## 商业友好的开源协议 38 | 39 | ThinkPHP遵循Apache2开源协议发布。Apache Licence是著名的非盈利开源组织Apache采用的协议,该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再作为开源或商业软件发布。 40 | -------------------------------------------------------------------------------- /ThinkPHP/Conf/debug.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 默认的调试模式配置文件 14 | */ 15 | 16 | // 调试模式下面默认设置 可以在应用配置目录下重新定义 debug.php 覆盖 17 | return array( 18 | 'LOG_RECORD' => true, // 进行日志记录 19 | 'LOG_EXCEPTION_RECORD' => true, // 是否记录异常信息日志 20 | 'LOG_LEVEL' => 'EMERG,ALERT,CRIT,ERR,WARN,NOTIC,INFO,DEBUG,SQL', // 允许记录的日志级别 21 | 'DB_FIELDS_CACHE' => false, // 字段缓存信息 22 | 'DB_DEBUG' => true, // 开启调试模式 记录SQL日志 23 | 'TMPL_CACHE_ON' => false, // 是否开启模板编译缓存,设为false则每次都会重新编译 24 | 'TMPL_STRIP_SPACE' => false, // 是否去除模板文件里面的html空格与换行 25 | 'SHOW_ERROR_MSG' => true, // 显示错误信息 26 | 'URL_CASE_INSENSITIVE' => false, // URL区分大小写 27 | ); 28 | -------------------------------------------------------------------------------- /ThinkPHP/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 3 | 版权所有Copyright © 2006-2014 by ThinkPHP (http://thinkphp.cn) 4 | All rights reserved。 5 | ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 6 | 7 | Apache Licence是著名的非盈利开源组织Apache采用的协议。 8 | 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, 9 | 允许代码修改,再作为开源或商业软件发布。需要满足 10 | 的条件: 11 | 1. 需要给代码的用户一份Apache Licence ; 12 | 2. 如果你修改了代码,需要在被修改的文件中说明; 13 | 3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 14 | 带有原来代码中的协议,商标,专利声明和其他原来作者规 15 | 定需要包含的说明; 16 | 4. 如果再发布的产品中包含一个Notice文件,则在Notice文 17 | 件中需要带有本协议内容。你可以在Notice中增加自己的 18 | 许可,但不可以表现为对Apache Licence构成更改。 19 | 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /ThinkPHP/Lang/zh-cn.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 简体中文语言包 14 | */ 15 | return array( 16 | /* 核心语言变量 */ 17 | '_MODULE_NOT_EXIST_' => '无法加载模块', 18 | '_CONTROLLER_NOT_EXIST_' => '无法加载控制器', 19 | '_ERROR_ACTION_' => '非法操作', 20 | '_LANGUAGE_NOT_LOAD_' => '无法加载语言包', 21 | '_TEMPLATE_NOT_EXIST_' => '模板不存在', 22 | '_MODULE_' => '模块', 23 | '_ACTION_' => '操作', 24 | '_MODEL_NOT_EXIST_' => '模型不存在或者没有定义', 25 | '_VALID_ACCESS_' => '没有权限', 26 | '_XML_TAG_ERROR_' => 'XML标签语法错误', 27 | '_DATA_TYPE_INVALID_' => '非法数据对象!', 28 | '_OPERATION_WRONG_' => '操作出现错误', 29 | '_NOT_LOAD_DB_' => '无法加载数据库', 30 | '_NO_DB_DRIVER_' => '无法加载数据库驱动', 31 | '_NOT_SUPPORT_DB_' => '系统暂时不支持数据库', 32 | '_NO_DB_CONFIG_' => '没有定义数据库配置', 33 | '_NOT_SUPPORT_' => '系统不支持', 34 | '_CACHE_TYPE_INVALID_' => '无法加载缓存类型', 35 | '_FILE_NOT_WRITABLE_' => '目录(文件)不可写', 36 | '_METHOD_NOT_EXIST_' => '方法不存在!', 37 | '_CLASS_NOT_EXIST_' => '实例化一个不存在的类!', 38 | '_CLASS_CONFLICT_' => '类名冲突', 39 | '_TEMPLATE_ERROR_' => '模板引擎错误', 40 | '_CACHE_WRITE_ERROR_' => '缓存文件写入失败!', 41 | '_TAGLIB_NOT_EXIST_' => '标签库未定义', 42 | '_OPERATION_FAIL_' => '操作失败!', 43 | '_OPERATION_SUCCESS_' => '操作成功!', 44 | '_SELECT_NOT_EXIST_' => '记录不存在!', 45 | '_EXPRESS_ERROR_' => '表达式错误', 46 | '_TOKEN_ERROR_' => '表单令牌错误', 47 | '_RECORD_HAS_UPDATE_' => '记录已经更新', 48 | '_NOT_ALLOW_PHP_' => '模板禁用PHP代码', 49 | '_PARAM_ERROR_' => '参数错误或者未定义', 50 | '_ERROR_QUERY_EXPRESS_' => '错误的查询条件', 51 | ); 52 | -------------------------------------------------------------------------------- /ThinkPHP/Lang/zh-tw.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 繁体中文語言包 14 | */ 15 | return array( 16 | /* 核心語言變數 */ 17 | '_MODULE_NOT_EXIST_' => '無法載入模組', 18 | '_CONTROLLER_NOT_EXIST_' => '無法載入控制器', 19 | '_ERROR_ACTION_' => '非法操作', 20 | '_LANGUAGE_NOT_LOAD_' => '無法載入語言包', 21 | '_TEMPLATE_NOT_EXIST_' => '模板不存在', 22 | '_MODULE_' => '模組', 23 | '_ACTION_' => '操作', 24 | '_MODEL_NOT_EXIST_' => '模型不存在或者沒有定義', 25 | '_VALID_ACCESS_' => '沒有權限', 26 | '_XML_TAG_ERROR_' => 'XML標籤語法錯誤', 27 | '_DATA_TYPE_INVALID_' => '非法資料物件!', 28 | '_OPERATION_WRONG_' => '操作出現錯誤', 29 | '_NOT_LOAD_DB_' => '無法載入資料庫', 30 | '_NO_DB_DRIVER_' => '無法載入資料庫驅動', 31 | '_NOT_SUPPORT_DB_' => '系統暫時不支援資料庫', 32 | '_NO_DB_CONFIG_' => '沒有定義資料庫設定', 33 | '_NOT_SUPPORT_' => '系統不支援', 34 | '_CACHE_TYPE_INVALID_' => '無法載入快取類型', 35 | '_FILE_NOT_WRITABLE_' => '目錄(檔案)不可寫', 36 | '_METHOD_NOT_EXIST_' => '方法不存在!', 37 | '_CLASS_NOT_EXIST_' => '實例化一個不存在的類別!', 38 | '_CLASS_CONFLICT_' => '類別名稱衝突', 39 | '_TEMPLATE_ERROR_' => '模板引擎錯誤', 40 | '_CACHE_WRITE_ERROR_' => '快取檔案寫入失敗!', 41 | '_TAGLIB_NOT_EXIST_' => '標籤庫未定義', 42 | '_OPERATION_FAIL_' => '操作失敗!', 43 | '_OPERATION_SUCCESS_' => '操作成功!', 44 | '_SELECT_NOT_EXIST_' => '記錄不存在!', 45 | '_EXPRESS_ERROR_' => '運算式錯誤', 46 | '_TOKEN_ERROR_' => '表單權限錯誤', 47 | '_RECORD_HAS_UPDATE_' => '記錄已經更新', 48 | '_NOT_ALLOW_PHP_' => '模板禁用PHP代碼', 49 | '_PARAM_ERROR_' => '參數錯誤或者未定義', 50 | '_ERROR_QUERY_EXPRESS_' => '錯誤的查詢條件', 51 | ); 52 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/AgentCheckBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 行为扩展:代理检测 15 | */ 16 | class AgentCheckBehavior 17 | { 18 | public function run(&$params) 19 | { 20 | // 代理访问检测 21 | $limitProxyVisit = C('LIMIT_PROXY_VISIT', null, true); 22 | if ($limitProxyVisit && ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_USER_AGENT_VIA'])) { 23 | // 禁止代理访问 24 | exit('Access Denied'); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/BorisBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | use Think\Think; 14 | 15 | /** 16 | * Boris行为扩展 17 | */ 18 | class BorisBehavior 19 | { 20 | public function run(&$params) 21 | { 22 | if (IS_CLI) { 23 | if (!function_exists('pcntl_signal')) { 24 | E("pcntl_signal not working.\nRepl mode based on Linux OS or PHP for OS X(http://php-osx.liip.ch/)\n"); 25 | } 26 | 27 | Think::addMap(array( 28 | 'Boris\Boris' => VENDOR_PATH . 'Boris/Boris.php', 29 | 'Boris\Config' => VENDOR_PATH . 'Boris/Config.php', 30 | 'Boris\CLIOptionsHandler' => VENDOR_PATH . 'Boris/CLIOptionsHandler.php', 31 | 'Boris\ColoredInspector' => VENDOR_PATH . 'Boris/ColoredInspector.php', 32 | 'Boris\DumpInspector' => VENDOR_PATH . 'Boris/DumpInspector.php', 33 | 'Boris\EvalWorker' => VENDOR_PATH . 'Boris/EvalWorker.php', 34 | 'Boris\ExportInspector' => VENDOR_PATH . 'Boris/ExportInspector.php', 35 | 'Boris\Inspector' => VENDOR_PATH . 'Boris/Inspector.php', 36 | 'Boris\ReadlineClient' => VENDOR_PATH . 'Boris/ReadlineClient.php', 37 | 'Boris\ShallowParser' => VENDOR_PATH . 'Boris/ShallowParser.php', 38 | )); 39 | $boris = new \Boris\Boris(">>> "); 40 | $config = new \Boris\Config(); 41 | $config->apply($boris, true); 42 | $options = new \Boris\CLIOptionsHandler(); 43 | $options->handle($boris); 44 | $boris->onStart(sprintf("echo 'REPL MODE FOR THINKPHP \nTHINKPHP_VERSION: %s, PHP_VERSION: %s, BORIS_VERSION: %s\n';", THINK_VERSION, PHP_VERSION, $boris::VERSION)); 45 | $boris->start(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/BrowserCheckBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 浏览器防刷新检测 15 | */ 16 | class BrowserCheckBehavior 17 | { 18 | public function run(&$params) 19 | { 20 | if ('GET' == $_SERVER['REQUEST_METHOD']) { 21 | // 启用页面防刷新机制 22 | $guid = md5($_SERVER['PHP_SELF']); 23 | // 浏览器防刷新的时间间隔(秒) 默认为10 24 | $refleshTime = C('LIMIT_REFLESH_TIMES', null, 10); 25 | // 检查页面刷新间隔 26 | if (cookie('_last_visit_time_' . $guid) && cookie('_last_visit_time_' . $guid) > time() - $refleshTime) { 27 | // 页面刷新读取浏览器缓存 28 | header('HTTP/1.1 304 Not Modified'); 29 | exit; 30 | } else { 31 | // 缓存当前地址访问时间 32 | cookie('_last_visit_time_' . $guid, $_SERVER['REQUEST_TIME']); 33 | //header('Last-Modified:'.(date('D,d M Y H:i:s',$_SERVER['REQUEST_TIME']-C('LIMIT_REFLESH_TIMES'))).' GMT'); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 系统行为扩展:模板内容输出替换 15 | */ 16 | class ContentReplaceBehavior 17 | { 18 | 19 | // 行为扩展的执行入口必须是run 20 | public function run(&$content) 21 | { 22 | $content = $this->templateContentReplace($content); 23 | } 24 | 25 | /** 26 | * 模板内容替换 27 | * @access protected 28 | * @param string $content 模板内容 29 | * @return string 30 | */ 31 | protected function templateContentReplace($content) 32 | { 33 | // 系统默认的特殊变量替换 34 | $replace = array( 35 | '__ROOT__' => __ROOT__, // 当前网站地址 36 | '__APP__' => __APP__, // 当前应用地址 37 | '__MODULE__' => __MODULE__, 38 | '__ACTION__' => __ACTION__, // 当前操作地址 39 | '__SELF__' => htmlentities(__SELF__), // 当前页面地址 40 | '__CONTROLLER__' => __CONTROLLER__, 41 | '__URL__' => __CONTROLLER__, 42 | '__PUBLIC__' => __ROOT__ . '/Public', // 站点公共目录 43 | ); 44 | // 允许用户自定义模板的字符串替换 45 | if (is_array(C('TMPL_PARSE_STRING'))) { 46 | $replace = array_merge($replace, C('TMPL_PARSE_STRING')); 47 | } 48 | 49 | $content = str_replace(array_keys($replace), array_values($replace), $content); 50 | return $content; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/CronRunBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 自动执行任务 15 | */ 16 | use Think\Log as Log; 17 | class CronRunBehavior 18 | { 19 | 20 | public function run(&$params) 21 | { 22 | // 锁定自动执行 23 | $lockfile = RUNTIME_PATH . 'cron.lock'; 24 | if (is_writable($lockfile) && filemtime($lockfile) > $_SERVER['REQUEST_TIME'] - C('CRON_MAX_TIME', null, 60)) { 25 | return; 26 | } else { 27 | touch($lockfile); 28 | } 29 | set_time_limit(1000); 30 | ignore_user_abort(true); 31 | 32 | // 载入cron配置文件 33 | // 格式 return array( 34 | // 'cronname'=>array('filename',intervals,nextruntime),... 35 | // ); 36 | if (is_file(RUNTIME_PATH . '~crons.php')) { 37 | $crons = include RUNTIME_PATH . '~crons.php'; 38 | } elseif (is_file(COMMON_PATH . 'Conf/crons.php')) { 39 | $crons = include COMMON_PATH . 'Conf/crons.php'; 40 | } 41 | if (isset($crons) && is_array($crons)) { 42 | $update = false; 43 | $log = array(); 44 | foreach ($crons as $key => $cron) { 45 | if (empty($cron[2]) || $_SERVER['REQUEST_TIME'] >= $cron[2]) { 46 | // 到达时间 执行cron文件 47 | G('cronStart'); 48 | include COMMON_PATH . 'Cron/' . $cron[0] . '.php'; 49 | G('cronEnd'); 50 | $_useTime = G('cronStart', 'cronEnd', 6); 51 | // 更新cron记录 52 | $cron[2] = $_SERVER['REQUEST_TIME'] + $cron[1]; 53 | $crons[$key] = $cron; 54 | $log[] = "Cron:$key Runat " . date('Y-m-d H:i:s') . " Use $_useTime s\n"; 55 | $update = true; 56 | } 57 | } 58 | if ($update) { 59 | // 记录Cron执行日志 60 | \Think\Log::write(implode('', $log)); 61 | // 更新cron文件 62 | $content = ""; 63 | file_put_contents(RUNTIME_PATH . '~crons.php', $content); 64 | } 65 | } 66 | // 解除锁定 67 | unlink($lockfile); 68 | return; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/RobotCheckBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 机器人检测 15 | * @author liu21st 16 | */ 17 | class RobotCheckBehavior 18 | { 19 | 20 | public function run(&$params) 21 | { 22 | // 机器人访问检测 23 | if (C('LIMIT_ROBOT_VISIT', null, true) && self::isRobot()) { 24 | // 禁止机器人访问 25 | exit('Access Denied'); 26 | } 27 | } 28 | 29 | private static function isRobot() 30 | { 31 | static $_robot = null; 32 | if (is_null($_robot)) { 33 | $spiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla'; 34 | $browsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla'; 35 | if (preg_match("/($browsers)/", $_SERVER['HTTP_USER_AGENT'])) { 36 | $_robot = false; 37 | } elseif (preg_match("/($spiders)/", $_SERVER['HTTP_USER_AGENT'])) { 38 | $_robot = true; 39 | } else { 40 | $_robot = false; 41 | } 42 | } 43 | return $_robot; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/TokenBuildBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | /** 14 | * 系统行为扩展:表单令牌生成 15 | */ 16 | class TokenBuildBehavior 17 | { 18 | 19 | public function run(&$content) 20 | { 21 | if (C('TOKEN_ON')) { 22 | list($tokenName, $tokenKey, $tokenValue) = $this->getToken(); 23 | $input_token = ''; 24 | $meta_token = ''; 25 | if (strpos($content, '{__TOKEN__}')) { 26 | // 指定表单令牌隐藏域位置 27 | $content = str_replace('{__TOKEN__}', $input_token, $content); 28 | } elseif (preg_match('/<\/form(\s*)>/is', $content, $match)) { 29 | // 智能生成表单令牌隐藏域 30 | $content = str_replace($match[0], $input_token . $match[0], $content); 31 | } 32 | $content = str_ireplace('', $meta_token . '', $content); 33 | } else { 34 | $content = str_replace('{__TOKEN__}', '', $content); 35 | } 36 | } 37 | 38 | //获得token 39 | private function getToken() 40 | { 41 | $tokenName = C('TOKEN_NAME', null, '__hash__'); 42 | $tokenType = C('TOKEN_TYPE', null, 'md5'); 43 | if (!isset($_SESSION[$tokenName])) { 44 | $_SESSION[$tokenName] = array(); 45 | } 46 | // 标识当前页面唯一性 47 | $tokenKey = md5($_SERVER['REQUEST_URI']); 48 | if (isset($_SESSION[$tokenName][$tokenKey])) { 49 | // 相同页面不重复生成session 50 | $tokenValue = $_SESSION[$tokenName][$tokenKey]; 51 | } else { 52 | $tokenValue = is_callable($tokenType) ? $tokenType(microtime(true)) : md5(microtime(true)); 53 | $_SESSION[$tokenName][$tokenKey] = $tokenValue; 54 | if (IS_AJAX && C('TOKEN_RESET', null, true)) { 55 | header($tokenName . ': ' . $tokenKey . '_' . $tokenValue); 56 | } 57 | //ajax需要获得这个header并替换页面中meta中的token值 58 | } 59 | return array($tokenName, $tokenKey, $tokenValue); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Behavior; 12 | 13 | use Think\Storage; 14 | 15 | /** 16 | * 系统行为扩展:静态缓存写入 17 | */ 18 | class WriteHtmlCacheBehavior 19 | { 20 | 21 | // 行为扩展的执行入口必须是run 22 | public function run(&$content) 23 | { 24 | //2014-11-28 修改 如果有HTTP 4xx 3xx 5xx 头部,禁止存储 25 | //2014-12-1 修改 对注入的网址 防止生成,例如 /game/lst/SortType/hot/-e8-90-8c-e5-85-94-e7-88-b1-e6-b6-88-e9-99-a4/-e8-bf-9b-e5-87-bb-e7-9a-84-e9-83-a8-e8-90-bd/-e9-a3-8e-e4-ba-91-e5-a4-a9-e4-b8-8b/index.shtml 26 | if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME') 27 | && !preg_match('/Status.*[345]{1}\d{2}/i', implode(' ', headers_list())) 28 | && !preg_match('/(-[a-z0-9]{2}){3,}/i', HTML_FILE_NAME)) { 29 | //静态文件写入 30 | Storage::put(HTML_FILE_NAME, $content, 'html'); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Org/Util/Stack.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Org\Util; 12 | 13 | /** 14 | * Stack实现类 15 | * @category ORG 16 | * @package ORG 17 | * @subpackage Util 18 | * @author liu21st 19 | */ 20 | class Stack extends ArrayList 21 | { 22 | 23 | /** 24 | * 架构函数 25 | * @access public 26 | * @param array $values 初始化数组元素 27 | */ 28 | public function __construct($values = array()) 29 | { 30 | parent::__construct($values); 31 | } 32 | 33 | /** 34 | * 将堆栈的内部指针指向第一个单元 35 | * @access public 36 | * @return mixed 37 | */ 38 | public function peek() 39 | { 40 | return reset($this->toArray()); 41 | } 42 | 43 | /** 44 | * 元素进栈 45 | * @access public 46 | * @param mixed $value 47 | * @return mixed 48 | */ 49 | public function push($value) 50 | { 51 | $this->add($value); 52 | return $value; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Behavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think; 12 | 13 | /** 14 | * ThinkPHP Behavior基础类 15 | */ 16 | abstract class Behavior 17 | { 18 | /** 19 | * 执行行为 run方法是Behavior唯一的接口 20 | * @access public 21 | * @param mixed $params 行为参数 22 | * @return void 23 | */ 24 | abstract public function run(&$params); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Cache/Driver/Apc.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Cache\Driver; 12 | 13 | use Think\Cache; 14 | 15 | /** 16 | * Apc缓存驱动 17 | */ 18 | class Apc extends Cache 19 | { 20 | 21 | /** 22 | * 架构函数 23 | * @param array $options 缓存参数 24 | * @access public 25 | */ 26 | public function __construct($options = array()) 27 | { 28 | if (!function_exists('apc_cache_info')) { 29 | E(L('_NOT_SUPPORT_') . ':Apc'); 30 | } 31 | $this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : C('DATA_CACHE_PREFIX'); 32 | $this->options['length'] = isset($options['length']) ? $options['length'] : 0; 33 | $this->options['expire'] = isset($options['expire']) ? $options['expire'] : C('DATA_CACHE_TIME'); 34 | } 35 | 36 | /** 37 | * 读取缓存 38 | * @access public 39 | * @param string $name 缓存变量名 40 | * @return mixed 41 | */ 42 | public function get($name) 43 | { 44 | N('cache_read', 1); 45 | return apc_fetch($this->options['prefix'] . $name); 46 | } 47 | 48 | /** 49 | * 写入缓存 50 | * @access public 51 | * @param string $name 缓存变量名 52 | * @param mixed $value 存储数据 53 | * @param integer $expire 有效时间(秒) 54 | * @return boolean 55 | */ 56 | public function set($name, $value, $expire = null) 57 | { 58 | N('cache_write', 1); 59 | if (is_null($expire)) { 60 | $expire = $this->options['expire']; 61 | } 62 | $name = $this->options['prefix'] . $name; 63 | if ($result = apc_store($name, $value, $expire)) { 64 | if ($this->options['length'] > 0) { 65 | // 记录缓存队列 66 | $this->queue($name); 67 | } 68 | } 69 | return $result; 70 | } 71 | 72 | /** 73 | * 删除缓存 74 | * @access public 75 | * @param string $name 缓存变量名 76 | * @return boolean 77 | */ 78 | public function rm($name) 79 | { 80 | return apc_delete($this->options['prefix'] . $name); 81 | } 82 | 83 | /** 84 | * 清除缓存 85 | * @access public 86 | * @return boolean 87 | */ 88 | public function clear() 89 | { 90 | return apc_clear_cache(); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Cache/Driver/Eaccelerator.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Cache\Driver; 12 | 13 | use Think\Cache; 14 | 15 | /** 16 | * Eaccelerator缓存驱动 17 | */ 18 | class Eaccelerator extends Cache 19 | { 20 | 21 | /** 22 | * 架构函数 23 | * @param array $options 缓存参数 24 | * @access public 25 | */ 26 | public function __construct($options = array()) 27 | { 28 | $this->options['expire'] = isset($options['expire']) ? $options['expire'] : C('DATA_CACHE_TIME'); 29 | $this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : C('DATA_CACHE_PREFIX'); 30 | $this->options['length'] = isset($options['length']) ? $options['length'] : 0; 31 | } 32 | 33 | /** 34 | * 读取缓存 35 | * @access public 36 | * @param string $name 缓存变量名 37 | * @return mixed 38 | */ 39 | public function get($name) 40 | { 41 | N('cache_read', 1); 42 | return eaccelerator_get($this->options['prefix'] . $name); 43 | } 44 | 45 | /** 46 | * 写入缓存 47 | * @access public 48 | * @param string $name 缓存变量名 49 | * @param mixed $value 存储数据 50 | * @param integer $expire 有效时间(秒) 51 | * @return boolean 52 | */ 53 | public function set($name, $value, $expire = null) 54 | { 55 | N('cache_write', 1); 56 | if (is_null($expire)) { 57 | $expire = $this->options['expire']; 58 | } 59 | $name = $this->options['prefix'] . $name; 60 | eaccelerator_lock($name); 61 | if (eaccelerator_put($name, $value, $expire)) { 62 | if ($this->options['length'] > 0) { 63 | // 记录缓存队列 64 | $this->queue($name); 65 | } 66 | return true; 67 | } 68 | return false; 69 | } 70 | 71 | /** 72 | * 删除缓存 73 | * @access public 74 | * @param string $name 缓存变量名 75 | * @return boolean 76 | */ 77 | public function rm($name) 78 | { 79 | return eaccelerator_rm($this->options['prefix'] . $name); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Controller/HproseController.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Controller; 12 | 13 | /** 14 | * ThinkPHP Hprose控制器类 15 | */ 16 | class HproseController 17 | { 18 | 19 | protected $allowMethodList = ''; 20 | protected $crossDomain = false; 21 | protected $P3P = false; 22 | protected $get = true; 23 | protected $debug = false; 24 | 25 | /** 26 | * 架构函数 27 | * @access public 28 | */ 29 | public function __construct() 30 | { 31 | //控制器初始化 32 | if (method_exists($this, '_initialize')) { 33 | $this->_initialize(); 34 | } 35 | 36 | //导入类库 37 | Vendor('Hprose.HproseHttpServer'); 38 | //实例化HproseHttpServer 39 | $server = new \HproseHttpServer(); 40 | if ($this->allowMethodList) { 41 | $methods = $this->allowMethodList; 42 | } else { 43 | $methods = get_class_methods($this); 44 | $methods = array_diff($methods, array('__construct', '__call', '_initialize')); 45 | } 46 | $server->addMethods($methods, $this); 47 | if (APP_DEBUG || $this->debug) { 48 | $server->setDebugEnabled(true); 49 | } 50 | // Hprose设置 51 | $server->setCrossDomainEnabled($this->crossDomain); 52 | $server->setP3PEnabled($this->P3P); 53 | $server->setGetEnabled($this->get); 54 | // 启动server 55 | $server->start(); 56 | } 57 | 58 | /** 59 | * 魔术方法 有不存在的操作的时候执行 60 | * @access public 61 | * @param string $method 方法名 62 | * @param array $args 参数 63 | * @return mixed 64 | */ 65 | public function __call($method, $args) 66 | {} 67 | } 68 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Controller/JsonRpcController.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Controller; 12 | 13 | /** 14 | * ThinkPHP JsonRPC控制器类 15 | */ 16 | use jsonRPCServer as jsonRPCServer; 17 | class JsonRpcController 18 | { 19 | 20 | /** 21 | * 架构函数 22 | * @access public 23 | */ 24 | public function __construct() 25 | { 26 | //控制器初始化 27 | if (method_exists($this, '_initialize')) { 28 | $this->_initialize(); 29 | } 30 | 31 | //导入类库 32 | Vendor('jsonRPC.jsonRPCServer'); 33 | // 启动server 34 | \jsonRPCServer::handle($this); 35 | } 36 | 37 | /** 38 | * 魔术方法 有不存在的操作的时候执行 39 | * @access public 40 | * @param string $method 方法名 41 | * @param array $args 参数 42 | * @return mixed 43 | */ 44 | public function __call($method, $args) 45 | {} 46 | } 47 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Controller/RpcController.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Controller; 12 | 13 | /** 14 | * ThinkPHP RPC控制器类 15 | */ 16 | class RpcController 17 | { 18 | 19 | protected $allowMethodList = ''; 20 | protected $debug = false; 21 | 22 | /** 23 | * 架构函数 24 | * @access public 25 | */ 26 | public function __construct() 27 | { 28 | //控制器初始化 29 | if (method_exists($this, '_initialize')) { 30 | $this->_initialize(); 31 | } 32 | 33 | //导入类库 34 | Vendor('phpRPC.phprpc_server'); 35 | //实例化phprpc 36 | $server = new \PHPRPC_Server(); 37 | if ($this->allowMethodList) { 38 | $methods = $this->allowMethodList; 39 | } else { 40 | $methods = get_class_methods($this); 41 | $methods = array_diff($methods, array('__construct', '__call', '_initialize')); 42 | } 43 | $server->add($methods, $this); 44 | 45 | if (APP_DEBUG || $this->debug) { 46 | $server->setDebugMode(true); 47 | } 48 | $server->setEnableGZIP(true); 49 | $server->start(); 50 | echo $server->comment(); 51 | } 52 | 53 | /** 54 | * 魔术方法 有不存在的操作的时候执行 55 | * @access public 56 | * @param string $method 方法名 57 | * @param array $args 参数 58 | * @return mixed 59 | */ 60 | public function __call($method, $args) 61 | {} 62 | } 63 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Controller/YarController.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Controller; 12 | 13 | /** 14 | * ThinkPHP Yar控制器类 15 | */ 16 | class YarController 17 | { 18 | 19 | /** 20 | * 架构函数 21 | * @access public 22 | */ 23 | public function __construct() 24 | { 25 | //控制器初始化 26 | if (method_exists($this, '_initialize')) { 27 | $this->_initialize(); 28 | } 29 | 30 | //判断扩展是否存在 31 | if (!extension_loaded('yar')) { 32 | E(L('_NOT_SUPPORT_') . ':yar'); 33 | } 34 | 35 | //实例化Yar_Server 36 | $server = new \Yar_Server($this); 37 | // 启动server 38 | $server->handle(); 39 | } 40 | 41 | /** 42 | * 魔术方法 有不存在的操作的时候执行 43 | * @access public 44 | * @param string $method 方法名 45 | * @param array $args 参数 46 | * @return mixed 47 | */ 48 | public function __call($method, $args) 49 | {} 50 | } 51 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Crypt.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think; 12 | 13 | /** 14 | * 加密解密类 15 | */ 16 | class Crypt 17 | { 18 | 19 | private static $handler = ''; 20 | 21 | public static function init($type = '') 22 | { 23 | $type = $type ?: C('DATA_CRYPT_TYPE'); 24 | $class = strpos($type, '\\') ? $type : 'Think\\Crypt\\Driver\\' . ucwords(strtolower($type)); 25 | self::$handler = $class; 26 | } 27 | 28 | /** 29 | * 加密字符串 30 | * @param string $str 字符串 31 | * @param string $key 加密key 32 | * @param integer $expire 有效期(秒) 0 为永久有效 33 | * @return string 34 | */ 35 | public static function encrypt($data, $key, $expire = 0) 36 | { 37 | if (empty(self::$handler)) { 38 | self::init(); 39 | } 40 | $class = self::$handler; 41 | return $class::encrypt($data, $key, $expire); 42 | } 43 | 44 | /** 45 | * 解密字符串 46 | * @param string $str 字符串 47 | * @param string $key 加密key 48 | * @return string 49 | */ 50 | public static function decrypt($data, $key) 51 | { 52 | if (empty(self::$handler)) { 53 | self::init(); 54 | } 55 | $class = self::$handler; 56 | return $class::decrypt($data, $key); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Crypt/Driver/Base64.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Crypt\Driver; 12 | 13 | /** 14 | * Base64 加密实现类 15 | */ 16 | class Base64 17 | { 18 | 19 | /** 20 | * 加密字符串 21 | * @param string $str 字符串 22 | * @param string $key 加密key 23 | * @param integer $expire 有效期(秒) 24 | * @return string 25 | */ 26 | public static function encrypt($data, $key, $expire = 0) 27 | { 28 | $expire = sprintf('%010d', $expire ? $expire + time() : 0); 29 | $key = md5($key); 30 | $data = base64_encode($expire . $data); 31 | $x = 0; 32 | $len = strlen($data); 33 | $l = strlen($key); 34 | for ($i = 0; $i < $len; $i++) { 35 | if ($x == $l) { 36 | $x = 0; 37 | } 38 | 39 | $char .= substr($key, $x, 1); 40 | $x++; 41 | } 42 | 43 | for ($i = 0; $i < $len; $i++) { 44 | $str .= chr(ord(substr($data, $i, 1)) + (ord(substr($char, $i, 1))) % 256); 45 | } 46 | return $str; 47 | } 48 | 49 | /** 50 | * 解密字符串 51 | * @param string $str 字符串 52 | * @param string $key 加密key 53 | * @return string 54 | */ 55 | public static function decrypt($data, $key) 56 | { 57 | $key = md5($key); 58 | $x = 0; 59 | $len = strlen($data); 60 | $l = strlen($key); 61 | for ($i = 0; $i < $len; $i++) { 62 | if ($x == $l) { 63 | $x = 0; 64 | } 65 | 66 | $char .= substr($key, $x, 1); 67 | $x++; 68 | } 69 | for ($i = 0; $i < $len; $i++) { 70 | if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1))) { 71 | $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1))); 72 | } else { 73 | $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1))); 74 | } 75 | } 76 | $data = base64_decode($str); 77 | $expire = substr($data, 0, 10); 78 | if ($expire > 0 && $expire < time()) { 79 | return ''; 80 | } 81 | $data = substr($data, 10); 82 | return $data; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Exception.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think; 12 | 13 | /** 14 | * ThinkPHP系统异常基类 15 | */ 16 | class Exception extends \Exception 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Log/Driver/File.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace Think\Log\Driver; 13 | 14 | class File 15 | { 16 | 17 | protected $config = array( 18 | 'log_time_format' => ' c ', 19 | 'log_file_size' => 2097152, 20 | 'log_path' => '', 21 | ); 22 | 23 | // 实例化并传入参数 24 | public function __construct($config = array()) 25 | { 26 | $this->config = array_merge($this->config, $config); 27 | } 28 | 29 | /** 30 | * 日志写入接口 31 | * @access public 32 | * @param string $log 日志信息 33 | * @param string $destination 写入目标 34 | * @return void 35 | */ 36 | public function write($log, $destination = '') 37 | { 38 | $now = date($this->config['log_time_format']); 39 | if (empty($destination)) { 40 | $destination = $this->config['log_path'] . date('y_m_d') . '.log'; 41 | } 42 | // 自动创建日志目录 43 | $log_dir = dirname($destination); 44 | if (!is_dir($log_dir)) { 45 | mkdir($log_dir, 0755, true); 46 | } 47 | //检测日志文件大小,超过配置大小则备份日志文件重新生成 48 | if (is_file($destination) && floor($this->config['log_file_size']) <= filesize($destination)) { 49 | rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination)); 50 | } 51 | error_log("[{$now}] " . $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['REQUEST_URI'] . "\r\n{$log}\r\n", 3, $destination); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Log/Driver/Sae.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace Think\Log\Driver; 13 | 14 | class Sae 15 | { 16 | 17 | protected $config = array( 18 | 'log_time_format' => ' c ', 19 | ); 20 | 21 | // 实例化并传入参数 22 | public function __construct($config = array()) 23 | { 24 | $this->config = array_merge($this->config, $config); 25 | } 26 | 27 | /** 28 | * 日志写入接口 29 | * @access public 30 | * @param string $log 日志信息 31 | * @param string $destination 写入目标 32 | * @return void 33 | */ 34 | public function write($log, $destination = '') 35 | { 36 | static $is_debug = null; 37 | $now = date($this->config['log_time_format']); 38 | $logstr = "[{$now}] " . $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['REQUEST_URI'] . "\r\n{$log}\r\n"; 39 | if (is_null($is_debug)) { 40 | preg_replace('@(\w+)\=([^;]*)@e', '$appSettings[\'\\1\']="\\2";', $_SERVER['HTTP_APPCOOKIE']); 41 | $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false; 42 | } 43 | if ($is_debug) { 44 | sae_set_display_errors(false); //记录日志不将日志打印出来 45 | } 46 | sae_debug($logstr); 47 | if ($is_debug) { 48 | sae_set_display_errors(true); 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Session/Driver/Memcache.class.php: -------------------------------------------------------------------------------- 1 | lifeTime = C('SESSION_EXPIRE') ? C('SESSION_EXPIRE') : $this->lifeTime; 19 | // $this->sessionName = $sessName; 20 | $options = array( 21 | 'timeout' => C('SESSION_TIMEOUT') ? C('SESSION_TIMEOUT') : 1, 22 | 'persistent' => C('SESSION_PERSISTENT') ? C('SESSION_PERSISTENT') : 0, 23 | ); 24 | $this->handle = new \Memcache; 25 | $hosts = explode(',', C('MEMCACHE_HOST')); 26 | $ports = explode(',', C('MEMCACHE_PORT')); 27 | foreach ($hosts as $i => $host) { 28 | $port = isset($ports[$i]) ? $ports[$i] : $ports[0]; 29 | $this->handle->addServer($host, $port, true, 1, $options['timeout']); 30 | } 31 | return true; 32 | } 33 | 34 | /** 35 | * 关闭Session 36 | * @access public 37 | */ 38 | public function close() 39 | { 40 | $this->gc(ini_get('session.gc_maxlifetime')); 41 | $this->handle->close(); 42 | $this->handle = null; 43 | return true; 44 | } 45 | 46 | /** 47 | * 读取Session 48 | * @access public 49 | * @param string $sessID 50 | */ 51 | public function read($sessID) 52 | { 53 | return $this->handle->get($this->sessionName . $sessID); 54 | } 55 | 56 | /** 57 | * 写入Session 58 | * @access public 59 | * @param string $sessID 60 | * @param String $sessData 61 | */ 62 | public function write($sessID, $sessData) 63 | { 64 | return $this->handle->set($this->sessionName . $sessID, $sessData, 0, $this->lifeTime); 65 | } 66 | 67 | /** 68 | * 删除Session 69 | * @access public 70 | * @param string $sessID 71 | */ 72 | public function destroy($sessID) 73 | { 74 | return $this->handle->delete($this->sessionName . $sessID); 75 | } 76 | 77 | /** 78 | * Session 垃圾回收 79 | * @access public 80 | * @param string $sessMaxLifeTime 81 | */ 82 | public function gc($sessMaxLifeTime) 83 | { 84 | return true; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Storage.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think; 12 | 13 | // 分布式文件存储类 14 | class Storage 15 | { 16 | 17 | /** 18 | * 操作句柄 19 | * @var string 20 | * @access protected 21 | */ 22 | protected static $handler; 23 | 24 | /** 25 | * 连接分布式文件系统 26 | * @access public 27 | * @param string $type 文件类型 28 | * @param array $options 配置数组 29 | * @return void 30 | */ 31 | public static function connect($type = 'File', $options = array()) 32 | { 33 | $class = 'Think\\Storage\\Driver\\' . ucwords($type); 34 | self::$handler = new $class($options); 35 | } 36 | 37 | public static function __callStatic($method, $args) 38 | { 39 | //调用缓存驱动的方法 40 | if (method_exists(self::$handler, $method)) { 41 | return call_user_func_array(array(self::$handler, $method), $args); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Template/Driver/Ease.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Template\Driver; 12 | 13 | /** 14 | * EaseTemplate模板引擎驱动 15 | */ 16 | class Ease 17 | { 18 | /** 19 | * 渲染模板输出 20 | * @access public 21 | * @param string $templateFile 模板文件名 22 | * @param array $var 模板变量 23 | * @return void 24 | */ 25 | public function fetch($templateFile, $var) 26 | { 27 | $templateFile = substr($templateFile, strlen(THEME_PATH), -5); 28 | $CacheDir = substr(CACHE_PATH, 0, -1); 29 | $TemplateDir = substr(THEME_PATH, 0, -1); 30 | vendor('EaseTemplate.template#ease'); 31 | $config = array( 32 | 'CacheDir' => $CacheDir, 33 | 'TemplateDir' => $TemplateDir, 34 | 'TplType' => 'html', 35 | ); 36 | if (C('TMPL_ENGINE_CONFIG')) { 37 | $config = array_merge($config, C('TMPL_ENGINE_CONFIG')); 38 | } 39 | $tpl = new \EaseTemplate($config); 40 | $tpl->set_var($var); 41 | $tpl->set_file($templateFile); 42 | $tpl->p(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Template/Driver/Lite.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Template\Driver; 12 | 13 | /** 14 | * TemplateLite模板引擎驱动 15 | */ 16 | class Lite 17 | { 18 | /** 19 | * 渲染模板输出 20 | * @access public 21 | * @param string $templateFile 模板文件名 22 | * @param array $var 模板变量 23 | * @return void 24 | */ 25 | public function fetch($templateFile, $var) 26 | { 27 | vendor("TemplateLite.class#template"); 28 | $templateFile = substr($templateFile, strlen(THEME_PATH)); 29 | $tpl = new \Template_Lite(); 30 | $tpl->template_dir = THEME_PATH; 31 | $tpl->compile_dir = CACHE_PATH; 32 | $tpl->cache_dir = TEMP_PATH; 33 | if (C('TMPL_ENGINE_CONFIG')) { 34 | $config = C('TMPL_ENGINE_CONFIG'); 35 | foreach ($config as $key => $val) { 36 | $tpl->{$key} = $val; 37 | } 38 | } 39 | $tpl->assign($var); 40 | $tpl->display($templateFile); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Template/Driver/Mobile.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Template\Driver; 12 | 13 | /** 14 | * MobileTemplate模板引擎驱动 15 | */ 16 | class Mobile 17 | { 18 | /** 19 | * 渲染模板输出 20 | * @access public 21 | * @param string $templateFile 模板文件名 22 | * @param array $var 模板变量 23 | * @return void 24 | */ 25 | public function fetch($templateFile, $var) 26 | { 27 | $templateFile = substr($templateFile, strlen(THEME_PATH)); 28 | $var['_think_template_path'] = $templateFile; 29 | exit(json_encode($var)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Template/Driver/Smart.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Template\Driver; 12 | 13 | /** 14 | * Smart模板引擎驱动 15 | */ 16 | class Smart 17 | { 18 | /** 19 | * 渲染模板输出 20 | * @access public 21 | * @param string $templateFile 模板文件名 22 | * @param array $var 模板变量 23 | * @return void 24 | */ 25 | public function fetch($templateFile, $var) 26 | { 27 | $templateFile = substr($templateFile, strlen(THEME_PATH)); 28 | vendor('SmartTemplate.class#smarttemplate'); 29 | $tpl = new \SmartTemplate($templateFile); 30 | $tpl->caching = C('TMPL_CACHE_ON'); 31 | $tpl->template_dir = THEME_PATH; 32 | $tpl->compile_dir = CACHE_PATH; 33 | $tpl->cache_dir = TEMP_PATH; 34 | if (C('TMPL_ENGINE_CONFIG')) { 35 | $config = C('TMPL_ENGINE_CONFIG'); 36 | foreach ($config as $key => $val) { 37 | $tpl->{$key} = $val; 38 | } 39 | } 40 | $tpl->assign($var); 41 | $tpl->output(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Template/Driver/Smarty.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace Think\Template\Driver; 12 | 13 | /** 14 | * Smarty模板引擎驱动 15 | */ 16 | class Smarty 17 | { 18 | 19 | /** 20 | * 渲染模板输出 21 | * @access public 22 | * @param string $templateFile 模板文件名 23 | * @param array $var 模板变量 24 | * @return void 25 | */ 26 | public function fetch($templateFile, $var) 27 | { 28 | $templateFile = substr($templateFile, strlen(THEME_PATH)); 29 | vendor('Smarty.Smarty#class'); 30 | $tpl = new \Smarty(); 31 | $tpl->caching = C('TMPL_CACHE_ON'); 32 | $tpl->template_dir = THEME_PATH; 33 | $tpl->compile_dir = CACHE_PATH; 34 | $tpl->cache_dir = TEMP_PATH; 35 | if (C('TMPL_ENGINE_CONFIG')) { 36 | $config = C('TMPL_ENGINE_CONFIG'); 37 | foreach ($config as $key => $val) { 38 | $tpl->{$key} = $val; 39 | } 40 | } 41 | $tpl->assign($var); 42 | $tpl->display($templateFile); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/1.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/2.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/3.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/4.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/5.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/6.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/7.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/bgs/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/bgs/8.jpg -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/1.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/2.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/3.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/3.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/4.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/4.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/5.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/5.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/ttfs/6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/ttfs/6.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Think/Verify/zhttfs/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/Library/Think/Verify/zhttfs/1.ttf -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Boris/CLIOptionsHandler.php: -------------------------------------------------------------------------------- 1 | $value) { 20 | switch ($option) { 21 | /* 22 | * Sets files to load at startup, may be used multiple times, 23 | * i.e: boris -r test.php,foo/bar.php -r ba/foo.php --require hey.php 24 | */ 25 | case 'r': 26 | case 'require': 27 | $this->_handleRequire($boris, $value); 28 | break; 29 | 30 | /* 31 | * Show Usage info 32 | */ 33 | case 'h': 34 | case 'help': 35 | $this->_handleUsageInfo(); 36 | break; 37 | 38 | /* 39 | * Show version 40 | */ 41 | case 'v': 42 | case 'version': 43 | $this->_handleVersion(); 44 | break; 45 | } 46 | } 47 | } 48 | 49 | // -- Private Methods 50 | 51 | private function _handleRequire($boris, $paths) { 52 | $require = array_reduce( 53 | (array) $paths, 54 | function($acc, $v) { return array_merge($acc, explode(',', $v)); }, 55 | array() 56 | ); 57 | 58 | $boris->onStart(function($worker, $scope) use($require) { 59 | foreach($require as $path) { 60 | require $path; 61 | } 62 | 63 | $worker->setLocal(get_defined_vars()); 64 | }); 65 | } 66 | 67 | private function _handleUsageInfo() { 68 | echo <<_cascade = $cascade; 38 | $this->_searchPaths = $searchPaths; 39 | } 40 | 41 | /** 42 | * Searches for configuration files in the available 43 | * search paths, and applies them to the provided 44 | * boris instance. 45 | * 46 | * Returns true if any configuration files were found. 47 | * 48 | * @param Boris\Boris $boris 49 | * @return bool 50 | */ 51 | public function apply(Boris $boris) { 52 | $applied = false; 53 | 54 | foreach($this->_searchPaths as $path) { 55 | if (is_readable($path)) { 56 | $this->_loadInIsolation($path, $boris); 57 | 58 | $applied = true; 59 | $this->_files[] = $path; 60 | 61 | if (!$this->_cascade) { 62 | break; 63 | } 64 | } 65 | } 66 | 67 | return $applied; 68 | } 69 | 70 | /** 71 | * Returns an array of files that were loaded 72 | * for this Config 73 | * 74 | * @return array 75 | */ 76 | public function loadedFiles() { 77 | return $this->_files; 78 | } 79 | 80 | // -- Private Methods 81 | 82 | private function _loadInIsolation($path, $boris) { 83 | require $path; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Boris/DumpInspector.php: -------------------------------------------------------------------------------- 1 | '1', //缓存ID 27 | 'TplType' =>'htm', //模板格式 28 | 'CacheDir' =>'cache', //缓存目录 29 | 'TemplateDir'=>'template' , //模板存放目录 30 | 'AutoImage' =>'on' , //自动解析图片目录开关 on表示开放 off表示关闭 31 | 'LangDir' =>'language' , //语言文件存放的目录 32 | 'Language' =>'default' , //语言的默认文件 33 | 'Copyright' =>'off' , //版权保护 34 | 'MemCache' =>'' , //Memcache服务器地址例如:127.0.0.1:11211 35 | ) 36 | ){ 37 | 38 | parent::ETCoreStart($set); 39 | } 40 | 41 | } 42 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Hprose/HproseClassManager.php: -------------------------------------------------------------------------------- 1 | * 20 | * * 21 | \**********************************************************/ 22 | 23 | class HproseClassManager { 24 | private static $classCache1 = array(); 25 | private static $classCache2 = array(); 26 | public static function register($class, $alias) { 27 | self::$classCache1[$alias] = $class; 28 | self::$classCache2[$class] = $alias; 29 | } 30 | public static function getClassAlias($class) { 31 | if (array_key_exists($class, self::$classCache2)) { 32 | return self::$classCache2[$class]; 33 | } 34 | $alias = str_replace('\\', '_', $class); 35 | self::register($class, $alias); 36 | return $alias; 37 | } 38 | public static function getClass($alias) { 39 | if (array_key_exists($alias, self::$classCache1)) { 40 | return self::$classCache1[$alias]; 41 | } 42 | if (!class_exists($alias)) { 43 | $class = str_replace('_', '\\', $alias); 44 | if (class_exists($class)) { 45 | self::register($class, $alias); 46 | return $class; 47 | } 48 | eval("class " . $alias . " { }"); 49 | } 50 | return $alias; 51 | } 52 | } 53 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Hprose/HproseFormatter.php: -------------------------------------------------------------------------------- 1 | * 20 | * * 21 | \**********************************************************/ 22 | 23 | require_once('HproseIOStream.php'); 24 | require_once('HproseReader.php'); 25 | require_once('HproseWriter.php'); 26 | 27 | class HproseFormatter { 28 | public static function serialize(&$var, $simple = false) { 29 | $stream = new HproseStringStream(); 30 | $hproseWriter = ($simple ? new HproseSimpleWriter($stream) : new HproseWriter($stream)); 31 | $hproseWriter->serialize($var); 32 | return $stream->toString(); 33 | } 34 | public static function &unserialize($data, $simple = false) { 35 | $stream = new HproseStringStream($data); 36 | $hproseReader = ($simple ? new HproseSimpleReader($stream) : new HproseReader($stream)); 37 | return $hproseReader->unserialize(); 38 | } 39 | } 40 | ?> 41 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Hprose/HproseIO.php: -------------------------------------------------------------------------------- 1 | * 20 | * * 21 | \**********************************************************/ 22 | 23 | require_once('HproseTags.php'); 24 | require_once('HproseClassManager.php'); 25 | require_once('HproseReader.php'); 26 | require_once('HproseWriter.php'); 27 | require_once('HproseFormatter.php'); 28 | 29 | ?> 30 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Hprose/HproseTags.php: -------------------------------------------------------------------------------- 1 | * 20 | * * 21 | \**********************************************************/ 22 | 23 | class HproseTags { 24 | /* Serialize Tags */ 25 | const TagInteger = 'i'; 26 | const TagLong = 'l'; 27 | const TagDouble = 'd'; 28 | const TagNull = 'n'; 29 | const TagEmpty = 'e'; 30 | const TagTrue = 't'; 31 | const TagFalse = 'f'; 32 | const TagNaN = 'N'; 33 | const TagInfinity = 'I'; 34 | const TagDate = 'D'; 35 | const TagTime = 'T'; 36 | const TagUTC = 'Z'; 37 | const TagBytes = 'b'; 38 | const TagUTF8Char = 'u'; 39 | const TagString = 's'; 40 | const TagGuid = 'g'; 41 | const TagList = 'a'; 42 | const TagMap = 'm'; 43 | const TagClass = 'c'; 44 | const TagObject = 'o'; 45 | const TagRef = 'r'; 46 | /* Serialize Marks */ 47 | const TagPos = '+'; 48 | const TagNeg = '-'; 49 | const TagSemicolon = ';'; 50 | const TagOpenbrace = '{'; 51 | const TagClosebrace = '}'; 52 | const TagQuote = '"'; 53 | const TagPoint = '.'; 54 | /* Protocol Tags */ 55 | const TagFunctions = 'F'; 56 | const TagCall = 'C'; 57 | const TagResult = 'R'; 58 | const TagArgument = 'A'; 59 | const TagError = 'E'; 60 | const TagEnd = 'z'; 61 | } 62 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/README.txt: -------------------------------------------------------------------------------- 1 | 第三方类库包目录 -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/function.counter.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: counter
13 | * Purpose: print out a counter value 14 | * 15 | * @author Monte Ohrt 16 | * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} 17 | * (Smarty online manual) 18 | * @param array $params parameters 19 | * @param Smarty_Internal_Template $template template object 20 | * @return string|null 21 | */ 22 | function smarty_function_counter($params, $template) 23 | { 24 | static $counters = array(); 25 | 26 | $name = (isset($params['name'])) ? $params['name'] : 'default'; 27 | if (!isset($counters[$name])) { 28 | $counters[$name] = array( 29 | 'start'=>1, 30 | 'skip'=>1, 31 | 'direction'=>'up', 32 | 'count'=>1 33 | ); 34 | } 35 | $counter =& $counters[$name]; 36 | 37 | if (isset($params['start'])) { 38 | $counter['start'] = $counter['count'] = (int)$params['start']; 39 | } 40 | 41 | if (!empty($params['assign'])) { 42 | $counter['assign'] = $params['assign']; 43 | } 44 | 45 | if (isset($counter['assign'])) { 46 | $template->assign($counter['assign'], $counter['count']); 47 | } 48 | 49 | if (isset($params['print'])) { 50 | $print = (bool)$params['print']; 51 | } else { 52 | $print = empty($counter['assign']); 53 | } 54 | 55 | if ($print) { 56 | $retval = $counter['count']; 57 | } else { 58 | $retval = null; 59 | } 60 | 61 | if (isset($params['skip'])) { 62 | $counter['skip'] = $params['skip']; 63 | } 64 | 65 | if (isset($params['direction'])) { 66 | $counter['direction'] = $params['direction']; 67 | } 68 | 69 | if ($counter['direction'] == "down") 70 | $counter['count'] -= $counter['skip']; 71 | else 72 | $counter['count'] += $counter['skip']; 73 | 74 | return $retval; 75 | 76 | } 77 | 78 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifier.date_format.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: date_format
14 | * Purpose: format datestamps via strftime
15 | * Input:
16 | * - string: input date string 17 | * - format: strftime format for output 18 | * - default_date: default date if $string is empty 19 | * 20 | * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual) 21 | * @author Monte Ohrt 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 | * @return string |void 27 | * @uses smarty_make_timestamp() 28 | */ 29 | function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '',$formatter='auto') 30 | { 31 | /** 32 | * Include the {@link shared.make_timestamp.php} plugin 33 | */ 34 | require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); 35 | if ($string != '') { 36 | $timestamp = smarty_make_timestamp($string); 37 | } elseif ($default_date != '') { 38 | $timestamp = smarty_make_timestamp($default_date); 39 | } else { 40 | return; 41 | } 42 | if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) { 43 | if (DS == '\\') { 44 | $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); 45 | $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); 46 | if (strpos($format, '%e') !== false) { 47 | $_win_from[] = '%e'; 48 | $_win_to[] = sprintf('%\' 2d', date('j', $timestamp)); 49 | } 50 | if (strpos($format, '%l') !== false) { 51 | $_win_from[] = '%l'; 52 | $_win_to[] = sprintf('%\' 2d', date('h', $timestamp)); 53 | } 54 | $format = str_replace($_win_from, $_win_to, $format); 55 | } 56 | return strftime($format, $timestamp); 57 | } else { 58 | return date($format, $timestamp); 59 | } 60 | } 61 | 62 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifier.regex_replace.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: regex_replace
14 | * Purpose: regular expression search/replace 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php 17 | * regex_replace (Smarty online manual) 18 | * @author Monte Ohrt 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 | * @return string 23 | */ 24 | function smarty_modifier_regex_replace($string, $search, $replace) 25 | { 26 | if(is_array($search)) { 27 | foreach($search as $idx => $s) { 28 | $search[$idx] = _smarty_regex_replace_check($s); 29 | } 30 | } else { 31 | $search = _smarty_regex_replace_check($search); 32 | } 33 | return preg_replace($search, $replace, $string); 34 | } 35 | 36 | /** 37 | * @param string $search string(s) that should be replaced 38 | * @return string 39 | * @ignore 40 | */ 41 | function _smarty_regex_replace_check($search) 42 | { 43 | // null-byte injection detection 44 | // anything behind the first null-byte is ignored 45 | if (($pos = strpos($search,"\0")) !== false) { 46 | $search = substr($search,0,$pos); 47 | } 48 | // remove eval-modifier from $search 49 | if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { 50 | $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); 51 | } 52 | return $search; 53 | } 54 | 55 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifier.replace.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: replace
13 | * Purpose: simple search/replace 14 | * 15 | * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @author Uwe Tews 18 | * @param string $string input string 19 | * @param string $search text to search for 20 | * @param string $replace replacement text 21 | * @return string 22 | */ 23 | function smarty_modifier_replace($string, $search, $replace) 24 | { 25 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 26 | require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); 27 | return smarty_mb_str_replace($search, $replace, $string); 28 | } 29 | 30 | return str_replace($search, $replace, $string); 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifier.spacify.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: spacify
13 | * Purpose: add spaces between characters in a string 14 | * 15 | * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @param string $string input string 18 | * @param string $spacify_char string to insert between characters. 19 | * @return string 20 | */ 21 | function smarty_modifier_spacify($string, $spacify_char = ' ') 22 | { 23 | // well… what about charsets besides latin and UTF-8? 24 | return implode($spacify_char, preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY)); 25 | } 26 | 27 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifier.truncate.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: truncate
14 | * Purpose: Truncate a string to a certain length if necessary, 15 | * optionally splitting in the middle of a word, and 16 | * appending the $etc string or inserting $etc into the middle. 17 | * 18 | * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual) 19 | * @author Monte Ohrt 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 | * @return string truncated string 26 | */ 27 | function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) { 28 | if ($length == 0) 29 | return ''; 30 | 31 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 32 | if (mb_strlen($string, SMARTY_RESOURCE_CHAR_SET) > $length) { 33 | $length -= min($length, mb_strlen($etc, SMARTY_RESOURCE_CHAR_SET)); 34 | if (!$break_words && !$middle) { 35 | $string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($string, 0, $length + 1, SMARTY_RESOURCE_CHAR_SET)); 36 | } 37 | if (!$middle) { 38 | return mb_substr($string, 0, $length, SMARTY_RESOURCE_CHAR_SET) . $etc; 39 | } 40 | return mb_substr($string, 0, $length / 2, SMARTY_RESOURCE_CHAR_SET) . $etc . mb_substr($string, - $length / 2, $length, SMARTY_RESOURCE_CHAR_SET); 41 | } 42 | return $string; 43 | } 44 | 45 | // no MBString fallback 46 | if (isset($string[$length])) { 47 | $length -= min($length, strlen($etc)); 48 | if (!$break_words && !$middle) { 49 | $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1)); 50 | } 51 | if (!$middle) { 52 | return substr($string, 0, $length) . $etc; 53 | } 54 | return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2); 55 | } 56 | return $string; 57 | } 58 | 59 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.cat.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: cat
14 | * Date: Feb 24, 2003
15 | * Purpose: catenate a value to a variable
16 | * Input: string to catenate
17 | * Example: {$var|cat:"foo"} 18 | * 19 | * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat 20 | * (Smarty online manual) 21 | * @author Uwe Tews 22 | * @param array $params parameters 23 | * @return string with compiled code 24 | */ 25 | function smarty_modifiercompiler_cat($params, $compiler) 26 | { 27 | return '('.implode(').(', $params).')'; 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_characters.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_characteres
14 | * Purpose: count the number of characters in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_count_characters($params, $compiler) 22 | { 23 | if (!isset($params[1]) || $params[1] != 'true') { 24 | return 'preg_match_all(\'/[^\s]/u\',' . $params[0] . ', $tmp)'; 25 | } 26 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 27 | return 'mb_strlen(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET)'; 28 | } 29 | // no MBString fallback 30 | return 'strlen(' . $params[0] . ')'; 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_paragraphs.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_paragraphs
14 | * Purpose: count the number of paragraphs in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php 17 | * count_paragraphs (Smarty online manual) 18 | * @author Uwe Tews 19 | * @param array $params parameters 20 | * @return string with compiled code 21 | */ 22 | function smarty_modifiercompiler_count_paragraphs($params, $compiler) 23 | { 24 | // count \r or \n characters 25 | return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)'; 26 | } 27 | 28 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_sentences.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_sentences 14 | * Purpose: count the number of sentences in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php 17 | * count_sentences (Smarty online manual) 18 | * @author Uwe Tews 19 | * @param array $params parameters 20 | * @return string with compiled code 21 | */ 22 | function smarty_modifiercompiler_count_sentences($params, $compiler) 23 | { 24 | // find periods, question marks, exclamation marks with a word before but not after. 25 | return 'preg_match_all("#\w[\.\?\!](\W|$)#uS", ' . $params[0] . ', $tmp)'; 26 | } 27 | 28 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_words.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_words
14 | * Purpose: count the number of words in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_count_words($params, $compiler) 22 | { 23 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 24 | // return 'preg_match_all(\'#[\w\pL]+#u\', ' . $params[0] . ', $tmp)'; 25 | // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592 26 | return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/u\', ' . $params[0] . ', $tmp)'; 27 | } 28 | // no MBString fallback 29 | return 'str_word_count(' . $params[0] . ')'; 30 | } 31 | 32 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.default.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: default
14 | * Purpose: designate default value for empty variables 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_default ($params, $compiler) 22 | { 23 | $output = $params[0]; 24 | if (!isset($params[1])) { 25 | $params[1] = "''"; 26 | } 27 | 28 | array_shift($params); 29 | foreach ($params as $param) { 30 | $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)'; 31 | } 32 | return $output; 33 | } 34 | 35 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.from_charset.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: from_charset
14 | * Purpose: convert character encoding from $charset to internal encoding 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_from_charset($params, $compiler) 21 | { 22 | if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 23 | // FIXME: (rodneyrehm) shouldn't this throw an error? 24 | return $params[0]; 25 | } 26 | 27 | if (!isset($params[1])) { 28 | $params[1] = '"ISO-8859-1"'; 29 | } 30 | 31 | return 'mb_convert_encoding(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET, ' . $params[1] . ')'; 32 | } 33 | 34 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.indent.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: indent
13 | * Purpose: indent lines of text 14 | * 15 | * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual) 16 | * @author Uwe Tews 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | 21 | function smarty_modifiercompiler_indent($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = 4; 25 | } 26 | if (!isset($params[2])) { 27 | $params[2] = "' '"; 28 | } 29 | return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')'; 30 | } 31 | 32 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.lower.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: lower
13 | * Purpose: convert string to lowercase 14 | * 15 | * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | 22 | function smarty_modifiercompiler_lower($params, $compiler) 23 | { 24 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 25 | return 'mb_strtolower(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ; 26 | } 27 | // no MBString fallback 28 | return 'strtolower(' . $params[0] . ')'; 29 | } 30 | 31 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.noprint.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: noprint
14 | * Purpose: return an empty string 15 | * 16 | * @author Uwe Tews 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_noprint($params, $compiler) 21 | { 22 | return "''"; 23 | } 24 | 25 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.string_format.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: string_format
14 | * Purpose: format strings via sprintf 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_string_format($params, $compiler) 22 | { 23 | return 'sprintf(' . $params[1] . ',' . $params[0] . ')'; 24 | } 25 | 26 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.strip.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: strip
14 | * Purpose: Replace all repeated spaces, newlines, tabs 15 | * with a single space or supplied replacement string.
16 | * Example: {$var|strip} {$var|strip:" "}
17 | * Date: September 25th, 2002 18 | * 19 | * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual) 20 | * @author Uwe Tews 21 | * @param array $params parameters 22 | * @return string with compiled code 23 | */ 24 | 25 | function smarty_modifiercompiler_strip($params, $compiler) 26 | { 27 | if (!isset($params[1])) { 28 | $params[1] = "' '"; 29 | } 30 | return "preg_replace('!\s+!u', {$params[1]},{$params[0]})"; 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.strip_tags.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: strip_tags
14 | * Purpose: strip html tags from text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_strip_tags($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = true; 25 | } 26 | if ($params[1] === true) { 27 | return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})"; 28 | } else { 29 | return 'strip_tags(' . $params[0] . ')'; 30 | } 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.to_charset.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: to_charset
14 | * Purpose: convert character encoding from internal encoding to $charset 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_to_charset($params, $compiler) 21 | { 22 | if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 23 | // FIXME: (rodneyrehm) shouldn't this throw an error? 24 | return $params[0]; 25 | } 26 | 27 | if (!isset($params[1])) { 28 | $params[1] = '"ISO-8859-1"'; 29 | } 30 | 31 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', SMARTY_RESOURCE_CHAR_SET)'; 32 | } 33 | 34 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.unescape.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: unescape
14 | * Purpose: unescape html entities 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_unescape($params, $compiler) 21 | { 22 | if (!isset($params[1])) { 23 | $params[1] = 'html'; 24 | } 25 | if (!isset($params[2])) { 26 | $params[2] = "SMARTY_RESOURCE_CHAR_SET"; 27 | } else { 28 | $params[2] = "'" . $params[2] . "'"; 29 | } 30 | 31 | switch (trim($params[1], '"\'')) { 32 | case 'entity': 33 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; 34 | case 'htmlall': 35 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 36 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; 37 | } 38 | return 'html_entity_decode(' . $params[0] . ', ENT_QUOTES, ' . $params[2] . ')'; 39 | 40 | case 'html': 41 | return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)'; 42 | 43 | default: 44 | return $params[0]; 45 | } 46 | } 47 | 48 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.upper.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: lower
14 | * Purpose: convert string to uppercase 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_upper($params, $compiler) 22 | { 23 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 24 | return 'mb_strtoupper(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ; 25 | } 26 | // no MBString fallback 27 | return 'strtoupper(' . $params[0] . ')'; 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.wordwrap.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: wordwrap
14 | * Purpose: wrap a string of text at a given length 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_wordwrap($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = 80; 25 | } 26 | if (!isset($params[2])) { 27 | $params[2] = '"\n"'; 28 | } 29 | if (!isset($params[3])) { 30 | $params[3] = 'false'; 31 | } 32 | $function = 'wordwrap'; 33 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 34 | if ($compiler->tag_nocache | $compiler->nocache) { 35 | $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php'; 36 | $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap'; 37 | } else { 38 | $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php'; 39 | $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap'; 40 | } 41 | $function = 'smarty_mb_wordwrap'; 42 | } 43 | return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')'; 44 | } 45 | 46 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/shared.escape_special_chars.php: -------------------------------------------------------------------------------- 1 | =')) { 10 | /** 11 | * escape_special_chars common function 12 | * 13 | * Function: smarty_function_escape_special_chars
14 | * Purpose: used by other smarty functions to escape 15 | * special chars except for already escaped ones 16 | * 17 | * @author Monte Ohrt 18 | * @param string $string text that should by escaped 19 | * @return string 20 | */ 21 | function smarty_function_escape_special_chars($string) 22 | { 23 | if (!is_array($string)) { 24 | $string = htmlspecialchars($string, ENT_COMPAT, SMARTY_RESOURCE_CHAR_SET, false); 25 | } 26 | return $string; 27 | } 28 | } else { 29 | /** 30 | * escape_special_chars common function 31 | * 32 | * Function: smarty_function_escape_special_chars
33 | * Purpose: used by other smarty functions to escape 34 | * special chars except for already escaped ones 35 | * 36 | * @author Monte Ohrt 37 | * @param string $string text that should by escaped 38 | * @return string 39 | */ 40 | function smarty_function_escape_special_chars($string) 41 | { 42 | if (!is_array($string)) { 43 | $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); 44 | $string = htmlspecialchars($string); 45 | $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); 46 | } 47 | return $string; 48 | } 49 | } 50 | 51 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/shared.literal_compiler_param.php: -------------------------------------------------------------------------------- 1 | 11 | * Purpose: used by other smarty functions to make a timestamp from a string. 12 | * 13 | * @author Monte Ohrt 14 | * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() 15 | * @return int 16 | */ 17 | function smarty_make_timestamp($string) 18 | { 19 | if (empty($string)) { 20 | // use "now": 21 | return time(); 22 | } elseif ($string instanceof DateTime) { 23 | return $string->getTimestamp(); 24 | } elseif (strlen($string) == 14 && ctype_digit($string)) { 25 | // it is mysql timestamp format of YYYYMMDDHHMMSS? 26 | return mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), 27 | substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); 28 | } elseif (is_numeric($string)) { 29 | // it is a numeric string, we handle it as timestamp 30 | return (int) $string; 31 | } else { 32 | // strtotime should handle it 33 | $time = strtotime($string); 34 | if ($time == -1 || $time === false) { 35 | // strtotime() was not able to parse $string, use "now": 36 | return time(); 37 | } 38 | return $time; 39 | } 40 | } 41 | 42 | ?> 43 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/shared.mb_str_replace.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/shared.mb_unicode.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/plugins/variablefilter.htmlspecialchars.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_append.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var', 'value'); 32 | $this->shorttag_order = array('var', 'value'); 33 | $this->optional_attributes = array('scope', 'index'); 34 | // check and get attributes 35 | $_attr = $this->getAttributes($compiler, $args); 36 | // map to compile assign attributes 37 | if (isset($_attr['index'])) { 38 | $_params['smarty_internal_index'] = '[' . $_attr['index'] . ']'; 39 | unset($_attr['index']); 40 | } else { 41 | $_params['smarty_internal_index'] = '[]'; 42 | } 43 | $_new_attr = array(); 44 | foreach ($_attr as $key => $value) { 45 | $_new_attr[] = array($key => $value); 46 | } 47 | // call compile assign 48 | return parent::compile($_new_attr, $compiler, $_params); 49 | } 50 | 51 | } 52 | 53 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_break.php: -------------------------------------------------------------------------------- 1 | true, 'foreach' => true, 'while' => true, 'section' => true); 45 | // check and get attributes 46 | $_attr = $this->getAttributes($compiler, $args); 47 | 48 | if ($_attr['nocache'] === true) { 49 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 50 | } 51 | 52 | if (isset($_attr['levels'])) { 53 | if (!is_numeric($_attr['levels'])) { 54 | $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno); 55 | } 56 | $_levels = $_attr['levels']; 57 | } else { 58 | $_levels = 1; 59 | } 60 | $level_count = $_levels; 61 | $stack_count = count($compiler->_tag_stack) - 1; 62 | while ($level_count > 0 && $stack_count >= 0) { 63 | if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) { 64 | $level_count--; 65 | } 66 | $stack_count--; 67 | } 68 | if ($level_count != 0) { 69 | $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno); 70 | } 71 | $compiler->has_code = true; 72 | return ""; 73 | } 74 | 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_config_load.php: -------------------------------------------------------------------------------- 1 | true,'parent' => true,'root' => true,'global' => true); 52 | // check and get attributes 53 | $_attr = $this->getAttributes($compiler, $args); 54 | 55 | if ($_attr['nocache'] === true) { 56 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 57 | } 58 | 59 | 60 | // save posible attributes 61 | $conf_file = $_attr['file']; 62 | if (isset($_attr['section'])) { 63 | $section = $_attr['section']; 64 | } else { 65 | $section = 'null'; 66 | } 67 | $scope = 'local'; 68 | // scope setup 69 | if (isset($_attr['scope'])) { 70 | $_attr['scope'] = trim($_attr['scope'], "'\""); 71 | if (isset($_is_legal_scope[$_attr['scope']])) { 72 | $scope = $_attr['scope']; 73 | } else { 74 | $compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno); 75 | } 76 | } 77 | // create config object 78 | $_output = "smarty, \$_smarty_tpl);"; 79 | $_output .= "\$_config->loadConfigVars($section, '$scope'); ?>"; 80 | return $_output; 81 | } 82 | 83 | } 84 | 85 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_continue.php: -------------------------------------------------------------------------------- 1 | true, 'foreach' => true, 'while' => true, 'section' => true); 46 | // check and get attributes 47 | $_attr = $this->getAttributes($compiler, $args); 48 | 49 | if ($_attr['nocache'] === true) { 50 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 51 | } 52 | 53 | if (isset($_attr['levels'])) { 54 | if (!is_numeric($_attr['levels'])) { 55 | $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno); 56 | } 57 | $_levels = $_attr['levels']; 58 | } else { 59 | $_levels = 1; 60 | } 61 | $level_count = $_levels; 62 | $stack_count = count($compiler->_tag_stack) - 1; 63 | while ($level_count > 0 && $stack_count >= 0) { 64 | if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) { 65 | $level_count--; 66 | } 67 | $stack_count--; 68 | } 69 | if ($level_count != 0) { 70 | $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno); 71 | } 72 | $compiler->has_code = true; 73 | return ""; 74 | } 75 | 76 | } 77 | 78 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/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 = "smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>"; 38 | return $_output; 39 | } 40 | 41 | } 42 | 43 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_eval.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var'); 52 | $this->optional_attributes = array('assign'); 53 | // check and get attributes 54 | $_attr = $this->getAttributes($compiler, $args); 55 | if (isset($_attr['assign'])) { 56 | // output will be stored in a smarty variable instead of beind 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 | return ""; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_ldelim.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 31 | if ($_attr['nocache'] === true) { 32 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 33 | } 34 | // this tag does not return compiled code 35 | $compiler->has_code = true; 36 | return $compiler->smarty->left_delimiter; 37 | } 38 | 39 | } 40 | 41 | ?> 42 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_nocache.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | if ($_attr['nocache'] === true) { 33 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 34 | } 35 | // enter nocache mode 36 | $compiler->nocache = true; 37 | // this tag does not return compiled code 38 | $compiler->has_code = false; 39 | return true; 40 | } 41 | 42 | } 43 | 44 | /** 45 | * Smarty Internal Plugin Compile Nocacheclose Class 46 | * 47 | * @package Smarty 48 | * @subpackage Compiler 49 | */ 50 | class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase { 51 | 52 | /** 53 | * Compiles code for the {/nocache} tag 54 | * 55 | * This tag does not generate compiled output. It only sets a compiler flag. 56 | * 57 | * @param array $args array with attributes from parser 58 | * @param object $compiler compiler object 59 | * @return bool 60 | */ 61 | public function compile($args, $compiler) 62 | { 63 | $_attr = $this->getAttributes($compiler, $args); 64 | // leave nocache mode 65 | $compiler->nocache = false; 66 | // this tag does not return compiled code 67 | $compiler->has_code = false; 68 | return true; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_function_plugin.php: -------------------------------------------------------------------------------- 1 | has_output = true; 49 | 50 | // check and get attributes 51 | $_attr = $this->getAttributes($compiler, $args); 52 | if ($_attr['nocache'] === true) { 53 | $compiler->tag_nocache = true; 54 | } 55 | unset($_attr['nocache']); 56 | // convert attributes into parameter array string 57 | $_paramsArray = array(); 58 | foreach ($_attr as $_key => $_value) { 59 | if (is_int($_key)) { 60 | $_paramsArray[] = "$_key=>$_value"; 61 | } else { 62 | $_paramsArray[] = "'$_key'=>$_value"; 63 | } 64 | } 65 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 66 | // compile code 67 | $output = "\n"; 68 | return $output; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_object_function.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 42 | if ($_attr['nocache'] === true) { 43 | $compiler->tag_nocache = true; 44 | } 45 | unset($_attr['nocache']); 46 | $_assign = null; 47 | if (isset($_attr['assign'])) { 48 | $_assign = $_attr['assign']; 49 | unset($_attr['assign']); 50 | } 51 | // convert attributes into parameter array string 52 | if ($compiler->smarty->registered_objects[$tag][2]) { 53 | $_paramsArray = array(); 54 | foreach ($_attr as $_key => $_value) { 55 | if (is_int($_key)) { 56 | $_paramsArray[] = "$_key=>$_value"; 57 | } else { 58 | $_paramsArray[] = "'$_key'=>$_value"; 59 | } 60 | } 61 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 62 | $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; 63 | } else { 64 | $_params = implode(",", $_attr); 65 | $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; 66 | } 67 | if (empty($_assign)) { 68 | // This tag does create output 69 | $compiler->has_output = true; 70 | $output = "\n"; 71 | } else { 72 | $output = "assign({$_assign},{$return});?>\n"; 73 | } 74 | return $output; 75 | } 76 | 77 | } 78 | 79 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_rdelim.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 31 | if ($_attr['nocache'] === true) { 32 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 33 | } 34 | // this tag does not return compiled code 35 | $compiler->has_code = true; 36 | return $compiler->smarty->right_delimiter; 37 | } 38 | 39 | } 40 | 41 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_setfilter.php: -------------------------------------------------------------------------------- 1 | variable_filter_stack[] = $compiler->template->variable_filters; 31 | $compiler->template->variable_filters = $parameter['modifier_list']; 32 | // this tag does not return compiled code 33 | $compiler->has_code = false; 34 | return true; 35 | } 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 | * 50 | * This tag does not generate compiled output. It resets variable filter. 51 | * 52 | * @param array $args array with attributes from parser 53 | * @param object $compiler compiler object 54 | * @return string compiled code 55 | */ 56 | public function compile($args, $compiler) 57 | { 58 | $_attr = $this->getAttributes($compiler, $args); 59 | // reset variable filter to previous state 60 | if (count($compiler->variable_filter_stack)) { 61 | $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack); 62 | } else { 63 | $compiler->template->variable_filters = array(); 64 | } 65 | // this tag does not return compiled code 66 | $compiler->has_code = false; 67 | return true; 68 | } 69 | 70 | } 71 | 72 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_function_call_handler.php: -------------------------------------------------------------------------------- 1 | tpl_vars; 38 | foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}; 39 | foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>"; 40 | if ($_nocache) { 41 | $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!", 42 | "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']); 43 | $_template->smarty->template_functions[$_name]['called_nocache'] = true; 44 | } else { 45 | $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']); 46 | } 47 | $_code .= "tpl_vars = \$saved_tpl_vars;}"; 48 | eval($_code); 49 | } 50 | $_function($_template, $_params); 51 | } 52 | 53 | } 54 | 55 | ?> 56 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_get_include_path.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_nocache_insert.php: -------------------------------------------------------------------------------- 1 | assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>"; 41 | } else { 42 | $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>"; 43 | } 44 | $_tpl = $_template; 45 | while ($_tpl->parent instanceof Smarty_Internal_Template) { 46 | $_tpl = $_tpl->parent; 47 | } 48 | return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/"; 49 | } 50 | 51 | } 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_stream.php: -------------------------------------------------------------------------------- 1 | filepath = str_replace(':', '://', $source->resource); 34 | $source->uid = false; 35 | $source->content = $this->getContent($source); 36 | $source->timestamp = false; 37 | $source->exists = !!$source->content; 38 | } 39 | 40 | /** 41 | * Load template's source from stream into current template object 42 | * 43 | * @param Smarty_Template_Source $source source object 44 | * @return string template source 45 | * @throws SmartyException if source cannot be loaded 46 | */ 47 | public function getContent(Smarty_Template_Source $source) 48 | { 49 | $t = ''; 50 | // the availability of the stream has already been checked in Smarty_Resource::fetch() 51 | $fp = fopen($source->filepath, 'r+'); 52 | if ($fp) { 53 | while (!feof($fp) && ($current_line = fgets($fp)) !== false) { 54 | $t .= $current_line; 55 | } 56 | fclose($fp); 57 | return $t; 58 | } else { 59 | return false; 60 | } 61 | } 62 | 63 | /** 64 | * modify resource_name according to resource handlers specifications 65 | * 66 | * @param Smarty $smarty Smarty instance 67 | * @param string $resource_name resource_name to make unique 68 | * @return string unique resource name 69 | */ 70 | protected function buildUniqueResourceName(Smarty $smarty, $resource_name) 71 | { 72 | return get_class($this) . '#' . $resource_name; 73 | } 74 | } 75 | 76 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_write_file.php: -------------------------------------------------------------------------------- 1 | _file_perms !== null) { 31 | $old_umask = umask(0); 32 | } 33 | 34 | $_dirpath = dirname($_filepath); 35 | // if subdirs, create dir structure 36 | if ($_dirpath !== '.' && !file_exists($_dirpath)) { 37 | mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true); 38 | } 39 | 40 | // write to tmp file, then move to overt file lock race condition 41 | $_tmp_file = $_dirpath . DS . uniqid('wrt'); 42 | if (!file_put_contents($_tmp_file, $_contents)) { 43 | error_reporting($_error_reporting); 44 | throw new SmartyException("unable to write file {$_tmp_file}"); 45 | return false; 46 | } 47 | 48 | // remove original file 49 | @unlink($_filepath); 50 | 51 | // rename tmp file 52 | $success = rename($_tmp_file, $_filepath); 53 | if (!$success) { 54 | error_reporting($_error_reporting); 55 | throw new SmartyException("unable to write file {$_filepath}"); 56 | return false; 57 | } 58 | 59 | if ($smarty->_file_perms !== null) { 60 | // set file permissions 61 | chmod($_filepath, $smarty->_file_perms); 62 | umask($old_umask); 63 | } 64 | error_reporting($_error_reporting); 65 | return true; 66 | } 67 | 68 | } 69 | 70 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource_recompiled.php: -------------------------------------------------------------------------------- 1 | filepath = false; 30 | $compiled->timestamp = false; 31 | $compiled->exists = false; 32 | } 33 | 34 | } 35 | 36 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource_uncompiled.php: -------------------------------------------------------------------------------- 1 | filepath = false; 38 | $compiled->timestamp = false; 39 | $compiled->exists = false; 40 | } 41 | 42 | } 43 | 44 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_config.php: -------------------------------------------------------------------------------- 1 | _var_bracket_regexp . ')|\.\$?\w+|\S+!', $variable, $_match); 18 | $variable = $_match[0]; 19 | $var_name = array_shift($variable); 20 | 21 | $_result = "\$this->_confs['$var_name']"; 22 | foreach ($variable as $var) 23 | { 24 | if ($var{0} == '[') 25 | { 26 | $var = substr($var, 1, -1); 27 | if (is_numeric($var)) 28 | { 29 | $_result .= "[$var]"; 30 | } 31 | elseif ($var{0} == '$') 32 | { 33 | $_result .= "[" . $object->_compile_variable($var) . "]"; 34 | } 35 | elseif ($var{0} == '#') 36 | { 37 | $_result .= "[" . $object->_compile_config($var) . "]"; 38 | } 39 | else 40 | { 41 | $_result .= "['$var']"; 42 | } 43 | } 44 | else if ($var{0} == '.') 45 | { 46 | if ($var{1} == '$') 47 | { 48 | $_result .= "[\$this->_TPL['" . substr($var, 2) . "']]"; 49 | } 50 | else 51 | { 52 | $_result .= "['" . substr($var, 1) . "']"; 53 | } 54 | } 55 | else if (substr($var,0,2) == '->') 56 | { 57 | if(substr($var,2,2) == '__') 58 | { 59 | $object->trigger_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); 60 | } 61 | else if (substr($var, 2, 1) == '$') 62 | { 63 | $_output .= '->{(($var=$this->_TPL[\''.substr($var,3).'\']) && substr($var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$var\\"")}'; 64 | } 65 | } 66 | else 67 | { 68 | $object->trigger_error('#' . $var_name.implode('', $variable) . '# is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); 69 | } 70 | } 71 | return $_result; 72 | } 73 | 74 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_block.php: -------------------------------------------------------------------------------- 1 | _plugin_exists($function, "block")) 22 | { 23 | if ($start_tag) 24 | { 25 | $_args = $object->_parse_arguments($arguments); 26 | foreach($_args as $key => $value) 27 | { 28 | if (is_bool($value)) 29 | { 30 | $value = $value ? 'true' : 'false'; 31 | } 32 | if (is_null($value)) 33 | { 34 | $value = 'null'; 35 | } 36 | $_args[$key] = "'$key' => $value"; 37 | } 38 | $_result = "_tag_stack[] = array('$function', array(".implode(',', (array)$_args).")); "; 39 | $_result .= $function . '(array(' . implode(',', (array)$_args) .'), null, $this); '; 40 | $_result .= 'ob_start(); ?>'; 41 | } 42 | else 43 | { 44 | $_result .= '_block_content = ob_get_contents(); ob_end_clean(); '; 45 | $_result .= '$this->_block_content = ' . $function . '($this->_tag_stack[count($this->_tag_stack) - 1][1], $this->_block_content, $this); '; 46 | if (!empty($modifiers)) 47 | { 48 | $_result .= '$this->_block_content = ' . $object->_parse_modifier('$this->_block_content', $modifiers) . '; '; 49 | } 50 | $_result .= 'echo $this->_block_content; array_pop($this->_tag_stack); ?>'; 51 | } 52 | return true; 53 | } 54 | else 55 | { 56 | return false; 57 | } 58 | } 59 | 60 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_function.php: -------------------------------------------------------------------------------- 1 | _plugin_exists($function, "function")) 12 | { 13 | $_args = $object->_parse_arguments($arguments); 14 | foreach($_args as $key => $value) 15 | { 16 | if (is_bool($value)) 17 | { 18 | $value = $value ? 'true' : 'false'; 19 | } 20 | if (is_null($value)) 21 | { 22 | $value = 'null'; 23 | } 24 | $_args[$key] = "'$key' => $value"; 25 | } 26 | $_result = '_parse_modifier($function . '(array(' . implode(',', (array)$_args) . '), $this)', $modifiers) . '; '; 30 | } 31 | else 32 | { 33 | $_result .= $function . '(array(' . implode(',', (array)$_args) . '), $this);'; 34 | } 35 | $_result .= '?>'; 36 | return true; 37 | } 38 | else 39 | { 40 | return false; 41 | } 42 | } 43 | 44 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.generate_compiler_debug_output.php: -------------------------------------------------------------------------------- 1 | _vars;\n"; 12 | $debug_output .= "ksort(\$assigned_vars);\n"; 13 | $debug_output .= "if (@is_array(\$this->_config[0])) {\n"; 14 | $debug_output .= " \$config_vars = \$this->_config[0];\n"; 15 | $debug_output .= " ksort(\$config_vars);\n"; 16 | $debug_output .= " \$this->assign('_debug_config_keys', array_keys(\$config_vars));\n"; 17 | $debug_output .= " \$this->assign('_debug_config_vals', array_values(\$config_vars));\n"; 18 | $debug_output .= "} \n"; 19 | 20 | $debug_output .= "\$included_templates = \$this->_templatelite_debug_info;\n"; 21 | 22 | $debug_output .= "\$this->assign('_debug_keys', array_keys(\$assigned_vars));\n"; 23 | $debug_output .= "\$this->assign('_debug_vals', array_values(\$assigned_vars));\n"; 24 | $debug_output .= "\$this->assign('_debug_tpls', \$included_templates);\n"; 25 | 26 | $debug_output .= "\$this->_templatelite_debug_loop = true;\n"; 27 | $debug_output .= "\$this->_templatelite_debug_dir = \$this->template_dir;\n"; 28 | $debug_output .= "\$this->template_dir = TEMPLATE_LITE_DIR . 'internal/';\n"; 29 | $debug_output .= "echo \$this->_fetch_compile('debug.tpl');\n"; 30 | $debug_output .= "\$this->template_dir = \$this->_templatelite_debug_dir;\n"; 31 | $debug_output .= "\$this->_templatelite_debug_loop = false; \n"; 32 | return $debug_output; 33 | } 34 | 35 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.include.php: -------------------------------------------------------------------------------- 1 | _parse_arguments($arguments); 12 | 13 | $arg_list = array(); 14 | if (empty($_args['file'])) 15 | { 16 | $object->trigger_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__); 17 | } 18 | 19 | foreach ($_args as $arg_name => $arg_value) 20 | { 21 | if ($arg_name == 'file') 22 | { 23 | $include_file = $arg_value; 24 | continue; 25 | } 26 | else if ($arg_name == 'assign') 27 | { 28 | $assign_var = $arg_value; 29 | continue; 30 | } 31 | if (is_bool($arg_value)) 32 | { 33 | $arg_value = $arg_value ? 'true' : 'false'; 34 | } 35 | $arg_list[] = "'$arg_name' => $arg_value"; 36 | } 37 | 38 | if (isset($assign_var)) 39 | { 40 | $output = '_vars;' . 41 | "\n\$this->assign(" . $assign_var . ", \$this->_fetch_compile_include(" . $include_file . ", array(".implode(',', (array)$arg_list).")));\n" . 42 | "\$this->_vars = \$_templatelite_tpl_vars;\n" . 43 | "unset(\$_templatelite_tpl_vars);\n" . 44 | ' ?>'; 45 | } 46 | else 47 | { 48 | $output = '_vars;' . 49 | "\necho \$this->_fetch_compile_include(" . $include_file . ", array(".implode(',', (array)$arg_list)."));\n" . 50 | "\$this->_vars = \$_templatelite_tpl_vars;\n" . 51 | "unset(\$_templatelite_tpl_vars);\n" . 52 | ' ?>'; 53 | } 54 | return $output; 55 | } 56 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/compile.parse_is_expr.php: -------------------------------------------------------------------------------- 1 | _parse_variable($expr_arg) . "))"; 30 | } 31 | else 32 | { 33 | $expr = "!(1 & $is_arg)"; 34 | } 35 | break; 36 | 37 | case 'odd': 38 | if (isset($_args[$expr_end]) && $_args[$expr_end] == 'by') 39 | { 40 | $expr_end++; 41 | $expr_arg = $_args[$expr_end++]; 42 | $expr = "(1 & ($is_arg / " . $object->_parse_variable($expr_arg) . "))"; 43 | } 44 | else 45 | { 46 | $expr = "(1 & $is_arg)"; 47 | } 48 | break; 49 | 50 | case 'div': 51 | if (@$_args[$expr_end] == 'by') 52 | { 53 | $expr_end++; 54 | $expr_arg = $_args[$expr_end++]; 55 | $expr = "!($is_arg % " . $object->_parse_variable($expr_arg) . ")"; 56 | } 57 | else 58 | { 59 | $object->trigger_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__); 60 | } 61 | break; 62 | 63 | default: 64 | $object->trigger_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__); 65 | break; 66 | } 67 | 68 | if ($negate_expr) { 69 | $expr = "!($expr)"; 70 | } 71 | 72 | array_splice($_args, 0, $expr_end, $expr); 73 | 74 | return $_args; 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/template.build_dir.php: -------------------------------------------------------------------------------- 1 | _get_dir($dir); 15 | } 16 | $_result = $object->_get_dir($dir); 17 | foreach($_args as $value) 18 | { 19 | $_result .= $value.DIRECTORY_SEPARATOR; 20 | if (!is_dir($_result)) 21 | { 22 | @mkdir($_result, 0777); 23 | } 24 | } 25 | return $_result; 26 | } 27 | 28 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/template.config_loader.php: -------------------------------------------------------------------------------- 1 | _config_module_loaded = true; 10 | $this->template_dir = $this->_get_dir($this->template_dir); 11 | $this->config_dir = $this->_get_dir($this->config_dir); 12 | $this->compile_dir = $this->_get_dir($this->compile_dir); 13 | $name = ($this->encode_file_name) ? md5($this->template_dir . $file . $section_name . $var_name).'.php' : str_replace(".", "_", str_replace("/", "_", $file."_".$section_name."_".$var_name)).'.php'; 14 | 15 | if ($this->debugging) 16 | { 17 | $debug_start_time = array_sum(explode(' ', microtime())); 18 | } 19 | 20 | if ($this->cache) 21 | { 22 | array_push($this->_cache_info['config'], $file); 23 | } 24 | 25 | if (!$this->force_compile && file_exists($this->compile_dir.'c_'.$name) && (filemtime($this->compile_dir.'c_'.$name) > filemtime($this->config_dir.$file))) 26 | { 27 | include($this->compile_dir.'c_'.$name); 28 | return true; 29 | } 30 | 31 | if (!is_object($this->_config_obj)) 32 | { 33 | require_once(TEMPLATE_LITE_DIR . "class.config.php"); 34 | $this->_config_obj = new $this->config_class; 35 | $this->_config_obj->overwrite = $this->config_overwrite; 36 | $this->_config_obj->booleanize = $this->config_booleanize; 37 | $this->_config_obj->fix_new_lines = $this->config_fix_new_lines; 38 | $this->_config_obj->read_hidden = $this->config_read_hidden; 39 | } 40 | 41 | if (!($_result = $this->_config_obj->config_load($this->config_dir.$file, $section_name, $var_name))) 42 | { 43 | return false; 44 | } 45 | 46 | if (!empty($var_name) || !empty($section_name)) 47 | { 48 | $output = "\$this->_confs = " . var_export($_result, true) . ";"; 49 | } 50 | else 51 | { 52 | // must shift of the bottom level of the array to get rid of the section labels 53 | $_temp = array(); 54 | foreach($_result as $value) 55 | { 56 | $_temp = array_merge($_temp, $value); 57 | } 58 | $output = "\$this->_confs = " . var_export($_temp, true) . ";"; 59 | } 60 | 61 | $f = fopen($this->compile_dir.'c_'.$name, "w"); 62 | fwrite($f, ''); 63 | fclose($f); 64 | eval($output); 65 | 66 | if ($this->debugging) 67 | { 68 | $this->_templatelite_debug_info[] = array('type' => 'config', 69 | 'filename' => $file.' ['.$section_name.'] '.$var_name, 70 | 'depth' => 0, 71 | 'exec_time' => array_sum(explode(' ', microtime())) - $debug_start_time ); 72 | } 73 | 74 | return true; 75 | 76 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/template.destroy_dir.php: -------------------------------------------------------------------------------- 1 | template_dir = $object->_get_dir($object->template_dir); 32 | 33 | $name = ($object->encode_file_name) ? md5($object->template_dir.$file).'.php' : str_replace(".", "_", str_replace("/", "_", $file)).'.php'; 34 | @unlink($dir.$name); 35 | } 36 | else 37 | { 38 | $_args = ""; 39 | foreach(explode('|', $id) as $value) 40 | { 41 | $_args .= $value.DIRECTORY_SEPARATOR; 42 | } 43 | template_rm_dir($dir.DIRECTORY_SEPARATOR.$_args); 44 | } 45 | } 46 | } 47 | 48 | function template_rm_dir($dir) 49 | { 50 | if (is_file(substr($dir, 0, -1))) 51 | { 52 | @unlink(substr($dir, 0, -1)); 53 | return; 54 | } 55 | if ($d = opendir($dir)) 56 | { 57 | while(($f = readdir($d)) !== false) 58 | { 59 | if ($f != '.' && $f != '..') 60 | { 61 | template_rm_dir($dir.$f.DIRECTORY_SEPARATOR, $object); 62 | } 63 | } 64 | @rmdir($dir.$f); 65 | } 66 | } 67 | 68 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/template.fetch_compile_include.php: -------------------------------------------------------------------------------- 1 | debugging) 12 | { 13 | $object->_templatelite_debug_info[] = array('type' => 'template', 14 | 'filename' => $_templatelite_include_file, 15 | 'depth' => ++$object->_inclusion_depth, 16 | 'exec_time' => array_sum(explode(' ', microtime())) ); 17 | $included_tpls_idx = count($object->_templatelite_debug_info) - 1; 18 | } 19 | 20 | $object->_vars = array_merge($object->_vars, $_templatelite_include_vars); 21 | $_templatelite_include_file = $object->_get_resource($_templatelite_include_file); 22 | if(isset($object->_confs[0])) 23 | { 24 | array_unshift($object->_confs, $object->_confs[0]); 25 | $_compiled_output = $object->_fetch_compile($_templatelite_include_file); 26 | array_shift($object->_confs); 27 | } 28 | else 29 | { 30 | $_compiled_output = $object->_fetch_compile($_templatelite_include_file); 31 | } 32 | 33 | $object->_inclusion_depth--; 34 | 35 | if ($object->debugging) 36 | { 37 | $object->_templatelite_debug_info[$included_tpls_idx]['exec_time'] = array_sum(explode(' ', microtime())) - $object->_templatelite_debug_info[$included_tpls_idx]['exec_time']; 38 | } 39 | return $_compiled_output; 40 | } 41 | 42 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/TemplateLite/internal/template.generate_debug_output.php: -------------------------------------------------------------------------------- 1 | _vars; 12 | ksort($assigned_vars); 13 | if (@is_array($object->_config[0])) 14 | { 15 | $config_vars = $object->_config[0]; 16 | ksort($config_vars); 17 | $object->assign("_debug_config_keys", array_keys($config_vars)); 18 | $object->assign("_debug_config_vals", array_values($config_vars)); 19 | } 20 | 21 | $included_templates = $object->_templatelite_debug_info; 22 | 23 | $object->assign("_debug_keys", array_keys($assigned_vars)); 24 | $object->assign("_debug_vals", array_values($assigned_vars)); 25 | $object->assign("_debug_tpls", $included_templates); 26 | $object->assign("_templatelite_debug_output", ""); 27 | 28 | $object->_templatelite_debug_loop = true; 29 | $object->_templatelite_debug_dir = $object->template_dir; 30 | $object->template_dir = TEMPLATE_LITE_DIR . "internal/"; 31 | $debug_output = $object->fetch("debug.tpl"); 32 | $object->template_dir = $object->_templatelite_debug_dir; 33 | $object->_templatelite_debug_loop = false; 34 | return $debug_output; 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/jsonRPC/jsonRPCServer.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | This file is part of JSON-RPC PHP. 8 | 9 | JSON-RPC PHP is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | JSON-RPC PHP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with JSON-RPC PHP; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | /** 25 | * This class build a json-RPC Server 1.0 26 | * http://json-rpc.org/wiki/specification 27 | * 28 | * @author sergio 29 | */ 30 | class jsonRPCServer { 31 | /** 32 | * This function handle a request binding it to a given object 33 | * 34 | * @param object $object 35 | * @return boolean 36 | */ 37 | public static function handle($object) { 38 | 39 | // checks if a JSON-RCP request has been received 40 | if ( 41 | $_SERVER['REQUEST_METHOD'] != 'POST' || 42 | empty($_SERVER['CONTENT_TYPE']) || 43 | $_SERVER['CONTENT_TYPE'] != 'application/json' 44 | ) { 45 | // This is not a JSON-RPC request 46 | return false; 47 | } 48 | 49 | // reads the input data 50 | $request = json_decode(file_get_contents('php://input'),true); 51 | 52 | // executes the task on local object 53 | try { 54 | if ($result = @call_user_func_array(array($object,$request['method']),$request['params'])) { 55 | $response = array ( 56 | 'id' => $request['id'], 57 | 'result' => $result, 58 | 'error' => NULL 59 | ); 60 | } else { 61 | $response = array ( 62 | 'id' => $request['id'], 63 | 'result' => NULL, 64 | 'error' => 'unknown method or incorrect parameters' 65 | ); 66 | } 67 | } catch (Exception $e) { 68 | $response = array ( 69 | 'id' => $request['id'], 70 | 'result' => NULL, 71 | 'error' => $e->getMessage() 72 | ); 73 | } 74 | 75 | // output the response 76 | if (!empty($request['id'])) { // notifications don't want response 77 | header('content-type: text/javascript'); 78 | echo json_encode($response); 79 | } 80 | 81 | // finish 82 | return true; 83 | } 84 | } 85 | ?> 86 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/CREDITS: -------------------------------------------------------------------------------- 1 | XXTEA PHP extension 2 | Ma Bingyao (andot@coolcode.cn) 3 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/INSTALL: -------------------------------------------------------------------------------- 1 | Installing of XXTEA PHP package. 2 | 3 | There are many ways to build the package. Below you can find details for most 4 | useful ways of package building: 5 | 6 | 1. with PHP 7 | 2. with phpize utility 8 | 3. under Windows using Microsoft Visual C (.NET or VC6) 9 | 10 | ----------------------------------------------------------------------------- 11 | Way 1: Building the package with PHP 12 | ----------------------------------------------------------------------------- 13 | 14 | 1. Create ext/xxtea folder in the php-source-folder. Copy all files 15 | from the package into created folder. 16 | 17 | 2. Run 18 | ./buildconf 19 | to rebuild PHP's configure script. 20 | 21 | 3. Compile php with option: 22 | --enable-xxtea to build bundled into PHP module 23 | --enable-xxtea=shared to build dinamycally loadable module 24 | 25 | ----------------------------------------------------------------------------- 26 | Way 2: Building the package with phpize utility 27 | ----------------------------------------------------------------------------- 28 | 29 | 1. Unpack contents of the package. 30 | 31 | 2. Run 32 | phpize 33 | script, which will prepare environment for building XXTEA package. 34 | 35 | 3. Run 36 | ./configure --enable-xxtea=shared 37 | to generate makefile 38 | 39 | 4. Run 40 | make 41 | to build XXTEA extension library. It will be placed into 42 | ./modules folder. 43 | 44 | 5. Run 45 | make install 46 | to install XXTEA extension library into PHP 47 | 48 | ----------------------------------------------------------------------------- 49 | Way 3: Building the package under Windows using Microsoft Visual C (.NET or VC6) 50 | ----------------------------------------------------------------------------- 51 | 1. Create ext/xxtea folder in the php-source-folder. Copy all files 52 | from the package into created folder. 53 | 54 | 2. Copy php4ts.lib (for PHP4) or php5ts.lib (for PHP5) static library from 55 | your version of PHP into ext/xxtea folder. 56 | 57 | 3. Open php_xxtea.sln - solution file under MSVC.NET or php_xxtea.dsw - 58 | workspace file under MSVC6. Try to build Release_php4 (for PHP4) or Release_php5 59 | (for PHP5) configuration. 60 | 61 | 4. Copy php_xxtea.dll from ext/xxtea/Release_php4 or ext/xxtea/Release_php5 62 | into {extension_dir} folder. Path to {extension_dir} can be found in php.ini 63 | 64 | 5. Add line 65 | extension=php_xxtea.dll 66 | into php.ini 67 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/README: -------------------------------------------------------------------------------- 1 | XXTEA PHP extension 2 | 3 | What is it? 4 | ----------------------------------------------- 5 | This extension based on xxtea library, which provides a set of functions 6 | for encrypt or decrypt data with XXTEA algorithm. 7 | 8 | 9 | 10 | How to install it? 11 | ----------------------------------------------- 12 | See INSTALL for installation instructions. 13 | 14 | 15 | 16 | How to use it? 17 | ----------------------------------------------- 18 | string xxtea_encrypt(string data, string key) 19 | 20 | Encrypt data using XXTEA algorithm. The key is a 16 bytes(128 bits) string. 21 | 22 | string xxtea_decrypt(string data, string key) 23 | 24 | Decrypt data using XXTEA algorithm. The key is a 16 bytes(128 bits) string. 25 | 26 | string xxtea_info() 27 | 28 | Get the version information. -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(xxtea, xxtea module, 2 | [ --enable-xxtea Enable xxtea module.]) 3 | 4 | if test "$PHP_XXTEA" != "no"; then 5 | PHP_NEW_EXTENSION(xxtea, php_xxtea.c xxtea.c, $ext_shared) 6 | AC_DEFINE(HAVE_XXTEA, 1, [Have XXTEA library]) 7 | fi 8 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("xxtea", "xxtea module", "no"); 2 | 3 | if (PHP_XXTEA != "no") { 4 | EXTENSION("xxtea", "php_xxtea.c xxtea.c"); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | 3 | Copyright 2006-2007 Ma Bingyao 4 | 5 | These sources is free software. Redistributions of source code must 6 | retain the above copyright notice. Redistributions in binary form 7 | must reproduce the above copyright notice. You can redistribute it 8 | freely. You can use it with any free or commercial software. 9 | 10 | These sources is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY. Without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | 14 | You may contact the author by: 15 | e-mail: andot@coolcode.cn 16 | 17 | *************************************************************************/ 18 | 19 | #ifndef PHP_XXTEA_H 20 | #define PHP_XXTEA_H 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include "config.h" 24 | #endif 25 | 26 | #if HAVE_XXTEA 27 | extern zend_module_entry xxtea_module_entry; 28 | #define phpext_xxtea_ptr &xxtea_module_entry 29 | 30 | #define XXTEA_MODULE_NAME "xxtea" 31 | #define XXTEA_BUILD_DATE __DATE__ " " __TIME__ 32 | #define XXTEA_VERSION "1.0.3" 33 | #define XXTEA_AUTHOR "Ma Bingyao" 34 | #define XXTEA_HOMEPAGE "http://www.coolcode.cn/?p=209" 35 | 36 | ZEND_MINIT_FUNCTION(xxtea); 37 | ZEND_MSHUTDOWN_FUNCTION(xxtea); 38 | ZEND_MINFO_FUNCTION(xxtea); 39 | 40 | /* declaration of functions to be exported */ 41 | ZEND_FUNCTION(xxtea_encrypt); 42 | ZEND_FUNCTION(xxtea_decrypt); 43 | ZEND_FUNCTION(xxtea_info); 44 | 45 | #else /* if HAVE_XXTEA */ 46 | #define phpext_xxtea_ptr NULL 47 | #endif 48 | 49 | #endif /* ifndef PHP_XXTEA_H */ 50 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "php_xxtea", "php_xxtea.vcproj", "{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug_php4|Win32 = Debug_php4|Win32 8 | Debug_php5|Win32 = Debug_php5|Win32 9 | Release_php4|Win32 = Release_php4|Win32 10 | Release_php5|Win32 = Release_php5|Win32 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php4|Win32.ActiveCfg = Debug_php4|Win32 14 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php4|Win32.Build.0 = Debug_php4|Win32 15 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php5|Win32.ActiveCfg = Debug_php5|Win32 16 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php5|Win32.Build.0 = Debug_php5|Win32 17 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php4|Win32.ActiveCfg = Release_php4|Win32 18 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php4|Win32.Build.0 = Release_php4|Win32 19 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php5|Win32.ActiveCfg = Release_php5|Win32 20 | {71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php5|Win32.Build.0 = Release_php5|Win32 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/test/test.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/xxtea.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | 3 | Copyright 2006-2007 Ma Bingyao 4 | 5 | These sources is free software. Redistributions of source code must 6 | retain the above copyright notice. Redistributions in binary form 7 | must reproduce the above copyright notice. You can redistribute it 8 | freely. You can use it with any free or commercial software. 9 | 10 | These sources is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY. Without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | 14 | You may contact the author by: 15 | e-mail: andot@coolcode.cn 16 | 17 | *************************************************************************/ 18 | #include "xxtea.h" 19 | 20 | void xxtea_long_encrypt(xxtea_long *v, xxtea_long len, xxtea_long *k) { 21 | xxtea_long n = len - 1; 22 | xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = 0, e; 23 | if (n < 1) { 24 | return; 25 | } 26 | while (0 < q--) { 27 | sum += XXTEA_DELTA; 28 | e = sum >> 2 & 3; 29 | for (p = 0; p < n; p++) { 30 | y = v[p + 1]; 31 | z = v[p] += XXTEA_MX; 32 | } 33 | y = v[0]; 34 | z = v[n] += XXTEA_MX; 35 | } 36 | } 37 | 38 | void xxtea_long_decrypt(xxtea_long *v, xxtea_long len, xxtea_long *k) { 39 | xxtea_long n = len - 1; 40 | xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = q * XXTEA_DELTA, e; 41 | if (n < 1) { 42 | return; 43 | } 44 | while (sum != 0) { 45 | e = sum >> 2 & 3; 46 | for (p = n; p > 0; p--) { 47 | z = v[p - 1]; 48 | y = v[p] -= XXTEA_MX; 49 | } 50 | z = v[n]; 51 | y = v[0] -= XXTEA_MX; 52 | sum -= XXTEA_DELTA; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/xxtea.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | 3 | Copyright 2006-2007 Ma Bingyao 4 | 5 | These sources is free software. Redistributions of source code must 6 | retain the above copyright notice. Redistributions in binary form 7 | must reproduce the above copyright notice. You can redistribute it 8 | freely. You can use it with any free or commercial software. 9 | 10 | These sources is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY. Without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | 14 | You may contact the author by: 15 | e-mail: andot@coolcode.cn 16 | 17 | *************************************************************************/ 18 | 19 | #ifndef XXTEA_H 20 | #define XXTEA_H 21 | 22 | #include /* for size_t & NULL declarations */ 23 | 24 | #if defined(_MSC_VER) 25 | 26 | typedef unsigned __int32 xxtea_long; 27 | 28 | #else 29 | 30 | #if defined(__FreeBSD__) && __FreeBSD__ < 5 31 | /* FreeBSD 4 doesn't have stdint.h file */ 32 | #include 33 | #else 34 | #include 35 | #endif 36 | 37 | typedef uint32_t xxtea_long; 38 | 39 | #endif /* end of if defined(_MSC_VER) */ 40 | 41 | #define XXTEA_MX (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z) 42 | #define XXTEA_DELTA 0x9e3779b9 43 | 44 | void xxtea_long_encrypt(xxtea_long *v, xxtea_long len, xxtea_long *k); 45 | void xxtea_long_decrypt(xxtea_long *v, xxtea_long len, xxtea_long *k); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Vladimir Andersen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/README.md: -------------------------------------------------------------------------------- 1 | **Spyc** is a YAML loader/dumper written in pure PHP. Given a YAML document, Spyc will return an array that 2 | you can use however you see fit. Given an array, Spyc will return a string which contains a YAML document 3 | built from your data. 4 | 5 | **YAML** is an amazingly human friendly and strikingly versatile data serialization language which can be used 6 | for log files, config files, custom protocols, the works. For more information, see http://www.yaml.org. 7 | 8 | Spyc supports YAML 1.0 specification. 9 | 10 | ## Using Spyc 11 | 12 | Using Spyc is trivial: 13 | 14 | ``` 15 | =5.3.1" 18 | }, 19 | "autoload": { 20 | "files": [ "Spyc.php" ] 21 | }, 22 | "extra": { 23 | "branch-alias": { 24 | "dev-master": "0.5.x-dev" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/examples/yaml-dump.php: -------------------------------------------------------------------------------- 1 | 'A sequence','second' => 'of mapped values'); 18 | $array['Mapped'] = array('A sequence','which is mapped'); 19 | $array['A Note'] = 'What if your text is too long?'; 20 | $array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block. Kinda like this.'; 21 | $array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.'; 22 | $array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!"; 23 | $array['key:withcolon'] = "Should support this to"; 24 | 25 | $yaml = Spyc::YAMLDump($array,4,60); 26 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/examples/yaml-load.php: -------------------------------------------------------------------------------- 1 | spyc.yaml loaded into PHP:
'; 15 | print_r($array); 16 | echo ''; 17 | 18 | 19 | echo '
YAML Data dumped back:
'; 20 | echo Spyc::YAMLDump($array); 21 | echo '
'; 22 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/php4/5to4.php: -------------------------------------------------------------------------------- 1 | ', $code); 13 | $f = fopen ($dest, 'w'); 14 | fwrite($f, $code); 15 | fclose ($f); 16 | print "Written to $dest.\n"; 17 | } -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/IndentTest.php: -------------------------------------------------------------------------------- 1 | Y = Spyc::YAMLLoad("indent_1.yaml"); 11 | } 12 | 13 | public function testIndent_1() { 14 | $this->assertEquals (array ('child_1' => 2, 'child_2' => 0, 'child_3' => 1), $this->Y['root']); 15 | } 16 | 17 | public function testIndent_2() { 18 | $this->assertEquals (array ('child_1' => 1, 'child_2' => 2), $this->Y['root2']); 19 | } 20 | 21 | public function testIndent_3() { 22 | $this->assertEquals (array (array ('resolutions' => array (1024 => 768, 1920 => 1200), 'producer' => 'Nec')), $this->Y['display']); 23 | } 24 | 25 | public function testIndent_4() { 26 | $this->assertEquals (array ( 27 | array ('resolutions' => array (1024 => 768)), 28 | array ('resolutions' => array (1920 => 1200)), 29 | ), $this->Y['displays']); 30 | } 31 | 32 | public function testIndent_5() { 33 | $this->assertEquals (array (array ( 34 | 'row' => 0, 35 | 'col' => 0, 36 | 'headsets_affected' => array ( 37 | array ( 38 | 'ports' => array (0), 39 | 'side' => 'left', 40 | ) 41 | ), 42 | 'switch_function' => array ( 43 | 'ics_ptt' => true 44 | ) 45 | )), $this->Y['nested_hashes_and_seqs']); 46 | } 47 | 48 | public function testIndent_6() { 49 | $this->assertEquals (array ( 50 | 'h' => array ( 51 | array ('a' => 'b', 'a1' => 'b1'), 52 | array ('c' => 'd') 53 | ) 54 | ), $this->Y['easier_nest']); 55 | } 56 | 57 | public function testIndent_space() { 58 | $this->assertEquals ("By four\n spaces", $this->Y['one_space']); 59 | } 60 | 61 | public function testListAndComment() { 62 | $this->assertEquals (array ('one', 'two', 'three'), $this->Y['list_and_comment']); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/RoundTripTest.php: -------------------------------------------------------------------------------- 1 | $a))); } 6 | 7 | 8 | class RoundTripTest extends PHPUnit_Framework_TestCase { 9 | 10 | protected function setUp() { 11 | } 12 | 13 | public function testNull() { 14 | $this->assertEquals (array ('x' => null), roundTrip (null)); 15 | } 16 | 17 | public function testY() { 18 | $this->assertEquals (array ('x' => 'y'), roundTrip ('y')); 19 | } 20 | 21 | public function testExclam() { 22 | $this->assertEquals (array ('x' => '!yeah'), roundTrip ('!yeah')); 23 | } 24 | 25 | public function test5() { 26 | $this->assertEquals (array ('x' => '5'), roundTrip ('5')); 27 | } 28 | 29 | public function testSpaces() { 30 | $this->assertEquals (array ('x' => 'x '), roundTrip ('x ')); 31 | } 32 | 33 | public function testApostrophes() { 34 | $this->assertEquals (array ('x' => "'biz'"), roundTrip ("'biz'")); 35 | } 36 | 37 | public function testNewLines() { 38 | $this->assertEquals (array ('x' => "\n"), roundTrip ("\n")); 39 | } 40 | 41 | public function testHashes() { 42 | $this->assertEquals (array ('x' => array ("#color" => '#fff')), roundTrip (array ("#color" => '#fff'))); 43 | } 44 | 45 | public function testPreserveString() { 46 | $result1 = roundTrip ('0'); 47 | $result2 = roundTrip ('true'); 48 | $this->assertTrue (is_string ($result1['x'])); 49 | $this->assertTrue (is_string ($result2['x'])); 50 | } 51 | 52 | public function testPreserveBool() { 53 | $result = roundTrip (true); 54 | $this->assertTrue (is_bool ($result['x'])); 55 | } 56 | 57 | public function testPreserveInteger() { 58 | $result = roundTrip (0); 59 | $this->assertTrue (is_int ($result['x'])); 60 | } 61 | 62 | public function testWordWrap() { 63 | $this->assertEquals (array ('x' => "aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"), roundTrip ("aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); 64 | } 65 | 66 | public function testABCD() { 67 | $this->assertEquals (array ('a', 'b', 'c', 'd'), Spyc::YAMLLoad(Spyc::YAMLDump(array('a', 'b', 'c', 'd')))); 68 | } 69 | 70 | public function testABCD2() { 71 | $a = array('a', 'b', 'c', 'd'); // Create a simple list 72 | $b = Spyc::YAMLDump($a); // Dump the list as YAML 73 | $c = Spyc::YAMLLoad($b); // Load the dumped YAML 74 | $d = Spyc::YAMLDump($c); // Re-dump the data 75 | $this->assertSame($b, $d); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/comments.yaml: -------------------------------------------------------------------------------- 1 | foo: 'bar' #Comment 2 | arr: ['x', 'y', 'z'] # Comment here 3 | bar: kittens -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/failing1.yaml: -------------------------------------------------------------------------------- 1 | MyObject: 2 | Prop1: {key1:val1} -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/indent_1.yaml: -------------------------------------------------------------------------------- 1 | root: 2 | child_1: 2 3 | 4 | child_2: 0 5 | child_3: 1 6 | 7 | root2: 8 | child_1: 1 9 | # A comment 10 | child_2: 2 11 | 12 | displays: 13 | - resolutions: 14 | 1024: 768 15 | - resolutions: 16 | 1920: 1200 17 | 18 | display: 19 | - resolutions: 20 | 1024: 768 21 | 1920: 1200 22 | producer: "Nec" 23 | 24 | nested_hashes_and_seqs: 25 | - { row: 0, col: 0, headsets_affected: [{ports: [0], side: left}], switch_function: {ics_ptt: true} } 26 | 27 | easier_nest: { h: [{a: b, a1: b1}, {c: d}] } 28 | 29 | one_space: | 30 | By four 31 | spaces 32 | 33 | steps: 34 | - step: &id001 35 | instrument: Lasik 2000 36 | pulseEnergy: 5.4 37 | pulseDuration: 12 38 | repetition: 1000 39 | spotSize: 1mm 40 | - step: 41 | <<: *id001 42 | spotSize: 2mm 43 | 44 | death masks are: 45 | sad: 2 46 | <<: {magnificent: 4} 47 | 48 | login: &login 49 | adapter: mysql 50 | host: localhost 51 | 52 | development: 53 | database: rails_dev 54 | <<: *login 55 | 56 | "key": "value:" 57 | colon_only: ":" 58 | 59 | list_and_comment: [one, two, three] # comment 60 | kai: 61 | -example: value 62 | kai_list_of_items: 63 | - -item 64 | - '-item' 65 | -item -------------------------------------------------------------------------------- /ThinkPHP/Library/Vendor/spyc/tests/quotes.yaml: -------------------------------------------------------------------------------- 1 | html_tags: 2 | -
3 | -

4 | html_content: 5 | -

hello world

6 | - hello
world 7 | text_content: 8 | - hello world -------------------------------------------------------------------------------- /ThinkPHP/Mode/Sae/convention.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * SAE模式惯例配置文件 14 | * 该文件请不要修改,如果要覆盖惯例配置的值,可在应用配置文件中设定和惯例不符的配置项 15 | * 配置名称大小写任意,系统会统一转换成小写 16 | * 所有配置参数都可以在生效前动态改变 17 | */ 18 | $st = new SaeStorage(); 19 | return array( 20 | //SAE下固定mysql配置 21 | 'DB_TYPE' => 'mysql', // 数据库类型 22 | 'DB_DEPLOY_TYPE' => 1, 23 | 'DB_RW_SEPARATE' => true, 24 | 'DB_HOST' => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S, // 服务器地址 25 | 'DB_NAME' => SAE_MYSQL_DB, // 数据库名 26 | 'DB_USER' => SAE_MYSQL_USER, // 用户名 27 | 'DB_PWD' => SAE_MYSQL_PASS, // 密码 28 | 'DB_PORT' => SAE_MYSQL_PORT, // 端口 29 | //更改模板替换变量,让普通能在所有平台下显示 30 | 'TMPL_PARSE_STRING' => array( 31 | // __PUBLIC__/upload --> /Public/upload -->http://appname-public.stor.sinaapp.com/upload 32 | '/Public/upload' => $st->getUrl('public', 'upload'), 33 | ), 34 | 'LOG_TYPE' => 'Sae', 35 | 'DATA_CACHE_TYPE' => 'Memcachesae', 36 | 'CHECK_APP_DIR' => false, 37 | 'FILE_UPLOAD_TYPE' => 'Sae', 38 | ); 39 | -------------------------------------------------------------------------------- /ThinkPHP/Mode/api.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP API模式定义 14 | */ 15 | return array( 16 | // 配置文件 17 | 'config' => array( 18 | THINK_PATH . 'Conf/convention.php', // 系统惯例配置 19 | CONF_PATH . 'config' . CONF_EXT, // 应用公共配置 20 | ), 21 | 22 | // 别名定义 23 | 'alias' => array( 24 | 'Think\Exception' => CORE_PATH . 'Exception' . EXT, 25 | 'Think\Model' => CORE_PATH . 'Model' . EXT, 26 | 'Think\Db' => CORE_PATH . 'Db' . EXT, 27 | 'Think\Cache' => CORE_PATH . 'Cache' . EXT, 28 | 'Think\Cache\Driver\File' => CORE_PATH . 'Cache/Driver/File' . EXT, 29 | 'Think\Storage' => CORE_PATH . 'Storage' . EXT, 30 | ), 31 | 32 | // 函数和类文件 33 | 'core' => array( 34 | MODE_PATH . 'Api/functions.php', 35 | COMMON_PATH . 'Common/function.php', 36 | MODE_PATH . 'Api/App' . EXT, 37 | MODE_PATH . 'Api/Dispatcher' . EXT, 38 | MODE_PATH . 'Api/Controller' . EXT, 39 | CORE_PATH . 'Behavior' . EXT, 40 | ), 41 | // 行为扩展定义 42 | 'tags' => array( 43 | ), 44 | ); 45 | -------------------------------------------------------------------------------- /ThinkPHP/Mode/lite.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP Lite模式定义 14 | */ 15 | return array( 16 | // 配置文件 17 | 'config' => array( 18 | MODE_PATH . 'Lite/convention.php', // 系统惯例配置 19 | CONF_PATH . 'config' . CONF_EXT, // 应用公共配置 20 | ), 21 | 22 | // 别名定义 23 | 'alias' => array( 24 | 'Think\Exception' => CORE_PATH . 'Exception' . EXT, 25 | 'Think\Model' => CORE_PATH . 'Model' . EXT, 26 | 'Think\Db' => CORE_PATH . 'Db' . EXT, 27 | 'Think\Cache' => CORE_PATH . 'Cache' . EXT, 28 | 'Think\Cache\Driver\File' => CORE_PATH . 'Cache/Driver/File' . EXT, 29 | 'Think\Storage' => CORE_PATH . 'Storage' . EXT, 30 | ), 31 | 32 | // 函数和类文件 33 | 'core' => array( 34 | MODE_PATH . 'Lite/functions.php', 35 | COMMON_PATH . 'Common/function.php', 36 | CORE_PATH . 'Hook' . EXT, 37 | CORE_PATH . 'App' . EXT, 38 | CORE_PATH . 'Dispatcher' . EXT, 39 | //CORE_PATH . 'Log'.EXT, 40 | CORE_PATH . 'Route' . EXT, 41 | CORE_PATH . 'Controller' . EXT, 42 | CORE_PATH . 'View' . EXT, 43 | ), 44 | // 行为扩展定义 45 | 'tags' => array( 46 | ), 47 | ); 48 | -------------------------------------------------------------------------------- /ThinkPHP/Mode/sae.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP SAE应用模式定义文件 14 | */ 15 | return array( 16 | // 配置文件 17 | 'config' => array( 18 | THINK_PATH . 'Conf/convention.php', // 系统惯例配置 19 | CONF_PATH . 'config' . CONF_EXT, // 应用公共配置 20 | MODE_PATH . 'Sae/convention.php', //[sae] sae的惯例配置 21 | ), 22 | 23 | // 别名定义 24 | 'alias' => array( 25 | 'Think\Log' => CORE_PATH . 'Log' . EXT, 26 | 'Think\Log\Driver\File' => CORE_PATH . 'Log/Driver/File' . EXT, 27 | 'Think\Exception' => CORE_PATH . 'Exception' . EXT, 28 | 'Think\Model' => CORE_PATH . 'Model' . EXT, 29 | 'Think\Db' => CORE_PATH . 'Db' . EXT, 30 | 'Think\Template' => CORE_PATH . 'Template' . EXT, 31 | 'Think\Cache' => CORE_PATH . 'Cache' . EXT, 32 | 'Think\Cache\Driver\File' => CORE_PATH . 'Cache/Driver/File' . EXT, 33 | 'Think\Storage' => CORE_PATH . 'Storage' . EXT, 34 | ), 35 | 36 | // 函数和类文件 37 | 'core' => array( 38 | THINK_PATH . 'Common/functions.php', 39 | COMMON_PATH . 'Common/function.php', 40 | CORE_PATH . 'Hook' . EXT, 41 | CORE_PATH . 'App' . EXT, 42 | CORE_PATH . 'Dispatcher' . EXT, 43 | //CORE_PATH . 'Log'.EXT, 44 | CORE_PATH . 'Route' . EXT, 45 | CORE_PATH . 'Controller' . EXT, 46 | CORE_PATH . 'View' . EXT, 47 | BEHAVIOR_PATH . 'ParseTemplateBehavior' . EXT, 48 | BEHAVIOR_PATH . 'ContentReplaceBehavior' . EXT, 49 | ), 50 | // 行为扩展定义 51 | 'tags' => array( 52 | 'app_begin' => array( 53 | 'Behavior\ReadHtmlCacheBehavior', // 读取静态缓存 54 | ), 55 | 'app_end' => array( 56 | 'Behavior\ShowPageTraceBehavior', // 页面Trace显示 57 | ), 58 | 'view_parse' => array( 59 | 'Behavior\ParseTemplateBehavior', // 模板解析 支持PHP、内置模板引擎和第三方模板引擎 60 | ), 61 | 'template_filter' => array( 62 | 'Behavior\ContentReplaceBehavior', // 模板输出替换 63 | ), 64 | 'view_filter' => array( 65 | 'Behavior\WriteHtmlCacheBehavior', // 写入静态缓存 66 | ), 67 | ), 68 | ); 69 | -------------------------------------------------------------------------------- /ThinkPHP/Tpl/dispatch_jump.tpl: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 跳转提示 11 | 21 | 22 | 23 |
24 | 25 |

:)

26 |

27 | 28 |

:(

29 |

30 | 31 |

32 |

33 | 页面自动 跳转 等待时间: 34 |

35 |
36 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ThinkPHP/Tpl/think_exception.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 系统发生错误 5 | 21 | 22 | 23 |
24 |

:(

25 |

26 |
27 | 28 |
29 |
30 |

错误位置

31 |
32 |
33 |

FILE:  LINE:

34 |
35 |
36 | 37 | 38 |
39 |
40 |

TRACE

41 |
42 |
43 |

44 |
45 |
46 | 47 |
48 |
49 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ThinkPHP/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/top-think/thinkphp/40757e0d881b6b0d949501aa58148e1a8d77e340/ThinkPHP/logo.png -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "topthink/thinkphp", 3 | "description": "the ThinkPHP Framework", 4 | "type": "framework", 5 | "keywords": ["framework","thinkphp","ORM"], 6 | "homepage": "http://thinkphp.cn/", 7 | "license": "Apache-2.0", 8 | "authors": [ 9 | { 10 | "name": "liu21st", 11 | "email": "liu21st@gmail.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.3.0" 16 | }, 17 | "minimum-stability": "dev" 18 | } 19 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // 应用入口文件 13 | 14 | // 检测PHP环境 15 | if (version_compare(PHP_VERSION, '5.3.0', '<')) { 16 | die('require PHP > 5.3.0 !'); 17 | } 18 | 19 | // 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false 20 | define('APP_DEBUG', true); 21 | 22 | // 定义应用目录 23 | define('APP_PATH', './Application/'); 24 | 25 | // 引入ThinkPHP入口文件 26 | require './ThinkPHP/ThinkPHP.php'; 27 | 28 | // 亲^_^ 后面不需要任何代码了 就是如此简单 29 | --------------------------------------------------------------------------------