├── !!!readme
├── 10.jpg
├── 11.jpg
├── 12.jpg
├── 13.jpg
├── 2.jpg
├── 3.jpg
├── 4.jpg
├── 5.jpg
├── 6.jpg
├── 7.jpg
├── 8.jpg
└── 9.jpg
├── LICENSE
├── README.md
├── api.php
├── api
└── checkcode.php
├── caches
├── caches_commons
│ └── caches_data
│ │ └── common.cache.php
├── configs
│ ├── cache.php
│ ├── database.php
│ ├── route.php
│ ├── sub_config.php
│ └── system.php
└── error_log.php
├── data
└── sql_yuyue_lite_db.sql
├── index.php
├── source
├── base.php
├── libs
│ ├── classes
│ │ ├── application.class.php
│ │ ├── cache_factory.class.php
│ │ ├── cache_file.class.php
│ │ ├── cache_memcache.class.php
│ │ ├── checkcode.class.php
│ │ ├── db.class.php
│ │ ├── db_factory.class.php
│ │ ├── form.class.php
│ │ ├── model.class.php
│ │ ├── mysql.class.php
│ │ ├── param.class.php
│ │ ├── session_files.class.php
│ │ ├── session_mysql.class.php
│ │ └── tree.class.php
│ ├── data
│ │ ├── dict
│ │ │ └── dict.csv
│ │ ├── font
│ │ │ ├── Vineta.ttf
│ │ │ ├── elephant.ttf
│ │ │ └── georgia.ttf
│ │ └── ipdata
│ │ │ └── mini.Dat
│ └── functions
│ │ ├── dir.func.php
│ │ ├── extention.func.php
│ │ ├── global.func.php
│ │ ├── iconv.func.php
│ │ └── mail.func.php
├── model
│ ├── admin_model.class.php
│ ├── adminlogs_model.class.php
│ ├── bmfz_model.class.php
│ ├── bzks_model.class.php
│ ├── diqu_model.class.php
│ ├── edlogs_model.class.php
│ ├── email_model.class.php
│ ├── ipbanned_model.class.php
│ ├── jzqk_model.class.php
│ ├── log_model.class.php
│ ├── lyfs_model.class.php
│ ├── menu_model.class.php
│ ├── pbqk_data_model.class.php
│ ├── pbqk_model.class.php
│ ├── session_model.class.php
│ ├── site_model.class.php
│ ├── times_model.class.php
│ ├── wlxf_data_model.class.php
│ ├── wlxf_model.class.php
│ ├── wlzh_data_model.class.php
│ ├── yuyue_data_model.class.php
│ ├── yuyue_model.class.php
│ ├── yytj_model.class.php
│ ├── zjys_model.class.php
│ └── zxzy_model.class.php
└── modules
│ └── admin
│ ├── anls.php
│ ├── classes
│ ├── admin.class.php
│ └── admin_op.class.php
│ ├── comp.php
│ ├── dyua.php
│ ├── edlg.php
│ ├── functions
│ ├── admin.func.php
│ └── comm.func.php
│ ├── index.php
│ ├── line.php
│ ├── main.php
│ ├── quer.php
│ ├── repo.php
│ ├── sysm.php
│ ├── templates
│ ├── anls_chart.tpl.php
│ ├── anls_chart_column.tpl.php
│ ├── anls_chart_line.tpl.php
│ ├── anls_chart_pie.tpl.php
│ ├── comp_wlxf_edit.tpl.php
│ ├── comp_wlxf_list.tpl.php
│ ├── dyua_edit.tpl.php
│ ├── dyua_list.tpl.php
│ ├── edlg_list.tpl.php
│ ├── elem.tpl.php
│ ├── footer.tpl.php
│ ├── header.tpl.php
│ ├── index.tpl.php
│ ├── line_edit.tpl.php
│ ├── line_list.tpl.php
│ ├── login.tpl.php
│ ├── main_edit.tpl.php
│ ├── main_list.tpl.php
│ ├── msdialog.tpl.php
│ ├── navier.tpl.bak.php
│ ├── navier.tpl.php
│ ├── repo_comm.tpl.php
│ ├── repo_dyuan.tpl.php
│ ├── showmessage.tpl.php
│ ├── sysm_commset.tpl.php
│ ├── sysm_emailset.tpl.php
│ ├── sysm_loginlogs.tpl.php
│ ├── sysm_siteset.tpl.php
│ ├── user_changepwd.tpl.php
│ ├── user_edituser.tpl.php
│ └── user_userlist.tpl.php
│ ├── user.php
│ └── webctrl.php
├── statics
├── css
│ ├── daterangepicker-bs3.css
│ └── master.css
├── images
│ ├── sorter_asc.gif
│ ├── sorter_bg.gif
│ └── sorter_desc.gif
└── js
│ ├── date_metro.js
│ ├── daterangepicker.js
│ ├── highcharts.js
│ ├── index.js
│ ├── jquery.tablesorter.js
│ ├── moment.js
│ ├── moment.min.js
│ ├── moo.fx.js
│ ├── moo.fx.pack.js
│ ├── plugin.js
│ └── prototype.lite.js
└── webctrl.php
/!!!readme/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/10.jpg
--------------------------------------------------------------------------------
/!!!readme/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/11.jpg
--------------------------------------------------------------------------------
/!!!readme/12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/12.jpg
--------------------------------------------------------------------------------
/!!!readme/13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/13.jpg
--------------------------------------------------------------------------------
/!!!readme/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/2.jpg
--------------------------------------------------------------------------------
/!!!readme/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/3.jpg
--------------------------------------------------------------------------------
/!!!readme/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/4.jpg
--------------------------------------------------------------------------------
/!!!readme/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/5.jpg
--------------------------------------------------------------------------------
/!!!readme/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/6.jpg
--------------------------------------------------------------------------------
/!!!readme/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/7.jpg
--------------------------------------------------------------------------------
/!!!readme/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/8.jpg
--------------------------------------------------------------------------------
/!!!readme/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/!!!readme/9.jpg
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ##网络在线预约管理系统
2 |
3 | @(发布)[预约管理系统,预约系统,网络预约管理]
4 | >基于PHP MVC架构+Bootstrap前端的高效、简洁网络在线预约管理系统,灵活的交叉权限控制,多样的数据图表,各项数据的分类统计报表。
5 |
6 | ###环境
7 | PHP 5.26 **高版本的PHP环境会报错以后会修复**
8 | MYSQL >=5.1
9 |
10 | ###配置
11 |
12 | - sql数据文件:\data\sql_yuyue_lite_db
13 | - 系统配置:\caches\configs\system.php
14 | - 数据库配置:\caches\configs\database.php
15 |
16 | ###登录管理
17 |
18 | - 地址:/webctrl.php
19 | - 用户名:yltuan
20 | - 密码:123456
21 |
22 | ###特性
23 | 1. 灵活的权限分配;
24 | 2. 基于Bootstrap简洁精巧的管理界面;
25 | 4. 高效的数据查询导出管理;
26 | 3. 高效多样的数据分类统计图表、报表;
27 | 5. 预约数据编辑历史记录查看功能;
28 |
29 | ###更多支持
30 | - QQ182860914
31 |
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 |
44 | ###赞赏支持
45 | 你的赞赏是我的动力:
46 | ####普通赞赏通道——
47 |
48 | 
49 |
50 | ####土豪赞赏通道——
51 | 
--------------------------------------------------------------------------------
/api.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api/checkcode.php:
--------------------------------------------------------------------------------
1 | code_len = intval($_GET['code_len']);
9 | if ($checkcode->code_len > 8 || $checkcode->code_len < 2) {
10 | $checkcode->code_len = 4;
11 | }
12 | if (isset($_GET['font_size']) && intval($_GET['font_size'])) $checkcode->font_size = intval($_GET['font_size']);
13 | if (isset($_GET['width']) && intval($_GET['width'])) $checkcode->width = intval($_GET['width']);
14 | if ($checkcode->width <= 0) {
15 | $checkcode->width = 130;
16 | }
17 |
18 | if (isset($_GET['height']) && intval($_GET['height'])) $checkcode->height = intval($_GET['height']);
19 | if ($checkcode->height <= 0) {
20 | $checkcode->height = 50;
21 | }
22 | $max_width = $checkcode->code_len * 28;
23 | $max_height = $checkcode->font_size * 2;
24 | if($checkcode->width > $max_width) $checkcode->width = $max_width;
25 | if($checkcode->height > $max_height) $checkcode->height = $max_height;
26 |
27 | if (isset($_GET['font_color']) && trim(urldecode($_GET['font_color'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['font_color'])))) $checkcode->font_color = trim(urldecode($_GET['font_color']));
28 | if (isset($_GET['background']) && trim(urldecode($_GET['background'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['background'])))) $checkcode->background = trim(urldecode($_GET['background']));
29 | $checkcode->doimage();
30 | $_SESSION['code']=$checkcode->get_code();
--------------------------------------------------------------------------------
/caches/caches_commons/caches_data/common.cache.php:
--------------------------------------------------------------------------------
1 | 'admin@admin.cn',
5 | 'maxloginfailedtimes' => '8',
6 | 'minrefreshtime' => '2',
7 | 'mail_type' => '1',
8 | 'mail_server' => 'smtp.qq.com',
9 | 'mail_port' => '25',
10 | 'category_ajax' => '0',
11 | 'mail_user' => 'admin.cn@foxmail.com',
12 | 'mail_auth' => '1',
13 | 'mail_from' => 'admin.cn@foxmail.com',
14 | 'mail_password' => '',
15 | 'errorlog_size' => '20',
16 | );
17 | ?>
--------------------------------------------------------------------------------
/caches/configs/cache.php:
--------------------------------------------------------------------------------
1 | array (
5 | 'type' => 'file',
6 | 'debug' => true,
7 | 'pconnect' => 0,
8 | 'autoconnect' => 0
9 | ),
10 | 'template' => array (
11 | 'hostname' => '210.78.140.2',
12 | 'port' => 11211,
13 | 'timeout' => 0,
14 | 'type' => 'memcache',
15 | 'debug' => true,
16 | 'pconnect' => 0,
17 | 'autoconnect' => 0
18 | )
19 | );
20 | ?>
--------------------------------------------------------------------------------
/caches/configs/database.php:
--------------------------------------------------------------------------------
1 | array (
5 | 'hostname' => '127.0.0.1:3306',
6 | 'database' => 'sql_yuyue_lite_db',
7 | 'username' => 'root',
8 | 'password' => '123654',
9 | 'tablepre' => 'v9tb_',
10 | 'charset' => 'utf8',
11 | 'type' => 'mysql',
12 | 'debug' => true,
13 | 'pconnect' => 0,
14 | 'autoconnect' => 0
15 | ),
16 | );
17 |
18 | ?>
--------------------------------------------------------------------------------
/caches/configs/route.php:
--------------------------------------------------------------------------------
1 | array(
6 | * 'm'=>'main',
7 | * 'c'=>'index',
8 | * 'a'=>'init',
9 | * 'data'=>array(
10 | * 'POST'=>array(
11 | * 'catid'=>1
12 | * ),
13 | * 'GET'=>array(
14 | * 'contentid'=>1
15 | * )
16 | * )
17 | * )
18 | * 基中“m”为模型,“c”为控制器,“a”为事件,“data”为其他附加参数。
19 | * data为一个二维数组,可设置POST和GET的默认参数。POST和GET分别对应PHP中的$_POST和$_GET两个超全局变量。在程序中您可以使用$_POST['catid']来得到data下面POST中的数组的值。
20 | * data中的所设置的参数等级比较低。如果外部程序有提交相同的名字的变量,将会覆盖配置文件中所设置的值。如:
21 | * 外部程序POST了一个变量catid=2那么你在程序中使用$_POST取到的值是2,而不是配置文件中所设置的1。
22 | */
23 | return array(
24 | 'default'=>array('m'=>'content', 'c'=>'index', 'a'=>'init'),
25 | );
--------------------------------------------------------------------------------
/caches/configs/sub_config.php:
--------------------------------------------------------------------------------
1 | 1 //电话修改设置 0不能修改 1可以修改 >1分钟限制
4 | );
5 | ?>
--------------------------------------------------------------------------------
/caches/configs/system.php:
--------------------------------------------------------------------------------
1 | '/',
5 | //Session配置
6 | 'session_storage' => 'mysql',
7 | 'session_ttl' => 1800,
8 | 'session_savepath' => CACHE_PATH.'sessions/',
9 | 'session_n' => 0,
10 | //Cookie配置
11 | 'cookie_domain' => '', //Cookie 作用域
12 | 'cookie_path' => '', //Cookie 作用路径
13 | 'cookie_pre' => 'TPFct_', //Cookie 前缀,同一域名下安装多套系统时,请修改Cookie前缀
14 | 'cookie_ttl' => 0, //Cookie 生命周期,0 表示随浏览器进程
15 | //模板相关配置
16 | 'tpl_root' => 'templates/', //模板保存物理路径
17 | 'tpl_name' => 'default', //当前模板方案目录
18 | 'tpl_css' => 'default', //当前样式目录
19 | 'tpl_referesh' => 1,
20 | 'tpl_edit'=>0,//是否允许在线编辑模板
21 |
22 | //附件相关配置
23 | 'upload_path' => RUN_PATH.'uploadfile/',
24 | 'upload_url' => '/uploadfile/', //附件路径
25 | 'attachment_stat' => '1',//是否记录附件使用状态 0 统计 1 统计, 注意: 本功能会加重服务器负担
26 |
27 | 'js_path' => '/statics/js/', //CDN JS
28 | 'css_path' => '/statics/css/', //CDN CSS
29 | 'img_path' => '/statics/images/', //CDN img
30 | 'app_path' => '/',//动态域名配置地址
31 |
32 | 'charset' => 'utf-8', //网站字符集
33 | 'timezone' => 'Etc/GMT-8', //网站时区(只对php 5.1以上版本有效),Etc/GMT-8 实际表示的是 GMT+8
34 | 'debug' => 0, //是否显示调试信息
35 | 'admin_log' => 1, //是否记录后台操作日志
36 | 'errorlog' => 1, //1、保存错误日志到 cache/error_log.php | 0、在页面直接显示
37 | 'gzip' => 1, //是否Gzip压缩后输出
38 | 'auth_key' => 'UB3DPguSb6x88NnPnOsd', //密钥
39 | 'lang' => 'zh-cn', //网站语言包
40 | 'lock_ex' => '1', //写入缓存时是否建立文件互斥锁定(如果使用nfs建议关闭)
41 |
42 | 'admin_founders' => '1', //网站创始人ID,多个ID逗号分隔
43 | 'admin_super' => 'yltuan', //网站超级管理员CID
44 | 'execution_sql' => 0, //EXECUTION_SQL
45 |
46 | 'safe_card'=>'1',//是否启用口令卡
47 |
48 | 'plugin_debug' => '0', //插件测试
49 | 'admin_url' => '', //允许访问后台的域名
50 | );
51 | ?>
--------------------------------------------------------------------------------
/caches/error_log.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/caches/error_log.php
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | route_m());
17 | define('ROUTE_C', $param->route_c());
18 | define('ROUTE_A', $param->route_a());
19 | $this->init();
20 | }
21 |
22 | /**
23 | * 调用件事
24 | */
25 | private function init() {
26 | $controller = $this->load_controller();
27 | if (method_exists($controller, ROUTE_A)) {
28 | if (preg_match('/^[_]/i', ROUTE_A)) {
29 | exit('You are visiting the action is to protect the private action');
30 | } else {
31 | call_user_func(array($controller, ROUTE_A));
32 | }
33 | } else {
34 | exit('Action does not exist.');
35 | }
36 | }
37 |
38 | /**
39 | * 加载控制器
40 | * @param string $filename
41 | * @param string $m
42 | * @return obj
43 | */
44 | private function load_controller($filename = '', $m = '') {
45 | if (empty($filename)) $filename = ROUTE_C;
46 | if (empty($m)) $m = ROUTE_M;
47 | $filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR.$filename.'.php';
48 | //exit($filepath);
49 | if (file_exists($filepath)) {
50 | $classname = $filename;
51 | include $filepath;
52 | if ($mypath = pc_base::my_path($filepath)) {
53 | $classname = 'MY_'.$filename;
54 | include $mypath;
55 | }
56 | if(class_exists($classname)){
57 | return new $classname;
58 | }else{
59 | exit('Controller does not exist.');
60 | }
61 | } else {
62 | exit('Controller does not exist.');
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/source/libs/classes/cache_factory.class.php:
--------------------------------------------------------------------------------
1 | cache_config = $cache_config;
43 | }
44 | }
45 | return cache_factory::$cache_factory;
46 | }
47 |
48 | /**
49 | * 获取缓存操作实例
50 | * @param $cache_name 缓存配置名称
51 | */
52 | public function get_cache($cache_name) {
53 | if(!isset($this->cache_list[$cache_name]) || !is_object($this->cache_list[$cache_name])) {
54 | $this->cache_list[$cache_name] = $this->load($cache_name);
55 | }
56 | return $this->cache_list[$cache_name];
57 | }
58 |
59 | /**
60 | * 加载缓存驱动
61 | * @param $cache_name 缓存配置名称
62 | * @return object
63 | */
64 | public function load($cache_name) {
65 | $object = null;
66 | if(isset($this->cache_config[$cache_name]['type'])) {
67 | switch($this->cache_config[$cache_name]['type']) {
68 | case 'file' :
69 | $object = pc_base::load_sys_class('cache_file');
70 | break;
71 | case 'memcache' :
72 | define('MEMCACHE_HOST', $this->cache_config[$cache_name]['hostname']);
73 | define('MEMCACHE_PORT', $this->cache_config[$cache_name]['port']);
74 | define('MEMCACHE_TIMEOUT', $this->cache_config[$cache_name]['timeout']);
75 | define('MEMCACHE_DEBUG', $this->cache_config[$cache_name]['debug']);
76 |
77 | $object = pc_base::load_sys_class('cache_memcache');
78 | break;
79 | case 'apc' :
80 | $object = pc_base::load_sys_class('cache_apc');
81 | break;
82 | default :
83 | $object = pc_base::load_sys_class('cache_file');
84 | }
85 | } else {
86 | $object = pc_base::load_sys_class('cache_file');
87 | }
88 | return $object;
89 | }
90 |
91 | }
92 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/cache_file.class.php:
--------------------------------------------------------------------------------
1 | '.cache.php', /*缓存文件后缀*/
8 | 'type' => 'array', /*缓存格式:array数组,serialize序列化,null字符串*/
9 | );
10 |
11 | /*缓存路径*/
12 | protected $filepath = '';
13 |
14 | /**
15 | * 构造函数
16 | * @param array $setting 缓存配置
17 | * @return void
18 | */
19 | public function __construct($setting = '') {
20 | $this->get_setting($setting);
21 | }
22 |
23 | /**
24 | * 写入缓存
25 | * @param string $name 缓存名称
26 | * @param mixed $data 缓存数据
27 | * @param array $setting 缓存配置
28 | * @param string $type 缓存类型
29 | * @param string $module 所属模型
30 | * @return mixed 缓存路径/false
31 | */
32 |
33 | public function set($name, $data, $setting = '', $type = 'data', $module = ROUTE_M) {
34 | $this->get_setting($setting);
35 | if(empty($type)) $type = 'data';
36 | if(empty($module)) $module = ROUTE_M;
37 | $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/';
38 | $filename = $name.$this->_setting['suf'];
39 | if(!is_dir($filepath)) {
40 | mkdir($filepath, 0777, true);
41 | }
42 |
43 | if($this->_setting['type'] == 'array') {
44 | $data = "";
45 | } elseif($this->_setting['type'] == 'serialize') {
46 | $data = serialize($data);
47 | }
48 | if ($module == 'commons' || ($module == 'commons' && substr($name, 0, 16) != 'category_content')) {
49 | $db = pc_base::load_model('cache_model');
50 | $datas = new_addslashes($data);
51 | if ($db->get_one(array('filename'=>$filename, 'path'=>'caches_'.$module.'/caches_'.$type.'/'), '`filename`')) {
52 | $db->update(array('data'=>$datas), array('filename'=>$filename, 'path'=>'caches_'.$module.'/caches_'.$type.'/'));
53 | } else {
54 | $db->insert(array('filename'=>$filename, 'path'=>'caches_'.$module.'/caches_'.$type.'/', 'data'=>$datas));
55 | }
56 | }
57 |
58 | //是否开启互斥锁
59 | if(pc_base::load_config('system', 'lock_ex')) {
60 | $file_size = file_put_contents($filepath.$filename, $data, LOCK_EX);
61 | } else {
62 | $file_size = file_put_contents($filepath.$filename, $data);
63 | }
64 |
65 | return $file_size ? $file_size : 'false';
66 | }
67 |
68 | /**
69 | * 获取缓存
70 | * @param string $name 缓存名称
71 | * @param array $setting 缓存配置
72 | * @param string $type 缓存类型
73 | * @param string $module 所属模型
74 | * @return mixed $data 缓存数据
75 | */
76 | public function get($name, $setting = '', $type = 'data', $module = ROUTE_M) {
77 | $this->get_setting($setting);
78 | if(empty($type)) $type = 'data';
79 | if(empty($module)) $module = ROUTE_M;
80 | $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/';
81 | $filename = $name.$this->_setting['suf'];
82 | if (!file_exists($filepath.$filename)) {
83 | return false;
84 | } else {
85 | if($this->_setting['type'] == 'array') {
86 | $data = @require($filepath.$filename);
87 | } elseif($this->_setting['type'] == 'serialize') {
88 | $data = unserialize(file_get_contents($filepath.$filename));
89 | }
90 |
91 | return $data;
92 | }
93 | }
94 |
95 | /**
96 | * 删除缓存
97 | * @param string $name 缓存名称
98 | * @param array $setting 缓存配置
99 | * @param string $type 缓存类型
100 | * @param string $module 所属模型
101 | * @return bool
102 | */
103 | public function delete($name, $setting = '', $type = 'data', $module = ROUTE_M) {
104 | $this->get_setting($setting);
105 | if(empty($type)) $type = 'data';
106 | if(empty($module)) $module = ROUTE_M;
107 | $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/';
108 | $filename = $name.$this->_setting['suf'];
109 | if(file_exists($filepath.$filename)) {
110 | if ($module == 'commons' && substr($name, 0, 16) != 'category_content') {
111 | $db = pc_base::load_model('cache_model');
112 | $db->delete(array('filename'=>$filename, 'path'=>'caches_'.$module.'/caches_'.$type.'/'));
113 | }
114 | return @unlink($filepath.$filename) ? true : false;
115 | } else {
116 | return false;
117 | }
118 | }
119 |
120 | /**
121 | * 和系统缓存配置对比获取自定义缓存配置
122 | * @param array $setting 自定义缓存配置
123 | * @return array $setting 缓存配置
124 | */
125 | public function get_setting($setting = '') {
126 | if($setting) {
127 | $this->_setting = array_merge($this->_setting, $setting);
128 | }
129 | }
130 |
131 | public function cacheinfo($name, $setting = '', $type = 'data', $module = ROUTE_M) {
132 | $this->get_setting($setting);
133 | if(empty($type)) $type = 'data';
134 | if(empty($module)) $module = ROUTE_M;
135 | $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/';
136 | $filename = $filepath.$name.$this->_setting['suf'];
137 |
138 | if(file_exists($filename)) {
139 | $res['filename'] = $name.$this->_setting['suf'];
140 | $res['filepath'] = $filepath;
141 | $res['filectime'] = filectime($filename);
142 | $res['filemtime'] = filemtime($filename);
143 | $res['filesize'] = filesize($filename);
144 | return $res;
145 | } else {
146 | return false;
147 | }
148 | }
149 |
150 | }
151 |
152 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/cache_memcache.class.php:
--------------------------------------------------------------------------------
1 | memcache = new Memcache;
9 | $this->memcache->connect(MEMCACHE_HOST, MEMCACHE_PORT, MEMCACHE_TIMEOUT);
10 | }
11 |
12 | public function memcache() {
13 | $this->__construct();
14 | }
15 |
16 | public function get($name) {
17 | $value = $this->memcache->get($name);
18 | return $value;
19 | }
20 |
21 | public function set($name, $value, $ttl = 0, $ext1='', $ext2='') {
22 | return $this->memcache->set($name, $value, false, $ttl);
23 | }
24 |
25 | public function delete($name) {
26 | return $this->memcache->delete($name);
27 | }
28 |
29 | public function flush() {
30 | return $this->memcache->flush();
31 | }
32 | }
33 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/checkcode.class.php:
--------------------------------------------------------------------------------
1 | doimage();
8 | * //取得验证
9 | * $_SESSION['code']=$checkcode->get_code();
10 | */
11 |
12 | defined('IN_SYS') or exit('No permission resources.');
13 | class checkcode {
14 | //验证码的宽度
15 | public $width=130;
16 |
17 | //验证码的高
18 | public $height=50;
19 |
20 | //设置字体的地址
21 | private $font;
22 |
23 | //设置字体色
24 | public $font_color;
25 |
26 | //设置随机生成因子
27 | public $charset = 'abcdefghkmnprstuvwyzABCDEFGHKLMNPRSTUVWYZ23456789';
28 |
29 | //设置背景色
30 | public $background = '#EDF7FF';
31 |
32 | //生成验证码字符数
33 | public $code_len = 4;
34 |
35 | //字体大小
36 | public $font_size = 20;
37 |
38 | //验证码
39 | private $code;
40 |
41 | //图片内存
42 | private $img;
43 |
44 | //文字X轴开始的地方
45 | private $x_start;
46 |
47 | function __construct() {
48 | $rand = rand(0,1);
49 | if($rand==0) {
50 | $this->font = PC_PATH.'libs'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'font'.DIRECTORY_SEPARATOR.'elephant.ttf';
51 | } else {
52 | $this->font = PC_PATH.'libs'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'font'.DIRECTORY_SEPARATOR.'Vineta.ttf';
53 | }
54 | }
55 |
56 | /**
57 | * 生成随机验证码。
58 | */
59 | protected function creat_code() {
60 | $code = '';
61 | $charset_len = strlen($this->charset)-1;
62 | for ($i=0; $i<$this->code_len; $i++) {
63 | $code .= $this->charset[rand(1, $charset_len)];
64 | }
65 | $this->code = $code;
66 | }
67 |
68 | /**
69 | * 获取验证码
70 | */
71 | public function get_code() {
72 | return strtolower($this->code);
73 | }
74 |
75 | /**
76 | * 生成图片
77 | */
78 | public function doimage() {
79 | $code = $this->creat_code();
80 | $this->img = imagecreatetruecolor($this->width, $this->height);
81 | if (!$this->font_color) {
82 | $this->font_color = imagecolorallocate($this->img, rand(0,156), rand(0,156), rand(0,156));
83 | } else {
84 | $this->font_color = imagecolorallocate($this->img, hexdec(substr($this->font_color, 1,2)), hexdec(substr($this->font_color, 3,2)), hexdec(substr($this->font_color, 5,2)));
85 | }
86 | //设置背景色
87 | $background = imagecolorallocate($this->img,hexdec(substr($this->background, 1,2)),hexdec(substr($this->background, 3,2)),hexdec(substr($this->background, 5,2)));
88 | //画一个柜形,设置背景颜色。
89 | imagefilledrectangle($this->img,0, $this->height, $this->width, 0, $background);
90 | $this->creat_font();
91 | $this->creat_line();
92 | $this->output();
93 | }
94 |
95 | /**
96 | * 生成文字
97 | */
98 | private function creat_font() {
99 | $x = $this->width/$this->code_len;
100 | for ($i=0; $i<$this->code_len; $i++) {
101 | imagettftext($this->img, $this->font_size, rand(-30,30), $x*$i+rand(0,5), $this->height/1.4, $this->font_color, $this->font, $this->code[$i]);
102 | if($i==0)$this->x_start=$x*$i+5;
103 | }
104 | }
105 |
106 | /**
107 | * 画线
108 | */
109 | private function creat_line() {
110 | imagesetthickness($this->img, 3);
111 | $xpos = ($this->font_size * 2) + rand(-5, 5);
112 | $width = $this->width / 2.66 + rand(3, 10);
113 | $height = $this->font_size * 2.14;
114 |
115 | if ( rand(0,100) % 2 == 0 ) {
116 | $start = rand(0,66);
117 | $ypos = $this->height / 2 - rand(10, 30);
118 | $xpos += rand(5, 15);
119 | } else {
120 | $start = rand(180, 246);
121 | $ypos = $this->height / 2 + rand(10, 30);
122 | }
123 |
124 | $end = $start + rand(75, 110);
125 |
126 | imagearc($this->img, $xpos, $ypos, $width, $height, $start, $end, $this->font_color);
127 |
128 | if ( rand(1,75) % 2 == 0 ) {
129 | $start = rand(45, 111);
130 | $ypos = $this->height / 2 - rand(10, 30);
131 | $xpos += rand(5, 15);
132 | } else {
133 | $start = rand(200, 250);
134 | $ypos = $this->height / 2 + rand(10, 30);
135 | }
136 |
137 | $end = $start + rand(75, 100);
138 |
139 | imagearc($this->img, $this->width * .75, $ypos, $width, $height, $start, $end, $this->font_color);
140 | }
141 |
142 | /**
143 | * 输出图片
144 | */
145 | private function output() {
146 | header("content-type:image/png\r\n");
147 | imagepng($this->img);
148 | imagedestroy($this->img);
149 | }
150 | }
--------------------------------------------------------------------------------
/source/libs/classes/db.class.php:
--------------------------------------------------------------------------------
1 | curlink = $link;
11 | $dbcharset && mysql_query('SET sql_mode="",NAMES "'.$dbcharset.'",CHARACTER SET '.$dbcharset.',CHARACTER_SET_RESULTS='.$dbcharset.',COLLATION_CONNECTION="'.$dbcharset.'_general_ci"', $link);
12 | if ( !@$this->select_db($dbname, $link) ){
13 | throw new Exception('mysql:open db error',E_USER_ERROR);
14 | }
15 | }
16 | $this->querynum = 0;
17 | }
18 |
19 | function delete($table,$where='', $limit = 0, $unbuffered = true){
20 | $sql = 'DELETE FROM '.$table.($where ? " WHERE $where" : '').($limit ? " LIMIT $limit" : '');
21 | return $this->query($sql, ($unbuffered ? 'UNBUFFERED' : ''));
22 | }
23 |
24 | function replace($table,$data,$where,$unbuffered=true){
25 | $d = $this->fetch_first("SELECT count(*) as is_exists FROM {$table} WHERE {$where}");
26 | if ( $d['is_exists'] ){
27 | $this->update($table, $data, $where, $unbuffered);
28 | }else{
29 | $this->insert($table, $data, $unbuffered);
30 | }
31 | }
32 |
33 | function update($table, $data,$where='', $unbuffered = false){
34 | //$data=array('key'=>'value',...);
35 | $sql = '';
36 | foreach ($data as $k => $v) {
37 | $sql && $sql .= ',';
38 | $sql .= "`$k`='$v'";
39 | }
40 | $where && $sql .= " WHERE $where";
41 | return $this->query("UPDATE {$table} SET {$sql}",$unbuffered ? 'UNBUFFERED' : '');
42 | }
43 |
44 | function insert($table, $data, $return_insert_id = false){
45 | //$data=array('key'=>'value',...);
46 | $sql1 = $sql2 = '';
47 | foreach ($data as $k => $v) {
48 | if ( $sql1 ){
49 | $sql1 .= ',';
50 | $sql2 .= ',';
51 | }
52 | $sql1 .= "`$k`";
53 | $sql2 .= "'$v'";
54 | }
55 | $return = $this->query("INSERT INTO {$table} ({$sql1}) VALUES ({$sql2})");
56 | if ( $return && $return_insert_id ) {
57 | $return = $this->insert_id();
58 | }
59 | return $return;
60 | }
61 |
62 | static function connect($dbhost, $dbuser, $dbpw, $dbname, $dbcharset='utf8') {
63 | return new db($dbhost, $dbuser, $dbpw, $dbname,$dbcharset);
64 | }
65 |
66 | function select_db($dbname) {
67 | return mysql_select_db($dbname, $this->curlink);
68 | }
69 |
70 | function fetch_array($query, $result_type = MYSQL_ASSOC) {
71 | return mysql_fetch_array($query, $result_type);
72 | }
73 |
74 | function fetch_first($sql) {
75 | return $this->fetch_array($this->query($sql));
76 | }
77 |
78 | function result_first($sql) {
79 | return $this->result($this->query($sql), 0);
80 | }
81 |
82 | function query($sql, $type = '') {
83 | $func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ? 'mysql_unbuffered_query' : 'mysql_query';
84 | if(!($query = $func($sql, $this->curlink))) {
85 | if(in_array($this->errno(), array(2006, 2013)) && substr($type, 0, 5) != 'RETRY') {
86 | $this->connect();
87 | return $this->query($sql, 'RETRY'.$type);
88 | }
89 | if($type != 'SILENT' && substr($type, 5) != 'SILENT') {
90 | //$this->halt('语句错误', $sql);
91 | return false;
92 | }
93 | }
94 | //echo $sql.'
';
95 | $this->querynum++;
96 | return $query;
97 | }
98 |
99 | function affected_rows() {
100 | return mysql_affected_rows($this->curlink);
101 | }
102 |
103 | function error() {
104 | return isset($this->curlink) ? mysql_error($this->curlink) : mysql_error();
105 | }
106 |
107 | function errno() {
108 | return isset($this->curlink) ? mysql_errno($this->curlink) : mysql_errno();
109 | }
110 |
111 | function result($query, $row = 0) {
112 | return @mysql_result($query, $row);
113 | }
114 |
115 | function num_rows($query) {
116 | return mysql_num_rows($query);
117 | }
118 |
119 | function num_fields($query) {
120 | return mysql_num_fields($query);
121 | }
122 |
123 | function free_result($query) {
124 | return mysql_free_result($query);
125 | }
126 |
127 | function insert_id() {
128 | return ($id = mysql_insert_id($this->curlink)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
129 | }
130 |
131 | function fetch_row($query) {
132 | $query = mysql_fetch_row($query);
133 | return $query;
134 | }
135 |
136 | function fetch_fields($query) {
137 | return mysql_fetch_field($query);
138 | }
139 |
140 | function version() {
141 | if(empty($this->version)) {
142 | $this->version = mysql_get_server_info($this->curlink);
143 | }
144 | return $this->version;
145 | }
146 |
147 | function close() {
148 | return @mysql_close($this->curlink);
149 | }
150 |
151 | function halt($message='',$sql='') {
152 | if ( $sql ){
153 | $sql = "\r\n".$sql;
154 | }
155 | $str = $message."\r\n".$this->errno().$sql."\r\n".$this->error();
156 | throw new Exception($str,E_USER_ERROR);
157 | //write_log(__FILE__,__line__,$str);
158 |
159 | }
160 |
161 | function __destruct(){
162 | $this->close();
163 | }
164 |
165 | function escape_string($str) {
166 | if ( is_array($str) ) {
167 | return array_map(array($this,'escape_string'), $str);
168 | }else{
169 | return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $str);
170 | }
171 | //return is_array($str) ? array_map('escape_string', $str) : mysql_real_escape_string($str, $this->curlink);
172 | }
173 |
174 |
175 | function unescape_string($str) {
176 | if ( is_array($str) ) {
177 | return array_map(array($this,'unescape_string'), $str);
178 | }else{
179 | return str_replace(array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), $str);
180 | }
181 | }
182 |
183 | static function safe_string($str) {
184 | if ( is_array($str) ) {
185 | return array_map(array($this,'safe_string'), $str);
186 | }else{
187 | return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), '', $str);
188 | }
189 | }
190 |
191 | }
192 |
--------------------------------------------------------------------------------
/source/libs/classes/db_factory.class.php:
--------------------------------------------------------------------------------
1 | db_config) db_factory::$db_factory->db_config = array_merge($db_config, db_factory::$db_factory->db_config);
45 | return db_factory::$db_factory;
46 | }
47 |
48 | /**
49 | * 获取数据库操作实例
50 | * @param $db_name 数据库配置名称
51 | */
52 | public function get_database($db_name) {
53 | if(!isset($this->db_list[$db_name]) || !is_object($this->db_list[$db_name])) {
54 | $this->db_list[$db_name] = $this->connect($db_name);
55 | }
56 | return $this->db_list[$db_name];
57 | }
58 |
59 | /**
60 | * 加载数据库驱动
61 | * @param $db_name 数据库配置名称
62 | * @return object
63 | */
64 | public function connect($db_name) {
65 | $object = null;
66 | switch($this->db_config[$db_name]['type']) {
67 | case 'mysql' :
68 | pc_base::load_sys_class('mysql', '', 0);
69 | $object = new mysql();
70 | break;
71 | case 'mysqli' :
72 | $object = pc_base::load_sys_class('mysqli');
73 | break;
74 | case 'access' :
75 | $object = pc_base::load_sys_class('db_access');
76 | break;
77 | default :
78 | pc_base::load_sys_class('mysql', '', 0);
79 | $object = new mysql();
80 | }
81 | $object->open($this->db_config[$db_name]);
82 | return $object;
83 | }
84 |
85 | /**
86 | * 关闭数据库连接
87 | * @return void
88 | */
89 | protected function close() {
90 | foreach($this->db_list as $db) {
91 | $db->close();
92 | }
93 | }
94 |
95 | /**
96 | * 析构函数
97 | */
98 | public function __destruct() {
99 | $this->close();
100 | }
101 | }
102 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/form.class.php:
--------------------------------------------------------------------------------
1 |
35 |
36 |
37 |
38 | ';
39 | }
40 | $str .= ' ';
41 | $str .= '';
52 | return $str;
53 | }
54 |
55 | /**
56 | * 下拉选择框
57 | */
58 | public static function select($array = array(), $id = 0, $str = '', $default_option = '') {
59 | $string = '';
70 | return $string;
71 | }
72 |
73 | /**
74 | * 复选框
75 | *
76 | * @param $array 选项 二维数组
77 | * @param $id 默认选中值,多个用 '逗号'分割
78 | * @param $str 属性
79 | * @param $defaultvalue 是否增加默认值 默认值为 -99
80 | * @param $width 宽度
81 | */
82 | public static function checkbox($array = array(), $id = '', $str = '', $defaultvalue = '', $width = 0, $field = '') {
83 | $string = '';
84 | $id = trim($id);
85 | if($id != '') $id = strpos($id, ',') ? explode(',', $id) : array($id);
86 | if($defaultvalue) $string .= '';
87 | $i = 1;
88 | foreach($array as $key=>$value) {
89 | $key = trim($key);
90 | $checked = ($id && in_array($key, $id)) ? 'checked' : '';
91 | if($width) $string .= '';
94 | $i++;
95 | }
96 | return $string;
97 | }
98 |
99 | /**
100 | * 单选框
101 | *
102 | * @param $array 选项 二维数组
103 | * @param $id 默认选中值
104 | * @param $str 属性
105 | */
106 | public static function radio($array = array(), $id = 0, $str = '', $width = 0, $field = '') {
107 | $string = '';
108 | foreach($array as $key=>$value) {
109 | $checked = trim($id)==trim($key) ? 'checked' : '';
110 | if($width) $string .= '';
113 | }
114 | return $string;
115 | }
116 |
117 | /**
118 | * 验证码
119 | * @param string $id 生成的验证码ID
120 | * @param integer $code_len 生成多少位验证码
121 | * @param integer $font_size 验证码字体大小
122 | * @param integer $width 验证图片的宽
123 | * @param integer $height 验证码图片的高
124 | * @param string $font 使用什么字体,设置字体的URL
125 | * @param string $font_color 字体使用什么颜色
126 | * @param string $background 背景使用什么颜色
127 | */
128 | public static function checkcode($id = 'checkcode',$code_len = 4, $font_size = 20, $width = 130, $height = 36, $font = '', $font_color = '', $background = '') {
129 | return "";
130 | }
131 | }
132 |
133 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/model.class.php:
--------------------------------------------------------------------------------
1 | db_config[$this->db_setting])) {
25 | $this->db_setting = 'default';
26 | }
27 | $this->table_name = $this->db_config[$this->db_setting]['tablepre'].$this->table_name;
28 | $this->db_tablepre = $this->db_config[$this->db_setting]['tablepre'];
29 | $this->db = db_factory::get_instance($this->db_config)->get_database($this->db_setting);
30 | }
31 |
32 | /**
33 | * 执行sql查询
34 | * @param $where 查询条件[例`name`='$name']
35 | * @param $data 需要查询的字段值[例`name`,`gender`,`birthday`]
36 | * @param $limit 返回结果范围[例:10或10,10 默认为空]
37 | * @param $order 排序方式 [默认按数据库默认方式排序]
38 | * @param $group 分组方式 [默认为空]
39 | * @param $key 返回数组按键名排序
40 | * @return array 查询结果集数组
41 | */
42 | final public function select($where = '', $data = '*', $limit = '', $order = '', $group = '', $key='') {
43 | if (is_array($where)) $where = $this->sqls($where);
44 | return $this->db->select($data, $this->table_name, $where, $limit, $order, $group, $key);
45 | }
46 |
47 | /**
48 | * 查询多条数据并分页
49 | * @param $where
50 | * @param $order
51 | * @param $page
52 | * @param $pagesize
53 | * @return unknown_type
54 | */
55 | final public function listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array(), $data = '*') {
56 | $where = to_sqls($where);
57 | $this->number = $this->count($where);
58 | $page = max(intval($page), 1);
59 | $offset = $pagesize*($page-1);
60 | $this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);
61 | $array = array();
62 | if ($this->number > 0) {
63 | return $this->select($where, $data, "$offset, $pagesize", $order, '', $key);
64 | } else {
65 | return array();
66 | }
67 | }
68 |
69 | /**
70 | * 获取单条记录查询
71 | * @param $where 查询条件
72 | * @param $data 需要查询的字段值[例`name`,`gender`,`birthday`]
73 | * @param $order 排序方式 [默认按数据库默认方式排序]
74 | * @param $group 分组方式 [默认为空]
75 | * @return array/null 数据查询结果集,如果不存在,则返回空
76 | */
77 | final public function get_one($where = '', $data = '*', $order = '', $group = '') {
78 | if (is_array($where)) $where = $this->sqls($where);
79 | return $this->db->get_one($data, $this->table_name, $where, $order, $group);
80 | }
81 |
82 | /**
83 | * 直接执行sql查询
84 | * @param $sql 查询sql语句
85 | * @return boolean/query resource 如果为查询语句,返回资源句柄,否则返回true/false
86 | */
87 | final public function query($sql) {
88 | $sql = str_replace('phpapp_', $this->db_tablepre, $sql);
89 | return $this->db->query($sql);
90 | }
91 |
92 | /**
93 | * 执行添加记录操作
94 | * @param $data 要增加的数据,参数为数组。数组key为字段值,数组值为数据取值
95 | * @param $return_insert_id 是否返回新建ID号
96 | * @param $replace 是否采用 replace into的方式添加数据
97 | * @return boolean
98 | */
99 | final public function insert($data, $return_insert_id = false, $replace = false) {
100 | return $this->db->insert($data, $this->table_name, $return_insert_id, $replace);
101 | }
102 |
103 | /**
104 | * 获取最后一次添加记录的主键号
105 | * @return int
106 | */
107 | final public function insert_id() {
108 | return $this->db->insert_id();
109 | }
110 |
111 | /**
112 | * 执行更新记录操作
113 | * @param $data 要更新的数据内容,参数可以为数组也可以为字符串,建议数组。
114 | * 为数组时数组key为字段值,数组值为数据取值
115 | * 为字符串时[例:`name`='phpapp',`hits`=`hits`+1]。
116 | * 为数组时[例: array('name'=>'phpapp','password'=>'123456')]
117 | * 数组的另一种使用array('name'=>'+=1', 'base'=>'-=1');程序会自动解析为`name` = `name` + 1, `base` = `base` - 1
118 | * @param $where 更新数据时的条件,可为数组或字符串
119 | * @return boolean
120 | */
121 | final public function update($data, $where = '') {
122 | if (is_array($where)) $where = $this->sqls($where);
123 | return $this->db->update($data, $this->table_name, $where);
124 | }
125 |
126 | /**
127 | * 执行删除记录操作
128 | * @param $where 删除数据条件,不充许为空。
129 | * @return boolean
130 | */
131 | final public function delete($where) {
132 | if (is_array($where)) $where = $this->sqls($where);
133 | return $this->db->delete($this->table_name, $where);
134 | }
135 |
136 | /**
137 | * 计算记录数
138 | * @param string/array $where 查询条件
139 | */
140 | final public function count($where = '') {
141 | $r = $this->get_one($where, "COUNT(*) AS num");
142 | return $r['num'];
143 | }
144 |
145 | /**
146 | * 字段求和
147 | */
148 | final public function sum($field, $where = '') {
149 | $r = $this->get_one($where, "SUM($field) AS total");
150 | return $r['total'];
151 | }
152 |
153 | /**
154 | * 将数组转换为SQL语句
155 | * @param array $where 要生成的数组
156 | * @param string $font 连接串。
157 | */
158 | final public function sqls($where, $font = ' AND ') {
159 | if (is_array($where)) {
160 | $sql = '';
161 | foreach ($where as $key=>$val) {
162 | $sql .= $sql ? " $font `$key` = '$val' " : " `$key` = '$val'";
163 | }
164 | return $sql;
165 | } else {
166 | return $where;
167 | }
168 | }
169 |
170 | /**
171 | * 获取最后数据库操作影响到的条数
172 | * @return int
173 | */
174 | final public function affected_rows() {
175 | return $this->db->affected_rows();
176 | }
177 |
178 | /**
179 | * 获取数据表主键
180 | * @return array
181 | */
182 | final public function get_primary() {
183 | return $this->db->get_primary($this->table_name);
184 | }
185 |
186 | /**
187 | * 获取表字段
188 | * @param string $table_name 表名
189 | * @return array
190 | */
191 | final public function get_fields($table_name = '') {
192 | if (empty($table_name)) {
193 | $table_name = $this->table_name;
194 | } else {
195 | $table_name = $this->db_tablepre.$table_name;
196 | }
197 | return $this->db->get_fields($table_name);
198 | }
199 |
200 | /**
201 | * 检查表是否存在
202 | * @param $table 表名
203 | * @return boolean
204 | */
205 | final public function table_exists($table){
206 | return $this->db->table_exists($this->db_tablepre.$table);
207 | }
208 |
209 | /**
210 | * 检查字段是否存在
211 | * @param $field 字段名
212 | * @return boolean
213 | */
214 | public function field_exists($field) {
215 | $fields = $this->db->get_fields($this->table_name);
216 | return array_key_exists($field, $fields);
217 | }
218 |
219 | final public function list_tables() {
220 | return $this->db->list_tables();
221 | }
222 | /**
223 | * 返回数据结果集
224 | * @param $query (mysql_query返回值)
225 | * @return array
226 | */
227 | final public function fetch_array() {
228 | $data = array();
229 | while($r = $this->db->fetch_next()) {
230 | $data[] = $r;
231 | }
232 | return $data;
233 | }
234 |
235 | /**
236 | * 返回数据库版本号
237 | */
238 | final public function version() {
239 | return $this->db->version();
240 | }
241 | }
--------------------------------------------------------------------------------
/source/libs/classes/param.class.php:
--------------------------------------------------------------------------------
1 | route_config = pc_base::load_config('route', SITE_URL) ? pc_base::load_config('route', SITE_URL) : pc_base::load_config('route', 'default');
22 |
23 | if(isset($this->route_config['data']['POST']) && is_array($this->route_config['data']['POST'])) {
24 | foreach($this->route_config['data']['POST'] as $_key => $_value) {
25 | if(!isset($_POST[$_key])) $_POST[$_key] = $_value;
26 | }
27 | }
28 | if(isset($this->route_config['data']['GET']) && is_array($this->route_config['data']['GET'])) {
29 | foreach($this->route_config['data']['GET'] as $_key => $_value) {
30 | if(!isset($_GET[$_key])) $_GET[$_key] = $_value;
31 | }
32 | }
33 | if(isset($_GET['page'])) {
34 | $_GET['page'] = max(intval($_GET['page']),1);
35 | $_GET['page'] = min($_GET['page'],1000000000);
36 | }
37 | return true;
38 | }
39 |
40 | /**
41 | * 获取模型
42 | */
43 | public function route_m() {
44 | $m = isset($_GET['m']) && !empty($_GET['m']) ? $_GET['m'] : (isset($_POST['m']) && !empty($_POST['m']) ? $_POST['m'] : '');
45 | $m = $this->safe_deal($m);
46 | if (empty($m)) {
47 | return $this->route_config['m'];
48 | } else {
49 | if(is_string($m)) return $m;
50 | }
51 | }
52 |
53 | /**
54 | * 获取控制器
55 | */
56 | public function route_c() {
57 | $c = isset($_GET['c']) && !empty($_GET['c']) ? $_GET['c'] : (isset($_POST['c']) && !empty($_POST['c']) ? $_POST['c'] : '');
58 | $c = $this->safe_deal($c);
59 | if (empty($c)) {
60 | return $this->route_config['c'];
61 | } else {
62 | if(is_string($c)) return $c;
63 | }
64 | }
65 |
66 | /**
67 | * 获取事件
68 | */
69 | public function route_a() {
70 | $a = isset($_GET['a']) && !empty($_GET['a']) ? $_GET['a'] : (isset($_POST['a']) && !empty($_POST['a']) ? $_POST['a'] : '');
71 | $a = $this->safe_deal($a);
72 | if (empty($a)) {
73 | return $this->route_config['a'];
74 | } else {
75 | if(is_string($a)) return $a;
76 | }
77 | }
78 |
79 | /**
80 | * 设置 cookie
81 | * @param string $var 变量名
82 | * @param string $value 变量值
83 | * @param int $time 过期时间
84 | */
85 | public static function set_cookie($var, $value = '', $time = 0) {
86 | $time = $time > 0 ? $time : ($value == '' ? SYS_TIME - 3600 : 0);
87 | $s = $_SERVER['SERVER_PORT'] == '443' ? 1 : 0;
88 | $var = pc_base::load_config('system','cookie_pre').$var;
89 | $_COOKIE[$var] = $value;
90 | if (is_array($value)) {
91 | foreach($value as $k=>$v) {
92 | setcookie($var.'['.$k.']', sys_auth($v, 'ENCODE'), $time, pc_base::load_config('system','cookie_path'), pc_base::load_config('system','cookie_domain'), $s);
93 | }
94 | } else {
95 | setcookie($var, sys_auth($value, 'ENCODE'), $time, pc_base::load_config('system','cookie_path'), pc_base::load_config('system','cookie_domain'), $s);
96 | }
97 | }
98 |
99 | /**
100 | * 获取通过 set_cookie 设置的 cookie 变量
101 | * @param string $var 变量名
102 | * @param string $default 默认值
103 | * @return mixed 成功则返回cookie 值,否则返回 false
104 | */
105 | public static function get_cookie($var, $default = '') {
106 | $var = pc_base::load_config('system','cookie_pre').$var;
107 | $value = isset($_COOKIE[$var]) ? sys_auth($_COOKIE[$var], 'DECODE') : $default;
108 | if(in_array($var,array('_userid','siteid'))) {
109 | $value = intval($value);
110 | } elseif($var=='_usename') {
111 | $value = safe_replace($value);
112 | }
113 | return $value;
114 | }
115 |
116 | /**
117 | * 安全处理函数
118 | * 处理m,a,c
119 | */
120 | private function safe_deal($str) {
121 | return str_replace(array('/', '.'), '', $str);
122 | }
123 |
124 | }
125 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/session_files.class.php:
--------------------------------------------------------------------------------
1 | 0 ? pc_base::load_config('system', 'session_n').';'.pc_base::load_config('system', 'session_savepath') : pc_base::load_config('system', 'session_savepath');
7 | ini_set('session.save_handler', 'files');
8 | session_save_path($path);
9 | session_start();
10 | }
11 | }
12 | ?>
--------------------------------------------------------------------------------
/source/libs/classes/session_mysql.class.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('session_model');
19 | $this->lifetime = pc_base::load_config('system','session_ttl');
20 | session_set_save_handler(array(&$this,'open'), array(&$this,'close'), array(&$this,'read'), array(&$this,'write'), array(&$this,'destroy'), array(&$this,'gc'));
21 | session_start();
22 | }
23 | /**
24 | * session_set_save_handler open方法
25 | * @param $save_path
26 | * @param $session_name
27 | * @return true
28 | */
29 | public function open($save_path, $session_name) {
30 |
31 | return true;
32 | }
33 | /**
34 | * session_set_save_handler close方法
35 | * @return bool
36 | */
37 | public function close() {
38 | return $this->gc($this->lifetime);
39 | }
40 | /**
41 | * 读取session_id
42 | * session_set_save_handler read方法
43 | * @return string 读取session_id
44 | */
45 | public function read($id) {
46 | $r = $this->db->get_one(array('sessionid'=>$id), 'data');
47 | return $r ? $r['data'] : '';
48 | }
49 | /**
50 | * 写入session_id 的值
51 | *
52 | * @param $id session
53 | * @param $data 值
54 | * @return mixed query 执行结果
55 | */
56 | public function write($id, $data) {
57 | $uid = isset($_SESSION['ctrl_userid']) ? $_SESSION['ctrl_userid'] : 0;
58 | $roleid = isset($_SESSION['ctrl_roleid']) ? $_SESSION['ctrl_roleid'] : 0;
59 | $groupid = isset($_SESSION['ctrl_groupid']) ? $_SESSION['ctrl_groupid'] : 0;
60 | $m = defined('ROUTE_M') ? ROUTE_M : '';
61 | $c = defined('ROUTE_C') ? ROUTE_C : '';
62 | $a = defined('ROUTE_A') ? ROUTE_A : '';
63 | if(strlen($data) > 255) $data = '';
64 | $ip = ip();
65 | $sessiondata = array(
66 | 'sessionid'=>$id,
67 | 'userid'=>$uid,
68 | 'ip'=>$ip,
69 | 'lastvisit'=>SYS_TIME,
70 | 'roleid'=>$roleid,
71 | 'groupid'=>$groupid,
72 | 'm'=>$m,
73 | 'c'=>$c,
74 | 'a'=>$a,
75 | 'data'=>$data,
76 | );
77 | return $this->db->insert($sessiondata, 1, 1);
78 | }
79 | /**
80 | * 删除指定的session_id
81 | *
82 | * @param $id session
83 | * @return bool
84 | */
85 | public function destroy($id) {
86 | return $this->db->delete(array('sessionid'=>$id));
87 | }
88 | /**
89 | * 删除过期的 session
90 | *
91 | * @param $maxlifetime 存活期时间
92 | * @return bool
93 | */
94 | public function gc($maxlifetime) {
95 | $expiretime = SYS_TIME - $maxlifetime;
96 | return $this->db->delete("`lastvisit`<$expiretime");
97 | }
98 | }
99 | ?>
--------------------------------------------------------------------------------
/source/libs/data/dict/dict.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/source/libs/data/dict/dict.csv
--------------------------------------------------------------------------------
/source/libs/data/font/Vineta.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/source/libs/data/font/Vineta.ttf
--------------------------------------------------------------------------------
/source/libs/data/font/elephant.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/source/libs/data/font/elephant.ttf
--------------------------------------------------------------------------------
/source/libs/data/font/georgia.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/source/libs/data/font/georgia.ttf
--------------------------------------------------------------------------------
/source/libs/data/ipdata/mini.Dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Johnhacker/FromX/7d3c413d1cee837341edc9e6876484b71458f7f6/source/libs/data/ipdata/mini.Dat
--------------------------------------------------------------------------------
/source/libs/functions/dir.func.php:
--------------------------------------------------------------------------------
1 | $id,'parentid'=>$parentid, 'name'=>basename($v), 'dir'=>$v.'/');
135 | $dirs = dir_tree($v.'/', $id, $dirs);
136 | }
137 | }
138 | return $dirs;
139 | }
140 |
141 | /**
142 | * 删除目录及目录下面的所有文件
143 | *
144 | * @param string $dir 路径
145 | * @return bool 如果成功则返回 TRUE,失败则返回 FALSE
146 | */
147 | function dir_delete($dir) {
148 | $dir = dir_path($dir);
149 | if (!is_dir($dir)) return FALSE;
150 | $list = glob($dir.'*');
151 | foreach($list as $v) {
152 | is_dir($v) ? dir_delete($v) : @unlink($v);
153 | }
154 | return @rmdir($dir);
155 | }
156 |
157 | ?>
--------------------------------------------------------------------------------
/source/libs/functions/extention.func.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/source/libs/functions/iconv.func.php:
--------------------------------------------------------------------------------
1 | 0x80) {
61 | $thisW = substr($gbstr, 0, 2);
62 | $gbstr = substr($gbstr, 2, strlen($gbstr));
63 | $utf8 = '';
64 | @$utf8 = unicode_to_utf8(hexdec($CODETABLE[hexdec(bin2hex($thisW)) - 0x8080]));
65 | if($utf8 != '') {
66 | for($i = 0; $i < strlen($utf8); $i += 3) $ret .= chr(substr($utf8, $i, 3));
67 | }
68 | } else {
69 | $ret .= substr($gbstr, 0, 1);
70 | $gbstr = substr($gbstr, 1, strlen($gbstr));
71 | }
72 | }
73 | return $ret;
74 | }
75 | /**
76 | * 繁体转简体
77 | * @param $Text
78 | */
79 | function big5_to_gbk($Text) {
80 | global $BIG5_DATA;
81 | if(empty($BIG5_DATA)) {
82 | $filename = CODETABLEDIR.'big5-gb.table';
83 | $fp = fopen($filename, 'rb');
84 | $BIG5_DATA = fread($fp, filesize($filename));
85 | fclose($fp);
86 | }
87 | $max = strlen($Text)-1;
88 | for($i = 0; $i < $max; $i++) {
89 | $h = ord($Text[$i]);
90 | if($h >= 0x80) {
91 | $l = ord($Text[$i+1]);
92 | if($h==161 && $l==64) {
93 | $gbstr = ' ';
94 | } else {
95 | $p = ($h-160)*510+($l-1)*2;
96 | $gbstr = $BIG5_DATA[$p].$BIG5_DATA[$p+1];
97 | }
98 | $Text[$i] = $gbstr[0];
99 | $Text[$i+1] = $gbstr[1];
100 | $i++;
101 | }
102 | }
103 | return $Text;
104 | }
105 | /**
106 | * 简体转繁体
107 | * @param $Text
108 | */
109 | function gbk_to_big5($Text) {
110 | global $GB_DATA;
111 | if(empty($GB_DATA)) {
112 | $filename = CODETABLEDIR.'gb-big5.table';
113 | $fp = fopen($filename, 'rb');
114 | $gb = fread($fp, filesize($filename));
115 | fclose($fp);
116 | }
117 | $max = strlen($Text)-1;
118 | for($i = 0; $i < $max; $i++) {
119 | $h = ord($Text[$i]);
120 | if($h >= 0x80) {
121 | $l = ord($Text[$i+1]);
122 | if($h==161 && $l==64) {
123 | $big = ' ';
124 | } else {
125 | $p = ($h-160)*510+($l-1)*2;
126 | $big = $GB_DATA[$p].$GB_DATA[$p+1];
127 | }
128 | $Text[$i] = $big[0];
129 | $Text[$i+1] = $big[1];
130 | $i++;
131 | }
132 | }
133 | return $Text;
134 | }
135 | /**
136 | * unicode转utf8
137 | * @param $c
138 | */
139 | function unicode_to_utf8($c) {
140 | $str = '';
141 | if($c < 0x80) {
142 | $str .= $c;
143 | } elseif($c < 0x800) {
144 | $str .= (0xC0 | $c >> 6);
145 | $str .= (0x80 | $c & 0x3F);
146 | } elseif($c < 0x10000) {
147 | $str .= (0xE0 | $c >> 12);
148 | $str .= (0x80 | $c >> 6 & 0x3F);
149 | $str .= (0x80 | $c & 0x3F);
150 | } elseif($c < 0x200000) {
151 | $str .= (0xF0 | $c >> 18);
152 | $str .= (0x80 | $c >> 12 & 0x3F);
153 | $str .= (0x80 | $c >> 6 & 0x3F);
154 | $str .= (0x80 | $c & 0x3F);
155 | }
156 | return $str;
157 | }
158 | /**
159 | * utf8转unicode
160 | * @param $c
161 | */
162 | function utf8_to_unicode($c) {
163 | switch(strlen($c)) {
164 | case 1:
165 | return ord($c);
166 | case 2:
167 | $n = (ord($c[0]) & 0x3f) << 6;
168 | $n += ord($c[1]) & 0x3f;
169 | return $n;
170 | case 3:
171 | $n = (ord($c[0]) & 0x1f) << 12;
172 | $n += (ord($c[1]) & 0x3f) << 6;
173 | $n += ord($c[2]) & 0x3f;
174 | return $n;
175 | case 4:
176 | $n = (ord($c[0]) & 0x0f) << 18;
177 | $n += (ord($c[1]) & 0x3f) << 12;
178 | $n += (ord($c[2]) & 0x3f) << 6;
179 | $n += ord($c[3]) & 0x3f;
180 | return $n;
181 | }
182 | }
183 |
184 | /**
185 | * Ascii转拼音
186 | * @param $asc
187 | * @param $pyarr
188 | */
189 | function asc_to_pinyin($asc,&$pyarr) {
190 | if($asc < 128)return chr($asc);
191 | elseif(isset($pyarr[$asc]))return $pyarr[$asc];
192 | else {
193 | foreach($pyarr as $id => $p) {
194 | if($id >= $asc)return $p;
195 | }
196 | }
197 | }
198 | /**
199 | * gbk转拼音
200 | * @param $txt
201 | */
202 | function gbk_to_pinyin($txt) {
203 | if(CHARSET != 'gbk') {
204 | $txt = iconv(CHARSET,'GBK',$txt);
205 | }
206 | $l = strlen($txt);
207 | $i = 0;
208 | $pyarr = array();
209 | $py = array();
210 | $filename = CODETABLEDIR.'gb-pinyin.table';
211 | $fp = fopen($filename,'r');
212 | while(!feof($fp)) {
213 | $p = explode("-",fgets($fp,32));
214 | $pyarr[intval($p[1])] = trim($p[0]);
215 | }
216 | fclose($fp);
217 | ksort($pyarr);
218 | while($i<$l) {
219 | $tmp = ord($txt[$i]);
220 | if($tmp>=128) {
221 | $asc = abs($tmp*256+ord($txt[$i+1])-65536);
222 | $i = $i+1;
223 | } else $asc = $tmp;
224 | $py[] = asc_to_pinyin($asc,$pyarr);
225 | $i++;
226 | }
227 | return $py;
228 | }
229 | ?>
--------------------------------------------------------------------------------
/source/libs/functions/mail.func.php:
--------------------------------------------------------------------------------
1 | 2,
41 | 'maildelimiter' => 1,
42 | 'mailusername' => 1,
43 | 'server' => $cfg['mail_server'],
44 | 'port' => $cfg['mail_port'],
45 | 'auth' => $cfg['mail_auth'],
46 | 'from' => $cfg['mail_from'],
47 | 'auth_username' => $cfg['mail_user'],
48 | 'auth_password' => $cfg['mail_password']
49 | );
50 | }
51 | //mail 发送模式
52 | if($mail_type==0) {
53 | $headers = 'MIME-Version: 1.0' . "\r\n";
54 | $headers .= 'Content-type: text/html; charset='.CHARSET.'' . "\r\n";
55 | $headers .= 'From: '.$sitename.' <'.$from.'>' . "\r\n";
56 | mail($toemail, $subject, $message, $headers);
57 | return true;
58 | }
59 | //邮件头的分隔符
60 | $maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n");
61 | //收件人地址中包含用户名
62 | $mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1;
63 | //端口
64 | $mail['port'] = $mail['port'] ? $mail['port'] : 25;
65 | $mail['mailsend'] = $mail['mailsend'] ? $mail['mailsend'] : 1;
66 |
67 | //发信者
68 | $email_from = $from == '' ? '=?'.CHARSET.'?B?'.base64_encode($sitename)."?= <".$from.">" : (preg_match('/^(.+?) \<(.+?)\>$/',$from, $mats) ? '=?'.CHARSET.'?B?'.base64_encode($mats[1])."?= <$mats[2]>" : $from);
69 |
70 | $email_to = preg_match('/^(.+?) \<(.+?)\>$/',$toemail, $mats) ? ($mailusername ? '=?'.CHARSET.'?B?'.base64_encode($mats[1])."?= <$mats[2]>" : $mats[2]) : $toemail;;
71 |
72 | $email_subject = '=?'.CHARSET.'?B?'.base64_encode(preg_replace("/[\r|\n]/", '', '['.$sitename.'] '.$subject)).'?=';
73 | $email_message = chunk_split(base64_encode(str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $message))))));
74 |
75 | $headers = "From: $email_from{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: {$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/html; charset=".CHARSET."{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}";
76 |
77 | if(!$fp = fsockopen($mail['server'], $mail['port'], $errno, $errstr, 30)) {
78 | runlog('SMTP', "($mail[server]:$mail[port]) CONNECT - Unable to connect to the SMTP server", 0);
79 | return false;
80 | }
81 | stream_set_blocking($fp, true);
82 |
83 | $lastmessage = fgets($fp, 512);
84 | if(substr($lastmessage, 0, 3) != '220') {
85 | runlog('SMTP', "$mail[server]:$mail[port] CONNECT - $lastmessage", 0);
86 | return false;
87 | }
88 |
89 | fputs($fp, ($mail['auth'] ? 'EHLO' : 'HELO')." \r\n");
90 | $lastmessage = fgets($fp, 512);
91 | if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) {
92 | runlog('SMTP', "($mail[server]:$mail[port]) HELO/EHLO - $lastmessage", 0);
93 | return false;
94 | }
95 |
96 | while(1) {
97 | if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) {
98 | break;
99 | }
100 | $lastmessage = fgets($fp, 512);
101 | }
102 |
103 | if($mail['auth']) {
104 | fputs($fp, "AUTH LOGIN\r\n");
105 | $lastmessage = fgets($fp, 512);
106 | if(substr($lastmessage, 0, 3) != 334) {
107 | runlog('SMTP', "($mail[server]:$mail[port]) AUTH LOGIN - $lastmessage", 0);
108 | return false;
109 | }
110 |
111 | fputs($fp, base64_encode($mail['auth_username'])."\r\n");
112 | $lastmessage = fgets($fp, 512);
113 | if(substr($lastmessage, 0, 3) != 334) {
114 | runlog('SMTP', "($mail[server]:$mail[port]) USERNAME - $lastmessage", 0);
115 | return false;
116 | }
117 |
118 | fputs($fp, base64_encode($mail['auth_password'])."\r\n");
119 | $lastmessage = fgets($fp, 512);
120 | if(substr($lastmessage, 0, 3) != 235) {
121 | runlog('SMTP', "($mail[server]:$mail[port]) PASSWORD - $lastmessage", 0);
122 | return false;
123 | }
124 |
125 | $email_from = $mail['from'];
126 | }
127 |
128 | fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n");
129 | $lastmessage = fgets($fp, 512);
130 | if(substr($lastmessage, 0, 3) != 250) {
131 | fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n");
132 | $lastmessage = fgets($fp, 512);
133 | if(substr($lastmessage, 0, 3) != 250) {
134 | runlog('SMTP', "($mail[server]:$mail[port]) MAIL FROM - $lastmessage", 0);
135 | return false;
136 | }
137 | }
138 |
139 | fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $toemail).">\r\n");
140 | $lastmessage = fgets($fp, 512);
141 | if(substr($lastmessage, 0, 3) != 250) {
142 | fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $toemail).">\r\n");
143 | $lastmessage = fgets($fp, 512);
144 | runlog('SMTP', "($mail[server]:$mail[port]) RCPT TO - $lastmessage", 0);
145 | return false;
146 | }
147 |
148 | fputs($fp, "DATA\r\n");
149 | $lastmessage = fgets($fp, 512);
150 | if(substr($lastmessage, 0, 3) != 354) {
151 | runlog('SMTP', "($mail[server]:$mail[port]) DATA - $lastmessage", 0);
152 | return false;
153 | }
154 |
155 | $headers .= 'Message-ID: <'.gmdate('YmdHs').'.'.substr(md5($email_message.microtime()), 0, 6).rand(100000, 999999).'@'.$_SERVER['HTTP_HOST'].">{$maildelimiter}";
156 |
157 | fputs($fp, "Date: ".gmdate('r')."\r\n");
158 | fputs($fp, "To: ".$email_to."\r\n");
159 | fputs($fp, "Subject: ".$email_subject."\r\n");
160 | fputs($fp, $headers."\r\n");
161 | fputs($fp, "\r\n\r\n");
162 | fputs($fp, "$email_message\r\n.\r\n");
163 | $lastmessage = fgets($fp, 512);
164 | if(substr($lastmessage, 0, 3) != 250) {
165 | runlog('SMTP', "($mail[server]:$mail[port]) END - $lastmessage", 0);
166 | }
167 | fputs($fp, "QUIT\r\n");
168 | return true;
169 | }
170 | ?>
--------------------------------------------------------------------------------
/source/model/admin_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'admin';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/adminlogs_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'adminlogs';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/bmfz_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'bmfz';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/bzks_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'bzks';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/diqu_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'diqu';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/edlogs_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'edlogs';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/email_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'email';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/ipbanned_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
9 | $this->db_setting = 'default';
10 | $this->table_name = 'ipbanned';
11 | parent::__construct();
12 | }
13 |
14 | /**
15 | *
16 | * 把IP进行格式化,统一为IPV4, 参数:$op --操作类型 max 表示格式为该段的最大值,比如:192.168.1.* 格式化为:192.168.1.255 ,其它任意值表示格式化最小值: 192.168.1.1
17 | * @param $op 操作类型,值为(min,max)
18 | * @param $ip 要处理的IP段(127.0.0.*) 或者IP值 (127.0.0.5)
19 | */
20 | public function convert_ip($op,$ip){
21 | $arr_ip = explode(".",$ip);
22 | $arr_temp = array();
23 | $i = 0;
24 | $ip_val= $op== "max" ? "255":"1";
25 | foreach($arr_ip as $key => $val ){
26 | $i++;
27 | $val = $val== "*" ? $ip_val:$val;
28 | $arr_temp[]= $val;
29 | }
30 | for($i=4-$i;$i>0;$i--){
31 | $arr_temp[]=$ip_val;
32 | }
33 | $comma = "";
34 | foreach($arr_temp as $v){
35 | $result.= $comma.$v;
36 | $comma = ".";
37 | }
38 | return $result;
39 | }
40 |
41 | /**
42 | *
43 | * 判断IP是否被限并返回
44 | * @param $ip 当前IP
45 | * @param $ip_from 开始IP段
46 | * @param $ip_to 结束IP段
47 | */
48 | public function ipforbidden($ip,$ip_from,$ip_to){
49 | $from = strcmp($ip,$ip_from);
50 | $to = strcmp($ip,$ip_to);
51 | if($from >=0 && $to <= 0){
52 | return 0;
53 | } else {
54 | return 1;
55 | }
56 | }
57 |
58 | /**
59 | *
60 | * IP禁止判断接口,供外部调用 ...
61 | */
62 | public function check_ip(){
63 | $ip_array = array();
64 | //当前IP
65 | $ip = ip();
66 | //加载IP禁止缓存
67 | $ipbanned_cache = getcache('ipbanned','commons');
68 | if(!empty($ipbanned_cache)) {
69 | foreach($ipbanned_cache as $data){
70 | $ip_array[$data['ip']] = $data['ip'];
71 | //是否是IP段
72 | if(strpos($data['ip'],'*')){
73 | $ip_min = $this->convert_ip("min",$data['ip']);
74 | $ip_max = $this->convert_ip("max",$data['ip']);
75 | $result = $this->ipforbidden($ip,$ip_min,$ip_max);
76 | if($result==0 && $data['expires']>SYS_TIME){
77 | //被封
78 | showmessage('你在IP禁止段内,所以禁止你访问');
79 | }
80 | } else {
81 | //不是IP段,用绝对匹配
82 | if($ip==$data['ip']&& $data['expires']>SYS_TIME){
83 | showmessage('IP地址绝对匹配,禁止你访问');
84 | }
85 | }
86 | }
87 | }
88 | }
89 | }
90 | ?>
--------------------------------------------------------------------------------
/source/model/jzqk_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'jzqk';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/log_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'log';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/lyfs_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'lyfs';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/menu_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'menu';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/pbqk_data_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'pbqk_data';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/pbqk_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'pbqk';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/session_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'session';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/site_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'site';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/times_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'times';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/wlxf_data_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'wlxf_data';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/wlxf_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'wlxf';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/wlzh_data_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'wlzh_data';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/yuyue_data_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'yuyue_data';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/yuyue_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'yuyue';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/yytj_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'yytj';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/zjys_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'zjys';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/model/zxzy_model.class.php:
--------------------------------------------------------------------------------
1 | db_config = pc_base::load_config('database');
8 | $this->db_setting = 'default';
9 | $this->table_name = 'zxzy';
10 | parent::__construct();
11 | }
12 | }
13 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/classes/admin_op.class.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('admin_model');
9 | }
10 | /*
11 | * 修改密码
12 | */
13 | public function edit_password($userid, $password){
14 | $userid = intval($userid);
15 | if($userid < 1) return false;
16 | if(!is_password($password))
17 | {
18 | showmessdialog('密码不合法!');
19 | return false;
20 | }
21 | $passwordinfo = password($password);
22 | return $this->db->update($passwordinfo,array('userid'=>$userid));
23 | }
24 | /*
25 | * 检查用户名重名
26 | */
27 | public function checkname($username) {
28 | $username = trim($username);
29 | if ($this->db->get_one(array('username'=>$username),'userid')){
30 | return false;
31 | }
32 | return true;
33 | }
34 | }
35 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/comp.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('yuyue_model');*/
11 | $this->wlxf_db = pc_base::load_model('wlxf_model');
12 | $this->wlxf_db_dt = pc_base::load_model('wlxf_data_model');
13 | $this->wlzh_db_dt = pc_base::load_model('wlzh_data_model');
14 | }
15 |
16 | public function init () {
17 | self::public_list();
18 | }
19 |
20 | public function public_wlxf_list() {
21 | $action=__FUNCTION__;
22 |
23 | //权限判断
24 | if(!admin::check_roid('|31,')) showmessdialog('无权操作!', 300, HTTP_REFERER, 'noajax');
25 |
26 | /*$smonth=date('Y-m',SYS_TIME);
27 | $stdate=strtotime($smonth.'-1');
28 | $endate=strtotime(date('Y-m-t',$stdate));*/
29 |
30 | $rdate=getdaterange(trim($_GET['s']));
31 | if($rdate['stdate']!=''&&$rdate['endate']!=''){
32 | $stdate=$rdate['stdate'];
33 | $endate=$rdate['endate'];
34 | $where="rcdate >= '$stdate' and rcdate <= '$endate'";
35 | }
36 |
37 | $arr_wlxf = $this->wlxf_db_dt->select($where, 'cname', '', 'cname desc', 'cname');
38 | array_unshift($arr_wlxf,array('cname'=>'日期'));
39 | array_push($arr_wlxf,array('cname'=>'合计'));//横轴
40 | array_push($arr_wlxf,array('cname'=>'操作'));
41 |
42 | //表头设置
43 | $arr_thead=array();
44 |
45 | foreach($arr_wlxf as $row){
46 | foreach($row as $key=>$rowb){
47 | //echo $key;
48 | //json_encode($rowb);
49 | $arr_thead[]=$row[$key];
50 | }
51 | }
52 |
53 | $infos=array();
54 | $arr=array();
55 | $arr_wlzh = $this->wlzh_db_dt->select($where, 'id,rcdate', '', 'rcdate desc', 'rcdate');
56 | $arr_wlzh[]=array('rcdate'=>'合计');//竖轴
57 |
58 | foreach($arr_wlzh as $row){//竖轴
59 | $arr='';
60 | foreach($arr_wlxf as $rowb){//横轴
61 | if($rowb['cname']=='日期'){
62 | $arr[]=$row['rcdate']=='合计' ? $row['rcdate'] : date('Y-m-d',$row['rcdate']);
63 | }elseif($rowb['cname']=='合计'){
64 | if($row['rcdate']=='合计'){
65 | $tdata=$this->wlxf_db_dt->sum('tgcost', $where);
66 | }else{
67 | $tdata=$this->wlxf_db_dt->sum('tgcost', "rcdate='$row[rcdate]'");
68 | }
69 | $arr[]=$tdata;
70 | }elseif($rowb['cname']=='操作'){
71 | if($row['rcdate']=='合计'){
72 |
73 | }else{
74 | $arr[]='修改';
75 | }
76 | }else{
77 | if($row['rcdate']=='合计'){
78 | $tdata=$this->wlxf_db_dt->sum('tgcost', "rcdate >= '$stdate' and rcdate <= '$endate' and cname='$rowb[cname]'");
79 | }else{
80 | $tdata=$this->wlxf_db_dt->sum('tgcost', "rcdate='$row[rcdate]' and cname='$rowb[cname]'");
81 | }
82 | $arr[]=$tdata;
83 | }
84 | }
85 | $infos[]=$arr;
86 | }
87 |
88 | include $this->admin_tpl('comp_wlxf_list');
89 | }
90 |
91 | public function public_wlxf_add() {
92 | $action=__FUNCTION__;
93 |
94 | //权限判断
95 | if(!admin::check_roid('|32,')) showmessdialog('无权操作!', 300, HTTP_REFERER, 'noajax');
96 |
97 | if(isset($_GET['dosubmit'])) {
98 | $info = array();
99 | $info = $_POST['info'];
100 | if($this->savepostedit($info)){
101 | showmessdialog('操作成功!', 200,'./?m=admin&c=comp&a=public_wlxf_list&s=cmonth');
102 | }else{
103 | showmessdialog('操作出错!');
104 | }
105 | }else{
106 |
107 | $infos = $this->wlxf_db->listinfo('', 'listorder desc, id asc', 1, 100);
108 | $r=array();
109 | $r['rcdate']=date('Y-m-d',strtotime('-1 day',SYS_TIME));
110 |
111 | include $this->admin_tpl('comp_wlxf_edit');
112 | }
113 | }
114 |
115 | public function public_wlxf_edit() {
116 | $action=__FUNCTION__;
117 |
118 | //权限判断
119 | if(!admin::check_roid('|32,')) showmessdialog('无权操作!', 300, HTTP_REFERER, 'noajax');
120 |
121 | if(isset($_GET['dosubmit'])) {
122 | $info = array();
123 | $info = $_POST['info'];
124 | $cid = intval($info['cid']);
125 | if($this->savepostedit($info, 'edit', $cid)){
126 | showmessdialog('操作成功!', 200, './?m=admin&c=comp&a=public_wlxf_list&s=cmonth');
127 | }else{
128 | showmessdialog('操作出错!');
129 | }
130 | }else{
131 | $cid=intval($_GET['cid']);
132 |
133 | $arr_tem=array();
134 | $infos = $this->wlxf_db_dt->listinfo("catid='$cid'", 'cname desc, id asc', 1, 100);
135 | $arr_wlxf = $this->wlxf_db->listinfo('', 'listorder desc, id asc', 1, 100);
136 | foreach($arr_wlxf as $row){
137 | foreach($infos as $rowb){
138 | if($rowb['cname']!=$row['cname']){
139 | $arr_tem[]=$row;
140 | }
141 | }
142 | }
143 | $r=$this->wlzh_db_dt->get_one(array('id'=>$cid));
144 | $r['rcdate']=date('Y-m-d',$r['rcdate']);
145 |
146 | include $this->admin_tpl('comp_wlxf_edit');
147 | }
148 | }
149 |
150 | private function savepostedit($info, $ctrl='add', $cid=0){
151 |
152 | if($ctrl=='edit'&&$cid==0 || $ctrl=='edit'&&$cid==''){
153 | return false;
154 | }
155 |
156 | $info['rcdate']=strtotime($info['rcdate']);
157 |
158 | if($info['rcdate']==''){
159 | showmessdialog('日期不能为空!');
160 | }
161 |
162 | if($ctrl=='add'){
163 | $r=$this->wlzh_db_dt->get_one(array('rcdate'=>$info['rcdate']));
164 | if($r['id']!=''){
165 | showmessdialog('当前日期已经存在记录!');
166 | }
167 |
168 | $this->wlzh_db_dt->insert(array('rcdate'=>$info['rcdate'], 'addtime'=>SYS_TIME));
169 | $cid=$this->wlzh_db_dt->insert_id();
170 | if($cid){
171 | $arr_wlxf = $this->wlxf_db->listinfo('', 'listorder desc, id asc', 1, 100);
172 | foreach($arr_wlxf as $row){
173 | $tgcost='';
174 | $tgcost=sprintf('%.2f', $info['wlxf'.$row['id']]);
175 | if($tgcost!=0){
176 | $this->wlxf_db_dt->insert(array('catid'=>$cid, 'rcdate'=>$info['rcdate'], 'cname'=>$row['cname'], 'tgcost'=>$tgcost, 'addtime'=>SYS_TIME));
177 | }
178 | }
179 | return true;
180 | }else{
181 | return false;
182 | }
183 | }
184 |
185 | if($ctrl=='edit'){
186 | /*$result=$this->wlxf_db->update($info, array('id'=>$cid));
187 | if($result){
188 | $this->wlxf_db_dt->update(array('jzremark'=>$jzremark), array('id'=>$cid));
189 | return true;
190 | }else{
191 | return false;
192 | }*/
193 | }
194 |
195 | return false;
196 | }
197 |
198 | }
199 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/edlg.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('edlogs_model');
10 | }
11 |
12 | public function init () {
13 | self::public_list();
14 | }
15 |
16 | public function public_list() {
17 | $action=__FUNCTION__;
18 | $fromer=$_GET['c'];
19 | $ctrl=$action;
20 |
21 | $param = array();
22 | $param = $_GET['p'];
23 | $param_fields = array('stdate', 'endate', 'keyword');
24 |
25 | if(is_array($param)){
26 | foreach ($param as $k=>$value) {
27 | $info[$k]=trim($value);
28 | if (!in_array($k, $param_fields)){
29 | unset($param[$k]);
30 | }
31 | }
32 | }
33 |
34 | $sedate=date('Y-m-d',strtotime('-5 month',SYS_TIME)).' 至 '.date('Y-m-d',SYS_TIME);
35 |
36 | if($param['stdate']!=''&&$param['endate']!=''){
37 | $stdate=strtotime($param['stdate']);
38 | $endate=strtotime($param['endate']);
39 | }
40 |
41 | //列表
42 | include $this->admin_tpl('edlg_list');
43 | }
44 |
45 | }
46 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/functions/admin.func.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/source/modules/admin/functions/comm.func.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/source/modules/admin/index.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('admin_model');
9 | $this->menu_db = pc_base::load_model('menu_model');
10 | }
11 | public function init() {
12 | //代码
13 | }
14 | }
15 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/line.php:
--------------------------------------------------------------------------------
1 | db = pc_base::load_model('pbqk_model');
11 | $this->db_dt = pc_base::load_model('pbqk_data_model');
12 | }
13 |
14 | public function init () {
15 | self::public_list();
16 | }
17 |
18 | public function public_list() {
19 | $action=__FUNCTION__;
20 |
21 | //权限判断
22 | if(!admin::check_roid('|51,')) showmessdialog('无权操作!', 300, HTTP_REFERER, 'noajax');
23 |
24 | $cid=intval($_GET['s']);
25 |
26 | $arr_week=array('日','一','二','三','四','五','六');
27 | $pbmonth=intval(date('m',SYS_TIME));
28 | $maxday=intval(date('t',SYS_TIME));
29 | $dclass='';
30 | $dstyle='';
31 |
32 | $thead=array();
33 | $weeks=array();
34 | $pbval=array();
35 |
36 | for($i=1; $i<=31; $i++){
37 | $thead[]=$i;
38 | }
39 | for($i=1; $i<=31; $i++){
40 | $weeks[]=$arr_week[date('w',strtotime(date('Y-m',SYS_TIME)."-$i"))];
41 | }
42 | for($i=1; $i<=31; $i++){
43 | $pbval[]=$i;
44 | }
45 |
46 | $r = $this->db->get_one(array('id'=>$cid));
47 |
48 | $pblist='';
49 | $p = $this->db_dt->get_one(array('pbmonth'=>$pbmonth, 'pbsort'=>$r['cname']));
50 | $pblist=unserialize($p['pbcontent']);
51 |
52 | for($i=1; $i<=31; $i++){
53 | if($i>$maxday){
54 | array_pop($thead);
55 | array_pop($weeks);
56 | array_pop($pblist);
57 | }
58 | }
59 |
60 | $actioname=$r['cname'];
61 |
62 | if($_GET['echo']=='export'){
63 | $filename=str_replace(' ', '', $pbmonth.'月份'.$actioname);
64 | $csv_data = ','.implode(',',$thead)."\n";
65 |
66 | ob_start();
67 | echo $csv_data;
68 | $csv_data = ','.implode(',',$weeks)."\n";
69 | echo $csv_data;
70 | foreach($pblist as $k=>$info) {
71 | $csv_data = '';
72 | $csv_data .= $info[0][0];
73 | $csv_data .= $info[0][1]."\n";
74 | echo $csv_data;
75 | }
76 | export_csv($filename);
77 | }
78 |
79 | include $this->admin_tpl('line_list');
80 | }
81 |
82 | public function public_pbset() {
83 | $action=__FUNCTION__;
84 |
85 | //权限判断
86 | if(!admin::check_roid('|52,')) showmessdialog('无权操作!', 300, HTTP_REFERER, 'noajax');
87 |
88 | //排班设置
89 | if(isset($_GET['dosubmit'])) {
90 | $pbsort = isset($_POST['pbsort']{3}) && trim($_POST['pbsort']) ? trim($_POST['pbsort']) : showmessdialog('名称不能为空!');
91 | $pbmonth = isset($_POST['pbmonth']) && trim($_POST['pbmonth']) ? trim($_POST['pbmonth']) : showmessdialog('月份不能为空!');
92 | $pbdata = isset($_POST['pbdata']{3}) && trim($_POST['pbdata']) ? trim($_POST['pbdata']) : showmessdialog('排班内容不能为空!');
93 |
94 | $pbdata_a=array();
95 | $pbdata_b=array();
96 | $pbdata_t=array();
97 |
98 | $pbdata_t=explode('$',$pbdata);
99 |
100 | foreach($pbdata_t as $row) {
101 | if(trim($row)!=''){
102 | $pbdata_b='';
103 | $pbdata_b[]=explode('|',$row);
104 | $pbdata_a[]=$pbdata_b;
105 | }
106 | }
107 |
108 | $pbdata=serialize($pbdata_a);
109 |
110 | if($_POST['ctrl']=='modify' && $_POST['cid']!=''){
111 | $cid=intval($_POST['cid']);
112 | $this->db_dt->update(array('pbsort'=>$pbsort, 'pbmonth'=>$pbmonth, 'pbcontent'=>$pbdata), array('id'=>$cid));
113 | }else{
114 | $this->db_dt->insert(array('pbsort'=>$pbsort, 'pbmonth'=>$pbmonth, 'pbcontent'=>$pbdata, 'addtime'=>SYS_TIME));
115 | }
116 |
117 | showmessdialog('操作成功', 200, './?m=admin&c=line&a='.__FUNCTION__);
118 |
119 | }else{
120 | $arr_week=array('日','一','二','三','四','五','六');
121 | $maxday=intval(date('t',SYS_TIME));
122 | $dclass='';
123 | $dstyle='';
124 |
125 | $thead=array();
126 | $weeks=array();
127 | $pblist=array(0);
128 | $pbval=array();
129 |
130 | for($i=1; $i<=31; $i++){
131 | $thead[]=$i;
132 | }
133 |
134 | for($i=1; $i<=31; $i++){
135 | $weeks[]=$arr_week[date('w',strtotime(date('Y-m',SYS_TIME)."-$i"))];
136 | }
137 | for($i=1; $i<=31; $i++){
138 | $pbval[]=$i;
139 | }
140 |
141 | $pbqk_list = $this->db->listinfo('', 'listorder desc, id asc', 1, 100);
142 |
143 | if(isset($_GET['ctrl'])=='modify') {
144 | $pblist='';
145 | $cid=intval($_GET['cid']);
146 | $r = $this->db_dt->get_one(array('id'=>$cid));
147 | $r['cid']=$r['id'];
148 | $pblist=unserialize($r['pbcontent']);
149 | $ctrl='modify';
150 | }
151 |
152 | $page = $_GET['page'] ? intval($_GET['page']) : '1';
153 | $infos = $this->db_dt->listinfo('', 'id desc', $page, 20);
154 | $pages = $this->db_dt->pages;
155 |
156 | include $this->admin_tpl('line_edit');
157 | }
158 | }
159 |
160 | public function deleteds(){
161 | if(isset($_GET['dosubmit'])) {
162 | if(empty($_POST['ids'])) showmessdialog('您没有勾选信息!');
163 | foreach($_POST['ids'] as $id) {
164 | $this->db->delete(array('id'=>$id));
165 | }
166 | showmessdialog('操作成功', 200, 'reload');
167 | }
168 | }
169 |
170 | }
171 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/quer.php:
--------------------------------------------------------------------------------
1 | userid = $_SESSION['userid'];
9 | }
10 |
11 | public function init () {
12 | $fromer = $_GET['fromer'];
13 | $ctrl = $_GET['ctrl'];
14 | $param = array();
15 | $param = $_POST['p'];
16 | $param_fields = array('stdate', 'endate', 'keyword');
17 | foreach ($param as $k=>$value) {
18 | $info[$k]=trim($value);
19 | if (!in_array($k, $param_fields)){
20 | unset($param[$k]);
21 | }
22 | }
23 | //echo $fromer;
24 | if($fromer=='main'){
25 | header("Location: ./?m=admin&c=main&p[stdate]=$param[stdate]&p[endate]=$param[endate]&p[keyword]=$param[keyword]");
26 | }
27 |
28 | if($fromer=='edlg'){
29 | header("Location: ./?m=admin&c=edlg&a=$ctrl&p[stdate]=$param[stdate]&p[endate]=$param[endate]&p[keyword]=$param[keyword]");
30 | }
31 |
32 | if($fromer=='dyua'){
33 | header("Location: ./?m=admin&c=dyua&p[stdate]=$param[stdate]&p[endate]=$param[endate]&p[keyword]=$param[keyword]");
34 | }
35 |
36 | if($fromer=='anls'){
37 | header("Location: ./?m=admin&c=anls&a=$ctrl&p[stdate]=$param[stdate]&p[endate]=$param[endate]");
38 | }
39 |
40 | if($fromer=='repo'){
41 | header("Location: ./?m=admin&c=repo&a=$ctrl&p[stdate]=$param[stdate]&p[endate]=$param[endate]");
42 | }
43 | }
44 |
45 | }
46 | ?>
--------------------------------------------------------------------------------
/source/modules/admin/templates/anls_chart.tpl.php:
--------------------------------------------------------------------------------
1 |
6 |