コード例 #1
0
ファイル: RecycleService.php プロジェクト: youngsun45/miniyun
 public function search()
 {
     $fileName = MiniHttp::getParam("file_name", "");
     $arr = new RecycleBiz();
     $data = $arr->search($fileName);
     return $data;
 }
コード例 #2
0
ファイル: UserService.php プロジェクト: youngsun45/miniyun
 public function saveSortType()
 {
     $type = MiniHttp::getParam("type", "");
     $sortOrder = MiniHttp::getParam("sortOrder", "");
     $biz = new UserBiz();
     return $biz->saveSortType($type, $sortOrder);
 }
コード例 #3
0
ファイル: SiteService.php プロジェクト: youngsun45/miniyun
 /**
  * 根据OpenId获得accessToken
  */
 public function bind()
 {
     $appKey = MiniHttp::getParam('app_key', "");
     $openId = MiniHttp::getParam('open_id', "");
     $biz = new SiteBiz();
     return $biz->bindOpenId($appKey, $openId);
 }
コード例 #4
0
 /**
  * 根據文件Id获取文件数据
  */
 public function getLink($fileId, $linkType, $shareKey)
 {
     $data = array();
     $file = MiniFile::getInstance()->getById($fileId);
     $data["name"] = $file["file_name"];
     $data["bytes"] = intval($file["file_size"] + "");
     $fileType = $file["file_type"];
     if ($fileType == 0) {
         $data["icon"] = MiniHttp::getIcon4File($file["file_name"]);
         if (!MiniUtil::isMixCloudVersion()) {
             $data["icon"] = MiniHttp::getMiniHost() . "statics/static/mini-box/images/link/" . $data["icon"];
         } else {
             $data["icon"] = "http://static.miniyun.cn/static/mini-box/images/link/" . $data["icon"];
         }
     }
     $ext = MiniUtil::getFileExtension($file["file_name"]);
     $path = MiniUtil::getRelativePath($file["file_path"]);
     if ($ext == "jpg" || $ext == "jpeg" || $ext == "png" || $ext == "gif") {
         $data["thumbnail_link"] = MiniHttp::createAnonymousUrl("linkAccess/thumbnail?key=" . $shareKey . "&size=256x256&path=" . urlencode($path));
     } else {
         $data["thumbnail_link"] = "";
     }
     if ($linkType == MiniLink::$PREVIEW_LINK) {
         $data["link"] = MiniHttp::createUrl("link/access/key/" . $shareKey);
     } else {
         $data["link"] = MiniHttp::createAnonymousUrl("linkAccess/download?key=" . $shareKey . "&path=" . urlencode($path));
     }
     return $data;
 }
コード例 #5
0
ファイル: HistoryService.php プロジェクト: youngsun45/miniyun
 /**
  * 恢复版本
  */
 public function recover()
 {
     $signature = MiniHttp::getParam("signature", "-1");
     $path = MiniHttp::getParam("file_path", "");
     $history = new HistoryBiz();
     $result = $history->recover($signature, $path);
     return array('success' => $result);
 }
コード例 #6
0
 /**
  * 获取在线用户列表
  */
 public function getList()
 {
     $pageSize = MiniHttp::getParam('page_size', 10);
     $currentPage = MiniHttp::getParam('current_page', 1);
     $model = new OnlineListBiz();
     $data = $model->getOnlineUsers($pageSize, $currentPage);
     return $data;
 }
コード例 #7
0
 public function miniyun()
 {
     $sharedPath = MiniHttp::getParam('shared_path', '');
     $urlManager = new MUrlManager();
     $urlArray = $urlManager->parseActionFromUrl();
     $metadataController = new MMetadataController();
     $metadataController->invoke($urlArray["uri"], $sharedPath);
 }
コード例 #8
0
 /**
  * 设置迷你云默认地址,迷你文档服务器下载文件内容需要获得这个地址
  */
 private function setDefault()
 {
     //判断是否在网页启动数据库生成,在command模式下无法获得$_SERVER的值
     if (array_key_exists("SERVER_PORT", $_SERVER)) {
         $host = MiniHttp::getMiniHost();
         MiniOption::getInstance()->setOptionValue("miniyun_host", $host);
     }
 }
コード例 #9
0
ファイル: AlbumService.php プロジェクト: youngsun45/miniyun
 /**
  * download file
  */
 public function getList()
 {
     $pageSize = MiniHttp::getParam("pageSize", "");
     $page = MiniHttp::getParam("page", "");
     $biz = new AlbumBiz();
     $list = $biz->getPage($page, $pageSize);
     return $list;
 }
コード例 #10
0
 /**
  * 根据用户名或设备名查找设备信息
  */
 public function searchDevicesByName()
 {
     $pageSize = MiniHttp::getParam('page_size', 10);
     $currentPage = MiniHttp::getParam('current_page', 1);
     $key = MiniHttp::getParam('key', '');
     $model = new DeviceManageBiz();
     $data = $model->searchDevicesByName($key, $pageSize, $currentPage);
     return $data;
 }
コード例 #11
0
ファイル: SiteController.php プロジェクト: youngsun45/miniyun
 /**
  * This is the action to handle external exceptions.
  */
 public function actionError()
 {
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest || MiniHttp::isPCClient()) {
             echo $error['message'];
         } else {
             $this->render('error', $error);
         }
     }
 }
コード例 #12
0
 /**
  * 商业版主题参数设置接口
  */
 public function setParams()
 {
     $companyName = MiniHttp::getParam('company_name', "");
     $productName = MiniHttp::getParam('product_name', "");
     $companyEnglishName = MiniHttp::getParam('company_english_name', "");
     $helpUrl = MiniHttp::getParam('help_url', "");
     $helpName = MiniHttp::getParam('help_name', "");
     $biz = new PluginBusinessThemeBiz();
     $biz->setParams($companyName, $productName, $companyEnglishName, $helpUrl, $helpName);
 }
コード例 #13
0
 /**
  * 修改迷你搜索节点的状态
  */
 public function nodeStatus()
 {
     $name = MiniHttp::getParam("name", "");
     $status = MiniHttp::getParam("status", "0");
     if (empty($name)) {
         throw new MiniException(100302);
     }
     $biz = new PluginMiniSearchBiz();
     return $biz->modifyNodeStatus($name, $status);
 }
コード例 #14
0
ファイル: ChooserService.php プロジェクト: youngsun45/miniyun
 /**
  * 选择器名字的列表
  */
 public function getList()
 {
     $pageSize = MiniHttp::getParam('page_size', 10);
     $currentPage = MiniHttp::getParam('current_page', 1);
     $type = MiniHttp::getParam('type', 'web');
     $items = MiniChooser::getInstance()->getPageList($pageSize, $currentPage, $type);
     $total = MiniChooser::getInstance()->getTotal($type);
     $value['items'] = $items;
     $value['total'] = $total;
     return $value;
 }
コード例 #15
0
 /**
  * 修改editor
  */
 public function updateEditor()
 {
     $selectExtend = MiniHttp::getParam('select_extend', "");
     $extend = MiniHttp::getParam('extend', "");
     $firstMethod = MiniHttp::getParam('first_method', "");
     $secondMethod = MiniHttp::getParam('second_method', "");
     $editorTip = MiniHttp::getParam('editor_tip', "");
     $model = new EditorManageBiz();
     $data = $model->updateEditor($selectExtend, $extend, $firstMethod, $secondMethod, $editorTip);
     return array('success' => $data);
 }
コード例 #16
0
ファイル: EventService.php プロジェクト: youngsun45/miniyun
 public function getList()
 {
     $path = MiniHttp::getParam('path', '');
     $time = MiniHttp::getParam("time", "-1");
     $deviceUuid = MiniHttp::getParam('device_uuid', '-1');
     $currentPage = MiniHttp::getParam('current_page', '1');
     $pageSize = MiniHttp::getParam('page_size', '20');
     $model = new EventBiz();
     $data = $model->getList($path, $time, $deviceUuid, $pageSize, $currentPage);
     return $data;
 }
コード例 #17
0
ファイル: SiteBiz.php プロジェクト: youngsun45/miniyun
 /**
  * 获得站点信息
  */
 public static function getSiteInfo()
 {
     $data = array();
     $data['version'] = APP_VERSION;
     $data['status'] = "done";
     $data['app_name'] = 100;
     $data['app_logo'] = MiniHttp::getSystemParam("absoluteUrl") . "/static/images/logo.png";
     $data['default_size'] = 100;
     $data['can_register'] = true;
     $data['register_url'] = "";
     //产品名称
     $value = MiniOption::getInstance()->getOptionValue('site_name');
     if (isset($value)) {
         $data['app_name'] = $value;
     }
     //站点ID
     $data['code'] = MiniSiteUtils::getSiteCode();
     $data['site_id'] = MiniSiteUtils::getSiteID();
     $data['wx_token'] = MiniSiteUtils::getWxToken();
     //产品Logo
     $value = MiniOption::getInstance()->getOptionValue('site_logo_url');
     if (isset($value)) {
         $data['app_logo'] = MiniHttp::getSystemParam("absoluteUrl") . $value;
     }
     //判断系统是否可以注册
     $enableReg = MiniOption::getInstance()->getOptionValue("user_register_enabled");
     if (isset($enableReg) && $enableReg == "0") {
         $data['can_register'] = false;
     }
     //系统注册入口是否在第3方
     $value = MiniOption::getInstance()->getOptionValue("user_create_url");
     if (isset($value) && !empty($value)) {
         $data['register_url'] = $value;
     }
     // 32M
     $blockSize = 4 * 1024 * 1024;
     // 内存配置需要
     $memoryLimit = CUtils::return_bytes(ini_get('memory_limit'));
     if ($memoryLimit < 4 * $blockSize) {
         $blockSize = $memoryLimit / 4;
     }
     $postMaxSize = CUtils::return_bytes(ini_get('post_max_size'));
     $uploadMaxFileSize = CUtils::return_bytes(ini_get('upload_max_filesize'));
     $min = $postMaxSize > $uploadMaxFileSize ? $uploadMaxFileSize : $postMaxSize;
     $data['block_size'] = $min > $blockSize ? $blockSize : $min;
     if ($data['block_size'] == $postMaxSize && $data['block_size'] == $uploadMaxFileSize) {
         $data['block_size'] = $data['block_size'] - 104858;
     }
     // 获取忘记密码使用短信口子地址
     $forgetPasswordUrl = MiniHttp::getSystemParam("absoluteUrl");
     $data['forget_password_url'] = $forgetPasswordUrl;
     return $data;
 }
コード例 #18
0
ファイル: MessageBiz.php プロジェクト: youngsun45/miniyun
 public function getStatusList()
 {
     $pageSize = MiniHttp::getParam('pageSize', '');
     $page = MiniHttp::getParam('page', '');
     $pageSet = ($page - 1) * $pageSize;
     $sessionUser = $this->user;
     $userId = $sessionUser["id"];
     $value = MiniMessage::getInstance()->getMessageStatus($pageSize, $pageSet, $userId);
     $list["list"] = $this->createArray($value);
     $list["total"] = MiniMessage::getInstance()->getMessageStatusCount($userId);
     return $list;
 }
コード例 #19
0
 /**
  * 存储AD信息
  */
 public function setAdInfo()
 {
     $adInfo = array();
     $adInfo['ad_ldap_host'] = MiniHttp::getParam('ad_ldap_host', "");
     $adInfo['ad_ldap_port'] = MiniHttp::getParam('ad_ldap_port', "");
     $adInfo['ad_ldap_base_cn'] = MiniHttp::getParam('ad_ldap_base_cn', "");
     $adInfo['ad_coding'] = MiniHttp::getParam('ad_coding', "");
     $adInfo['ad_white_list_open'] = MiniHttp::getParam('ad_white_list_open', "");
     $adInfo['ad_sync_department'] = MiniHttp::getParam('ad_sync_department', "");
     $adInfo['ad_test_user_name'] = MiniHttp::getParam('user_name', "");
     $adInfo['ad_test_password'] = MiniHttp::getParam('password', "");
     $model = new PluginAdBiz();
     return $model->setAdInfo($adInfo);
 }
コード例 #20
0
 /**
  * 存储LDAP信息
  */
 public function setLdapInfo()
 {
     $ldapInfo = array();
     $ldapInfo['ldap_host'] = MiniHttp::getParam('ldap_host', "");
     $ldapInfo['ldap_port'] = MiniHttp::getParam('ldap_port', "");
     $ldapInfo['ldap_base_cn'] = MiniHttp::getParam('ldap_base_cn', "");
     $ldapInfo['ldap_primary_key'] = strtolower(MiniHttp::getParam('ldap_primary_key', ""));
     $ldapInfo['ldap_nick'] = strtolower(MiniHttp::getParam('ldap_nick', ""));
     $ldapInfo['ldap_department_name'] = strtolower(MiniHttp::getParam('ldap_department_name', ""));
     $ldapInfo['ldap_coding'] = MiniHttp::getParam('ldap_coding', "");
     $ldapInfo['ldap_white_list_open'] = MiniHttp::getParam('ldap_white_list_open', "");
     $ldapInfo['ldap_sync_department'] = MiniHttp::getParam('ldap_sync_department', "");
     $ldapInfo['ldap_test_user_name'] = MiniHttp::getParam('user_name', "");
     $ldapInfo['ldap_test_password'] = MiniHttp::getParam('password', "");
     $model = new PluginLdapBiz();
     return $model->setLdapInfo($ldapInfo);
 }
コード例 #21
0
 public function invoke()
 {
     $route = MiniHttp::getParam("route", "");
     if (!empty($route)) {
         //1.7调用方式
         //插件的接口访问形式如下
         //{http://t.miniyun.cn/api.php?route=module/miniDoc/list&page_size=16&page=1&mime_type=application/msword}
         //执行该类的方式是PluginMiniDocService.download方法
         if ($this->isPluginSendRequest()) {
             //查询是否是来自插件的请求
             $info = explode("/", $route);
             $pluginName = $info[1];
             $className = "Plugin" . ucfirst($pluginName) . "Service";
             $service = new $className();
             $result = $service->invoke($info[2]);
             echo json_encode($result);
             exit;
         } else {
             $info = explode("/", $route);
             $module = $info[0];
             $class = ucfirst($module) . "Service";
             $service = new $class();
             $result = $service->invoke($info[1]);
             echo json_encode($result);
             exit;
         }
     } else {
         //1.5调用方式
         $uri = $this->getFilterUrl();
         $info = explode("/", $uri);
         $module = $info[3];
         $whiteList = $this->getWhiteList();
         foreach ($whiteList as $item) {
             if ($module === $item) {
                 $newUri = "/" . implode("/", array_slice($info, 3));
                 $class = ucfirst($module) . "Service";
                 $service = new $class();
                 $result = $service->invoke($newUri);
                 echo json_encode($result);
                 exit;
             }
         }
     }
 }
コード例 #22
0
 /**
  * 检查密码
  * @return mixed
  */
 public function checkPassword()
 {
     $key = MiniHttp::getParam("key", "");
     $password = MiniHttp::getParam("password", "");
     $result = MiniLink::getInstance()->checkPassword($key, $password);
     return $result;
 }
コード例 #23
0
 /**
  * 获取站点的基本信息
  */
 public function getSiteInfo()
 {
     $data = array();
     $data['siteTitle'] = MiniOption::getInstance()->getOptionValue('site_title');
     $data['siteName'] = MiniOption::getInstance()->getOptionValue('site_name');
     $data['siteDefaultSpace'] = MiniOption::getInstance()->getOptionValue('site_default_space');
     $data['siteCompany'] = MiniOption::getInstance()->getOptionValue('site_company');
     $data['userRegisterEnabled'] = MiniOption::getInstance()->getOptionValue('user_register_enabled');
     $miniHost = MiniOption::getInstance()->getOptionValue('miniyun_host');
     if (empty($miniHost)) {
         $miniHost = MiniHttp::getMiniHost();
         MiniOption::getInstance()->setOptionValue('miniyun_host', $miniHost);
     }
     $data['miniyun_host'] = $miniHost;
     $data['fileStorePath'] = BASE;
     return $data;
 }
コード例 #24
0
 /**
  * 创建默认站点
  */
 public function createDefault()
 {
     $nodes = $this->getNodeList();
     if (count($nodes) > 2) {
         return true;
     }
     if (count($nodes) == 1) {
         $node = StoreNode::model()->find("id=:id", array("id" => $nodes[0]["id"]));
     } else {
         $node = new StoreNode();
         $node->saved_file_count = 0;
         $node->downloaded_file_count = 0;
         $node->safe_code = "uBEEAcKM2D7sxpJD7QQEapsxiCmzPCyS";
         $node->name = "store1";
     }
     $host = MiniHttp::getMiniHost();
     $miniHostInfo = parse_url($host);
     $node->host = $miniHostInfo["scheme"] . "://" . $miniHostInfo["host"] . ":6081" . $miniHostInfo["path"];
     $node->status = 1;
     $node->save();
 }
コード例 #25
0
ファイル: PrivilegeBiz.php プロジェクト: youngsun45/miniyun
 /**
  * 获得拥有权限的用户列表
  */
 public function getPrivilegeList($filePath)
 {
     //获得绝对路径
     $privileges = MiniUserPrivilege::getInstance()->getPrivilegeList($filePath);
     $groupPrivileges = MiniGroupPrivilege::getInstance()->getPrivilegeList($filePath);
     $data = array();
     foreach ($privileges as $item) {
         $user = MiniUser::getInstance()->getUser($item['user_id']);
         $privilege = array();
         $privilege['id'] = $user['user_id'];
         $privilege['name'] = $user['user_name'];
         $privilege['nick'] = $user['nick'];
         $privilege['avatar'] = $user['avatar'];
         $privilege['user_status'] = $user['user_status'];
         $permission = $item['permission'];
         $readValue = substr($permission, 0, 1);
         $modifyValue = substr($permission, 1);
         $dirCreateValue = substr($permission, 1, 1);
         $dirRenameValue = substr($permission, 2, 1);
         $dirDelValue = substr($permission, 3, 1);
         $fileUploadValue = substr($permission, 4, 1);
         $contentValue = substr($permission, 5, 1);
         $fileRenameValue = substr($permission, 6, 1);
         $fileDelValue = substr($permission, 7, 1);
         $previewValue = substr($permission, 8, 1);
         if ($readValue == '1') {
             //read权限 与js格式转化为一致
             $privilege['view'] = true;
         } else {
             $privilege['view'] = false;
         }
         if ($dirCreateValue == '1') {
             //dir_create权限 与js格式转化为一致
             $privilege['dir_create'] = true;
         } else {
             $privilege['dir_create'] = false;
         }
         if ($dirRenameValue == '1') {
             //dir_rename权限 与js格式转化为一致
             $privilege['dir_rename'] = true;
         } else {
             $privilege['dir_rename'] = false;
         }
         if ($dirDelValue == '1') {
             //dir_del权限 与js格式转化为一致
             $privilege['dir_delete'] = true;
         } else {
             $privilege['dir_delete'] = false;
         }
         if ($fileUploadValue == '1') {
             //file_upload权限 与js格式转化为一致
             $privilege['file_upload'] = true;
         } else {
             $privilege['file_upload'] = false;
         }
         if ($fileRenameValue == '1') {
             //file_rename权限 与js格式转化为一致
             $privilege['file_rename'] = true;
         } else {
             $privilege['file_rename'] = false;
         }
         if ($contentValue == '1') {
             //content权限 与js格式转化为一致
             $privilege['file_edit'] = true;
         } else {
             $privilege['file_edit'] = false;
         }
         if ($fileDelValue == '1') {
             //file_del权限 与js格式转化为一致
             $privilege['file_delete'] = true;
         } else {
             $privilege['file_delete'] = false;
         }
         if ($previewValue == '1') {
             //preview权限 与js格式转化为一致
             $privilege['download'] = true;
         } else {
             $privilege['download'] = false;
         }
         if ($modifyValue == '11111111') {
             $privilege['modified'] = true;
         } else {
             $privilege['modified'] = false;
         }
         $privilege['type'] = "0";
         array_push($data, $privilege);
     }
     foreach ($groupPrivileges as $item) {
         $group = MiniGroup::getInstance()->getById($item['group_id']);
         $privilege = array();
         $privilege['id'] = $item['group_id'];
         $privilege['name'] = $group['group_name'];
         $privilege['nick'] = $group['group_name'];
         $privilege['avatar'] = MiniHttp::getMiniHost() . "static/images/icon_group.png";
         $permission = $item['permission'];
         $readValue = substr($permission, 0, 1);
         $modifyValue = substr($permission, 1);
         $dirCreateValue = substr($permission, 1, 1);
         $dirRenameValue = substr($permission, 2, 1);
         $dirDelValue = substr($permission, 3, 1);
         $fileUploadValue = substr($permission, 4, 1);
         $contentValue = substr($permission, 5, 1);
         $fileRenameValue = substr($permission, 6, 1);
         $fileDelValue = substr($permission, 7, 1);
         $previewValue = substr($permission, 8, 1);
         if ($readValue == '1') {
             //read权限 与js格式转化为一致
             $privilege['view'] = true;
         } else {
             $privilege['view'] = false;
         }
         if ($dirCreateValue == '1') {
             //dir_create权限 与js格式转化为一致
             $privilege['dir_create'] = true;
         } else {
             $privilege['dir_create'] = false;
         }
         if ($dirRenameValue == '1') {
             //dir_rename权限 与js格式转化为一致
             $privilege['dir_rename'] = true;
         } else {
             $privilege['dir_rename'] = false;
         }
         if ($dirDelValue == '1') {
             //dir_del权限 与js格式转化为一致
             $privilege['dir_delete'] = true;
         } else {
             $privilege['dir_delete'] = false;
         }
         if ($fileUploadValue == '1') {
             //file_upload权限 与js格式转化为一致
             $privilege['file_upload'] = true;
         } else {
             $privilege['file_upload'] = false;
         }
         if ($fileRenameValue == '1') {
             //file_rename权限 与js格式转化为一致
             $privilege['file_rename'] = true;
         } else {
             $privilege['file_rename'] = false;
         }
         if ($contentValue == '1') {
             //content权限 与js格式转化为一致
             $privilege['file_edit'] = true;
         } else {
             $privilege['file_edit'] = false;
         }
         if ($fileDelValue == '1') {
             //file_del权限 与js格式转化为一致
             $privilege['file_delete'] = true;
         } else {
             $privilege['file_delete'] = false;
         }
         if ($previewValue == '1') {
             //preview权限 与js格式转化为一致
             $privilege['download'] = true;
         } else {
             $privilege['download'] = false;
         }
         if ($modifyValue == '11111111') {
             $privilege['modified'] = true;
         } else {
             $privilege['modified'] = false;
         }
         $privilege['type'] = "1";
         array_push($data, $privilege);
     }
     return $data;
 }
コード例 #26
0
 /**
  * 控制器执行主逻辑函数
  */
 public function invoke($uri = null)
 {
     $this->setAction(MConst::CREATE_FILE);
     // 调用父类初始化函数,注册自定义的异常和错误处理逻辑
     parent::init();
     $urlManager = new MUrlManager();
     $root = $urlManager->parseRootFromUrl($uri);
     if ($root == false) {
         //支持参数模式传递上传路径
         $path = MiniHttp::getParam("path", "");
         if (empty($path)) {
             throw new MFilesException(Yii::t('api', MConst::PATH_ERROR), MConst::HTTP_CODE_411);
         }
     }
     // 初始化创建文件公共类句柄
     $createFileHandler = MFilesCommon::initMFilesCommon();
     if (count($_FILES) == 0) {
         throw new MFilesException(Yii::t('api', MConst::PARAMS_ERROR . "5"), MConst::HTTP_CODE_400);
     }
     $keys = array_keys($_FILES);
     if (count($keys) != 1) {
         throw new MFilesException(Yii::t('api', MConst::PARAMS_ERROR . "6"), MConst::HTTP_CODE_400);
     }
     $key = $keys[0];
     // 检查请求参数$_FILES
     if (isset($_FILES[$key]) === false) {
         throw new MFilesException(Yii::t('api', MConst::PARAMS_ERROR . "7"), MConst::HTTP_CODE_400);
     }
     // 检查文件上传过程是否有错
     if ($_FILES[$key]["error"] != 0) {
         throw new MFilesException(Yii::t('api', MConst::PARAMS_ERROR . "8"), MConst::HTTP_CODE_400);
     }
     $fileName = $_FILES[$key]["name"];
     $type = MiniUtil::getMimeType($fileName);
     $size = $_FILES[$key]["size"];
     $tmpName = $_FILES[$key]["tmp_name"];
     // 验证文件是否已经上传成功
     if (file_exists($tmpName) === false) {
         throw new MFilesException(Yii::t('api', MConst::INTERNAL_SERVER_ERROR), MConst::HTTP_CODE_500);
     }
     // 检查文件上传错误
     if (filesize($tmpName) != $size) {
         throw new MFilesException(Yii::t('api', "The file upload error!"), MConst::HTTP_CODE_400);
     }
     //断点文件上传
     if ($this->isBreakpointUpload()) {
         $filesController = new MFilePutController();
         $filesController->invoke($uri);
     } else {
         //完整文件上传
         $signature = MiniUtil::getFileHash($tmpName);
         // 解析路径
         $path = MiniHttp::getParam("path", "");
         $path = MiniUtil::specialWordReplace($path);
         $parentPath = dirname($path);
         $user = MUserManager::getInstance()->getCurrentUser();
         $parentFile = MiniFile::getInstance()->getByPath($parentPath);
         //如果目录存在,且该目录is_delete=1,则把目录状态删除状态修改为0
         if (!empty($parentFile) && $parentFile['is_deleted'] == 1) {
             $values = array();
             $values['is_deleted'] = false;
             MiniFile::getInstance()->updateByPath($parentPath, $values);
         } else {
             //如果是根目录,则不用新建目录
             //否则会创建文件名名称的文件夹出来,而且目标文件位于该文件夹的下面
             if (!MiniUtil::isRootPath($parentPath, $user["id"])) {
                 MiniFile::getInstance()->createFolder($parentPath, $user['id']);
             }
         }
         $createFileHandler->size = $size;
         $createFileHandler->parent_path = MUtils::convertStandardPath($parentPath);
         $createFileHandler->file_name = MiniUtil::specialWordReplace($fileName);
         $createFileHandler->root = $root;
         $createFileHandler->path = MUtils::convertStandardPath($path);
         $createFileHandler->type = $type;
         // 文件不存在,保存文件
         $createFileHandler->saveFile($tmpName, $signature, $size);
         // 保存文件meta
         $createFileHandler->saveFileMeta();
         // 处理不同端,不同返回值
         if (MUserManager::getInstance()->isWeb() === true) {
             $createFileHandler->buildWebResponse();
             return;
         }
         $createFileHandler->buildResult();
     }
 }
コード例 #27
0
ファイル: GroupService.php プロジェクト: youngsun45/miniyun
 /**
  * 用户与群组解绑
  */
 public function unbind()
 {
     $userId = MiniHttp::getParam("user_id", "");
     $groupId = MiniHttp::getParam("group_id", "");
     $biz = new GroupBiz();
     return $biz->unbind($userId, $groupId);
 }
コード例 #28
0
ファイル: api.php プロジェクト: youngsun45/miniyun
date_default_timezone_set("PRC");
defined('YII_DEBUG') or define('YII_DEBUG', false);
@ini_set('display_errors', '1');
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
// change the following paths if necessary
$config = dirname(__FILE__) . '/protected/config/main.php';
$yii = dirname(__FILE__) . '/yii/framework/yii.php';
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 8);
// 客户端请求
defined('CLIENT_REQUEST_API') or define('CLIENT_REQUEST_API', TRUE);
require_once $yii;
Yii::createWebApplication($config);
header('Access-Control-Allow-Origin: http://static.miniyun.cn');
header('Access-Control-Allow-Methods: POST');
header('Access-Control-Allow-Methods: GET');
MiniAppParam::getInstance()->load();
//初始化APP静态数据
MiniPlugin::getInstance()->load();
//加载插件
$routePath = MiniHttp::getParam("route", "");
if (empty($routePath)) {
    //老接口
    $meta = new MAPIController();
    //通过meta的控制器进行跳转处理逻辑
    $meta->invoke();
} else {
    //新接口
    $api = new APIController();
    $api->invoke();
}
コード例 #29
0
ファイル: install.php プロジェクト: youngsun45/miniyun
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
echo NAME_ZH;
?>
 &rsaquo; <?php 
echo Yii::t("front_common", "install_title");
?>
</title>
<link rel="shortcut icon" href="<?php 
echo Yii::app()->params['app']['host'] . Yii::app()->params['app']['logoSmall'];
?>
" />
<link rel="stylesheet" href="<?php 
echo MiniHttp::getMiniHost();
?>
static/css/install.css?v=<?php 
echo APP_VERSION;
?>
" type="text/css" />
<style>
.errorSummary {
	border: 2px solid #C00;
	padding: 7px 7px 12px 7px;
	margin: 0 0 20px 0;
	background: #FEE;
	font-size: 0.9em;
}
.errorMessage {color: red;font-size: 0.9em;}
.errorSummary p {margin: 0;padding: 5px;}
コード例 #30
0
 /**
  *修改用户绑定的用户组
  */
 public function modifyBind()
 {
     $userId = MiniHttp::getParam('user_id', '');
     $groupId = MiniHttp::getParam('new_group_id', '');
     $biz = new DepartmentBiz();
     $result = $biz->modifyBind($userId, $groupId);
     return $result;
 }