当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_Utils::securePath方法代码示例

本文整理汇总了PHP中AJXP_Utils::securePath方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::securePath方法的具体用法?PHP AJXP_Utils::securePath怎么用?PHP AJXP_Utils::securePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AJXP_Utils的用法示例。


在下文中一共展示了AJXP_Utils::securePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initFromArray

 function initFromArray($array)
 {
     if (!is_array($array)) {
         return;
     }
     if (isset($array[$this->varPrefix]) && $array[$this->varPrefix] != "") {
         $this->files[] = AJXP_Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix]));
         $this->isUnique = true;
         //return ;
     }
     if (isset($array[$this->varPrefix . "_0"])) {
         $index = 0;
         while (isset($array[$this->varPrefix . "_" . $index])) {
             $this->files[] = AJXP_Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix . "_" . $index]));
             $index++;
         }
         $this->isUnique = false;
         if (count($this->files) == 1) {
             $this->isUnique = true;
         }
         //return ;
     }
     if (isset($array[$this->dirPrefix])) {
         $this->dir = AJXP_Utils::securePath($array[$this->dirPrefix]);
         if ($test = $this->detectZip($this->dir)) {
             $this->inZip = true;
             $this->zipFile = $test[0];
             $this->localZipPath = $test[1];
         }
     }
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:31,代码来源:class.UserSelection.php

示例2: initPath

 /**
  * Initialize the stream from the given path.
  */
 protected static function initPath($path, $streamType = '', $storeOpenContext = false, $skipZip = true)
 {
     $url = AJXP_Utils::safeParseUrl($path);
     $repoId = $url["host"];
     $path = $url["path"];
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         throw new Exception("Cannot find repository with id " . $repoId);
     }
     $basePath = $repoObject->getOption("PATH");
     $host = $repoObject->getOption("SFTP_HOST");
     $port = $repoObject->getOption("SFTP_PORT");
     $credentials = AJXP_Safe::tryLoadingCredentialsFromSources($url, $repoObject);
     $user = $credentials["user"];
     $pass = $credentials["password"];
     if ($basePath[strlen($basePath) - 1] == "/") {
         $basePath = substr($basePath, 0, -1);
     }
     if ($basePath[0] != "/") {
         $basePath = "/{$basePath}";
     }
     $path = AJXP_Utils::securePath($path);
     if ($path[0] == "/") {
         $path = substr($path, 1);
     }
     return "sftp://" . $user . ':' . $pass . '@' . $host . ':' . $port . $basePath . "/" . $path;
     // http://username:password@hostname:port/path/file.ext
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:31,代码来源:class.sftpPSLAccessWrapper.php

示例3: initPath

 /**
  * Initialize the stream from the given path. 
  * Concretely, transform ajxp.webdav:// into webdav://
  *
  * @param string $path
  * @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
  */
 protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
 {
     $url = parse_url($path);
     $repoId = $url["host"];
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         throw new Exception("Cannot find repository with id " . $repoId);
     }
     $path = $url["path"];
     $host = $repoObject->getOption("HOST");
     $host = str_replace(array("http", "https"), array("webdav", "webdavs"), $host);
     // MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
     $basePath = $repoObject->getOption("PATH");
     if ($basePath[strlen($basePath) - 1] == "/") {
         $basePath = substr($basePath, 0, -1);
     }
     if ($basePath[0] != "/") {
         $basePath = "/{$basePath}";
     }
     $path = AJXP_Utils::securePath($path);
     if ($path[0] == "/") {
         $path = substr($path, 1);
     }
     // SHOULD RETURN webdav://host_server/uri/to/webdav/folder
     return $host . $basePath . "/" . $path;
 }
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:33,代码来源:class.webdavAccessWrapper.php

示例4: __construct

 /**
  * Initialize an empty mask, or from a serializedForm.
  * @param array|null $serializedForm
  */
 function __construct($serializedForm = null)
 {
     if ($serializedForm != null) {
         foreach ($serializedForm as $path => $permissionValue) {
             $path = AJXP_Utils::sanitize(AJXP_Utils::securePath($path), AJXP_SANITIZE_DIRNAME);
             if (!is_array($permissionValue) || $permissionValue["children"]) {
                 continue;
             }
             $perm = new AJXP_Permission();
             if ($permissionValue["read"]) {
                 $perm->setRead();
             }
             if ($permissionValue["write"]) {
                 $perm->setWrite();
             }
             if ($permissionValue["deny"]) {
                 $perm->setDeny();
             }
             if ($perm->isEmpty()) {
                 continue;
             }
             $this->updateBranch($path, $perm);
         }
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:29,代码来源:class.AJXP_PermissionMask.php

示例5: init

 public function init($options)
 {
     // Migrate new version of the options
     if (isset($options["CMS_TYPE"])) {
         // Transform MASTER_URL + LOGIN_URI to MASTER_HOST, MASTER_URI, LOGIN_URL, LOGOUT_URI
         $options["SLAVE_MODE"] = "false";
         $cmsOpts = $options["CMS_TYPE"];
         if ($cmsOpts["cms"] != "custom") {
             $loginURI = $cmsOpts["LOGIN_URI"];
             if (strpos($cmsOpts["MASTER_URL"], "http") === 0) {
                 $parse = parse_url($cmsOpts["MASTER_URL"]);
                 $rootHost = $parse["host"];
                 $rootURI = $parse["path"];
             } else {
                 $rootHost = "";
                 $rootURI = $cmsOpts["MASTER_URL"];
             }
             $cmsOpts["MASTER_HOST"] = $rootHost;
             $cmsOpts["LOGIN_URL"] = $cmsOpts["MASTER_URI"] = AJXP_Utils::securePath("/" . $rootURI . "/" . $loginURI);
             $logoutAction = $cmsOpts["LOGOUT_ACTION"];
             switch ($cmsOpts["cms"]) {
                 case "wp":
                     $cmsOpts["LOGOUT_URL"] = $logoutAction == "back" ? $cmsOpts["MASTER_URL"] : $cmsOpts["MASTER_URL"] . "/wp-login.php?action=logout";
                     break;
                 case "joomla":
                     $cmsOpts["LOGOUT_URL"] = $cmsOpts["LOGIN_URL"];
                     break;
                 case "drupal":
                     $cmsOpts["LOGOUT_URL"] = $logoutAction == "back" ? $cmsOpts["LOGIN_URL"] : $cmsOpts["MASTER_URL"] . "/user/logout";
                     break;
                 default:
                     break;
             }
         }
         $options = array_merge($options, $cmsOpts);
     }
     $this->slaveMode = $options["SLAVE_MODE"] == "true";
     if ($this->slaveMode && ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth")) {
         $contribs = $this->xPath->query("registry_contributions/external_file");
         foreach ($contribs as $contribNode) {
             if ($contribNode->getAttribute('filename') == 'plugins/core.auth/standard_auth_actions.xml') {
                 $contribNode->parentNode->removeChild($contribNode);
             }
         }
     }
     parent::init($options);
     $options = $this->options;
     $this->usersSerFile = $options["USERS_FILEPATH"];
     $this->secret = $options["SECRET"];
     $this->urls = array($options["LOGIN_URL"], $options["LOGOUT_URL"]);
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:51,代码来源:class.remoteAuthDriver.php

示例6: initPath

 /**
  * Initialize the stream from the given path.
  * Concretely, transform ajxp.webdav:// into webdav://
  *
  * @param string $path
  * @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
  */
 protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
 {
     $url = AJXP_Utils::safeParseUrl($path);
     $repoId = $url["host"];
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         $e = new Exception("Cannot find repository with id " . $repoId);
         self::$lastException = $e;
         throw $e;
     }
     $path = $url["path"];
     $host = $repoObject->getOption("HOST");
     $hostParts = parse_url($host);
     if ($hostParts["scheme"] == "https" && !extension_loaded("openssl")) {
         $e = new Exception("Warning you must have the openssl PHP extension loaded to connect an https server!");
         self::$lastException = $e;
         throw $e;
     }
     $credentials = AJXP_Safe::tryLoadingCredentialsFromSources($hostParts, $repoObject);
     $user = $credentials["user"];
     $password = $credentials["password"];
     if ($user != null && $password != null) {
         $host = ($hostParts["scheme"] == "https" ? "webdavs" : "webdav") . "://{$user}:{$password}@" . $hostParts["host"];
         if (isset($hostParts["port"])) {
             $host .= ":" . $hostParts["port"];
         }
     } else {
         $host = str_replace(array("http", "https"), array("webdav", "webdavs"), $host);
     }
     // MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
     $basePath = $repoObject->getOption("PATH");
     if ($basePath[strlen($basePath) - 1] == "/") {
         $basePath = substr($basePath, 0, -1);
     }
     if ($basePath[0] != "/") {
         $basePath = "/{$basePath}";
     }
     $path = AJXP_Utils::securePath($path);
     if ($path[0] == "/") {
         $path = substr($path, 1);
     }
     // SHOULD RETURN webdav://host_server/uri/to/webdav/folder
     AJXP_Logger::debug(__CLASS__, __FUNCTION__, $host . $basePath . "/" . $path);
     return $host . $basePath . "/" . $path;
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:52,代码来源:class.webdavAccessWrapper.php

示例7: makeZip

 public function makeZip($src, $dest, $basedir)
 {
     @set_time_limit(0);
     require_once AJXP_BIN_FOLDER . "/pclzip.lib.php";
     $filePaths = array();
     foreach ($src as $item) {
         $realFile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $this->urlBase . ($item[0] == "/" ? "" : "/") . AJXP_Utils::securePath($item));
         $basedir = trim(dirname($realFile)) . "/";
         $filePaths[] = array(PCLZIP_ATT_FILE_NAME => $realFile, PCLZIP_ATT_FILE_NEW_SHORT_NAME => basename($item));
     }
     $this->logDebug("Pathes", $filePaths);
     $this->logDebug("Basedir", array($basedir));
     self::$filteringDriverInstance = $this;
     $archive = new PclZip($dest);
     $vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON);
     if (!$vList) {
         throw new Exception("Zip creation error : ({$dest}) " . $archive->errorInfo(true));
     }
     self::$filteringDriverInstance = null;
     return $vList;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:21,代码来源:class.smbAccessDriver.php

示例8: initPath

 /**
  * Initialize the stream from the given path. 
  * Concretely, transform ajxp.webdav:// into webdav://
  *
  * @param string $path
  * @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
  */
 protected static function initPath($path, $streamType = "", $sftpResource = false, $skipZip = false)
 {
     $url = parse_url($path);
     $repoId = $url["host"];
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         throw new Exception("Cannot find repository with id " . $repoId);
     }
     $path = $url["path"];
     // MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
     $basePath = $repoObject->getOption("PATH");
     if ($basePath[strlen($basePath) - 1] == "/") {
         $basePath = substr($basePath, 0, -1);
     }
     if ($basePath[0] != "/") {
         $basePath = "/{$basePath}";
     }
     $path = AJXP_Utils::securePath($path);
     if ($path[0] == "/") {
         $path = substr($path, 1);
     }
     // SHOULD RETURN ssh2.sftp://Resource #23/server/path/folder/path
     return "ssh2.sftp://" . self::getSftpResource($repoObject) . $basePath . "/" . $path;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:31,代码来源:class.sftpAccessWrapper.php

示例9: switchAction


//.........这里部分代码省略.........
                         foreach ($metaIds as $metaID) {
                             $metaPlug = $pServ->getPluginById($metaID);
                             if ($metaPlug == null) {
                                 continue;
                             }
                             $pNodes = $metaPlug->getManifestRawContent("//param[@default]", "nodes");
                             $defaultParams = array();
                             foreach ($pNodes as $domNode) {
                                 $defaultParams[$domNode->getAttribute("name")] = $domNode->getAttribute("default");
                             }
                             $metaSourceOptions[$metaID] = $defaultParams;
                         }
                         $newRep->addOption("META_SOURCES", $metaSourceOptions);
                     }
                 }
             }
             if ($this->repositoryExists($newRep->getDisplay())) {
                 AJXP_XMLWriter::header();
                 AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.50"]);
                 AJXP_XMLWriter::close();
                 return;
             }
             if ($isTemplate) {
                 $newRep->isTemplate = true;
             }
             if ($currentUserIsGroupAdmin) {
                 $newRep->setGroupPath(AuthService::getLoggedUser()->getGroupPath());
             } else {
                 if (!empty($options["AJXP_GROUP_PATH_PARAMETER"])) {
                     $basePath = "/";
                     if (AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != null) {
                         $basePath = AuthService::getLoggedUser()->getGroupPath();
                     }
                     $value = AJXP_Utils::securePath(rtrim($basePath, "/") . "/" . ltrim($options["AJXP_GROUP_PATH_PARAMETER"], "/"));
                     $newRep->setGroupPath($value);
                 }
             }
             $res = ConfService::addRepository($newRep);
             AJXP_XMLWriter::header();
             if ($res == -1) {
                 AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.51"]);
             } else {
                 $loggedUser = AuthService::getLoggedUser();
                 $loggedUser->personalRole->setAcl($newRep->getUniqueId(), "rw");
                 $loggedUser->recomputeMergedRole();
                 $loggedUser->save("superuser");
                 AuthService::updateUser($loggedUser);
                 AJXP_XMLWriter::sendMessage($mess["ajxp_conf.52"], null);
                 AJXP_XMLWriter::reloadDataNode("", $newRep->getUniqueId());
                 AJXP_XMLWriter::reloadRepositoryList();
             }
             AJXP_XMLWriter::close();
             break;
         case "edit_repository":
             $repId = $httpVars["repository_id"];
             $repository = ConfService::getRepositoryById($repId);
             if ($repository == null) {
                 throw new Exception("Cannot find workspace with id {$repId}");
             }
             if (!AuthService::canAdministrate($repository)) {
                 throw new Exception("You are not allowed to edit this workspace!");
             }
             $pServ = AJXP_PluginsService::getInstance();
             $plug = $pServ->getPluginById("access." . $repository->accessType);
             if ($plug == null) {
                 throw new Exception("Cannot find access driver (" . $repository->accessType . ") for workspace!");
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:67,代码来源:class.ajxp_confAccessDriver.php

示例10: stream_open

 /**
  * Opens the strem
  *
  * @param String $path Maybe in the form "ajxp.fs://repositoryId/pathToFile"
  * @param String $mode
  * @param string $options
  * @param resource $context
  * @return bool
  */
 public function stream_open($path, $mode, $options, &$context)
 {
     try {
         $this->realPath = AJXP_Utils::securePath(self::initPath($path, "file"));
     } catch (Exception $e) {
         AJXP_Logger::error(__CLASS__, "stream_open", "Error while opening stream {$path} (" . $e->getMessage() . ")");
         return false;
     }
     if ($this->realPath == -1) {
         $this->fp = -1;
         return true;
     } else {
         $this->fp = fopen($this->realPath, $mode, $options);
         return $this->fp !== false;
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:25,代码来源:class.fsAccessWrapper.php

示例11: unifyChunks

 public function unifyChunks($action, &$httpVars, &$fileVars)
 {
     $filename = AJXP_Utils::decodeSecureMagic($httpVars["name"]);
     $tmpName = $fileVars["file"]["tmp_name"];
     $chunk = $httpVars["chunk"];
     $chunks = $httpVars["chunks"];
     //error_log("currentChunk:".$chunk."  chunks: ".$chunks);
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(false)) {
         return false;
     }
     $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
     $streamData = $plugin->detectStreamWrapper(true);
     $wrapperName = $streamData["classname"];
     $dir = AJXP_Utils::securePath($httpVars["dir"]);
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
     $driver = ConfService::loadDriverForRepository($repository);
     $remote = false;
     if (method_exists($driver, "storeFileToCopy")) {
         $remote = true;
         $destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($repository->getOption("TMP_UPLOAD"));
         // Make tmp folder a bit more unique using secure_token
         $tmpFolder = $destCopy . "/" . $httpVars["secure_token"];
         if (!is_dir($tmpFolder)) {
             @mkdir($tmpFolder, 0700, true);
         }
         $target = $tmpFolder . '/' . $filename;
         $fileVars["file"]["destination"] = base64_encode($dir);
     } else {
         if (call_user_func(array($wrapperName, "isRemote"))) {
             $remote = true;
             $tmpFolder = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["secure_token"];
             if (!is_dir($tmpFolder)) {
                 @mkdir($tmpFolder, 0700, true);
             }
             $target = $tmpFolder . '/' . $filename;
         } else {
             $target = $destStreamURL . $filename;
         }
     }
     //error_log("Directory: ".$dir);
     // Clean the fileName for security reasons
     //$filename = preg_replace('/[^\w\._]+/', '', $filename);
     // Look for the content type header
     if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
         $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
     }
     if (isset($_SERVER["CONTENT_TYPE"])) {
         $contentType = $_SERVER["CONTENT_TYPE"];
     }
     // Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
     if (strpos($contentType, "multipart") !== false) {
         if (isset($tmpName) && is_uploaded_file($tmpName)) {
             //error_log("tmpName: ".$tmpName);
             // Open temp file
             $out = fopen($target, $chunk == 0 ? "wb" : "ab");
             if ($out) {
                 // Read binary input stream and append it to temp file
                 $in = fopen($tmpName, "rb");
                 if ($in) {
                     while ($buff = fread($in, 4096)) {
                         fwrite($out, $buff);
                     }
                 } else {
                     die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
                 }
                 fclose($in);
                 fclose($out);
                 @unlink($tmpName);
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
             }
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
         }
     } else {
         // Open temp file
         $out = fopen($target, $chunk == 0 ? "wb" : "ab");
         if ($out) {
             // Read binary input stream and append it to temp file
             $in = fopen("php://input", "rb");
             if ($in) {
                 while ($buff = fread($in, 4096)) {
                     fwrite($out, $buff);
                 }
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
             }
             fclose($in);
             fclose($out);
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
         }
     }
     /* we apply the hook if we are uploading the last chunk */
     if ($chunk == $chunks - 1) {
         if (!$remote) {
             AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($destStreamURL . $filename), false));
         } else {
             if (method_exists($driver, "storeFileToCopy")) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.PluploadProcessor.php

示例12: makeZip

 /**
  * @return zipfile
  */
 function makeZip($src, $dest, $basedir)
 {
     @set_time_limit(60);
     require_once SERVER_RESOURCES_FOLDER . "/pclzip.lib.php";
     $filePaths = array();
     foreach ($src as $item) {
         $realFile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $this->urlBase . "/" . $item);
         $realFile = AJXP_Utils::securePath($realFile);
         $basedir = trim(dirname($realFile));
         $filePaths[] = array(PCLZIP_ATT_FILE_NAME => $realFile, PCLZIP_ATT_FILE_NEW_SHORT_NAME => basename($item));
     }
     AJXP_Logger::debug("Pathes", $filePaths);
     AJXP_Logger::debug("Basedir", array($basedir));
     $archive = new PclZip($dest);
     $vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION);
     if (!$vList) {
         throw new Exception("Zip creation error : ({$dest}) " . $archive->errorInfo(true));
     }
     return $vList;
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:23,代码来源:class.fsAccessDriver.php

示例13: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     $xmlBuffer = "";
     foreach ($httpVars as $getName => $getValue) {
         ${$getName} = AJXP_Utils::securePath($getValue);
     }
     if (isset($dir) && $action != "upload") {
         $dir = SystemTextEncoding::fromUTF8($dir);
     }
     $mess = ConfService::getMessages();
     switch ($action) {
         //------------------------------------
         //	SWITCH THE ROOT REPOSITORY
         //------------------------------------
         case "switch_repository":
             if (!isset($repository_id)) {
                 break;
             }
             $dirList = ConfService::getRepositoriesList();
             /** @var $repository_id string */
             if (!isset($dirList[$repository_id])) {
                 $errorMessage = "Trying to switch to an unkown repository!";
                 break;
             }
             ConfService::switchRootDir($repository_id);
             // Load try to init the driver now, to trigger an exception
             // if it's not loading right.
             ConfService::loadRepositoryDriver();
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $user = AuthService::getLoggedUser();
                 $activeRepId = ConfService::getCurrentRepositoryId();
                 $user->setArrayPref("history", "last_repository", $activeRepId);
                 $user->save("user");
             }
             //$logMessage = "Successfully Switched!";
             $this->logInfo("Switch Repository", array("rep. id" => $repository_id));
             break;
             //------------------------------------
             //	SEND XML REGISTRY
             //------------------------------------
         //------------------------------------
         //	SEND XML REGISTRY
         //------------------------------------
         case "get_xml_registry":
         case "state":
             $regDoc = AJXP_PluginsService::getXmlRegistry();
             $changes = AJXP_Controller::filterRegistryFromRole($regDoc);
             if ($changes) {
                 AJXP_PluginsService::updateXmlRegistry($regDoc);
             }
             $clone = $regDoc->cloneNode(true);
             $clonePath = new DOMXPath($clone);
             $serverCallbacks = $clonePath->query("//serverCallback|hooks");
             foreach ($serverCallbacks as $callback) {
                 $callback->parentNode->removeChild($callback);
             }
             $xPath = '';
             if (isset($httpVars["xPath"])) {
                 $xPath = ltrim(AJXP_Utils::securePath($httpVars["xPath"]), "/");
             }
             if (!empty($xPath)) {
                 $nodes = $clonePath->query($xPath);
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($nodes->item(0));
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $xPath));
                     if ($nodes->length) {
                         print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML($nodes->item(0)));
                     }
                     AJXP_XMLWriter::close("ajxp_registry_part");
                 }
             } else {
                 AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($clone);
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     header('Content-Type: application/xml; charset=UTF-8');
                     print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
                 }
             }
             break;
             //------------------------------------
             //	BOOKMARK BAR
             //------------------------------------
         //------------------------------------
         //	BOOKMARK BAR
         //------------------------------------
         case "get_bookmarks":
             $bmUser = null;
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $bmUser = AuthService::getLoggedUser();
             } else {
                 if (!AuthService::usersEnabled()) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.AbstractConfDriver.php

示例14: decodeSecureMagic

 /**
  * Perform standard urldecode, sanitization and securepath
  * @static
  * @param $data
  * @param int $sanitizeLevel
  * @return string
  */
 public static function decodeSecureMagic($data, $sanitizeLevel = AJXP_SANITIZE_HTML)
 {
     return SystemTextEncoding::fromUTF8(AJXP_Utils::sanitize(AJXP_Utils::securePath($data), $sanitizeLevel));
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:11,代码来源:class.AJXP_Utils.php

示例15: getServerFeatures

 /** This method retrieves the FTP server features as described in RFC2389
  *	A decent FTP server support MLST command to list file using UTF-8 encoding
  *  @return an array of features (see code)
  */
 protected function getServerFeatures()
 {
     $link = $this->createFTPLink();
     if (ConfService::getRepositoryById($this->repositoryId)->getOption("CREATE") == true) {
         // Test if root exists and create it otherwise
         $serverPath = AJXP_Utils::securePath($this->path . "/");
         $testCd = @ftp_chdir($link, $serverPath);
         if ($testCd !== true) {
             $res = @ftp_mkdir($link, $serverPath);
             if (!$res) {
                 throw new Exception("Cannot create path on remote server!");
             }
         }
     }
     $features = @ftp_raw($link, "FEAT");
     // Check the answer code
     if (isset($features[0]) && $features[0][0] != "2") {
         //ftp_close($link);
         return array("list" => "LIST", "charset" => $this->repoCharset);
     }
     $retArray = array("list" => "LIST", "charset" => $this->repoCharset);
     // Ok, find out the encoding used
     foreach ($features as $feature) {
         if (strstr($feature, "UTF8") !== FALSE) {
             // See http://wiki.filezilla-project.org/Character_Set for an explaination
             @ftp_raw($link, "OPTS UTF-8 ON");
             $retArray['charset'] = "UTF-8";
             //ftp_close($link);
             return $retArray;
         }
     }
     // In the future version, we should also use MLST as it standardize the listing format
     return $retArray;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:38,代码来源:class.ftpAccessWrapper.php


注:本文中的AJXP_Utils::securePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。