Exemplo n.º 1
0
 public function getConfig()
 {
     $default = array('font_size' => '14px', 'theme' => 'github', 'auto_wrap' => 0, 'display_char' => 0, 'auto_complete' => 1);
     $config_file = USER . 'data/editor_config.php';
     if (!file_exists($config_file)) {
         //不存在则创建
         $sql = new fileCache($config_file);
         $sql->reset($default);
     } else {
         $sql = new fileCache($config_file);
         $default = $sql->get();
     }
     return json_encode($default);
 }
Exemplo n.º 2
0
 public function getConfig()
 {
     $default = array('font_size' => '15px', 'theme' => 'clouds', 'auto_wrap' => 0, 'display_char' => 0, 'auto_complete' => 1, 'function_list' => 1);
     $config_file = USER . 'data/editor_config.php';
     if (!file_exists($config_file)) {
         //It does not exist, create
         $sql = new fileCache($config_file);
         $sql->reset($default);
     } else {
         $sql = new fileCache($config_file);
         $default = $sql->get();
     }
     if (!isset($default['function_list'])) {
         $default['function_list'] = 1;
     }
     return json_encode($default);
 }
Exemplo n.º 3
0
 /**
  * 用户app初始化
  */
 private function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $desktop = USER_PATH . $user['name'] . '/home/desktop/';
     foreach ($list as $key => $data) {
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user['status'] = 1;
     $member = new fileCache($this->config['system_file']['member']);
     $member->update($user['name'], $user);
 }
 private function _tree_init($app)
 {
     if ($app == 'editor' && isset($this->in['project'])) {
         $list_project = $this->path(_DIR($this->in['project']), true, true);
         $project = array_merge($list_project['folderlist'], $list_project['filelist']);
         $tree_data = array(array('name' => get_path_this($this->in['project']), 'children' => $project, 'iconSkin' => "my", 'menuType' => "menuTreeRoot", 'open' => true, 'this_path' => $this->in['project'], 'isParent' => count($project) > 0 ? true : false));
         show_json($tree_data);
         return;
     }
     $check_file = $app == 'editor' ? true : false;
     $favData = new fileCache($this->config['user_fav_file']);
     $fav_list = $favData->get();
     $fav = array();
     foreach ($fav_list as $key => $val) {
         $fav[] = array('name' => $val['name'], 'this_path' => $val['path'], 'iconSkin' => "fav", 'menuType' => "menuTreeFav", 'type' => 'folder', 'isParent' => path_haschildren(_DIR($val['path']), $check_file));
     }
     $list_root = $this->path(_DIR(MYHOME), $check_file, true);
     $list_public = $this->path(PUBLIC_PATH, $check_file, true);
     if ($check_file) {
         //编辑器
         $root = array_merge($list_root['folderlist'], $list_root['filelist']);
         $public = array_merge($list_public['folderlist'], $list_public['filelist']);
     } else {
         //文件管理器
         $root = $list_root['folderlist'];
         $public = $list_public['folderlist'];
     }
     $root_isparent = count($root) > 0 ? true : false;
     $public_isparent = count($public) > 0 ? true : false;
     $tree_data = array(array('name' => $this->L['fav'], 'iconSkin' => "fav", 'menuType' => "menuTreeFavRoot", 'open' => true, 'children' => $fav), array('name' => $this->L['root_path'], 'children' => $root, 'menuType' => "menuTreeRoot", 'iconSkin' => "my", 'open' => true, 'this_path' => MYHOME, 'isParent' => $root_isparent), array('name' => $this->L['public_path'], 'children' => $public, 'menuType' => "menuTreeRoot", 'iconSkin' => "lib", 'open' => true, 'this_path' => '*public*', 'isParent' => $public_isparent));
     show_json($tree_data);
 }
Exemplo n.º 5
0
 /**
  * 用户app初始化
  */
 public function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $default = array('365日历', 'pptv直播', 'ps', 'qq音乐', '搜狐影视', '时钟', '水果忍者', '计算器', '豆瓣电台', '音悦台');
     $info = array();
     foreach ($default as $key) {
         $info[$key] = $list[$key];
     }
     $desktop = USER_PATH . $user['name'] . '/home/desktop/';
     foreach ($info as $key => $data) {
         //touch($path);
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user['status'] = 1;
     $member = new fileCache($this->config['system_file']['member']);
     $member->update($user['name'], $user);
 }
Exemplo n.º 6
0
 private function _assign_info()
 {
     $user_config = new fileCache(USER . 'data/config.php');
     $config = $user_config->get();
     if (count($config) < 1) {
         $config = $GLOBALS['config']['setting_default'];
     }
     $this->assign('config_theme', $config['theme']);
     $this->share_info['share_password'] = '';
     $this->share_info['num_view'] = intval($this->share_info['num_view']);
     $this->share_info['num_download'] = intval($this->share_info['num_download']);
     $this->share_info['path'] = get_path_this(iconv_app($this->path));
     $this->assign('share_info', $this->share_info);
 }
Exemplo n.º 7
0
 /**
  * 权限验证;统一入口检验
  */
 public function authCheck()
 {
     if (isset($GLOBALS['is_root']) && $GLOBALS['is_root'] == 1) {
         return;
     }
     if (in_array(ACT, $this->notCheck)) {
         return;
     }
     if (!array_key_exists(ST, $this->config['role_setting'])) {
         return;
     }
     if (!in_array(ACT, $this->config['role_setting'][ST]) && ST . ':' . ACT != 'user:common_js') {
         return;
     }
     //输出处理过的权限
     //有权限限制的函数
     $key = ST . ':' . ACT;
     $group = new fileCache(USER_SYSTEM . 'group.php');
     $auth = $group->get($this->user['role']);
     //向下版本兼容处理
     //未定义;新版本首次使用默认开放的功能
     if (!isset($auth['userShare:set'])) {
         $auth['userShare:set'] = 1;
     }
     if (!isset($auth['explorer:fileDownload'])) {
         $auth['explorer:fileDownload'] = 1;
     }
     //默认扩展功能 等价权限
     $auth['user:common_js'] = 1;
     //权限数据配置后输出到前端
     $auth['explorer:pathChmod'] = $auth['explorer:pathRname'];
     $auth['explorer:pathDeleteRecycle'] = $auth['explorer:pathDelete'];
     $auth['explorer:pathCopyDrag'] = $auth['explorer:pathCuteDrag'];
     $auth['explorer:fileDownloadRemove'] = $auth['explorer:fileDownload'];
     $auth['explorer:zipDownload'] = $auth['explorer:fileDownload'];
     $auth['explorer:fileProxy'] = $auth['explorer:fileDownload'];
     $auth['editor:fileGet'] = $auth['explorer:fileDownload'];
     $auth['explorer:officeView'] = $auth['explorer:fileDownload'];
     $auth['explorer:officeSave'] = $auth['editor:fileSave'];
     $auth['userShare:del'] = $auth['userShare:set'];
     if ($auth[$key] != 1) {
         show_json($this->L['no_permission'], false);
     }
     $GLOBALS['auth'] = $auth;
     //全局
     //扩展名限制:新建文件&上传文件&重命名文件&保存文件&zip解压文件
     $check_arr = array('mkfile' => $this->check_key('path'), 'pathRname' => $this->check_key('rname_to'), 'fileUpload' => isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '', 'fileSave' => $this->check_key('path'));
     if (array_key_exists(ACT, $check_arr) && !checkExt($check_arr[ACT])) {
         show_json($this->L['no_permission_ext'], false);
     }
 }
Exemplo n.º 8
0
 private function _tree_init($app)
 {
     $check_file = $app == 'editor' ? true : false;
     $favData = new fileCache($this->config['user_fav_file']);
     $fav_list = $favData->get();
     $fav = array();
     foreach ($fav_list as $key => $val) {
         $fav[] = array('ext' => 'folder', 'name' => $val['name'], 'this_path' => $val['path'], 'iconSkin' => "fav", 'type' => 'folder', 'isParent' => path_haschildren(_DIR($val['path']), $check_file));
     }
     $list_root = $this->path(_DIR(MYHOME), true, true);
     $list_share = $this->path(_DIR(PUBLIC_PATH), true, true);
     if ($check_file) {
         //编辑器
         $root = array_merge($list_root['folderlist'], $list_root['filelist']);
         $share = array_merge($list_share['folderlist'], $list_share['filelist']);
         $tree_data = array(array('name' => $this->L['fav'], 'ext' => '__fav__', 'iconSkin' => "fav", 'open' => true, 'children' => $fav), array('name' => $this->L['root_path'], 'ext' => '__root__', 'children' => $root, 'iconSkin' => "my", 'open' => true, 'this_path' => MYHOME, 'isParent' => true), array('name' => $this->L['public_path'], 'ext' => '__root__', 'children' => $share, 'iconSkin' => "lib", 'open' => true, 'this_path' => PUBLIC_PATH, 'isParent' => true));
     } else {
         //文件管理器
         $root = $list_root['folderlist'];
         $share = $list_share['folderlist'];
         $tree_data = array(array('name' => $this->L['fav'], 'ext' => '__fav__', 'iconSkin' => "fav", 'open' => true, 'children' => $fav), array('name' => $this->L['root_path'], 'ext' => '__root__', 'children' => $root, 'iconSkin' => "my", 'open' => true, 'this_path' => MYHOME, 'isParent' => true), array('name' => $this->L['public_path'], 'ext' => '__root__', 'children' => $share, 'iconSkin' => "lib", 'open' => true, 'this_path' => PUBLIC_PATH, 'isParent' => true));
     }
     show_json($tree_data);
 }
Exemplo n.º 9
0
 /**
  * 用户app初始化
  */
 public function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $desktop = USER_PATH . $user . '/home/desktop/';
     foreach ($list as $key => $data) {
         //touch($path);
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
 }
Exemplo n.º 10
0
 /**
  * Permission Validation; unified entrance examination
  */
 public function authCheck()
 {
     if (isset($GLOBALS['is_root']) && $GLOBALS['is_root'] == 1) {
         return;
     }
     if (in_array(ACT, $this->notCheck)) {
         return;
     }
     if (!array_key_exists(ST, $this->config['role_setting'])) {
         return;
     }
     if (!in_array(ACT, $this->config['role_setting'][ST]) && ST . ':' . ACT != 'user:common_js') {
         return;
     }
     //Outputs the processed permissions
     //With restricted access function
     $key = ST . ':' . ACT;
     $group = new fileCache(USER_SYSTEM . 'group.php');
     $auth = $group->get($this->user['role']);
     // Downward compatible with version handling
     // Undefined; the new version features the first use of the default open
     if (!isset($auth['userShare:set'])) {
         $auth['userShare:set'] = 1;
     }
     if (!isset($auth['explorer:fileDownload'])) {
         $auth['explorer:fileDownload'] = 1;
     }
     //The default extension is functionally equivalent authority
     $auth['user:common_js'] = 1;
     //After permission to configure the output data to the front end
     $auth['explorer:pathChmod'] = $auth['explorer:pathRname'];
     $auth['explorer:pathDeleteRecycle'] = $auth['explorer:pathDelete'];
     $auth['explorer:pathCopyDrag'] = $auth['explorer:pathCuteDrag'];
     $auth['explorer:fileDownloadRemove'] = $auth['explorer:fileDownload'];
     $auth['explorer:zipDownload'] = $auth['explorer:fileDownload'];
     $auth['explorer:fileProxy'] = $auth['explorer:fileDownload'];
     $auth['editor:fileGet'] = $auth['explorer:fileDownload'];
     $auth['explorer:officeView'] = $auth['explorer:fileDownload'];
     $auth['explorer:officeSave'] = $auth['editor:fileSave'];
     $auth['userShare:del'] = $auth['userShare:set'];
     if ($auth[$key] != 1) {
         show_json($this->L['no_permission'], false);
     }
     $GLOBALS['auth'] = $auth;
     //Overall situation
     //Extension restrictions: New File Upload & File & rename files & save files Unzip & zip file
     $check_arr = array('mkfile' => $this->check_key('path'), 'pathRname' => $this->check_key('rname_to'), 'fileUpload' => isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '', 'fileSave' => $this->check_key('path'));
     if (array_key_exists(ACT, $check_arr) && !checkExt($check_arr[ACT])) {
         show_json($this->L['no_permission_ext'], false);
     }
 }