├── assets ├── doit │ ├── js │ │ ├── calendar │ │ │ ├── skin │ │ │ │ ├── WdatePicker.css │ │ │ │ ├── calendar.png │ │ │ │ ├── default │ │ │ │ │ ├── img.gif │ │ │ │ │ ├── index.html │ │ │ │ │ └── datepicker.css │ │ │ │ └── index.html │ │ │ ├── config.js │ │ │ ├── lang │ │ │ │ ├── en.js │ │ │ │ ├── zh-cn.js │ │ │ │ ├── zh-tw.js │ │ │ │ └── index.html │ │ │ ├── index.html │ │ │ ├── calendar.html │ │ │ └── WdatePicker.js │ │ ├── index.html │ │ └── jquery │ │ │ ├── index.html │ │ │ ├── jquery.checkbox.min.js │ │ │ └── jquery.lazyload.min.js │ ├── images │ │ ├── ajax_loading_big.gif │ │ ├── ajax_loading_ring.gif │ │ ├── ajax_loading_small.gif │ │ ├── ajax_loading_snake.gif │ │ ├── index.html │ │ ├── doitphp_pagelist_default.min.css │ │ └── doitphp_pagelist_classic.min.css │ └── index.html ├── css │ └── index.html ├── index.html ├── js │ └── index.html └── images │ └── index.html ├── doitphp ├── vendors │ ├── calendar │ │ ├── skin │ │ │ ├── WdatePicker.css │ │ │ ├── calendar.png │ │ │ ├── default │ │ │ │ ├── img.gif │ │ │ │ ├── index.html │ │ │ │ └── datepicker.css │ │ │ └── index.html │ │ ├── config.js │ │ ├── lang │ │ │ ├── en.js │ │ │ ├── index.html │ │ │ ├── zh-cn.js │ │ │ └── zh-tw.js │ │ ├── index.html │ │ └── calendar.html │ ├── index.html │ └── jquery │ │ ├── index.html │ │ ├── jquery.checkbox.min.js │ │ └── jquery.lazyload.min.js ├── views │ ├── source │ │ ├── aispec.ttf │ │ ├── watermark.bmp │ │ ├── watermark.gif │ │ ├── watermark.jpg │ │ ├── watermark.png │ │ └── index.html │ ├── images │ │ ├── ajax_loading_big.gif │ │ ├── ajax_loading_ring.gif │ │ ├── ajax_loading_small.gif │ │ ├── ajax_loading_snake.gif │ │ ├── index.html │ │ ├── doitphp_pagelist_default.min.css │ │ └── doitphp_pagelist_classic.min.css │ ├── errors │ │ ├── error404.html │ │ ├── index.html │ │ ├── exception.php │ │ └── message.php │ └── index.html ├── index.html ├── core │ ├── index.html │ ├── DoitException.php │ ├── Log.php │ ├── Extension.php │ ├── WidgetTemplate.php │ ├── Configure.php │ └── Response.php └── library │ ├── index.html │ ├── cache │ ├── index.html │ ├── File.php │ ├── Redis.php │ ├── Memcached.php │ └── Memcache.php │ ├── FileDownload.php │ ├── Xml.php │ ├── Language.php │ ├── Csv.php │ ├── Benchmark.php │ ├── FileUpload.php │ ├── Cookie.php │ ├── Calendar.php │ ├── Session.php │ ├── Client.php │ ├── Validation.php │ ├── Tree.php │ ├── Excel.php │ ├── Security.php │ ├── Curl.php │ ├── Ftp.php │ └── MongoDb.php ├── cache ├── index.html ├── data │ └── index.html ├── temp │ └── index.html ├── htmls │ └── index.html ├── models │ └── index.html └── views │ └── index.html ├── logs └── index.html ├── application ├── index.html ├── config │ ├── index.html │ └── application.php ├── language │ └── index.html ├── library │ └── index.html ├── models │ └── index.html ├── modules │ └── index.html ├── views │ └── index.html ├── widgets │ ├── index.html │ └── views │ │ └── index.html ├── controllers │ ├── index.html │ └── IndexController.php └── extensions │ └── index.html ├── robots.txt ├── readme.txt ├── .gitattributes ├── index.php ├── README.md ├── license.txt └── .gitignore /assets/doit/js/calendar/skin/WdatePicker.css: -------------------------------------------------------------------------------- 1 | .doitphp_calendar{background:#FFF url(calendar.png) no-repeat right center;} -------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/WdatePicker.css: -------------------------------------------------------------------------------- 1 | .doitphp_calendar{background:#FFF url(calendar.png) no-repeat right center;} -------------------------------------------------------------------------------- /doitphp/views/source/aispec.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/source/aispec.ttf -------------------------------------------------------------------------------- /doitphp/views/source/watermark.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/source/watermark.bmp -------------------------------------------------------------------------------- /doitphp/views/source/watermark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/source/watermark.gif -------------------------------------------------------------------------------- /doitphp/views/source/watermark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/source/watermark.jpg -------------------------------------------------------------------------------- /doitphp/views/source/watermark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/source/watermark.png -------------------------------------------------------------------------------- /assets/doit/images/ajax_loading_big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/images/ajax_loading_big.gif -------------------------------------------------------------------------------- /assets/doit/images/ajax_loading_ring.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/images/ajax_loading_ring.gif -------------------------------------------------------------------------------- /assets/doit/images/ajax_loading_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/images/ajax_loading_small.gif -------------------------------------------------------------------------------- /assets/doit/images/ajax_loading_snake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/images/ajax_loading_snake.gif -------------------------------------------------------------------------------- /assets/doit/js/calendar/skin/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/js/calendar/skin/calendar.png -------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/vendors/calendar/skin/calendar.png -------------------------------------------------------------------------------- /doitphp/views/images/ajax_loading_big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/images/ajax_loading_big.gif -------------------------------------------------------------------------------- /doitphp/views/images/ajax_loading_ring.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/images/ajax_loading_ring.gif -------------------------------------------------------------------------------- /assets/doit/js/calendar/skin/default/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/assets/doit/js/calendar/skin/default/img.gif -------------------------------------------------------------------------------- /cache/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /doitphp/views/images/ajax_loading_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/images/ajax_loading_small.gif -------------------------------------------------------------------------------- /doitphp/views/images/ajax_loading_snake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/views/images/ajax_loading_snake.gif -------------------------------------------------------------------------------- /logs/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/css/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/js/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /cache/data/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /cache/temp/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/default/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doitphp/doitphp_professional/HEAD/doitphp/vendors/calendar/skin/default/img.gif -------------------------------------------------------------------------------- /application/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/doit/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/doit/js/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/images/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /cache/htmls/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /cache/models/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /cache/views/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Crawl-delay: 10 3 | Disallow: /doitphp/ 4 | Disallow: /application/ 5 | Disallow: /assets/ 6 | Disallow: /cache/ 7 | Disallow: /logs/ -------------------------------------------------------------------------------- /application/config/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/language/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/library/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/models/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/modules/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/views/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/widgets/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/doit/images/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/controllers/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/extensions/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /application/widgets/views/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/doit/js/jquery/index.html: -------------------------------------------------------------------------------- 1 | 403 Forbidden

Forbidden

Directory access is forbidden.

-------------------------------------------------------------------------------- /assets/doit/js/calendar/config.js: -------------------------------------------------------------------------------- 1 | var langList=[{name:'en',charset:'UTF-8'},{name:'zh-cn',charset:'UTF-8'},{name:'zh-tw',charset:'UTF-8'}];var skinList=[{name:'default',charset:'UTF-8'},]; -------------------------------------------------------------------------------- /doitphp/vendors/calendar/config.js: -------------------------------------------------------------------------------- 1 | var langList=[{name:'en',charset:'UTF-8'},{name:'zh-cn',charset:'UTF-8'},{name:'zh-tw',charset:'UTF-8'}];var skinList=[{name:'default',charset:'UTF-8'},]; -------------------------------------------------------------------------------- /application/controllers/IndexController.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (C) 2009-2012 www.doitphp.com All rights reserved. 7 | * @version $Id: index.php 1.0 2014-09-18 01:14:18Z tommy $ 8 | * @package application 9 | * @since 1.0 10 | */ 11 | 12 | define('IN_DOIT', true); 13 | 14 | /** 15 | * 定义项目所在路径(根目录):APP_ROOT 16 | */ 17 | define('APP_ROOT', dirname(__FILE__)); 18 | 19 | /** 20 | * 加载DoitPHP框架的初始化文件,如果必要可以修改文件路径 21 | */ 22 | require_once APP_ROOT . '/doitphp/DoitPHP.php'; 23 | 24 | $config = APP_ROOT . '/application/config/application.php'; 25 | 26 | /** 27 | * 启动应用程序(网站)进程 28 | */ 29 | doit::run($config); -------------------------------------------------------------------------------- /doitphp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/views/errors/error404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 404 Not Found 访问的网页不存在 6 | 11 | 12 | 13 | 14 |

404 Error

15 |

没有找到您要访问的页面

16 |

The requested URL was not found on this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/library/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /assets/doit/js/jquery/jquery.checkbox.min.js: -------------------------------------------------------------------------------- 1 | (function($){$.fn.checkbox_all=function(ele){$(this).click(function(){$(ele).attr('checked',true)})};$.fn.checkbox_none=function(ele){$(this).click(function(){$(ele).attr('checked',false)})};$.fn.checkbox_anti=function(ele){$(this).click(function(){$(ele).each(function(){if(this.checked==true){this.checked=false}else{this.checked=true}})})};$.fn.checkbox_checkbox=function(ele){$(this).click(function(){if(this.checked==true){$(ele).attr('checked',true)}else{$(ele).attr('checked',false)}})};$.checkbox_get_id=function(ele){var selected_id='';$(ele).each(function(){if($(this).attr('checked')=='checked'){selected_id+=$(this).val()+','}});selected_id=selected_id.slice(0,-1);return selected_id}})(jQuery); -------------------------------------------------------------------------------- /doitphp/library/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/jquery/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/jquery/jquery.checkbox.min.js: -------------------------------------------------------------------------------- 1 | (function($){$.fn.checkbox_all=function(ele){$(this).click(function(){$(ele).attr('checked',true)})};$.fn.checkbox_none=function(ele){$(this).click(function(){$(ele).attr('checked',false)})};$.fn.checkbox_anti=function(ele){$(this).click(function(){$(ele).each(function(){if(this.checked==true){this.checked=false}else{this.checked=true}})})};$.fn.checkbox_checkbox=function(ele){$(this).click(function(){if(this.checked==true){$(ele).attr('checked',true)}else{$(ele).attr('checked',false)}})};$.checkbox_get_id=function(ele){var selected_id='';$(ele).each(function(){if($(this).attr('checked')=='checked'){selected_id+=$(this).val()+','}});selected_id=selected_id.slice(0,-1);return selected_id}})(jQuery); -------------------------------------------------------------------------------- /doitphp/views/errors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/views/images/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/views/source/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/calendar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/calendar/lang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/default/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 Forbidden 6 | 11 | 12 | 13 | 14 |

Forbidden

15 |

403 Error

16 |

Your client does not have permission to get this directory from this server.

17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #DoitPHP 专业版 V2.3 2 | 3 | 注:DoitPHP专业版与标准版的区别在于:专业版支持Modules,而标准版不支持,Modules对于企业级的大项目在代码管理方面优势明显。 4 | 5 | DoitPHP(原Tommyframework)是一个基于BSD开源协议发布的轻量级PHP框架。简而言之:DoitPHP运行高效,易学易用,易于扩展。换而言之:DoitPHP运行高效而不失功能强大,操作灵活而又能扩展自如。作为PHP框架里的“后起之秀”,DoitPHP秉承了那些优秀的PHP框架所共有的:代码的OOP编写风格、URL的路由功能、MVC的架构思想、UID的数据库操作、以及AJAX的前端页面技术支持。并在操作和功能设计上进行了微创新: 6 | 7 | 一、DoitPHP的辅助开发工具(DoitPHP Tools),其强大的“脚手架”功能,使得利用本框架进行程序开发更加容易。 8 | 9 | 二、简明高效的视图运行机制,使视图文件的开发操作变得简单易行。 10 | 11 | 三、灵活的扩展模块(extension)设计,能够非常容易地调用如:SMARTY、CKEDITOR、TINYEDITOR、FPDF、PHPMAILER、PHPRPC等第三方开源程序。 12 | 13 | 四、集成了JQUERY及JQUERY FORM、LAZYLOAD等JQUERY插件,使前端页面开发中实现AJAX LOADING图片加载效果、CHECKBOX的全选或反选效果以及图片的惰性加载效果等,让其变得得心应手。 14 | 15 | 五、提供了PHP程序开发中常用的操作类库,无论是COOKIE、SESSION的操作,还是实现网页页面的分页效果,生成RAR、EXCEL、PDF等文件类型的文件,实现MEMCACH、XCACHE、APC等常见的缓存操作。利用扩展类库进行操作,如同“信手拈来”。 16 | 17 | 六、丰富的数据库驱动,支持MYSQL、POSTGRESQL、ORACLE、SQLITE、MSSQL、MONGODB、REDIS等数据库。 18 | 19 | 官方网址:http://www.doitphp.com/ -------------------------------------------------------------------------------- /assets/doit/images/doitphp_pagelist_default.min.css: -------------------------------------------------------------------------------- 1 | .doitphp_pagelist_box{font-family:微软雅黑,sans-serif,Arial,Helvetica;font-size:14px;line-height:24px;color:#000;height:24px;width:100%;text-align:left;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul{list-style-type:none;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul li{font-size:14px;line-height:24px;color:#000;float:left;height:24px;width:auto;text-align:center;margin:0 0 0 5px;}.doitphp_pagelist_box ul .pagelist_blank{height:24px;width:24px;float:left;padding:0;}.doitphp_pagelist_box ul .pagelist_note{float:left;height:24px;width:auto;font-size:14px;}.doitphp_pagelist_box ul .pagelist_ext{height:24px;width:48px;float:left;font-size:14px;}.doitphp_pagelist_box ul .pagelist_current{font-size:16px;line-height:24px;color:#3399FE;height:24px;width:auto;float:left;font-weight:700;}.doitphp_pagelist_box ul li a{text-decoration:none;color:#000;}.doitphp_pagelist_box ul li a:hover{text-decoration:underline;color:#3399FE;font-weight:700;} -------------------------------------------------------------------------------- /doitphp/views/images/doitphp_pagelist_default.min.css: -------------------------------------------------------------------------------- 1 | .doitphp_pagelist_box{font-family:微软雅黑,sans-serif,Arial,Helvetica;font-size:14px;line-height:24px;color:#000;height:24px;width:100%;text-align:left;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul{list-style-type:none;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul li{font-size:14px;line-height:24px;color:#000;float:left;height:24px;width:auto;text-align:center;margin:0 0 0 5px;}.doitphp_pagelist_box ul .pagelist_blank{height:24px;width:24px;float:left;padding:0;}.doitphp_pagelist_box ul .pagelist_note{float:left;height:24px;width:auto;font-size:14px;}.doitphp_pagelist_box ul .pagelist_ext{height:24px;width:48px;float:left;font-size:14px;}.doitphp_pagelist_box ul .pagelist_current{font-size:16px;line-height:24px;color:#3399FE;height:24px;width:auto;float:left;font-weight:700;}.doitphp_pagelist_box ul li a{text-decoration:none;color:#000;}.doitphp_pagelist_box ul li a:hover{text-decoration:underline;color:#3399FE;font-weight:700;} -------------------------------------------------------------------------------- /doitphp/views/errors/exception.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Exception 6 | 15 | 16 | 17 | 18 |

Exception

19 | 20 |

Description

21 |

22 | 23 |

24 | 25 |

Source File

26 |

27 | 28 |

29 | 30 |

Stack Trace

31 |
32 |
33 | 
34 | 
35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /assets/doit/js/calendar/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | var $lang={errAlertMsg:"\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?",aWeekStr:["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],aMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],aLongMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],clearStr:"\u6E05\u7A7A",todayStr:"\u4ECA\u5929",okStr:"\u786E\u5B9A",updateStr:"\u786E\u5B9A",timeStr:"\u65F6\u95F4",quickStr:"\u5FEB\u901F\u9009\u62E9",err_1:'\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!'} -------------------------------------------------------------------------------- /assets/doit/js/calendar/lang/zh-tw.js: -------------------------------------------------------------------------------- 1 | var $lang={errAlertMsg:"\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u7BC4\u570D,\u9700\u8981\u64A4\u92B7\u55CE?",aWeekStr:["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],aMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],aLongMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],clearStr:"\u6E05\u7A7A",todayStr:"\u4ECA\u5929",okStr:"\u78BA\u5B9A",updateStr:"\u78BA\u5B9A",timeStr:"\u6642\u9593",quickStr:"\u5FEB\u901F\u9078\u64C7",err_1:'\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u65BC\u6700\u5927\u65E5\u671F!'} -------------------------------------------------------------------------------- /doitphp/vendors/calendar/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | var $lang={errAlertMsg:"\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?",aWeekStr:["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],aMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],aLongMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],clearStr:"\u6E05\u7A7A",todayStr:"\u4ECA\u5929",okStr:"\u786E\u5B9A",updateStr:"\u786E\u5B9A",timeStr:"\u65F6\u95F4",quickStr:"\u5FEB\u901F\u9009\u62E9",err_1:'\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!'} -------------------------------------------------------------------------------- /doitphp/vendors/calendar/lang/zh-tw.js: -------------------------------------------------------------------------------- 1 | var $lang={errAlertMsg:"\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u7BC4\u570D,\u9700\u8981\u64A4\u92B7\u55CE?",aWeekStr:["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],aMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],aLongMonStr:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],clearStr:"\u6E05\u7A7A",todayStr:"\u4ECA\u5929",okStr:"\u78BA\u5B9A",updateStr:"\u78BA\u5B9A",timeStr:"\u6642\u9593",quickStr:"\u5FEB\u901F\u9078\u64C7",err_1:'\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u65BC\u6700\u5927\u65E5\u671F!'} -------------------------------------------------------------------------------- /assets/doit/js/calendar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 7 | 8 | 9 | 10 | 12 | 13 | 14 |
11 | DoitPHP   
Error
 
15 |
16 |

Forbidden

17 | Your client does not have permission to get this directory from this server. 18 |
19 |
20 | -------------------------------------------------------------------------------- /assets/doit/js/calendar/lang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 7 | 8 | 9 | 10 | 12 | 13 | 14 |
11 | DoitPHP   
Error
 
15 |
16 |

Forbidden

17 | Your client does not have permission to get this directory from this server. 18 |
19 |
20 | -------------------------------------------------------------------------------- /assets/doit/js/calendar/skin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 7 | 8 | 9 | 10 | 12 | 13 | 14 |
11 | DoitPHP   
Error
 
15 |
16 |

Forbidden

17 | Your client does not have permission to get this directory from this server. 18 |
19 |
20 | -------------------------------------------------------------------------------- /assets/doit/js/calendar/skin/default/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 7 | 8 | 9 | 10 | 12 | 13 | 14 |
11 | DoitPHP   
Error
 
15 |
16 |

Forbidden

17 | Your client does not have permission to get this directory from this server. 18 |
19 |
20 | -------------------------------------------------------------------------------- /assets/doit/js/calendar/calendar.html: -------------------------------------------------------------------------------- 1 | DoitPHP-calendar 2 | -------------------------------------------------------------------------------- /doitphp/vendors/calendar/calendar.html: -------------------------------------------------------------------------------- 1 | DoitPHP-calendar 2 | -------------------------------------------------------------------------------- /assets/doit/images/doitphp_pagelist_classic.min.css: -------------------------------------------------------------------------------- 1 | .doitphp_pagelist_box{font-family:微软雅黑,sans-serif,Arial,Helvetica;font-size:14px;line-height:20px;color:#000;height:24px;width:100%;text-align:left;border-style:none;}.doitphp_pagelist_box ul{list-style-type:none;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul li{font-size:14px;line-height:20px;color:#000;float:left;height:20px;text-align:center;border:1px solid #C1C8D2;width:auto!important;width:24px;margin:0 5px;padding:0;}.doitphp_pagelist_box ul .pagelist_ext{height:20px;width:48px;float:left;font-size:12px;line-height:20px;margin:1px 0 1px 5px;padding:0;}.doitphp_pagelist_box ul .pagelist_current{float:left;width:auto;height:20px;font-size:16px;line-height:20px;color:#3399FE;font-weight:700;border:1px solid #C3D9FF;margin:0 5px;padding:0 5px;}.doitphp_pagelist_box ul li a{text-decoration:none;color:#000;height:20px;width:auto;display:block;margin:0;padding:0 5px;}.doitphp_pagelist_box ul li a:hover{text-decoration:none;color:#FFF;background-color:#C3D9FF;font-size:14px;line-height:20px;}.doitphp_pagelist_box ul .pagelist_ext a{text-decoration:none;display:block;height:18px;width:46px;line-height:18px;margin:1px;padding:0;}.doitphp_pagelist_box ul .pagelist_ext a:hover{font-weight:400;color:#FFF;text-decoration:none;background-color:#C3D9FF;font-size:12px;} -------------------------------------------------------------------------------- /doitphp/views/images/doitphp_pagelist_classic.min.css: -------------------------------------------------------------------------------- 1 | .doitphp_pagelist_box{font-family:微软雅黑,sans-serif,Arial,Helvetica;font-size:14px;line-height:20px;color:#000;height:24px;width:100%;text-align:left;border-style:none;}.doitphp_pagelist_box ul{list-style-type:none;border-style:none;margin:0;padding:0;}.doitphp_pagelist_box ul li{font-size:14px;line-height:20px;color:#000;float:left;height:20px;text-align:center;border:1px solid #C1C8D2;width:auto!important;width:24px;margin:0 5px;padding:0;}.doitphp_pagelist_box ul .pagelist_ext{height:20px;width:48px;float:left;font-size:12px;line-height:20px;margin:1px 0 1px 5px;padding:0;}.doitphp_pagelist_box ul .pagelist_current{float:left;width:auto;height:20px;font-size:16px;line-height:20px;color:#3399FE;font-weight:700;border:1px solid #C3D9FF;margin:0 5px;padding:0 5px;}.doitphp_pagelist_box ul li a{text-decoration:none;color:#000;height:20px;width:auto;display:block;margin:0;padding:0 5px;}.doitphp_pagelist_box ul li a:hover{text-decoration:none;color:#FFF;background-color:#C3D9FF;font-size:14px;line-height:20px;}.doitphp_pagelist_box ul .pagelist_ext a{text-decoration:none;display:block;height:18px;width:46px;line-height:18px;margin:1px;padding:0;}.doitphp_pagelist_box ul .pagelist_ext a:hover{font-weight:400;color:#FFF;text-decoration:none;background-color:#C3D9FF;font-size:12px;} -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | The DoitPHP is free software. It is released under the terms of 2 | the following BSD License. 3 | 4 | Copyright © 2010-2011 by Tommy software studio LLC (http://www.doitphp.com) 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the 15 | distribution. 16 | * Neither the name of Yii Software LLC nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /doitphp/library/FileDownload.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: FileDownload.php 2.0 2012-12-23 20:24:43Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | class FileDownload { 15 | 16 | /** 17 | * http下载文件 18 | * 19 | * Reads a file and send a header to force download it. 20 | * 21 | * @access public 22 | * 23 | * @param string $file 文件路径 24 | * @param string $rename 文件重命名后的名称 25 | * 26 | * @return void 27 | */ 28 | public static function render($file, $rename = null) { 29 | 30 | //参数分析 31 | if(!$file) { 32 | return false; 33 | } 34 | 35 | if(headers_sent()) { 36 | return false; 37 | } 38 | 39 | //分析文件是否存在 40 | if (!is_file($file)) { 41 | Controller::showMsg('Error 404:The file not found!'); 42 | } 43 | 44 | //分析文件名 45 | $filename = (!$rename) ? basename($file) : $rename; 46 | 47 | header('Content-Description: File Transfer'); 48 | header('Content-Type: application/octet-stream'); 49 | header("Content-Disposition: attachment; filename=\"{$filename}\""); 50 | header('Expires: 0'); 51 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 52 | header('Pragma: public'); 53 | header('Content-Length: ' . filesize($file)); 54 | ob_clean(); 55 | flush(); 56 | 57 | readfile($file); 58 | 59 | exit(); 60 | } 61 | } -------------------------------------------------------------------------------- /doitphp/core/DoitException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: DoitException.php 1.0 2012-12-04 10:56:13Z tommy $ 10 | * @package core 11 | * @since 1.0 12 | */ 13 | 14 | class DoitException extends Exception { 15 | 16 | /** 17 | * 异常输出 18 | * 19 | * 注:当调试模式关闭时,异常提示信息将会写入日志 20 | * 21 | * @access public 22 | * @return string 23 | */ 24 | public function __toString() { 25 | 26 | //分析获取异常信息 27 | $code = $this->getCode(); 28 | $exceptionMsg = $this->getMessage(); 29 | $message = ($code ? "Error Code:{$code}
" : '') . ($exceptionMsg ? "Error Message:{$exceptionMsg}" : ''); 30 | 31 | $line = $this->getLine(); 32 | $sourceFile = $this->getFile() . (!$line ? '' : "({$line})"); 33 | 34 | if (DOIT_DEBUG === true) { 35 | $traceString = ''; 36 | $traces = $this->getTrace(); 37 | foreach ($traces as $key=>$trace) { 38 | //代码跟踪级别限制 39 | if ($key > 2) { 40 | break; 41 | } 42 | $traceString .= "#{$key} {$trace['file']}({$trace['line']})
"; 43 | } 44 | } 45 | 46 | //定义错误级别(当错误级别为Normal时,则不显示代码跟踪信息) 47 | $level = 'Error'; 48 | 49 | ob_start(); 50 | //加载,分析,并输出excepiton文件内容 51 | include_once DOIT_ROOT . '/views/errors/exception.php'; 52 | 53 | $exceptionMessage = ob_get_clean(); 54 | 55 | if (DOIT_DEBUG === false) { 56 | $exceptionMsg = str_replace('
', ' ', $exceptionMsg); 57 | $logContent = ((!$code) ? "" : "Error Code:{$code} ") . "Error Message:{$exceptionMsg} File:{$sourceFile}"; 58 | //写入程序运行日志 59 | Log::write($logContent); 60 | } 61 | 62 | return $exceptionMessage; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /doitphp/views/errors/message.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 提示信息 6 | 23 | 24 | 25 |
26 |
27 | 33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /application/config/application.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) Copyright (c) 2012 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: application.php 1.0 2013-01-11 21:53:32Z tommy $ 10 | * @package config 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | /** 19 | * 设置时区,默认时区为东八区(中国)时区(Asia/ShangHai)。 20 | */ 21 | //$config['application']['defaultTimeZone'] = 'Asia/ShangHai'; 22 | 23 | /** 24 | * 设置URL网址的格式。 25 | * Configure::GET_FORMAT为:index.php?router=controller/action¶ms=value; 26 | * Configure::PATH_FORMAT为:index.php/controller/action/params/value。 27 | * 默认为:Configure::PATH_FORMAT 28 | */ 29 | //$config['application']['urlFormat'] = Configure::GET_FORMAT; 30 | 31 | /** 32 | * 设置是否开启URL路由网址重写(Rewrite)功能。true:开启;false:关闭。默认:关闭。 33 | */ 34 | //$config['application']['rewrite'] = true; 35 | 36 | /** 37 | * 设置是否开启Debug调用功能。true:开启;false:关闭。默认:关闭。 38 | */ 39 | //$config['application']['debug'] = true; 40 | 41 | /** 42 | * 设置是否开启日志记录功能。true:开启;false:关闭。默认:关闭。 43 | */ 44 | //$config['application']['log'] = true; 45 | 46 | /** 47 | * 自定义项目(application)目录路径的设置。注:结尾无需"/",建议用绝对路径。 48 | */ 49 | //$config['application']['basePath'] = APP_ROOT . '/application'; 50 | 51 | /** 52 | * 自定义缓存(cache)目录路径的设置。注:结尾无需"/",建议用绝对路径。 53 | */ 54 | //$config['application']['cachePath'] = APP_ROOT . '/cache'; 55 | 56 | /** 57 | * 自定义日志(log)目录路径的设置。注:结尾无需"/",建议用绝对路径。 58 | */ 59 | //$config['application']['logPath'] = APP_ROOT . '/logs'; 60 | 61 | /** 62 | * 设置视图文件的格式。Configure::VIEW_EXT_HTML为html;Configure::VIEW_EXT_PHP为php。默认为:php。 63 | */ 64 | //$config['application']['viewExt'] = Configure::VIEW_EXT_HTML; 65 | 66 | /** 67 | * 设置数据库(关系型数据库)的连接参数。 注:仅支持PDO连接。 68 | * 69 | * @example 70 | * 例一:单数据库 71 | * $config['db'] = array( 72 | * 'dsn' => 'mysql:host=localhost;dbname=doitphp', 73 | * 'username' => 'root', 74 | * 'password' => '123qwe', 75 | * 'prefix' => 'do_', 76 | * 'charset' => 'utf8', 77 | * ); 78 | * 79 | * 例二:数据库主从分离 80 | * $config['db'] = array( 81 | * 'master' => array( 82 | * 'dsn' => '...', 83 | * 'username' => '...', 84 | * 'password' => '...', 85 | * ), 86 | * 'slave' => array( 87 | * 'dsn' => '...', 88 | * 'username' => '...', 89 | * 'password' => '...', 90 | * ), 91 | * 'prefix' => 'do_', 92 | * 'charset' => 'utf8', 93 | * ); 94 | * 注:prefix为数据表前缀。当没有前缀时,此参数可以省略。charset为数库编码。默认值为:utf8。如编码为utf8时,此参数也可以省略。 95 | */ 96 | //$config['db']['dsn'] = 'mysql:host=yourHost;dbname=yourDbname'; 97 | //$config['db']['username'] = 'yourUsername'; 98 | //$config['db']['password'] = 'yourPassword'; -------------------------------------------------------------------------------- /assets/doit/js/jquery/jquery.lazyload.min.js: -------------------------------------------------------------------------------- 1 | (function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options)}var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear")}else{if(counter++>settings.failurelimit){return false}}});var temp=$.grep(elements,function(element){return!element.loaded});elements=$(temp)})}this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"))}if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder)}else{$(self).removeAttr("src")}self.loaded=false}else{self.loaded=true}$(self).one("appear",function(){if(!this.loaded){$("").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))[settings.effect](settings.effectspeed);self.loaded=true}).attr("src",$(self).attr("original"))}});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear")}})}});$(settings.container).trigger(settings.event);return this};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop()}else{var fold=$(settings.container).offset().top+$(settings.container).height()}return fold<=$(element).offset().top-settings.threshold};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft()}else{var fold=$(settings.container).offset().left+$(settings.container).width()}return fold<=$(element).offset().left-settings.threshold};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop()}else{var fold=$(settings.container).offset().top}return fold>=$(element).offset().top+settings.threshold+$(element).height()};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft()}else{var fold=$(settings.container).offset().left}return fold>=$(element).offset().left+settings.threshold+$(element).width()};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery); -------------------------------------------------------------------------------- /doitphp/vendors/jquery/jquery.lazyload.min.js: -------------------------------------------------------------------------------- 1 | (function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options)}var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear")}else{if(counter++>settings.failurelimit){return false}}});var temp=$.grep(elements,function(element){return!element.loaded});elements=$(temp)})}this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"))}if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder)}else{$(self).removeAttr("src")}self.loaded=false}else{self.loaded=true}$(self).one("appear",function(){if(!this.loaded){$("").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))[settings.effect](settings.effectspeed);self.loaded=true}).attr("src",$(self).attr("original"))}});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear")}})}});$(settings.container).trigger(settings.event);return this};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop()}else{var fold=$(settings.container).offset().top+$(settings.container).height()}return fold<=$(element).offset().top-settings.threshold};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft()}else{var fold=$(settings.container).offset().left+$(settings.container).width()}return fold<=$(element).offset().left-settings.threshold};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop()}else{var fold=$(settings.container).offset().top}return fold>=$(element).offset().top+settings.threshold+$(element).height()};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft()}else{var fold=$(settings.container).offset().left}return fold>=$(element).offset().left+settings.threshold+$(element).width()};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery); -------------------------------------------------------------------------------- /doitphp/library/Xml.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2010 Tommy Software Studio 9 | * @link http://www.doitphp.com 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Xml.php 2.0 2012-12-29 19:40:01Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class Xml { 21 | 22 | /** 23 | * 加载xml文件.支持文件名及xml代码. 24 | * 25 | * @access public 26 | * 27 | * @param string $fileName xml文件名或xml代码内容 28 | * 29 | * @return string 30 | */ 31 | public static function loadXml($fileName) { 32 | 33 | if (!$fileName) { 34 | return false; 35 | } 36 | 37 | return (strpos($fileName, ' $val) { 78 | is_numeric($key) && $key = "item id=\"$key\""; 79 | $xml.="\t<$key>"; 80 | $xml.= (is_array($val) || is_object($val)) ? self::_dataToXml($val) : str_replace(array("&","<",">","\"", "'", "-"), array("&", "<", ">", """, "'", "-"), $val); 81 | list($key, ) = explode(' ', $key); 82 | $xml.="\n"; 83 | } 84 | 85 | return $xml; 86 | } 87 | 88 | /** 89 | * 进行对xml编码. 90 | * 91 | * @param string $data xml内容数组 92 | * @param string $root 93 | * @return string 94 | */ 95 | public static function xmlEncode($data, $root = null, $encoding = 'UTF-8') { 96 | 97 | if (!$data) { 98 | return false; 99 | } 100 | 101 | $root = is_null($root) ? 'root' : trim($root); 102 | $xml = "\n"; 103 | $xml .= "<".$root.">\n"; 104 | $xml .= self::_dataToXml($data); 105 | $xml .= ""; 106 | 107 | return $xml; 108 | } 109 | } -------------------------------------------------------------------------------- /assets/doit/js/calendar/skin/default/datepicker.css: -------------------------------------------------------------------------------- 1 | .WdateDiv{width:180px;background-color:#FFF;border:#CCC 1px solid;padding:2px;} 2 | .WdateDiv2{width:360px;} 3 | .WdateDiv *{font-size:12px;} 4 | .WdateDiv .NavImg a{display:block;cursor:pointer;height:16px;width:16px;} 5 | .WdateDiv .NavImgll a{float:left;background:transparent url(img.gif) no-repeat scroll 0 0;} 6 | .WdateDiv .NavImgl a{float:left;background:transparent url(img.gif) no-repeat scroll -16px 0;} 7 | .WdateDiv .NavImgr a{float:right;background:transparent url(img.gif) no-repeat scroll -32px 0;} 8 | .WdateDiv .NavImgrr a{float:right;background:transparent url(img.gif) no-repeat scroll -48px 0;} 9 | .WdateDiv #dpTitle{height:24px;margin-bottom:2px;padding:1px;} 10 | .WdateDiv .yminput{margin-top:2px;text-align:center;height:20px;border:0;width:50px;cursor:pointer;} 11 | .WdateDiv .yminputfocus{margin-top:2px;text-align:center;font-weight:700;height:20px;color:blue;border:#ccc 1px solid;width:50px;} 12 | .WdateDiv .menuSel{z-index:1;position:absolute;background-color:#FFF;border:#ccc 1px solid;display:none;} 13 | .WdateDiv .menu{cursor:pointer;background-color:#fff;} 14 | .WdateDiv .menuOn{cursor:pointer;background-color:#B6E0FA;} 15 | .WdateDiv .YMenu{margin-top:20px;} 16 | .WdateDiv .MMenu{margin-top:20px;width:62px;} 17 | .WdateDiv .hhMenu{margin-top:-90px;margin-left:26px;} 18 | .WdateDiv .mmMenu{margin-top:-46px;margin-left:26px;} 19 | .WdateDiv .ssMenu{margin-top:-24px;margin-left:26px;} 20 | .WdateDiv .Wweek{text-align:center;background:#DAF3F5;border-right:#B6E0FA 1px solid;} 21 | .WdateDiv .MTitle{background-color:#B6E0FA;} 22 | .WdateDiv .WdayTable2{border-collapse:collapse;border:#B6E0FA 1px solid;} 23 | .WdateDiv .WdayTable2 table{border:0;} 24 | .WdateDiv .WdayTable{line-height:20px;border:#c5d9e8 1px solid;} 25 | .WdateDiv .WdayTable td{text-align:center;} 26 | .WdateDiv .Wday{cursor:pointer;} 27 | .WdateDiv .WdayOn{cursor:pointer;background-color:#B6E0FA;} 28 | .WdateDiv .Wwday{cursor:pointer;color:#FF2F2F;} 29 | .WdateDiv .WwdayOn{cursor:pointer;color:#000;background-color:#B6E0FA;} 30 | .WdateDiv .Wtoday{cursor:pointer;color:blue;} 31 | .WdateDiv .Wselday{background-color:#B6E0FA;color:#FFF;} 32 | .WdateDiv .WspecialDay{background-color:#66F4DF;} 33 | .WdateDiv .WotherDay{cursor:pointer;color:#6A6AFF;} 34 | .WdateDiv .WotherDayOn{cursor:pointer;background-color:#B6E0FA;} 35 | .WdateDiv #dpTime{float:left;margin-top:3px;margin-right:30px;} 36 | .WdateDiv #dpTime #dpTimeStr{margin-left:1px;} 37 | .WdateDiv #dpTime input{width:18px;height:20px;text-align:center;border:#ccc 1px solid;} 38 | .WdateDiv #dpTime .tB{border-right:0;} 39 | .WdateDiv #dpTime .tE{border-left:0;border-right:0;} 40 | .WdateDiv #dpTime .tm{width:7px;border-left:0;border-right:0;} 41 | .WdateDiv #dpTime #dpTimeUp{height:10px;width:13px;border:0;background:url(img.gif) no-repeat -32px -16px;} 42 | .WdateDiv #dpTime #dpTimeDown{height:10px;width:13px;border:0;background:url(img.gif) no-repeat -48px -16px;} 43 | .WdateDiv #dpQS{float:left;margin-right:3px;margin-top:3px;background:url(img.gif) no-repeat 0 -16px;width:20px;height:20px;cursor:pointer;} 44 | .WdateDiv #dpControl{text-align:right;} 45 | .WdateDiv .dpButton{height:20px;width:45px;border:#ccc 1px solid;margin-top:2px;margin-right:1px;} 46 | .WdateDiv .invalidMenu,.WdateDiv .WinvalidDay{color:#aaa;} -------------------------------------------------------------------------------- /doitphp/vendors/calendar/skin/default/datepicker.css: -------------------------------------------------------------------------------- 1 | .WdateDiv{width:180px;background-color:#FFF;border:#CCC 1px solid;padding:2px;} 2 | .WdateDiv2{width:360px;} 3 | .WdateDiv *{font-size:12px;} 4 | .WdateDiv .NavImg a{display:block;cursor:pointer;height:16px;width:16px;} 5 | .WdateDiv .NavImgll a{float:left;background:transparent url(img.gif) no-repeat scroll 0 0;} 6 | .WdateDiv .NavImgl a{float:left;background:transparent url(img.gif) no-repeat scroll -16px 0;} 7 | .WdateDiv .NavImgr a{float:right;background:transparent url(img.gif) no-repeat scroll -32px 0;} 8 | .WdateDiv .NavImgrr a{float:right;background:transparent url(img.gif) no-repeat scroll -48px 0;} 9 | .WdateDiv #dpTitle{height:24px;margin-bottom:2px;padding:1px;} 10 | .WdateDiv .yminput{margin-top:2px;text-align:center;height:20px;border:0;width:50px;cursor:pointer;} 11 | .WdateDiv .yminputfocus{margin-top:2px;text-align:center;font-weight:700;height:20px;color:blue;border:#ccc 1px solid;width:50px;} 12 | .WdateDiv .menuSel{z-index:1;position:absolute;background-color:#FFF;border:#ccc 1px solid;display:none;} 13 | .WdateDiv .menu{cursor:pointer;background-color:#fff;} 14 | .WdateDiv .menuOn{cursor:pointer;background-color:#B6E0FA;} 15 | .WdateDiv .YMenu{margin-top:20px;} 16 | .WdateDiv .MMenu{margin-top:20px;width:62px;} 17 | .WdateDiv .hhMenu{margin-top:-90px;margin-left:26px;} 18 | .WdateDiv .mmMenu{margin-top:-46px;margin-left:26px;} 19 | .WdateDiv .ssMenu{margin-top:-24px;margin-left:26px;} 20 | .WdateDiv .Wweek{text-align:center;background:#DAF3F5;border-right:#B6E0FA 1px solid;} 21 | .WdateDiv .MTitle{background-color:#B6E0FA;} 22 | .WdateDiv .WdayTable2{border-collapse:collapse;border:#B6E0FA 1px solid;} 23 | .WdateDiv .WdayTable2 table{border:0;} 24 | .WdateDiv .WdayTable{line-height:20px;border:#c5d9e8 1px solid;} 25 | .WdateDiv .WdayTable td{text-align:center;} 26 | .WdateDiv .Wday{cursor:pointer;} 27 | .WdateDiv .WdayOn{cursor:pointer;background-color:#B6E0FA;} 28 | .WdateDiv .Wwday{cursor:pointer;color:#FF2F2F;} 29 | .WdateDiv .WwdayOn{cursor:pointer;color:#000;background-color:#B6E0FA;} 30 | .WdateDiv .Wtoday{cursor:pointer;color:blue;} 31 | .WdateDiv .Wselday{background-color:#B6E0FA;color:#FFF;} 32 | .WdateDiv .WspecialDay{background-color:#66F4DF;} 33 | .WdateDiv .WotherDay{cursor:pointer;color:#6A6AFF;} 34 | .WdateDiv .WotherDayOn{cursor:pointer;background-color:#B6E0FA;} 35 | .WdateDiv #dpTime{float:left;margin-top:3px;margin-right:30px;} 36 | .WdateDiv #dpTime #dpTimeStr{margin-left:1px;} 37 | .WdateDiv #dpTime input{width:18px;height:20px;text-align:center;border:#ccc 1px solid;} 38 | .WdateDiv #dpTime .tB{border-right:0;} 39 | .WdateDiv #dpTime .tE{border-left:0;border-right:0;} 40 | .WdateDiv #dpTime .tm{width:7px;border-left:0;border-right:0;} 41 | .WdateDiv #dpTime #dpTimeUp{height:10px;width:13px;border:0;background:url(img.gif) no-repeat -32px -16px;} 42 | .WdateDiv #dpTime #dpTimeDown{height:10px;width:13px;border:0;background:url(img.gif) no-repeat -48px -16px;} 43 | .WdateDiv #dpQS{float:left;margin-right:3px;margin-top:3px;background:url(img.gif) no-repeat 0 -16px;width:20px;height:20px;cursor:pointer;} 44 | .WdateDiv #dpControl{text-align:right;} 45 | .WdateDiv .dpButton{height:20px;width:45px;border:#ccc 1px solid;margin-top:2px;margin-right:1px;} 46 | .WdateDiv .invalidMenu,.WdateDiv .WinvalidDay{color:#aaa;} -------------------------------------------------------------------------------- /doitphp/library/Language.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Language.php 2.0 2012-12-22 19:41:54Z tommy $ 10 | * @package core 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Language { 19 | 20 | /** 21 | * 语言包的目录 22 | * 23 | * @var string 24 | */ 25 | protected $_langPath = null; 26 | 27 | /** 28 | * 构造方法 29 | * 30 | * 用于初始化运行环境,或对基本变量进行赋值 31 | * 32 | * @access public 33 | * @return boolean 34 | */ 35 | public function __construct() { 36 | 37 | //获取默认的语言包目录的路径 38 | $moduleName = Doit::getModuleName(); 39 | $this->_langPath = BASE_PATH . ((!$moduleName) ? '/language': '/modules/' . $moduleName . '/language'); 40 | 41 | return true; 42 | } 43 | 44 | /** 45 | * 获取语言包的基本路径 46 | * 47 | * @access public 48 | * @return string 49 | */ 50 | public static function getLanguagePath() { 51 | 52 | return $this->_langPath; 53 | } 54 | 55 | /** 56 | * 设置语言包的基本路径 57 | * 58 | * @access public 59 | * 60 | * @param string $path 语言包的基本路径 61 | * 62 | * @return boolean 63 | */ 64 | public function setLanguagePath($path) { 65 | 66 | //参数分析 67 | if (!$path) { 68 | return false; 69 | } 70 | 71 | $this->_langPath = $path; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * 加载语言数据文件 78 | * 79 | * @access public 80 | * 81 | * @param string $langName 语言名称 82 | * 83 | * @return array 84 | */ 85 | public function loadLanguage($langName = 'zh_cn') { 86 | 87 | //参数分析 88 | if (!$langName) { 89 | return false; 90 | } 91 | 92 | $langFilePath = $this->_langPath . DS . $langName . '.php'; 93 | 94 | static $_langArray = array(); 95 | if (!isset($_langArray[$langName])) { 96 | //分析语言文件是否存在 97 | if (!is_file($langFilePath)) { 98 | Controller::halt("The Langueage File: {$langFilePath} is not found!", 'Normal'); 99 | } 100 | 101 | //获取语言包内容 102 | $lang = array(); 103 | include_once $langFilePath; 104 | $_langArray[$langName] = $lang; 105 | } 106 | 107 | return $_langArray[$langName]; 108 | } 109 | 110 | /** 111 | * 获取语言包某键值的内容 112 | * 113 | * @access public 114 | * 115 | * @param string $key 键值 116 | * @param string $langName 语言名称 117 | * 118 | * @return mixed 119 | */ 120 | public function get($key, $langName = 'zh_cn') { 121 | 122 | //参数分析 123 | if (!$key) { 124 | return null; 125 | } 126 | 127 | $langArray = $this->loadLanguage($langName); 128 | 129 | return isset($langArray[$key]) ? $langArray[$key] : null; 130 | } 131 | 132 | } -------------------------------------------------------------------------------- /doitphp/library/Csv.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2010 Tommycode Studio 9 | * @link http://www.doitphp.com 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Csv.php 2.0 2012-12-23 15:56:01Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class Csv { 21 | 22 | /** 23 | * 将CSV文件转化为数组 24 | * 25 | * @access public 26 | * 27 | * @param string $fileName csv文件名(路径) 28 | * @param string $delimiter 单元分割符(逗号或制表符) 29 | * 30 | * @return array 31 | */ 32 | public static function readCsv($fileName, $delimiter = ",") { 33 | 34 | //参数分析 35 | if (!$fileName) { 36 | return false; 37 | } 38 | 39 | setlocale(LC_ALL, 'en_US.UTF-8'); 40 | 41 | //读取csv文件内容 42 | $handle = fopen($fileName, 'r'); 43 | 44 | $outputArray = array(); 45 | $row = 0; 46 | while ($data = fgetcsv($handle, 1000, $delimiter)) { 47 | $num = count($data); 48 | for ($i = 0; $i < $num; $i ++) { 49 | $outputArray[$row][$i] = $data[$i]; 50 | } 51 | $row++; 52 | } 53 | fclose($handle); 54 | 55 | return $outputArray; 56 | } 57 | 58 | /** 59 | * 生成csv文件 60 | * 61 | * @access public 62 | * 63 | * @param string $fileName 所要生成的文件名 64 | * @param array $data csv数据内容, 注:本参数为二维数组 65 | * @param boolean $isDownLoad 生成Csv文件的方式是否为浏览器下载(true:是/false:不是) 66 | * 67 | * @return mixed 68 | */ 69 | public static function createCsv($fileName, $data, $isDownLoad = true) { 70 | 71 | //参数分析 72 | if (!$fileName || !$data || !is_array($data)) { 73 | return false; 74 | } 75 | if (stripos($fileName, '.csv') === false) { 76 | $fileName .= '.csv'; 77 | } 78 | 79 | //分析$data内容 80 | $content = ''; 81 | foreach ($data as $lines) { 82 | if ($lines && is_array($lines)) { 83 | foreach ($lines as $key=>$value) { 84 | if (is_string($value)) { 85 | $lines[$key] = '"' . $value . '"'; 86 | } 87 | } 88 | $content .= implode(",", $lines) . "\n"; 89 | } 90 | } 91 | 92 | //当文件生成方式不为浏览器下载时 93 | if ($isDownLoad === false) { 94 | //分析文件所在的目录 95 | $dirPath = dirname($fileName); 96 | if (!is_dir($dirPath)) { 97 | mkdir($dirPath, 0777, true); 98 | } 99 | 100 | return file_put_contents($fileName, $content, LOCK_EX); 101 | } 102 | 103 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 104 | header("Expires:0"); 105 | header("Pragma:public"); 106 | header("Cache-Control: public"); 107 | header("Content-type:text/csv"); 108 | header("Content-Disposition:attachment;filename=" . $fileName); 109 | 110 | echo $content; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /doitphp/library/Benchmark.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://www.doitphp.com 9 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Benchmark.php 2.0 2012-12-31 11:12:25Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | class Benchmark { 17 | 18 | /** 19 | * 标记时间数据存贮容器 20 | * 21 | * @var array 22 | */ 23 | protected static $_timeArray = array(); 24 | 25 | /** 26 | * 标记内存占用数据存贮容器 27 | * 28 | * @var array 29 | */ 30 | protected static $_memoArray = array(); 31 | 32 | /** 33 | * 标记当前点的基准数据 34 | * 35 | * @access public 36 | * 37 | * @param string $name 标记名 38 | * 39 | * @return boolean 40 | */ 41 | public static function mark($name) { 42 | 43 | //参数分析 44 | if (!$name) { 45 | return false; 46 | } 47 | 48 | //获取当前时间及内存占用 49 | self::$_timeArray[$name] = microtime(true); 50 | self::$_memoArray[$name] = self::_getMemUsage(); 51 | 52 | return true; 53 | } 54 | 55 | /** 56 | * 获取测试代码片段的总的内存占用及执行时间 57 | * 58 | * @access public 59 | * 60 | * @param string $startName 开始标记名 61 | * @param string $endName 结束标记名 62 | * 63 | * @return array 64 | */ 65 | public static function get($startName, $endName = null) { 66 | 67 | //参数分析 68 | if (!$startName) { 69 | return false; 70 | } 71 | 72 | //判断标记点时否存在 73 | if (!isset(self::$_timeArray[$startName])) { 74 | return false; 75 | } 76 | if ($endName && !isset(self::$_timeArray[$endName])) { 77 | return false; 78 | } 79 | 80 | $startTime = self::$_timeArray[$startName]; 81 | $startMemo = self::$_memoArray[$startName]; 82 | 83 | $endTime = (!$endName) ? microtime(true) : self::$_timeArray[$endName]; 84 | $endMemo = (!$endName) ? self::_getMemUsage() : self::$_memoArray[$endName]; 85 | 86 | $time = sprintf('%6fs',$endTime - $startTime); 87 | $memory = $endMemo = $startMemo; 88 | 89 | return array('time'=>$time, 'memory'=>$memory); 90 | } 91 | 92 | /** 93 | * 获取当前内存的占用数据 94 | * 95 | * @access protected 96 | * @return string 97 | */ 98 | protected static function _getMemUsage() { 99 | 100 | return memory_get_usage(); 101 | } 102 | 103 | /** 104 | * 获取每个标记点的内存及执行时间 105 | * 106 | * @access public 107 | * @return array 108 | */ 109 | public static function getAll() { 110 | 111 | $data = array(); 112 | foreach (self::$_timeArray as $key =>$value) { 113 | $data[$key] = array('time'=>$value, 'memory'=>self::$_memoArray[$key]); 114 | } 115 | 116 | return $data; 117 | } 118 | 119 | /** 120 | * 获取每个标记点的时间 121 | * 122 | * @access public 123 | * @return array 124 | */ 125 | public static function getTime() { 126 | 127 | return self::$_timeArray; 128 | } 129 | 130 | /** 131 | * 获取每个标记点的内存占用 132 | * 133 | * @access public 134 | * @return array 135 | */ 136 | public static function getMemory() { 137 | 138 | return self::$_memoArray; 139 | } 140 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /doitphp/library/FileUpload.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: FileUpload.php 2.0 2012-12-23 22:30:38Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | class FileUpload { 15 | 16 | /** 17 | * 文件限制大小(默认:8M) 18 | * 19 | * @var integer 20 | */ 21 | protected $_limitSize = 8388608; 22 | 23 | /** 24 | * 上传的文件信息 25 | * 26 | * @var string 27 | */ 28 | protected $_files = array(); 29 | 30 | /** 31 | * 文件的限制类型 32 | * 33 | * @var string 34 | */ 35 | protected $_limitType = array(); 36 | 37 | /** 38 | * 返回的错误信息 39 | * 40 | * @var string 41 | */ 42 | protected $_errorMsg = null; 43 | 44 | /** 45 | * 文件上传处理 46 | * 47 | * @access public 48 | * 49 | * @param array $files $_FILE的参数名 50 | * @param string $destFile 上传后的文件路径 51 | * 52 | * @return boolean 53 | */ 54 | public function render($files, $destFile) { 55 | 56 | //参数分析 57 | if (!$files || !$destFile) { 58 | return false; 59 | } 60 | 61 | $this->_files = $files; 62 | 63 | //分析文件大小 64 | if (!$this->_parseFileSize()) { 65 | return false; 66 | } 67 | 68 | //分析文件类型 69 | if (!$this->_parseFileType()) { 70 | return false; 71 | } 72 | 73 | if (!move_uploaded_file($this->_files['tmp_name'], $destFile)) { 74 | $this->_errorMsg = '文件上传失败!请重新上传'; 75 | return false; 76 | } 77 | 78 | return true; 79 | } 80 | 81 | /** 82 | * 设置上传文件的限制格式,即:文件后缀。 83 | * 84 | * @access public 85 | * 86 | * @param array $type 所限制上传文件后缀。注:本参数为数组 87 | * 88 | * @return object 89 | */ 90 | public function setLimitType($type) { 91 | 92 | //参数分析 93 | if ($type && is_array($type)) { 94 | $this->_limitType = $type; 95 | } 96 | 97 | return $this; 98 | } 99 | 100 | /** 101 | * 设置上传文件的最大的限制大小 102 | * 103 | * @access public 104 | * 105 | * @param integer $fileSize 文件的大小(file size)。 106 | * 107 | * @return object 108 | */ 109 | public function setLimitSize($fileSize) { 110 | 111 | //参数分析 112 | if ($fileSize) { 113 | $this->_limitSize = (int)$fileSize; 114 | } 115 | 116 | return $this; 117 | } 118 | 119 | /** 120 | * 获取错误提示信息 121 | * 122 | * @access public 123 | * @return string 124 | */ 125 | public function getErrorInfo() { 126 | 127 | return $this->_errorMsg; 128 | } 129 | 130 | /** 131 | * 分析文件大小 132 | * 133 | * @access protected 134 | * @return boolean 135 | */ 136 | protected function _parseFileSize() { 137 | 138 | if ($this->_limitSize) { 139 | if ($this->_files['size'] > $this->_limitSize) { 140 | $this->_errorMsg = '上传文件的大小超出所允许的上传范围!'; 141 | return false; 142 | } 143 | } 144 | 145 | return true; 146 | } 147 | 148 | /** 149 | * 分析文件的格式类型(Mime Tyep) 150 | * 151 | * @access protected 152 | * @return boolean 153 | */ 154 | protected function _parseFileType() { 155 | 156 | if ($this->_limitType && is_array($this->_limitType)) { 157 | 158 | //获取文件后缀 159 | $extName = strtolower(substr(strrchr($this->_files['name'], '.'), 1)); 160 | if (!in_array($extName, $this->_limitType)) { 161 | $this->_errorMsg = '上传文件的格式不正确!'; 162 | return false; 163 | } 164 | } 165 | 166 | return true; 167 | } 168 | 169 | } -------------------------------------------------------------------------------- /doitphp/library/Cookie.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Cookie.php 2.0 2012-12-20 22:07:17Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Cookie { 19 | 20 | /** 21 | * Cookie存贮默认配置信息 22 | * 23 | * @var array 24 | */ 25 | protected $_defaultOptions = array( 26 | 'expire' => 3600, 27 | 'path' => '/', 28 | 'domain' => null, 29 | ); 30 | 31 | /** 32 | * Cookie的存贮设置选项 33 | * 34 | * @var array 35 | */ 36 | protected $_options = null; 37 | 38 | /** 39 | * 构造函数 40 | * 41 | * @access public 42 | * @return boolean 43 | */ 44 | public function __construct() { 45 | $options = Configure::get('cookie'); 46 | $this->_options = ($options && is_array($options)) ? $options : array(); 47 | $this->_options += $this->_defaultOptions; 48 | 49 | return true; 50 | } 51 | 52 | /** 53 | * 获取某cookie变量的值 54 | * 55 | * @access public 56 | * 57 | * @param string $cookieName cookie变量名 58 | * @param mixed $default 默认值 59 | * 60 | * @return mixed 61 | */ 62 | public function get($cookieName, $default = null) { 63 | 64 | //参数分析 65 | if (!$cookieName) { 66 | return null; 67 | } 68 | if (!isset($_COOKIE[$cookieName])) { 69 | return $default; 70 | } 71 | 72 | if ($this->_options['secretkey']) { 73 | $value = Doit::singleton('Encrypt')->decode($_COOKIE[$cookieName], $this->_options['secretkey']); 74 | return unserialize($value); 75 | } 76 | 77 | return unserialize(base64_decode($_COOKIE[$cookieName])); 78 | } 79 | 80 | /** 81 | * 设置某cookie变量的值 82 | * 83 | * @access public 84 | * 85 | * @param string $cookieName cookie的变量名 86 | * @param mixed $value cookie值 87 | * @param integer $expire cookie的生存周期 88 | * @param string $path cookie所存放的目录 89 | * @param string $domain cookie所支持的域名 90 | * 91 | * @return boolean 92 | */ 93 | public function set($cookieName, $value, $expire = null, $path = null, $domain = null) { 94 | 95 | //参数分析 96 | if (!$cookieName) { 97 | return false; 98 | } 99 | 100 | $expire = is_null($expire) ? $this->_options['expire'] : $expire; 101 | $path = is_null($path) ? $this->_options['path'] : $path; 102 | $domain = is_null($domain) ? $this->_options['domain'] : $domain; 103 | 104 | $expire = $_SERVER['REQUEST_TIME'] + $this->_options['expire']; 105 | if ($this->_options['secretkey']) { 106 | $value = Doit::singleton('Encrypt')->encode(serialize($value), $this->_options['secretkey']); 107 | } else { 108 | $value = base64_encode(serialize($value)); 109 | } 110 | 111 | setcookie($cookieName, $value, $expire, $path, $domain); 112 | $_COOKIE[$cookieName] = $value; 113 | 114 | return true; 115 | } 116 | 117 | /** 118 | * 删除某个Cookie变量 119 | * 120 | * @access public 121 | * 122 | * @param string $name cookie的名称 123 | * 124 | * @return boolean 125 | */ 126 | public function delete($name) { 127 | 128 | //参数分析 129 | if (!$name) { 130 | return false; 131 | } 132 | 133 | self::set($name, null, '-3600'); 134 | unset($_COOKIE[$name]); 135 | 136 | return true; 137 | } 138 | 139 | /** 140 | * 清空cookie 141 | * 142 | * @access public 143 | * @return boolean 144 | */ 145 | public function clear() { 146 | 147 | if (isset($_COOKIE)) { 148 | unset($_COOKIE); 149 | } 150 | 151 | return true; 152 | } 153 | 154 | } -------------------------------------------------------------------------------- /doitphp/core/Log.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://www.doitphp.com 9 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Log.php 2.0 2012-11-29 23:33:00Z tommy $ 12 | * @package core 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | abstract class Log { 21 | 22 | /** 23 | * 写入日志 24 | * 25 | * @access public 26 | * 27 | * @param string $message 所要写入的日志内容 28 | * @param string $level 日志类型. 参数:Warning, Error, Notice 29 | * @param string $logFileName 日志文件名 30 | * 31 | * @return boolean 32 | */ 33 | public static function write($message, $level = 'Error', $logFileName = null) { 34 | 35 | //参数分析 36 | if (!$message) { 37 | return false; 38 | } 39 | 40 | //当日志写入功能关闭时 41 | if(Configure::get('application.log') === false){ 42 | return true; 43 | } 44 | 45 | $logFilePath = self::_getLogFilePath($logFileName); 46 | 47 | //分析日志文件存放目录 48 | $logDir = dirname($logFilePath); 49 | if (!is_dir($logDir)) { 50 | mkdir($logDir, 0777, true); 51 | } 52 | 53 | //分析记录日志的当前页面 54 | $moduleId = Doit::getModuleName(); 55 | $controllerId = ((!$moduleId) ? '' : $moduleId . '::') . Doit::getControllerName(); 56 | $actionId = Doit::getActionName(); 57 | 58 | //分析日志内容 59 | $message = "[{$controllerId}][{$actionId}]:" . $message; 60 | 61 | return error_log(date('[Y-m-d H:i:s]') . " {$level}: {$message} IP: {$_SERVER['REMOTE_ADDR']}\n", 3, $logFilePath); 62 | } 63 | 64 | /** 65 | * 显示日志内容 66 | * 67 | * 显示日志文件内容,以列表的形式显示.便于程序调用查看日志 68 | * 69 | * @access public 70 | * 71 | * @param string $logFileName 所要显示的日志文件内容,默认为null, 即当天的日志文件名.注:不带后缀名.log 72 | * 73 | * @return string 74 | */ 75 | public static function show($logFileName = null) { 76 | 77 | //参数分析 78 | $logFilePath = self::_getLogFilePath($logFileName); 79 | $logContent = is_file($logFilePath) ? file_get_contents($logFilePath) : ''; 80 | 81 | $logArray = explode("\n", $logContent); 82 | $totalLines = sizeof($logArray); 83 | 84 | //清除不必要内存占用 85 | unset($logContent); 86 | 87 | //输出日志内容 88 | echo ''; 89 | 90 | foreach ($logArray as $key=>$logString) { 91 | 92 | if ($key == $totalLines - 1) { 93 | continue; 94 | } 95 | 96 | $bgColor = ($key % 2 == 0) ? '#FFFFFF' : '#C6E7FF'; 97 | 98 | echo ''; 99 | } 100 | 101 | echo '
 ' . $logString . '
'; 102 | } 103 | 104 | /** 105 | * 获取当前日志文件名 106 | * 107 | * @example 108 | * 109 | * $this->_getLogFilePath('sql'); 110 | * 或 111 | * $this->_getLogFilePath('2012-11.2012-11-23'); 112 | * 或 113 | * $this->_getLogFilePath('2012-11/2012-11-23'); 114 | * 115 | * @access private 116 | * 117 | * @param $logFileName 日志文件名 118 | * 119 | * @return string 120 | */ 121 | private static function _getLogFilePath($logFileName = null) { 122 | 123 | //参数分析 124 | if ($logFileName && strpos($logFileName, '.') !== false) { 125 | $logFileName = str_replace('.', '/', $logFileName); 126 | } 127 | 128 | //组装日志文件路径 129 | $logFilePath = rtrim(Configure::get('application.logPath'), '/'); 130 | if (!$logFileName) { 131 | $logFilePath .= DS . date('Y-m') . '/' . date('Y-m-d'); 132 | } else { 133 | if (strpos($logFileName, '/') !== false) { 134 | $logFilePath .= DS . $logFileName; 135 | } else { 136 | $logFilePath .= DS . date('Y-m') . '/' . $logFileName; 137 | } 138 | } 139 | $logFilePath .= '.log'; 140 | 141 | return $logFilePath; 142 | } 143 | } -------------------------------------------------------------------------------- /doitphp/core/Extension.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Extension.php 2.0 2012-12-19 23:29:01Z tommy $ 10 | * @package core 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | abstract class Extension extends Controller { 19 | 20 | /** 21 | * 扩展模块实例化对象存贮数组 22 | * 23 | * @var object 24 | */ 25 | private static $_extensionObjArray = array(); 26 | 27 | /** 28 | * 设置视图文件布局结构视图的文件名(layout) 29 | * 30 | * 挂件(Widget)的视图机制不支持layout视图 31 | * 32 | * @access public 33 | * 34 | * @param string $layoutName 所要设置的layout名称。默认值为:null,即:不使用layout视图 35 | * 36 | * @return boolean 37 | */ 38 | public function setLayout($layoutName = null) { 39 | 40 | return false; 41 | } 42 | 43 | /** 44 | * 分析并加载视图缓存 45 | * 46 | * 注:挂件(Widget)的视图机制不支持视图缓存 47 | * 48 | * @access public 49 | * 50 | * @param string $cacheId 页面文件的缓存ID 51 | * @param integer $expire 页面缓存的生存周期 52 | * 53 | * @return mixed 54 | */ 55 | public function cache($cacheId = null, $expire = null) { 56 | 57 | return false; 58 | } 59 | 60 | /** 61 | * 加载视图处理类并完成视图类的实例化 62 | * 63 | * 注:本类方法为回调类方法。 64 | * 65 | * @access protected 66 | * @return object 67 | */ 68 | protected function initView() { 69 | 70 | return null; 71 | } 72 | 73 | /** 74 | * 显示当前页面的视图内容 75 | * 76 | * 注:挂件(Widget)的视图机制不支持Layout视图 77 | * 78 | * @access public 79 | * 80 | * @param string $fileName 视图名称 81 | * 82 | * @return string 83 | */ 84 | public function display($fileName = null) { 85 | 86 | return false; 87 | } 88 | 89 | /** 90 | * 视图变量赋值操作 91 | * 92 | * @access public 93 | * 94 | * @param mixed $keys 视图变量名 95 | * @param mixed $value 视图变量值 96 | * 97 | * @return void 98 | */ 99 | public function assign($keys, $value = null) { 100 | 101 | return false; 102 | } 103 | 104 | /** 105 | * 加载并显示视图片段文件内容 106 | * 107 | * 相当于include 代码片段,当$return为:true时返回代码代码片段内容,反之则显示代码片段内容 108 | * 109 | * @access public 110 | * 111 | * @param string $fileName 视图片段文件名称 112 | * @param array $data 视图模板变量,注:数组型 113 | * @param boolean $return 视图内容是否为返回,当为true时为返回,为false时则为显示。 默认为:false 114 | * 115 | * @return string 116 | */ 117 | public function render($fileName = null, $data = array(), $return = false) { 118 | 119 | return false; 120 | } 121 | 122 | /** 123 | * 获取当前扩展目录的路径 124 | * 125 | * @access protected 126 | * 127 | * @param string $extensionName 扩展插件名称 128 | * 129 | * @return string 130 | */ 131 | protected static function _getExtRoot($extensionName) { 132 | 133 | return BASE_PATH . '/extensions/' . $extensionName; 134 | } 135 | 136 | /** 137 | * 获取当前扩展目录的路径 138 | * 139 | * @access public 140 | * @return string 141 | */ 142 | public function getExtRoot() { 143 | 144 | return BASE_PATH . '/extensions/' . $this->getExtName(); 145 | } 146 | 147 | /** 148 | * 获取当前的扩展模块的名称 149 | * 150 | * @access public 151 | * @return string 152 | */ 153 | public function getExtName() { 154 | 155 | return substr(get_class($this), 0, -3); 156 | } 157 | 158 | /** 159 | * 加载并单例模式实例化扩展模块(通常为第三方程序) 160 | * 161 | * 注:这里所调用的扩展模声要放在项目extension目录里的子目录中 162 | * 163 | * @access public 164 | * 165 | * @param string $extensionName 扩展插件名称 166 | * 167 | * @access object 168 | */ 169 | final public static function loadExtension($extensionName) { 170 | 171 | //参数分析 172 | if (!$extensionName) { 173 | return false; 174 | } 175 | 176 | //当所加载的扩展模块还示被实例化时 177 | if (!isset(self::$_extensionObjArray[$extensionName])) { 178 | 179 | //加载扩展模块的引导文件(index) 180 | $extensionPath = self::_getExtRoot($extensionName) . DS . $extensionName . 'Ext.php'; 181 | Doit::loadFile($extensionPath); 182 | 183 | self::$_extensionObjArray[$extensionName] = Doit::singleton($extensionName . 'Ext'); 184 | } 185 | 186 | return self::$_extensionObjArray[$extensionName]; 187 | } 188 | } -------------------------------------------------------------------------------- /doitphp/library/Calendar.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Calendar.php 2.0 2012-12-30 01:28:54Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Calendar { 19 | 20 | /** 21 | * 日历的年份 22 | * 23 | * @var integer 24 | */ 25 | protected $_year = null; 26 | 27 | /** 28 | * 日历的月份 29 | * 30 | * @var integer 31 | */ 32 | protected $_month = null; 33 | 34 | /** 35 | * 日历中已使用的日期 36 | * 37 | * @var array 38 | */ 39 | protected $_usedDays = array(); 40 | 41 | /** 42 | * 设置日历的年份 43 | * 44 | * 默认为当前的年份 45 | * 46 | * @access public 47 | * 48 | * @param integer $year 所要设置的年份 49 | * 50 | * @return object 51 | */ 52 | public function setYear($year) { 53 | 54 | //参数分析 55 | if ($year && is_int($year)) { 56 | $this->_year = $year; 57 | } 58 | 59 | return $this; 60 | } 61 | 62 | /** 63 | * 设置月份 64 | * 65 | * 默认为当前月份 66 | * 67 | * @access public 68 | * 69 | * @param integer $month 所要设置的月份 70 | * 71 | * @return object 72 | */ 73 | public function setMonth($month) { 74 | 75 | //参数分析 76 | if ($month && is_int($month)) { 77 | $this->_month = $month; 78 | } 79 | 80 | return $this; 81 | } 82 | 83 | /** 84 | * 设置已占用的日期 85 | * 86 | * @access public 87 | * 88 | * @param array $days 已占用的日期。注:本参数为数组 89 | * 90 | * @return object 91 | */ 92 | public function setUsedDays($days) { 93 | 94 | //参数分析 95 | if ($days && is_array($days)) { 96 | $this->_usedDays = $days; 97 | } 98 | 99 | return $this; 100 | } 101 | 102 | /** 103 | * 输出日历数组 104 | * 105 | * @access public 106 | * @return array 107 | */ 108 | public function render() { 109 | 110 | return $this->_processData(); 111 | } 112 | 113 | /** 114 | * 处理日历数组 115 | * 116 | * @access protected 117 | * @return array 118 | */ 119 | protected function _processData() { 120 | 121 | //分析数组 122 | $this->_year = (!$this->_year) ? date('Y') : $this->_year; 123 | $this->_month = (!$this->_month) ? date('m') : $this->_month; 124 | 125 | $yearNow = date('Y'); 126 | $monthNow = date('m'); 127 | $dateNow = date('j'); 128 | 129 | $timeIndex = mktime(0, 0, 0, $this->_month, 1, $this->_year); 130 | 131 | //获取当前所在月份的总天数,第一天的星期数。 132 | $totalDays = date('t', $timeIndex); 133 | $dayIndex = date('w', $timeIndex); 134 | 135 | //计算日历的总行数。 136 | $totalRowNum = ceil(($totalDays + $dayIndex)/7); 137 | 138 | //分析日期占用 139 | $usedDayArray = (!$this->_usedDays) ? array() : array_keys($this->_usedDays); 140 | 141 | //分析日历数组 142 | $data = array('year'=>$this->_year, 'month'=>$this->_month, 'content'=>array()); 143 | 144 | for ($i = 0; $i < $totalRowNum; $i ++) { 145 | for($k = 0; $k < 7; $k ++) { 146 | //所要显示的日期 147 | $dateShow = intval( 7 * $i + $k - $dayIndex + 1); 148 | if (($dateShow < 1) || ($dateShow > $totalDays)) { 149 | $data['content'][$i][$k] = array('date'=> null, 'status'=> false); 150 | } else { 151 | //分析已占用的日期状态 152 | $usedStatus = in_array($dateShow, $usedDayArray) ? true : false; 153 | $todayStatus = (!$usedStatus && ($dateShow == $dateNow) && ($yearNow == $this->_year && $monthNow == $this->_month)) ? true : false; 154 | 155 | $data['content'][$i][$k] = array('date' => $dateShow); 156 | if ($usedStatus) { 157 | $data['content'][$i][$k]['status'] = 'used'; 158 | $data['content'][$i][$k]['ext'] = $this->_usedDays[$dateShow]; 159 | } else if ($todayStatus) { 160 | $data['content'][$i][$k]['status'] = 'today'; 161 | } else { 162 | $data['content'][$i][$k]['status'] = true; 163 | } 164 | } 165 | } 166 | } 167 | 168 | return $data; 169 | } 170 | 171 | } -------------------------------------------------------------------------------- /doitphp/library/Session.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (c) 2010 Tommy Software Studio 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Session.php 2.0 2012-12-20 23:09:01Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Session { 19 | 20 | /** 21 | * session的启动状态 22 | * 23 | * @var boolean 24 | */ 25 | protected static $_start = false; 26 | 27 | /** 28 | * 构造方法 29 | * 30 | * @access public 31 | * @return void 32 | */ 33 | public function __construct() { 34 | 35 | //设置session的生存周期 36 | $this->_setTimeout(); 37 | 38 | //启动session 39 | $this->start(); 40 | 41 | return true; 42 | } 43 | 44 | /** 45 | * 启动session 46 | * 47 | * @access public 48 | * @return boolean 49 | */ 50 | public static function start() { 51 | 52 | if (self::$_start === true) { 53 | return true; 54 | } 55 | 56 | //设置项目系统session的存放目录 57 | $sessionPath = Configure::get('session.path'); 58 | if ($sessionPath && is_dir($sessionPath) && is_writable($sessionPath)) { 59 | session_save_path($sessionPath); 60 | } 61 | 62 | session_start(); 63 | self::$_start = true; 64 | 65 | return true; 66 | } 67 | 68 | /** 69 | * 设置session变量的值 70 | * 71 | * @access public 72 | * 73 | * @param string $key session变量名 74 | * @param mixed $value session值 75 | * 76 | * @return boolean 77 | */ 78 | public static function set($key, $value = null) { 79 | 80 | //参数分析 81 | if (!$key) { 82 | return false; 83 | } 84 | 85 | //分析是否开启session 86 | if (self::$_start === false) { 87 | self::start(); 88 | } 89 | 90 | $_SESSION[$key] = $value; 91 | 92 | return true; 93 | } 94 | 95 | /** 96 | * 获取某session变量的值 97 | * 98 | * @access public 99 | * 100 | * @param string $key session变量名 101 | * @param mixted $default 默认值 102 | * 103 | * @return mixted 104 | */ 105 | public static function get($key, $default = null) { 106 | 107 | //参数分析 108 | if (!$key) { 109 | return isset($_SESSION) ? $_SESSION : null; 110 | } 111 | 112 | //分析是否开启session 113 | if (self::$_start === false) { 114 | self::start(); 115 | } 116 | 117 | //当查询的session不存在时,返回默认值 118 | if (!isset($_SESSION[$key])) { 119 | return $default; 120 | } 121 | 122 | return $_SESSION[$key]; 123 | } 124 | 125 | /** 126 | * 删除某session的值 127 | * 128 | * @access public 129 | * @return boolean 130 | */ 131 | public static function delete($key) { 132 | 133 | //参数分析 134 | if (!$key) { 135 | return false; 136 | } 137 | 138 | if (!isset($_SESSION[$key])){ 139 | return false; 140 | } 141 | 142 | unset($_SESSION[$key]); 143 | 144 | return true; 145 | } 146 | 147 | /** 148 | * 清空session值 149 | * 150 | * @access public 151 | * @return boolean 152 | */ 153 | public static function clear(){ 154 | 155 | $_SESSION = array(); 156 | 157 | return true; 158 | } 159 | 160 | /** 161 | * 注销session 162 | * 163 | * @access public 164 | * @return boolean 165 | */ 166 | public static function destory() { 167 | 168 | if (self::$_start === true){ 169 | unset($_SESSION); 170 | session_destroy(); 171 | } 172 | 173 | return true; 174 | } 175 | 176 | /** 177 | * 停止session写入 178 | * 179 | * @access public 180 | * @return boolean 181 | */ 182 | public static function close(){ 183 | 184 | if (self::$_start === true) { 185 | session_write_close(); 186 | } 187 | 188 | return true; 189 | } 190 | 191 | /** 192 | * 设置session最大存活时间. 193 | * 194 | * @access protected 195 | * @return boolean 196 | */ 197 | protected static function _setTimeout() { 198 | 199 | //获取session的系统配置信息 200 | $configExpire = Configure::get('session.expire'); 201 | 202 | if (!$configExpire) { 203 | return false; 204 | } 205 | 206 | return ini_set('session.gc_maxlifetime', $configExpire); 207 | } 208 | 209 | /** 210 | * 析构函数 211 | * 212 | * 程序执行完毕,打扫战场 213 | * 214 | * @access public 215 | * 216 | * @return void 217 | */ 218 | public function __destruct() { 219 | 220 | $this->close(); 221 | return true; 222 | } 223 | } -------------------------------------------------------------------------------- /doitphp/library/Client.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Copyright (c) 2010 Tommy Software Studio 8 | * @link http://www.doitphp.com 9 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 10 | * @version $Id: Client.php 1.3 2011-11-11 20:50:01Z tommy $ 11 | * @package library 12 | * @since 1.0 13 | */ 14 | 15 | if (!defined('IN_DOIT')) { 16 | exit(); 17 | } 18 | 19 | class Client { 20 | 21 | /** 22 | * 获取客户端系统语言 23 | * 24 | * @access public 25 | * @return string 26 | */ 27 | public static function getLanguage() { 28 | 29 | return isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? htmlspecialchars($_SERVER['HTTP_ACCEPT_LANGUAGE']) : null; 30 | } 31 | 32 | /** 33 | * 获取当前页面的url来源 34 | * 35 | * @access public 36 | * @return string 37 | */ 38 | public static function getUrlSource() { 39 | 40 | return isset($_SERVER['HTTP_REFERER']) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : null; 41 | } 42 | 43 | /** 44 | * 获取客户端浏览器信息. 45 | * 46 | * @access public 47 | * @return string 48 | */ 49 | public static function getBrowserAgent() { 50 | 51 | return isset($_SERVER['HTTP_USER_AGENT']) ? htmlspecialchars($_SERVER['HTTP_USER_AGENT']) : null; 52 | } 53 | 54 | /** 55 | * 获取客户端浏览器信息 56 | * 57 | * @access public 58 | * @return string 59 | */ 60 | public static function getBrowser() { 61 | 62 | $userAgentInfo = htmlspecialchars($_SERVER['HTTP_USER_AGENT']); 63 | 64 | $browserArray = array( 65 | 'MSIE 11.0' => 'IE11', 66 | 'MSIE 10.0' => 'IE10', 67 | 'MSIE 9.0' => 'IE9', 68 | 'MSIE 8.0' => 'IE8', 69 | 'MSIE 7.0' => 'IE7', 70 | 'MSIE 6.0' => 'IE6', 71 | 'Firefox' => 'Firefox', 72 | 'Chrome' => 'Chrome', 73 | 'Safari' => 'Safari', 74 | 'Elinks' => 'Elinks', 75 | 'OmniWeb' => 'OmniWeb', 76 | 'Links' => 'Links', 77 | 'Lynx' => 'Lynx', 78 | 'Arora' => 'Arora', 79 | 'Epiphany' => 'Epiphany', 80 | 'Konqueror' => 'Konqueror', 81 | 'EudoraWeb' => 'EudoraWeb', 82 | 'Minimo' => 'Minimo', 83 | 'NetFront' => 'NetFront', 84 | 'POLARIS' => 'Polaris', 85 | 'BlackBerry'=> 'BlackBerry', 86 | 'Nokia' => 'Nokia', 87 | ); 88 | 89 | foreach ($browserArray as $key=>$value) { 90 | if(strpos($userAgentInfo,$key)) { 91 | return $value; 92 | } 93 | } 94 | 95 | return 'Others'; 96 | } 97 | 98 | /** 99 | * 获取客户端操作系统信息 100 | * 101 | * @access public 102 | * @return string 103 | */ 104 | public static function getOs() { 105 | 106 | $userAgentInfo = htmlspecialchars($_SERVER['HTTP_USER_AGENT']); 107 | 108 | $OsArray = array( 109 | 'Windows NT 6.3' => 'Windows 8.1', 110 | 'Windows NT 6.2' => 'Windows 8', 111 | 'Windows NT 6.1' => 'Windows 7', 112 | 'Windows NT 5.1' => 'Windows XP', 113 | 'Android' => 'Android', 114 | 'iPhone' => 'iPhone', 115 | 'Symbian' => 'Symbian', 116 | 'Mac OS X' => 'Mac OS X', 117 | 'Windows Phone' => 'Windows Phone', 118 | 'Ubuntu' => 'Ubuntu', 119 | 'Debian' => 'Debian', 120 | 'Fedora' => 'Fedora', 121 | 'redhat' => 'RedHat', 122 | 'Linux' => 'Linux', 123 | 'FreeBSD' => 'FreeBSD', 124 | 'SunOS' => 'SunOS', 125 | 'OpenBSD' => 'OpenBSD', 126 | 'NetBSD' => 'NetBSD', 127 | 'Mac OS X Mach-O' => 'OS X Mach', 128 | 'Windows NT 6.0' => 'Windows Vista', 129 | 'Windows NT 5.2' => 'Windows 2003', 130 | 'Windows NT 5.0' => 'Windows 2000', 131 | 'Windows ME' => 'Windows ME', 132 | 'PPC Mac OS X' => 'OS X PPC', 133 | 'Intel Mac OS X' => 'OS X Intel', 134 | 'Win98' => 'Windows 98', 135 | 'Win95' => 'Windows 95', 136 | 'WinNT4.0' => 'Windows NT4.0', 137 | 'AppleWebKit' => 'WebKit', 138 | 'Mint/8' => 'Mint 8', 139 | 'Minefield' => 'Minefield Alpha', 140 | 'gentoo' => 'Gentoo', 141 | 'Kubuntu' => 'Kubuntu', 142 | 'Slackware/13.0' => 'Slackware 13', 143 | 'DragonFly' => 'DragonFly', 144 | 'IRIX' => 'IRIX', 145 | 'Windows CE' => 'Windows CE', 146 | 'PalmOS' => 'PalmOS', 147 | 'DragonFly' => 'DragonFly', 148 | 'webOS' => 'webOS', 149 | 'PalmSource' => 'PalmSource', 150 | ); 151 | 152 | foreach ($OsArray as $key=>$value) { 153 | if(strpos($userAgentInfo,$key)) { 154 | return $value; 155 | } 156 | } 157 | 158 | return 'Others'; 159 | } 160 | } -------------------------------------------------------------------------------- /doitphp/library/Validation.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2010 Tommy Software Studio 9 | * @link http://www.doitphp.com 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Validation.php 2.0 2012-12-22 23:50:01Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class Validation { 21 | 22 | /** 23 | * 正则表达式验证email格式 24 | * 25 | * @param string $str 所要验证的邮箱地址 26 | * @return boolean 27 | */ 28 | public static function isEmail($str) { 29 | 30 | if (!$str) { 31 | return false; 32 | } 33 | 34 | return preg_match('#[a-z0-9&\-_.]+@[\w\-_]+([\w\-.]+)?\.[\w\-]+#is', $str) ? true : false; 35 | } 36 | 37 | /** 38 | * 正则表达式验证网址 39 | * 40 | * @param string $str 所要验证的网址 41 | * @return boolean 42 | */ 43 | public static function isUrl($str) { 44 | 45 | if (!$str) { 46 | return false; 47 | } 48 | 49 | return preg_match('#(http|https|ftp|ftps)://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?#i', $str) ? true : false; 50 | } 51 | 52 | /** 53 | * 验证字符串中是否含有汉字 54 | * 55 | * @param integer $string 所要验证的字符串。注:字符串编码仅支持UTF-8 56 | * @return boolean 57 | */ 58 | public static function isChineseCharacter($string) { 59 | 60 | if (!$string) { 61 | return false; 62 | } 63 | 64 | return preg_match('~[\x{4e00}-\x{9fa5}]+~u', $string) ? true : false; 65 | } 66 | 67 | /** 68 | * 验证字符串中是否含有非法字符 69 | * 70 | * @param string $string 待验证的字符串 71 | * @return boolean 72 | */ 73 | public static function isInvalidStr($string) { 74 | 75 | if (!$string) { 76 | return false; 77 | } 78 | 79 | return preg_match('#[!\#$%^&*(){}~`"\';:?+=<>/\[\]]+#', $string) ? true : false; 80 | } 81 | 82 | /** 83 | * 用正则表达式验证邮证编码 84 | * 85 | * @param integer $num 所要验证的邮政编码 86 | * @return boolean 87 | */ 88 | public static function isPostNum($num) { 89 | 90 | if (!$num) { 91 | return false; 92 | } 93 | 94 | return preg_match('#^[1-9][0-9]{5}$#', $num) ? true : false; 95 | } 96 | 97 | /** 98 | * 正则表达式验证身份证号码 99 | * 100 | * @param integer $num 所要验证的身份证号码 101 | * @return boolean 102 | */ 103 | public static function isPersonalCard($num) { 104 | 105 | if (!$num) { 106 | return false; 107 | } 108 | 109 | return preg_match('#^[\d]{15}$|^[\d]{18}$#', $num) ? true : false; 110 | } 111 | 112 | /** 113 | * 正则表达式验证IP地址, 注:仅限IPv4 114 | * 115 | * @param string $str 所要验证的IP地址 116 | * @return boolean 117 | */ 118 | public static function isIp($str) { 119 | 120 | if (!$str) { 121 | return false; 122 | } 123 | 124 | if (!preg_match('#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $str)) { 125 | return false; 126 | } 127 | 128 | $ipArray = explode('.', $str); 129 | 130 | //真实的ip地址每个数字不能大于255(0-255) 131 | return ($ipArray[0]<=255 && $ipArray[1]<=255 && $ipArray[2]<=255 && $ipArray[3]<=255) ? true : false; 132 | } 133 | 134 | /** 135 | * 用正则表达式验证出版物的ISBN号 136 | * 137 | * @param integer $str 所要验证的ISBN号,通常是由13位数字构成 138 | * @return boolean 139 | */ 140 | public static function isBookIsbn($str) { 141 | 142 | if (!$str) { 143 | return false; 144 | } 145 | 146 | return preg_match('#^978[\d]{10}$|^978-[\d]{10}$#', $str) ? true : false; 147 | } 148 | 149 | /** 150 | * 用正则表达式验证手机号码(中国大陆区) 151 | * @param integer $num 所要验证的手机号 152 | * @return boolean 153 | */ 154 | public static function isMobile($num) { 155 | 156 | if (!$num) { 157 | return false; 158 | } 159 | 160 | return preg_match('#^13[\d]{9}$|14^[0-9]\d{8}|^15[0-9]\d{8}$|^18[0-9]\d{8}$#', $num) ? true : false; 161 | } 162 | 163 | /** 164 | * 检查字符串是否为空 165 | * 166 | * @access public 167 | * @param string $string 字符串内容 168 | * @return boolean 169 | */ 170 | public static function isMust($string = null) { 171 | 172 | //参数分析 173 | if (is_null($string)) { 174 | return false; 175 | } 176 | 177 | return is_null($string) ? false : true; 178 | } 179 | 180 | /** 181 | * 检查字符串长度 182 | * 183 | * @access public 184 | * @param string $string 字符串内容 185 | * @param integer $min 最小的字符串数 186 | * @param integer $max 最大的字符串数 187 | */ 188 | public static function isLength($string = null, $min = 0, $max = 255) { 189 | 190 | //参数分析 191 | if (is_null($string)) { 192 | return false; 193 | } 194 | //获取字符串长度 195 | $length = (strlen($string) + mb_strlen($string, 'UTF8')) / 2; 196 | 197 | return (($length >= (int)$min) && ($length <= (int)$max)) ? true : false; 198 | } 199 | } -------------------------------------------------------------------------------- /doitphp/library/cache/File.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2012 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Cache_File.php 2.0 2012-12-30 21:04:41Z tommy $ 10 | * @package cache 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Cache_File { 19 | 20 | /** 21 | * 单例模式实例化本类 22 | * 23 | * @var object 24 | */ 25 | protected static $_instance = null; 26 | 27 | /** 28 | * 缓存目录 29 | * 30 | * @var string 31 | */ 32 | protected $_cachePath = null; 33 | 34 | /** 35 | * 默认的缓存策略 36 | * 37 | * @var array 38 | */ 39 | protected $_defaultOptions = array('expire' => 86400); 40 | 41 | /** 42 | * 构造方法 43 | * 44 | * @access public 45 | * @return boolean 46 | */ 47 | public function __construct() { 48 | 49 | $this->_cachePath = CACHE_PATH . '/data'; 50 | 51 | return true; 52 | } 53 | 54 | /** 55 | * 设置缓存 56 | * 57 | * @access public 58 | * 59 | * @param string $key 缓存数据key 60 | * @param mixed $value 缓存数据值 61 | * @param string $expire 缓存生存周期 62 | * 63 | * @return boolean 64 | */ 65 | public function set($key, $value, $expire = null) { 66 | 67 | //参数分析 68 | if (!$key) { 69 | return false; 70 | } 71 | if(is_null($expire)){ 72 | $expire = $_SERVER['REQUEST_TIME'] + $this->_defaultOptions['expire']; 73 | }else if ($expire === 0) { 74 | $expire = 0; 75 | }else{ 76 | $expire += $_SERVER['REQUEST_TIME']; 77 | } 78 | 79 | //分析缓存文件 80 | $filePath = $this->_parseCacheFile($key); 81 | 82 | //分析缓存内容 83 | $content = '_parseCacheFile($key); 106 | 107 | if (!is_file($filePath)) { 108 | return false; 109 | } 110 | 111 | $data = include $filePath; 112 | 113 | //当缓存文件非永久且过期时 114 | if ($data[0] && $_SERVER['REQUEST_TIME'] > $data[0]) { 115 | unlink($filePath); 116 | return false; 117 | } 118 | 119 | return $data[1]; 120 | } 121 | 122 | /** 123 | * 缓存一个变量到数据存储 124 | * 125 | * @access public 126 | * 127 | * @param string $key 数据key 128 | * @param mixed $value 数据值 129 | * @param int $expire 缓存时间(秒) 130 | * 131 | * @return boolean 132 | */ 133 | public function add($key, $value, $expire = null) { 134 | 135 | //参数分析 136 | if (!$key) { 137 | return false; 138 | } 139 | $expire = is_null($expire) ? $this->_defaultOptions['expire'] : $expire; 140 | 141 | return !$this->get($key) ? $this->set($key, $value, $expire) : false; 142 | } 143 | 144 | /** 145 | * 删除一条缓存数据 146 | * 147 | * @access public 148 | * 149 | * @param string $key 缓存数据key 150 | * 151 | * @return boolean 152 | */ 153 | public function delete($key) { 154 | 155 | //参数分析 156 | if (!$key) { 157 | return false; 158 | } 159 | 160 | //分析缓存文件 161 | $filePath = $this->_parseCacheFile($key); 162 | 163 | return is_file($filePath) ? unlink($filePath) : true; 164 | } 165 | 166 | /** 167 | * 清空所有的文件缓存 168 | * 169 | * @access public 170 | * @return boolean 171 | */ 172 | public function clear() { 173 | 174 | $fileList = File::readDir($this->_cachePath); 175 | 176 | //删除所有的缓存文件 177 | foreach ($fileList as $fileName) { 178 | if (strpos($fileName, '.filecache.php') !== false) { 179 | unlink($this->_cachePath . DS . $fileName); 180 | } 181 | } 182 | 183 | return true; 184 | } 185 | 186 | /** 187 | * 分析缓存文件名 188 | * 189 | * @access protected 190 | * 191 | * @param string $key 缓存数据key 192 | * 193 | * @return string 194 | */ 195 | protected function _parseCacheFile($key) { 196 | 197 | return $this->_cachePath . DS . md5($key) . '.filecache.php'; 198 | } 199 | 200 | /** 201 | * 单例模式 202 | * 203 | * 用于本类的单例模式(singleton)实例化 204 | * 205 | * @access public 206 | * @return object 207 | */ 208 | public static function getInstance() { 209 | 210 | if (!self::$_instance) { 211 | self::$_instance = new self(); 212 | } 213 | 214 | return self::$_instance; 215 | } 216 | } -------------------------------------------------------------------------------- /doitphp/library/Tree.php: -------------------------------------------------------------------------------- 1 | , tommy 6 | * @copyright CopyRight DoitPHP team, initphp team 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Tree.php 2.0 2012-12-29 19:01:01Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Tree { 19 | 20 | /** 21 | * 分类的父ID的键名(key) 22 | * 23 | * @var integer 24 | */ 25 | private $_parentId = 'pid'; 26 | 27 | /** 28 | * 分类的ID(key) 29 | * 30 | * @var integer 31 | */ 32 | private $_id = 'id'; 33 | 34 | /** 35 | * 分类名 36 | * 37 | * @var string 38 | */ 39 | private $_name = 'name'; 40 | 41 | /** 42 | * 子分类名 43 | * 44 | * @var string 45 | */ 46 | private $_child = 'child'; 47 | 48 | /** 49 | * 无限级分类树-初始化配置 50 | * 51 | * @access public 52 | * 53 | * @param array $config 配置分类的键 54 | * 55 | * @return $this 56 | * 57 | * @example 58 | * 59 | * 法一: 60 | * $params = array('parentId'=>'pid', 'id' => 'cat_id', 'name' =>'cat_name'); 61 | * $this->config($params ); 62 | * 63 | * 法二: 64 | * $params = array('parentId'=>'pid', 'id' => 'cat_id', 'name' =>'cat_name', 'child'=>'node'); 65 | * $this->config($params ); 66 | */ 67 | public function config($params) { 68 | 69 | //parse params 70 | if (!$params || !is_array($params)) { 71 | return false; 72 | } 73 | 74 | $this->_parentId = (isset($params['parentId'])) ? $params['parentId'] : $this->_parentId; 75 | $this->_id = (isset($params['id'])) ? $params['id'] : $this->_id; 76 | $this->_name = (isset($params['name'])) ? $params['name'] : $this->_name; 77 | $this->_child = (isset($params['child'])) ? $params['child'] : $this->_child; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * 无限级分类树-获取树 84 | * 85 | * 用于下拉框select标签的option内容 86 | * 87 | * @access public 88 | * 89 | * @param array $data 树的数组 90 | * @param int $parentId 初始化树时候,代表ID下的所有子集 91 | * @param int $selectId 选中的ID值 92 | * @param string $prefix 前缀 93 | * 94 | * @return mixed 95 | */ 96 | public function getHtmlOption($data, $parentId = 0, $selectId = null, $preFix = '|-') { 97 | 98 | //parse params 99 | if (!$data || !is_array($data)) { 100 | return ''; 101 | } 102 | 103 | $string = ''; 104 | foreach ($data as $key => $value) { 105 | if (isset($value[$this->_parentId]) && $value[$this->_parentId] == $parentId) { 106 | $string .= ''; 111 | $string .= $this->getHtmlOption($data, $value[$this->_id], $selectId, '  ' . $preFix); 112 | } 113 | } 114 | 115 | return $string ; 116 | } 117 | 118 | /** 119 | * 获取无限分类树 120 | * 121 | * @access public 122 | * 123 | * @param array $data 数组 124 | * @param integer $parentId 父ID 125 | * 126 | * @return array 127 | */ 128 | public function getTree($data, $parentId = 0) { 129 | 130 | //parse params 131 | if (!$data || !is_array($data)) { 132 | return ''; 133 | } 134 | 135 | //get child tree array 136 | $childArray = $this->getChild($data, $parentId); 137 | //当子分类无元素时,结果递归 138 | if(!sizeof($childArray)) { 139 | return ''; 140 | } 141 | 142 | $treeArray = array(); 143 | foreach ($childArray as $lines) { 144 | $treeArray[] = array( 145 | $this->_id => $lines[$this->_id], 146 | $this->_name => $lines[$this->_name], 147 | $this->_child => $this->getTree($data, $lines[$this->_id]), 148 | ); 149 | } 150 | 151 | return $treeArray; 152 | } 153 | 154 | /** 155 | * 无限级分类树-获取子类 156 | * 157 | * @access public 158 | * 159 | * @param array $data 树的数组 160 | * @param integer $id 父类ID 161 | * 162 | * @return mixed 163 | */ 164 | public function getChild($data, $id) { 165 | 166 | //parse params 167 | if (!$data || !is_array($data)) { 168 | return array(); 169 | } 170 | 171 | $tempArray = array(); 172 | foreach ($data as $value) { 173 | if ($value[$this->_parentId] == $id) { 174 | $tempArray[] = $value; 175 | } 176 | } 177 | 178 | return $tempArray; 179 | } 180 | 181 | /** 182 | * 无限级分类树-获取父类 183 | * 184 | * @access public 185 | * 186 | * @param array $data 树的数组 187 | * @param int $id 子类ID 188 | * 189 | * @return mixed 190 | */ 191 | public function getParent($data, $id) { 192 | 193 | //parse params 194 | if (!$data || !is_array($data)) { 195 | return array(); 196 | } 197 | 198 | $temp = array(); 199 | foreach ($data as $vaule) { 200 | $temp[$vaule[$this->_id]] = $vaule; 201 | } 202 | 203 | $parentId = $temp[$id][$this->_parentId]; 204 | 205 | return $temp[$parentId]; 206 | } 207 | 208 | } -------------------------------------------------------------------------------- /doitphp/core/WidgetTemplate.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://www.doitphp.com 9 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: WidgetTemplate.php 2.0 2012-12-16 23:12:00Z tommy $ 12 | * @package core 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class WidgetTemplate extends Template { 21 | 22 | /** 23 | * 单例模式实现化对象 24 | * 25 | * @var object 26 | */ 27 | protected static $_instance = null; 28 | 29 | /** 30 | * 视图变量数组 31 | * 32 | * @var array 33 | */ 34 | protected $_options = array(); 35 | 36 | /** 37 | * widget的名称,默认为null 38 | * 39 | * @var string 40 | */ 41 | public $widgetId = null; 42 | 43 | 44 | /** 45 | * 构造方法(函数) 46 | * 47 | * 用于初始化程序运行环境,或对基本变量进行赋值 48 | * 49 | * @access public 50 | * @return boolean 51 | */ 52 | public function __construct() { 53 | 54 | //获取当前的模块名称 55 | $moduleName = Doit::getModuleName(); 56 | 57 | //获取Widget文件目录路径 58 | if (!$moduleName) { 59 | $widgetPath = BASE_PATH . '/widgets'; 60 | } else { 61 | $widgetPath = BASE_PATH . '/modules/' . $moduleName . '/widgets'; 62 | } 63 | 64 | //设置挂件视图模板目录的路径 65 | $this->_viewPath = $widgetPath . '/views'; 66 | 67 | //设置视图编译缓存文件的默认目录路径 68 | $this->_compilePath = CACHE_PATH . '/views/widgets'; 69 | 70 | return true; 71 | } 72 | 73 | /** 74 | * 设置视图文件布局结构视图的文件名(layout) 75 | * 76 | * 挂件(Widget)的视图机制不支持layout视图 77 | * 78 | * @access public 79 | * 80 | * @param string $layoutName 所要设置的layout名称。默认值为:null,即:不使用layout视图 81 | * 82 | * @return boolean 83 | */ 84 | public function setLayout($layoutName = null) { 85 | 86 | return false; 87 | } 88 | 89 | /** 90 | * 分析并加载视图缓存 91 | * 92 | * 注:挂件(Widget)的视图机制不支持视图缓存 93 | * 94 | * @access public 95 | * 96 | * @param string $cacheId 页面文件的缓存ID 97 | * @param integer $expire 页面缓存的生存周期 98 | * 99 | * @return mixed 100 | */ 101 | public function cache($cacheId = null, $expire = null) { 102 | 103 | return false; 104 | } 105 | 106 | /** 107 | * 加载并显示视图片段文件内容 108 | * 109 | * 相当于include 代码片段,当$return为:true时返回代码代码片段内容,反之则显示代码片段内容 110 | * 111 | * @access public 112 | * 113 | * @param string $fileName 视图片段文件名称 114 | * @param array $data 视图模板变量,注:数组型 115 | * @param boolean $return 视图内容是否为返回,当为true时为返回,为false时则为显示。 默认为:false 116 | * 117 | * @return string 118 | */ 119 | public function render($fileName = null, $data = array(), $return = false) { 120 | 121 | //模板变量赋值 122 | if ($data && is_array($data)) { 123 | extract($data, EXTR_PREFIX_SAME, 'data'); 124 | unset($data); 125 | } else { 126 | //当且仅当本方法在处理action视图(非视图片段)时,对本类assign()所传递的视图变量进行赋值 127 | if (!$fileName && $this->_options) { 128 | extract($this->_options, EXTR_PREFIX_SAME, 'data'); 129 | $this->_options = array(); 130 | } 131 | } 132 | 133 | //分析挂件视图名称 134 | $fileName = (!$fileName) ? $this->widgetId : $fileName; 135 | 136 | //获取视图模板文件及编译文件的路径 137 | $viewFile = $this->_getViewFile($fileName); 138 | $compileFile = $this->_getCompileFile($fileName); 139 | 140 | //分析视图编译文件是否需要重新生成 141 | if ($this->_isCompile($viewFile, $compileFile)) { 142 | $templateContent = $this->_loadViewFile($viewFile); 143 | //重新生成编译缓存文件 144 | $this->_createCompileFile($compileFile, $templateContent); 145 | } 146 | 147 | //加载编译缓存文件 148 | ob_start(); 149 | include $compileFile; 150 | $widgetContent = ob_get_clean(); 151 | 152 | //返回信息 153 | if (!$return) { 154 | echo $widgetContent; 155 | } else { 156 | return $widgetContent; 157 | } 158 | } 159 | 160 | /** 161 | * 显示当前页面的视图内容 162 | * 163 | * 注:挂件(Widget)的视图机制不支持Layout视图 164 | * 165 | * @access public 166 | * 167 | * @param string $fileName 视图名称 168 | * 169 | * @return string 170 | */ 171 | public function display($fileName = null) { 172 | 173 | //参数分析 174 | if (!$fileName) { 175 | $fileName = $this->widgetId; 176 | } 177 | 178 | //模板变量赋值 179 | if ($this->_options) { 180 | extract($this->_options, EXTR_PREFIX_SAME, 'data'); 181 | $this->_options = array(); 182 | } 183 | 184 | //获取视图模板文件及编译文件的路径 185 | $viewFile = $this->_getViewFile($fileName); 186 | $compileFile = $this->_getCompileFile($fileName); 187 | 188 | //分析视图编译文件是否需要重新生成 189 | if ($this->_isCompile($viewFile, $compileFile)) { 190 | $templateContent = $this->_loadViewFile($viewFile); 191 | //重新生成编译缓存文件 192 | $this->_createCompileFile($compileFile, $templateContent); 193 | } 194 | 195 | //加载编译缓存文件 196 | ob_start(); 197 | include $compileFile; 198 | $widgetContent = ob_get_clean(); 199 | 200 | //显示挂件视图内容 201 | echo $widgetContent; 202 | } 203 | 204 | /** 205 | * 获取视图编译文件的路径 206 | * 207 | * @access protected 208 | * 209 | * @param string $fileName 视图名. 注:不带后缀 210 | * 211 | * @return string 212 | */ 213 | protected function _getCompileFile($fileName) { 214 | 215 | return $this->_compilePath . DS . $fileName . '.widget.compilecache.php'; 216 | } 217 | 218 | /** 219 | * 单例模式实例化当前模型类 220 | * 221 | * @access public 222 | * @return object 223 | */ 224 | public static function getInstance() { 225 | 226 | if (self::$_instance === null) { 227 | self::$_instance = new self(); 228 | } 229 | 230 | return self::$_instance; 231 | } 232 | } -------------------------------------------------------------------------------- /doitphp/core/Configure.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (C) 2012 www.doitphp.com All rights reserved. 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Configure.php 1.0 2012-11-11 22:01:36Z tommy $ 10 | * @package core 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | abstract class Configure { 19 | 20 | /* 21 | * 网址格式 22 | * 23 | * @var string 24 | */ 25 | const PATH_FORMAT = 'path'; 26 | const GET_FORMAT = 'get'; 27 | 28 | /* 29 | * 视图格式 30 | * 31 | * @var string 32 | */ 33 | const VIEW_EXT_HTML = '.html'; 34 | const VIEW_EXT_PHP = '.php'; 35 | 36 | /** 37 | * 项目配置文件内容临时存贮数组 38 | * 39 | * @var array 40 | */ 41 | private static $_config = array(); 42 | 43 | /** 44 | * 应用配置文件内容存贮数组 45 | * 46 | * @var array 47 | */ 48 | private static $_data = array(); 49 | 50 | /** 51 | * 类方法:loadConfig()调用状态。如果调用则为true,反之为false。 52 | * 53 | * @var boolean 54 | */ 55 | private static $_isStart = false; 56 | 57 | /** 58 | * 加载应用配置文件 59 | * 60 | * 加载应用配置文件,分析该配置文件内容,并将分析后的数据赋值给self::$_data。 61 | * 62 | * @access public 63 | * 64 | * @param string $filePath 应用配置文件路径 65 | * 66 | * @return boolean 67 | */ 68 | public static function loadConfig($filePath = null) { 69 | 70 | //判断本方法是否被调用过,如果调用过,则直接返回。 71 | if (self::$_isStart == true) { 72 | return true; 73 | } 74 | 75 | //获取应用配置文件内容默认值 76 | $defaultConfig = self::_getDefaultConfig(); 77 | 78 | $config = array(); 79 | //当配置文件路径存在时 80 | if ($filePath) { 81 | //分析配置文件是否存在 82 | if (!is_file($filePath)) { 83 | Controller::halt('The configuration file: ' . $filePath . ' is not found!', 'Normal'); 84 | } 85 | //获取应用配置文件内容 86 | include_once $filePath; 87 | 88 | //应用配置文件内容的默认值与配置文件值进行整合 89 | $config['application'] = (isset($config['application']) && is_array($config['application'])) ? $config['application'] + $defaultConfig : $defaultConfig; 90 | } else { 91 | $config['application'] = $defaultConfig; 92 | } 93 | 94 | self::$_data = $config; 95 | self::$_isStart = true; 96 | 97 | return true; 98 | } 99 | 100 | /** 101 | * 获取参数值 102 | * 103 | * 根据某参数名,获取应用配置文件的该参数的参数值 104 | * 105 | * @access public 106 | * 107 | * @param string $key 应用配置文件内容的参数名 108 | * 109 | * @return mixed 110 | */ 111 | public static function get($key) { 112 | 113 | //分析参数 114 | if (!$key) { 115 | return false; 116 | } 117 | 118 | if (strpos($key, '.') === false) { 119 | if (!isset(self::$_data[$key])) { 120 | return false; 121 | } 122 | return self::$_data[$key]; 123 | } 124 | 125 | $keyArray = explode('.', $key); 126 | 127 | $value = false; 128 | if ($keyArray) { 129 | foreach ($keyArray as $keyId=>$keyName) { 130 | if ($keyId == 0) { 131 | if (!isset(self::$_data[$keyName])) { 132 | $value = false; 133 | break; 134 | } 135 | $value = self::$_data[$keyName]; 136 | } else { 137 | if (!isset($value[$keyName])) { 138 | $value = false; 139 | break; 140 | } 141 | $value = $value[$keyName]; 142 | } 143 | } 144 | } 145 | 146 | return $value; 147 | } 148 | 149 | /** 150 | * 获取项目配置文件内容 151 | * 152 | * 根据DoitPHP项目的配置文件名称,获取该项目配置文件的内容,并将该内容进行返回 153 | * 154 | * @access public 155 | * 156 | * @param string $fileName 项目配置文件名。注:不含“.php”后缀。 157 | * 158 | * @return array 159 | */ 160 | public static function getConfig($fileName) { 161 | 162 | //参数分析. 163 | if (!$fileName) { 164 | return false; 165 | } 166 | 167 | if (!isset(self::$_config[$fileName])) { 168 | $filePath = BASE_PATH . '/config/' . $fileName . '.php'; 169 | //判断文件是否存在 170 | if (!is_file($filePath)) { 171 | Controller::halt('The configuration file: ' . $fileName . '.php is not exists!', 'Normal'); 172 | } 173 | 174 | $config = array(); 175 | include_once $filePath; 176 | self::$_config[$fileName] = $config; 177 | } 178 | 179 | return self::$_config[$fileName]; 180 | } 181 | 182 | /** 183 | * 获取应用配置文件的默认值 184 | * 185 | * @access private 186 | * @return array 187 | */ 188 | private static function _getDefaultConfig() { 189 | 190 | //定义变量$defaultConfig 191 | $defaultConfig = array(); 192 | 193 | //设置应用目录(application)的路径 194 | $defaultConfig['basePath'] = APP_ROOT . '/application'; 195 | 196 | //设置缓存目录的路径 197 | $defaultConfig['cachePath'] = APP_ROOT . '/cache'; 198 | 199 | //设置日志目录的路径 200 | $defaultConfig['logPath'] = APP_ROOT . '/logs'; 201 | 202 | //设置是否开启调试模式(开启后,程序运行出现错误时,显示错误信息,便于程序调试) 203 | $defaultConfig['debug'] = false; 204 | 205 | //设置日志写入功能是否开启 206 | $defaultConfig['log'] = false; 207 | 208 | //设置路由网址的重写模式是否开启 209 | $defaultConfig['rewrite'] = false; 210 | 211 | //设置路由网址格式(path:为url路由格式;get:为标准普通url格式) 212 | $defaultConfig['urlFormat'] = self::PATH_FORMAT; 213 | 214 | //设置路由分割符 215 | $defaultConfig['urlSegmentation'] = '/'; 216 | 217 | //设置默认module、controller及action名 218 | $defaultConfig['defaultModule'] = ''; 219 | $defaultConfig['defaultController'] = 'Index'; 220 | $defaultConfig['defaultAction'] = 'index'; 221 | 222 | //设置时区,默认时区为东八区(中国)时区(Asia/ShangHai)。 223 | $defaultConfig['defaultTimeZone'] = 'Asia/ShangHai'; 224 | 225 | //设置视图文件的格式(php或html, 默认为php) 226 | $defaultConfig['viewExt'] = self::VIEW_EXT_PHP; 227 | 228 | return $defaultConfig; 229 | } 230 | } -------------------------------------------------------------------------------- /doitphp/library/Excel.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (c) 2010 Tommy Software Studio 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Excel.php 2.0 2012-12-23 00:50:01Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Excel { 19 | 20 | /** 21 | * EXCEL表格的xml代码 22 | * 23 | * @var string 24 | */ 25 | protected $_xmlTable; 26 | 27 | /** 28 | * EXCEL的标题xml代码 29 | * 30 | * @var string 31 | */ 32 | protected $_xmlMenu; 33 | 34 | /** 35 | * 处理EXCEL中一行代码,相当于HTML中的行标签 36 | * 37 | * @access protected 38 | * 39 | * @param array $data 行数据 40 | * 41 | * @return string 42 | */ 43 | protected function _handleRow($data) { 44 | 45 | //参数分析 46 | if (empty($data) || !is_array($data)) { 47 | return false; 48 | } 49 | 50 | $xml = "\n"; 51 | foreach ($data as $key=>$value) { 52 | $xml .= ($key>0&&empty($data[$key-1])) ? $this->_handleIndexCell($value, $key+1) : $this->_handleCell($value); 53 | } 54 | $xml .= "\n"; 55 | 56 | return $xml; 57 | } 58 | 59 | /** 60 | * 处理EXCEL多行数据的代码. 61 | * 62 | * @access protected 63 | * 64 | * @param array $data 多行数据 65 | * 66 | * @return string 67 | */ 68 | protected function _addRows($data) { 69 | 70 | //参数分析 71 | if (empty($data) || !is_array($data) || !is_array($data[0])) { 72 | return false; 73 | } 74 | 75 | $xmlArray = array(); 76 | foreach ($data as $row) { 77 | $xmlArray[] = $this->_handleRow($row); 78 | } 79 | 80 | return implode('', $xmlArray); 81 | } 82 | 83 | /** 84 | * 配置EXCEL表格的标题 85 | * 86 | * @access public 87 | * 88 | * @param array $data 所要生成的excel的标题,注:参数为数组 89 | * 90 | * @return boolean 91 | */ 92 | public function setMenu($data) { 93 | 94 | //参数分析 95 | if (empty($data) || !is_array($data) || is_array($data[0]) || array_search('', $data)) { 96 | return false; 97 | } 98 | 99 | $xml = "\n"; 100 | foreach ($data as $value) { 101 | $type = (is_numeric($data)&&(substr($data, 0, 1)!=0)) ? 'Number' : 'String'; 102 | $xml .= "" . $value . "\n"; 103 | } 104 | $xml .= "\n"; 105 | $this->_xmlMenu = $xml; 106 | 107 | return true; 108 | } 109 | 110 | /** 111 | * 处理EXCEL表格的内容,相当于table. 112 | * 113 | * @access public 114 | * 115 | * @param array $data Excel内容数据 116 | * 117 | * @return string 118 | */ 119 | public function setData($data) { 120 | 121 | //参数分析 122 | if (!$data || !is_array($data) || !is_array($data[0])) { 123 | return false; 124 | } 125 | 126 | $xmlRows = $this->_addRows($data); 127 | 128 | if (!$xmlRows) { 129 | if (!$this->_xmlMenu) { 130 | return false; 131 | } else { 132 | $content = $this->_xmlMenu; 133 | } 134 | } else { 135 | if (!$this->_xmlMenu) { 136 | $content = $xmlRows; 137 | } else { 138 | $content = $this->_xmlMenu.$xmlRows; 139 | } 140 | } 141 | 142 | return $this->_xmlTable = "\n" . $content . "
\n"; 143 | } 144 | 145 | /** 146 | * 处理EXCEL表格信息代码 147 | * 148 | * @access protected 149 | * @return string 150 | */ 151 | protected function _parseTable() { 152 | 153 | $xmlWorksheet = "\n"; 154 | 155 | if (empty($this->_xmlTable)) { 156 | $xmlWorksheet .= "\n"; 157 | } else{ 158 | $xmlWorksheet .= $this->_xmlTable; 159 | } 160 | 161 | $xmlWorksheet .= "\n"; 162 | 163 | return $xmlWorksheet; 164 | } 165 | 166 | /** 167 | * 处理EXCEL中的表格,相当于html中的标签 168 | * 169 | * @access protected 170 | * 171 | * @param string $data 表格数据 172 | * 173 | * @return string 174 | */ 175 | protected function _handleCell($data) { 176 | 177 | //参数分析 178 | if (is_array($data)) { 179 | return false; 180 | } 181 | 182 | $type = (is_numeric($data)&&(substr($data, 0, 1)!=0)) ? 'Number' : 'String'; 183 | 184 | return "" . $data . "\n"; 185 | } 186 | 187 | /** 188 | * 处理EXCEL中CELL代码,当该CELL前的一个CELL内容为空时. 189 | * 190 | * @access protected 191 | * 192 | * @param string $data 表格数据 193 | * @param integer $key 键值 194 | * 195 | * @return string 196 | */ 197 | protected function _handleIndexCell($data, $key) { 198 | 199 | //参数分析 200 | if (is_array($data)) { 201 | return false; 202 | } 203 | 204 | $type = (is_numeric($data)&&(substr($data, 0, 1)!=0)) ? 'Number' : 'String'; 205 | 206 | return "" . $data . "\n"; 207 | } 208 | 209 | 210 | /** 211 | * 分析EXCEL的文件头 212 | * 213 | * @access protected 214 | * @return string 215 | */ 216 | protected function _parseHeader() { 217 | 218 | return " 219 | \n"; 224 | } 225 | 226 | /** 227 | * 生成EXCEL文件并下载. 228 | * 229 | * @access public 230 | * 231 | * @param string $fileName 所要生成的excel的文件名,注:文件名中不含后缀名 232 | * 233 | * @return void 234 | */ 235 | public function download($fileName) { 236 | 237 | //参数分析 238 | if (empty($fileName)) { 239 | return false; 240 | } 241 | 242 | header('Pragma: no-cache'); 243 | header("Content-Type: application/vnd.ms-excel; charset=utf-8"); 244 | header("Content-Disposition: inline; filename=\"" . $fileName . ".xls\""); 245 | $excelXml = $this->_parseHeader().$this->_parseTable().""; 246 | 247 | echo $excelXml; 248 | } 249 | 250 | /** 251 | * 析构函数(类方法) 252 | * 253 | * @return void 254 | */ 255 | public function __destruct(){ 256 | 257 | exit(); 258 | } 259 | } -------------------------------------------------------------------------------- /doitphp/library/Security.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://www.doitphp.com 9 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Security.php 2.0 2012-12-29 15:57:21Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class Security { 21 | 22 | /** 23 | * Token生存时间周期 24 | * 25 | * @var integer 26 | */ 27 | protected static $_expire = 7200; 28 | 29 | /** 30 | * 加密字符串(密钥) 31 | * 32 | * @var string 33 | */ 34 | protected static $_key = 'your-secret-code'; 35 | 36 | /** 37 | * 过滤XSS(跨网站攻击)代码 38 | * 39 | * 通常用于富文本提交内容的过滤。提升网站安全必备 40 | * 41 | * @access public 42 | * 43 | * @param string $string 待过滤的内容 44 | * 45 | * @return string 46 | */ 47 | public static function removeXss($string) { 48 | 49 | //参数分析 50 | if (!$string) { 51 | return $string; 52 | } 53 | 54 | if (is_array($string)) { 55 | return array_map(array('Security', 'removeXss'), $string); 56 | } 57 | 58 | // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed 59 | // this prevents some character re-spacing such as 60 | // note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs 61 | $string = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $string); 62 | 63 | // straight replacements, the user should never need these since they're normal characters 64 | // this prevents like 65 | $search= 'abcdefghijklmnopqrstuvwxyz'; 66 | $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 67 | $search .= '1234567890!@#$%^&*()'; 68 | $search .= '~`";:?+/={}[]-_|\'\\'; 69 | 70 | for ($i = 0; $i < strlen($search); $i++) { 71 | // ;? matches the ;, which is optional 72 | // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars 73 | 74 | // @ @ search for the hex values 75 | $string = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $string); // with a ; 76 | // @ @ 0{0,7} matches '0' zero to seven times 77 | $string = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $string); // with a ; 78 | } 79 | 80 | // now the only remaining whitespace attacks are \t, \n, and \r 81 | $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); 82 | $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); 83 | $ra = array_merge($ra1, $ra2); 84 | 85 | $found = true; // keep replacing as long as the previous round replaced something 86 | while ($found == true) { 87 | $stringBefore = $string; 88 | for ($i = 0; $i < sizeof($ra); $i++) { 89 | $pattern = '/'; 90 | for ($j = 0; $j < strlen($ra[$i]); $j++) { 91 | if ($j > 0) { 92 | $pattern .= '('; 93 | $pattern .= '(&#[xX]0{0,8}([9ab]);)'; 94 | $pattern .= '|'; 95 | $pattern .= '|(�{0,8}([9|10|13]);)'; 96 | $pattern .= ')*'; 97 | } 98 | $pattern .= $ra[$i][$j]; 99 | } 100 | $pattern .= '/i'; 101 | $replacement = substr($ra[$i], 0, 2).''.substr($ra[$i], 2); // add in <> to nerf the tag 102 | $string = preg_replace($pattern, $replacement, $string); // filter out the hex tags 103 | if ($stringBefore == $string) { 104 | // no replacements were made, so exit the loop 105 | $found = false; 106 | } 107 | } 108 | } 109 | 110 | return $string; 111 | } 112 | 113 | /** 114 | * 生成令牌密码 115 | * 116 | * @access public 117 | * 118 | * @param string $string 所要加密的字符(也可以是随机的) 119 | * @param string $expire 令版密码的有效时间(单位:秒) 120 | * @param string $key 自定义密钥 121 | * 122 | * @return string 123 | */ 124 | public static function getToken($string, $expire = null, $key = null) { 125 | 126 | //参数分析 127 | if (!$string) { 128 | return false; 129 | } 130 | 131 | //设置token生存周期及附加加密码 132 | $expire = (!$expire) ? self::$_expire : $expire; 133 | $key = (!$key) ? self::$_key : $key; 134 | $per = ceil($_SERVER['REQUEST_TIME'] / $expire); 135 | 136 | return hash_hmac('md5', $per . $string, $key); 137 | } 138 | 139 | /** 140 | * 令牌密码验证 141 | * 142 | * @access public 143 | * 144 | * @param string $string 所要加密的字符(也可以是随机的) 145 | * @param string $tokenCode 所要验证的加密字符串 146 | * @param string $expire 令版密码的有效时间(单位:秒) 147 | * @param string $key 自定义密钥 148 | * 149 | * @return boolean 150 | */ 151 | public function checkToken($string, $tokenCode, $expire = null, $key = null) { 152 | 153 | //参数分析 154 | if (!$string || !$tokenCode) { 155 | return false; 156 | } 157 | 158 | //设置token生存周期及附加加密码 159 | $expire = (!$expire) ? self::$_expire : $expire; 160 | $key = (!$key) ? self::$_key : $key; 161 | $per = ceil($_SERVER['REQUEST_TIME'] / $expire); 162 | 163 | //获取token值 164 | $sourceToken = hash_hmac('md5', $per . $string, $key); 165 | 166 | return ($sourceToken == $tokenCode) ? true : false; 167 | } 168 | } -------------------------------------------------------------------------------- /doitphp/library/cache/Redis.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (c) 2010 Tommy Software Studio 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Cache_Redis.php 2.0 2012-12-30 19:48:01Z tommy $ 10 | * @package cache 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Cache_Redis { 19 | 20 | /** 21 | * 单例模式实例化对象 22 | * 23 | * @var object 24 | */ 25 | protected static $_instance; 26 | 27 | /** 28 | * 数据库连接ID 29 | * 30 | * @var object 31 | */ 32 | protected $_Redis; 33 | 34 | /** 35 | * 数据库连接参数默认值 36 | * 37 | * @var array 38 | */ 39 | protected $_defaultOptions = array( 40 | 'host' => '127.0.0.1', 41 | 'port' => '6379', 42 | 'password' => null, 43 | 'database' => 0, 44 | 'persistent' => false, 45 | 'expire' => 900, 46 | ); 47 | 48 | /** 49 | * 构造函数 50 | * 51 | * @access public 52 | * 53 | * @param array $params 数据库连接参数,如主机名,数据库用户名,密码等 54 | * 55 | * @return boolean 56 | */ 57 | public function __construct($options = null) { 58 | 59 | if (!extension_loaded('redis')) { 60 | Controller::halt('The redis extension to be loaded!'); 61 | } 62 | 63 | //当参数为空时,程序则自动加载配置文件中数据库连接参数 64 | if (!$options || !is_array($options)) { 65 | $options = Configure::get('redis'); 66 | if (!$options) { 67 | $options = array(); 68 | } 69 | } 70 | 71 | $options += $this->_defaultOptions; 72 | //连接数据库 73 | $this->_Redis = new Redis(); 74 | $connect = (!$options['persistent']) ? 'connect' : 'pconnect'; 75 | $return = $this->_Redis->$connect($options['host'], $options['port'], $options['expire']); 76 | 77 | if ($return && $options['password']) { 78 | $return = $this->_Redis->auth($options['password']); 79 | } 80 | if ($return && $options['database']) { 81 | $return = $this->_Redis->select($options['database']); 82 | } 83 | 84 | return $return; 85 | } 86 | 87 | /** 88 | * 设置数据值 89 | * 90 | * @access public 91 | * 92 | * @param string $key KEY名称 93 | * @param mixed $value 获取得到的数据 94 | * @param integer $expire 缓存的生存周期 95 | * 96 | * @return boolean 97 | */ 98 | public function set($key, $value, $expire = null) { 99 | 100 | //参数分析 101 | if (!$key) { 102 | return false; 103 | } 104 | 105 | $value = json_encode($value); 106 | $result = $this->_Redis->set($key, $value); 107 | 108 | if ($expire > 0) { 109 | $this->_Redis->setTimeout($key, $expire); 110 | } 111 | 112 | return $result; 113 | } 114 | 115 | /** 116 | * 通过KEY获取数据 117 | * 118 | * @access public 119 | * 120 | * @param string $key 数据Key 121 | * 122 | * @return mixed 123 | */ 124 | public function get($key) { 125 | 126 | //参数分析 127 | if (!$key) { 128 | return false; 129 | } 130 | 131 | $value = $this->_Redis->get($key); 132 | return json_decode($value, true); 133 | } 134 | 135 | /** 136 | * 删除一条数据 137 | * 138 | * @access public 139 | * 140 | * @param string $key 数据key 141 | * 142 | * @return boolean 143 | */ 144 | public function delete($key) { 145 | 146 | //参数分析 147 | if (!$key) { 148 | return false; 149 | } 150 | 151 | return $this->_Redis->delete($key); 152 | } 153 | 154 | /** 155 | * 清空数据 156 | * 157 | * @access public 158 | * @return boolean 159 | */ 160 | public function clear() { 161 | 162 | return $this->_Redis->flushAll(); 163 | } 164 | 165 | /** 166 | * 数据入队列 167 | * 168 | * @access public 169 | * 170 | * @param string $key KEY名称 171 | * @param mixed $value 获取得到的数据 172 | * @param bool $right 是否从右边开始入 173 | * 174 | * @return boolean 175 | */ 176 | public function push($key, $value, $right = true) { 177 | 178 | //参数分析 179 | if (!$key) { 180 | return false; 181 | } 182 | 183 | $value = json_encode($value); 184 | return ($right == true) ? $this->_Redis->rPush($key, $value) : $this->_Redis->lPush($key, $value); 185 | } 186 | 187 | /** 188 | * 数据出队列 189 | * 190 | * @access public 191 | * 192 | * @param string $key KEY名称 193 | * @param bool $left 是否从左边开始出数据 194 | * 195 | * @return mixed 196 | */ 197 | public function pop($key, $left = true) { 198 | 199 | //参数分析 200 | if (!$key) { 201 | return false; 202 | } 203 | 204 | $value = ($left == true) ? $this->_Redis->lPop($key) : $this->_Redis->rPop($key); 205 | return json_decode($value); 206 | } 207 | 208 | /** 209 | * 数据自增 210 | * 211 | * @access public 212 | * 213 | * @param string $key 数据key 214 | * @param integer $value 自增数据值 215 | * 216 | * @return boolean 217 | */ 218 | public function increment($key, $value = 1) { 219 | 220 | //参数分析 221 | if (!$key) { 222 | return false; 223 | } 224 | 225 | return $this->_Redis->incrBy($key, $value); 226 | } 227 | 228 | /** 229 | * 数据自减 230 | * 231 | * @access public 232 | * 233 | * @param string $key 数据key 234 | * @param integer $value 自减数据值 235 | * 236 | * @return boolean 237 | */ 238 | public function decrement($key, $value = 1) { 239 | 240 | //参数分析 241 | if (!$key) { 242 | return false; 243 | } 244 | 245 | return $this->_Redis->decrBy($key, $value); 246 | } 247 | 248 | /** 249 | * key是否存在,存在返回ture 250 | * 251 | * @access public 252 | * 253 | * @param string $key KEY名称 254 | * 255 | * @return boolean 256 | */ 257 | public function exists($key) { 258 | 259 | //参数分析 260 | if (!$key) { 261 | return false; 262 | } 263 | 264 | return $this->_Redis->exists($key); 265 | } 266 | 267 | /** 268 | * 返回redis对象 269 | * 270 | * @access public 271 | * @return object 272 | */ 273 | public function getConnection() { 274 | 275 | return $this->_Redis; 276 | } 277 | 278 | /** 279 | * 单例模式 280 | * 281 | * @access public 282 | * 283 | * @param array $params 数据库连接参数 284 | * 285 | * @return object 286 | */ 287 | public static function getInstance($params = null) { 288 | 289 | if (!self::$_instance) { 290 | self::$_instance = new self($params); 291 | } 292 | 293 | return self::$_instance; 294 | } 295 | 296 | } -------------------------------------------------------------------------------- /doitphp/library/cache/Memcached.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (c) 2015 Tommy Software Studio 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Cache_Memcachedd.php 2.0 2015-04-01 15:00:01Z tommy $ 10 | * @package cache 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | /** 19 | * 使用说明 20 | * 21 | * @author tommy 22 | * 23 | * @example 24 | * 25 | * 参数范例 26 | * $memOptions = array( 27 | * 'servers'=> array( 28 | * array('host'=>'127.0.0.1', 'port'=>11211, 'persistent'=>true, 'weight'=>1, 'timeout'=>60), 29 | * array('host'=>'192.168.0.101', 'port'=>11211, 'persistent'=>true, 'weight'=>2, 'timeout'=>60), 30 | * ), 31 | * 'compressed'=>true, 32 | * 'expire' => 3600, 33 | * 'persistent' => true, 34 | * ); 35 | * 36 | * 实例化 37 | * 38 | * 法一: 39 | * $memcached = new Cache_Memcachedd($memOptions); 40 | * 41 | */ 42 | 43 | class Cache_Memcachedd { 44 | 45 | /** 46 | * 单例模式实例化本类 47 | * 48 | * @var object 49 | */ 50 | protected static $_instance = null; 51 | 52 | /** 53 | * Memcached实例 54 | * 55 | * @var objeact 56 | */ 57 | private $_Memcached; 58 | 59 | /** 60 | * 默认的缓存服务器 61 | * 62 | * @var array 63 | */ 64 | protected $_defaultServer = array( 65 | /** 66 | * 缓存服务器地址或主机名 67 | */ 68 | 'host' => '127.0.0.1', 69 | 70 | /** 71 | * 缓存服务器端口 72 | */ 73 | 'port' => '11211', 74 | ); 75 | 76 | /** 77 | * 默认的缓存策略 78 | * 79 | * @var array 80 | */ 81 | protected $_defaultOptions = array( 82 | 83 | /** 84 | * 缓存服务器配置,参看$_defaultServer 85 | * 允许多个缓存服务器 86 | */ 87 | 'servers' => array(), 88 | 89 | /** 90 | * 是否压缩缓存数据 91 | */ 92 | 'compressed' => false, 93 | 94 | /** 95 | * 缓存有效时间 96 | * 97 | * 如果设置为 0 表示缓存永不过期 98 | */ 99 | 'expire' => 900, 100 | 101 | /** 102 | * 是否使用持久连接 103 | */ 104 | 'persistent' => true, 105 | ); 106 | 107 | /** 108 | * 构造方法 109 | * 110 | * @access public 111 | * 112 | * @param array $params 数据库连接参数,如主机名,数据库用户名,密码等 113 | * 114 | * @return boolean 115 | */ 116 | public function __construct($options = null) { 117 | 118 | //分析memcached扩展模块的加载 119 | if (!extension_loaded('memcached')) { 120 | Controller::halt('The memcached extension to be loaded before use!'); 121 | } 122 | 123 | //获取Memcache服务器连接参数 124 | if (!$options || !is_array($options)) { 125 | $options = Configure::get('memcached'); 126 | } 127 | 128 | if (is_array($options) && $options) { 129 | $this->_defaultOptions = $options + $this->_defaultOptions; 130 | } 131 | 132 | if (!$this->_defaultOptions['servers']) { 133 | $this->_defaultOptions['servers'][] = $this->_defaultServer; 134 | } 135 | 136 | $this->_Memcached = new Memcached(); 137 | 138 | foreach ($this->_defaultOptions['servers'] as $server) { 139 | $server += array('host' => '127.0.0.1', 'port' => 11211, 'persistent' => true); 140 | $this->_Memcached->addServer($server['host'], $server['port'], $this->_defaultOptions['persistent']); 141 | } 142 | 143 | return true; 144 | } 145 | 146 | /** 147 | * 写入缓存 148 | * 149 | * @access public 150 | * 151 | * @param string $key 缓存Key 152 | * @param mixed $data 缓存内容 153 | * @param int $expire 缓存时间(秒) 154 | * 155 | * @return boolean 156 | */ 157 | public function set($key, $data, $expire = null) { 158 | 159 | //参数分析 160 | if (!$key) { 161 | return false; 162 | } 163 | if (is_null($expire)) { 164 | $expire = $this->_defaultOptions['expire']; 165 | } 166 | 167 | return $this->_Memcached->set($key, $data, $expire); 168 | } 169 | 170 | /** 171 | * 读取缓存,失败或缓存撒失效时返回false 172 | * 173 | * @access public 174 | * 175 | * @param string $key 所要读取数据的key 176 | * 177 | * @return mixed 178 | */ 179 | public function get($key) { 180 | 181 | //参数分析 182 | if (!$key) { 183 | return false; 184 | } 185 | 186 | return $this->_Memcached->get($key); 187 | } 188 | 189 | /** 190 | * 删除指定的缓存 191 | * 192 | * @access public 193 | * 194 | * @param string $key 所要删除数据的Key 195 | * 196 | * @return boolean 197 | */ 198 | public function delete($key) { 199 | 200 | //参数分析 201 | if (!$key) { 202 | return false; 203 | } 204 | 205 | return $this->_Memcached->delete($key); 206 | } 207 | 208 | /** 209 | * 数据自增 210 | * 211 | * @access public 212 | * 213 | * @author ColaPHP 214 | * @param string $key 数据key 215 | * @param integer $value 自增数据值 216 | * 217 | * @return boolean 218 | */ 219 | public function increment($key, $value = 1) { 220 | 221 | //参数分析 222 | if (!$key) { 223 | return false; 224 | } 225 | 226 | return $this->_Memcached->increment($key, $value); 227 | } 228 | 229 | /** 230 | * 数据自减 231 | * 232 | * @access public 233 | * 234 | * @param string $key 数据key 235 | * @param integer $value 自减数据值 236 | * 237 | * @return boolean 238 | */ 239 | public function decrement($key, $value = 1) { 240 | 241 | //参数分析 242 | if (!$key) { 243 | return false; 244 | } 245 | 246 | return $this->_Memcached->decrement($key, $value); 247 | } 248 | 249 | /** 250 | * 清除所有的缓存数据 251 | * 252 | * @access public 253 | * @return boolean 254 | */ 255 | public function clear() { 256 | 257 | return $this->_Memcached->flush(); 258 | } 259 | 260 | /** 261 | * 返回memcached实例化对象 262 | * 263 | * @access public 264 | * @return object 265 | */ 266 | public function getConnection() { 267 | 268 | return $this->_Memcached; 269 | } 270 | 271 | /** 272 | * 析构函数 273 | * 274 | * @access public 275 | * @return boolean 276 | */ 277 | public function __destruct() { 278 | 279 | if ($this->_Memcached) { 280 | $this->_Memcached->quit(); 281 | } 282 | 283 | return true; 284 | } 285 | 286 | /** 287 | * 单例模式 288 | * 289 | * 用于本类的单例模式(singleton)实例化 290 | * 291 | * @access public 292 | * 293 | * @param array $params 数据库连接参数 294 | * 295 | * @return object 296 | */ 297 | public static function getInstance($params = null) { 298 | 299 | if (!self::$_instance) { 300 | self::$_instance = new self($params); 301 | } 302 | 303 | return self::$_instance; 304 | } 305 | } -------------------------------------------------------------------------------- /doitphp/library/Curl.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Copyright (c) 2010 Tommy Software Studio 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Curl.php 2.0 2012-12-22 21:45:01Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Curl { 19 | 20 | /** 21 | * 浏览器的AGENT信息 22 | * 23 | * @var string 24 | */ 25 | protected static $_userAgent = null; 26 | 27 | /** 28 | * cookie的存贮文件路径 29 | * 30 | * @var string 31 | */ 32 | protected static $_cookieFilePath = null; 33 | 34 | /** 35 | * 是否curl get获取页面信息时支持cookie存贮 36 | * 37 | * @var boolean 38 | */ 39 | protected static $_cookieSupport = false; 40 | 41 | 42 | /** 43 | * 设置浏览器的AGENT信息 44 | * 45 | * @access public 46 | * 47 | * @param string $userAgent 浏览器的AGENT信息 48 | * 49 | * @return object 50 | */ 51 | public function setUserAgent($userAgent) { 52 | 53 | //参数分析 54 | if (!$userAgent) { 55 | return false; 56 | } 57 | 58 | self::$_userAgent = $userAgent; 59 | 60 | return $this; 61 | } 62 | 63 | /** 64 | * 设置cookie的存贮文件路径 65 | * 66 | * @access public 67 | * 68 | * @param string $filePath 存贮cookie的文件路径 69 | * 70 | * @return object 71 | */ 72 | public function setCookieFile($filePath) { 73 | 74 | //参数分析 75 | if (!$filePath) { 76 | return false; 77 | } 78 | 79 | self::$_cookieSupport = true; 80 | self::$_cookieFilePath = $filePath; 81 | 82 | return $this; 83 | } 84 | 85 | /** 86 | * 设置cookie功能是否开启 87 | * 88 | * @access public 89 | * 90 | * @param boolean $isOn 是否开启 91 | * 92 | * @return object 93 | */ 94 | public function setCookieStatus($isOn = true) { 95 | 96 | self::$_cookieSupport = $isOn; 97 | 98 | return $this; 99 | } 100 | 101 | /** 102 | * 用CURL模拟获取网页页面内容 103 | * 104 | * @access public 105 | * 106 | * @param string $url 所要获取内容的网址 107 | * @param array $data 所要提交的数据 108 | * @param string $proxy 代理设置 109 | * @param integer $expire 时间限制 110 | * 111 | * @return string 112 | * 113 | * @example 114 | * 115 | * $url = 'http://www.doitphp.com/'; 116 | * 117 | * $curl = new Curl(); 118 | * $curl ->get($url); 119 | */ 120 | public static function get($url, $data = array(), $proxy = null, $expire = 30) { 121 | 122 | //参数分析 123 | if (!$url) { 124 | return false; 125 | } 126 | 127 | //分析是否开启SSL加密 128 | $ssl = strtolower(substr($url, 0, 8)) == 'https://' ? true : false; 129 | 130 | //读取网址内容 131 | $ch = curl_init(); 132 | 133 | //设置代理 134 | if (!$proxy) { 135 | curl_setopt ($ch, CURLOPT_PROXY, $proxy); 136 | } 137 | 138 | //分析网址中的参数 139 | if ($data) { 140 | $paramUrl = http_build_query($data, '', '&'); 141 | $extStr = (strpos($url, '?') !== false) ? '&' : '?'; 142 | $url = $url . (($paramUrl) ? $extStr . $paramUrl : ''); 143 | } 144 | 145 | curl_setopt($ch, CURLOPT_URL, $url); 146 | 147 | if ($ssl) { 148 | // 对认证证书来源的检查 149 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 150 | // 从证书中检查SSL加密算法是否存在 151 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); 152 | } 153 | 154 | if (self::$_cookieSupport === true) { 155 | $cookieFile = self::_parseCookieFile(); 156 | //cookie设置 157 | curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); 158 | curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); 159 | } 160 | 161 | //设置浏览器 162 | if (self::$_userAgent || $_SERVER['HTTP_USER_AGENT']) { 163 | curl_setopt($ch, CURLOPT_USERAGENT, (!self::$_userAgent) ? $_SERVER['HTTP_USER_AGENT'] : self::$_userAgent); 164 | curl_setopt($ch, CURLOPT_HEADER, 0); 165 | } 166 | 167 | //使用自动跳转 168 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 169 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 170 | curl_setopt($ch, CURLOPT_TIMEOUT, $expire); 171 | 172 | $content = curl_exec($ch); 173 | curl_close($ch); 174 | 175 | return $content; 176 | } 177 | 178 | /** 179 | * 获取cookie存贮文件的路径 180 | * 181 | * @access protected 182 | * @return stirng 183 | */ 184 | protected static function _parseCookieFile() { 185 | 186 | //分析cookie数据存贮文件 187 | if (self::$_cookieFilePath) { 188 | return self::$_cookieFilePath; 189 | } 190 | 191 | return CACHE_PATH . '/temp/' . md5('doitphp_curl_cookie') . '.txt'; 192 | } 193 | 194 | /** 195 | * 用CURL模拟提交数据 196 | * 197 | * @access public 198 | * 199 | * @param string $url post所要提交的网址 200 | * @param array $data 所要提交的数据 201 | * @param string $proxy 代理设置 202 | * @param integer $expire 所用的时间限制 203 | * 204 | * @return string 205 | */ 206 | public static function post($url, $data = array(), $proxy = null, $expire = 30) { 207 | 208 | //参数分析 209 | if (!$url) { 210 | return false; 211 | } 212 | 213 | //分析是否开启SSL加密 214 | $ssl = strtolower(substr($url, 0, 8)) == 'https://' ? true : false; 215 | 216 | //读取网址内容 217 | $ch = curl_init(); 218 | 219 | //设置代理 220 | if (!$proxy) { 221 | curl_setopt ($ch, CURLOPT_PROXY, $proxy); 222 | } 223 | 224 | curl_setopt($ch, CURLOPT_URL, $url); 225 | 226 | if ($ssl) { 227 | // 对认证证书来源的检查 228 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 229 | // 从证书中检查SSL加密算法是否存在 230 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); 231 | } 232 | 233 | if (self::$_cookieSupport === true) { 234 | $cookieFile = self::_parseCookieFile(); 235 | //cookie设置 236 | curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); 237 | curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); 238 | } 239 | 240 | //设置浏览器 241 | if (self::$_userAgent || $_SERVER['HTTP_USER_AGENT']) { 242 | curl_setopt($ch, CURLOPT_USERAGENT, (!self::$_userAgent) ? $_SERVER['HTTP_USER_AGENT'] : self::$_userAgent); 243 | curl_setopt($ch, CURLOPT_HEADER, 0); 244 | } 245 | 246 | //发送一个常规的Post请求 247 | curl_setopt($ch, CURLOPT_POST, true); 248 | //Post提交的数据包 249 | if ($data) { 250 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 251 | } 252 | 253 | //使用自动跳转 254 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 255 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 256 | curl_setopt($ch, CURLOPT_TIMEOUT, $expire); 257 | 258 | $content = curl_exec($ch); 259 | curl_close($ch); 260 | 261 | return $content; 262 | } 263 | } -------------------------------------------------------------------------------- /doitphp/library/cache/Memcache.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2010 Tommy Software Studio 9 | * @link http://www.doitphp.com 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: Cache_Memcache.php 2.0 2012-12-30 18:00:01Z tommy $ 12 | * @package cache 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | /** 21 | * 使用说明 22 | * 23 | * @author tommy 24 | * 25 | * @example 26 | * 27 | * 参数范例 28 | * $memOptions = array( 29 | * 'servers'=> array( 30 | * array('host'=>'127.0.0.1', 'port'=>11211, 'persistent'=>true, 'weight'=>1, 'timeout'=>60), 31 | * array('host'=>'192.168.0.101', 'port'=>11211, 'persistent'=>true, 'weight'=>2, 'timeout'=>60), 32 | * ), 33 | * 'compressed'=>true, 34 | * 'expire' => 3600, 35 | * 'persistent' => true, 36 | * ); 37 | * 38 | * 实例化 39 | * 40 | * 法一: 41 | * $memcache = new Cache_Memcache($memOptions); 42 | * 43 | */ 44 | 45 | class Cache_Memcache { 46 | 47 | /** 48 | * 单例模式实例化本类 49 | * 50 | * @var object 51 | */ 52 | protected static $_instance = null; 53 | 54 | /** 55 | * Memcached实例 56 | * 57 | * @var objeact 58 | */ 59 | private $_Memcache; 60 | 61 | /** 62 | * 默认的缓存服务器 63 | * 64 | * @var array 65 | */ 66 | protected $_defaultServer = array( 67 | /** 68 | * 缓存服务器地址或主机名 69 | */ 70 | 'host' => '127.0.0.1', 71 | 72 | /** 73 | * 缓存服务器端口 74 | */ 75 | 'port' => '11211', 76 | ); 77 | 78 | /** 79 | * 默认的缓存策略 80 | * 81 | * @var array 82 | */ 83 | protected $_defaultOptions = array( 84 | 85 | /** 86 | * 缓存服务器配置,参看$_defaultServer 87 | * 允许多个缓存服务器 88 | */ 89 | 'servers' => array(), 90 | 91 | /** 92 | * 是否压缩缓存数据 93 | */ 94 | 'compressed' => false, 95 | 96 | /** 97 | * 缓存有效时间 98 | * 99 | * 如果设置为 0 表示缓存永不过期 100 | */ 101 | 'expire' => 900, 102 | 103 | /** 104 | * 是否使用持久连接 105 | */ 106 | 'persistent' => true, 107 | ); 108 | 109 | /** 110 | * 构造方法 111 | * 112 | * @access public 113 | * 114 | * @param array $params 数据库连接参数,如主机名,数据库用户名,密码等 115 | * 116 | * @return boolean 117 | */ 118 | public function __construct($options = null) { 119 | 120 | //分析memcache扩展模块的加载 121 | if (!extension_loaded('memcache')) { 122 | Controller::halt('The memcache extension to be loaded before use!'); 123 | } 124 | 125 | //获取Memcache服务器连接参数 126 | if (!$options || !is_array($options)) { 127 | $options = Configure::get('memcache'); 128 | } 129 | 130 | if (is_array($options) && $options) { 131 | $this->_defaultOptions = $options + $this->_defaultOptions; 132 | } 133 | 134 | if (!$this->_defaultOptions['servers']) { 135 | $this->_defaultOptions['servers'][] = $this->_defaultServer; 136 | } 137 | 138 | $this->_Memcache = new Memcache(); 139 | 140 | foreach ($this->_defaultOptions['servers'] as $server) { 141 | $server += array('host' => '127.0.0.1', 'port' => 11211, 'persistent' => true); 142 | $this->_Memcache->addServer($server['host'], $server['port'], $this->_defaultOptions['persistent']); 143 | } 144 | 145 | return true; 146 | } 147 | 148 | /** 149 | * 写入缓存 150 | * 151 | * @access public 152 | * 153 | * @param string $key 缓存Key 154 | * @param mixed $data 缓存内容 155 | * @param int $expire 缓存时间(秒) 156 | * 157 | * @return boolean 158 | */ 159 | public function set($key, $data, $expire = null) { 160 | 161 | //参数分析 162 | if (!$key) { 163 | return false; 164 | } 165 | if (is_null($expire)) { 166 | $expire = $this->_defaultOptions['expire']; 167 | } 168 | 169 | return $this->_Memcache->set($key, $data, (!$this->_defaultOptions['compressed']) ? 0 : MEMCACHE_COMPRESSED, $expire); 170 | } 171 | 172 | /** 173 | * 读取缓存,失败或缓存撒失效时返回false 174 | * 175 | * @access public 176 | * 177 | * @param string $key 所要读取数据的key 178 | * 179 | * @return mixed 180 | */ 181 | public function get($key) { 182 | 183 | //参数分析 184 | if (!$key) { 185 | return false; 186 | } 187 | 188 | return $this->_Memcache->get($key); 189 | } 190 | 191 | /** 192 | * 删除指定的缓存 193 | * 194 | * @access public 195 | * 196 | * @param string $key 所要删除数据的Key 197 | * 198 | * @return boolean 199 | */ 200 | public function delete($key) { 201 | 202 | //参数分析 203 | if (!$key) { 204 | return false; 205 | } 206 | 207 | return $this->_Memcache->delete($key); 208 | } 209 | 210 | /** 211 | * 数据自增 212 | * 213 | * @access public 214 | * 215 | * @author ColaPHP 216 | * @param string $key 数据key 217 | * @param integer $value 自增数据值 218 | * 219 | * @return boolean 220 | */ 221 | public function increment($key, $value = 1) { 222 | 223 | //参数分析 224 | if (!$key) { 225 | return false; 226 | } 227 | 228 | return $this->_Memcache->increment($key, $value); 229 | } 230 | 231 | /** 232 | * 数据自减 233 | * 234 | * @access public 235 | * 236 | * @param string $key 数据key 237 | * @param integer $value 自减数据值 238 | * 239 | * @return boolean 240 | */ 241 | public function decrement($key, $value = 1) { 242 | 243 | //参数分析 244 | if (!$key) { 245 | return false; 246 | } 247 | 248 | return $this->_Memcache->decrement($key, $value); 249 | } 250 | 251 | /** 252 | * 清除所有的缓存数据 253 | * 254 | * @access public 255 | * @return boolean 256 | */ 257 | public function clear() { 258 | 259 | return $this->_Memcache->flush(); 260 | } 261 | 262 | /** 263 | * 返回memcached实例化对象 264 | * 265 | * @access public 266 | * @return object 267 | */ 268 | public function getConnection() { 269 | 270 | return $this->_Memcache; 271 | } 272 | 273 | /** 274 | * 析构函数 275 | * 276 | * @access public 277 | * @return boolean 278 | */ 279 | public function __destruct() { 280 | 281 | if ($this->_Memcache) { 282 | $this->_Memcache->close(); 283 | } 284 | 285 | return true; 286 | } 287 | 288 | /** 289 | * 单例模式 290 | * 291 | * 用于本类的单例模式(singleton)实例化 292 | * 293 | * @access public 294 | * 295 | * @param array $params 数据库连接参数 296 | * 297 | * @return object 298 | */ 299 | public static function getInstance($params = null) { 300 | 301 | if (!self::$_instance) { 302 | self::$_instance = new self($params); 303 | } 304 | 305 | return self::$_instance; 306 | } 307 | } -------------------------------------------------------------------------------- /doitphp/core/Response.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doitphp.com 7 | * @copyright Copyright (C) 2015 www.doitphp.com All rights reserved. 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Response.php 2.0 2012-11-28 00:50:27Z tommy $ 10 | * @package core 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | abstract class Response { 19 | 20 | /** 21 | * 设置页面编码 22 | * 23 | * @access public 24 | * 25 | * @param string $encode 编码名称 26 | * 27 | * @return void 28 | */ 29 | public static function charset($encode = 'UTF-8') { 30 | 31 | header("Content-Type:text/html; charset={$encode}"); 32 | 33 | return true; 34 | } 35 | 36 | /** 37 | * 禁用浏览器缓存 38 | * 39 | * @access public 40 | * @return boolean 41 | */ 42 | public static function noCache() { 43 | 44 | header("Cache-Control: no-store, no-cache, must-revalidate"); 45 | header("Cache-Control: post-check=0, pre-check=0", false); 46 | header("Pragma: no-cache"); 47 | 48 | return true; 49 | } 50 | 51 | /** 52 | * 设置网页生存周期 53 | * 54 | * @access public 55 | * 56 | * @param integer $seconds 生存周期(单位:秒) 57 | * 58 | * @return boolean 59 | */ 60 | public static function expires($seconds = 1800) { 61 | 62 | $time = date('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $seconds) . ' GMT'; 63 | header("Expires: {$time}"); 64 | 65 | return true; 66 | } 67 | 68 | /** 69 | * 网址(URL)跳转操作 70 | * 71 | * 页面跳转方法,例:运行页面跳转到自定义的网址(即:URL重定向) 72 | * 73 | * @access public 74 | * 75 | * @param string $url 所要跳转的网址(URL) 76 | * 77 | * @return void 78 | */ 79 | public static function redirect($url) { 80 | 81 | //参数分析. 82 | if (!$url) { 83 | return false; 84 | } 85 | 86 | if (!headers_sent()) { 87 | header("Location:" . $url); 88 | }else { 89 | echo ''; 90 | } 91 | 92 | exit(); 93 | } 94 | 95 | /** 96 | * 显示提示信息操作 97 | * 98 | * 本方法支持URL的自动跳转,当显示时间有效期失效时则跳转到自定义网址,若跳转网址为空则函数不执行跳转功能,当自定义网址参数为-1时默认为:返回上一页。 99 | * 注:显示提示信息的页面模板内容可以自定义. 方法:在项目视图目录中的error子目录中新建message.php文件,自定义该文件内容。 100 | * 模板文件输出信息处代码参考doitphp子目录中文件:views/errors/message.php 101 | * 102 | * @access public 103 | * 104 | * @param string $message 所要显示的提示信息 105 | * @param string $gotoUrl 所要跳转的自定义网址 106 | * @param integer $limitTime 显示信息的有效期,注:(单位:秒) 默认为3秒 107 | * 108 | * @return string 109 | */ 110 | public static function showMsg($message, $gotoUrl = null, $limitTime = 3) { 111 | 112 | //参数分析 113 | if (!$message) { 114 | return false; 115 | } 116 | 117 | //当自定义跳转网址存在时 118 | if ($gotoUrl) { 119 | $limitTime = 1000 * $limitTime; 120 | //分析自定义网址是否为返回页 121 | if ($gotoUrl == -1) { 122 | $gotoUrl = 'javascript:history.go(-1);'; 123 | $message .= '
如果你的浏览器没反应,请点击这里...'; 124 | } else{ 125 | //防止网址过长,有换行引起跳转变不正确 126 | $gotoUrl = str_replace(array("\n","\r"), '', $gotoUrl); 127 | $message .= '
如果你的浏览器没反应,请点击这里...'; 128 | } 129 | $message .= ''; 130 | } 131 | 132 | $messageTemplateFile = BASE_PATH . '/views/errors/message.php'; 133 | 134 | is_file($messageTemplateFile) ? include_once $messageTemplateFile : include_once DOIT_ROOT . '/views/errors/message.php'; 135 | 136 | exit(); 137 | } 138 | 139 | /** 140 | * 优雅输出print_r()函数所要输出的内容 141 | * 142 | * 用于程序调试时,完美输出调试数据,功能相当于print_r().当第二参数为true时(默认为:false),功能相当于var_dump()。 143 | * 注:本方法一般用于程序调试 144 | * 145 | * @access public 146 | * 147 | * @param mixed $data 所要输出的数据 148 | * @param boolean $option 选项:true(显示var_dump()的内容)/ false(显示print_r()的内容) 149 | * 150 | * @return string 151 | */ 152 | public static function dump($data = null, $option = false) { 153 | 154 | //设置页面编码 155 | if (!headers_sent()) { 156 | header("Content-Type:text/html; charset=utf-8"); 157 | } 158 | 159 | //当输出print_r()内容时 160 | if(!$option){ 161 | echo '
';
162 |             print_r($data);
163 |             echo '
'; 164 | } else { 165 | ob_start(); 166 | var_dump($data); 167 | $output = ob_get_clean(); 168 | 169 | $output = str_replace('"', '', $output); 170 | $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); 171 | 172 | echo '
', $output, '
'; 173 | } 174 | 175 | exit(); 176 | } 177 | 178 | /** 179 | * 用于显示错误信息 180 | * 181 | * 若调试模式关闭时(即:DOIT_DEBUG为false时),则将错误信息并写入日志 182 | * 183 | * @access public 184 | * 185 | * @param string $message 所要显示的错误信息 186 | * @param string $level 日志类型. 默认为Error. 参数:Warning, Error, Notice 187 | * 188 | * @return string 189 | */ 190 | public static function halt($message, $level = 'Normal') { 191 | 192 | //参数分析 193 | if (!$message) { 194 | return false; 195 | } 196 | 197 | //调试模式下优雅输出错误信息 198 | $traces = debug_backtrace(); 199 | $traceString = ''; 200 | $sourceFile = $traces[0]['file'] . '(' . $traces[0]['line'] . ')'; 201 | 202 | if (defined('DOIT_DEBUG') && DOIT_DEBUG === true && $level != 'Normal') { 203 | foreach ($traces as $key=>$trace) { 204 | //代码跟踪级别限制 205 | if ($key > 2) { 206 | break; 207 | } 208 | $argsString = ($trace['args'] && is_array($trace['args'])) ? '(' . implode('.', $trace['args']) . ')': ''; 209 | $traceString .= "#{$key} {$trace['file']}({$trace['line']}){$trace['class']}{$trace['type']}{$trace['function']}{$argsString}
"; 210 | } 211 | } 212 | 213 | //加载,分析,并输出excepiton文件内容 214 | include_once DOIT_ROOT . '/views/errors/exception.php'; 215 | 216 | if (defined('DOIT_DEBUG') && DOIT_DEBUG === false && $level != 'Normal') { 217 | //写入程序运行日志 218 | Log::write($message, $level); 219 | } 220 | 221 | //终止程序 222 | exit(); 223 | } 224 | 225 | /** 226 | * 输出供Ajax所调用的页面返回信息 227 | * 228 | * 返回json数据,供前台ajax调用 229 | * 230 | * @access public 231 | * 232 | * @param boolean $status 执行状态 : true/false 或 1/0 233 | * @param string $msg 返回信息, 默认为空 234 | * @param array $data 返回数据,支持数组。 235 | * 236 | * @return string 237 | */ 238 | public static function ajax($status, $msg = null, $data = array()) { 239 | 240 | $result = array(); 241 | $result['status'] = $status; 242 | $result['msg'] = !is_null($msg) ? $msg : ''; 243 | $result['data'] = $data; 244 | 245 | //设置页面编码 246 | header("Content-Type:text/html; charset=utf-8"); 247 | 248 | exit(json_encode($result)); 249 | } 250 | 251 | } -------------------------------------------------------------------------------- /doitphp/library/Ftp.php: -------------------------------------------------------------------------------- 1 | , tommy 6 | * @copyright CopyRight DoitPHP team, initphp team 7 | * @link http://www.doitphp.com 8 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 9 | * @version $Id: Ftp.php 2.0 2012-12-23 00:05:01Z tommy $ 10 | * @package library 11 | * @since 1.0 12 | */ 13 | 14 | if (!defined('IN_DOIT')) { 15 | exit(); 16 | } 17 | 18 | class Ftp { 19 | 20 | /** 21 | * FTP 连接 ID 22 | * 23 | * @var object 24 | */ 25 | private $_linkId; 26 | 27 | 28 | /** 29 | * 连接FTP服务器 30 | * 31 | * @access public 32 | * 33 | * @param string $server FTP服务器地址 34 | * @param integer $port FTP服务器端口 35 | * @param string $username FTP用户名 36 | * @param string $password FTP密码 37 | * 38 | * @return boolean 39 | */ 40 | public function connect($server, $port = 21, $username, $password) { 41 | 42 | //参数分析 43 | if (!$server || !$username || !$password) { 44 | return false; 45 | } 46 | 47 | try { 48 | $this->_linkId = @ftp_connect($server, $port); 49 | if (!@ftp_login($this->_linkId, $username, $password)){ 50 | Controller::showMsg('Ftp Server 登陆失败'); 51 | } 52 | 53 | //打开被动模拟 54 | ftp_pasv($this->_linkId, 1); 55 | 56 | return true; 57 | } catch (Exception $exception) { 58 | 59 | //抛出异常信息 60 | throw new DoitException('Ftp server connect error!
' . $exception->getMessage(), $exception->getCode()); 61 | } 62 | } 63 | 64 | /** 65 | * FTP-文件上传 66 | * 67 | * @access public 68 | * 69 | * @param string $localFile 本地文件 70 | * @param string $ftpFile Ftp文件 71 | * 72 | * @return boolean 73 | */ 74 | public function upload($localFile, $ftpFile) { 75 | 76 | if (!$localFile || !$ftpFile) { 77 | return false; 78 | } 79 | 80 | $ftpPath = dirname($ftpFile); 81 | if ($ftpPath) { 82 | //创建目录 83 | $this->makeDir($ftpPath); 84 | @ftp_chdir($this->_linkId, $ftpPath); 85 | $ftpFile = basename($ftpFile); 86 | } 87 | 88 | $ret = ftp_nb_put($this->_linkId, $ftpFile, $localFile, FTP_BINARY); 89 | while ($ret == FTP_MOREDATA) { 90 | $ret = ftp_nb_continue($this->_linkId); 91 | } 92 | 93 | if ($ret != FTP_FINISHED) { 94 | return false; 95 | } 96 | 97 | return true; 98 | } 99 | 100 | /** 101 | * FTP-文件下载 102 | * 103 | * @access public 104 | * 105 | * @param string $localFile 本地文件 106 | * @param string $ftpFile Ftp文件 107 | * 108 | * @return boolean 109 | */ 110 | public function download($localFile, $ftpFile) { 111 | 112 | if (!$localFile || !$ftpFile) { 113 | return false; 114 | } 115 | 116 | $ret = ftp_nb_get($this->_linkId, $localFile, $ftpFile, FTP_BINARY); 117 | while ($ret == FTP_MOREDATA) { 118 | $ret = ftp_nb_continue ($this->_linkId); 119 | } 120 | 121 | if ($ret != FTP_FINISHED) { 122 | return false; 123 | } 124 | 125 | return true; 126 | } 127 | 128 | /** 129 | * FTP-创建目录 130 | * 131 | * @access public 132 | * 133 | * @param string $path 路径地址 134 | * 135 | * @return boolean 136 | */ 137 | public function makeDir($path) { 138 | 139 | if (!$path) { 140 | return false; 141 | } 142 | 143 | $dir = explode("/", $path); 144 | $path = ftp_pwd($this->_linkId) . '/'; 145 | $ret = true; 146 | for ($i=0; $i_linkId, $path)) { 149 | if (!@ftp_mkdir($this->_linkId, $dir[$i])) { 150 | $ret = false; 151 | break; 152 | } 153 | } 154 | @ftp_chdir($this->_linkId, $path); 155 | } 156 | 157 | if (!$ret) { 158 | return false; 159 | } 160 | 161 | return true; 162 | } 163 | 164 | /** 165 | * FTP-删除文件目录 166 | * 167 | * @access public 168 | * 169 | * @param string $dir 删除文件目录 170 | * 171 | * @return boolean 172 | */ 173 | public function deleteDir($dir) { 174 | 175 | //参数分析 176 | if (!$dir) { 177 | return false; 178 | } 179 | 180 | $dir = $this->checkpath($dir); 181 | if (@!ftp_rmdir($this->_linkId, $dir)) { 182 | return false; 183 | } 184 | 185 | return true; 186 | } 187 | 188 | /** 189 | * FTP-删除文件 190 | * 191 | * @access public 192 | * 193 | * @param string $file 删除文件 194 | * 195 | * @return boolean 196 | */ 197 | public function deleteFile($file) { 198 | 199 | //参数分析 200 | if (!$file) { 201 | return false; 202 | } 203 | 204 | $file = $this->checkpath($file); 205 | if (@!ftp_delete($this->_linkId, $file)) { 206 | return false; 207 | } 208 | 209 | return true; 210 | } 211 | 212 | /** 213 | * FTP-FTP上的文件列表 214 | * 215 | * @access public 216 | * 217 | * @param string $path 路径 218 | * 219 | * @return boolean 220 | */ 221 | public function nlist($path = '/') { 222 | 223 | return ftp_nlist($this->_linkId, $path); 224 | } 225 | 226 | /** 227 | * FTP-改变文件权限值 228 | * 229 | * @access public 230 | * 231 | * @param string $file 文件 232 | * @param string $value 值 233 | * 234 | * @return boolean 235 | */ 236 | public function chmod($file, $value = 0777) { 237 | 238 | //参数分析 239 | if (!$file) { 240 | return false; 241 | } 242 | 243 | return @ftp_chmod($this->_linkId, $value, $file); 244 | } 245 | 246 | /** 247 | * FTP-返回文件大小 248 | * 249 | * @access public 250 | * 251 | * @param string $file 文件 252 | * 253 | * @return boolean 254 | */ 255 | public function fileSize($file) { 256 | 257 | //参数分析 258 | if (!$file) { 259 | return false; 260 | } 261 | 262 | return ftp_size($this->_linkId, $file); 263 | } 264 | 265 | /** 266 | * FTP-文件修改时间 267 | * 268 | * @access public 269 | * 270 | * @param string $file 文件 271 | * 272 | * @return boolean 273 | */ 274 | public function mdtime($file) { 275 | 276 | //参数分析 277 | if (!$file) { 278 | return false; 279 | } 280 | 281 | return ftp_mdtm($this->_linkId, $file); 282 | } 283 | 284 | /** 285 | * FTP-更改ftp上的文件名称 286 | * 287 | * @access public 288 | * 289 | * @param string $oldname 旧文件 290 | * @param string $newname 新文件名称 291 | * 292 | * @return boolean 293 | */ 294 | public function rename($oldname, $newname) { 295 | 296 | //参数分析 297 | if (!$oldname || !$newname) { 298 | return false; 299 | } 300 | 301 | return ftp_rename ($this->_linkId, $oldname, $newname); 302 | } 303 | 304 | /** 305 | * 析构函数 306 | * 307 | * @access public 308 | * @return boolean 309 | */ 310 | public function __destruct() { 311 | 312 | if ($this->_linkId) { 313 | ftp_close($this->_linkId); 314 | } 315 | 316 | return true; 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /doitphp/library/MongoDb.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2010 Tommy Software Studio 9 | * @link http://www.doitphp.com 10 | * @license New BSD License.{@link http://www.opensource.org/licenses/bsd-license.php} 11 | * @version $Id: MongoDb.php 2.0 2012-12-29 21:31:01Z tommy $ 12 | * @package library 13 | * @since 1.0 14 | */ 15 | 16 | if (!defined('IN_DOIT')) { 17 | exit(); 18 | } 19 | 20 | class MongoDb { 21 | 22 | /** 23 | * 单例模式实例化本类 24 | * 25 | * @var object 26 | */ 27 | protected static $_instance = null; 28 | 29 | /** 30 | * 数据库连接实例化对象名 31 | * 32 | * @var object 33 | */ 34 | protected $_dbLink = null; 35 | 36 | /** 37 | * mongo实例化对象 38 | * 39 | * @var object 40 | */ 41 | protected $_mongo = null; 42 | 43 | /** 44 | * 数据库连接参数默认值 45 | * 46 | * @var array 47 | */ 48 | protected $_defaultConfig = array( 49 | 'dsn' => 'mongodb://localhost:27017', 50 | 'option' => array('connect' => true), 51 | ); 52 | 53 | /** 54 | * 构造方法 55 | * 56 | * 用于初始化运行环境,或对基本变量进行赋值 57 | * 58 | * @access public 59 | * 60 | * @param array $params 数据库连接参数,如主机名,数据库用户名,密码等 61 | * 62 | * @return boolean 63 | */ 64 | public function __construct($params = array()) { 65 | 66 | if (!extension_loaded('mongo')) { 67 | Controller::halt('The mongo extension to be loaded!'); 68 | } 69 | 70 | //参数分析 71 | if (!$params || !is_array($params)) { 72 | //加载数据库配置文件. 73 | $params = Configure::get('mongo'); 74 | } 75 | 76 | $params = is_array($params) ? $params + $this->_defaultConfig : $this->_defaultConfig; 77 | if (!isset($params['dbname']) || !$params['dbname']) { 78 | Controller::halt('The file of MongoDB config is error, dbname is not found!'); 79 | } 80 | 81 | try { 82 | //实例化mongo 83 | $this->_mongo = new Mongo($params['dsn'], $params['option']); 84 | 85 | //连接mongo数据库 86 | $this->_dbLink = $this->_mongo->selectDB($params['dbname']); 87 | 88 | //用户登录 89 | if (isset($params['username']) && isset($params['password'])) { 90 | $this->_dbLink->authenticate($params['username'], $params['password']); 91 | } 92 | 93 | return true; 94 | } catch (Exception $exception) { 95 | 96 | //抛出异常信息 97 | throw new DoitException('MongoDb connect error!
' . $exception->getMessage(), $exception->getCode()); 98 | } 99 | } 100 | 101 | /** 102 | * Select Collection 103 | * 104 | * @author ColaPHP 105 | * 106 | * @access public 107 | * 108 | * @param string $collection 集合名称(相当于关系数据库中的表) 109 | * 110 | * @return object 111 | */ 112 | public function collection($collection) { 113 | 114 | return $this->_dbLink->selectCollection($collection); 115 | } 116 | 117 | /** 118 | * 查询一条记录 119 | * 120 | * @access public 121 | * 122 | * @param string $collnections 集合名称(相当于关系数据库中的表) 123 | * @param array $query 查询的条件array(key=>value) 相当于key=value 124 | * @param array fields 需要列表的字段信息array(filed1,filed2) 125 | * 126 | * @return array 127 | */ 128 | public function getOne($collnections, $query, $fields=array()) { 129 | 130 | return $this->collection($collnections)->findOne($query, $fields); 131 | } 132 | 133 | /** 134 | * 查询多条记录 135 | * 136 | * @access public 137 | * 138 | * @param string $collnections 集合名称(相当于关系数据库中的表) 139 | * @param array $query 查询的条件array(key=>value) 相当于key=value 140 | * @param array fields 需要列表的字段信息array(filed1,filed2) 141 | * 142 | * @return array 143 | */ 144 | public function getAll($collnections, $query, $fields=array()) { 145 | 146 | $result = array(); 147 | $cursor = $this->collection($collnections)->find($query, $fields); 148 | while ($cursor->hasNext()) { 149 | $result[] = $cursor->getNext(); 150 | } 151 | 152 | return $result; 153 | } 154 | 155 | /** 156 | * 插入数据 157 | * 158 | * @access public 159 | * 160 | * @param string $collnections 集合名称(相当于关系数据库中的表) 161 | * @param array $data 所要写入的数据信息 162 | * 163 | * @return boolean 164 | */ 165 | public function insert($collnections, $data) { 166 | 167 | return $this->collection($collnections)->insert($data); 168 | } 169 | 170 | /** 171 | * 更改数据 172 | * 173 | * @access public 174 | * 175 | * @param string $collnections 集合名称(相当于关系数据库中的表) 176 | * @param array $query 查询的条件array(key=>value) 相当于key=value 177 | * @param array $data 所要更改的信息 178 | * @param array $options 选项 179 | * 180 | * @return boolean 181 | */ 182 | public function update($collection, $query, $data, $options=array('safe'=>true,'multiple'=>true)) { 183 | 184 | return $this->collection($collection)->update($query, $data, $options); 185 | } 186 | 187 | /** 188 | * 删除数据 189 | * 190 | * @access public 191 | * 192 | * @param string $collnections 集合名称(相当于关系数据库中的表) 193 | * @param array $query 查询的条件array(key=>value) 相当于key=value 194 | * @param array $option 选项 195 | * 196 | * @return boolean 197 | */ 198 | public function delete($collection, $query, $option=array("justOne"=>false)) { 199 | 200 | return $this->collection($collection)->remove($query, $option); 201 | } 202 | 203 | /** 204 | * MongoId 205 | * 206 | * @author ColaPHP 207 | * 208 | * @access public 209 | * 210 | * @param string $id 获取mongoId 211 | * 212 | * @return object 213 | */ 214 | public static function id($id = null) 215 | { 216 | return new MongoId($id); 217 | } 218 | 219 | /** 220 | * MongoTimestamp 221 | * 222 | * @author ColaPHP 223 | * 224 | * @access public 225 | * 226 | * @param int $sec 227 | * @param int $inc 228 | * 229 | * @return MongoTimestamp 230 | */ 231 | public static function Timestamp($sec = null, $inc = 0) 232 | { 233 | if (!$sec) { 234 | $sec = $_SERVER['REQUEST_TIME']; 235 | } 236 | 237 | return new MongoTimestamp($sec, $inc); 238 | } 239 | 240 | /** 241 | * GridFS 242 | * 243 | * @author ColaPHP 244 | * 245 | * @access public 246 | * 247 | * @return object 248 | */ 249 | public function gridFS($prefix = 'fs') 250 | { 251 | return $this->_dbLink->getGridFS($prefix); 252 | } 253 | 254 | /** 255 | * 析构函数 256 | * 257 | * 程序执行完毕,打扫战场 258 | * 259 | * @access public 260 | * 261 | * @return void 262 | */ 263 | public function __destruct() { 264 | 265 | if ($this->_dbLink) { 266 | $this->_dbLink = null; 267 | } 268 | 269 | if ($this->_mongo) { 270 | $this->_mongo->close(); 271 | } 272 | 273 | return true; 274 | } 275 | 276 | /** 277 | * 单例模式 278 | * 279 | * 用于本类的单例模式(singleton)实例化 280 | * 281 | * @access public 282 | * 283 | * @param array $params 数据库连接参数,如数据库服务器名,用户名,密码等 284 | * 285 | * @return object 286 | */ 287 | public static function getInstance($params = array()) { 288 | 289 | if (!self::$_instance) { 290 | self::$_instance = new self($params); 291 | } 292 | 293 | return self::$_instance; 294 | } 295 | 296 | } -------------------------------------------------------------------------------- /assets/doit/js/calendar/WdatePicker.js: -------------------------------------------------------------------------------- 1 | var $dp,WdatePicker;(function(){var _={$wdate:true,$dpPath:"",$crossFrame:true,doubleCalendar:false,enableKeyboard:true,enableInputMask:true,autoUpdateOnChanged:null,whichDayIsfirstWeek:4,position:{},lang:"zh-cn",skin:"default",dateFmt:"yyyy-MM-dd",realDateFmt:"yyyy-MM-dd",realTimeFmt:"HH:mm:ss",realFullFmt:"%Date %Time",minDate:"1900-01-01 00:00:00",maxDate:"2099-12-31 23:59:59",startDate:"",alwaysUseStartDate:false,yearOffset:1911,firstDayOfWeek:0,isShowWeek:false,highLineWeekDay:true,isShowClear:true,isShowToday:true,isShowOK:true,isShowOthers:true,readOnly:false,errDealMode:0,autoPickDate:null,qsEnabled:true,autoShowQS:false,specialDates:null,specialDays:null,disabledDates:null,disabledDays:null,opposite:false,onpicking:null,onpicked:null,onclearing:null,oncleared:null,ychanging:null,ychanged:null,Mchanging:null,Mchanged:null,dchanging:null,dchanged:null,Hchanging:null,Hchanged:null,mchanging:null,mchanged:null,schanging:null,schanged:null,eCont:null,vel:null,errMsg:"",quickSel:[],has:{}};WdatePicker=U;var X=window,O="document",J="documentElement",C="getElementsByTagName",V,A,T,I,b;switch(navigator.appName){case"Microsoft Internet Explorer":T=true;break;case"Opera":b=true;break;default:I=true;break}A=L();if(_.$wdate)M(A+"skin/WdatePicker.css");V=X;if(_.$crossFrame){try{while(V.parent&&V.parent[O]!=V[O]&&V.parent[O][C]("frameset").length==0)V=V.parent}catch(P){}}if(!V.$dp)V.$dp={ff:I,ie:T,opera:b,el:null,win:X,status:0,defMinDate:_.minDate,defMaxDate:_.maxDate,flatCfgs:[]};B();if($dp.status==0)Z(X,function(){U(null,true)});if(!X[O].docMD){E(X[O],"onmousedown",D);X[O].docMD=true}if(!V[O].docMD){E(V[O],"onmousedown",D);V[O].docMD=true}E(X,"onunload",function(){if($dp.dd)Q($dp.dd,"none")});function B(){V.$dp=V.$dp||{};obj={$:function($){return(typeof $=="string")?X[O].getElementById($):$},$D:function($,_){return this.$DV(this.$($).value,_)},$DV:function(_,$){if(_!=""){this.dt=$dp.cal.splitDate(_,$dp.cal.dateFmt);if($)for(var B in $)if(this.dt[B]===undefined)this.errMsg="invalid property:"+B;else{this.dt[B]+=$[B];if(B=="M"){var C=$["M"]>0?1:0,A=new Date(this.dt["y"],this.dt["M"],0).getDate();this.dt["d"]=Math.min(A+C,this.dt["d"])}}if(this.dt.refresh())return this.dt}return""},show:function(){var A=V[O].getElementsByTagName("div"),$=100000;for(var B=0;B$)$=_}this.dd.style.zIndex=$+2;Q(this.dd,"block")},hide:function(){Q(this.dd,"none")},attachEvent:E};for(var $ in obj)V.$dp[$]=obj[$];$dp=V.$dp;$dp.dd=V[O].getElementById("_my97DP")}function E(A,$,_){if(T)A.attachEvent($,_);else if(_){var B=$.replace(/on/,"");_._ieEmuEventHandler=function($){return _($)};A.addEventListener(B,_._ieEmuEventHandler,false)}}function L(){var _,A,$=X[O][C]("script");for(var B=0;B<$.length;B++){_=$[B].src.substring(0,$[B].src.toLowerCase().indexOf("wdatepicker.js"));A=_.lastIndexOf("/");if(A>0)_=_.substring(0,A+1);if(_)break}return _}function F(F){var E,C;if(F.substring(0,1)!="/"&&F.indexOf("://")==-1){E=V.location.href;C=location.href;if(E.indexOf("?")>-1)E=E.substring(0,E.indexOf("?"));if(C.indexOf("?")>-1)C=C.substring(0,C.indexOf("?"));var G,I,$="",D="",A="",J,H,B="";for(J=0;J_.scrollTop||A.scrollLeft>_.scrollLeft))?A:_;return{"top":B.scrollTop,"left":B.scrollLeft}}function D($){var _=$?($.srcElement||$.target):null;try{if($dp.cal&&!$dp.eCont&&$dp.dd&&_!=$dp.el&&$dp.dd.style.display=="block")$dp.cal.close()}catch($){}}function Y(){$dp.status=2;H()}function H(){if($dp.flatCfgs.length>0){var $=$dp.flatCfgs.shift();$.el={innerHTML:""};$.autoPickDate=true;$.qsEnabled=false;K($)}}var R,$;function U(J,C){$dp.win=X;B();J=J||{};if(C){if(!G()){$=$||setInterval(function(){if(V[O].readyState=="complete")clearInterval($);U(null,true)},50);return}if($dp.status==0){$dp.status=1;K({el:{innerHTML:""}},true)}else return}else if(J.eCont){J.eCont=$dp.$(J.eCont);$dp.flatCfgs.push(J);if($dp.status==2)H()}else{if($dp.status==0){U(null,true);return}if($dp.status!=2)return;var F=D();if(F){$dp.srcEl=F.srcElement||F.target;F.cancelBubble=true}$dp.el=J.el=$dp.$(J.el||$dp.srcEl);if(!$dp.el||$dp.el["My97Mark"]===true||$dp.el.disabled||($dp.el==$dp.el&&Q($dp.dd)!="none"&&$dp.dd.style.left!="-1970px")){$dp.el["My97Mark"]=false;return}K(J);if(F&&$dp.el.nodeType==1&&$dp.el["My97Mark"]===undefined){$dp.el["My97Mark"]=false;var _,A;if(F.type=="focus"){_="onclick";A="onfocus"}else{_="onfocus";A="onclick"}E($dp.el,_,$dp.el[A])}}function G(){if(T&&V!=X&&V[O].readyState!="complete")return false;return true}function D(){if(I){func=D.caller;while(func!=null){var $=func.arguments[0];if($&&($+"").indexOf("Event")>=0)return $;func=func.caller}return null}return event}}function S(_,$){return _.currentStyle?_.currentStyle[$]:document.defaultView.getComputedStyle(_,false)[$]}function Q(_,$){if(_)if($!=null)_.style.display=$;else return S(_,"display")}function K(H,$){for(var D in _)if(D.substring(0,1)!="$")$dp[D]=_[D];for(D in H)if($dp[D]!==undefined)$dp[D]=H[D];var E=$dp.el?$dp.el.nodeName:"INPUT";if($||$dp.eCont||new RegExp(/input|textarea|div|span|p|a/ig).test(E))$dp.elProp=E=="INPUT"?"value":"innerHTML";else return;if($dp.lang=="auto")$dp.lang=T?navigator.browserLanguage.toLowerCase():navigator.language.toLowerCase();if(!$dp.dd||$dp.eCont||($dp.lang&&$dp.realLang&&$dp.realLang.name!=$dp.lang&&$dp.getLangIndex&&$dp.getLangIndex($dp.lang)>=0)){if($dp.dd&&!$dp.eCont)V[O].body.removeChild($dp.dd);if(_.$dpPath=="")F(A);var B="";if($dp.eCont){$dp.eCont.innerHTML=B;Z($dp.eCont.childNodes[0],Y)}else{$dp.dd=V[O].createElement("DIV");$dp.dd.id="_my97DP";$dp.dd.style.cssText="position:absolute";$dp.dd.innerHTML=B;V[O].body.appendChild($dp.dd);Z($dp.dd.childNodes[0],Y);if($)$dp.dd.style.left=$dp.dd.style.top="-1970px";else{$dp.show();C()}}}else if($dp.cal){$dp.show();$dp.cal.init();if(!$dp.eCont)C()}function C(){var F=$dp.position.left,B=$dp.position.top,C=$dp.el;if(C!=$dp.srcEl&&(Q(C)=="none"||C.type=="hidden"))C=$dp.srcEl;var H=W(C),$=G(X),D=N(V),A=a(V),E=$dp.dd.offsetHeight,_=$dp.dd.offsetWidth;if(isNaN(B)){if(B=="above"||(B!="under"&&(($.topM+H.bottom+E>D.height)&&($.topM+H.top-E>0))))B=A.top+$.topM+H.top-E-2;else B=A.top+$.topM+Math.min(H.bottom,D.height-E)+2}else B+=A.top+$.topM;if(isNaN(F))F=A.left+Math.min($.leftM+H.left,D.width-_-5)-(T?2:0);else F+=A.left+$.leftM;$dp.dd.style.top=B+"px";$dp.dd.style.left=F+"px"}}})() --------------------------------------------------------------------------------