diff --git a/.idea/KodExplorer.iml b/.idea/KodExplorer.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/KodExplorer.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..4ca2f64
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..197a8a6
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ show_tips
+ $this->sql
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/controller/app.class.php b/controller/app.class.php
index e409a4e..5fdfab0 100755
--- a/controller/app.class.php
+++ b/controller/app.class.php
@@ -19,7 +19,7 @@ class app extends Controller{
$this->display(TEMPLATE.'app/index.php');
}
- public function init_app($user_info){
+ public function init_app(){
$list = $this->sql->get();
$new_user_app = $this->config['setting_system']['new_user_app'];
$default = explode(',',$new_user_app);
diff --git a/controller/fav.class.php b/controller/fav.class.php
index 1d1f26b..8d76534 100755
--- a/controller/fav.class.php
+++ b/controller/fav.class.php
@@ -33,7 +33,7 @@ class fav extends Controller{
}
$name = $name.'('.$index.')';
}
- $res=$this->sql->set(
+ $this->sql->set(
$name,
array(
'name' => $name,
@@ -49,9 +49,6 @@ class fav extends Controller{
* 编辑
*/
public function edit() {
- $this->in['name'] = $this->in['name'];
- $this->in['path'] = $this->in['path'];
- $this->in['name_to'] = $this->in['name_to'];
$new_fav = $this->sql->get($this->in['name']);
if(!isset($new_fav['type'])){
$new_fav['type'] = 'folder';
diff --git a/controller/setting.class.php b/controller/setting.class.php
index a51415c..ffebe60 100755
--- a/controller/setting.class.php
+++ b/controller/setting.class.php
@@ -7,7 +7,6 @@
*/
class setting extends Controller{
- private $sql;
function __construct(){
parent::__construct();
}
diff --git a/controller/share.class.php b/controller/share.class.php
index 5f65749..2c4af70 100755
--- a/controller/share.class.php
+++ b/controller/share.class.php
@@ -14,7 +14,7 @@ class share extends Controller{
function __construct(){
parent::__construct();
$this->tpl = TEMPLATE.'share/';
- $auth = system_role::get_info(1);//经过role检测
+ system_role::get_info(1);//经过role检测
//不需要检查的action
$arr_not_check = array('common_js');
if (!in_array(ACT,$arr_not_check)){
@@ -192,7 +192,7 @@ class share extends Controller{
$this->sql->set($this->in['sid'],$this->share_info);
}
public function common_js(){
- $out = ob_get_clean();
+ ob_get_clean();
$the_config = array(
'lang' => LANGUAGE_TYPE,
'system_os' => $this->config['system_os'],
@@ -614,7 +614,7 @@ class share extends Controller{
if (in_array($val['name'],$ex_name)) continue;
$list_new['folderlist'][] = $val;
}
- $s = _DIR_OUT($list_new);
+ _DIR_OUT($list_new);
return _DIR_OUT($list_new);
}
}
diff --git a/controller/system_group.class.php b/controller/system_group.class.php
index 867b9fa..dde7ace 100755
--- a/controller/system_group.class.php
+++ b/controller/system_group.class.php
@@ -34,7 +34,7 @@ class system_group extends Controller{
* @param [type] $the_id [user_id or group_id]
* @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位]
*/
- public static function space_change($the_id,$use_size_add=false){
+ public function space_change($the_id,$use_size_add=false){
$sql = self::load_data();
$info = $sql->get($the_id);
if(!is_array($info)){
@@ -58,7 +58,7 @@ class system_group extends Controller{
* 空间剩余检测
* 1073741824 —— 1G
*/
- public static function space_check($the_id){
+ public function space_check($the_id){
$sql = self::load_data();
$info = $sql->get($the_id);
if(!is_array($info)){
diff --git a/controller/system_member.class.php b/controller/system_member.class.php
index 9bc6716..798bba8 100755
--- a/controller/system_member.class.php
+++ b/controller/system_member.class.php
@@ -33,7 +33,7 @@ class system_member extends Controller{
* @param [type] $the_id [user_id or group_id]
* @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位]
*/
- public static function space_change($the_id,$use_size_add=false){
+ public function space_change($the_id,$use_size_add=false){
$sql = self::load_data();
$info = $sql->get($the_id);
if(!is_array($info)){
@@ -48,7 +48,7 @@ class system_member extends Controller{
}
}else{
$current_use = floatval($info['config']['size_use'])+floatval($use_size_add);
- }
+ }
$info['config']['size_use'] = $current_use<0?0:$current_use;
$sql->set($the_id,$info);
}
@@ -56,7 +56,7 @@ class system_member extends Controller{
* 空间剩余检测
* 1073741824 —— 1G
*/
- public static function space_check($the_id){
+ public function space_check($the_id){
$sql = self::load_data();
$info = $sql->get($the_id);
if(!is_array($info)){
@@ -105,7 +105,7 @@ class system_member extends Controller{
}
return $result;
}
- //判断自己对某个组的权限 return false/'read'/'write'
+ //判断自己对某个组的权限 return false/'read'/'write'
public static function _user_auth_group_role($group_id){
$sql = self::load_data();
$user_info = $sql->get($_SESSION['kod_user']['user_id']);
@@ -218,7 +218,7 @@ class system_member extends Controller{
$name = trim(rawurldecode($this->in['name']));
$password = rawurldecode($this->in['password']);
- $group_info = json_decode(rawurldecode($this->in['group_info']),true);
+ $group_info = json_decode(rawurldecode($this->in['group_info']),true);
if(!is_array($group_info)){
show_json($this->L["system_member_group_error"],false);
}
@@ -320,8 +320,8 @@ class system_member extends Controller{
}
//管理员自己不能添加自己到非管理员组
- if($GLOBALS['is_root']
- && $_SESSION['kod_user']['user_id']==$user_id
+ if($GLOBALS['is_root']
+ && $_SESSION['kod_user']['user_id']==$user_id
&& $this->in['role']!='1'){
show_json($this->L['error'],false);
}
@@ -337,7 +337,7 @@ class system_member extends Controller{
$this->in['name'] = rawurlencode($the_name);//还原
$edit_arr = array('name','role','password','group_info','home_path','status','size_max');
foreach ($edit_arr as $key) {
- if(!isset($this->in[$key])) continue;
+ if(!isset($this->in[$key])) continue;
$user_info[$key] = rawurldecode($this->in[$key]);
if($key == 'password'){
$user_info['password'] = md5($user_info[$key]);
@@ -367,7 +367,7 @@ class system_member extends Controller{
/**
* 用户批量操作 system_member/do_action&action=&user_id=[101,222,131]¶m=
- * action :
+ * action :
* -------------
* del 删除用户
* status_set 启用&禁用 param=0/1
@@ -375,7 +375,7 @@ class system_member extends Controller{
* group_reset 重置分组 param=group_json
* group_remove_from 从某个组删除 param=group_id
* group_add 添加到某个分组 param=group_json
- */
+ */
public function do_action() {
if (!isset($this->in['user_id'])){
show_json($this->L["username_can_not_null"],false);
@@ -391,14 +391,14 @@ class system_member extends Controller{
foreach ($user_arr as $user_id) {
switch ($action) {
case 'del'://删除
- $user_info = $this->sql->get($user_id);
+ $user_info = $this->sql->get($user_id);
if($this->sql->remove($user_id) && $user_info['name']!=''){
del_dir(iconv_system(USER_PATH.$user_info['path'].'/'));
}
break;
case 'status_set'://禁用&启用
$status = intval($this->in['param']);
- $this->sql->set(array('user_id',$user_id),array('status',$status));
+ $this->sql->set(array('user_id',$user_id),array('status',$status));
break;
case 'role_set'://设置权限组
$role = $this->in['param'];
@@ -406,20 +406,20 @@ class system_member extends Controller{
if(!$GLOBALS['is_root'] && $role=='1'){
show_json($this->L['group_role_error'],false);
}
- $this->sql->set(array('user_id',$user_id),array('role',$role));
+ $this->sql->set(array('user_id',$user_id),array('role',$role));
break;
case 'group_reset'://设置分组
$group_arr = json_decode($this->in['param'],true);
if(!is_array($group_arr)){
show_json($this->L['error'],false);
}
- $this->sql->set(array('user_id',$user_id),array('group_info',$group_arr));
+ $this->sql->set(array('user_id',$user_id),array('group_info',$group_arr));
break;
case 'group_remove_from'://从某个组移除
$group_id = $this->in['param'];
$user_info = $this->sql->get($user_id);
unset($user_info['group_info'][$group_id]);
- $this->sql->set($user_id,$user_info);
+ $this->sql->set($user_id,$user_info);
break;
case 'group_add'://添加到某个组
$group_arr = json_decode($this->in['param'],true);
@@ -429,8 +429,8 @@ class system_member extends Controller{
$user_info = $this->sql->get($user_id);
foreach ($group_arr as $key => $value) {
$user_info['group_info'][$key] = $value;
- }
- $this->sql->set($user_id,$user_info);
+ }
+ $this->sql->set($user_id,$user_info);
default:break;
}
}
@@ -467,7 +467,7 @@ class system_member extends Controller{
//============内部处理函数=============
/**
*初始化用户数据和配置。
- */
+ */
private function _initDir($path){
$user_folder = array('home','recycle_kod','data');
$home_folders = explode(',',$this->config['setting_system']['new_user_folder']);
diff --git a/controller/user.class.php b/controller/user.class.php
index a5c3105..20201d9 100755
--- a/controller/user.class.php
+++ b/controller/user.class.php
@@ -8,7 +8,6 @@
class user extends Controller{
private $user; //用户相关信息
- private $auth; //用户所属组权限
private $notCheck;
function __construct(){
parent::__construct();
@@ -42,8 +41,7 @@ class user extends Controller{
$this->_setCsrfToken();
}
- if(in_array(ST,$this->notCheckApp)) return;//不需要判断的控制器
- if(in_array(ACT,$this->notCheck)) return;//不需要判断的action
+ if(in_array(ST,$this->notCheckApp) && in_array(ACT,$this->notCheck)) return;//不需要判断的控制器 | 不需要判断的action
if(isset($_SESSION['kod_login']) && $_SESSION['kod_login']===true){
$user = system_member::get_info($this->user['user_id']);
$this->login_success($user);
@@ -143,7 +141,7 @@ class user extends Controller{
if(isset($_SESSION) && $_SESSION['kod_login'] == 1){//避免session不可写导致循环跳转
$user = $_SESSION['kod_user'];
//admin 或者不填则允许所有kod用户登陆
- if( $user['role'] == '1' ||
+ if( $user['role'] == '1' ||
!isset($this->in['check']) ||
!isset($this->in['value']) ){
$result = true;
@@ -537,5 +535,4 @@ class user extends Controller{
include CLASS_DIR.'phpqrcode.php';
QRcode::png(rawurldecode($this->in['url']));
}
-}
-
+}
\ No newline at end of file
diff --git a/lib/core/Application.class.php b/lib/core/Application.class.php
index 8de9a9c..5080319 100755
--- a/lib/core/Application.class.php
+++ b/lib/core/Application.class.php
@@ -13,7 +13,7 @@
class Application {
public $default_controller = null; //默认的类名
public $default_do = null; //默认的方法名
- public $sub_dir =''; //控制器子目录
+ public $sub_dir = ''; //控制器子目录
public $model = ''; //控制器对应模型 对象。
/**
@@ -70,7 +70,7 @@ class Application {
*/
private function autorun(){
global $config;
- if (count($config['autorun']) > 0) {
+ if (count($config['autorun'])) {
foreach ($config['autorun'] as $key => $var) {
$this->appRun($var['controller'],$var['function']);
}
diff --git a/lib/core/Controller.class.php b/lib/core/Controller.class.php
index 40b04b8..00b4440 100755
--- a/lib/core/Controller.class.php
+++ b/lib/core/Controller.class.php
@@ -37,6 +37,9 @@ abstract class Controller {
*/
public function loadModel($class){
$args = func_get_args();
+ if ( !$this->$class ) {
+ show_tips($class.' model not exists');
+ }
$this -> $class = call_user_func_array('init_model', $args);
return $this -> $class;
}
diff --git a/lib/core/Model.class.php b/lib/core/Model.class.php
index 0e6d21b..5017a7b 100755
--- a/lib/core/Model.class.php
+++ b/lib/core/Model.class.php
@@ -12,24 +12,22 @@
*/
abstract class Model {
- var $db = null;
- var $in;
- var $config;
+ protected $db = null;
+ public $in;
/**
* 构造函数
* @return Null
*/
- function __construct(){
+ public function __construct(){
global $g_config, $in;
$this -> in = $in;
- $this -> config = $config;
}
/**
* TODO db
*/
- function db(){
+ public function db(){
if ($this ->db != NULL) {
return $this ->db;
}else{
diff --git a/lib/update.php b/lib/update.php
index 1c2e8c5..26b1f7d 100755
--- a/lib/update.php
+++ b/lib/update.php
@@ -15,7 +15,7 @@ function update_check(){
unzip_repeat();//再次解压,避免windows部分主机解压失败问题
//from <=3.23 to last
- if( file_exists(THE_DATA_PATH.'system/member.php') &&
+ if( file_exists(THE_DATA_PATH.'system/member.php') &&
!file_exists(THE_DATA_PATH.'system/system_member.php')){
new updateToV330();
update_clear();
@@ -24,7 +24,7 @@ function update_check(){
//from [3.30~3.35]
$system_file = THE_DATA_PATH.'system/system_setting.php';
$system_data = fileCache::load($system_file);
- if( file_exists($system_file) &&
+ if( file_exists($system_file) &&
(is_array($system_data) && !isset($system_data['current_version']) )
){
update330To336();
@@ -67,7 +67,7 @@ function update_clear(){
del_file(BASIC_PATH.'readme.txt');
del_file(BASIC_PATH.'controller/group.class.php');
del_file(BASIC_PATH.'controller/member.class.php');
-
+
del_dir(THE_DATA_PATH.'i18n');
del_dir(THE_DATA_PATH.'thumb');
del_dir(BASIC_PATH.'__MACOSX');
@@ -206,7 +206,7 @@ class updateToV330{
$group_path = THE_DATA_PATH.'Group/';
mk_dir($group_path);
- touch($group_path.'index.html');
+ touch($group_path.'index.htmzl');
$public = THE_DATA_PATH.'public';
$item_path = iconv_system($group_path.$arr['path'].'/');