Skip to content

Commit

Permalink
version to 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuli.zhul committed Dec 18, 2013
1 parent 3f292c1 commit e278f3b
Show file tree
Hide file tree
Showing 74 changed files with 457 additions and 146 deletions.
12 changes: 4 additions & 8 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
InitPHP3.2.2版本
1. 新增InitPHP::cli_init 命令行运行模式
2. 验证码支持多个地方使用,只要传递key值
3. 修改分页可以支持自定义样式
4. 修改URL组装方式
5. 模板$this->view->display("index/run")
6. get_gp 默认关闭参数过滤,这样的话就需要默认开始输出过滤
7. 新增$this->dao->db->build_key($data, $fields)
1. 新增控制器白名单可以指定HTTP METHOD方法
2. 新增renturn200 return404 return500方法
3. 修复is_empty方法
4. 修复CURL 参数传参问题
2 changes: 1 addition & 1 deletion demo/dscv_demo/app/data/template_c/index_run.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-04 09:21:56, compiled from ../app/web/template/index_run.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:55:54, compiled from ../app/web/template/index_run.htm */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand Down
2 changes: 1 addition & 1 deletion demo/form_demo/app/data/template_c/index_run.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-03 05:18:43, compiled from ../app/web/template/index_run.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:26:03, compiled from ../app/web/template/index_run.htm */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand Down
37 changes: 35 additions & 2 deletions demo/hello_world_demo/app/web/controller/indexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,42 @@
*/
class indexController extends Controller {

public $initphp_list = array('test'); //Action白名单
public $initphp_list = array('test', 'getAc|get', 'postAc|post', 'putAc|put', 'delAc|del'); //Action白名单

public function run() {
echo "<h1>Hello World,This is A InitPHP FrameWork Demo</h1>";
echo "<h1>Hello World,This is A InitPHP FrameWork Demo</h1>";
}

public function test() {
echo "一个测试类。<br/>";
echo "Action 可以指定HTTP的请求方式,指定单个 例如:getAc|get 通过|符号分隔<br/>";
echo "如果指定多个方法,方法之间用-符号分隔 例如:getAc|get-post-del 这个允许 GET POST 和 DEL操作 <br/>";
echo "操作方式一共四种:get,post,del,put";
$curl = $this->getLibrary("curl");
echo "<br/><br/><br/>GET:<br/><br/><br/>";
echo $curl->get("http://127.0.0.1/initphp/trunk/demo/hello_world_demo/www/?a=getAc");
echo "<br/><br/><br/>POST:<br/><br/><br/>";
echo $curl->post("http://127.0.0.1/initphp/trunk/demo/hello_world_demo/www/?a=postAc");
echo "<br/><br/><br/>PUT:<br/><br/><br/>";
echo $curl->put("http://127.0.0.1/initphp/trunk/demo/hello_world_demo/www/?a=putAc");
echo "<br/><br/><br/>DEL:<br/><br/><br/>";
echo $curl->del("http://127.0.0.1/initphp/trunk/demo/hello_world_demo/www/?a=delAc");
}

public function getAc() {
echo "只能是HTTP GET请求的时候才能访问到";
}

public function postAc() {
echo "只能是HTTP POST请求的时候才能访问到";
}

public function putAc() {
echo "只能是HTTP PUT请求的时候才能访问到";
}

public function delAc() {
echo "只能是HTTP DEL请求的时候才能访问到";
}

}
2 changes: 1 addition & 1 deletion demo/mvc_demo/app/data/template_c/index_run.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-05 08:46:26, compiled from ../app/web/template/index_run.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:55:00, compiled from ../app/web/template/index_run.htm */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand Down
2 changes: 1 addition & 1 deletion demo/view_demo/app/data/template_c/index_footer.tpl.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-03 05:18:39, compiled from ../app/web/template/index_footer.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:26:01, compiled from ../app/web/template/index_footer.htm */ ?>
<br/><br/>
This is Footer
2 changes: 1 addition & 1 deletion demo/view_demo/app/data/template_c/index_header.tpl.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-03 05:18:39, compiled from ../app/web/template/index_header.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:26:01, compiled from ../app/web/template/index_header.htm */ ?>
This is Header
<br/><br/>
2 changes: 1 addition & 1 deletion demo/view_demo/app/data/template_c/index_run.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-12-03 05:18:39, compiled from ../app/web/template/index_run.htm */ ?>
<?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2012-11-27 05:26:01, compiled from ../app/web/template/index_run.htm */ ?>

<h1><?php echo $title;?></h1><br/>
以下是加载的模板列表:
Expand Down
1 change: 0 additions & 1 deletion demo/view_demo/app/web/controller/indexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public function run() {
$this->view->set_tpl("index_run"); //中间的模板
$this->view->set_tpl("index_header", "F"); //头部模板
$this->view->set_tpl("index_footer", "L"); //脚步模板

$tpls = $this->view->get_tpl(); //统计输出的模板
$this->view->assign("tpls", $tpls);
$this->view->display(); //模板展示
Expand Down
33 changes: 32 additions & 1 deletion initphp/core/controller/controller.init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Controller-controller 控制器基类
* InitPHP 3.3 国产PHP开发框架 Controller-controller 控制器基类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
Expand Down Expand Up @@ -69,6 +69,37 @@ public function redirect($url, $time = 0) {
}
}

/**
* 返回404
* Controller中使用方法:$this->controller->return404()
* @return
*/
public function return404() {
header('HTTP/1.1 404 Not Found');
header("status: 404 Not Found");
return;
}

/**
* 返回404
* Controller中使用方法:$this->controller->return200()
* @return
*/
public function return200() {
header("HTTP/1.1 200 OK");
return;
}

/**
* 返回500
* Controller中使用方法:$this->controller->return500()
* @return
*/
public function return500() {
header('HTTP/1.1 500 Internal Server Error');
return;
}

/**
* 类加载-获取全局TOKEN,防止CSRF攻击
* Controller中使用方法:$this->controller->get_token()
Expand Down
2 changes: 1 addition & 1 deletion initphp/core/controller/filter.init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Controller-filter 安全过滤类
* InitPHP 3.3 国产PHP开发框架 Controller-filter 安全过滤类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
Expand Down
2 changes: 1 addition & 1 deletion initphp/core/controller/request.init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Controller-request Http请求类
* InitPHP 3.3 国产PHP开发框架 Controller-request Http请求类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
Expand Down
8 changes: 4 additions & 4 deletions initphp/core/controller/validate.init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Controller-validate 数据基础验证类
* InitPHP 3.3 国产PHP开发框架 Controller-validate 数据基础验证类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
Expand Down Expand Up @@ -74,8 +74,8 @@ public function is_require($value) {
* @return bool
*/
public function is_empty($value) {
if (empty($value) || $value=="") return false;
return true;
if (empty($value) || $value=="") return true;
return false;
}

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ public function is_ip($value) {
* @return bool
*/
public function is_number($value) {
return preg_match('/\d+$/', trim($value));
return preg_match('/^\d{0,}$/', trim($value));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/cache.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-cache 数据缓存工厂类
* InitPHP 3.3 国产PHP开发框架 Dao-cache 数据缓存工厂类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class cacheInit{
//缓存类型 FILE-文件缓存类型 MEM-内存缓存类型 MYSQL-数据库缓存类 APC-APC缓存
Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/apc.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-APC缓存 不适合频繁写入的缓存数据
* InitPHP 3.3 国产PHP开发框架 Dao-APC缓存 不适合频繁写入的缓存数据
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class apcInit {

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/filecache.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-filecahce 文件缓存
* InitPHP 3.3 国产PHP开发框架 Dao-filecahce 文件缓存
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class filecacheInit {

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/memcached.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-memcached 内存缓存
* InitPHP 3.3 国产PHP开发框架 Dao-memcached 内存缓存
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class memcachedInit {

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/mysqlcache.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-mysqlcache 数据库缓存
* InitPHP 3.3 国产PHP开发框架 Dao-mysqlcache 数据库缓存
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
*************************************************************************
* CREATE TABLE `initphp_mysqlcache` (
* `id` int(10) NOT NULL auto_increment,
Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/wincache.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-WINCACHE缓存
* InitPHP 3.3 国产PHP开发框架 Dao-WINCACHE缓存
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class wincacheInit {

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/cache/driver/xcache.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-XCACHE缓存
* InitPHP 3.3 国产PHP开发框架 Dao-XCACHE缓存
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class xcacheInit {

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/dao.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-dao Dao基类
* InitPHP 3.3 国产PHP开发框架 Dao-dao Dao基类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class daoInit{

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/db/db.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-db 常用SQL方法封装
* InitPHP 3.3 国产PHP开发框架 Dao-db 常用SQL方法封装
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
require_once("sqlbuild.init.php");
class dbInit extends sqlbuildInit {
Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/db/dbhandler.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-ddb 多库-主从-分表解决方案
* InitPHP 3.3 国产PHP开发框架 Dao-ddb 多库-主从-分表解决方案
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
require_once("driver/dbbase.init.php");
class dbhandlerInit {
Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/db/driver/dbbase.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-dbbase Driver DB基类
* InitPHP 3.3 国产PHP开发框架 Dao-dbbase Driver DB基类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
abstract class dbbaseInit{

Expand Down
4 changes: 2 additions & 2 deletions initphp/core/dao/db/driver/mysql.init.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
if (!defined('IS_INITPHP')) exit('Access Denied!');
/*********************************************************************************
* InitPHP 3.2.2 国产PHP开发框架 Dao-mysql 基类
* InitPHP 3.3 国产PHP开发框架 Dao-mysql 基类
*-------------------------------------------------------------------------------
* 版权所有: CopyRight By initphp.com
* 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
*-------------------------------------------------------------------------------
* $Author:zhuli
* $Dtime:2012-11-27
* $Dtime:2013-5-29
***********************************************************************************/
class mysqlInit extends dbbaseInit{

Expand Down
Loading

0 comments on commit e278f3b

Please sign in to comment.