├── README.md
└── myblog
├── 1.sql
├── app
├── admin
│ ├── controller
│ │ ├── BaseController.php
│ │ └── IndexController.php
│ ├── model
│ │ ├── BaseModel.php
│ │ └── adminModel.php
│ └── view
│ │ └── index
│ │ └── index.html
└── index
│ ├── controller
│ ├── BaseController.php
│ └── IndexController.php
│ ├── model
│ ├── BaseModel.php
│ └── details.php
│ └── view
│ └── index
│ └── index.html
├── boot
├── Psr4Autoloader.php
└── Router.php
├── cache
├── admin
│ ├── admin
│ │ └── info_html.php
│ ├── blog
│ │ └── cate_html.php
│ ├── book
│ │ └── book_html.php
│ ├── details
│ │ └── details_html.php
│ ├── index
│ │ └── index_html.php
│ ├── list
│ │ ├── add_html.php
│ │ └── list_html.php
│ └── user
│ │ └── pass_html.php
├── index
│ ├── book
│ │ └── word_html.php
│ ├── index
│ │ └── index_html.php
│ ├── list
│ │ └── show_html.php
│ └── user
│ │ ├── login_html.php
│ │ └── register_html.php
├── my_admin.php
├── my_book.php
├── my_details.php
├── my_list.php
├── my_plate.php
└── my_user.php
├── config
└── database.php
├── index.php
├── public
├── index
│ ├── css
│ │ ├── admin.css
│ │ ├── index.css
│ │ └── pintuer.css
│ ├── images
│ │ ├── 11.jpg
│ │ ├── 2011713195450617.jpg
│ │ ├── 2011713203720633.jpg
│ │ ├── 2011714152744924.jpg
│ │ ├── 90304_top.jpg
│ │ ├── bg.jpg
│ │ ├── import.gif
│ │ ├── nav.swf
│ │ ├── passcode.jpg
│ │ ├── tmbg-white.png
│ │ └── y.jpg
│ └── js
│ │ ├── jquery.js
│ │ ├── modernizr.js
│ │ ├── pintuer.js
│ │ └── silder.js
└── upload
│ └── 2017
│ └── 06
│ ├── 19
│ ├── 5947196cf0ec2.bmp
│ ├── 59471a9b900d7.bmp
│ ├── 59471ad454530.bmp
│ ├── 5947b3307ea80.bmp
│ ├── 5947b34b18bb9.bmp
│ ├── 5947b41c99259.bmp
│ ├── 5947b578a7875.bmp
│ └── 5947b63eccb82.bmp
│ └── 20
│ └── 5947fe3f3b584.bmp
└── vendor
└── csl
└── framework
└── src
├── Model.php
└── Template.php
/README.md:
--------------------------------------------------------------------------------
1 | # mvc-
2 | 十分钟学成mvc框架
3 |
--------------------------------------------------------------------------------
/myblog/1.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.11, for Win32 (AMD64)
2 | --
3 | -- Host: localhost Database: frameset_blog
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.11
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `my_admin`
20 | --
21 |
22 | DROP TABLE IF EXISTS `my_admin`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `my_admin` (
26 | `hid` int(11) NOT NULL AUTO_INCREMENT,
27 | `titlename` varchar(255) NOT NULL,
28 | `urlname` varchar(255) NOT NULL,
29 | `url` varchar(245) NOT NULL,
30 | `file` varchar(255) NOT NULL,
31 | `isdel` int(2) NOT NULL DEFAULT '0',
32 | PRIMARY KEY (`hid`)
33 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
34 | /*!40101 SET character_set_client = @saved_cs_client */;
35 |
36 | --
37 | -- Dumping data for table `my_admin`
38 | --
39 |
40 | LOCK TABLES `my_admin` WRITE;
41 | /*!40000 ALTER TABLE `my_admin` DISABLE KEYS */;
42 | INSERT INTO `my_admin` VALUES (2,'碧海青天夜夜心','Good Good study','http://www.baidu.com','那一刻,我们的心是如此的近,这就是我们开始的原因.....',0);
43 | /*!40000 ALTER TABLE `my_admin` ENABLE KEYS */;
44 | UNLOCK TABLES;
45 |
46 | --
47 | -- Table structure for table `my_book`
48 | --
49 |
50 | DROP TABLE IF EXISTS `my_book`;
51 | /*!40101 SET @saved_cs_client = @@character_set_client */;
52 | /*!40101 SET character_set_client = utf8 */;
53 | CREATE TABLE `my_book` (
54 | `bid` int(11) NOT NULL AUTO_INCREMENT,
55 | `authorid` int(11) NOT NULL COMMENT '用户id',
56 | `book_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发表时间',
57 | `book_content` text NOT NULL COMMENT '留言内容',
58 | `is_top` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否置顶',
59 | `isdel` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否放入回收',
60 | PRIMARY KEY (`bid`)
61 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='留言板表';
62 | /*!40101 SET character_set_client = @saved_cs_client */;
63 |
64 | --
65 | -- Dumping data for table `my_book`
66 | --
67 |
68 | LOCK TABLES `my_book` WRITE;
69 | /*!40000 ALTER TABLE `my_book` DISABLE KEYS */;
70 | INSERT INTO `my_book` VALUES (2,4,'2017-06-17 19:36:01','哇哦!跑都跑的那么帅,我真幸福.....',0,0),(3,5,'2017-06-18 21:08:08','生活不止眼前的苟且,还有诗和远方.....',0,0),(4,4,'2017-06-18 21:08:08','人生就像魔法书,兜兜转转又是一年.....',0,0);
71 | /*!40000 ALTER TABLE `my_book` ENABLE KEYS */;
72 | UNLOCK TABLES;
73 |
74 | --
75 | -- Table structure for table `my_details`
76 | --
77 |
78 | DROP TABLE IF EXISTS `my_details`;
79 | /*!40101 SET @saved_cs_client = @@character_set_client */;
80 | /*!40101 SET character_set_client = utf8 */;
81 | CREATE TABLE `my_details` (
82 | `did` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
83 | `title` varchar(500) DEFAULT NULL COMMENT '标题',
84 | `content` text NOT NULL COMMENT '内容',
85 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '回帖或发帖时间',
86 | `first` tinyint(2) NOT NULL DEFAULT '0' COMMENT '1是帖子 0是评论',
87 | `state` tinyint(4) DEFAULT '0' COMMENT '是否显示',
88 | `istop` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否置顶',
89 | `comment_num` int(11) NOT NULL DEFAULT '0' COMMENT '评论数',
90 | `read_num` int(11) DEFAULT '0' COMMENT '阅读数',
91 | `nocomment` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否禁止评论0是否',
92 | `classid` int(11) NOT NULL COMMENT '板块的id',
93 | `authorid` int(11) DEFAULT NULL COMMENT '发布人id',
94 | `picture` varchar(200) DEFAULT NULL COMMENT '头像',
95 | `describer` text COMMENT '帖子描述',
96 | PRIMARY KEY (`did`)
97 | ) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COMMENT='帖子表';
98 | /*!40101 SET character_set_client = @saved_cs_client */;
99 |
100 | --
101 | -- Dumping data for table `my_details`
102 | --
103 |
104 | LOCK TABLES `my_details` WRITE;
105 | /*!40000 ALTER TABLE `my_details` DISABLE KEYS */;
106 | INSERT INTO `my_details` VALUES (3,'女孩都有浪漫的小情怀',' 女孩子都有着浪漫的小情怀,对于求婚更是抱着满满的浪漫期待,也希望在求婚那一天对方可以给自己一个最浪漫的求婚词。\r\n\r\n you are the apple of my eyes.\r\n\r\n 你是我这辈子最珍贵的人。请让我永远守护在你身边,我一定将你当成掌心的珍宝,一辈子悉心呵护。你,愿意嫁给我吗?','2017-06-17 14:23:04',1,0,1,0,0,0,1,0,NULL,NULL),(4,'也许下个路口就会遇见希望',' 不要忽视了自己,因为有你,有些人的世界会灿烂起来!\r\n 爱和恨,从来就没有单独存在过,一直是一起存在的,只不过是某个阶段中,爱比恨多了一点儿,所以看见了爱,模糊了恨;或者恨比爱多了一点儿,所以看见了恨,模糊了爱,而我们,就都在这些被模糊了情感中,最终模糊了自己。\r\n 如果世上不存在对等的爱,那就让我爱多一些吧。\r\n 想你的时候,把你的名字写在手心,摊开是想念,握紧是幸福。幸福就是简简单单的依靠,就是手牵手的温柔。','2017-06-17 14:25:10',0,0,0,0,0,0,1,0,NULL,NULL),(5,'6月毕业季,祝福送给你',' 时光荏苒,依稀记得开学那天兴奋不已的心情,可如今我们就要毕业了,各奔东西。\r\n 一天天的相聚如在眼前,一夜夜的奋斗有你陪伴,一次次的欢笑你我共享,一回回的困难你帮我解决。一千多个日夜,你我的情谊深厚弥坚。离别的汽笛已经鸣响,分别就在这迷人的六月。愿你别后宏图大展,梦想实现,我们将重逢在美好的明天!\r\n 知识的浪潮依然在我们脑海涌动,昂扬的斗志依然在我们的世界驻扎,相知的情意依然在我们的心田飘荡,离别的号角却已在我们的耳边奏响...','2017-06-17 14:27:18',0,0,0,0,0,0,2,0,NULL,NULL),(18,'啊是的大发光火','撒地方规划回家看','2017-06-19 19:28:56',0,0,0,0,0,0,1,NULL,'./public/upload/2017/06/19/5947b578a7875.bmp','撒地方规划回家,k'),(19,'啊是的大发光火','撒地方规划回家看','2017-06-19 19:29:31',0,0,0,0,0,0,1,NULL,'./public/upload/2017/06/19/5947b578a7875.bmp','撒地方规划回家,k'),(21,NULL,'这个是测试评论的','2017-06-19 22:17:46',1,4,0,0,0,0,1,9,NULL,NULL),(24,NULL,'这个评论真的好丑 讨厌前台的东西 我宁愿去找bug 好气....','2017-06-19 23:49:41',1,5,0,0,0,0,2,9,NULL,NULL),(25,NULL,'到底评论有没有完了 都十二点了','2017-06-19 23:53:22',1,5,0,0,0,0,2,9,NULL,NULL),(26,NULL,'啊啊啊啊啊啊吖吖.....\r\n\r\n 又错了','2017-06-20 00:00:15',1,5,0,0,0,0,2,9,NULL,NULL),(27,NULL,'活该....\r\n谁让你总粗心,一个破id你都搞不定','2017-06-20 00:01:15',1,5,0,0,0,0,2,9,NULL,NULL),(28,NULL,'生活不止眼前的苟且,还有诗和远方','2017-06-20 00:02:20',1,4,0,0,0,0,1,9,NULL,NULL),(29,NULL,'哇....\r\n跑都跑的那么帅,我真幸福','2017-06-20 00:02:50',1,4,0,0,0,0,1,9,NULL,NULL),(30,NULL,'人生就像魔法书,兜兜转转又是一年','2017-06-20 00:03:20',1,4,0,0,0,0,1,9,NULL,NULL),(31,NULL,'嘿...\r\n道行太浅,老实回家做宅男','2017-06-20 00:04:24',1,4,0,0,0,0,1,9,NULL,NULL),(32,NULL,'人之所以能,是因为相信能','2017-06-20 00:04:49',1,4,0,0,0,0,1,9,NULL,NULL),(33,'生活大多是枯燥','关于生活的命题,每个人都活有不同的答案,或浅显或高深,或伪高深 或真高深,所以表现出来的也千奇百怪,有时真的很庆幸自己有一个揣摩别人内心的一个嗜好,生活很枯燥,也乏味,就在这个枯燥乏味的世界里,给自己找点事做,也算是一种消遣吧,通过这个项目让我了解了太多的不足 心里急得不行, 不知道面临我的究竟会是什么 ,我依旧迷茫着,不知道走到那才是我内心的方向,我只有这么走着,在我还没倒下之前.....\r\n回想下以前的日子 突然觉得时间有时候很慢,慢的让人烦躁,不安,无力,有时候又很快,快的让你仿佛很久以前的事情就像在眼前,感觉自己有时太理智,相处的4个女朋友最后都让理智把两个人之间的绳子割断了,有时候又觉得自己太感性,感性的只有一瞬间就想和对方在一起.. 矛盾体。。就是矛盾体\r\n 也许是年纪大一些?亦或者是单身久了?感觉一个人没什么不好,就像刘同说的一样:也许你现在正在一个人吃饭,一个人睡觉,一个人看电影,然而你却可以一个人吃饭,一个人睡觉,一个人看电影,有些人离开另一个人就失去了自己,如果是这样,那这样的孤独是不是也是一种虽败犹荣???算么??真的算么???无数次的问自己,你到底想要什么??????最后的答案依旧是我在乎的人快乐幸福,给身边的人带来一些快乐不想看到一点负面情绪,,也许这就是物极必反把 ,,偏偏自己的内心却是一个赤裸裸的反面教材 ,,真的是越不想让别人失望,就越不想别人让你失望 好乱 ,没有意思逻辑 水煎 明天还要上线 也许有时一堆的404 and 500','2017-06-20 00:39:27',0,0,0,0,0,0,3,NULL,'./public/upload/2017/06/20/5947fe3f3b584.bmp','不知道应该怎么说,像薯片,好看,好闻,但不是每个人都爱吃'),(34,NULL,'法国红酒 ','2017-06-20 00:45:50',1,4,0,0,0,0,1,9,NULL,NULL),(35,NULL,'哈哈...\r\n\r\n又发现一个bug 还好没睡!!给自己个赞','2017-06-20 00:51:49',1,33,0,0,0,0,3,9,NULL,NULL);
107 | /*!40000 ALTER TABLE `my_details` ENABLE KEYS */;
108 | UNLOCK TABLES;
109 |
110 | --
111 | -- Table structure for table `my_plate`
112 | --
113 |
114 | DROP TABLE IF EXISTS `my_plate`;
115 | /*!40101 SET @saved_cs_client = @@character_set_client */;
116 | /*!40101 SET character_set_client = utf8 */;
117 | CREATE TABLE `my_plate` (
118 | `cid` int(11) NOT NULL AUTO_INCREMENT,
119 | `classname` varchar(200) NOT NULL,
120 | `description` varchar(500) NOT NULL,
121 | `lastpost` varchar(500) DEFAULT NULL,
122 | PRIMARY KEY (`cid`)
123 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
124 | /*!40101 SET character_set_client = @saved_cs_client */;
125 |
126 | --
127 | -- Dumping data for table `my_plate`
128 | --
129 |
130 | LOCK TABLES `my_plate` WRITE;
131 | /*!40000 ALTER TABLE `my_plate` DISABLE KEYS */;
132 | INSERT INTO `my_plate` VALUES (1,'碎言碎语','人生就是一个for循环,一直循环着死亡与重生的过程','null'),(2,'诗词歌赋','一句词、一本书、一个世界、一个人.....',NULL),(3,'慢生活','我们总在忙着认识各种人,以为是在丰富生命,其实,最有价值的遇见,是在某一个时刻重遇了自己.....',NULL);
133 | /*!40000 ALTER TABLE `my_plate` ENABLE KEYS */;
134 | UNLOCK TABLES;
135 |
136 | --
137 | -- Table structure for table `my_user`
138 | --
139 |
140 | DROP TABLE IF EXISTS `my_user`;
141 | /*!40101 SET @saved_cs_client = @@character_set_client */;
142 | /*!40101 SET character_set_client = utf8 */;
143 | CREATE TABLE `my_user` (
144 | `uid` int(11) NOT NULL AUTO_INCREMENT,
145 | `username` varchar(32) NOT NULL,
146 | `password` char(32) NOT NULL,
147 | `email` varchar(32) DEFAULT NULL,
148 | `usertype` tinyint(2) NOT NULL DEFAULT '0',
149 | `regtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
150 | `picture` varchar(50) DEFAULT NULL,
151 | `sex` tinyint(2) NOT NULL DEFAULT '0',
152 | `qq` varchar(40) DEFAULT NULL,
153 | `allowlogin` tinyint(2) NOT NULL DEFAULT '0',
154 | PRIMARY KEY (`uid`)
155 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
156 | /*!40101 SET character_set_client = @saved_cs_client */;
157 |
158 | --
159 | -- Dumping data for table `my_user`
160 | --
161 |
162 | LOCK TABLES `my_user` WRITE;
163 | /*!40000 ALTER TABLE `my_user` DISABLE KEYS */;
164 | INSERT INTO `my_user` VALUES (3,'laoleng','1985d434c0bc98a1a71b6e24190c7220','553703655@qq.com',0,'2017-06-18 11:40:29',NULL,0,NULL,0),(4,'caoxu','1985d434c0bc98a1a71b6e24190c7220','553703655@qq.com',0,'2017-06-18 12:06:51',NULL,0,NULL,0),(5,'xiaoleng','1985d434c0bc98a1a71b6e24190c7220','553703655@qq.com',0,'2017-06-18 12:32:28',NULL,0,NULL,0),(9,'admin','1985d434c0bc98a1a71b6e24190c7220','553703655@qq.com',1,'2017-06-18 12:50:20',NULL,0,NULL,0),(10,'jingjing','1985d434c0bc98a1a71b6e24190c7220','553703655@qq.com',0,'2017-06-18 20:58:30',NULL,0,NULL,0);
165 | /*!40000 ALTER TABLE `my_user` ENABLE KEYS */;
166 | UNLOCK TABLES;
167 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
168 |
169 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
170 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
171 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
172 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
173 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
174 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
175 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
176 |
177 | -- Dump completed on 2017-06-20 10:30:09
178 |
--------------------------------------------------------------------------------
/myblog/app/admin/controller/BaseController.php:
--------------------------------------------------------------------------------
1 | _init();
11 | }
12 | //创建初始化 他就是为了被继承的
13 | public function _init()
14 | {
15 |
16 | }
17 | //设置的是当display方法不传参时默认选项
18 | public function display($viewFile=null,$isExtract=true)
19 | {
20 | if (empty($viewFile)){
21 | $viewFile = $_GET['c'] . '/' . $_GET['a'] . '.html';
22 | }
23 | parent::display($viewFile,$isExtract);
24 | }
25 | }
--------------------------------------------------------------------------------
/myblog/app/admin/controller/IndexController.php:
--------------------------------------------------------------------------------
1 | a = new adminModel();
11 | }
12 | public function index()
13 | {
14 | //调用adminModel下的方法并且分配变量 注意4行时引入了adminModel
15 | $data = $this->a->demo();
16 | $this->assign('data',$data);//把获取的值分配出去
17 | $this->display();//引入页面
18 | }
19 | }
--------------------------------------------------------------------------------
/myblog/app/admin/model/BaseModel.php:
--------------------------------------------------------------------------------
1 | _init();
13 | }
14 | //子类的初始化方法
15 | public function _init()
16 | {
17 |
18 | }
19 | //重写display方法 不写参数默认是类名下的方法名文件
20 | public function display($viewFile=null,$isExtract=true)
21 | {
22 | if (empty($viewFile)){
23 | $viewFile = $_GET['c'] . '/' . $_GET['a'] . '.html';
24 | }
25 | parent::display($viewFile,$isExtract);
26 | }
27 |
28 |
29 | }
--------------------------------------------------------------------------------
/myblog/app/index/controller/IndexController.php:
--------------------------------------------------------------------------------
1 | blog = new details();
13 |
14 | }
15 | public function index()
16 | {
17 | $data = $this->blog->detailsList();
18 | $this->assign('data',$data);
19 | $this->display();
20 | }
21 | }
--------------------------------------------------------------------------------
/myblog/app/index/model/BaseModel.php:
--------------------------------------------------------------------------------
1 | maps=$config;
13 |
14 | }
15 | //向系统注册自己自动加载方法
16 | spl_autoload_register([$this,'loadClass']);
17 |
18 | }
19 |
20 | /**
21 | * 自动加载方法
22 | * @param [type] $className [类名(带命名空间)]
23 | * @return [type] [无]
24 | */
25 | protected function loadClass($className)
26 | {
27 |
28 | //把得到的命名空间名拆分成数组
29 | $arr = explode('\\', $className);
30 | //弹出最后元素 得到类名
31 | $realClass = array_pop($arr);
32 | //得到空间名
33 | $namespace = join('\\',$arr);
34 | $this->loadMap($namespace,$realClass);
35 | }
36 |
37 | /**
38 | * 把命名空间变成目录,加载类文件
39 | * @param [type] $namespace [命名空间]
40 | * @param [type] $realClass [类名]
41 | * @return [type] [无]
42 | */
43 | protected function loadMap($namespace,$realClass)
44 | {
45 | //如果命名空间存在在映射表中,直接取得目录
46 | if (array_key_exists($namespace, $this->maps)) {
47 | $path = $this->maps[$namespace];
48 |
49 | }else{
50 | //如果不存在,直接把命名空当做目录名
51 | $path = str_replace('\\', '/', $namespace);
52 |
53 | }
54 |
55 | //在目录后添加斜线
56 | $namespace = trim($path, '') . '/';
57 | $path = $namespace . $realClass . '.php';
58 | if (file_exists($path)) {
59 |
60 | include $path;
61 | }else{
62 | exit($path . '文件不存在');
63 | }
64 |
65 | }
66 |
67 | }
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/myblog/boot/Router.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 网站信息
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
77 |
78 |
--------------------------------------------------------------------------------
/myblog/cache/admin/blog/cate_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
内容列表
17 |
18 |
19 |
20 |
21 |
22 | ID |
23 | 板块名称 |
24 | 板块内容 |
25 | 操作 |
26 |
27 |
28 |
29 | =$value['cid'];?> |
30 | =$value['classname'];?> |
31 | =$value['description'];?> |
32 | |
33 |
34 |
35 |
36 |
37 |
44 |
45 |
添加内容
46 |
47 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/myblog/cache/admin/book/book_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
58 |
95 |
--------------------------------------------------------------------------------
/myblog/cache/admin/details/details_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
58 |
95 |
--------------------------------------------------------------------------------
/myblog/cache/admin/index/index_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 后台管理中心
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
后台管理中心
17 |
18 |
19 |
20 |
21 |
菜单列表
22 |
基本设置
23 |
31 |
栏目管理
32 |
37 |
38 |
51 |
52 | - 首页
53 | - 网站信息
54 | - 当前语言:中文
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/myblog/cache/admin/list/add_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
增加内容
17 |
18 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/myblog/cache/admin/list/list_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
57 |
230 |
231 |
--------------------------------------------------------------------------------
/myblog/cache/admin/user/pass_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
修改会员密码
17 |
18 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/myblog/cache/index/book/word_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 心若向阳 无畏悲伤
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 | =$valu['description'];?>
18 |
19 |
20 |
21 |
22 |
23 |
25 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
=$book_ban['book_time'];?>
49 |
50 |
51 | =$book_ban['book_content'];?>
52 |
53 |
....
54 |
55 |
56 |
57 |
58 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/myblog/cache/index/index/index_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
心若向阳 无畏悲伤
6 |
7 |
8 |
9 |
12 |
13 |
14 |
35 |
36 |
37 |
39 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
=$value['create_time'];?>
64 |
65 |
66 |
67 |
68 | =$value['content'];?>
69 |
70 |
.
71 |
阅读>>
72 |
73 |
74 |
75 |
76 |
77 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/myblog/cache/index/list/show_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
心若向阳 无畏悲伤
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 | =$valu['description'];?>
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
44 |
45 |
46 |
47 |
48 |
49 |
120 |
121 |
122 |
123 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/myblog/cache/index/user/login_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
登录
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/myblog/cache/index/user/register_html.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
登录
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/myblog/cache/my_admin.php:
--------------------------------------------------------------------------------
1 | 'hid',
4 | 0 => 'hid',
5 | 1 => 'titlename',
6 | 2 => 'urlname',
7 | 3 => 'url',
8 | 4 => 'file',
9 | 5 => 'isdel',
10 | );?>
--------------------------------------------------------------------------------
/myblog/cache/my_book.php:
--------------------------------------------------------------------------------
1 | 'bid',
4 | 0 => 'bid',
5 | 1 => 'uid',
6 | 2 => 'book_time',
7 | 3 => 'book_content',
8 | 4 => 'is_top',
9 | 5 => 'isdel',
10 | );?>
--------------------------------------------------------------------------------
/myblog/cache/my_details.php:
--------------------------------------------------------------------------------
1 | 'did',
4 | 0 => 'did',
5 | 1 => 'title',
6 | 2 => 'content',
7 | 3 => 'create_time',
8 | 4 => 'first',
9 | 5 => 'state',
10 | 6 => 'istop',
11 | 7 => 'comment_num',
12 | 8 => 'read_num',
13 | 9 => 'nocomment',
14 | 10 => 'classid',
15 | 11 => 'authorid',
16 | 12 => 'picture',
17 | 13 => 'describer',
18 | );?>
--------------------------------------------------------------------------------
/myblog/cache/my_list.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/myblog/cache/my_plate.php:
--------------------------------------------------------------------------------
1 | 'cid',
4 | 0 => 'cid',
5 | 1 => 'classname',
6 | 2 => 'description',
7 | 3 => 'lastpost',
8 | );?>
--------------------------------------------------------------------------------
/myblog/cache/my_user.php:
--------------------------------------------------------------------------------
1 | 'uid',
4 | 0 => 'uid',
5 | 1 => 'username',
6 | 2 => 'password',
7 | 3 => 'email',
8 | 4 => 'usertype',
9 | 5 => 'regtime',
10 | 6 => 'picture',
11 | 7 => 'sex',
12 | 8 => 'qq',
13 | 9 => 'allowlogin',
14 | );?>
--------------------------------------------------------------------------------
/myblog/config/database.php:
--------------------------------------------------------------------------------
1 | 'localhost',
5 | 'DB_USER' => 'root',
6 | 'DB_PASSWORD' => '123456',
7 | 'DB_NAME' => 'frameset_blog',
8 | 'DB_PREFIX' => 'my_',
9 | 'DB_CHARSET' => 'utf8',
10 | 'DB_CACHE' => './cache',
11 | ];
--------------------------------------------------------------------------------
/myblog/index.php:
--------------------------------------------------------------------------------
1 | ', rule, ''].join('');
67 | div.id = mod;
68 | (body ? div : fakeBody).innerHTML += style;
69 | fakeBody.appendChild(div);
70 | if ( !body ) {
71 | fakeBody.style.background = '';
72 | fakeBody.style.overflow = 'hidden';
73 | docOverflow = docElement.style.overflow;
74 | docElement.style.overflow = 'hidden';
75 | docElement.appendChild(fakeBody);
76 | }
77 |
78 | ret = callback(div, rule);
79 | if ( !body ) {
80 | fakeBody.parentNode.removeChild(fakeBody);
81 | docElement.style.overflow = docOverflow;
82 | } else {
83 | div.parentNode.removeChild(div);
84 | }
85 |
86 | return !!ret;
87 |
88 | },
89 |
90 |
91 |
92 | isEventSupported = (function() {
93 |
94 | var TAGNAMES = {
95 | 'select': 'input', 'change': 'input',
96 | 'submit': 'form', 'reset': 'form',
97 | 'error': 'img', 'load': 'img', 'abort': 'img'
98 | };
99 |
100 | function isEventSupported( eventName, element ) {
101 |
102 | element = element || document.createElement(TAGNAMES[eventName] || 'div');
103 | eventName = 'on' + eventName;
104 |
105 | var isSupported = eventName in element;
106 |
107 | if ( !isSupported ) {
108 | if ( !element.setAttribute ) {
109 | element = document.createElement('div');
110 | }
111 | if ( element.setAttribute && element.removeAttribute ) {
112 | element.setAttribute(eventName, '');
113 | isSupported = is(element[eventName], 'function');
114 |
115 | if ( !is(element[eventName], 'undefined') ) {
116 | element[eventName] = undefined;
117 | }
118 | element.removeAttribute(eventName);
119 | }
120 | }
121 |
122 | element = null;
123 | return isSupported;
124 | }
125 | return isEventSupported;
126 | })(),
127 |
128 |
129 | _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
130 |
131 | if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
132 | hasOwnProp = function (object, property) {
133 | return _hasOwnProperty.call(object, property);
134 | };
135 | }
136 | else {
137 | hasOwnProp = function (object, property) {
138 | return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
139 | };
140 | }
141 |
142 |
143 | if (!Function.prototype.bind) {
144 | Function.prototype.bind = function bind(that) {
145 |
146 | var target = this;
147 |
148 | if (typeof target != "function") {
149 | throw new TypeError();
150 | }
151 |
152 | var args = slice.call(arguments, 1),
153 | bound = function () {
154 |
155 | if (this instanceof bound) {
156 |
157 | var F = function(){};
158 | F.prototype = target.prototype;
159 | var self = new F();
160 |
161 | var result = target.apply(
162 | self,
163 | args.concat(slice.call(arguments))
164 | );
165 | if (Object(result) === result) {
166 | return result;
167 | }
168 | return self;
169 |
170 | } else {
171 |
172 | return target.apply(
173 | that,
174 | args.concat(slice.call(arguments))
175 | );
176 |
177 | }
178 |
179 | };
180 |
181 | return bound;
182 | };
183 | }
184 |
185 | function setCss( str ) {
186 | mStyle.cssText = str;
187 | }
188 |
189 | function setCssAll( str1, str2 ) {
190 | return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
191 | }
192 |
193 | function is( obj, type ) {
194 | return typeof obj === type;
195 | }
196 |
197 | function contains( str, substr ) {
198 | return !!~('' + str).indexOf(substr);
199 | }
200 |
201 | function testProps( props, prefixed ) {
202 | for ( var i in props ) {
203 | var prop = props[i];
204 | if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
205 | return prefixed == 'pfx' ? prop : true;
206 | }
207 | }
208 | return false;
209 | }
210 |
211 | function testDOMProps( props, obj, elem ) {
212 | for ( var i in props ) {
213 | var item = obj[props[i]];
214 | if ( item !== undefined) {
215 |
216 | if (elem === false) return props[i];
217 |
218 | if (is(item, 'function')){
219 | return item.bind(elem || obj);
220 | }
221 |
222 | return item;
223 | }
224 | }
225 | return false;
226 | }
227 |
228 | function testPropsAll( prop, prefixed, elem ) {
229 |
230 | var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
231 | props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
232 |
233 | if(is(prefixed, "string") || is(prefixed, "undefined")) {
234 | return testProps(props, prefixed);
235 |
236 | } else {
237 | props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
238 | return testDOMProps(props, prefixed, elem);
239 | }
240 | } tests['flexbox'] = function() {
241 | return testPropsAll('flexWrap');
242 | }; tests['canvas'] = function() {
243 | var elem = document.createElement('canvas');
244 | return !!(elem.getContext && elem.getContext('2d'));
245 | };
246 |
247 | tests['canvastext'] = function() {
248 | return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
249 | };
250 |
251 |
252 |
253 | tests['webgl'] = function() {
254 | return !!window.WebGLRenderingContext;
255 | };
256 |
257 |
258 | tests['touch'] = function() {
259 | var bool;
260 |
261 | if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
262 | bool = true;
263 | } else {
264 | injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
265 | bool = node.offsetTop === 9;
266 | });
267 | }
268 |
269 | return bool;
270 | };
271 |
272 |
273 |
274 | tests['geolocation'] = function() {
275 | return 'geolocation' in navigator;
276 | };
277 |
278 |
279 | tests['postmessage'] = function() {
280 | return !!window.postMessage;
281 | };
282 |
283 |
284 | tests['websqldatabase'] = function() {
285 | return !!window.openDatabase;
286 | };
287 |
288 | tests['indexedDB'] = function() {
289 | return !!testPropsAll("indexedDB", window);
290 | };
291 |
292 | tests['hashchange'] = function() {
293 | return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
294 | };
295 |
296 | tests['history'] = function() {
297 | return !!(window.history && history.pushState);
298 | };
299 |
300 | tests['draganddrop'] = function() {
301 | var div = document.createElement('div');
302 | return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
303 | };
304 |
305 | tests['websockets'] = function() {
306 | return 'WebSocket' in window || 'MozWebSocket' in window;
307 | };
308 |
309 |
310 | tests['rgba'] = function() {
311 | setCss('background-color:rgba(150,255,150,.5)');
312 |
313 | return contains(mStyle.backgroundColor, 'rgba');
314 | };
315 |
316 | tests['hsla'] = function() {
317 | setCss('background-color:hsla(120,40%,100%,.5)');
318 |
319 | return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
320 | };
321 |
322 | tests['multiplebgs'] = function() {
323 | setCss('background:url(https://),url(https://),red url(https://)');
324 |
325 | return (/(url\s*\(.*?){3}/).test(mStyle.background);
326 | }; tests['backgroundsize'] = function() {
327 | return testPropsAll('backgroundSize');
328 | };
329 |
330 | tests['borderimage'] = function() {
331 | return testPropsAll('borderImage');
332 | };
333 |
334 |
335 |
336 | tests['borderradius'] = function() {
337 | return testPropsAll('borderRadius');
338 | };
339 |
340 | tests['boxshadow'] = function() {
341 | return testPropsAll('boxShadow');
342 | };
343 |
344 | tests['textshadow'] = function() {
345 | return document.createElement('div').style.textShadow === '';
346 | };
347 |
348 |
349 | tests['opacity'] = function() {
350 | setCssAll('opacity:.55');
351 |
352 | return (/^0.55$/).test(mStyle.opacity);
353 | };
354 |
355 |
356 | tests['cssanimations'] = function() {
357 | return testPropsAll('animationName');
358 | };
359 |
360 |
361 | tests['csscolumns'] = function() {
362 | return testPropsAll('columnCount');
363 | };
364 |
365 |
366 | tests['cssgradients'] = function() {
367 | var str1 = 'background-image:',
368 | str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
369 | str3 = 'linear-gradient(left top,#9f9, white);';
370 |
371 | setCss(
372 | (str1 + '-webkit- '.split(' ').join(str2 + str1) +
373 | prefixes.join(str3 + str1)).slice(0, -str1.length)
374 | );
375 |
376 | return contains(mStyle.backgroundImage, 'gradient');
377 | };
378 |
379 |
380 | tests['cssreflections'] = function() {
381 | return testPropsAll('boxReflect');
382 | };
383 |
384 |
385 | tests['csstransforms'] = function() {
386 | return !!testPropsAll('transform');
387 | };
388 |
389 |
390 | tests['csstransforms3d'] = function() {
391 |
392 | var ret = !!testPropsAll('perspective');
393 |
394 | if ( ret && 'webkitPerspective' in docElement.style ) {
395 |
396 | injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
397 | ret = node.offsetLeft === 9 && node.offsetHeight === 3;
398 | });
399 | }
400 | return ret;
401 | };
402 |
403 |
404 | tests['csstransitions'] = function() {
405 | return testPropsAll('transition');
406 | };
407 |
408 |
409 |
410 | tests['fontface'] = function() {
411 | var bool;
412 |
413 | injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
414 | var style = document.getElementById('smodernizr'),
415 | sheet = style.sheet || style.styleSheet,
416 | cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
417 |
418 | bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
419 | });
420 |
421 | return bool;
422 | };
423 |
424 | tests['generatedcontent'] = function() {
425 | var bool;
426 |
427 | injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
428 | bool = node.offsetHeight >= 3;
429 | });
430 |
431 | return bool;
432 | };
433 | tests['video'] = function() {
434 | var elem = document.createElement('video'),
435 | bool = false;
436 |
437 | try {
438 | if ( bool = !!elem.canPlayType ) {
439 | bool = new Boolean(bool);
440 | bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
441 |
442 | bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
443 |
444 | bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
445 | }
446 |
447 | } catch(e) { }
448 |
449 | return bool;
450 | };
451 |
452 | tests['audio'] = function() {
453 | var elem = document.createElement('audio'),
454 | bool = false;
455 |
456 | try {
457 | if ( bool = !!elem.canPlayType ) {
458 | bool = new Boolean(bool);
459 | bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
460 | bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
461 |
462 | bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
463 | bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
464 | elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
465 | }
466 | } catch(e) { }
467 |
468 | return bool;
469 | };
470 |
471 |
472 | tests['localstorage'] = function() {
473 | try {
474 | localStorage.setItem(mod, mod);
475 | localStorage.removeItem(mod);
476 | return true;
477 | } catch(e) {
478 | return false;
479 | }
480 | };
481 |
482 | tests['sessionstorage'] = function() {
483 | try {
484 | sessionStorage.setItem(mod, mod);
485 | sessionStorage.removeItem(mod);
486 | return true;
487 | } catch(e) {
488 | return false;
489 | }
490 | };
491 |
492 |
493 | tests['webworkers'] = function() {
494 | return !!window.Worker;
495 | };
496 |
497 |
498 | tests['applicationcache'] = function() {
499 | return !!window.applicationCache;
500 | };
501 |
502 |
503 | tests['svg'] = function() {
504 | return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
505 | };
506 |
507 | tests['inlinesvg'] = function() {
508 | var div = document.createElement('div');
509 | div.innerHTML = '
';
510 | return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
511 | };
512 |
513 | tests['smil'] = function() {
514 | return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
515 | };
516 |
517 |
518 | tests['svgclippaths'] = function() {
519 | return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
520 | };
521 |
522 | function webforms() {
523 | Modernizr['input'] = (function( props ) {
524 | for ( var i = 0, len = props.length; i < len; i++ ) {
525 | attrs[ props[i] ] = !!(props[i] in inputElem);
526 | }
527 | if (attrs.list){
528 | attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
529 | }
530 | return attrs;
531 | })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
532 | Modernizr['inputtypes'] = (function(props) {
533 |
534 | for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
535 |
536 | inputElem.setAttribute('type', inputElemType = props[i]);
537 | bool = inputElem.type !== 'text';
538 |
539 | if ( bool ) {
540 |
541 | inputElem.value = smile;
542 | inputElem.style.cssText = 'position:absolute;visibility:hidden;';
543 |
544 | if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
545 |
546 | docElement.appendChild(inputElem);
547 | defaultView = document.defaultView;
548 |
549 | bool = defaultView.getComputedStyle &&
550 | defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
551 | (inputElem.offsetHeight !== 0);
552 |
553 | docElement.removeChild(inputElem);
554 |
555 | } else if ( /^(search|tel)$/.test(inputElemType) ){
556 | } else if ( /^(url|email)$/.test(inputElemType) ) {
557 | bool = inputElem.checkValidity && inputElem.checkValidity() === false;
558 |
559 | } else {
560 | bool = inputElem.value != smile;
561 | }
562 | }
563 |
564 | inputs[ props[i] ] = !!bool;
565 | }
566 | return inputs;
567 | })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
568 | }
569 | for ( var feature in tests ) {
570 | if ( hasOwnProp(tests, feature) ) {
571 | featureName = feature.toLowerCase();
572 | Modernizr[featureName] = tests[feature]();
573 |
574 | classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
575 | }
576 | }
577 |
578 | Modernizr.input || webforms();
579 |
580 |
581 | Modernizr.addTest = function ( feature, test ) {
582 | if ( typeof feature == 'object' ) {
583 | for ( var key in feature ) {
584 | if ( hasOwnProp( feature, key ) ) {
585 | Modernizr.addTest( key, feature[ key ] );
586 | }
587 | }
588 | } else {
589 |
590 | feature = feature.toLowerCase();
591 |
592 | if ( Modernizr[feature] !== undefined ) {
593 | return Modernizr;
594 | }
595 |
596 | test = typeof test == 'function' ? test() : test;
597 |
598 | if (typeof enableClasses !== "undefined" && enableClasses) {
599 | docElement.className += ' ' + (test ? '' : 'no-') + feature;
600 | }
601 | Modernizr[feature] = test;
602 |
603 | }
604 |
605 | return Modernizr;
606 | };
607 |
608 |
609 | setCss('');
610 | modElem = inputElem = null;
611 |
612 | ;(function(window, document) {
613 | var options = window.html5 || {};
614 |
615 | var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
616 |
617 | var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
618 |
619 | var supportsHtml5Styles;
620 |
621 | var expando = '_html5shiv';
622 |
623 | var expanID = 0;
624 |
625 | var expandoData = {};
626 |
627 | var supportsUnknownElements;
628 |
629 | (function() {
630 | try {
631 | var a = document.createElement('a');
632 | a.innerHTML = '
';
633 | supportsHtml5Styles = ('hidden' in a);
634 |
635 | supportsUnknownElements = a.childNodes.length == 1 || (function() {
636 | (document.createElement)('a');
637 | var frag = document.createDocumentFragment();
638 | return (
639 | typeof frag.cloneNode == 'undefined' ||
640 | typeof frag.createDocumentFragment == 'undefined' ||
641 | typeof frag.createElement == 'undefined'
642 | );
643 | }());
644 | } catch(e) {
645 | supportsHtml5Styles = true;
646 | supportsUnknownElements = true;
647 | }
648 |
649 | }()); function addStyleSheet(ownerDocument, cssText) {
650 | var p = ownerDocument.createElement('p'),
651 | parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
652 |
653 | p.innerHTML = 'x';
654 | return parent.insertBefore(p.lastChild, parent.firstChild);
655 | }
656 |
657 | function getElements() {
658 | var elements = html5.elements;
659 | return typeof elements == 'string' ? elements.split(' ') : elements;
660 | }
661 |
662 | function getExpandoData(ownerDocument) {
663 | var data = expandoData[ownerDocument[expando]];
664 | if (!data) {
665 | data = {};
666 | expanID++;
667 | ownerDocument[expando] = expanID;
668 | expandoData[expanID] = data;
669 | }
670 | return data;
671 | }
672 |
673 | function createElement(nodeName, ownerDocument, data){
674 | if (!ownerDocument) {
675 | ownerDocument = document;
676 | }
677 | if(supportsUnknownElements){
678 | return ownerDocument.createElement(nodeName);
679 | }
680 | if (!data) {
681 | data = getExpandoData(ownerDocument);
682 | }
683 | var node;
684 |
685 | if (data.cache[nodeName]) {
686 | node = data.cache[nodeName].cloneNode();
687 | } else if (saveClones.test(nodeName)) {
688 | node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
689 | } else {
690 | node = data.createElem(nodeName);
691 | }
692 |
693 | return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
694 | }
695 |
696 | function createDocumentFragment(ownerDocument, data){
697 | if (!ownerDocument) {
698 | ownerDocument = document;
699 | }
700 | if(supportsUnknownElements){
701 | return ownerDocument.createDocumentFragment();
702 | }
703 | data = data || getExpandoData(ownerDocument);
704 | var clone = data.frag.cloneNode(),
705 | i = 0,
706 | elems = getElements(),
707 | l = elems.length;
708 | for(;i
=0){
104 | for(var i=0;i<$checkdata.length;i++){
105 | var $checktype=$checkdata[i].split(':');
106 | if(! $pintuercheck(e,$checktype[0],$checkvalue)){
107 | $checkstate=false;
108 | $checktext=$checktext+"- "+$checktype[1]+"
";
109 | }
110 | }
111 | };
112 | if($checkstate){
113 | e.closest('.form-group').removeClass("check-error");
114 | e.parent().find(".input-help").remove();
115 | e.closest('.form-group').addClass("check-success");
116 | }else{
117 | e.closest('.form-group').removeClass("check-success");
118 | e.closest('.form-group').addClass("check-error");
119 | e.closest('.field').append('');
120 | }
121 | }
122 | });
123 | $pintuercheck=function(element,type,value){
124 | $pintu=value.replace(/(^\s*)|(\s*$)/g, "");
125 | switch(type){
126 | case "required":return /[^(^\s*)|(\s*$)]/.test($pintu);break;
127 | case "chinese":return /^[\u0391-\uFFE5]+$/.test($pintu);break;
128 | case "number":return /^\d+$/.test($pintu);break;
129 | case "integer":return /^[-\+]?\d+$/.test($pintu);break;
130 | case "plusinteger":return /^[+]?\d+$/.test($pintu);break;
131 | case "double":return /^[-\+]?\d+(\.\d+)?$/.test($pintu);break;
132 | case "plusdouble":return /^[+]?\d+(\.\d+)?$/.test($pintu);break;
133 | case "english":return /^[A-Za-z]+$/.test($pintu);break;
134 | case "username":return /^[a-z]\w{3,}$/i.test($pintu);break;
135 | case "mobile":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu);break;
136 | case "phone":return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break;
137 | case "tel":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu) || /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break;
138 | case "email":return /^[^@]+@[^@]+\.[^@]+$/.test($pintu);break;
139 | case "url":return /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/.test($pintu);break;
140 | case "ip":return /^[\d\.]{7,15}$/.test($pintu);break;
141 | case "qq":return /^[1-9]\d{4,10}$/.test($pintu);break;
142 | case "currency":return /^\d+(\.\d+)?$/.test($pintu);break;
143 | case "zip":return /^[1-9]\d{5}$/.test($pintu);break;
144 | case "radio":
145 | var radio=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length;
146 | return eval(radio==1);
147 | break;
148 | default:
149 | var $test=type.split('#');
150 | if($test.length>1){
151 | switch($test[0]){
152 | case "compare":
153 | return eval(Number($pintu)+$test[1]);
154 | break;
155 | case "regexp":
156 | return new RegExp($test[1],"gi").test($pintu);
157 | break;
158 | case "length":
159 | var $length;
160 | if(element.attr("type")=="checkbox"){
161 | $length=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length;
162 | }else{
163 | $length=$pintu.replace(/[\u4e00-\u9fa5]/g,"***").length;
164 | }
165 | return eval($length+$test[1]);
166 | break;
167 | case "ajax":
168 | var $getdata;
169 | var $url=$test[1]+$pintu;
170 | $.ajaxSetup({async:false});
171 | $.getJSON($url,function(data){
172 | //alert(data.getdata);
173 | $getdata=data.getdata;
174 | });
175 | if($getdata=="true"){return true;}
176 | break;
177 | case "repeat":
178 | return $pintu==jQuery('input[name="'+$test[1]+'"]').eq(0).val();
179 | break;
180 | default:return true;break;
181 | }
182 | break;
183 | }else{
184 | return true;
185 | }
186 | }
187 | };
188 | $('form').submit(function(){
189 | $(this).find('input[data-validate],textarea[data-validate],select[data-validate]').trigger("blur");
190 | $(this).find('input[placeholder],textarea[placeholder]').each(function(){$hideplaceholder($(this));});
191 | var numError = $(this).find('.check-error').length;
192 | if(numError){
193 | $(this).find('.check-error').first().find('input[data-validate],textarea[data-validate],select[data-validate]').first().focus().select();
194 | return false;
195 | }
196 | });
197 | $('.form-reset').click(function(){
198 | $(this).closest('form').find(".input-help").remove();
199 | $(this).closest('form').find('.form-submit').removeAttr('disabled');
200 | $(this).closest('form').find('.form-group').removeClass("check-error");
201 | $(this).closest('form').find('.form-group').removeClass("check-success");
202 | });
203 | $('.tab .tab-nav li').each(function(){
204 | var e=$(this);
205 | var trigger=e.closest('.tab').attr("data-toggle");
206 | if (trigger=="hover"){
207 | e.mouseover(function(){
208 | $showtabs(e);
209 | });
210 | e.click(function(){
211 | return false;
212 | });
213 | }else{
214 | e.click(function(){
215 | $showtabs(e);
216 | return false;
217 | });
218 | }
219 | });
220 | $showtabs=function(e){
221 | var detail=e.children("a").attr("href");
222 | e.closest('.tab .tab-nav').find("li").removeClass("active");
223 | e.closest('.tab').find(".tab-body .tab-panel").removeClass("active");
224 | e.addClass("active");
225 | $(detail).addClass("active");
226 | };
227 | $('.dialogs').each(function(){
228 | var e=$(this);
229 | var trigger=e.attr("data-toggle");
230 | if (trigger=="hover"){
231 | e.mouseover(function(){
232 | $showdialogs(e);
233 | });
234 | }else if(trigger=="click"){
235 | e.click(function(){
236 | $showdialogs(e);
237 | });
238 | }
239 | });
240 | $showdialogs=function(e){
241 | var trigger=e.attr("data-toggle");
242 | var getid=e.attr("data-target");
243 | var data=e.attr("data-url");
244 | var mask=e.attr("data-mask");
245 | var width=e.attr("data-width");
246 | var detail="";
247 | var masklayout=$('');
248 | if(width==null){width="80%";}
249 |
250 | if (mask=="1"){
251 | $("body").append(masklayout);
252 | }
253 | detail='';
254 | if(getid!=null){detail=detail+$(getid).html();}
255 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;}
256 | //alert(detail);
257 | detail=detail+'
';
258 |
259 | var win=$(detail);
260 | win.find(".dialog").addClass("open");
261 | $("body").append(win);
262 | var x=parseInt($(window).width()-win.outerWidth())/2;
263 | var y=parseInt($(window).height()-win.outerHeight())/2;
264 | if (y<=10){y="10"}
265 | win.css({"left":x,"top":y});
266 | win.find(".dialog-close,.close").each(function(){
267 | $(this).click(function(){
268 | win.remove();
269 | $('.dialog-mask').remove();
270 | });
271 | });
272 | masklayout.click(function(){
273 | win.remove();
274 | $(this).remove();
275 | });
276 | };
277 | $('.tips').each(function(){
278 | var e=$(this);
279 | var title=e.attr("title");
280 | var trigger=e.attr("data-toggle");
281 | e.attr("title","");
282 | if (trigger=="" || trigger==null){trigger="hover";}
283 | if (trigger=="hover"){
284 | e.mouseover(function(){
285 | $showtips(e,title);
286 | });
287 | }else if(trigger=="click"){
288 | e.click(function(){
289 | $showtips(e,title);
290 | });
291 | }else if(trigger=="show"){
292 | e.ready(function(){
293 | $showtips(e,title);
294 | });
295 | }
296 | });
297 | $showtips=function(e,title){
298 | var trigger=e.attr("data-toggle");
299 | var place=e.attr("data-place");
300 | var width=e.attr("data-width");
301 | var css=e.attr("data-style");
302 | var image=e.attr("data-image");
303 | var content=e.attr("content");
304 | var getid=e.attr("data-target");
305 | var data=e.attr("data-url");
306 | var x=0;
307 | var y=0;
308 | var html="";
309 | var detail="";
310 |
311 | if(image!=null){detail=detail+'
';}
312 | if(content!=null){detail=detail+''+content+'
';}
313 | if(getid!=null){detail=detail+$(getid).html();}
314 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;}
315 | if(title!=null && title!=""){
316 | if(detail!=null && detail!=""){detail=''+title+'
'+detail;}else{detail=''+title+'
';}
317 | }
318 | detail=''+detail+'
';
319 | html=$(detail);
320 |
321 | $("body").append( html );
322 | if(width!=null){
323 | html.css("width",width);
324 | }
325 | if(place=="" || place==null){place="top";}
326 | if(place=="left"){
327 | x=e.offset().left - html.outerWidth()-5;
328 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2;
329 | }else if(place=="top"){
330 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2;
331 | y=e.offset().top - html.outerHeight()-5;
332 | }else if(place=="right"){
333 | x=e.offset().left + e.outerWidth()+5;
334 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2;
335 | }else if(place=="bottom"){
336 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2;
337 | y=e.offset().top + e.outerHeight()+5;
338 | }
339 | if (css!=""){html.addClass(css);}
340 | html.css({"left":x+"px","top":y+"px","position":"absolute"});
341 | if (trigger=="hover" || trigger=="click" || trigger==null){
342 | e.mouseout(function(){html.remove();e.attr("title",title)});
343 | }
344 | };
345 | $('.alert .close').each(function(){
346 | $(this).click(function(){
347 | $(this).closest('.alert').remove();
348 | });
349 | });
350 | $('.radio label').each(function(){
351 | var e=$(this);
352 | e.click(function(){
353 | e.closest('.radio').find("label").removeClass("active");
354 | e.addClass("active");
355 | });
356 | });
357 | $('.checkbox label').each(function(){
358 | var e=$(this);
359 | e.click(function(){
360 | if(e.find('input').is(':checked')){
361 | e.addClass("active");
362 | }else{
363 | e.removeClass("active");
364 | };
365 | });
366 | });
367 | $('.collapse .panel-head').each(function(){
368 | var e=$(this);
369 | e.click(function(){
370 | e.closest('.collapse').find(".panel").removeClass("active");
371 | e.closest('.panel').addClass("active");
372 | });
373 | });
374 | $('.icon-navicon').each(function(){
375 | var e=$(this);
376 | var target=e.attr("data-target");
377 | e.click(function(){
378 | $(target).toggleClass("nav-navicon");
379 | });
380 | });
381 | $('.banner').each(function(){
382 | var e=$(this);
383 | var pointer=e.attr("data-pointer");
384 | var interval=e.attr("data-interval");
385 | var style=e.attr("data-style");
386 | var items=e.attr("data-item");
387 | var items_s=e.attr("data-small");
388 | var items_m=e.attr("data-middle");
389 | var items_b=e.attr("data-big");
390 | var num=e.find(".carousel .item").length;
391 | var win=$(window).width();
392 | var i=1;
393 |
394 | if(interval==null){interval=5};
395 | if(items==null || items<1){items=1};
396 | if(items_s!=null && win>760){items=items_s};
397 | if(items_m!=null && win>1000){items=items_m};
398 | if(items_b!=null && win>1200){items=items_b};
399 |
400 | var itemWidth=Math.ceil(e.outerWidth()/items);
401 | var page=Math.ceil(num/items);
402 | e.find(".carousel .item").css("width",itemWidth+ "px");
403 | e.find(".carousel").css("width",itemWidth*num + "px");
404 |
405 | var carousel=function(){
406 | i++;
407 | if(i>page){i=1;}
408 | $showbanner(e,i,items,num);
409 | };
410 | var play=setInterval(carousel,interval*600);
411 |
412 | e.mouseover(function(){clearInterval(play);});
413 | e.mouseout(function(){play=setInterval(carousel,interval*600);});
414 |
415 | if(pointer!=0 && page>1){
416 | var point='';
417 | for (var j=1;j';
419 | };
420 | point=point+'
';
421 | var pager=$(point);
422 | if(style!=null){pager.addClass(style);};
423 | e.append(pager);
424 | pager.css("left",e.outerWidth()*0.5 - pager.outerWidth()*0.5+"px");
425 | pager.find("li").click(function(){
426 | $showbanner(e,$(this).val(),items,num);
427 | });
428 | var lefter=$('');
429 | var righter=$('');
430 | if(style!=null){lefter.addClass(style);righter.addClass(style);};
431 | e.append(lefter);
432 | e.append(righter);
433 |
434 | lefter.click(function(){
435 | i--;
436 | if(i<1){i=page;}
437 | $showbanner(e,i,items,num);
438 | });
439 | righter.click(function(){
440 | i++;
441 | if(i>page){i=1;}
442 | $showbanner(e,i,items,num);
443 | });
444 | };
445 | });
446 | $showbanner=function(e,i,items,num){
447 | var after=0,leftx=0;
448 | leftx = - Math.ceil(e.outerWidth()/items)*(items)*(i-1);
449 | if(i*items > num){after=i*items-num;leftx= - Math.ceil(e.outerWidth()/items)*(num-items);};
450 | e.find(".carousel").stop(true, true).animate({"left":leftx+"px"},800);
451 | e.find(".pointer li").removeClass("active");
452 | e.find(".pointer li").eq(i-1).addClass("active");
453 | };
454 | $(".spy a").each(function(){
455 | var e=$(this);
456 | var t=e.closest(".spy");
457 | var target=t.attr("data-target");
458 | var top=t.attr("data-offset-spy");
459 | var thistarget="";
460 | var thistop="";
461 | if(top==null){top=0;};
462 | if(target==null){thistarget=$(window);}else{thistarget=$(target);};
463 |
464 | thistarget.bind("scroll",function(){
465 | if(target==null){
466 | thistop=$(e.attr("href")).offset().top - $(window).scrollTop() - parseInt(top);
467 | }else{
468 | thistop=$(e.attr("href")).offset().top - thistarget.offset().top - parseInt(top);
469 | };
470 |
471 | if(thistop<0){
472 | t.find('li').removeClass("active");
473 | e.parents('li').addClass("active");
474 | };
475 |
476 | });
477 | });
478 | $(".fixed").each(function(){
479 | var e=$(this);
480 | var style=e.attr("data-style");
481 | var top=e.attr("data-offset-fixed");
482 | if(top==null){top=e.offset().top;}else{top=e.offset().top - parseInt(top);};
483 | if(style==null){style="fixed-top";};
484 |
485 | $(window).bind("scroll",function(){
486 | var thistop=top - $(window).scrollTop();
487 | if(style=="fixed-top" && thistop<0){
488 | e.addClass("fixed-top");
489 | }else{
490 | e.removeClass("fixed-top");
491 | };
492 |
493 | var thisbottom=top - $(window).scrollTop()-$(window).height();
494 | if(style=="fixed-bottom" && thisbottom>0){
495 | e.addClass("fixed-bottom");
496 | }else{
497 | e.removeClass("fixed-bottom");
498 | };
499 | });
500 |
501 | });
502 |
503 | })
--------------------------------------------------------------------------------
/myblog/public/index/js/silder.js:
--------------------------------------------------------------------------------
1 | var obj=null;
2 | var As=document.getElementById('nav').getElementsByTagName('a');
3 | obj = As[0];
4 | for(i=1;i=0)
5 | obj=As[i];}
6 | obj.id='nav_current'
7 |
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947196cf0ec2.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947196cf0ec2.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/59471a9b900d7.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/59471a9b900d7.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/59471ad454530.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/59471ad454530.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947b3307ea80.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947b3307ea80.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947b34b18bb9.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947b34b18bb9.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947b41c99259.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947b41c99259.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947b578a7875.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947b578a7875.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/19/5947b63eccb82.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/19/5947b63eccb82.bmp
--------------------------------------------------------------------------------
/myblog/public/upload/2017/06/20/5947fe3f3b584.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dest1obj/mvc-/33fa525ee2fef6b1b2ec76ba3f4572741211bc04/myblog/public/upload/2017/06/20/5947fe3f3b584.bmp
--------------------------------------------------------------------------------
/myblog/vendor/csl/framework/src/Model.php:
--------------------------------------------------------------------------------
1 | '*',
21 | 'table' => '',
22 | 'where' =>'',
23 | 'group' =>'',
24 | 'having' =>'',
25 | 'order' =>'',
26 | 'limit' =>'',
27 | 'values' =>''
28 | ];
29 |
30 | /**
31 | * 初始化方法
32 | * @param array $config [参数数组]
33 | */
34 | public function __construct(array $config=null)
35 | {
36 | $config = include('config/database.php');
37 |
38 | $this->host = $config['DB_HOST'];
39 | $this->user = $config['DB_USER'];
40 | $this->password = $config['DB_PASSWORD'];
41 | $this->charset = $config['DB_CHARSET'];
42 | $this->dbName = $config['DB_NAME'];
43 | $this->prefix = $config['DB_PREFIX'];
44 |
45 | $this->link = $this->connect();//连接数据库
46 | $this->table = $this->getTable();//获取表名
47 |
48 | //从配置文件获取缓存路径
49 | $cache = $config['DB_CACHE'];
50 | if ($this->checkDir($cache)) {
51 | $this->cacheDir = $cache;
52 | } else {
53 | exit('缓存目录不存在');
54 | }
55 | //初始化缓存目录
56 | $this->cacheField = $this->initCache();
57 |
58 | //初始化参数数组
59 | $this->options = $this->initOptions();
60 |
61 | }
62 | public function delete()
63 | {
64 | if (empty($this->options['where'])) {
65 | exit('请添加删除条件!');
66 | }
67 |
68 | $sql = "DELETE FROM %TABLE% %WHERE% %ORDER% %LIMIT%";
69 | $sql = str_replace(
70 | [
71 | '%WHERE%',
72 | '%TABLE%',
73 | '%ORDER%',
74 | '%LIMIT%'
75 | ],
76 | [
77 | 'where' => $this->options['where'],
78 | 'table' => $this->options['table'],
79 | 'order' => $this->options['order'],
80 | 'limit' => $this->options['limit']
81 | ],
82 | $sql
83 | );
84 | return $this->exec($sql,false);
85 | }
86 |
87 | //初始化缓存字段
88 | protected function initCache()
89 | {
90 | //获取缓存文件
91 | $path = rtrim($this->cacheDir ,'/').'/'. $this->table . '.php';
92 | //如果缓存文件存在
93 | if (file_exists($path)) {
94 | return include $path;
95 | }
96 |
97 | //不存在,获取表结构
98 | $sql = 'desc ' . $this->table ;
99 | // $data = $this->query($sql,MYSQLI_ASSOC);
100 | $result = mysqli_query($this->link,$sql);
101 | $fields = [];
102 | //将字段添加到数组
103 | while ($row = mysqli_fetch_assoc($result))
104 | {
105 | //把主键也添加到数组
106 | if ($row['Key'] == 'PRI') {
107 | $fields['PRI'] = $row['Field'];
108 | }
109 | $fields[] = $row['Field'];
110 | }
111 |
112 | //生成字段数组语法形式
113 | $str = "";
114 | //写缓存文件
115 | file_put_contents($path, $str);
116 |
117 | return $fields;
118 | }
119 |
120 | //检测目录
121 | protected function checkDir($dir)
122 | {
123 | if (!is_dir($dir)) {
124 | return mkdir($dir,0777,true);
125 | }
126 | if (!is_readable($dir) || !is_writable($dir)) {
127 | return chmod($dir, 0777);
128 | }
129 | return true;
130 | }
131 |
132 | /**
133 | * 获取表名
134 | * @return [type] [返回表名]
135 | */
136 | protected function getTable()
137 | {
138 | //查看是否有默认值
139 | if (!empty($this->table)) {
140 | return $this->prefix . $this->table;
141 | }
142 |
143 | //从类名获得表名
144 | //获取当前对象的类名,并且转换为小写
145 | $className = strtolower(get_class($this));
146 | //使用反斜线分割类名 'app\index\model\usermodel'
147 | $className = explode('\\',$className);
148 | //获取类名
149 | $className = array_pop($className);
150 | //获取类名model前的部分,例如usermodel,得到user
151 | if (stripos($className, 'model') === false) {
152 | //类名中不包含model
153 | return $this->prefix .$className;
154 | }
155 | $className = substr($className, 0,-5);
156 |
157 | return $this->prefix .$className;
158 | }
159 |
160 | /**
161 | * 初始化参数数组
162 | * @return [type] [参数数组]
163 | */
164 | protected function initOptions()
165 | {
166 | //把$this->cacheFields变成字符串
167 | unset($this->cacheField['PRI']);
168 | $tmp = join(',',$this->cacheField);
169 | return [
170 | 'field' =>$tmp,
171 | 'table' => $this->table,
172 | 'where' =>'',
173 | 'group' =>'',
174 | 'having' =>'',
175 | 'order' =>'',
176 | 'limit' =>'',
177 | 'values' => ''
178 | ];
179 | }
180 |
181 | //数据库连接
182 | protected function connect()
183 | {
184 | $link = mysqli_connect($this->host,$this->user,$this->password);
185 | if (!$link) {
186 | exit('数据库连接失败');
187 | }
188 | if (!mysqli_select_db($link,$this->dbName)) {
189 | mysqli_close($link);
190 | exit('选择数据库失败');
191 | }
192 | if (!mysqli_set_charset($link,$this->charset)) {
193 | mysqli_close($link);
194 | exit('字符集设置失败');
195 | }
196 | return $link;
197 | }
198 | //表名
199 | public function table(string $table)
200 | {
201 | $tables = explode(',' , $table);
202 | foreach ($tables as $key=> $value){
203 | $tbName = ltrim($value,$this->prefix);
204 | $tbName = $this->prefix . $tbName;
205 | $tables[$key] = $tbName;
206 | }
207 | $this->options['table'] = join(',',$tables);
208 | return $this;
209 | }
210 |
211 | /**
212 | * 获取查询条件
213 | * @param [type] $where [查询条件]
214 | * @return [type] [返回查询条件]
215 | */
216 | public function where($where)
217 | {
218 | //'uid = 100 and password="123"'
219 | //['uid =100','password="123"']
220 | if (is_string($where)) {
221 | $this->options['where'] = " where " . $where;
222 | } else if (is_array($where)) {
223 | $this->options['where'] = " where " .join(" and ",$where);
224 | }
225 |
226 | return $this;
227 | }
228 | /**
229 | * 获取分组条件
230 | * @param [type] $group [分组条件]
231 | * @return [type] [返回分组条件]
232 | */
233 | public function group($group)
234 | {
235 | //['uid','name','password']
236 | if (is_string($group)) {
237 | $this->options['group'] = " group by " . $group;
238 | } else if (is_array($group)) {
239 | $this->options['group'] = " group by " .join(" , ",$group);
240 | }
241 | return $this;
242 | }
243 |
244 | /**
245 | * 获取分组过滤条件
246 | * @param [type] $having [分组过滤条件]
247 | * @return [type] [返回分组过滤条件]
248 | */
249 | public function having($having)
250 | {
251 | if (is_string($having)) {
252 | $this->options['having'] = " having " . $having;
253 | } else if (is_array($having)) {
254 | $this->options['having'] = " having " .join(" and ",$having);
255 | }
256 | return $this;
257 | }
258 | /**
259 | * 获取排序条件
260 | * @param [type] $order [排序条件]
261 | * @return [type] [返回排序条件]
262 | */
263 | public function order($order)
264 | {
265 | //'uid desc,name asc'
266 | //['uid desc','name asc']
267 | if (is_string($order)) {
268 | $this->options['order'] = " order by " . $order;
269 | } else if (is_array($order)) {
270 | $this->options['order'] = " order by " .join(" , ",$order);
271 | }
272 | return $this;
273 | }
274 | /**
275 | * 获取limit条件
276 | * @param [type] $limit [limit条件]
277 | * @return [type] [返回limit条件]
278 | */
279 | public function limit($limit)
280 | {
281 | if (is_string($limit)) {
282 | $this->options['limit'] = " limit " . $limit;
283 | } else if (is_array($limit)) {
284 | $this->options['limit'] = " limit " .join(" , ",$limit);
285 | }
286 | return $this;
287 | }
288 |
289 | /**
290 | * 获取字段列表
291 | * @param [type] $field [字段列表]
292 | * @return [type] [返回字段列表]
293 | */
294 | public function field($field)
295 | {
296 | $this->options['field'] = $field;
297 | return $this;
298 | }
299 |
300 | /**
301 | * 返回查询结果
302 | * @param [type] $resultType [结果类型]
303 | * @return [type] [结果数组]
304 | */
305 | public function select($resultType= MYSQLI_BOTH)
306 | {
307 | //select uid,username from bbs_user where uid<100 group by uid having uid>0 order by uid limit 5";
308 |
309 | $sql = "SELECT %FIELD% FROM %TABLE% %WHERE% %GROUP% %HAVING% %ORDER% %LIMIT%";
310 | $sql = str_replace([
311 | '%FIELD%',
312 | '%TABLE%',
313 | '%WHERE%',
314 | '%GROUP%',
315 | '%HAVING%',
316 | '%ORDER%',
317 | '%LIMIT%'
318 | ],
319 | [
320 | 'field' => $this->options['field'],
321 | 'table' => $this->options['table'],
322 | 'where' => $this->options['where'],
323 | 'group' => $this->options['group'],
324 | 'having' => $this->options['having'],
325 | 'order' => $this->options['order'],
326 | 'limit' => $this->options['limit']
327 | ], $sql);
328 |
329 | return $this->query($sql,$resultType);
330 | }
331 |
332 | /**
333 | * 查询数据
334 | * @param [type] $sql [sql语句]
335 | * @param [type] $resultType [结果类型]
336 | * @return [type] [成功范湖结果数组,失败返回false]
337 | */
338 | public function query($sql,$resultType)
339 | {
340 | //给sql赋值
341 | $this->sql = $sql;
342 | //清空参数数组
343 | $this->options = $this->initOptions();
344 | $result = mysqli_query($this->link,$sql);
345 | if ($result && mysqli_affected_rows($this->link)>0) {
346 | return mysqli_fetch_all($result,$resultType);//返回所有查询结果
347 | }
348 | return false;
349 | }
350 |
351 | /**
352 | * 更新语句
353 | * @param array $data [更新的关联数组]
354 | * @return [type] [成功返回true,失败返回false]
355 | */
356 | //['uid'=>1,'name'=>'jerry']
357 | public function update(array $data)
358 | {
359 | //给字符数据添加单引号
360 | $data = $this->addQuote($data);
361 |
362 | //过滤无效字段
363 | $data = $this->validField($data);
364 |
365 | //把关联数组变成字符串
366 | $str = $this->array2String($data);
367 | $this->options['set'] = $str;
368 |
369 | $sql = "UPDATE %TABLE% SET %SET% %WHERE% %ORDER% %LIMIT%";
370 | $sql = str_replace(
371 | [
372 | '%TABLE%',
373 | '%SET%',
374 | '%WHERE%',
375 | '%ORDER%',
376 | '%LIMIT%'
377 | ],
378 | [
379 | 'table' => $this->options['table'],
380 | 'set' => $this->options['set'],
381 | 'where' => $this->options['where'],
382 | 'order' => $this->options['order'],
383 | 'limit' => $this->options['limit']
384 | ], $sql);
385 | return $this->exec($sql,false);
386 | }
387 |
388 | /**
389 | * 关联数组转换为字符串
390 | * @param [type] $data [关联数组]
391 | * @return [type] [字符串]
392 | */
393 | protected function array2String($data)
394 | {
395 | $str = '';
396 | if (is_array($data)) {
397 | foreach ($data as $key => $value) {
398 | //uid=1,
399 | $str .= $key . ' = '.$value . ',';
400 | }
401 | }
402 | return rtrim($str,',');
403 | }
404 |
405 |
406 | /**
407 | * [insert 插入数据]
408 | * @param array $data [必须是关联数组,键是字段名]
409 | * @return [type] [成功是true,失败是false]
410 | */
411 | public function insert(array $data)
412 | {
413 | //给字符数据添加单引号
414 | $data = $this->addQuote($data);
415 |
416 | //过滤无效字段
417 | $data = $this->validField($data);
418 |
419 | //取出键拼接为字符串
420 | $this->options['field'] = join(',',array_keys($data));
421 | //取出值拼接为字符串
422 | $this->options['values'] = join(',',array_values($data));
423 |
424 | $sql = "insert into %TABLE%(%FIELD%) VALUES(%VALUES%)";
425 | $sql = str_replace([
426 | '%TABLE%',
427 | '%FIELD%',
428 | '%VALUES%'
429 | ],
430 | [
431 | 'table' => $this->options['table'],
432 | 'field' => $this->options['field'],
433 | 'values' => $this->options['values']
434 | ], $sql);
435 | return $this->exec($sql,$isInsertId = false);
436 | }
437 |
438 | /**
439 | * 执行增删改语句
440 | * @param [type] $sql [sql语句]
441 | * @param boolean $isInsertId [是否返回自增主键的值]
442 | * @return [type] [如果执行成功,isInsertId为真,返回主键值,否则返回true,失败返回false]
443 | */
444 | public function exec($sql,$isInsertId = false)
445 | {
446 | $this->sql = $sql;
447 | $this->options = $this->initOptions();
448 |
449 | $result = mysqli_query($this->link,$sql);
450 | if ($result && $isInsertId) {
451 | return mysqli_insert_id($this->link);//返回自增主键的值
452 | }
453 | return $result;
454 |
455 | }
456 |
457 | /**
458 | * 给字符串元素两边添加单引号
459 | * @param [type] $data [添加单引号后的数组]
460 | */
461 | protected function addQuote($data)
462 | {
463 | if (is_array($data)) {
464 | foreach ($data as $key => $value) {
465 | if (is_string($value)) {
466 | $data[$key] = "'$value'";
467 | }
468 | }
469 | }
470 | return $data;
471 | }
472 |
473 | /**
474 | * 过滤无效字段
475 | * @param [type] $data [字段数组]
476 | * @return [type] [返回过滤后的数组]
477 | */
478 | protected function validField($data)
479 | {
480 | //['uid'=>2,'name'=>'tom']
481 | //[0=>'uid',1=>'name']
482 | //交换缓存的键值
483 | $cacheField = array_flip($this->cacheField);
484 | $data = array_intersect_key($data,$cacheField);
485 | return $data;
486 | }
487 |
488 | /**
489 | * 魔术方法call
490 | * @param [type] $name [方法名]
491 | * @param [type] $paras [方法参数]
492 | * @return [type] [结果数组]
493 | */
494 | public function __call($name,$paras)
495 | {
496 | if (substr($name,0,5) == 'getBy') {
497 | $fieldName = substr($name, 5);
498 | return $this->getBy($fieldName,$paras);
499 | }
500 | }
501 |
502 | /**
503 | * [根据字段获取记录]
504 | * @param [type] $name [字段名]
505 | * @param [type] $value [字段值]
506 | * @return [type] [记录的关联数组]
507 | */
508 | public function getBy($name,$value)
509 | {
510 | $name = strtolower($name);
511 | if (count($value)>0) {
512 | if (is_string($value[0])) {
513 | $this->options['where'] = ' where '.$name . " = '".$value[0] ."'";
514 | } else {
515 | $this->options['where'] = ' where '.$name . ' = '.$value[0];
516 | }
517 | }
518 | return $this->select(MYSQLI_ASSOC);
519 | }
520 |
521 | /**
522 | * 获取最后执行的sql
523 | * @param [type] $name [属性名]
524 | * @return [type] [返回sql]
525 | */
526 | public function __get($name)
527 | {
528 | if ('sql' ==$name) {
529 | return $this->sql;
530 | }
531 | }
532 | }
533 |
534 |
--------------------------------------------------------------------------------
/myblog/vendor/csl/framework/src/Template.php:
--------------------------------------------------------------------------------
1 | tplDir = $this->checkDir($tplDir);
14 | $this->cacheDir = $this->checkDir($cacheDir);
15 | $this->expireTime = $expireTime;
16 | }
17 |
18 | /**
19 | * [assign 分配变量]
20 | * @param [type] $name [变量名]
21 | * @param [type] $value [变量值]
22 | * @return [type] [没有]
23 | */
24 | public function assign($name,$value)
25 | {
26 | $this->vars[$name] = $value;
27 | }
28 |
29 |
30 | /**
31 | * [display 编译模板文件,加载缓存文件,显示]
32 | * @param [type] $viewFile [模板文件名]
33 | * @param [type] $isExtract [是否还原变量]
34 | * @return [type] [无]
35 | */
36 | public function display($viewFile,$isExtract=true)
37 | {
38 | //1 拼接模板文件和缓存文件的路径
39 | $tplFile = $this->tplDir . $viewFile;
40 | $cacheFile = $this->joinCachePath($viewFile);
41 |
42 | //2 检测模板文件是否存在
43 | if (!file_exists($tplFile)) {
44 | exit('模板文件不存在!');
45 | }
46 |
47 | //3 编译模板文件
48 | //3.1模板文件不存在或者模板文件修改时间晚于缓存文件创建时间
49 | if(!file_exists($cacheFile)||
50 | filectime($cacheFile) < filemtime($tplFile)||
51 | filectime($cacheFile) + $this->expireTime < time()
52 | )
53 | {
54 | // index/index.html
55 | $this->checkDir(dirname($cacheFile));
56 | $content = $this->compile($tplFile);
57 | file_put_contents($cacheFile, $content);
58 | } else {
59 | $this->updateInclude($tplFile);
60 | }
61 |
62 |
63 | //4 分配变量。加载缓存
64 | if ($isExtract) {
65 | extract($this->vars);
66 | include $cacheFile;
67 | }
68 |
69 | }
70 |
71 | protected function updateInclude($tplFile)
72 | {
73 | //读取模板文件内容
74 | $content = file_get_contents($tplFile);
75 | $pattern = '/\{include (.+)\}/';
76 | preg_match_all($pattern, $content, $matches);
77 | foreach ($matches[1] as $key => $value) {
78 | $value = trim($value ,'\'"');
79 | $this->display($value,false);
80 | }
81 | }
82 |
83 | protected function compile($fileName)
84 | {
85 | //读文件内容
86 | $content = file_get_contents($fileName);
87 | $rule = [
88 | '{$%%}' => '=$\1;?>',
89 | '{if %%}' => '',
90 | '{/if}' => '',
91 | '{else}' => '',
92 | '{elseif %%}' => '',
93 | '{else if %%}' => '',
94 | '{foreach %%}' => '',
95 | '{/foreach}' => '',
96 | '{while %%}' => '',
97 | '{/while}' => '',
98 | '{for %%}' => '',
99 | '{/for}' => '',
100 | '{continue}' => '',
101 | '{break}' => '',
102 | '{$%%++}' => '',
103 | '{$%%--}' => '',
104 | '{/*}' => ' '*/?>',
106 | '{section}' => ' '?>',
108 | '{$%% = $%%}' => '',
109 | '{default}' => '',
110 | '{include %%}' => '',
111 | ];
112 |
113 | foreach ($rule as $key => $value) {
114 | $key = preg_quote($key,'/');
115 | $pattern = '/'.str_replace('%%', '(.+)', $key) . '/U';
116 | if (stripos($key,'include')) {
117 | $content = preg_replace_callback($pattern, [$this,'parseInclude'], $content);
118 | } else {
119 | $content = preg_replace($pattern, $value, $content);
120 | }
121 | }
122 | return $content;
123 | }
124 |
125 | protected function parseInclude($data)
126 | {
127 | $file = trim($data[1],'\'"');
128 | $this->display($file,false);//编译模板文件,不还原变量
129 | $cacheFile = $this->joinCachePath($file);//缓存文件的路径
130 | return "";
131 | }
132 |
133 | //index.html index_html.php
134 | protected function joinCachePath($viewFile)
135 | {
136 | return $this->cacheDir . str_replace('.', '_', $viewFile).'.php';
137 | }
138 | protected function checkDir($dir)
139 | {
140 | $dir = str_replace('\\','/', $dir);
141 | $dir = rtrim($dir,'/') . '/';
142 | $flag = true;
143 | if (!is_dir($dir)) {
144 | $flag = mkdir($dir,0777,true);
145 | } else if (!is_readable($dir) || !is_writable($dir)) {
146 | $flag = chmod($dir, 0777);
147 | }
148 | if (!$flag) {
149 | exit('目录不存在或不可写');
150 | }
151 | return $dir;
152 | }
153 |
154 | }
--------------------------------------------------------------------------------