├── Common ├── Js │ └── image.js ├── index.htm ├── images │ ├── bg.jpg │ ├── hue.png │ ├── alpha.png │ ├── logo.png │ ├── logo1.png │ ├── sina.png │ ├── flower2.jpg │ ├── ver_code.jpg │ ├── xiangsu.jpg │ ├── bg_header.jpg │ ├── icon_Small.gif │ ├── login_list.png │ ├── login_logo.png │ ├── login_sub.png │ ├── saturation.png │ ├── screenshot.png │ ├── wrapperbg.jpg │ ├── login_banner.jpg │ ├── pageHeader_bg.png │ ├── admin_login_bg.png │ ├── login_header_bg.png │ ├── admin_login_input.png │ ├── login_content_bg.png │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── Uploads │ └── codejam.jpg └── Css │ ├── mobile.css │ ├── header.css │ ├── nanoscroller.css │ ├── page.css │ ├── login1.css │ ├── login.css │ └── overthrow.min.js ├── Home ├── Template │ ├── Index │ │ ├── init.js │ │ ├── about.html │ │ └── index.html │ ├── Public │ │ ├── error.html │ │ ├── success.html │ │ └── header.html │ ├── Content │ │ ├── submit.html │ │ ├── chat.html │ │ └── cj.html │ └── User │ │ ├── register.html │ │ └── login.html └── Lib │ └── Action │ ├── IndexAction.class.php │ ├── ApiAction.class.php │ └── UserAction.class.php ├── .gitignore ├── ThinkPHP ├── logo.png ├── Extend │ ├── Library │ │ ├── Com │ │ │ └── Zip.class.php │ │ └── ORG │ │ │ ├── Util │ │ │ ├── Lucida.ttf │ │ │ ├── Cookie.class.php │ │ │ ├── Stack.class.php │ │ │ ├── Socket.class.php │ │ │ └── Debug.class.php │ │ │ └── Crypt │ │ │ ├── Hmac.class.php │ │ │ ├── Base64.class.php │ │ │ └── Crypt.class.php │ └── README.txt ├── Tpl │ ├── default_index.tpl │ ├── dispatch_jump.tpl │ ├── think_exception.tpl │ └── page_trace.tpl ├── Conf │ ├── alias.php │ ├── debug.php │ └── tags.php ├── LICENSE.txt ├── Lib │ ├── Behavior │ │ ├── WriteHtmlCacheBehavior.class.php │ │ ├── LocationTemplateBehavior.class.php │ │ ├── ContentReplaceBehavior.class.php │ │ ├── TokenBuildBehavior.class.php │ │ ├── ShowRuntimeBehavior.class.php │ │ ├── ParseTemplateBehavior.class.php │ │ └── ReadHtmlCacheBehavior.class.php │ └── Core │ │ ├── Behavior.class.php │ │ ├── ThinkException.class.php │ │ ├── Cache.class.php │ │ ├── Widget.class.php │ │ ├── View.class.php │ │ └── Log.class.php ├── ThinkPHP.php ├── Lang │ ├── zh-cn.php │ └── en-us.php └── README.txt ├── Admin ├── Lib │ ├── Model │ │ ├── ClassModel.class.php │ │ └── UserModel.class.php │ └── Action │ │ ├── CommonAction.class.php │ │ ├── IndexAction.class.php │ │ ├── SettingAction.class.php │ │ └── ContentAction.class.php └── Tpl │ ├── Index │ ├── copyright.html │ ├── home.html │ ├── index.html │ ├── left.html │ └── header.html │ ├── Public │ ├── header.html │ ├── error.html │ └── success.html │ ├── User │ ├── add.html │ ├── edit.html │ ├── login.html │ └── manage.html │ ├── Setting │ ├── all.html │ └── basic.html │ ├── Comment │ ├── add.html │ ├── edit.html │ ├── suggest.html │ └── manage.html │ ├── Content │ ├── add.html │ ├── edit.html │ └── manage.html │ └── Live │ ├── add.html │ └── edit.html ├── robots.txt ├── admin.php ├── README.md ├── index.php ├── Conf └── config.inc.php └── table.md /Common/Js/image.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Common/index.htm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Home/Template/Index/init.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Admin/Runtime/* 2 | Home/Runtime/* 3 | Conf/config.php 4 | -------------------------------------------------------------------------------- /ThinkPHP/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/ThinkPHP/logo.png -------------------------------------------------------------------------------- /Common/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/bg.jpg -------------------------------------------------------------------------------- /Common/images/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/hue.png -------------------------------------------------------------------------------- /Common/images/alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/alpha.png -------------------------------------------------------------------------------- /Common/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/logo.png -------------------------------------------------------------------------------- /Common/images/logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/logo1.png -------------------------------------------------------------------------------- /Common/images/sina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/sina.png -------------------------------------------------------------------------------- /Common/Uploads/codejam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/Uploads/codejam.jpg -------------------------------------------------------------------------------- /Common/images/flower2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/flower2.jpg -------------------------------------------------------------------------------- /Common/images/ver_code.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/ver_code.jpg -------------------------------------------------------------------------------- /Common/images/xiangsu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/xiangsu.jpg -------------------------------------------------------------------------------- /Common/images/bg_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/bg_header.jpg -------------------------------------------------------------------------------- /Common/images/icon_Small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/icon_Small.gif -------------------------------------------------------------------------------- /Common/images/login_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_list.png -------------------------------------------------------------------------------- /Common/images/login_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_logo.png -------------------------------------------------------------------------------- /Common/images/login_sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_sub.png -------------------------------------------------------------------------------- /Common/images/saturation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/saturation.png -------------------------------------------------------------------------------- /Common/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/screenshot.png -------------------------------------------------------------------------------- /Common/images/wrapperbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/wrapperbg.jpg -------------------------------------------------------------------------------- /Common/images/login_banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_banner.jpg -------------------------------------------------------------------------------- /Common/images/pageHeader_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/pageHeader_bg.png -------------------------------------------------------------------------------- /Common/images/admin_login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/admin_login_bg.png -------------------------------------------------------------------------------- /Common/images/login_header_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_header_bg.png -------------------------------------------------------------------------------- /Common/images/admin_login_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/admin_login_input.png -------------------------------------------------------------------------------- /Common/images/login_content_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/login_content_bg.png -------------------------------------------------------------------------------- /Common/images/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/glyphicons-halflings.png -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/Com/Zip.class.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/ThinkPHP/Extend/Library/Com/Zip.class.php -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Util/Lucida.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/ThinkPHP/Extend/Library/ORG/Util/Lucida.ttf -------------------------------------------------------------------------------- /Common/images/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suziewong/wechat-activity/HEAD/Common/images/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /Admin/Lib/Model/ClassModel.class.php: -------------------------------------------------------------------------------- 1 | ThinkPHP   and   Bootstrap酥西黄 2010-2013 2 | 3 | -------------------------------------------------------------------------------- /Admin/Lib/Model/UserModel.class.php: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /Home/Template/Public/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

提交错误

8 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 微信活动平台 2 | ============ 3 | 4 | Author:[SuzieWong](http://www.imsuzie.com) 5 | 6 | Email:monkeysuzie[at]gmail.com 7 | 8 | #### 效果图 9 | 10 | ![](./Common/images/screenshot.png) 11 | 12 | #### 重要 13 | 14 | 这个作品,我会在暑假结束之后好好整理一下代码的,希望大家一如既往的支持我。 15 | 16 | #### 备注 17 | 18 | 本项目为杭州Codejam的作品. 19 | 20 | http://segmentfault.com/e/codejam-hangzhou-2013-p4 21 | http://hackathon.segmentfault.com/q/1010000000208388 22 | 23 | 关于表结构,我会整理以后再次上传的.. 24 | 25 | -------------------------------------------------------------------------------- /ThinkPHP/Extend/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Extend目录为系统扩展目录(核心版不含任何扩展),子目录结构为: 3 | 4 | |-Action 控制器扩展 5 | |-Behavior 行为扩展 6 | |-Driver 驱动扩展 7 | | ├Driver/Cache 缓存驱动 8 | | ├Driver/Db 数据库驱动 9 | | ├Driver/Session SESSION驱动 10 | | ├Driver/TagLib 标签库驱动 11 | | ├Driver/Template 模板引擎驱动 12 | | 13 | |-Engine 引擎扩展 14 | |-Function 函数扩展 15 | |-Library 类库扩展 16 | | ├ORG ORG类库包 17 | | ├COM COM类库包 18 | | 19 | |-Mode 模式扩展 20 | |-Model 模型扩展 21 | |-Tool 其他扩展或工具 22 | |-Vendor 第三方类库目录 23 | 24 | 关于扩展的详细使用,请参考开发手册的扩展章节。 -------------------------------------------------------------------------------- /Admin/Tpl/Public/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 后台管理 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Admin/Lib/Action/IndexAction.class.php: -------------------------------------------------------------------------------- 1 | display(); 7 | } 8 | // 显示管理后台头部内容 9 | public function header() 10 | { 11 | $this->display(); 12 | } 13 | 14 | // 显示管理后台左侧菜单内容 15 | public function left() 16 | { 17 | $this->display(); 18 | 19 | } 20 | 21 | // 显示管理后台欢迎页 22 | public function home() 23 | { 24 | $this->display(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /ThinkPHP/Tpl/default_index.tpl: -------------------------------------------------------------------------------- 1 | show('

:)

欢迎使用 ThinkPHP

','utf-8'); 6 | } 7 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 'default', 17 | 'THEME_LIST' => 'default,new', 18 | 'TMPL_DETECT_THEME' => true, // 自动侦测模板主题*/ 19 | 20 | require './ThinkPHP/ThinkPHP.php'; 21 | -------------------------------------------------------------------------------- /Conf/config.inc.php: -------------------------------------------------------------------------------- 1 | '配置值' 4 | // 添加数据库配置信息 5 | 'URL_MODEL'=> 0, // 0普通模式,1.pathinfo[利于SEO] 如果你的环境不支持PATHINFO 请设置为3 6 | 'DB_TYPE' => 'mysql', // 数据库类型 7 | 'DB_HOST' => '', // 服务器地址 8 | 'DB_NAME' => '', // 数据库名 9 | 'DB_USER' => '', // 用户名 10 | 'DB_PWD' => '', // 密码 11 | 'DB_PORT' => 3306, // 端口 12 | 'DB_PREFIX' => 'xx_', // 数据库表前缀 13 | 14 | 15 | 16 | 17 | 'TMPL_ACTION_ERROR' => 'Public:error', //默认错误跳转对应的模板文件 18 | 'TMPL_ACTION_SUCCESS' => 'Public:success', //默认成功跳转对应的模板文件 19 | 'TMPL_PARSE_STRING' =>array( 20 | '__PUBLIC__' => __ROOT__.'/Common', // 更改默认的__PUBLIC__ 替换规则 21 | '__ADMIN__' => __ROOT__.'/Common/', // 更改默认的__PUBLIC__ 替换规则 22 | '__CSS__'=> __ROOT__.'/Common/Css/', 23 | '__JS__' => __ROOT__.'/Common/Js/', // 增加新的JS类库路径替换规则 24 | '__UPLOAD__' => __ROOT__.'/Common/Uploads', // 增加新的上传路径替换规则 25 | '__PIC__'=> __ROOT__.'/Common/images/', 26 | ) 27 | ); 28 | ?> 29 | -------------------------------------------------------------------------------- /Home/Template/Content/submit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /Admin/Tpl/Public/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 页面提示 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 18 |
19 | {$msgTitle}{$message} 20 | 21 | {$msgTitle}{$error} 22 |
23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /Home/Template/User/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 |
8 | 9 |
10 |
11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Admin/Tpl/Public/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 页面提示 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 19 | 20 |
21 | 22 | √ {$msgTitle}{$message}! 23 | 24 | 正在{$waitSecond} 秒后为您转向基本配置页面,如果不想等待请点击 这里 关闭 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /Home/Template/Public/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 页面提示 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 19 | 20 |
21 | 22 | √ {$msgTitle}{$message}! 23 | 24 | 正在{$waitSecond} 秒后为您转向基本配置页面,如果不想等待请点击 这里 关闭 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /ThinkPHP/Conf/alias.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | // 系统别名定义文件 14 | return array( 15 | 'Model' => CORE_PATH.'Core/Model.class.php', 16 | 'Db' => CORE_PATH.'Core/Db.class.php', 17 | 'Log' => CORE_PATH.'Core/Log.class.php', 18 | 'ThinkTemplate' => CORE_PATH.'Template/ThinkTemplate.class.php', 19 | 'TagLib' => CORE_PATH.'Template/TagLib.class.php', 20 | 'Cache' => CORE_PATH.'Core/Cache.class.php', 21 | 'Widget' => CORE_PATH.'Core/Widget.class.php', 22 | 'TagLibCx' => CORE_PATH.'Driver/TagLib/TagLibCx.class.php', 23 | ); -------------------------------------------------------------------------------- /Home/Template/User/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 |
8 | 9 |
10 |
11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 | 22 | 23 |
24 |
25 |
26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Admin/Tpl/Index/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 后台管理 11 | 12 | 13 | 14 | 19 |
20 |

Hacker News

21 |

Just hack it!

22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Home/Template/Content/chat.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
    21 | {$page} 22 |
23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ThinkPHP/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 3 | 版权所有Copyright © 2006-2012 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/Lib/Behavior/WriteHtmlCacheBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:静态缓存写入 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class WriteHtmlCacheBehavior extends Behavior { 21 | 22 | // 行为扩展的执行入口必须是run 23 | public function run(&$content){ 24 | if(C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')) { 25 | //静态文件写入 26 | // 如果开启HTML功能 检查并重写HTML文件 27 | // 没有模版的操作不生成静态文件 28 | if(!is_dir(dirname(HTML_FILE_NAME))) 29 | mkdir(dirname(HTML_FILE_NAME),0755,true); 30 | if( false === file_put_contents( HTML_FILE_NAME , $content )) 31 | throw_exception(L('_CACHE_WRITE_ERROR_').':'.HTML_FILE_NAME); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Home/Template/Index/about.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

关于本网站

4 |

本站的维护者为酥西黄,他在杭州的加班圣地实习,所以这个网站版本更新的会很慢了.如果你愿意贡献代码,本项目托管于Github,地址在这里.

5 |

本站使用说明

6 |
7 |
    8 |
  1. 功能一直是beta版本,如果您需要,可以自己定制化修改,或者提交issues给我.
  2. 9 |
  3. 本人曾经做过微信公众账号,目前不过3000个人关注,是工大助手
  4. 10 |
  5. 因为做微信开发,曾近和十几所大学的微信开发者有过交流,也有一定的开发和运营经验,欢迎和我交流:)
  6. 11 |
12 |
13 |
14 | 27 | 28 | 29 | 30 | 41 | -------------------------------------------------------------------------------- /Common/Css/header.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 60px; 3 | padding-bottom: 40px; 4 | } 5 | .sidebar-nav { 6 | padding: 9px 0; 7 | } 8 | .footer { 9 | text-align: center; 10 | padding: 30px 0; 11 | margin-top: 90px; 12 | border-top: 1px solid #e5e5e5; 13 | background-color: #f5f5f5; 14 | } 15 | .input 16 | { 17 | font: 12px Arial, Helvetica, sans-serif; 18 | border: 1px solid #86888B; 19 | } 20 | #filedrag 21 | { 22 | display: none; 23 | font-weight: bold; 24 | text-align: center; 25 | padding: 1em 0; 26 | margin: 1em 0; 27 | color: #555; 28 | border: 2px dashed #555; 29 | border-radius: 7px; 30 | cursor: default; 31 | } 32 | #filedrag.hover 33 | { 34 | color: #71C671; 35 | border-color: #71C671; 36 | border-style: solid; 37 | box-shadow: inset 0 3px 4px #888; 38 | } 39 | #text{ 40 | margin-left: 180px; 41 | } 42 | ol{ 43 | font-size: 20px; 44 | margin-top: 20px; 45 | 46 | } 47 | li { 48 | line-height: 25px; 49 | } 50 | table{table-layout: fixed;} 51 | td{word-break: break-all; word-wrap:break-word;} 52 | footer{display:block;} -------------------------------------------------------------------------------- /table.md: -------------------------------------------------------------------------------- 1 | CREATE TABLE `wc_user`( 2 | `userid` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT '管理员ID', 3 | `username` varchar(50) NOT NULL COMMENT '管理员名称', 4 | `userpassword` varchar(32) NOT NULL COMMENT '管理员密码', 5 | `userpower` int(1) unsigned NOT NULL COMMENT '管理员权限', 6 | `loginip` varchar(30) DEFAULT NULL COMMENT '登录IP', 7 | `lastlogintime` int(10) unsigned DEFAULT NULL COMMENT '最后登录时间', 8 | `logincount` int(6) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数', 9 | PRIMARY KEY (`userid`) 10 | ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='管理员表'; 11 | 12 | 13 | 14 | CREATE TABLE `wc_content` ( 15 | `id` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', 16 | `lastid` int NOT NULL COMMENT 'lastid', 17 | `nickname`varchar(70) COMMENT '昵称', 18 | `fakeid` int NOT NULL COMMENT 'fakeid', 19 | `datetime` int NOT NULL COMMENT '时间', 20 | `content` varchar(500) COMMENT '内容', 21 | `avatar` varchar(200) NOT NULL COMMENT '头像', 22 | PRIMARY KEY (`id`) 23 | ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='内容表'; 24 | 25 | 26 | 27 | CREATE TABLE `wc_here` ( 28 | `id` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', 29 | `lastid` int NOT NULL COMMENT 'lastid', 30 | `nickname`varchar(70) COMMENT '昵称', 31 | `fakeid` int NOT NULL COMMENT 'fakeid', 32 | `datetime` int NOT NULL COMMENT '时间', 33 | `content` varchar(500) COMMENT '内容', 34 | `avatar` varchar(200) NOT NULL COMMENT '头像', 35 | PRIMARY KEY (`id`) 36 | ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='内容表'; -------------------------------------------------------------------------------- /Common/Css/nanoscroller.css: -------------------------------------------------------------------------------- 1 | /** initial setup **/ 2 | .nano { 3 | position : relative; 4 | width : 100%; 5 | height : 100%; 6 | overflow : hidden; 7 | } 8 | .nano .content { 9 | position : absolute; 10 | overflow : scroll; 11 | overflow-x : hidden; 12 | top : 0; 13 | right : 0; 14 | bottom : 0; 15 | left : 0; 16 | } 17 | .nano .content:focus { 18 | outline: thin dotted; 19 | } 20 | .nano .content::-webkit-scrollbar { 21 | visibility: hidden; 22 | } 23 | .has-scrollbar .content::-webkit-scrollbar { 24 | visibility: visible; 25 | } 26 | .nano > .pane { 27 | background : rgba(0,0,0,.25); 28 | position : absolute; 29 | width : 10px; 30 | right : 0; 31 | top : 0; 32 | bottom : 0; 33 | visibility : hidden\9; /* Target only IE7 and IE8 with this hack */ 34 | opacity : .01; 35 | -webkit-transition : .2s; 36 | -moz-transition : .2s; 37 | -o-transition : .2s; 38 | transition : .2s; 39 | -moz-border-radius : 5px; 40 | -webkit-border-radius : 5px; 41 | border-radius : 5px; 42 | } 43 | .nano > .pane > .slider { 44 | background: rgba(0,0,0,.5); 45 | position : relative; 46 | margin : 0 1px; 47 | -moz-border-radius : 3px; 48 | -webkit-border-radius : 3px; 49 | border-radius : 3px; 50 | } 51 | .nano:hover > .pane, .pane.active, .pane.flashed { 52 | visibility : visible\9; /* Target only IE7 and IE8 with this hack */ 53 | opacity : 0.99; 54 | } 55 | -------------------------------------------------------------------------------- /ThinkPHP/ThinkPHP.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // ThinkPHP 入口文件 13 | //记录开始运行时间 14 | $GLOBALS['_beginTime'] = microtime(TRUE); 15 | // 记录内存初始使用 16 | define('MEMORY_LIMIT_ON',function_exists('memory_get_usage')); 17 | if(MEMORY_LIMIT_ON) $GLOBALS['_startUseMems'] = memory_get_usage(); 18 | defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); 19 | defined('RUNTIME_PATH') or define('RUNTIME_PATH',APP_PATH.'Runtime/'); 20 | defined('APP_DEBUG') or define('APP_DEBUG',false); // 是否调试模式 21 | $runtime = defined('MODE_NAME')?'~'.strtolower(MODE_NAME).'_runtime.php':'~runtime.php'; 22 | defined('RUNTIME_FILE') or define('RUNTIME_FILE',RUNTIME_PATH.$runtime); 23 | if(!APP_DEBUG && is_file(RUNTIME_FILE)) { 24 | // 部署模式直接载入运行缓存 25 | require RUNTIME_FILE; 26 | }else{ 27 | // 系统目录定义 28 | defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__).'/'); 29 | // 加载运行时文件 30 | require THINK_PATH.'Common/runtime.php'; 31 | } -------------------------------------------------------------------------------- /ThinkPHP/Conf/debug.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 默认的调试模式配置文件 14 | * 如果项目有定义自己的调试模式配置文件,本文件无效 15 | * @category Think 16 | * @package Common 17 | * @author liu21st 18 | * @version $Id: debug.php 3071 2012-07-15 07:59:23Z liu21st@gmail.com $ 19 | */ 20 | defined('THINK_PATH') or exit(); 21 | // 调试模式下面默认设置 可以在项目配置目录下重新定义 debug.php 覆盖 22 | return array( 23 | 'LOG_RECORD' => true, // 进行日志记录 24 | 'LOG_EXCEPTION_RECORD' => true, // 是否记录异常信息日志 25 | 'LOG_LEVEL' => 'EMERG,ALERT,CRIT,ERR,WARN,NOTIC,INFO,DEBUG,SQL', // 允许记录的日志级别 26 | 'DB_FIELDS_CACHE' => false, // 字段缓存信息 27 | 'DB_SQL_LOG' => true, // 记录SQL信息 28 | 'APP_FILE_CASE' => true, // 是否检查文件的大小写 对Windows平台有效 29 | 'TMPL_CACHE_ON' => false, // 是否开启模板编译缓存,设为false则每次都会重新编译 30 | 'TMPL_STRIP_SPACE' => false, // 是否去除模板文件里面的html空格与换行 31 | 'SHOW_ERROR_MSG' => true, // 显示错误信息 32 | ); -------------------------------------------------------------------------------- /ThinkPHP/Conf/tags.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // 系统默认的核心行为扩展列表文件 13 | return array( 14 | 'app_init' => array( 15 | ), 16 | 'app_begin' => array( 17 | 'ReadHtmlCache', // 读取静态缓存 18 | ), 19 | 'route_check' => array( 20 | 'CheckRoute', // 路由检测 21 | ), 22 | 'app_end' => array(), 23 | 'path_info' => array(), 24 | 'action_begin' => array(), 25 | 'action_end' => array(), 26 | 'view_begin' => array(), 27 | 'view_template' => array( 28 | 'LocationTemplate', // 自动定位模板文件 29 | ), 30 | 'view_parse' => array( 31 | 'ParseTemplate', // 模板解析 支持PHP、内置模板引擎和第三方模板引擎 32 | ), 33 | 'view_filter' => array( 34 | 'ContentReplace', // 模板输出替换 35 | 'TokenBuild', // 表单令牌 36 | 'WriteHtmlCache', // 写入静态缓存 37 | 'ShowRuntime', // 运行时间显示 38 | ), 39 | 'view_end' => array( 40 | 'ShowPageTrace', // 页面Trace显示 41 | ), 42 | ); -------------------------------------------------------------------------------- /Home/Template/Public/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 微信活动平台 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ThinkPHP/Tpl/dispatch_jump.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 跳转提示 6 | 16 | 17 | 18 |
19 | 20 |

:)

21 |

22 | 23 |

:(

24 |

25 |
26 |

27 |

28 | 页面自动 跳转 等待时间: 29 |

30 |
31 | 43 | 44 | -------------------------------------------------------------------------------- /Home/Template/Index/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 |

CodeJam-黑客马拉松

7 | 8 |
9 |
10 |

微信活动平台

11 |
    12 |
  1. 活动发布
  2. 13 |
  3. 微信二维码扫描签到
  4. 14 |
  5. 微信墙聊天
  6. 15 |
  7. 微信抽奖。
  8. 16 |
  9. 我们可以做些什么?
  10. 17 |
18 |

19 |

作者

20 |
    21 |
  1. suziewong
  2. 22 |
  3. @酥西黄
  4. 23 |
  5. http://www.imsuzie.com
  6. 24 |
  7. zjut
  8. 25 |
26 |

27 |
28 |
29 |
30 | 31 | 44 | 45 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/Behavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP Behavior基础类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | abstract class Behavior { 20 | 21 | // 行为参数 和配置参数设置相同 22 | protected $options = array(); 23 | 24 | /** 25 | * 架构函数 26 | * @access public 27 | */ 28 | public function __construct() { 29 | if(!empty($this->options)) { 30 | foreach ($this->options as $name=>$val){ 31 | if(NULL !== C($name)) { // 参数已设置 则覆盖行为参数 32 | $this->options[$name] = C($name); 33 | }else{ // 参数未设置 则传入默认值到配置 34 | C($name,$val); 35 | } 36 | } 37 | array_change_key_case($this->options); 38 | } 39 | } 40 | 41 | // 获取行为参数 42 | public function __get($name){ 43 | return $this->options[strtolower($name)]; 44 | } 45 | 46 | /** 47 | * 执行行为 run方法是Behavior唯一的接口 48 | * @access public 49 | * @param mixed $params 行为参数 50 | * @return void 51 | */ 52 | abstract public function run(&$params); 53 | 54 | } -------------------------------------------------------------------------------- /Admin/Tpl/Index/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 后台管理 6 | 7 | 8 | 9 | 10 | 11 | 22 | 23 | 24 | 25 |
26 | 27 |
28 |
29 | 34 |
35 |
36 | 40 | 41 | 53 | 54 | -------------------------------------------------------------------------------- /Admin/Tpl/Index/left.html: -------------------------------------------------------------------------------- 1 | 18 |
19 | 49 |
50 | 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Home/Lib/Action/IndexAction.class.php: -------------------------------------------------------------------------------- 1 | query("select id,username,title,link,anonymous,time from dc_content,dc_user where dc_user.userid = dc_content.userid order by time desc "); 16 | while (list($key, $val) = each($Content)) { 17 | array_push($ContentList,$val); 18 | } 19 | import("ORG.Util.Page");// 导入分页类 20 | $count = count($ContentList);// 查询满足要求的总记录数 21 | $length = 20; 22 | $offset = $length * ($page - 1); 23 | $Page = new Page($count,$length,$page);// 实例化分页类 传入总记录数和每页显示的记录数和当前页数 24 | //$Page->setConfig('theme',' %upPage% %linkPage% %downPage%'); 25 | $Page->setConfig('prev','Older'); 26 | $Page->setConfig('next','More'); 27 | $Page->setConfig('theme',' %upPage% %downPage%'); 28 | $show = $Page->show();// 分页显示输出 29 | $this->assign("ContentList",$ContentList); 30 | $this->assign("offset",$offset); 31 | $this->assign("length",$length); 32 | $this->assign("page",$show); 33 | 34 | //$this->display(C('HOME_DEFAULT_THEME').':index'); 35 | */ 36 | $this->display(); 37 | 38 | } 39 | public function about() 40 | { 41 | $this->display(); 42 | } 43 | public function maktimes($date) 44 | { 45 | $time = strtotime($date); 46 | $t=time()-$time; 47 | $f=array( 48 | '31536000'=> '年', 49 | '2592000' => '个月', 50 | '604800' => '星期', 51 | '86400' => '天', 52 | '3600' => '小时', 53 | '60' => '分钟', 54 | '1' => '秒' 55 | ); 56 | foreach ($f as $k=>$v){ 57 | if (0 !=$c=floor($t/(int)$k)){ 58 | return $c.$v.'前'; 59 | } 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Admin/Tpl/User/add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
名 称内 容
用户类型 21 | 27 |
用户名
密码
请再输入一次密码
43 |
44 |

增加新用户

45 | 46 | 47 | 48 | 51 |
52 | 53 | 59 | 你无权访问
60 | 61 | 62 | -------------------------------------------------------------------------------- /Admin/Tpl/User/edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | ; 36 | 37 |
名 称内 容
用户类型 22 | 26 |
用户名
重置密码   (空表示不修改密码)
38 |
39 |

提交修改

40 | 41 | 42 | 43 | 46 |
47 | 48 | 54 | 你无权访问
55 | 56 | 57 | -------------------------------------------------------------------------------- /Admin/Tpl/Setting/all.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Feel 10 | 11 | 12 | 13 |
14 | 15 |
16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 |
功能设置 
前台模板 33 | 37 |  
42 |

保存设置

43 | 44 |
45 | 46 |
47 | 48 | 55 | 58 | 你无权访问
59 | 60 | 61 | -------------------------------------------------------------------------------- /Common/Css/page.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | body { 5 | margin: 0px; 6 | font-family: 'wenquanyi micro hei', 'microsoft yahei'; 7 | font-size: 20px; 8 | background: #d194d1; 9 | color: #808080; 10 | background: url("../../images/bg.jpg") center 0px no-repeat #e0e0bd; 11 | overflow-y: scroll; 12 | min-height: 800px; 13 | } 14 | #banner { 15 | padding: 10px 150px; 16 | margin-bottom: 50px; 17 | font-size: 50px; 18 | } 19 | #body { 20 | margin: 0px auto; 21 | width: 1060px; 22 | } 23 | #play { 24 | width: 70%; 25 | float: left; 26 | } 27 | #hide { 28 | width: 30%; 29 | float: left; 30 | overflow-x: hidden; 31 | height: 500px; 32 | } 33 | #wall { 34 | width: 120%; 35 | height: 100%; 36 | overflow: auto; 37 | padding: 0px 0px 300px 0px; 38 | } 39 | #wall .dj { 40 | height: 40px; 41 | margin: 10px; 42 | font-size: 16px; 43 | } 44 | #wall .dj:hover { 45 | background: #cfcf96; 46 | cursor: pointer; 47 | } 48 | #wall .dj img { 49 | width: 40px; 50 | margin-right: 15px; 51 | box-shadow: 0px 0px 20px #808080; 52 | } 53 | #wall .dj span { 54 | vertical-align: top; 55 | line-height: 40px; 56 | } 57 | #intro { 58 | height: 420px; 59 | padding: 10px; 60 | } 61 | #intro #border { 62 | width: 400px; 63 | height: 400px; 64 | text-align: center; 65 | float: left; 66 | } 67 | #intro #border img { 68 | border: 8px solid #e6e6e6; 69 | box-shadow: 0px 0px 20px #808080; 70 | } 71 | #intro #about { 72 | float: right; 73 | font-size: 15px; 74 | width: 260px; 75 | vertical-align: top; 76 | padding: 20px; 77 | line-height: 40px; 78 | } 79 | .photos { 80 | padding: 0px 10px; 81 | margin: 30px 0px; 82 | } 83 | .photos img { 84 | border: 4px solid #ccc; 85 | box-shadow: 0px 0px 10px #b3b3b3; 86 | height: 100px; 87 | } 88 | #more { 89 | padding: 10px 65px; 90 | font-size: 15px; 91 | margin-top: 20px; 92 | width: 500px; 93 | } 94 | .curr { 95 | background: #cfcf96; 96 | } 97 | .nano > .pane { 98 | background: #c3c6b9; 99 | background: rgba(0,0,0,0.25); 100 | } 101 | .nano .slider { 102 | background: #705c70; 103 | background: rgba(0,0,0,0.5); 104 | } 105 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/LocationTemplateBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:定位模板文件 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class LocationTemplateBehavior extends Behavior { 21 | // 行为扩展的执行入口必须是run 22 | public function run(&$templateFile){ 23 | // 自动定位模板文件 24 | if(!file_exists_case($templateFile)) 25 | $templateFile = $this->parseTemplateFile($templateFile); 26 | } 27 | 28 | /** 29 | * 自动定位模板文件 30 | * @access private 31 | * @param string $templateFile 文件名 32 | * @return string 33 | */ 34 | private function parseTemplateFile($templateFile) { 35 | if(''==$templateFile) { 36 | // 如果模板文件名为空 按照默认规则定位 37 | $templateFile = C('TEMPLATE_NAME'); 38 | }elseif(false === strpos($templateFile,C('TMPL_TEMPLATE_SUFFIX'))){ 39 | // 解析规则为 模板主题:模块:操作 不支持 跨项目和跨分组调用 40 | $path = explode(':',$templateFile); 41 | $action = array_pop($path); 42 | $module = !empty($path)?array_pop($path):MODULE_NAME; 43 | if(!empty($path)) {// 设置模板主题 44 | $path = dirname(THEME_PATH).'/'.array_pop($path).'/'; 45 | }else{ 46 | $path = THEME_PATH; 47 | } 48 | $templateFile = $path.$module.C('TMPL_FILE_DEPR').$action.C('TMPL_TEMPLATE_SUFFIX'); 49 | } 50 | if(!file_exists_case($templateFile)) 51 | throw_exception(L('_TEMPLATE_NOT_EXIST_').'['.$templateFile.']'); 52 | return $templateFile; 53 | } 54 | } -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/ContentReplaceBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:模板内容输出替换 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class ContentReplaceBehavior extends Behavior { 21 | // 行为参数定义 22 | protected $options = array( 23 | 'TMPL_PARSE_STRING' => array(), 24 | ); 25 | 26 | // 行为扩展的执行入口必须是run 27 | public function run(&$content){ 28 | $content = $this->templateContentReplace($content); 29 | } 30 | 31 | /** 32 | * 模板内容替换 33 | * @access protected 34 | * @param string $content 模板内容 35 | * @return string 36 | */ 37 | protected function templateContentReplace($content) { 38 | // 系统默认的特殊变量替换 39 | $replace = array( 40 | '__TMPL__' => APP_TMPL_PATH, // 项目模板目录 41 | '__ROOT__' => __ROOT__, // 当前网站地址 42 | '__APP__' => __APP__, // 当前项目地址 43 | '__GROUP__' => defined('GROUP_NAME')?__GROUP__:__APP__, 44 | '__ACTION__' => __ACTION__, // 当前操作地址 45 | '__SELF__' => __SELF__, // 当前页面地址 46 | '__URL__' => __URL__, 47 | '../Public' => APP_TMPL_PATH.'Public',// 项目公共模板目录 48 | '__PUBLIC__' => __ROOT__.'/Public',// 站点公共目录 49 | ); 50 | // 允许用户自定义模板的字符串替换 51 | if(is_array(C('TMPL_PARSE_STRING')) ) 52 | $replace = array_merge($replace,C('TMPL_PARSE_STRING')); 53 | $content = str_replace(array_keys($replace),array_values($replace),$content); 54 | return $content; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /ThinkPHP/Lang/zh-cn.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 简体中文语言包 14 | * @category Think 15 | * @package Lang 16 | * @author liu21st 17 | */ 18 | return array( 19 | // 核心 20 | '_MODULE_NOT_EXIST_' => '无法加载模块', 21 | '_ERROR_ACTION_' => '非法操作', 22 | '_LANGUAGE_NOT_LOAD_' => '无法加载语言包', 23 | '_TEMPLATE_NOT_EXIST_' => '模板不存在', 24 | '_MODULE_' => '模块', 25 | '_ACTION_' => '操作', 26 | '_ACTION_NOT_EXIST_' => '控制器不存在或者没有定义', 27 | '_MODEL_NOT_EXIST_' => '模型不存在或者没有定义', 28 | '_VALID_ACCESS_' => '没有权限', 29 | '_XML_TAG_ERROR_' => 'XML标签语法错误', 30 | '_DATA_TYPE_INVALID_' => '非法数据对象!', 31 | '_OPERATION_WRONG_' => '操作出现错误', 32 | '_NOT_LOAD_DB_' => '无法加载数据库', 33 | '_NO_DB_DRIVER_' => '无法加载数据库驱动', 34 | '_NOT_SUPPORT_DB_' => '系统暂时不支持数据库', 35 | '_NO_DB_CONFIG_' => '没有定义数据库配置', 36 | '_NOT_SUPPERT_' => '系统不支持', 37 | '_CACHE_TYPE_INVALID_' => '无法加载缓存类型', 38 | '_FILE_NOT_WRITEABLE_' => '目录(文件)不可写', 39 | '_METHOD_NOT_EXIST_' => '您所请求的方法不存在!', 40 | '_CLASS_NOT_EXIST_' => '实例化一个不存在的类!', 41 | '_CLASS_CONFLICT_' => '类名冲突', 42 | '_TEMPLATE_ERROR_' => '模板引擎错误', 43 | '_CACHE_WRITE_ERROR_' => '缓存文件写入失败!', 44 | '_TAGLIB_NOT_EXIST_' => '标签库未定义', 45 | '_OPERATION_FAIL_' => '操作失败!', 46 | '_OPERATION_SUCCESS_' => '操作成功!', 47 | '_SELECT_NOT_EXIST_' => '记录不存在!', 48 | '_EXPRESS_ERROR_' => '表达式错误', 49 | '_TOKEN_ERROR_' => '表单令牌错误', 50 | '_RECORD_HAS_UPDATE_' => '记录已经更新', 51 | '_NOT_ALLOW_PHP_' => '模板禁用PHP代码', 52 | '_PARAM_ERROR_' => '参数错误或者未定义', 53 | ); -------------------------------------------------------------------------------- /Home/Lib/Action/ApiAction.class.php: -------------------------------------------------------------------------------- 1 | getField('item_key,item_value'); 17 | echo json_encode($setting); 18 | } 19 | 20 | //返回主播信息 21 | public function dj() 22 | { 23 | $Dj = M("Dj"); 24 | $condition['id']=!empty($_GET['djid'])?$_GET['djid']:""; 25 | //var_dump($condition); 26 | if($condition['id'] == "") 27 | { 28 | $Dj = $Dj->select(); 29 | for($i=0;$iwhere($cond)->select(); 35 | for($j=0; $jwhere($condition)->select(); 54 | $cond['djid'] = $condition['id']; 55 | $Life = M("Life"); 56 | $Life = $Life->where($cond)->select(); 57 | for($i=0; $igroup('fakeid')->select(); 80 | echo json_encode($Content); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /Admin/Tpl/User/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {$SiteName}后台登陆 6 | 7 | 8 | 9 |
10 |
11 |

12 | 13 |

14 | 24 |
25 |
26 |
27 |
28 |

29 | 30 | 31 |

32 |

33 | 34 | 35 |

36 |

37 | 38 | 39 | 40 |

41 | 45 |
46 |
47 | 48 | 58 |
59 | 62 |
63 | 64 | 71 | -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Util/Cookie.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Cookie.class.php 2702 2012-02-02 12:35:01Z liu21st $ 12 | 13 | /** 14 | +------------------------------------------------------------------------------ 15 | * Cookie管理类 16 | +------------------------------------------------------------------------------ 17 | * @category Think 18 | * @package Think 19 | * @subpackage Util 20 | * @author liu21st 21 | * @version $Id: Cookie.class.php 2702 2012-02-02 12:35:01Z liu21st $ 22 | +------------------------------------------------------------------------------ 23 | */ 24 | class Cookie { 25 | // 判断Cookie是否存在 26 | static function is_set($name) { 27 | return isset($_COOKIE[C('COOKIE_PREFIX').$name]); 28 | } 29 | 30 | // 获取某个Cookie值 31 | static function get($name) { 32 | $value = $_COOKIE[C('COOKIE_PREFIX').$name]; 33 | $value = unserialize(base64_decode($value)); 34 | return $value; 35 | } 36 | 37 | // 设置某个Cookie值 38 | static function set($name,$value,$expire='',$path='',$domain='') { 39 | if($expire=='') { 40 | $expire = C('COOKIE_EXPIRE'); 41 | } 42 | if(empty($path)) { 43 | $path = C('COOKIE_PATH'); 44 | } 45 | if(empty($domain)) { 46 | $domain = C('COOKIE_DOMAIN'); 47 | } 48 | $expire = !empty($expire)? time()+$expire : 0; 49 | $value = base64_encode(serialize($value)); 50 | setcookie(C('COOKIE_PREFIX').$name, $value,$expire,$path,$domain); 51 | $_COOKIE[C('COOKIE_PREFIX').$name] = $value; 52 | } 53 | 54 | // 删除某个Cookie值 55 | static function delete($name) { 56 | Cookie::set($name,'',-3600); 57 | unset($_COOKIE[C('COOKIE_PREFIX').$name]); 58 | } 59 | 60 | // 清空Cookie值 61 | static function clear() { 62 | unset($_COOKIE); 63 | } 64 | } -------------------------------------------------------------------------------- /Admin/Tpl/Comment/add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Feel 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
名 称内 容
评论者ID
主播ID
节目评论
41 |
42 |

增加新评论

43 | 44 | 45 | 48 | 49 | 57 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/TokenBuildBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:表单令牌生成 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class TokenBuildBehavior extends Behavior { 21 | // 行为参数定义 22 | protected $options = array( 23 | 'TOKEN_ON' => false, // 开启令牌验证 24 | 'TOKEN_NAME' => '__hash__', // 令牌验证的表单隐藏字段名称 25 | 'TOKEN_TYPE' => 'md5', // 令牌验证哈希规则 26 | 'TOKEN_RESET' => true, // 令牌错误后是否重置 27 | ); 28 | 29 | public function run(&$content){ 30 | if(C('TOKEN_ON')) { 31 | if(strpos($content,'{__TOKEN__}')) { 32 | // 指定表单令牌隐藏域位置 33 | $content = str_replace('{__TOKEN__}',$this->buildToken(),$content); 34 | }elseif(preg_match('/<\/form(\s*)>/is',$content,$match)) { 35 | // 智能生成表单令牌隐藏域 36 | $content = str_replace($match[0],$this->buildToken().$match[0],$content); 37 | } 38 | }else{ 39 | $content = str_replace('{__TOKEN__}','',$content); 40 | } 41 | } 42 | 43 | // 创建表单令牌 44 | private function buildToken() { 45 | $tokenName = C('TOKEN_NAME'); 46 | $tokenType = C('TOKEN_TYPE'); 47 | if(!isset($_SESSION[$tokenName])) { 48 | $_SESSION[$tokenName] = array(); 49 | } 50 | // 标识当前页面唯一性 51 | $tokenKey = md5($_SERVER['REQUEST_URI']); 52 | if(isset($_SESSION[$tokenName][$tokenKey])) {// 相同页面不重复生成session 53 | $tokenValue = $_SESSION[$tokenName][$tokenKey]; 54 | }else{ 55 | $tokenValue = $tokenType(microtime(TRUE)); 56 | $_SESSION[$tokenName][$tokenKey] = $tokenValue; 57 | } 58 | $token = ''; 59 | return $token; 60 | } 61 | } -------------------------------------------------------------------------------- /ThinkPHP/Lang/en-us.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP English language package 14 | * @category Think 15 | * @package Lang 16 | * @author liu21st 17 | * @version $Id: zh-cn.php 3034 2012-10-17 21:14:00Z yangweijiester@gmail.com $ 18 | */ 19 | return array( 20 | // core 21 | '_MODULE_NOT_EXIST_' => 'Module can not been loaded', 22 | '_ERROR_ACTION_' => 'Error action', 23 | '_LANGUAGE_NOT_LOAD_' => 'Can\'t load language package', 24 | '_TEMPLATE_NOT_EXIST_' => 'Template does\'t exist', 25 | '_MODULE_' => 'Module', 26 | '_ACTION_' => 'Action', 27 | '_ACTION_NOT_EXIST_' => 'Action does\'t exist Or not defined', 28 | '_MODEL_NOT_EXIST_' => 'Model does\'t exist Or not defined', 29 | '_VALID_ACCESS_' => 'No access', 30 | '_XML_TAG_ERROR_' => 'XML tag syntax errors', 31 | '_DATA_TYPE_INVALID_' => 'Invlid data type!', 32 | '_OPERATION_WRONG_' => 'Operation error occurs', 33 | '_NOT_LOAD_DB_' => 'Unable to load the database', 34 | '_NO_DB_DRIVER_' => 'Unable to load database driver', 35 | '_NOT_SUPPORT_DB_' => 'The system is temporarily not support database', 36 | '_NO_DB_CONFIG_' => 'Not define the database configuration', 37 | '_NOT_SUPPERT_' => 'The system does not support', 38 | '_CACHE_TYPE_INVALID_' => 'Unable to load the cache type', 39 | '_FILE_NOT_WRITEABLE_' => 'Directory (file) is not writable', 40 | '_METHOD_NOT_EXIST_' => 'The method you requested does not exist!', 41 | '_CLASS_NOT_EXIST_' => 'Instantiating a class does not exist!', 42 | '_CLASS_CONFLICT_' => 'Class name conflicts', 43 | '_TEMPLATE_ERROR_' => 'Template Engine errors', 44 | '_CACHE_WRITE_ERROR_' => 'Cache file write failed!', 45 | '_TAGLIB_NOT_EXIST_' => 'Tag library is not defined', 46 | '_OPERATION_FAIL_' => 'Operation failed!', 47 | '_OPERATION_SUCCESS_' => 'Operation successed!', 48 | '_SELECT_NOT_EXIST_' => 'Record does not exist!', 49 | '_EXPRESS_ERROR_' => 'Expression errors', 50 | '_TOKEN_ERROR_' => 'Form\'s token errors', 51 | '_RECORD_HAS_UPDATE_' => 'Record has been updated', 52 | '_NOT_ALLOW_PHP_' => 'PHP codes are not allowed in the template', 53 | '_PARAM_ERROR_' => 'Parameter error or undefined', 54 | ); -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Util/Stack.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Stack.class.php 2662 2012-01-26 06:32:50Z liu21st $ 12 | 13 | import("ORG.Util.ArrayList"); 14 | 15 | /** 16 | +------------------------------------------------------------------------------ 17 | * Stack实现类 18 | +------------------------------------------------------------------------------ 19 | * @category ORG 20 | * @package ORG 21 | * @subpackage Util 22 | * @author liu21st 23 | * @version $Id: Stack.class.php 2662 2012-01-26 06:32:50Z liu21st $ 24 | +------------------------------------------------------------------------------ 25 | */ 26 | class Stack extends ArrayList { 27 | 28 | /** 29 | +---------------------------------------------------------- 30 | * 架构函数 31 | +---------------------------------------------------------- 32 | * @access public 33 | +---------------------------------------------------------- 34 | * @param array $values 初始化数组元素 35 | +---------------------------------------------------------- 36 | */ 37 | public function __construct($values = array()) { 38 | parent::__construct($values); 39 | } 40 | 41 | /** 42 | +---------------------------------------------------------- 43 | * 将堆栈的内部指针指向第一个单元 44 | * 45 | +---------------------------------------------------------- 46 | * @access public 47 | +---------------------------------------------------------- 48 | * @return mixed 49 | +---------------------------------------------------------- 50 | */ 51 | public function peek() { 52 | return reset($this->toArray()); 53 | } 54 | 55 | /** 56 | +---------------------------------------------------------- 57 | * 元素进栈 58 | +---------------------------------------------------------- 59 | * @access public 60 | +---------------------------------------------------------- 61 | * @param mixed $value 62 | +---------------------------------------------------------- 63 | * @return mixed 64 | +---------------------------------------------------------- 65 | */ 66 | public function push($value) { 67 | $this->add($value); 68 | return $value; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Util/Socket.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Socket.class.php 2504 2011-12-28 07:35:29Z liu21st $ 12 | 13 | class Socket { 14 | protected $_config = array( 15 | 'persistent' => false, 16 | 'host' => 'localhost', 17 | 'protocol' => 'tcp', 18 | 'port' => 80, 19 | 'timeout' => 30 20 | ); 21 | 22 | public $config = array(); 23 | public $connection = null; 24 | public $connected = false; 25 | public $error = array(); 26 | 27 | public function __construct($config = array()) { 28 | $this->config = array_merge($this->_config,$config); 29 | if (!is_numeric($this->config['protocol'])) { 30 | $this->config['protocol'] = getprotobyname($this->config['protocol']); 31 | } 32 | } 33 | 34 | public function connect() { 35 | if ($this->connection != null) { 36 | $this->disconnect(); 37 | } 38 | 39 | if ($this->config['persistent'] == true) { 40 | $tmp = null; 41 | $this->connection = @pfsockopen($this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); 42 | } else { 43 | $this->connection = fsockopen($this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); 44 | } 45 | 46 | if (!empty($errNum) || !empty($errStr)) { 47 | $this->error($errStr, $errNum); 48 | } 49 | 50 | $this->connected = is_resource($this->connection); 51 | 52 | return $this->connected; 53 | } 54 | 55 | public function error() { 56 | } 57 | 58 | public function write($data) { 59 | if (!$this->connected) { 60 | if (!$this->connect()) { 61 | return false; 62 | } 63 | } 64 | return fwrite($this->connection, $data, strlen($data)); 65 | } 66 | 67 | public function read($length=1024) { 68 | if (!$this->connected) { 69 | if (!$this->connect()) { 70 | return false; 71 | } 72 | } 73 | 74 | if (!feof($this->connection)) { 75 | return fread($this->connection, $length); 76 | } else { 77 | return false; 78 | } 79 | } 80 | 81 | public function disconnect() { 82 | if (!is_resource($this->connection)) { 83 | $this->connected = false; 84 | return true; 85 | } 86 | $this->connected = !fclose($this->connection); 87 | 88 | if (!$this->connected) { 89 | $this->connection = null; 90 | } 91 | return !$this->connected; 92 | } 93 | 94 | public function __destruct() { 95 | $this->disconnect(); 96 | } 97 | 98 | } -------------------------------------------------------------------------------- /Admin/Tpl/Setting/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Feel 10 | 11 | 12 | 13 |
14 | 15 |
16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
功能设置 
网站名字 
网站关键字 
网站描述 
ICP 
网站管理员邮箱 
63 |

保存设置

64 | 65 |
66 | 67 |
68 | 69 | 76 | 79 | 你无权访问
80 | 81 | 82 | -------------------------------------------------------------------------------- /Common/Css/login1.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | html, body, div, span, applet, object, iframe, 4 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 5 | a, abbr, acronym, address, big, cite, code, 6 | del, dfn, em, font, img, ins, kbd, q, s, samp, 7 | small, strike, strong, sub, sup, tt, var, 8 | dl, dt, dd, ol, ul, li, 9 | fieldset, form, label, legend, 10 | table, caption, tbody, tfoot, thead, tr, th, td { padding:0; margin:0; font-size:12px; line-height:100%; font-family:Arial, sans-serif;} 11 | 12 | ul, ol { list-style:none;} 13 | img { border:0;} 14 | 15 | body { margin:0; text-align:center; background:#FFF url(../default/images/login_bg.png) repeat-x top;} 16 | 17 | #login { display:block; width:950px; margin:0 auto; text-align:left;} 18 | #login_header { display:block; padding-top:40px; height:80px;} 19 | .login_logo { float:left; margin-top:10px;} 20 | .login_info { float:left; margin-left:10px; line-height:80px; font-size:18px; color:#0088cc; font-weight: bold;} 21 | .login_headerContent { float:right; display:block; width:280px; height:80px; padding:0 40px; background:url(../default/images/login_header_bg.png) no-repeat top right;} 22 | .navList { display:block; overflow:hidden; height:20px; padding-left:28px;} 23 | .navList ul { float:left; display:block; overflow:hidden;} 24 | .navList li { float:left; display:block; margin-left:-1px; padding:0 10px; background:url(../default/images/login_list.png) no-repeat 0 5px;} 25 | .navList a { display:block; white-space:nowrap; line-height:21px; color:#000; text-decoration:none;} 26 | .navList a:hover { text-decoration:underline;} 27 | 28 | #login_content { display:block; position:relative;} 29 | .login_title { display:block; padding:25px 0 0 38px;} 30 | .loginForm { display:block; width:240px; padding:40px 20px 0 20px; position:absolute; right:40px;} 31 | .loginForm p { margin:10px 0;} 32 | .loginForm label { float:left; width:70px; padding:0 0 0 10px; line-height:25px; color:#4c4c4c; font-size:14px;} 33 | .loginForm input { padding:3px 2px; border-style:solid; border-width:1px; border-color:#80a5c4;} 34 | .loginForm .login_input {} 35 | .loginForm .code { float:left; margin-right:5px;} 36 | .login_bar { padding-left:70px;} 37 | .login_bar .sub { display:block; width:75px; height:30px; border:none; background:url(../default/images/login_sub.png) no-repeat; cursor:pointer;} 38 | 39 | .login_banner { display:block; height:270px;} 40 | .login_main { display:block; height:200px; padding-right:40px; background:url(../default/images/login_content_bg.png) no-repeat top;} 41 | 42 | .helpList { float:right; width:200px;} 43 | .helpList li { display:block; padding-left:10px; background:url(../default/images/login_list.png) no-repeat 0 -40px;} 44 | .helpList a { line-height:21px; color:#333; text-decoration:none; } 45 | .helpList a:hover { text-decoration:underline;} 46 | 47 | .login_inner { display:block; width:560px; padding:30px 20px 0 20px;} 48 | .login_inner p { margin:10px 0; line-height:150%; font-size:14px; color:#666;} 49 | 50 | #login_footer { clear:both; display:block; margin-bottom:20px; padding:10px; border-top:solid 1px #e2e5e8; color:#666; text-align:center;} 51 | -------------------------------------------------------------------------------- /Common/Css/login.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | html, body, div, span, applet, object, iframe, 4 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 5 | a, abbr, acronym, address, big, cite, code, 6 | del, dfn, em, font, img, ins, kbd, q, s, samp, 7 | small, strike, strong, sub, sup, tt, var, 8 | dl, dt, dd, ol, ul, li, 9 | fieldset, form, label, legend, 10 | table, caption, tbody, tfoot, thead, tr, th, td { padding:0; margin:0; font-size:12px; line-height:100%; font-family:"微软雅黑";} 11 | 12 | ul, ol { list-style:none;} 13 | img { border:0;} 14 | 15 | body { margin:0; text-align:center; background:#FFF ;font-family:"微软雅黑";} 16 | 17 | #login { display:block; width:950px; margin:0 auto; text-align:left;} 18 | #login_header { display:block; padding-top:40px; height:80px;} 19 | .login_logo { float:left; margin-top:10px;} 20 | .login_info { float:left; margin-left:10px; line-height:80px; font-size:18px; color:#0088cc; font-weight: bold;} 21 | .login_headerContent 22 | { 23 | float:right; 24 | display:block; 25 | width:280px; 26 | height:80px; 27 | padding:0 40px; 28 | background:url(../images/login_header_bg.png) no-repeat top right; 29 | } 30 | .navList { display:block; overflow:hidden; height:20px; padding-left:28px;} 31 | .navList ul { float:left; display:block; overflow:hidden;} 32 | .navList li { float:left; display:block; margin-left:-1px; padding:0 10px; background:url(../images/login_list.png) no-repeat 0 5px;} 33 | .navList a { display:block; white-space:nowrap; line-height:21px; color:#000; text-decoration:none;} 34 | .navList a:hover { text-decoration:underline;} 35 | 36 | #login_content { display:block; position:relative;} 37 | .login_title { 38 | display:block; 39 | padding:25px 0 0 38px; 40 | font-size: 20px; 41 | } 42 | .loginForm { 43 | display:block; 44 | width:240px; 45 | padding:40px 20px 0 20px; 46 | position:absolute; 47 | right:40px; 48 | height:233px; 49 | background: #fff; 50 | } 51 | .loginForm p { margin:10px 0;} 52 | .loginForm label { float:left; width:70px; padding:0 0 0 10px; line-height:25px; color:#4c4c4c; font-size:14px;} 53 | .loginForm input { padding:3px 2px; border-style:solid; border-width:1px; border-color:#80a5c4;} 54 | .loginForm .login_input {} 55 | .loginForm .code { float:left; margin-right:5px;} 56 | .login_bar { padding-left:70px;} 57 | .login_bar .sub { display:block; width:75px; height:30px; border:none; background:url(../images/login_sub.png) no-repeat; cursor:pointer;} 58 | 59 | .login_banner { display:block; height:270px;} 60 | .login_main { display:block; height:200px; padding-right:40px; background:url(../images/login_content_bg.png) no-repeat top;} 61 | 62 | .helpList { float:right; width:200px;} 63 | .helpList li { display:block; padding-left:10px; background:url(../images/login_list.png) no-repeat 0 -40px;} 64 | .helpList a { line-height:21px; color:#333; text-decoration:none; } 65 | .helpList a:hover { text-decoration:underline;} 66 | 67 | .login_inner { display:block; width:560px; padding:30px 20px 0 20px;} 68 | .login_inner p { margin:10px 0; line-height:150%; font-size:14px; color:#666;} 69 | 70 | #login_footer { clear:both; display:block; margin-bottom:20px; padding:10px; border-top:solid 1px #e2e5e8; color:#666; text-align:center;} 71 | -------------------------------------------------------------------------------- /Admin/Tpl/Content/add.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
名 称内 容
标题
发布者ID 24 | 29 |
是否匿名
超链接
说明
45 |
46 |

增加内容

47 | 48 | 49 | 52 | 60 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Admin/Tpl/Content/edit.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
名 称内 容
标题
发布者ID 24 | 29 |
是否匿名
超链接
说明
45 |
46 |

增加内容

47 | 48 | 49 | 52 | 60 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Common/Css/overthrow.min.js: -------------------------------------------------------------------------------- 1 | /*! Overthrow v.0.1.0. An overflow:auto polyfill for responsive design. (c) 2012: Scott Jehl, Filament Group, Inc. http://filamentgroup.github.com/Overthrow/license.txt */ 2 | (function(a,b){var c=a.document,d=c.documentElement,e="overthrow-enabled",f="ontouchmove"in c,g="WebkitOverflowScrolling"in d.style||!f&&a.screen.width>1200||function(){var b=a.navigator.userAgent,c=b.match(/AppleWebKit\/([0-9]+)/),d=c&&c[1],e=c&&d>=534;return b.match(/Android ([0-9]+)/)&&RegExp.$1>=3&&e||b.match(/ Version\/([0-9]+)/)&&RegExp.$1>=0&&a.blackberry&&e||b.indexOf(/PlayBook/)>-1&&RegExp.$1>=0&&e||b.match(/Fennec\/([0-9]+)/)&&RegExp.$1>=4||b.match(/wOSBrowser\/([0-9]+)/)&&RegExp.$1>=233&&e||b.match(/NokiaBrowser\/([0-9\.]+)/)&&parseFloat(RegExp.$1)===7.3&&c&&d>=533}(),h=function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},i=!1,j,k=function(c,d){var e=0,f=c.scrollLeft,g=c.scrollTop,h={top:"+0",left:"+0",duration:100,easing:a.overthrow.easing},i,k;if(d)for(var l in h)d[l]!==b&&(h[l]=d[l]);return typeof h.left=="string"?(h.left=parseFloat(h.left),i=h.left+f):(i=h.left,h.left=h.left-f),typeof h.top=="string"?(h.top=parseFloat(h.top),k=h.top+g):(k=h.top,h.top=h.top-g),j=setInterval(function(){e++-1&&a||l(a.parentNode)},m=function(){clearInterval(j)},n=function(){if(i)return;i=!0;if(g||f)d.className+=" "+e;a.overthrow.forget=function(){d.className=d.className.replace(e,""),c.removeEventListener&&c.removeEventListener("touchstart",y,!1),a.overthrow.easing=h,i=!1};if(g||!f)return;var j,n=[],o=[],p,q,r=function(){n=[],p=null},s=function(){o=[],q=null},t=function(){var a=(n[0]-n[n.length-1])*8,b=(o[0]-o[o.length-1])*8,c=Math.max(Math.abs(b),Math.abs(a))/8;a=(a>0?"+":"")+a,b=(b>0?"+":"")+b,!isNaN(c)&&c>0&&(Math.abs(b)>80||Math.abs(a)>80)&&k(j,{left:b,top:a,duration:c})},u,v=function(a){u=j.querySelectorAll("textarea, input");for(var b=0,c=u.length;b1)return;v("none");var b=a,c=j.scrollTop,e=j.scrollLeft,f=j.offsetHeight,g=j.offsetWidth,h=a.touches[0].pageY,i=a.touches[0].pageX,k=j.scrollHeight,u=j.scrollWidth,w=function(a){var d=c+h-a.touches[0].pageY,l=e+i-a.touches[0].pageX,m=d>=(n.length?n[0]:0),t=l>=(o.length?o[0]:0);d>0&&d0&&l3&&n.pop(),o.length>3&&o.pop()},y=function(a){t(),v("auto"),setTimeout(function(){v("none")},450),j.removeEventListener("touchmove",w,!1),j.removeEventListener("touchend",y,!1)};j.addEventListener("touchmove",w,!1),j.addEventListener("touchend",y,!1)};c.addEventListener("touchstart",y,!1)};a.overthrow={set:n,forget:function(){},easing:h,toss:k,intercept:m,closest:l,support:g?"native":f&&"polyfilled"||"none"},n()})(this); -------------------------------------------------------------------------------- /Home/Template/Content/cj.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

随机抽奖

5 |
Codejam
6 |
开始抽奖啦
7 |
8 |
9 | 10 | 71 | 86 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/ThinkException.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP系统异常基类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | class ThinkException extends Exception { 20 | 21 | /** 22 | * 异常类型 23 | * @var string 24 | * @access private 25 | */ 26 | private $type; 27 | 28 | // 是否存在多余调试信息 29 | private $extra; 30 | 31 | /** 32 | * 架构函数 33 | * @access public 34 | * @param string $message 异常信息 35 | */ 36 | public function __construct($message,$code=0,$extra=false) { 37 | parent::__construct($message,$code); 38 | $this->type = get_class($this); 39 | $this->extra = $extra; 40 | } 41 | 42 | /** 43 | * 异常输出 所有异常处理类均通过__toString方法输出错误 44 | * 每次异常都会写入系统日志 45 | * 该方法可以被子类重载 46 | * @access public 47 | * @return array 48 | */ 49 | public function __toString() { 50 | $trace = $this->getTrace(); 51 | if($this->extra) 52 | // 通过throw_exception抛出的异常要去掉多余的调试信息 53 | array_shift($trace); 54 | $this->class = isset($trace[0]['class'])?$trace[0]['class']:''; 55 | $this->function = isset($trace[0]['function'])?$trace[0]['function']:''; 56 | $this->file = $trace[0]['file']; 57 | $this->line = $trace[0]['line']; 58 | $file = file($this->file); 59 | $traceInfo = ''; 60 | $time = date('y-m-d H:i:m'); 61 | foreach($trace as $t) { 62 | $traceInfo .= '['.$time.'] '.$t['file'].' ('.$t['line'].') '; 63 | $traceInfo .= $t['class'].$t['type'].$t['function'].'('; 64 | $traceInfo .= implode(', ', $t['args']); 65 | $traceInfo .=")\n"; 66 | } 67 | $error['message'] = $this->message; 68 | $error['type'] = $this->type; 69 | $error['detail'] = L('_MODULE_').'['.MODULE_NAME.'] '.L('_ACTION_').'['.ACTION_NAME.']'."\n"; 70 | $error['detail'] .= ($this->line-2).': '.$file[$this->line-3]; 71 | $error['detail'] .= ($this->line-1).': '.$file[$this->line-2]; 72 | $error['detail'] .= ''.($this->line).': '.$file[$this->line-1].''; 73 | $error['detail'] .= ($this->line+1).': '.$file[$this->line]; 74 | $error['detail'] .= ($this->line+2).': '.$file[$this->line+1]; 75 | $error['class'] = $this->class; 76 | $error['function'] = $this->function; 77 | $error['file'] = $this->file; 78 | $error['line'] = $this->line; 79 | $error['trace'] = $traceInfo; 80 | 81 | // 记录 Exception 日志 82 | if(C('LOG_EXCEPTION_RECORD')) { 83 | Log::Write('('.$this->type.') '.$this->message); 84 | } 85 | return $error ; 86 | } 87 | } -------------------------------------------------------------------------------- /ThinkPHP/README.txt: -------------------------------------------------------------------------------- 1 | [ 简介 ] 2 | ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架, 3 | 遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而 4 | 诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性 5 | 能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在 6 | 社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,众多 7 | 的典型案例确保可以稳定用于商业以及门户级的开发。 8 | 9 | 经过6年的不断积累和重构,3.0版本在框架底层的定制和扩展方面趋于完善, 10 | 使得应用的开发范围和需求适应度更加扩大,能够满足不同程度的开发人员的 11 | 需求。而且引入了全新的CBD(核心+行为+驱动)架构模式,旨在打造DIY框架 12 | 和AOP编程体验,让ThinkPHP能够在不同方面都能快速满足项目和应用的需求, 13 | 并且正式引入SAE、REST和Mongo支持。 14 | 15 | 使用ThinkPHP,你可以更方便和快捷的开发和部署应用。当然不仅仅是企业级 16 | 应用,任何PHP应用开发都可以从ThinkPHP的简单和快速的特性中受益。 17 | ThinkPHP本身具有很多的原创特性,并且倡导大道至简,开发由我的开发理念, 18 | 用最少的代码完成更多的功能,宗旨就是让WEB应用开发更简单、更快速。 19 | 为此ThinkPHP会不断吸收和融入更好的技术以保证其新鲜和活力,提供WEB应 20 | 用开发的最佳实践!经过6年来的不断重构和改进,ThinkPHP达到了一个新的 21 | 阶段,能够满足企业开发中复杂的项目需求,足以达到企业级和门户级的开 22 | 发标准。 23 | 24 | [ 协议 ] 25 | ThinkPHP遵循Apache2开源许可协议发布,意味着你可以免费使用ThinkPHP, 26 | 甚至允许把你的ThinkPHP应用采用商业闭源发布。 27 | 具体参考LICENSE.txt内容 28 | 29 | [ 特性 ] 30 | CBD架构:ThinkPHP3.0版本引入了全新的CBD(核心+行为+驱动)架构模式, 31 | 打造框架底层DIY定制和类AOP编程体验。利用这一新的特性,开发人员可以 32 | 方便地通过模式扩展为自己量身定制一套属于自己或者企业的开发框架。 33 | 编译机制:独创的项目编译机制,有效减少OOP开发中文件加载的性能开销。 34 | 改进后的项目编译机制,可以支持编译文件直接作为入口载入,并且支持常量 35 | 外部载入,利于产品发布。 36 | 37 | 类库导入:采用基于类库包和命名空间的方式导入类库,让类库导入看起来更 38 | 加简单清晰,而且还支持自动加载和别名导入。为了方便项目的跨平台移植, 39 | 系统还可以严格检查加载文件的大小写。 40 | 41 | URL和路由:系统支持普通模式、PATHINFO模式、REWRITE模式和兼容模式的 42 | URL方式,支持不同的服务器和运行模式的部署,配合URL路由功能,让你随心 43 | 所欲的构建需要的URL地址和进行SEO优化工作。支持灵活的规则路由和正则路 44 | 由,以及路由重定向支持,带给开发人员更方便灵活的URL优化体验。 45 | 调试模式:框架提供的调试模式可以方便用于开发过程的不同阶段,包括开发、 46 | 测试和演示等任何需要的情况,不同的应用模式可以配置独立的项目配置文件。 47 | 只是小小的性能牺牲就能满足调试开发过程中的日志和分析需要,并确保将来的 48 | 部署顺利,一旦切换到部署模式则可以迅速提升性能。 49 | 50 | ORM :简洁轻巧的ORM实现,配合简单的CURD以及AR模式,让开发效率无处不在。 51 | 52 | 数据库:支持包括Mysql、Sqlite、Pgsql、Oracle、SqlServer、Mongo等数据库, 53 | 并且内置分布式数据库和读写分离功能支持。系统支持多数据库连接和动态切换 54 | 机制,犹如企业开发的一把利刃,跨数据库应用和分布式支持从此无忧。 55 | 56 | 查询语言:内建丰富的查询机制,包括组合查询、快捷查询、复合查询、区间 57 | 查询、统计查询、定位查询、多表查询、子查询、动态查询和原生查询,让你的 58 | 数据查询简洁高效。 59 | 60 | 动态模型:无需创建任何对应的模型类,轻松完成CURD操作,支持多种模型之间 61 | 的动态切换,让你领略数据操作的无比畅快和最佳体验。 62 | 63 | 扩展模型:提供了丰富的扩展模型,包括:支持序列化字段、文本字段、只读字 64 | 段、延迟写入、乐观锁、数据分表等高级特性的高级模型;可以轻松动态地创建 65 | 数据库视图的视图模型;支持关联操作的关联模型;支持Mongo数据库的Mongo模 66 | 型等等,都可以方便的使用。 67 | 68 | 模块分组:不用担心大项目的分工协调和部署问题,分组帮你解决跨项目的难题, 69 | 还可以支持对分组的二级域名部署支持。 70 | 71 | 模板引擎:系统内建了一款卓越的基于XML的编译型模板引擎,支持两种类型的 72 | 模板标签,融合了Smarty和JSP标签库的思想,并内置布局模板功能和标签库扩展 73 | 支持。通过驱动还可以支持Smarty、EaseTemplate、TemplateLite、Smart等其他第 74 | 三方模板引擎。 75 | 76 | AJAX支持:内置和客户端无关的AJAX数据返回方法,支持JSON、XML和EVAL类型 77 | 返回客户端,而且可以扩展返回数据格式,系统不绑定任何AJAX类库,可随意使 78 | 用自己熟悉的AJAX类库进行操作。 79 | 80 | SAE支持:提供了新浪SAE平台的强力支持,具备“横跨性”和“平滑性”,支持本地化 81 | 开发和调试以及部署切换,让你轻松过渡到SAE开发,打造全新的SAE开发体验。 82 | 83 | RESTFul支持:REST模式提供了RESTFul支持,为你打造全新的URL设计和访问体验, 84 | 同时为接口应用提供了支持。 85 | 86 | 多语言支持:系统支持语言包功能,项目和分组都可以有单独的语言包,并且可以 87 | 自动检测浏览器语言自动载入对应的语言包。 88 | 89 | 模式扩展:除了标准模式外,还提供了AMF、PHPRpc、Lite、Thin和Cli模式扩展支 90 | 持,针对不同级别的应用开发提供最佳核心框架,还可以自定义模式扩展。 91 | 92 | 自动验证和完成:自动完成表单数据的验证和过滤,新版新增了IP验证和有效期验 93 | 证等更多的验证方式,配合自动完成可以生成安全的数据对象。 94 | 95 | 字段类型检测:系统会自动缓存字段信息和字段类型,支持非法字段过滤和字段类 96 | 型强制转换,确保数据写入和查询更安全。 97 | 98 | 缓存机制:系统支持包括文件方式、APC、Db、Memcache、Shmop、Sqlite、Redis、 99 | Eaccelerator和Xcache在内的动态数据缓存类型,以及可定制的静态缓存规则,并 100 | 提供了快捷方法进行存取操作。 101 | 102 | 扩展机制:系统支持包括模式扩展、行为扩展、类库扩展、驱动扩展、模型扩展、 103 | 控制器扩展、Widget扩展在内的强大灵活的扩展机制,让你不再受限于核心的不足 104 | 和无所适从,随心DIY自己的框架和扩展应用,满足企业开发中更加复杂的项目需求。 105 | 106 | [ 要求 ] 107 | ThinkPHP3.1需要PHP5.2.0以上版本支持,可以运行在任何系统环境下面。 108 | 109 | [ 安装 ] 110 | ThinkPHP无需安装,下载ThinkPHP核心包或者完整版之后,把解压后的目录拷贝到 111 | 你的WEB服务器或者WEB目录即可。 112 | 113 | [ 鸣谢 ] 114 | 特别要鸣谢ThinkPHP团队和所有关注和支持ThinkPHP的用户。 115 | 116 | [ 支持 ] 117 | 更多内容和支持请访问ThinkPHP官方网站http://thinkphp.cn/ 和论坛 http://bbs.thinkphp.cn。 -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Crypt/Hmac.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Hmac.class.php 2504 2011-12-28 07:35:29Z liu21st $ 12 | 13 | /** 14 | +------------------------------------------------------------------------------ 15 | * HMAC 加密实现类 16 | +------------------------------------------------------------------------------ 17 | * @category ORG 18 | * @package ORG 19 | * @subpackage Crypt 20 | * @author cevin 21 | * @version $Id: Hmac.class.php 2504 2011-12-28 07:35:29Z liu21st $ 22 | +------------------------------------------------------------------------------ 23 | */ 24 | class Hmac { 25 | 26 | /** 27 | +---------------------------------------------------------- 28 | * SHA1加密 29 | +---------------------------------------------------------- 30 | * @access static 31 | +---------------------------------------------------------- 32 | * @param string $key 加密key 33 | * @param string $str 字符串 34 | +---------------------------------------------------------- 35 | * @return string 36 | +---------------------------------------------------------- 37 | * @throws ThinkExecption 38 | +---------------------------------------------------------- 39 | */ 40 | public static function sha1($key,$str) { 41 | $blocksize=64; 42 | $hashfunc='sha1'; 43 | if (strlen($key)>$blocksize) 44 | $key=pack('H*', $hashfunc($key)); 45 | $key=str_pad($key,$blocksize,chr(0x00)); 46 | $ipad=str_repeat(chr(0x36),$blocksize); 47 | $opad=str_repeat(chr(0x5c),$blocksize); 48 | $hmac = pack( 49 | 'H*',$hashfunc( 50 | ($key^$opad).pack( 51 | 'H*',$hashfunc( 52 | ($key^$ipad).$str 53 | ) 54 | ) 55 | ) 56 | ); 57 | return $hmac; 58 | } 59 | 60 | /** 61 | +---------------------------------------------------------- 62 | * MD5加密 63 | +---------------------------------------------------------- 64 | * @access static 65 | +---------------------------------------------------------- 66 | * @param string $key 加密key 67 | * @param string $str 字符串 68 | +---------------------------------------------------------- 69 | * @return string 70 | +---------------------------------------------------------- 71 | * @throws ThinkExecption 72 | +---------------------------------------------------------- 73 | */ 74 | public static function md5($key, $str) { 75 | $b = 64; 76 | if (strlen($key) > $b) { 77 | $key = pack("H*",md5($key)); 78 | } 79 | 80 | $key = str_pad($key, $b, chr(0x00)); 81 | $ipad = str_pad('', $b, chr(0x36)); 82 | $opad = str_pad('', $b, chr(0x5c)); 83 | $k_ipad = $key ^ $ipad ; 84 | $k_opad = $key ^ $opad; 85 | 86 | return md5($k_opad . pack("H*",md5($k_ipad . $str))); 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/ShowRuntimeBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:运行时间信息显示 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class ShowRuntimeBehavior extends Behavior { 21 | // 行为参数定义 22 | protected $options = array( 23 | 'SHOW_RUN_TIME' => false, // 运行时间显示 24 | 'SHOW_ADV_TIME' => false, // 显示详细的运行时间 25 | 'SHOW_DB_TIMES' => false, // 显示数据库查询和写入次数 26 | 'SHOW_CACHE_TIMES' => false, // 显示缓存操作次数 27 | 'SHOW_USE_MEM' => false, // 显示内存开销 28 | 'SHOW_LOAD_FILE' => false, // 显示加载文件数 29 | 'SHOW_FUN_TIMES' => false , // 显示函数调用次数 30 | ); 31 | 32 | // 行为扩展的执行入口必须是run 33 | public function run(&$content){ 34 | if(C('SHOW_RUN_TIME')){ 35 | if(false !== strpos($content,'{__NORUNTIME__}')) { 36 | $content = str_replace('{__NORUNTIME__}','',$content); 37 | }else{ 38 | $runtime = $this->showTime(); 39 | if(strpos($content,'{__RUNTIME__}')) 40 | $content = str_replace('{__RUNTIME__}',$runtime,$content); 41 | else 42 | $content .= $runtime; 43 | } 44 | }else{ 45 | $content = str_replace(array('{__NORUNTIME__}','{__RUNTIME__}'),'',$content); 46 | } 47 | } 48 | 49 | /** 50 | * 显示运行时间、数据库操作、缓存次数、内存使用信息 51 | * @access private 52 | * @return string 53 | */ 54 | private function showTime() { 55 | // 显示运行时间 56 | G('beginTime',$GLOBALS['_beginTime']); 57 | G('viewEndTime'); 58 | $showTime = 'Process: '.G('beginTime','viewEndTime').'s '; 59 | if(C('SHOW_ADV_TIME')) { 60 | // 显示详细运行时间 61 | $showTime .= '( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )'; 62 | } 63 | if(C('SHOW_DB_TIMES') && class_exists('Db',false) ) { 64 | // 显示数据库操作次数 65 | $showTime .= ' | DB :'.N('db_query').' queries '.N('db_write').' writes '; 66 | } 67 | if(C('SHOW_CACHE_TIMES') && class_exists('Cache',false)) { 68 | // 显示缓存读写次数 69 | $showTime .= ' | Cache :'.N('cache_read').' gets '.N('cache_write').' writes '; 70 | } 71 | if(MEMORY_LIMIT_ON && C('SHOW_USE_MEM')) { 72 | // 显示内存开销 73 | $showTime .= ' | UseMem:'. number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024).' kb'; 74 | } 75 | if(C('SHOW_LOAD_FILE')) { 76 | $showTime .= ' | LoadFile:'.count(get_included_files()); 77 | } 78 | if(C('SHOW_FUN_TIMES')) { 79 | $fun = get_defined_functions(); 80 | $showTime .= ' | CallFun:'.count($fun['user']).','.count($fun['internal']); 81 | } 82 | return $showTime; 83 | } 84 | } -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Crypt/Base64.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Base64.class.php 2504 2011-12-28 07:35:29Z liu21st $ 12 | 13 | /** 14 | +------------------------------------------------------------------------------ 15 | * Base64 加密实现类 16 | +------------------------------------------------------------------------------ 17 | * @category ORG 18 | * @package ORG 19 | * @subpackage Crypt 20 | * @author liu21st 21 | * @version $Id: Base64.class.php 2504 2011-12-28 07:35:29Z liu21st $ 22 | +------------------------------------------------------------------------------ 23 | */ 24 | class Base64 { 25 | 26 | /** 27 | +---------------------------------------------------------- 28 | * 加密字符串 29 | +---------------------------------------------------------- 30 | * @access static 31 | +---------------------------------------------------------- 32 | * @param string $str 字符串 33 | * @param string $key 加密key 34 | +---------------------------------------------------------- 35 | * @return string 36 | +---------------------------------------------------------- 37 | * @throws ThinkExecption 38 | +---------------------------------------------------------- 39 | */ 40 | public static function encrypt($data,$key) { 41 | $key = md5($key); 42 | $data = base64_encode($data); 43 | $x=0; 44 | $len = strlen($data); 45 | $l = strlen($key); 46 | for ($i=0;$i< $len;$i++) { 47 | if ($x== $l) $x=0; 48 | $char .=substr($key,$x,1); 49 | $x++; 50 | } 51 | for ($i=0;$i< $len;$i++) { 52 | $str .=chr(ord(substr($data,$i,1))+(ord(substr($char,$i,1)))%256); 53 | } 54 | return $str; 55 | } 56 | 57 | /** 58 | +---------------------------------------------------------- 59 | * 解密字符串 60 | +---------------------------------------------------------- 61 | * @access static 62 | +---------------------------------------------------------- 63 | * @param string $str 字符串 64 | * @param string $key 加密key 65 | +---------------------------------------------------------- 66 | * @return string 67 | +---------------------------------------------------------- 68 | * @throws ThinkExecption 69 | +---------------------------------------------------------- 70 | */ 71 | public static function decrypt($data,$key) { 72 | $key = md5($key); 73 | $x=0; 74 | $len = strlen($data); 75 | $l = strlen($key); 76 | for ($i=0;$i< $len;$i++) { 77 | if ($x== $l) $x=0; 78 | $char .=substr($key,$x,1); 79 | $x++; 80 | } 81 | for ($i=0;$i< $len;$i++) { 82 | if (ord(substr($data,$i,1)) 10 | // +---------------------------------------------------------------------- 11 | // $Id: Crypt.class.php 2504 2011-12-28 07:35:29Z liu21st $ 12 | 13 | 14 | /** 15 | +------------------------------------------------------------------------------ 16 | * Crypt 加密实现类 17 | +------------------------------------------------------------------------------ 18 | * @category ORG 19 | * @package ORG 20 | * @subpackage Crypt 21 | * @author liu21st 22 | * @version $Id: Crypt.class.php 2504 2011-12-28 07:35:29Z liu21st $ 23 | +------------------------------------------------------------------------------ 24 | */ 25 | class Crypt { 26 | 27 | /** 28 | +---------------------------------------------------------- 29 | * 加密字符串 30 | +---------------------------------------------------------- 31 | * @access static 32 | +---------------------------------------------------------- 33 | * @param string $str 字符串 34 | * @param string $key 加密key 35 | +---------------------------------------------------------- 36 | * @return string 37 | +---------------------------------------------------------- 38 | * @throws ThinkExecption 39 | +---------------------------------------------------------- 40 | */ 41 | function encrypt($str,$key,$toBase64=false){ 42 | $r = md5($key); 43 | $c=0; 44 | $v = ""; 45 | $len = strlen($str); 46 | $l = strlen($r); 47 | for ($i=0;$i<$len;$i++){ 48 | if ($c== $l) $c=0; 49 | $v.= substr($r,$c,1) . 50 | (substr($str,$i,1) ^ substr($r,$c,1)); 51 | $c++; 52 | } 53 | if($toBase64) { 54 | return base64_encode(self::ed($v,$key)); 55 | }else { 56 | return self::ed($v,$key); 57 | } 58 | 59 | } 60 | 61 | /** 62 | +---------------------------------------------------------- 63 | * 解密字符串 64 | +---------------------------------------------------------- 65 | * @access static 66 | +---------------------------------------------------------- 67 | * @param string $str 字符串 68 | * @param string $key 加密key 69 | +---------------------------------------------------------- 70 | * @return string 71 | +---------------------------------------------------------- 72 | * @throws ThinkExecption 73 | +---------------------------------------------------------- 74 | */ 75 | function decrypt($str,$key,$toBase64=false) { 76 | if($toBase64) { 77 | $str = self::ed(base64_decode($str),$key); 78 | }else { 79 | $str = self::ed($str,$key); 80 | } 81 | $v = ""; 82 | $len = strlen($str); 83 | for ($i=0;$i<$len;$i++){ 84 | $md5 = substr($str,$i,1); 85 | $i++; 86 | $v.= (substr($str,$i,1) ^ $md5); 87 | } 88 | return $v; 89 | } 90 | 91 | 92 | function ed($str,$key) { 93 | $r = md5($key); 94 | $c=0; 95 | $v = ""; 96 | $len = strlen($str); 97 | $l = strlen($r); 98 | for ($i=0;$i<$len;$i++) { 99 | if ($c==$l) $c=0; 100 | $v.= substr($str,$i,1) ^ substr($r,$c,1); 101 | $c++; 102 | } 103 | return $v; 104 | } 105 | } -------------------------------------------------------------------------------- /Admin/Lib/Action/SettingAction.class.php: -------------------------------------------------------------------------------- 1 | item = isset($_REQUEST['item']) ? $_REQUEST['item'] : '0'; 7 | $this->assign("item",$this->item); 8 | } 9 | 10 | // 显示网站设置的基本配置页面 11 | public function basic(){ 12 | $this->assign("jumpUrl","__SELF__"); 13 | 14 | if(isset($_POST['feel'])){ 15 | 16 | if ($this->_update($_POST['feel'])) { 17 | //成功提示 18 | $this->success('基本配置修改成功'); 19 | } else { 20 | //错误提示 21 | $this->error('基本配置修改失败'); 22 | } 23 | 24 | } else { 25 | $model = M("Setting"); 26 | //$setting = $model->where("item='".$this->item."'")->getField('item_key,item_value'); 27 | $setting = $model->getField('item_key,item_value'); 28 | $this->assign("feel",$setting); 29 | $this->display(); 30 | } 31 | } 32 | // 全局设置 33 | public function all() 34 | { 35 | 36 | if(isset($_POST['all'])) { 37 | $v=$_POST['all']['theme']; 38 | $tmp = file_get_contents(CONF_PATH.'config.php'); 39 | $tmp = preg_replace("/'HOME_DEFAULT_THEME'\s*\=\>\s*'.*?'\,/is", "'HOME_DEFAULT_THEME' => '".$v."',", $tmp); 40 | if(file_put_contents(CONF_PATH.'config.php',$tmp)) 41 | { 42 | @unlink(RUNTIME_PATH.'~runtime.php'); 43 | // 更新数据 44 | //if ($this->_update($_POST['all'])) { 45 | //成功提示 46 | $this->success('全局设置修改成功'); 47 | //} else { 48 | //错误提示 49 | // $this->error('全局设置修改失败'); 50 | //} 51 | } else $this->error('全局设置修改失败'); 52 | } 53 | else 54 | { 55 | $all =array(); 56 | $all['theme'] = C('HOME_DEFAULT_THEME'); 57 | $this->assign("all",$all); 58 | $this->display(); 59 | } 60 | } 61 | 62 | protected function _update($settingarr, $item = '') { 63 | if($item == '') $item = $this->item; 64 | $setting = M('Setting'); 65 | $setting->where("item='".$item."'")->delete(); 66 | $data = array(); 67 | foreach($settingarr as $k => $v) { 68 | if(is_array($v)) $v = implode(',', $v); 69 | $data['item_key'] = $k; 70 | $data['item_value'] = $v; 71 | $result = $setting->add($data); 72 | if(false === $result) return false; 73 | } 74 | return true; 75 | } 76 | public function clear() 77 | { 78 | // $_POST['cache']=2; 79 | if(session('userpower') == 0) 80 | { 81 | if($_POST['cache'] == 2) 82 | { 83 | $dir = $_SERVER['DOCUMENT_ROOT'].__ROOT__."/Admin/Runtime/"; 84 | if(is_dir($dir)) 85 | { 86 | $info = $this->deldir($dir); 87 | } 88 | $msg = '后台'; 89 | } 90 | if($_POST['cache'] == 1) 91 | { 92 | $dir = $_SERVER['DOCUMENT_ROOT'].__ROOT__."/Home/Runtime/"; 93 | if(is_dir($dir)) 94 | { 95 | $info = $this->deldir($dir); 96 | } 97 | $msg = '前台'; 98 | } 99 | if($info == 1) 100 | { 101 | $msg='清除'.$msg.'缓存成功!'; 102 | echo "{"; 103 | echo "\"msg\":\"".$msg."\""; 104 | echo "}"; 105 | } 106 | else 107 | { 108 | $msg='清除失败!'; 109 | echo "{"; 110 | echo "\"msg\":\"".$msg."\""; 111 | echo "}"; 112 | } 113 | } 114 | else 115 | { 116 | $msg='你木有权限,修改失败!'; 117 | echo "{"; 118 | echo "\"msg\":\"".$msg."\""; 119 | echo "}"; 120 | } 121 | } 122 | 123 | protected function deldir($dir) { 124 | //先删除目录下的文件: 125 | 126 | $dh=opendir($dir); 127 | while ($file=readdir($dh)) { 128 | if($file!="." && $file!="..") { 129 | $fullpath=$dir."/".$file; 130 | if(!is_dir($fullpath)) { 131 | unlink($fullpath); 132 | } else { 133 | $this->deldir($fullpath); 134 | } 135 | } 136 | } 137 | 138 | closedir($dh); 139 | //删除当前文件夹: 140 | if(rmdir($dir)) { 141 | return true; 142 | } else { 143 | return false; 144 | } 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/Cache.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * 缓存管理类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | class Cache { 20 | 21 | /** 22 | * 操作句柄 23 | * @var string 24 | * @access protected 25 | */ 26 | protected $handler ; 27 | 28 | /** 29 | * 缓存连接参数 30 | * @var integer 31 | * @access protected 32 | */ 33 | protected $options = array(); 34 | 35 | /** 36 | * 连接缓存 37 | * @access public 38 | * @param string $type 缓存类型 39 | * @param array $options 配置数组 40 | * @return object 41 | */ 42 | public function connect($type='',$options=array()) { 43 | if(empty($type)) $type = C('DATA_CACHE_TYPE'); 44 | $type = strtolower(trim($type)); 45 | $class = 'Cache'.ucwords($type); 46 | if(class_exists($class)) 47 | $cache = new $class($options); 48 | else 49 | throw_exception(L('_CACHE_TYPE_INVALID_').':'.$type); 50 | return $cache; 51 | } 52 | 53 | public function __get($name) { 54 | return $this->get($name); 55 | } 56 | 57 | public function __set($name,$value) { 58 | return $this->set($name,$value); 59 | } 60 | 61 | public function __unset($name) { 62 | $this->rm($name); 63 | } 64 | public function setOptions($name,$value) { 65 | $this->options[$name] = $value; 66 | } 67 | 68 | public function getOptions($name) { 69 | return $this->options[$name]; 70 | } 71 | 72 | /** 73 | * 取得缓存类实例 74 | * @static 75 | * @access public 76 | * @return mixed 77 | */ 78 | static function getInstance() { 79 | $param = func_get_args(); 80 | return get_instance_of(__CLASS__,'connect',$param); 81 | } 82 | 83 | /** 84 | * 队列缓存 85 | * @access protected 86 | * @param string $key 队列名 87 | * @return mixed 88 | */ 89 | // 90 | protected function queue($key) { 91 | static $_handler = array( 92 | 'file' => array('F','F'), 93 | 'xcache'=> array('xcache_get','xcache_set'), 94 | 'apc' => array('apc_fetch','apc_store'), 95 | ); 96 | $queue = isset($this->options['queue'])?$this->options['queue']:'file'; 97 | $fun = isset($_handler[$queue])?$_handler[$queue]:$_handler['file']; 98 | $queue_name=isset($this->options['queue_name'])?$this->options['queue_name']:'think_queue'; 99 | $value = $fun[0]($queue_name); 100 | if(!$value) { 101 | $value = array(); 102 | } 103 | // 进列 104 | if(false===array_search($key, $value)) array_push($value,$key); 105 | if(count($value) > $this->options['length']) { 106 | // 出列 107 | $key = array_shift($value); 108 | // 删除缓存 109 | $this->rm($key); 110 | if(APP_DEUBG){ 111 | //调试模式下,记录出列次数 112 | N($queue_name.'_out_times',1,true); 113 | } 114 | } 115 | return $fun[1]($queue_name,$value); 116 | } 117 | 118 | public function __call($method,$args){ 119 | //调用缓存类型自己的方法 120 | if(method_exists($this->handler, $method)){ 121 | return call_user_func_array(array($this->handler,$method), $args); 122 | }else{ 123 | throw_exception(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_')); 124 | return; 125 | } 126 | } 127 | } -------------------------------------------------------------------------------- /Admin/Tpl/User/manage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 |
选择ID用户名类型操作
{$user.userid}{$user.username}管理员普通用户 29 | 编辑 30 | 删除 31 |
38 |
39 | 48 |
49 | {$page} 50 |
51 |
52 | 53 | 56 |
57 | 你无权访问
58 | 59 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/Widget.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP Widget类 抽象类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | abstract class Widget { 20 | 21 | // 使用的模板引擎 每个Widget可以单独配置不受系统影响 22 | protected $template = ''; 23 | 24 | /** 25 | * 渲染输出 render方法是Widget唯一的接口 26 | * 使用字符串返回 不能有任何输出 27 | * @access public 28 | * @param mixed $data 要渲染的数据 29 | * @return string 30 | */ 31 | abstract public function render($data); 32 | 33 | /** 34 | * 渲染模板输出 供render方法内部调用 35 | * @access public 36 | * @param string $templateFile 模板文件 37 | * @param mixed $var 模板变量 38 | * @return string 39 | */ 40 | protected function renderFile($templateFile='',$var='') { 41 | ob_start(); 42 | ob_implicit_flush(0); 43 | if(!file_exists_case($templateFile)){ 44 | // 自动定位模板文件 45 | $name = substr(get_class($this),0,-6); 46 | $filename = empty($templateFile)?$name:$templateFile; 47 | $templateFile = BASE_LIB_PATH.'Widget/'.$name.'/'.$filename.C('TMPL_TEMPLATE_SUFFIX'); 48 | if(!file_exists_case($templateFile)) 49 | throw_exception(L('_TEMPLATE_NOT_EXIST_').'['.$templateFile.']'); 50 | } 51 | $template = strtolower($this->template?$this->template:(C('TMPL_ENGINE_TYPE')?C('TMPL_ENGINE_TYPE'):'php')); 52 | if('php' == $template) { 53 | // 使用PHP模板 54 | if(!empty($var)) extract($var, EXTR_OVERWRITE); 55 | // 直接载入PHP模板 56 | include $templateFile; 57 | }elseif('think'==$template){ // 采用Think模板引擎 58 | if($this->checkCache($templateFile)) { // 缓存有效 59 | // 分解变量并载入模板缓存 60 | extract($var, EXTR_OVERWRITE); 61 | //载入模版缓存文件 62 | include C('CACHE_PATH').md5($templateFile).C('TMPL_CACHFILE_SUFFIX'); 63 | }else{ 64 | $tpl = Think::instance('ThinkTemplate'); 65 | // 编译并加载模板文件 66 | $tpl->fetch($templateFile,$var); 67 | } 68 | }else{ 69 | $class = 'Template'.ucwords($template); 70 | if(is_file(CORE_PATH.'Driver/Template/'.$class.'.class.php')) { 71 | // 内置驱动 72 | $path = CORE_PATH; 73 | }else{ // 扩展驱动 74 | $path = EXTEND_PATH; 75 | } 76 | require_cache($path.'Driver/Template/'.$class.'.class.php'); 77 | $tpl = new $class; 78 | $tpl->fetch($templateFile,$var); 79 | } 80 | $content = ob_get_clean(); 81 | return $content; 82 | } 83 | 84 | /** 85 | * 检查缓存文件是否有效 86 | * 如果无效则需要重新编译 87 | * @access public 88 | * @param string $tmplTemplateFile 模板文件名 89 | * @return boolen 90 | */ 91 | protected function checkCache($tmplTemplateFile) { 92 | if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测 93 | return false; 94 | $tmplCacheFile = C('CACHE_PATH').md5($tmplTemplateFile).C('TMPL_CACHFILE_SUFFIX'); 95 | if(!is_file($tmplCacheFile)){ 96 | return false; 97 | }elseif (filemtime($tmplTemplateFile) > filemtime($tmplCacheFile)) { 98 | // 模板文件如果有更新则缓存需要更新 99 | return false; 100 | }elseif (C('TMPL_CACHE_TIME') != 0 && time() > filemtime($tmplCacheFile)+C('TMPL_CACHE_TIME')) { 101 | // 缓存是否在有效期 102 | return false; 103 | } 104 | // 缓存有效 105 | return true; 106 | } 107 | } -------------------------------------------------------------------------------- /Admin/Tpl/Comment/edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Feel 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 |
名 称内 容
节目名称
栏目类型 36 | 42 |
节目主播
节目简介
[字数小于200字]
编号
上传MP3
留空表示不修改
60 | 61 |
66 |
67 |

提交编辑

68 | 69 | 70 | 78 | 81 |
82 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Admin/Tpl/Content/manage.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 |
选择ID标题发布人日期操作
{$Content.id}{$Content.title}{$Content.username}{$Content.time} 30 | 编辑 31 | 删除 32 |
39 |
40 |
41 | 42 | 46 |
47 |
48 | {$page} 49 |
50 |
51 | 52 | 55 |
56 | 57 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/View.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * ThinkPHP 视图类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | class View { 20 | /** 21 | * 模板输出变量 22 | * @var tVar 23 | * @access protected 24 | */ 25 | protected $tVar = array(); 26 | 27 | /** 28 | * 模板变量赋值 29 | * @access public 30 | * @param mixed $name 31 | * @param mixed $value 32 | */ 33 | public function assign($name,$value=''){ 34 | if(is_array($name)) { 35 | $this->tVar = array_merge($this->tVar,$name); 36 | }else { 37 | $this->tVar[$name] = $value; 38 | } 39 | } 40 | 41 | /** 42 | * 取得模板变量的值 43 | * @access public 44 | * @param string $name 45 | * @return mixed 46 | */ 47 | public function get($name=''){ 48 | if('' === $name) { 49 | return $this->tVar; 50 | } 51 | return isset($this->tVar[$name])?$this->tVar[$name]:false; 52 | } 53 | 54 | /** 55 | * 加载模板和页面输出 可以返回输出内容 56 | * @access public 57 | * @param string $templateFile 模板文件名 58 | * @param string $charset 模板输出字符集 59 | * @param string $contentType 输出类型 60 | * @param string $content 模板输出内容 61 | * @param string $prefix 模板缓存前缀 62 | * @return mixed 63 | */ 64 | public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') { 65 | G('viewStartTime'); 66 | // 视图开始标签 67 | tag('view_begin',$templateFile); 68 | // 解析并获取模板内容 69 | $content = $this->fetch($templateFile,$content,$prefix); 70 | // 输出模板内容 71 | $this->render($content,$charset,$contentType); 72 | // 视图结束标签 73 | tag('view_end'); 74 | } 75 | 76 | /** 77 | * 输出内容文本可以包括Html 78 | * @access private 79 | * @param string $content 输出内容 80 | * @param string $charset 模板输出字符集 81 | * @param string $contentType 输出类型 82 | * @return mixed 83 | */ 84 | private function render($content,$charset='',$contentType=''){ 85 | if(empty($charset)) $charset = C('DEFAULT_CHARSET'); 86 | if(empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE'); 87 | // 网页字符编码 88 | header('Content-Type:'.$contentType.'; charset='.$charset); 89 | header('Cache-control: '.C('HTTP_CACHE_CONTROL')); // 页面缓存控制 90 | header('X-Powered-By:ThinkPHP'); 91 | // 输出模板文件 92 | echo $content; 93 | } 94 | 95 | /** 96 | * 解析和获取模板内容 用于输出 97 | * @access public 98 | * @param string $templateFile 模板文件名 99 | * @param string $content 模板输出内容 100 | * @param string $prefix 模板缓存前缀 101 | * @return string 102 | */ 103 | public function fetch($templateFile='',$content='',$prefix='') { 104 | if(empty($content)) { 105 | // 模板文件解析标签 106 | tag('view_template',$templateFile); 107 | // 模板文件不存在直接返回 108 | if(!is_file($templateFile)) return NULL; 109 | } 110 | // 页面缓存 111 | ob_start(); 112 | ob_implicit_flush(0); 113 | if('php' == strtolower(C('TMPL_ENGINE_TYPE'))) { // 使用PHP原生模板 114 | // 模板阵列变量分解成为独立变量 115 | extract($this->tVar, EXTR_OVERWRITE); 116 | // 直接载入PHP模板 117 | empty($content)?include $templateFile:eval('?>'.$content); 118 | }else{ 119 | // 视图解析标签 120 | $params = array('var'=>$this->tVar,'file'=>$templateFile,'content'=>$content,'prefix'=>$prefix); 121 | tag('view_parse',$params); 122 | } 123 | // 获取并清空缓存 124 | $content = ob_get_clean(); 125 | // 内容过滤标签 126 | tag('view_filter',$content); 127 | // 输出模板文件 128 | return $content; 129 | } 130 | } -------------------------------------------------------------------------------- /ThinkPHP/Lib/Core/Log.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | /** 13 | * 日志处理类 14 | * @category Think 15 | * @package Think 16 | * @subpackage Core 17 | * @author liu21st 18 | */ 19 | class Log { 20 | 21 | // 日志级别 从上到下,由低到高 22 | const EMERG = 'EMERG'; // 严重错误: 导致系统崩溃无法使用 23 | const ALERT = 'ALERT'; // 警戒性错误: 必须被立即修改的错误 24 | const CRIT = 'CRIT'; // 临界值错误: 超过临界值的错误,例如一天24小时,而输入的是25小时这样 25 | const ERR = 'ERR'; // 一般错误: 一般性错误 26 | const WARN = 'WARN'; // 警告性错误: 需要发出警告的错误 27 | const NOTICE = 'NOTIC'; // 通知: 程序可以运行但是还不够完美的错误 28 | const INFO = 'INFO'; // 信息: 程序输出信息 29 | const DEBUG = 'DEBUG'; // 调试: 调试信息 30 | const SQL = 'SQL'; // SQL:SQL语句 注意只在调试模式开启时有效 31 | 32 | // 日志记录方式 33 | const SYSTEM = 0; 34 | const MAIL = 1; 35 | const FILE = 3; 36 | const SAPI = 4; 37 | 38 | // 日志信息 39 | static $log = array(); 40 | 41 | // 日期格式 42 | static $format = '[ c ]'; 43 | 44 | /** 45 | * 记录日志 并且会过滤未经设置的级别 46 | * @static 47 | * @access public 48 | * @param string $message 日志信息 49 | * @param string $level 日志级别 50 | * @param boolean $record 是否强制记录 51 | * @return void 52 | */ 53 | static function record($message,$level=self::ERR,$record=false) { 54 | if($record || false !== strpos(C('LOG_LEVEL'),$level)) { 55 | self::$log[] = "{$level}: {$message}\r\n"; 56 | } 57 | } 58 | 59 | /** 60 | * 日志保存 61 | * @static 62 | * @access public 63 | * @param integer $type 日志记录方式 64 | * @param string $destination 写入目标 65 | * @param string $extra 额外参数 66 | * @return void 67 | */ 68 | static function save($type='',$destination='',$extra='') { 69 | if(empty(self::$log)) return ; 70 | $type = $type?$type:C('LOG_TYPE'); 71 | if(self::FILE == $type) { // 文件方式记录日志信息 72 | if(empty($destination)) 73 | $destination = LOG_PATH.date('y_m_d').'.log'; 74 | //检测日志文件大小,超过配置大小则备份日志文件重新生成 75 | if(is_file($destination) && floor(C('LOG_FILE_SIZE')) <= filesize($destination) ) 76 | rename($destination,dirname($destination).'/'.time().'-'.basename($destination)); 77 | }else{ 78 | $destination = $destination?$destination:C('LOG_DEST'); 79 | $extra = $extra?$extra:C('LOG_EXTRA'); 80 | } 81 | $now = date(self::$format); 82 | error_log($now.' '.get_client_ip().' '.$_SERVER['REQUEST_URI']."\r\n".implode('',self::$log)."\r\n", $type,$destination ,$extra); 83 | // 保存后清空日志缓存 84 | self::$log = array(); 85 | //clearstatcache(); 86 | } 87 | 88 | /** 89 | * 日志直接写入 90 | * @static 91 | * @access public 92 | * @param string $message 日志信息 93 | * @param string $level 日志级别 94 | * @param integer $type 日志记录方式 95 | * @param string $destination 写入目标 96 | * @param string $extra 额外参数 97 | * @return void 98 | */ 99 | static function write($message,$level=self::ERR,$type='',$destination='',$extra='') { 100 | $now = date(self::$format); 101 | $type = $type?$type:C('LOG_TYPE'); 102 | if(self::FILE == $type) { // 文件方式记录日志 103 | if(empty($destination)) 104 | $destination = LOG_PATH.date('y_m_d').'.log'; 105 | //检测日志文件大小,超过配置大小则备份日志文件重新生成 106 | if(is_file($destination) && floor(C('LOG_FILE_SIZE')) <= filesize($destination) ) 107 | rename($destination,dirname($destination).'/'.time().'-'.basename($destination)); 108 | }else{ 109 | $destination = $destination?$destination:C('LOG_DEST'); 110 | $extra = $extra?$extra:C('LOG_EXTRA'); 111 | } 112 | error_log("{$now} {$level}: {$message}\r\n", $type,$destination,$extra ); 113 | //clearstatcache(); 114 | } 115 | } -------------------------------------------------------------------------------- /Home/Lib/Action/UserAction.class.php: -------------------------------------------------------------------------------- 1 | display(); 9 | } 10 | 11 | public function checklogin() 12 | { 13 | $username = $_POST["username"]; 14 | $password = md5($_POST["password"]); 15 | $User = M("User"); 16 | $condition['username'] = $username; 17 | $user_info = $User->where($condition)->find(); 18 | // 数据库操作 19 | 20 | //exit; 21 | if($user_info) 22 | { 23 | if($password == $user_info['userpassword'] ) 24 | { 25 | // 设置登录信息 26 | session('userid',$user_info['userid']); 27 | session('username',$user_info['username']); 28 | session('userpower',$user_info['userpower']); 29 | session('lastlogintime',$user_info['lastlogintime']); 30 | 31 | // 更新帐号登录信息 32 | $loginip = get_client_ip(); 33 | $data = array('loginip'=>$loginip,'lastlogintime'=>time(),'logincount'=>$user_info['logincount']+1); 34 | $condition['userid'] = $user_info['userid']; 35 | $User->where($condition)->setField($data); 36 | 37 | redirect(U('Index/index')); 38 | //$this->success("登录成功",'../Index/index'); 39 | //$this->assign('jumpUrl',U('Index/index')); 40 | //$this->display(THINK_PATH.'Tpl/dispatch_jump.tpl'); 41 | //echo json_encode(array("msg" => 'succeess登录成功!', "result" => '1')); 42 | } 43 | else 44 | { 45 | $msg = '密码错误,请重新输入'; 46 | 47 | } // end if password 48 | } 49 | else 50 | { 51 | $msg ='用户名不存在'; 52 | } // end if admin 53 | $this->assign('message',$msg);// 提示信息 54 | // 成功操作后默认停留1秒 55 | $this->assign('waitSecond','1'); 56 | // 登出成功返回登录页面 57 | $this->assign('jumpUrl',U('User/login')); 58 | $this->display(THINK_PATH.'Tpl/dispatch_jump.tpl'); 59 | } 60 | /* 61 | 精弘账号 62 | */ 63 | public function jhchecklogin() 64 | { 65 | $username = $_POST['username']; 66 | $password = $_POST['password']; 67 | $url = "http://user.zjut.com/api.php?app=member&action=login&username=".$username."&password=".$password; 68 | $result = json_decode(file_get_contents($url)); 69 | // 设置登录信息 70 | /*var_dump($result); 71 | exit;*/ 72 | if($result->state == "success") 73 | { 74 | session('uid',$result->data->uid); 75 | session('username',$result->data->username); 76 | session('email',$result->data->email); 77 | session('avatar',$result->data->avatar); 78 | redirect(U('Index/index')); 79 | } 80 | else 81 | { 82 | //错误提示 83 | $this->error('用户登录失败',U('User/login')); 84 | } 85 | 86 | } 87 | public function jhlogout() 88 | { 89 | if(session('userid')) { 90 | session('userid',null); 91 | session('username',null); 92 | session('email',null); 93 | session('avatar',null); 94 | redirect(U('Index/index')); 95 | }else { 96 | $this->error('已经登出!'); 97 | } 98 | } 99 | 100 | public function logout() 101 | { 102 | if(session('userid')) { 103 | session('userid',null); 104 | session('verify',null); 105 | session('username',null); 106 | session('userpower',null); 107 | session('lastlogintime',null); 108 | redirect(U('Index/index')); 109 | }else { 110 | $this->error('已经登出!'); 111 | } 112 | } 113 | /* 114 | 注册用户 115 | */ 116 | public function register() 117 | { 118 | if(isset($_POST['username'])) 119 | { 120 | $data = array(); 121 | $data['username'] = $_POST['username']; 122 | $data['userpassword'] = md5($_POST['password']); 123 | $data['userpower'] = 1; 124 | $user = M('User'); 125 | $result = $user->add($data); 126 | if($result) 127 | { 128 | //成功提示 129 | redirect(U('Index/index')); 130 | } else { 131 | //错误提示 132 | $this->error('增加用户失败'); 133 | } 134 | } 135 | $this->display(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /Admin/Lib/Action/ContentAction.class.php: -------------------------------------------------------------------------------- 1 | add($data); 21 | if ( $result ){ 22 | //成功提示 23 | $this->success('增加内容成功',U('Content/manage')); 24 | } 25 | else{ 26 | //错误提示 27 | $this->error('增加内容失败'); 28 | } 29 | } 30 | else 31 | { 32 | $User = M("User"); 33 | $User = $User->field('userid,username')->select(); 34 | $this->assign("UserList",$User); 35 | $this->display(); 36 | } 37 | } 38 | public function manage() 39 | { 40 | 41 | if(isset($_POST['duoxuanHidden'])) { 42 | $id = $_POST['duoxuanHidden']; 43 | 44 | $model = M("Content"); 45 | $map['id'] = array('in',$id); 46 | $mp3s = $model->where($map)->select(); 47 | $mp3length = count($mp3s); 48 | for($i=0;$i<$mp3length;$i++) 49 | { 50 | $this->del_file($mp3s[$i]['mp3address']); 51 | } 52 | $result = $model->where($map)->delete(); 53 | } 54 | $ContentList = array(); 55 | 56 | //$Content = M("Content"); 57 | $page = isset($_GET['p'])? $_GET['p'] : '1'; //默认显示首页数据 58 | 59 | //$Content= $Content->order('contentid asc')->select(); 60 | $Model = new Model(); 61 | $Content = $Model->query("select id,username,title,link,time from dc_content,dc_user where dc_user.userid = dc_content.userid"); 62 | while (list($key, $val) = each($Content)) { 63 | array_push($ContentList,$val); 64 | } 65 | import("ORG.Util.Page");// 导入分页类 66 | $count = count($ContentList);// 查询满足要求的总记录数 67 | $length = 10; 68 | $offset = $length * ($page - 1); 69 | $Page = new Page($count,$length,$page);// 实例化分页类 传入总记录数和每页显示的记录数和当前页数 70 | $Page->setConfig('theme',' %upPage% %linkPage% %downPage%'); 71 | $show = $Page->show();// 分页显示输出 72 | $this->assign("ContentList",$ContentList); 73 | $this->assign("offset",$offset); 74 | $this->assign("length",$length); 75 | $this->assign("page",$show); 76 | $this->display(); 77 | 78 | } 79 | public function edit() 80 | { 81 | 82 | if(isset($_POST["contentid"])) 83 | { 84 | $data = array(); 85 | $data["title"] = $_POST["title"]; 86 | $data["userid"] = $_POST["userid"]; 87 | $data["anonymous"] = empty($_POST["anonymous"])?0:1; 88 | $data["link"] = $_POST["link"]; 89 | $data["time"] = date("Y-m-d H:i:s"); 90 | 91 | 92 | $Content = M('Content'); 93 | if(isset($_POST['id'])) 94 | { 95 | $condition['id'] = $_POST['id']; 96 | 97 | //编辑数据 98 | $result = $Content->where($condition)->save($data); 99 | if ($result) 100 | { 101 | //成功提示 102 | $this->success('编辑内容成功',U('Content/manage')); 103 | } 104 | else 105 | { 106 | //错误提示 107 | $this->error('编辑内容失败',U('Content/manage')); 108 | } 109 | } 110 | } 111 | else 112 | { 113 | $contentid = $_GET['id']; 114 | $Content = M("Content"); 115 | $condition['id'] = $_GET['id']; 116 | $Content = $Content->where($condition)->find(); 117 | $this->assign("Content",$Content); 118 | 119 | $Class = M("Class"); 120 | $Class = $Class->field('classid,classname')->select(); 121 | $this->assign("ClassList",$Class); 122 | $this->display(); 123 | } 124 | } 125 | public function del() 126 | { 127 | $this->assign("jumpUrl",U('Content/manage')); 128 | $contentid = $_GET['id']; 129 | //echo $contentid; 130 | //exit; 131 | $condition['id'] = $contentid; 132 | $Content = M('Content'); 133 | 134 | $result = $Content->where($condition)->delete(); 135 | if ($result) { 136 | //成功提示 137 | $this->success('删除成功'); 138 | } else { 139 | //错误提示 140 | $this->error('删除失败'); 141 | } 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /Admin/Tpl/Comment/suggest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 给feel电台提的建议 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 52 | 53 | 54 | 55 | 56 |
57 | 62 |
63 |
64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 88 | 89 | 90 | 91 | 92 | 93 |
选择ID昵称邮箱建议提交时间操作
{$Suggest.id}{$Suggest.name}{$Suggest.email}{$Suggest.suggest}{$Suggest.posttime|date='Y-m-d H:i:s',###} 86 | 删除 87 |
94 |
95 |
96 | 97 | 101 |
102 |
103 | {$page} 104 |
105 |
106 | 107 | 110 |
111 | 112 | 113 | -------------------------------------------------------------------------------- /Admin/Tpl/Comment/manage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 评论管理 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 52 | 53 | 54 | 55 | 56 |
57 | 62 |
63 |
64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
选择ID主播名评论评论时间操作
{$Comment.id}{$Comment.name}{$Comment.comment}{$Comment.posttime|date='Y-m-d H:i:s',###} 87 | 删除 88 |
96 |
97 |
98 | 99 | 103 |
104 |
105 | {$page} 106 |
107 |
108 | 109 | 112 |
113 | 114 | 115 | -------------------------------------------------------------------------------- /ThinkPHP/Tpl/page_trace.tpl: -------------------------------------------------------------------------------- 1 |
2 | 24 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /Admin/Tpl/Index/header.html: -------------------------------------------------------------------------------- 1 | 7 | 8 |

后台管理

9 | 11 | 30 | 57 | 65 | -------------------------------------------------------------------------------- /Admin/Tpl/Live/add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Feel 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
名 称内 容
直播名称
主播(用英文逗号分开)
开始时间 41 |
42 | 43 | 44 | 45 | 46 | 47 |
48 |
结束时间 53 |
54 | 55 | 56 | 57 | 58 | 59 |
60 |
节目简介
68 |
69 |

增加新节目

70 | 71 | 72 | 75 | 76 | 84 | 98 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /ThinkPHP/Extend/Library/ORG/Util/Debug.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id: Debug.class.php 2702 2012-02-02 12:35:01Z liu21st $ 12 | 13 | /** 14 | +------------------------------------------------------------------------------ 15 | * 系统调试类 16 | +------------------------------------------------------------------------------ 17 | * @category Think 18 | * @package Think 19 | * @subpackage Util 20 | * @author liu21st 21 | * @version $Id: Debug.class.php 2702 2012-02-02 12:35:01Z liu21st $ 22 | +------------------------------------------------------------------------------ 23 | */ 24 | class Debug { 25 | 26 | static private $marker = array(); 27 | /** 28 | +---------------------------------------------------------- 29 | * 标记调试位 30 | +---------------------------------------------------------- 31 | * @access public 32 | +---------------------------------------------------------- 33 | * @param string $name 要标记的位置名称 34 | +---------------------------------------------------------- 35 | * @return void 36 | +---------------------------------------------------------- 37 | */ 38 | static public function mark($name) { 39 | self::$marker['time'][$name] = microtime(TRUE); 40 | if(MEMORY_LIMIT_ON) { 41 | self::$marker['mem'][$name] = memory_get_usage(); 42 | self::$marker['peak'][$name] = function_exists('memory_get_peak_usage')?memory_get_peak_usage(): self::$marker['mem'][$name]; 43 | } 44 | } 45 | 46 | /** 47 | +---------------------------------------------------------- 48 | * 区间使用时间查看 49 | +---------------------------------------------------------- 50 | * @access public 51 | +---------------------------------------------------------- 52 | * @param string $start 开始标记的名称 53 | * @param string $end 结束标记的名称 54 | * @param integer $decimals 时间的小数位 55 | +---------------------------------------------------------- 56 | * @return integer 57 | +---------------------------------------------------------- 58 | */ 59 | static public function useTime($start,$end,$decimals = 6) { 60 | if ( ! isset(self::$marker['time'][$start])) 61 | return ''; 62 | if ( ! isset(self::$marker['time'][$end])) 63 | self::$marker['time'][$end] = microtime(TRUE); 64 | return number_format(self::$marker['time'][$end] - self::$marker['time'][$start], $decimals); 65 | } 66 | 67 | /** 68 | +---------------------------------------------------------- 69 | * 区间使用内存查看 70 | +---------------------------------------------------------- 71 | * @access public 72 | +---------------------------------------------------------- 73 | * @param string $start 开始标记的名称 74 | * @param string $end 结束标记的名称 75 | +---------------------------------------------------------- 76 | * @return integer 77 | +---------------------------------------------------------- 78 | */ 79 | static public function useMemory($start,$end) { 80 | if(!MEMORY_LIMIT_ON) 81 | return ''; 82 | if ( ! isset(self::$marker['mem'][$start])) 83 | return ''; 84 | if ( ! isset(self::$marker['mem'][$end])) 85 | self::$marker['mem'][$end] = memory_get_usage(); 86 | return number_format((self::$marker['mem'][$end] - self::$marker['mem'][$start])/1024); 87 | } 88 | 89 | /** 90 | +---------------------------------------------------------- 91 | * 区间使用内存峰值查看 92 | +---------------------------------------------------------- 93 | * @access public 94 | +---------------------------------------------------------- 95 | * @param string $start 开始标记的名称 96 | * @param string $end 结束标记的名称 97 | +---------------------------------------------------------- 98 | * @return integer 99 | +---------------------------------------------------------- 100 | */ 101 | static function getMemPeak($start,$end) { 102 | if(!MEMORY_LIMIT_ON) 103 | return ''; 104 | if ( ! isset(self::$marker['peak'][$start])) 105 | return ''; 106 | if ( ! isset(self::$marker['peak'][$end])) 107 | self::$marker['peak'][$end] = function_exists('memory_get_peak_usage')?memory_get_peak_usage(): memory_get_usage(); 108 | return number_format(max(self::$marker['peak'][$start],self::$marker['peak'][$end])/1024); 109 | } 110 | } -------------------------------------------------------------------------------- /Admin/Tpl/Live/edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Feel 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 50 | 51 | 52 | 53 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
名 称内 容
直播名称
主播
开始时间 42 |
43 | 44 | 45 | 46 | 47 | 48 |
49 |
结束时间 54 |
55 | 56 | 57 | 58 | 59 | 60 |
61 |
节目简介
69 |
70 |

提交编辑

71 | 72 | 73 | 76 | 77 | 85 | 99 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/ParseTemplateBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:模板解析 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class ParseTemplateBehavior extends Behavior { 21 | // 行为参数定义(默认值) 可在项目配置中覆盖 22 | protected $options = array( 23 | // 布局设置 24 | 'TMPL_ENGINE_TYPE' => 'Think', // 默认模板引擎 以下设置仅对使用Think模板引擎有效 25 | 'TMPL_CACHFILE_SUFFIX' => '.php', // 默认模板缓存后缀 26 | 'TMPL_DENY_FUNC_LIST' => 'echo,exit', // 模板引擎禁用函数 27 | 'TMPL_DENY_PHP' => false, // 默认模板引擎是否禁用PHP原生代码 28 | 'TMPL_L_DELIM' => '{', // 模板引擎普通标签开始标记 29 | 'TMPL_R_DELIM' => '}', // 模板引擎普通标签结束标记 30 | 'TMPL_VAR_IDENTIFY' => 'array', // 模板变量识别。留空自动判断,参数为'obj'则表示对象 31 | 'TMPL_STRIP_SPACE' => true, // 是否去除模板文件里面的html空格与换行 32 | 'TMPL_CACHE_ON' => true, // 是否开启模板编译缓存,设为false则每次都会重新编译 33 | 'TMPL_CACHE_PREFIX' => '', // 模板缓存前缀标识,可以动态改变 34 | 'TMPL_CACHE_TIME' => 0, // 模板缓存有效期 0 为永久,(以数字为值,单位:秒) 35 | 'TMPL_LAYOUT_ITEM' => '{__CONTENT__}', // 布局模板的内容替换标识 36 | 'LAYOUT_ON' => false, // 是否启用布局 37 | 'LAYOUT_NAME' => 'layout', // 当前布局名称 默认为layout 38 | 39 | // Think模板引擎标签库相关设定 40 | 'TAGLIB_BEGIN' => '<', // 标签库标签开始标记 41 | 'TAGLIB_END' => '>', // 标签库标签结束标记 42 | 'TAGLIB_LOAD' => true, // 是否使用内置标签库之外的其它标签库,默认自动检测 43 | 'TAGLIB_BUILD_IN' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序 44 | 'TAGLIB_PRE_LOAD' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔 45 | ); 46 | 47 | // 行为扩展的执行入口必须是run 48 | public function run(&$_data){ 49 | $engine = strtolower(C('TMPL_ENGINE_TYPE')); 50 | $_content = empty($_data['content'])?$_data['file']:$_data['content']; 51 | $_data['prefix'] = !empty($_data['prefix'])?$_data['prefix']:C('TMPL_CACHE_PREFIX'); 52 | if('think'==$engine){ // 采用Think模板引擎 53 | if((!empty($_data['content']) && $this->checkContentCache($_data['content'],$_data['prefix'])) 54 | || $this->checkCache($_data['file'],$_data['prefix'])) { // 缓存有效 55 | // 分解变量并载入模板缓存 56 | extract($_data['var'], EXTR_OVERWRITE); 57 | //载入模版缓存文件 58 | include C('CACHE_PATH').$_data['prefix'].md5($_content).C('TMPL_CACHFILE_SUFFIX'); 59 | }else{ 60 | $tpl = Think::instance('ThinkTemplate'); 61 | // 编译并加载模板文件 62 | $tpl->fetch($_content,$_data['var'],$_data['prefix']); 63 | } 64 | }else{ 65 | // 调用第三方模板引擎解析和输出 66 | $class = 'Template'.ucwords($engine); 67 | if(class_exists($class)) { 68 | $tpl = new $class; 69 | $tpl->fetch($_content,$_data['var']); 70 | }else { // 类没有定义 71 | throw_exception(L('_NOT_SUPPERT_').': ' . $class); 72 | } 73 | } 74 | } 75 | 76 | /** 77 | * 检查缓存文件是否有效 78 | * 如果无效则需要重新编译 79 | * @access public 80 | * @param string $tmplTemplateFile 模板文件名 81 | * @return boolen 82 | */ 83 | protected function checkCache($tmplTemplateFile,$prefix='') { 84 | if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测 85 | return false; 86 | $tmplCacheFile = C('CACHE_PATH').$prefix.md5($tmplTemplateFile).C('TMPL_CACHFILE_SUFFIX'); 87 | if(!is_file($tmplCacheFile)){ 88 | return false; 89 | }elseif (filemtime($tmplTemplateFile) > filemtime($tmplCacheFile)) { 90 | // 模板文件如果有更新则缓存需要更新 91 | return false; 92 | }elseif (C('TMPL_CACHE_TIME') != 0 && time() > filemtime($tmplCacheFile)+C('TMPL_CACHE_TIME')) { 93 | // 缓存是否在有效期 94 | return false; 95 | } 96 | // 开启布局模板 97 | if(C('LAYOUT_ON')) { 98 | $layoutFile = THEME_PATH.C('LAYOUT_NAME').C('TMPL_TEMPLATE_SUFFIX'); 99 | if(filemtime($layoutFile) > filemtime($tmplCacheFile)) { 100 | return false; 101 | } 102 | } 103 | // 缓存有效 104 | return true; 105 | } 106 | 107 | /** 108 | * 检查缓存内容是否有效 109 | * 如果无效则需要重新编译 110 | * @access public 111 | * @param string $tmplContent 模板内容 112 | * @return boolen 113 | */ 114 | protected function checkContentCache($tmplContent,$prefix='') { 115 | if(is_file(C('CACHE_PATH').$prefix.md5($tmplContent).C('TMPL_CACHFILE_SUFFIX'))){ 116 | return true; 117 | }else{ 118 | return false; 119 | } 120 | } 121 | } -------------------------------------------------------------------------------- /ThinkPHP/Lib/Behavior/ReadHtmlCacheBehavior.class.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | defined('THINK_PATH') or exit(); 13 | /** 14 | * 系统行为扩展:静态缓存读取 15 | * @category Think 16 | * @package Think 17 | * @subpackage Behavior 18 | * @author liu21st 19 | */ 20 | class ReadHtmlCacheBehavior extends Behavior { 21 | protected $options = array( 22 | 'HTML_CACHE_ON' => false, 23 | 'HTML_CACHE_TIME' => 60, 24 | 'HTML_CACHE_RULES' => array(), 25 | 'HTML_FILE_SUFFIX' => '.html', 26 | ); 27 | 28 | // 行为扩展的执行入口必须是run 29 | public function run(&$params){ 30 | // 开启静态缓存 31 | if(C('HTML_CACHE_ON')) { 32 | $cacheTime = $this->requireHtmlCache(); 33 | if( false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME,$cacheTime)) { //静态页面有效 34 | // 读取静态页面输出 35 | readfile(HTML_FILE_NAME); 36 | exit(); 37 | } 38 | } 39 | } 40 | 41 | // 判断是否需要静态缓存 42 | static private function requireHtmlCache() { 43 | // 分析当前的静态规则 44 | $htmls = C('HTML_CACHE_RULES'); // 读取静态规则 45 | if(!empty($htmls)) { 46 | $htmls = array_change_key_case($htmls); 47 | // 静态规则文件定义格式 actionName=>array('静态规则','缓存时间','附加规则') 48 | // 'read'=>array('{id},{name}',60,'md5') 必须保证静态规则的唯一性 和 可判断性 49 | // 检测静态规则 50 | $moduleName = strtolower(MODULE_NAME); 51 | $actionName = strtolower(ACTION_NAME); 52 | if(isset($htmls[$moduleName.':'.$actionName])) { 53 | $html = $htmls[$moduleName.':'.$actionName]; // 某个模块的操作的静态规则 54 | }elseif(isset($htmls[$moduleName.':'])){// 某个模块的静态规则 55 | $html = $htmls[$moduleName.':']; 56 | }elseif(isset($htmls[$actionName])){ 57 | $html = $htmls[$actionName]; // 所有操作的静态规则 58 | }elseif(isset($htmls['*'])){ 59 | $html = $htmls['*']; // 全局静态规则 60 | }elseif(isset($htmls['empty:index']) && !class_exists(MODULE_NAME.'Action')){ 61 | $html = $htmls['empty:index']; // 空模块静态规则 62 | }elseif(isset($htmls[$moduleName.':_empty']) && $this->isEmptyAction(MODULE_NAME,ACTION_NAME)){ 63 | $html = $htmls[$moduleName.':_empty']; // 空操作静态规则 64 | } 65 | if(!empty($html)) { 66 | // 解读静态规则 67 | $rule = $html[0]; 68 | // 以$_开头的系统变量 69 | $rule = preg_replace('/{\$(_\w+)\.(\w+)\|(\w+)}/e',"\\3(\$\\1['\\2'])",$rule); 70 | $rule = preg_replace('/{\$(_\w+)\.(\w+)}/e',"\$\\1['\\2']",$rule); 71 | // {ID|FUN} GET变量的简写 72 | $rule = preg_replace('/{(\w+)\|(\w+)}/e',"\\2(\$_GET['\\1'])",$rule); 73 | $rule = preg_replace('/{(\w+)}/e',"\$_GET['\\1']",$rule); 74 | // 特殊系统变量 75 | $rule = str_ireplace( 76 | array('{:app}','{:module}','{:action}','{:group}'), 77 | array(APP_NAME,MODULE_NAME,ACTION_NAME,defined('GROUP_NAME')?GROUP_NAME:''), 78 | $rule); 79 | // {|FUN} 单独使用函数 80 | $rule = preg_replace('/{|(\w+)}/e',"\\1()",$rule); 81 | if(!empty($html[2])) $rule = $html[2]($rule); // 应用附加函数 82 | $cacheTime = isset($html[1])?$html[1]:C('HTML_CACHE_TIME'); // 缓存有效期 83 | // 当前缓存文件 84 | define('HTML_FILE_NAME',HTML_PATH . $rule.C('HTML_FILE_SUFFIX')); 85 | return $cacheTime; 86 | } 87 | } 88 | // 无需缓存 89 | return false; 90 | } 91 | 92 | /** 93 | * 检查静态HTML文件是否有效 94 | * 如果无效需要重新更新 95 | * @access public 96 | * @param string $cacheFile 静态文件名 97 | * @param integer $cacheTime 缓存有效期 98 | * @return boolen 99 | */ 100 | static public function checkHTMLCache($cacheFile='',$cacheTime='') { 101 | if(!is_file($cacheFile)){ 102 | return false; 103 | }elseif (filemtime(C('TEMPLATE_NAME')) > filemtime($cacheFile)) { 104 | // 模板文件如果更新静态文件需要更新 105 | return false; 106 | }elseif(!is_numeric($cacheTime) && function_exists($cacheTime)){ 107 | return $cacheTime($cacheFile); 108 | }elseif ($cacheTime != 0 && NOW_TIME > filemtime($cacheFile)+$cacheTime) { 109 | // 文件是否在有效期 110 | return false; 111 | } 112 | //静态文件有效 113 | return true; 114 | } 115 | 116 | //检测是否是空操作 117 | static private function isEmptyAction($module,$action) { 118 | $className = $module.'Action'; 119 | $class = new $className; 120 | return !method_exists($class,$action); 121 | } 122 | 123 | } --------------------------------------------------------------------------------