diff --git a/.gitignore b/.gitignore
index dd366a369..7e797ed9f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,5 +17,7 @@ env.ini
/app/public/node_modules
/public/install/lock
config.test.yml
+plugin/document
+public/plugin/document
plugin/document/kod/data/system
plugin/document/kod/data/system/system_member.php
\ No newline at end of file
diff --git a/plugin/document/KodSdk.php b/plugin/document/KodSdk.php
deleted file mode 100644
index eeebb246b..000000000
--- a/plugin/document/KodSdk.php
+++ /dev/null
@@ -1,170 +0,0 @@
-rootUrl . "?user/loginSubmit&login_token=%s", $loginToken);
- return $url;
- }
-
- /**
- * 通过用户名获取AccessToke
- * @param $user
- * @return array
- */
- public function getAccessToken($user)
- {
- $loginToken = base64_encode($user) . '|' . md5($user . $GLOBALS['config']['settings']['apiLoginTonken']);
- $url = sprintf($this->rootUrl . "?user/loginSubmit&isAjax=1&getToken=1&login_token=%s", $loginToken);
- $client = new \GuzzleHttp\Client();
- $response = $client->request('GET', $url);
- //echo $response->getBody();
- $statusCode = $response->getStatusCode(); // 200
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (!$bodyArr['code']) {
- return [false, "获取kod access token 失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
- /**
- name:demo1 //用户账号
- password:123456 //用户密码
- sizeMax:2 //用户空间大小设置
- role:2 //用户角色id
- groupInfo:{"1":"write"} //用户所在部门及在部门对应的权限
- ----
- homePath:"D:/" //可选;自定义指定用户的根目录;
- * @return array
- */
- public function createUser($dataArr, $accessToken)
- {
- $url = sprintf($this->rootUrl . "?systemMember/add&accessToken=".$accessToken);
- $client = new \GuzzleHttp\Client();
- $response = $client->request('POST', $url,['form_params' => $dataArr]);
- $statusCode = $response->getStatusCode();
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (is_null($bodyArr) || !$bodyArr['code']) {
- return [false, "创建用户失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
- /**
- * @param $userName
- * @param $accessToken
- * @return array
- */
- public function getUser($userName, $accessToken)
- {
- $url = sprintf($this->rootUrl . "?systemMember/getByName&name={$userName}&accessToken=".$accessToken);
- $client = new \GuzzleHttp\Client();
- $dataArr['name'] = $userName;
- $response = $client->request('POST', $url,['form_params' => $dataArr]);
- $statusCode = $response->getStatusCode();
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (!$bodyArr['code']) {
- return [false, "获取用户{$userName}信息失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
- /**
- * @param $userId
- * @param $accessToken
- * @return array
- */
- public function deleteUser($userId, $accessToken)
- {
- $url = sprintf($this->rootUrl . '?systemMember/doAction&accessToken='.$accessToken);
- $client = new \GuzzleHttp\Client();
- $dataArr['action'] = 'del';
- $dataArr['userID'] = json_encode([$userId]);
- $response = $client->request('POST', $url,['form_params' => $dataArr]);
- $statusCode = $response->getStatusCode();
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (!$bodyArr['code']) {
- return [false, "删除用户失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
-
- /**
- * @param $accessToken
- * @return array
- */
- public function getUsers($accessToken)
- {
- $url = sprintf($this->rootUrl . "?systemMember/get&accessToken=".$accessToken);
- $client = new \GuzzleHttp\Client();
- $response = $client->request('GET', $url);
- $statusCode = $response->getStatusCode();
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (!$bodyArr['code']) {
- return [false, "获取用户列表失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
- public function getRoles($accessToken)
- {
- $url = sprintf($this->rootUrl . "?systemRole/get&accessToken=".$accessToken);
- $client = new \GuzzleHttp\Client();
- $response = $client->request('GET', $url);
- $statusCode = $response->getStatusCode();
- if ($statusCode != 200) {
- return [false, 'response status:' . $statusCode];
- }
- $bodyArr = json_decode($response->getBody(), true);
- if (!$bodyArr['code']) {
- return [false, "获取角色列表失败\r\n" . $response->getBody()];
- }
- return [true, $bodyArr['data']];
- }
-
-
-}
\ No newline at end of file
diff --git a/plugin/document/PluginSubscriber.php b/plugin/document/PluginSubscriber.php
deleted file mode 100644
index 54e2f23f0..000000000
--- a/plugin/document/PluginSubscriber.php
+++ /dev/null
@@ -1,63 +0,0 @@
-pluginName = $pluginName;
- // 载入事件订阅类和函数
- parent::getEventSubscriberFile(realpath(dirname(__FILE__)).DS.'event');
- parent::loadEventSubscriber($dispatcher, basename (__DIR__));
- }
-
- /**
- * @return array
- */
- public static function getSubscribedEvents()
- {
- return [
- basename (__CLASS__).'@'.\main\app\event\Events::onPluginInstall =>'onInstallEvent',
- basename (__CLASS__).'@'.\main\app\event\Events::onPluginUnInstall =>'onUnInstallEvent'
- ];
- }
-
- /**
- * 插件安装后的操作
- * @param $pluginPlacedEvent
- */
- public function onInstallEvent(PluginPlacedEvent $pluginPlacedEvent)
- {
- // var_dump($pluginPlacedEvent);
-
- }
-
- /**
- * 插件卸载后的操作
- * @param $pluginPlacedEvent
- */
- public function onUnInstallEvent(PluginPlacedEvent $pluginPlacedEvent)
- {
- // var_dump($pluginPlacedEvent);
- }
-
-
-}
\ No newline at end of file
diff --git a/plugin/document/common.function.php b/plugin/document/common.function.php
deleted file mode 100644
index d8bcb0dc9..000000000
--- a/plugin/document/common.function.php
+++ /dev/null
@@ -1,1043 +0,0 @@
- newInstanceArgs($args);
-}
-/**
- * 生产controller对象
- */
-function init_controller($controllerName){
- if (!class_exists($controllerName)) {
- $modelFile = CONTROLLER_DIR.$controllerName.'.class.php';
- if(!is_file($modelFile)){
- return false;
- }
- include_once($modelFile);
- }
- $reflectionObj = new ReflectionClass($controllerName);
- $args = func_get_args();
- array_shift($args);
- return $reflectionObj -> newInstanceArgs($args);
-}
-
-/**
- * 文本字符串转换
- */
-function mystr($str){
- $from = array("\r\n", " ");
- $to = array("
", " ");
- return str_replace($from, $to, $str);
-}
-
-// 清除多余空格和回车字符
-function strip($str){
- return preg_replace('!\s+!', '', $str);
-}
-
-// 删除字符串两端的字符串
-function str_trim($str,$remove){
- return str_rtrim(str_ltrim($str,$remove),$remove);
-}
-function str_ltrim($str,$remove){
- if(!$str || !$remove) return $str;
- while(substr($str,0,strlen($remove)) == $remove){
- $str = substr($str,strlen($remove));
- }
- return $str;
-}
-function str_rtrim($str,$remove){
- if(!$str || !$remove) return $str;
- while(substr($str,-strlen($remove)) == $remove){
- $str = substr($str,0,-strlen($remove));
- echo $str;
- }
- return $str;
-}
-
-/**
- * 获取精确时间
- */
-function mtime(){
- $t= explode(' ',microtime());
- $time = $t[0]+$t[1];
- return $time;
-}
-/**
- * 过滤HTML
- */
-function clear_html($HTML, $br = true){
- $HTML = htmlspecialchars(trim($HTML));
- $HTML = str_replace("\t", ' ', $HTML);
- if ($br) {
- return nl2br($HTML);
- } else {
- return str_replace("\n", '', $HTML);
- }
-}
-
-/**
- * 过滤js、css等
- */
-function filter_html($html){
- $find = array(
- "/<(\/?)(script|i?frame|style|html|body|title|link|meta|\?|\%)([^>]*?)>/isU",
- "/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",
- "/javascript\s*:/isU",
- );
- $replace = array("<\\1\\2\\3>","\\1\\2","");
- return preg_replace($find,$replace,$html);
-}
-
-
-function in_array_not_case($needle, $haystack) {
- return in_array(strtolower($needle),array_map('strtolower',$haystack));
-}
-
-/**
- * 将obj深度转化成array
- *
- * @param $obj 要转换的数据 可能是数组 也可能是个对象 还可能是一般数据类型
- * @return array || 一般数据类型
- */
-function obj2array($obj){
- if (is_array($obj)) {
- foreach($obj as &$value) {
- $value = obj2array($value);
- }
- return $obj;
- } elseif (is_object($obj)) {
- $obj = get_object_vars($obj);
- return obj2array($obj);
- } else {
- return $obj;
- }
-}
-
-function ignore_timeout(){
- @ignore_user_abort(true);
- @ini_set("max_execution_time",48 * 60 * 60);
- @set_time_limit(48 * 60 * 60);//set_time_limit(0) 2day
- @ini_set('memory_limit', '4000M');//4G;
-}
-
-
-function check_code($code){
- ob_clean();
- header("Content-type: image/png");
- $width = 70;$height=27;
- $fontsize = 18;$len = strlen($code);
- $im = @imagecreatetruecolor($width, $height) or die("create image error!");
- $background_color = imagecolorallocate($im,255, 255, 255);
- imagefill($im, 0, 0, $background_color);
- for ($i = 0; $i < 2000; $i++) {//获取随机淡色
- $line_color = imagecolorallocate($im, mt_rand(180,255),mt_rand(160, 255),mt_rand(100, 255));
- imageline($im,mt_rand(0,$width),mt_rand(0,$height), //画直线
- mt_rand(0,$width), mt_rand(0,$height),$line_color);
- imagearc($im,mt_rand(0,$width),mt_rand(0,$height), //画弧线
- mt_rand(0,$width), mt_rand(0,$height), $height, $width,$line_color);
- }
- $border_color = imagecolorallocate($im, 160, 160, 160);
- imagerectangle($im, 0, 0, $width-1, $height-1, $border_color);//画矩形,边框颜色200,200,200
- for ($i = 0; $i < $len; $i++) {//写入随机字串
- $text_color = imagecolorallocate($im,mt_rand(30, 140),mt_rand(30,140),mt_rand(30,140));
- imagechar($im,10,$i*$fontsize+6,rand(1,$height/3),$code[$i],$text_color);
- }
- imagejpeg($im);//显示图
- imagedestroy($im);//销毁图片
-}
-
-
-/**
- * 计算N次方根
- * @param $num
- * @param $root
- */
-function croot($num, $root = 3){
- $root = intval($root);
- if (!$root) {
- return $num;
- }
- return exp(log($num) / $root);
-}
-
-function add_magic_quotes($array){
- foreach ((array) $array as $k => $v) {
- if (is_array($v)) {
- $array[$k] = add_magic_quotes($v);
- } else {
- $array[$k] = addslashes($v);
- }
- }
- return $array;
-}
-// 字符串加转义
-function add_slashes($string){
- if (!$GLOBALS['magic_quotes_gpc']) {
- if (is_array($string)) {
- foreach($string as $key => $val) {
- $string[$key] = add_slashes($val);
- }
- } else {
- $string = addslashes($string);
- }
- }
- return $string;
-}
-
-
-function setcookie_header($name,$value='',$maxage=0,$path='',$domain='',$secure=false,$HTTPOnly=false){
- if ( !empty($domain) ){
- if ( strtolower( substr($domain, 0, 4) ) == 'www.' ) $domain = substr($domain, 4);
- if ( substr($domain, 0, 1) != '.' ) $domain = '.'.$domain;
- if ( strpos($domain, ':') ) $domain = substr($domain, 0, strpos($domain, ':'));
- }
- header('Set-Cookie: '.rawurlencode($name).'='.rawurlencode($value)
- .(empty($domain) ? '' : '; Domain='.$domain)
- .(empty($maxage) ? '' : '; Max-Age='.$maxage)
- .(empty($path) ? '' : '; Path='.$path)
- .(!$secure ? '' : '; Secure')
- .(!$HTTPOnly ? '' : '; HttpOnly').'; ', false);
- return true;
-}
-
-/**
- * hex to binary
- */
-if (!function_exists('hex2bin')) {
- function hex2bin($hexdata) {
- return pack('H*', $hexdata);
- }
-}
-
-if (!function_exists('gzdecode')) {
- function gzdecode($data){
- return gzinflate(substr($data,10,-8));
- }
-}
-
-function xml2json($decodeXml){
- $data = simplexml_load_string($decodeXml,'SimpleXMLElement', LIBXML_NOCDATA);
- return json_decode(json_encode($data),true);
-}
-
-/**
- * 二维数组按照指定的键值进行排序,
- *
- * @param $keys 根据键值
- * @param $type 升序降序
- * @return array
- * $array = array(
- * array('name'=>'手机','brand'=>'诺基亚','price'=>1050),
- * array('name'=>'手表','brand'=>'卡西欧','price'=>960)
- * );
- * $out = array_sort_by($array,'price');
- */
-function array_sort_by($records, $field, $reverse=false){
- $reverse = $reverse?SORT_DESC:SORT_ASC;
- array_multisort(array_column($records,$field),$reverse,$records);
- return $records;
-}
-
-if (!function_exists('array_column')) {
- function array_column($array, $column_key, $index_key = null) {
- $column_key_isNumber = (is_numeric($column_key)) ? true : false;
- $index_key_isNumber = (is_numeric($index_key)) ? true : false;
- $index_key_isNull = (is_null($index_key)) ? true : false;
-
- $result = array();
- foreach((array)$array as $key=>$val){
- if($column_key_isNumber){
- $tmp = array_slice($val, $column_key, 1);
- $tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : null;
- } else {
- $tmp = isset($val[$column_key]) ? $val[$column_key] : null;
- }
- if(!$index_key_isNull){
- if($index_key_isNumber){
- $key = array_slice($val, $index_key, 1);
- $key = (is_array($key) && !empty($key)) ? current($key) : null;
- $key = is_null($key) ? 0 : $key;
- }else{
- $key = isset($val[$index_key]) ? $val[$index_key] : 0;
- }
- }
- $result[$key] = $tmp;
- }
- return $result;
- }
-}
-
-/**
- * 遍历数组,对每个元素调用 $callback,假如返回值不为假值,则直接返回该返回值;
- * 假如每次 $callback 都返回假值,最终返回 false
- *
- * @param $array
- * @param $callback
- * @return mixed
- */
-function array_try($array, $callback){
- if (!$array || !$callback) {
- return false;
- }
- $args = func_get_args();
- array_shift($args);
- array_shift($args);
- if (!$args) {
- $args = array();
- }
- foreach($array as $v) {
- $params = $args;
- array_unshift($params, $v);
- $x = call_user_func_array($callback, $params);
- if ($x) {
- return $x;
- }
- }
- return false;
-}
-// 求多个数组的并集
-function array_union(){
- $argsCount = func_num_args();
- if ($argsCount < 2) {
- return false;
- } else if (2 === $argsCount) {
- list($arr1, $arr2) = func_get_args();
-
- while ((list($k, $v) = each($arr2))) {
- if (!in_array($v, $arr1)) $arr1[] = $v;
- }
- return $arr1;
- } else { // 三个以上的数组合并
- $arg_list = func_get_args();
- $all = call_user_func_array('array_union', $arg_list);
- return array_union($arg_list[0], $all);
- }
-}
-// 取出数组中第n项
-function array_get_index($arr,$index){
- foreach($arr as $k=>$v){
- $index--;
- if($index<0) return array($k,$v);
- }
-}
-
-function array_field_values($arr,$field){
- $result = array();
- foreach ($arr as $val) {
- if(is_array($val) && isset($val[$field])){
- $result[] = $val[$field];
- }
- }
- return $result;
-}
-
-// 删除数组某个值
-function array_remove_value($array, $value){
- $isNumericArray = true;
- foreach ($array as $key => $item) {
- if ($item === $value) {
- if (!is_int($key)) {
- $isNumericArray = false;
- }
- unset($array[$key]);
- }
- }
- if ($isNumericArray) {
- $array = array_values($array);
- }
- return $array;
-}
-
-// 获取数组key最大的值
-function array_key_max($array){
- if(count($array)==0){
- return 1;
- }
- $idArr = array_keys($array);
- rsort($idArr,SORT_NUMERIC);//id从高到底
- return intval($idArr[0]);
-}
-
-//set_error_handler('errorHandler',E_ERROR|E_PARSE|E_CORE_ERROR|E_COMPILE_ERROR|E_USER_ERROR);
-register_shutdown_function('fatalErrorHandler');
-function errorHandler($err_type,$errstr,$errfile,$errline){
- if (($err_type & E_WARNING) === 0 && ($err_type & E_NOTICE) === 0) {
- return false;
- }
- $arr = array(
- $err_type,
- $errstr,
- //" in [".$errfile.']',
- " in [".get_path_this(get_path_father($errfile)).'/'.get_path_this($errfile).']',
- 'line:'.$errline,
- );
- $str = implode(" ",$arr)."
";
- show_tips($str);
-}
-
-//捕获fatalError
-function fatalErrorHandler(){
- $e = error_get_last();
- switch($e['type']){
- case E_ERROR:
- case E_PARSE:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- errorHandler($e['type'],$e['message'],$e['file'],$e['line']);
- break;
- case E_NOTICE:break;
- default:break;
- }
-}
-
-function show_tips($message,$url= '', $time = 3,$title = '',$exit = true){
- ob_get_clean();
- header('Content-Type: text/html; charset=utf-8');
- $goto = "content='$time;url=$url'";
- $info = "{$time}s 后自动跳转, 立即跳转";
- if ($url == "") {
- $goto = "";
- $info = "";
- } //是否自动跳转
-
- if($title == ''){
- $title = "出错了!";
- }
- //移动端;报错输出
- if(isset($_REQUEST['HTTP_X_PLATFORM'])){
- show_json($message,false);
- }
-
- if(is_array($message) || is_object($message)){
- $message = json_encode_force($message);
- $message = htmlspecialchars($message);
- $message = "
".$message.''; - }else{ - $message = filter_html(nl2br($message)); - } - if(file_exists(TEMPLATE.'common/showTips.html')){ - include(TEMPLATE.'common/showTips.html'); - if($exit){exit;} - } - echo<<