Ejemplo n.º 1
0
 public function init_app($user_info)
 {
     $list = $this->sql->get();
     $new_user_app = $this->config['setting_system']['new_user_app'];
     $default = explode(',', $new_user_app);
     $info = array();
     foreach ($default as $key) {
         $info[$key] = $list[$key];
     }
     $desktop = USER_PATH . $user_info['name'] . '/home/desktop/';
     mk_dir($desktop);
     foreach ($info as $key => $data) {
         if (!is_array($data)) {
             continue;
         }
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user_info['status'] = 1;
     $member = new fileCache(USER_SYSTEM . 'member.php');
     $member->update($user_info['name'], $user_info);
 }
Ejemplo n.º 2
0
 /**
  * 删除
  */
 public function del()
 {
     $role = $this->in['role'];
     if (!$role) {
         show_json($this->L["groupname_can_not_null"], false);
     }
     if ($role == 'root') {
         show_json($this->L['default_group_can_not_do'], false);
     }
     if ($this->sql->delete($role)) {
         $member = new fileCache($this->config['system_file']['member']);
         $member->update('role', '', $role);
         //改组用户设置为空
         show_json($this->L['success']);
     }
     show_json($this->L['error'], false);
 }
Ejemplo n.º 3
0
 /**
  * 删除
  */
 public function del()
 {
     if ($_SERVER['HTTP_REFERER'] != $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) {
         if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
             $role = $this->in['role'];
             if (!$role) {
                 show_json($this->L["groupname_can_not_null"], false);
             }
             if ($role == 'root') {
                 show_json($this->L['default_group_can_not_do'], false);
             }
             if ($this->sql->delete($role)) {
                 $member = new fileCache(USER_SYSTEM . 'member.php');
                 $member->update('role', '', $role);
                 //改组用户设置为空
                 show_json($this->L['success']);
             }
             show_json($this->L['error'], false);
         }
     } else {
         header('Location: 403.php');
     }
 }
Ejemplo n.º 4
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);
 }
Ejemplo 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);
 }
Ejemplo n.º 6
0
 public function setConfig()
 {
     $file = USER . 'data/editor_config.php';
     if (!is_writeable($file)) {
         //配置不可写
         show_json($this->L['no_permission_write_file'], false);
     }
     $key = $this->in['k'];
     $value = $this->in['v'];
     if ($key != '' && $value != '') {
         $sql = new fileCache($file);
         if (!$sql->update($key, $value)) {
             $sql->add($key, $value);
             //没有则添加一条
         }
         show_json($this->L["setting_success"]);
     } else {
         show_json($this->L['error'], false);
     }
 }
Ejemplo n.º 7
0
 /**
  * 修改密码
  */
 public function changePassword()
 {
     $password_now = $this->in['password_now'];
     $password_new = $this->in['password_new'];
     if (!$password_now && !$password_new) {
         show_json($this->L['password_not_null'], false);
     }
     if ($this->user['password'] == md5($password_now)) {
         $member_file = USER_SYSTEM . 'member.php';
         $sql = new fileCache(USER_SYSTEM . 'member.php');
         $this->user['password'] = md5($password_new);
         $sql->update($this->user['name'], $this->user);
         setcookie('kod_token', md5(md5($password_new)), time() + 3600 * 24 * 365);
         show_json('success');
     } else {
         show_json($this->L['old_password_error'], false);
     }
 }
Ejemplo n.º 8
0
 public function setConfig()
 {
     $key = $this->in['k'];
     $value = $this->in['v'];
     if ($key != '' && $value != '') {
         $config_file = USER . 'data/editor_config.php';
         $sql = new fileCache($config_file);
         $default = $sql->update($key, $value);
         show_json($this->L["setting_success"]);
     } else {
         show_json($this->L['error'], false);
     }
 }