Skip to content

Commit 80be14c

Browse files
committed
june-1.0
0 parents  commit 80be14c

File tree

868 files changed

+78530
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

868 files changed

+78530
-0
lines changed

.buildpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<buildpath>
3+
<buildpathentry kind="src" path=""/>
4+
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
5+
</buildpath>

.project

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>shop</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.validation.validationbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.dltk.core.scriptbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.php.core.PHPNature</nature>
21+
</natures>
22+
</projectDescription>

.settings/org.eclipse.php.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
include_path=0;/shop
3+
phpVersion=php5.3
4+
use_asp_tags_as_php=false

README.md

Whitespace-only changes.

check/AddressCheck.class.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
class AddressCheck extends Check{
3+
public function checkAdd(&$model,Array $param){
4+
if(Validate::isNullStr($_POST['name'])){
5+
$this->message[]='收货人长度不得小于2位';
6+
$this->flag=false;
7+
}
8+
if(!Validate::isLength($_POST['code'], 6)){
9+
$this->message[]='邮政编码必须为6位';
10+
$this->flag=false;
11+
}
12+
if(Validate::checkStrLength($_POST['name'], 20, 'max')){
13+
$this->message[]='收货人不得大于20位';
14+
$this->flag=false;
15+
}
16+
if(!Validate::checkEmail($_POST['email'])){
17+
$this->message[]='邮箱格式不正确';
18+
$this->flag=false;
19+
}
20+
if($model->isOne($param)){
21+
$this->message[]='收货人已被占用';
22+
$this->flag=false;
23+
}
24+
return $this->flag;
25+
}
26+
public function checkUpdate(&$model,Array $param){
27+
return $this->checkAdd($model, $param);
28+
}
29+
//用于ajax验证
30+
public function isExist(& $model ,Array $param){
31+
return $model->isOne($param) ? 'false' : 'true';
32+
}
33+
}

check/AttrCheck.class.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
class AttrCheck extends Check{
3+
public function checkAdd(&$model,Array $param){
4+
if(Validate::checkStrLength($_POST['name'], 2, 'min')){
5+
$this->message[]='属性名长度不得小于2位';
6+
$this->flag=false;
7+
}
8+
if(Validate::isNullStr($_POST['name'])){
9+
$this->message[]='属性名不得为空';
10+
$this->flag=false;
11+
}
12+
if(Validate::checkStrLength($_POST['name'], 4, 'max')){
13+
$this->message[]='属性名长度不得大于4位';
14+
$this->flag=false;
15+
}
16+
if($model->isOne($param)){
17+
$this->message[]='属性名已被占用';
18+
$this->flag=false;
19+
}
20+
return $this->flag;
21+
}
22+
public function checkUpdate(&$model,Array $param){
23+
return $this->checkAdd($model, $param);
24+
}
25+
//用于ajax检测数据是否存在
26+
public function isExist(& $model ,Array $param){
27+
return $model->isOne($param) ? 'false' : 'true';
28+
}
29+
}

check/BrandCheck.class.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
class BrandCheck extends Check{
3+
public function checkAdd(&$model,Array $param){
4+
if(Validate::isNullStr($_POST['name'])){
5+
$this->message[]='品牌名称不得为空';
6+
$this->flag=false;
7+
}
8+
if(Validate::isNullStr($_POST['type'])){
9+
$this->message[]='品牌类型不得为空';
10+
$this->flag=false;
11+
}
12+
if(Validate::isNullStr($_POST['url'])){
13+
$this->message[]='品牌网址不得为空';
14+
$this->flag=false;
15+
}
16+
if(Validate::checkStrLength($_POST['name'], 20, 'max')){
17+
$this->message[]='品牌名称不得大于20位';
18+
$this->flag=false;
19+
}
20+
if(Validate::checkStrLength($_POST['info'], 200, 'max')){
21+
$this->message[]='品牌简介不得大于20位';
22+
$this->flag=false;
23+
}
24+
if(Validate::checkStrLength($_POST['url'], 40, 'max')){
25+
$this->message[]='品牌网址不得大于40位';
26+
$this->flag=false;
27+
}
28+
if($model->isOne($param)){
29+
$this->message[]='该品牌已被占用';
30+
$this->flag=false;
31+
}
32+
return $this->flag;
33+
}
34+
public function checkUpdate(&$model){
35+
if(Validate::isNullStr($_POST['url'])){
36+
$this->message[]='品牌网址不得为空';
37+
$this->flag=false;
38+
}
39+
if(Validate::isNullStr($_POST['type'])){
40+
$this->message[]='品牌类型不得为空';
41+
$this->flag=false;
42+
}
43+
if(Validate::checkStrLength($_POST['info'], 200, 'max')){
44+
$this->message[]='品牌简介不得大于20位';
45+
$this->flag=false;
46+
}
47+
if(Validate::checkStrLength($_POST['url'], 40, 'max')){
48+
$this->message[]='品牌网址不得大于20位';
49+
$this->flag=false;
50+
}
51+
return $this->flag;
52+
}
53+
//用于ajax验证
54+
public function isExist(& $model ,Array $param){
55+
return $model->isOne($param) ? 'false' : 'true';
56+
}
57+
}

check/Check.class.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
class Check extends Validate{
3+
//判断验证是否通过
4+
protected $flag=true;
5+
//用于保存错误信息
6+
protected $message=array();
7+
//用于保存samrty对象
8+
private $tpl=null;
9+
public function __construct(){
10+
$this->tpl=new TPL();
11+
}
12+
//显示错误页面
13+
public function showError($url=''){
14+
if(empty($url)){
15+
$this->tpl->assign('message',$this->message);
16+
$this->tpl->assign('prev_url',PREV_URL);
17+
$this->tpl->display(ADMIN_STYLE.'public/error.tpl');
18+
exit();
19+
}else{
20+
Redirect::getInstance()->success('','./');
21+
}
22+
23+
}
24+
//手动设置错误信息
25+
public function setMessage($_message) {
26+
$this->message[] = $_message;
27+
}
28+
//用于修改数据时检测一条数据是否存在
29+
public function checkOne(Model &$model,Array $requestData){
30+
if(!$model->isOne($requestData)){
31+
$this->message='找不到指定数据';
32+
$this->flag=false;
33+
}
34+
return $this->flag;
35+
}
36+
37+
38+
}

check/CollectCheck.class.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
class CollectCheck extends Check{
3+
public function checkAdd(&$model,Array $param){
4+
if($model->isOne($param)){
5+
$this->message[]='您已收藏过此商品';
6+
$this->flag=false;
7+
}
8+
return $this->flag;
9+
}
10+
}
11+
12+
13+
14+
15+
16+
17+
18+
19+

check/CommendCheck.class.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
class CommendCheck extends Check{
3+
public function checkAdd(&$model,Array $param){
4+
if(Validate::isNullStr($_POST['content'])){
5+
$this->message[]='评论内容不得为空';
6+
$this->flag=false;
7+
}
8+
if(Validate::checkStrLength($_POST['content'], 200, 'max')){
9+
$this->message[]='评论内容不得大于200字';
10+
$this->flag=false;
11+
}
12+
if($model->isOne($param)){
13+
$this->message[]='一个订单只能评论一次';
14+
$this->flag=false;
15+
}
16+
return $this->flag;
17+
}
18+
public function checkUpdate(){
19+
if(Validate::checkStrLength($_POST['re_content'], 200, 'max')){
20+
$this->message[]='回复评价不得大于200位';
21+
$this->flag=false;
22+
}
23+
return $this->flag;
24+
}
25+
}

0 commit comments

Comments
 (0)