diff --git a/controller/app.class.php b/controller/app.class.php index cf692f4..a99cf44 100644 --- a/controller/app.class.php +++ b/controller/app.class.php @@ -65,6 +65,7 @@ class app extends Controller public function user_app() { $path = _DIR($this->in['path']); + if (isset($this->in['action']) && $this->in['action'] == 'add') { $path .= '.oexe'; } @@ -87,9 +88,13 @@ class app extends Controller */ public function get() { - $list = !isset($this->in['group']) || ('all' == $this->in['group']) - ? $this->sql->get() - : $this->sql->get(['group', $this->in['group']]); + $list = []; + + if (!isset($this->in['group']) || $this->in['group'] == 'all') { + $list = $this->sql->get(); + } else { + $list = $this->sql->get(['group', $this->in['group']]); + } $list = array_reverse($list); @@ -118,14 +123,9 @@ class app extends Controller public function edit() { //查找到一条记录,修改为该数组 - $this->sql->remove( - rawurldecode($this->in['old_name']) - ); + $this->sql->remove(rawurldecode($this->in['old_name'])); - if ($this->sql->set( - rawurldecode($this->in['name']), $this->_init() - ) - ) { + if ($this->sql->set(rawurldecode($this->in['name']), $this->_init())) { show_json($this->L['success']); } @@ -165,7 +165,6 @@ class app extends Controller { $data = rawurldecode($this->in['data']); $arr = json_decode($data, true); - if (!is_array($arr)) { show_json($this->L['error'], false); } diff --git a/controller/fav.class.php b/controller/fav.class.php index beade29..d098936 100644 --- a/controller/fav.class.php +++ b/controller/fav.class.php @@ -95,4 +95,4 @@ class fav extends Controller show_json($this->L['error'], false); } -} +} \ No newline at end of file diff --git a/controller/settings.class.php b/controller/setting.class.php old mode 100644 new mode 100755 similarity index 99% rename from controller/settings.class.php rename to controller/setting.class.php index 0092580..cf4c24e --- a/controller/settings.class.php +++ b/controller/setting.class.php @@ -7,7 +7,7 @@ * @license http://kalcaddle.com/tools/licenses/license.txt */ -class settings extends Controller +class setting extends Controller { public function __construct() { @@ -57,6 +57,7 @@ class settings extends Controller $result = $this->config['setting_system']; unset($result['system_password']); + show_json($result, true); } else { show_json('error', false); @@ -144,6 +145,7 @@ class settings extends Controller $user_path.'data/share_temp', $user_path.'recycle_kod', ]; + foreach ($path_arr as $value) { del_dir($value); mk_dir($value); diff --git a/controller/share.class.php b/controller/share.class.php index 1698e8b..f943b7d 100644 --- a/controller/share.class.php +++ b/controller/share.class.php @@ -757,10 +757,12 @@ class share extends Controller if ($val['ext'] == 'oexe') { $path = iconv_system($val['path']); $json = json_decode(@file_get_contents($path), true); + if (is_array($json)) { $val = array_merge($val, $json); } } + $list_new['filelist'][] = $val; } @@ -768,10 +770,12 @@ class share extends Controller if (in_array($val['name'], $ex_name)) { continue; } + $list_new['folderlist'][] = $val; } + _DIR_OUT($list_new); return _DIR_OUT($list_new); } -} +} \ No newline at end of file diff --git a/controller/system_group.class.php b/controller/system_group.class.php index 606c89d..a0cbaac 100644 --- a/controller/system_group.class.php +++ b/controller/system_group.class.php @@ -358,4 +358,4 @@ class system_group extends Controller mk_dir(iconv_system($path.'home/'.$dir)); } } -} +} \ No newline at end of file diff --git a/controller/system_member.class.php b/controller/system_member.class.php index 92410a7..76d9880 100644 --- a/controller/system_member.class.php +++ b/controller/system_member.class.php @@ -489,44 +489,60 @@ class system_member extends Controller switch ($action) { case 'del'://删除 $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(['user_id', $user_id], ['status', $status]); + break; case 'role_set'://设置权限组 $role = $this->in['param']; //非系统管理员,不能将别人设置为系统管理员 + if (!$GLOBALS['is_root'] && $role == '1') { show_json($this->L['group_role_error'], false); } + $this->sql->set(['user_id', $user_id], ['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(['user_id', $user_id], ['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); + break; case 'group_add'://添加到某个组 $group_arr = json_decode($this->in['param'], true); + if (!is_array($group_arr)) { show_json($this->L['error'], false); } + $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); default: break; @@ -546,6 +562,7 @@ class system_member extends Controller $info['path'] = $path; $info['create_time'] = time(); } + $sql->reset($list); //初始化群组目录 @@ -556,9 +573,11 @@ class system_member extends Controller foreach ($list as $id => &$info) {//创建用户目录及初始化 $path = make_path($info['name']); $root_path = GROUP_PATH.$path.'/'; + foreach ($home_folders as $dir) { mk_dir(iconv_system($root_path.'home/'.$dir)); } + $info['path'] = $path; $info['create_time'] = time(); } @@ -587,4 +606,4 @@ class system_member extends Controller fileCache::save($root_path.'data/config.php', $this->config['setting_default']); } -} +} \ No newline at end of file