本文整理汇总了PHP中SystemTextEncoding::toStorageEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP SystemTextEncoding::toStorageEncoding方法的具体用法?PHP SystemTextEncoding::toStorageEncoding怎么用?PHP SystemTextEncoding::toStorageEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SystemTextEncoding
的用法示例。
在下文中一共展示了SystemTextEncoding::toStorageEncoding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initPath
/**
* Initialize the stream from the given path.
*
* @param string $path
* @param $streamType
* @param bool $storeOpenContext
* @param bool $skipZip
* @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
* @throws AJXP_Exception
* @throws Exception
*/
protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
{
$path = self::unPatchPathForBaseDir($path);
$url = AJXP_Utils::safeParseUrl($path);
$repoId = $url["host"];
$test = trim($url["path"], "/");
$atRoot = empty($test);
$repoObject = ConfService::getRepositoryById($repoId);
if (!isset($repoObject)) {
throw new Exception("Cannot find repository with id " . $repoId);
}
$split = UserSelection::detectZip($url["path"]);
$insideZip = false;
if ($split && $streamType == "file" && $split[1] != "/") {
$insideZip = true;
}
if ($split && $streamType == "dir") {
$insideZip = true;
}
if ($skipZip) {
$insideZip = false;
}
$resolveUser = null;
if (isset($url["user"]) && AuthService::usersEnabled()) {
$resolveUser = ConfService::getConfStorageImpl()->createUserObject($url["user"]);
}
$resolvedPath = realpath(SystemTextEncoding::toStorageEncoding($repoObject->getOption("PATH", false, $resolveUser)));
//var_dump($path);
//var_dump($skipZip);
// Inside a zip : copy the file to a tmp file and return a reference to it
if ($insideZip) {
$zipPath = $split[0];
$localPath = $split[1];
require_once AJXP_BIN_FOLDER . "/pclzip.lib.php";
//print($streamType.$path);
if ($streamType == "file") {
if (self::$crtZip == null || !is_array(self::$currentListingKeys)) {
$tmpDir = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . md5(time() - rand());
mkdir($tmpDir);
$tmpFileName = $tmpDir . DIRECTORY_SEPARATOR . basename($localPath);
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Tmp file {$tmpFileName}");
register_shutdown_function(array("fsAccessWrapper", "removeTmpFile"), $tmpDir, $tmpFileName);
$crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath . $repoObject->resolveVirtualRoots($zipPath)));
$content = $crtZip->listContent();
if (is_array($content)) {
foreach ($content as $item) {
$fName = AJXP_Utils::securePath($item["stored_filename"]);
if ($fName == $localPath || "/" . $fName == $localPath) {
$localPath = $fName;
break;
}
}
}
$crtZip->extract(PCLZIP_OPT_BY_NAME, $localPath, PCLZIP_OPT_PATH, $tmpDir, PCLZIP_OPT_REMOVE_ALL_PATH);
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Extracted " . $path . " to " . dirname($localPath));
if ($storeOpenContext) {
self::$crtZip = $crtZip;
}
return $tmpFileName;
} else {
$key = basename($localPath);
if (array_key_exists($key, self::$currentListing)) {
self::$currentFileKey = $key;
return -1;
} else {
throw new AJXP_Exception("Cannot find key");
}
}
} else {
$crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath . $repoObject->resolveVirtualRoots($zipPath)));
$liste = $crtZip->listContent();
if (!is_array($liste)) {
$liste = array();
}
if ($storeOpenContext) {
self::$crtZip = $crtZip;
}
$folders = array();
$files = array();
$builtFolders = array();
if ($localPath[strlen($localPath) - 1] != "/") {
$localPath .= "/";
}
foreach ($liste as $item) {
$stored = $item["stored_filename"];
if ($stored[0] != "/") {
$stored = "/" . $stored;
}
$pathPos = strpos($stored, $localPath);
//.........这里部分代码省略.........
示例2: makeSharedRepositoryOptions
public function makeSharedRepositoryOptions($httpVars, $repository)
{
$newOptions = array("PATH" => SystemTextEncoding::toStorageEncoding($repository->getOption("PATH")) . AJXP_Utils::decodeSecureMagic($httpVars["file"]), "CREATE" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("CREATE") : false, "RECYCLE_BIN" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("RECYCLE_BIN") : "", "DEFAULT_RIGHTS" => "");
if ($repository->getOption("USE_SESSION_CREDENTIALS") === true) {
$newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
}
return $newOptions;
}
示例3: findMirrorNodesInShares
/**
* @param AJXP_Node $node
* @param String|null $direction "UP", "DOWN"
* @return array()
*/
private function findMirrorNodesInShares($node, $direction)
{
$result = array();
if ($direction !== "UP") {
$upmetas = array();
$this->getShareStore()->getMetaManager()->collectSharesInParent($node, $upmetas);
foreach ($upmetas as $metadata) {
if (is_array($metadata) && !empty($metadata["shares"])) {
foreach ($metadata["shares"] as $sId => $sData) {
$type = $sData["type"];
if ($type == "file") {
continue;
}
$wsId = $sId;
if ($type == "minisite") {
$minisiteData = $this->getShareStore()->loadShare($sId);
if (empty($minisiteData) || !isset($minisiteData["REPOSITORY"])) {
continue;
}
$wsId = $minisiteData["REPOSITORY"];
} else {
if ($type == "ocs_remote") {
continue;
}
}
$sharedNode = $metadata["SOURCE_NODE"];
$sharedPath = substr($node->getPath(), strlen($sharedNode->getPath()));
$sharedNodeUrl = $node->getScheme() . "://" . $wsId . $sharedPath;
$result[$wsId] = array(new AJXP_Node($sharedNodeUrl), "DOWN");
$this->logDebug('MIRROR NODES', 'Found shared in parent - register node ' . $sharedNodeUrl);
}
}
}
}
if ($direction !== "DOWN") {
if ($node->getRepository()->hasParent()) {
$parentRepoId = $node->getRepository()->getParentId();
$parentRepository = ConfService::getRepositoryById($parentRepoId);
if (!empty($parentRepository) && !$parentRepository->isTemplate) {
$currentRoot = $node->getRepository()->getOption("PATH");
$owner = $node->getRepository()->getOwner();
$resolveUser = null;
if ($owner != null) {
$resolveUser = ConfService::getConfStorageImpl()->createUserObject($owner);
}
$parentRoot = $parentRepository->getOption("PATH", false, $resolveUser);
$relative = substr($currentRoot, strlen($parentRoot));
$relative = SystemTextEncoding::toStorageEncoding($relative);
$parentNodeURL = $node->getScheme() . "://" . $parentRepoId . $relative . $node->getPath();
$this->logDebug("action.share", "Should trigger on " . $parentNodeURL);
$parentNode = new AJXP_Node($parentNodeURL);
if ($owner != null) {
$parentNode->setUser($owner);
}
$result[$parentRepoId] = array($parentNode, "UP");
}
}
}
return $result;
}
示例4: makeSharedRepositoryOptions
public function makeSharedRepositoryOptions($httpVars, $repository)
{
$newOptions = array("PATH" => SystemTextEncoding::toStorageEncoding($repository->getOption("PATH")) . AJXP_Utils::decodeSecureMagic($httpVars["file"]), "CREATE" => $repository->getOption("CREATE"), "RECYCLE_BIN" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("RECYCLE_BIN") : "", "DEFAULT_RIGHTS" => "", "DATA_TEMPLATE" => "");
if ($repository->getOption("USE_SESSION_CREDENTIALS") === true) {
$newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
}
$customData = array();
foreach ($httpVars as $key => $value) {
if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
$customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
}
}
if (count($customData)) {
$newOptions["PLUGINS_DATA"] = $customData;
}
if ($repository->getOption("META_SOURCES")) {
$newOptions["META_SOURCES"] = $repository->getOption("META_SOURCES");
foreach ($newOptions["META_SOURCES"] as $index => &$data) {
if (isset($data["USE_SESSION_CREDENTIALS"]) && $data["USE_SESSION_CREDENTIALS"] === true) {
$newOptions["META_SOURCES"][$index]["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
}
}
AJXP_Controller::applyHook("workspace.share_metasources", array(&$newOptions["META_SOURCES"]));
}
return $newOptions;
}