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


PHP AJXP_Utils::safeDirname方法代码示例

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


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

示例1: updateBaseHtaccessContent

function updateBaseHtaccessContent()
{
    $uri = $_SERVER["REQUEST_URI"];
    if (strpos($uri, '.php') !== false) {
        $uri = AJXP_Utils::safeDirname($uri);
    }
    if (empty($uri)) {
        $uri = "/";
    }
    $tpl = file_get_contents(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/boot.conf/htaccess.tpl");
    if ($uri == "/") {
        $htContent = str_replace('${APPLICATION_ROOT}/', "/", $tpl);
        $htContent = str_replace('${APPLICATION_ROOT}', "/", $htContent);
    } else {
        $htContent = str_replace('${APPLICATION_ROOT}', $uri, $tpl);
    }
    if (is_writeable(AJXP_INSTALL_PATH . "/.htaccess")) {
        echo '<br>Updating Htaccess';
        file_put_contents(AJXP_INSTALL_PATH . "/.htaccess", $htContent);
    } else {
        echo '<br>Cannot write htaccess file, please copy and paste the code below: <br><pre>' . $htContent . '</pre>';
    }
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:23,代码来源:5.3.4.php

示例2: receiveAction

 /**
  * @param String $action
  * @param Array $httpVars
  * @param Array $fileVars
  * @throws Exception
  */
 public function receiveAction($action, $httpVars, $fileVars)
 {
     //VAR CREATION OUTSIDE OF ALL CONDITIONS, THEY ARE "MUST HAVE" VAR !!
     $messages = ConfService::getMessages();
     $repository = ConfService::getRepository();
     $userSelection = new UserSelection($repository, $httpVars);
     $nodes = $userSelection->buildNodes();
     $currentDirPath = AJXP_Utils::safeDirname($userSelection->getUniqueNode()->getPath());
     $currentDirPath = rtrim($currentDirPath, "/") . "/";
     $currentDirUrl = $userSelection->currentBaseUrl() . $currentDirPath;
     if (empty($httpVars["compression_id"])) {
         $compressionId = sha1(rand());
         $httpVars["compression_id"] = $compressionId;
     } else {
         $compressionId = $httpVars["compression_id"];
     }
     $progressCompressionFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressCompressionID-" . $compressionId . ".txt";
     if (empty($httpVars["extraction_id"])) {
         $extractId = sha1(rand());
         $httpVars["extraction_id"] = $extractId;
     } else {
         $extractId = $httpVars["extraction_id"];
     }
     $progressExtractFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressExtractID-" . $extractId . ".txt";
     if ($action == "compression") {
         $archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
         $archiveFormat = $httpVars["type_archive"];
         $tabTypeArchive = array(".tar", ".tar.gz", ".tar.bz2");
         $acceptedExtension = false;
         foreach ($tabTypeArchive as $extensionArchive) {
             if ($extensionArchive == $archiveFormat) {
                 $acceptedExtension = true;
                 break;
             }
         }
         if ($acceptedExtension == false) {
             file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.16"]);
             throw new AJXP_Exception($messages["compression.16"]);
         }
         $typeArchive = $httpVars["type_archive"];
         //if we can run in background we do it
         if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
             $archivePath = $currentDirPath . $archiveName;
             file_put_contents($progressCompressionFileName, $messages["compression.5"]);
             AJXP_Controller::applyActionInBackground($repository->getId(), "compression", $httpVars);
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::triggerBgAction("check_compression_status", array("repository_id" => $repository->getId(), "compression_id" => $compressionId, "archive_path" => SystemTextEncoding::toUTF8($archivePath)), $messages["compression.5"], true, 2);
             AJXP_XMLWriter::close();
             return null;
         } else {
             $maxAuthorizedSize = 4294967296;
             $currentDirUrlLength = strlen($currentDirUrl);
             $tabFolders = array();
             $tabAllRecursiveFiles = array();
             $tabFilesNames = array();
             foreach ($nodes as $node) {
                 $nodeUrl = $node->getUrl();
                 if (is_file($nodeUrl) && filesize($nodeUrl) < $maxAuthorizedSize) {
                     array_push($tabAllRecursiveFiles, $nodeUrl);
                     array_push($tabFilesNames, substr($nodeUrl, $currentDirUrlLength));
                 }
                 if (is_dir($nodeUrl)) {
                     array_push($tabFolders, $nodeUrl);
                 }
             }
             //DO A FOREACH OR IT'S GONNA HAVE SOME SAMES FILES NAMES
             foreach ($tabFolders as $value) {
                 $dossiers = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($value));
                 foreach ($dossiers as $file) {
                     if ($file->isDir()) {
                         continue;
                     }
                     array_push($tabAllRecursiveFiles, $file->getPathname());
                     array_push($tabFilesNames, substr($file->getPathname(), $currentDirUrlLength));
                 }
             }
             //WE STOP IF IT'S JUST AN EMPTY FOLDER OR NO FILES
             if (empty($tabFilesNames)) {
                 file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.17"]);
                 throw new AJXP_Exception($messages["compression.17"]);
             }
             try {
                 $tmpArchiveName = tempnam(AJXP_Utils::getAjxpTmpDir(), "tar-compression") . ".tar";
                 $archive = new PharData($tmpArchiveName);
             } catch (Exception $e) {
                 file_put_contents($progressCompressionFileName, "Error : " . $e->getMessage());
                 throw $e;
             }
             $counterCompression = 0;
             //THE TWO ARRAY ARE MERGED FOR THE FOREACH LOOP
             $tabAllFiles = array_combine($tabAllRecursiveFiles, $tabFilesNames);
             foreach ($tabAllFiles as $fullPath => $fileName) {
                 try {
                     $archive->addFile(AJXP_MetaStreamWrapper::getRealFSReference($fullPath), $fileName);
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.PluginCompression.php

示例3: printFormFromServerSettings

 public function printFormFromServerSettings($fullManifest)
 {
     AJXP_XMLWriter::header("admin_data");
     $xPath = new DOMXPath($fullManifest->ownerDocument);
     $addParams = "";
     $pInstNodes = $xPath->query("server_settings/global_param[contains(@type, 'plugin_instance:')]");
     foreach ($pInstNodes as $pInstNode) {
         $type = $pInstNode->getAttribute("type");
         $instType = str_replace("plugin_instance:", "", $type);
         $fieldName = $pInstNode->getAttribute("name");
         $pInstNode->setAttribute("type", "group_switch:" . $fieldName);
         $typePlugs = AJXP_PluginsService::getInstance()->getPluginsByType($instType);
         foreach ($typePlugs as $typePlug) {
             if ($typePlug->getId() == "auth.multi") {
                 continue;
             }
             $checkErrorMessage = "";
             try {
                 $typePlug->performChecks();
             } catch (Exception $e) {
                 $checkErrorMessage = " (Warning : " . $e->getMessage() . ")";
             }
             $tParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/param"));
             $addParams .= '<global_param group_switch_name="' . $fieldName . '" name="instance_name" group_switch_label="' . $typePlug->getManifestLabel() . $checkErrorMessage . '" group_switch_value="' . $typePlug->getId() . '" default="' . $typePlug->getId() . '" type="hidden"/>';
             $addParams .= str_replace("<param", "<global_param group_switch_name=\"{$fieldName}\" group_switch_label=\"" . $typePlug->getManifestLabel() . $checkErrorMessage . "\" group_switch_value=\"" . $typePlug->getId() . "\" ", $tParams);
             $addParams .= AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/global_param"));
         }
     }
     $uri = $_SERVER["REQUEST_URI"];
     if (strpos($uri, '.php') !== false) {
         $uri = AJXP_Utils::safeDirname($uri);
     }
     if (empty($uri)) {
         $uri = "/";
     }
     $loadedValues = array("ENCODING" => defined('AJXP_LOCALE') ? AJXP_LOCALE : SystemTextEncoding::getEncoding(), "SERVER_URI" => $uri);
     foreach ($loadedValues as $pName => $pValue) {
         $vNodes = $xPath->query("server_settings/global_param[@name='{$pName}']");
         if (!$vNodes->length) {
             continue;
         }
         $vNodes->item(0)->setAttribute("default", $pValue);
     }
     $allParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($fullManifest->ownerDocument->saveXML($fullManifest));
     $allParams = str_replace('type="plugin_instance:', 'type="group_switch:', $allParams);
     $allParams = str_replace("</server_settings>", $addParams . "</server_settings>", $allParams);
     echo $allParams;
     AJXP_XMLWriter::close("admin_data");
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:49,代码来源:class.BootConfLoader.php

示例4: rawList

 protected function rawList($link, $serverPath, $target = 'd', $retry = true)
 {
     if ($target == 'f') {
         $parentDir = AJXP_Utils::safeDirname($serverPath);
         $fileName = AJXP_Utils::safeBasename($serverPath);
         ftp_chdir($link, $parentDir);
         $rl_dirlist = @ftp_rawlist($link, "-a .");
         //AJXP_Logger::debug(__CLASS__,__FUNCTION__,"FILE RAWLIST FROM ".$parentDir);
         if (is_array($rl_dirlist)) {
             $escaped = preg_quote($fileName);
             foreach ($rl_dirlist as $rl_index => $rl_entry) {
                 if (preg_match("/ {$escaped}\$/", $rl_entry)) {
                     $contents = array($rl_dirlist[$rl_index]);
                 }
             }
         }
     } else {
         ftp_chdir($link, $serverPath);
         $contents = ftp_rawlist($link, "-a .");
         //AJXP_Logger::debug(__CLASS__,__FUNCTION__,"RAW LIST RESULT ".print_r($contents, true));
     }
     if (!is_array($contents) && !$this->ftpActive) {
         if ($retry == false) {
             return array();
         }
         // We might have timed out, so let's go passive if not done yet
         global $_SESSION;
         if ($_SESSION["ftpPasv"] == "true") {
             return array();
         }
         @ftp_pasv($link, TRUE);
         $_SESSION["ftpPasv"] = "true";
         // RETRY!
         return $this->rawList($link, $serverPath, $target, FALSE);
     }
     if (!is_array($contents)) {
         return array();
     }
     return $contents;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:40,代码来源:class.ftpAccessWrapper.php

示例5: getBaseDir

 function getBaseDir()
 {
     return AJXP_Utils::safeDirname(array_keys($this->filters)[0]);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:4,代码来源:class.ContentFilter.php

示例6: switchAction


//.........这里部分代码省略.........
             $softPurgeTime = intval($this->repository->getOption("PURGE_AFTER_SOFT")) * 3600 * 24;
             $shareCenter = AJXP_PluginsService::findPluginById('action.share');
             if (!($shareCenter && $shareCenter->isEnabled())) {
                 //action.share is disabled, don't look at the softPurgeTime
                 $softPurgeTime = 0;
             }
             if ($hardPurgeTime > 0 || $softPurgeTime > 0) {
                 $this->recursivePurge($this->urlBase, $hardPurgeTime, $softPurgeTime);
             }
             break;
             //------------------------------------
             //	RENAME
             //------------------------------------
         //------------------------------------
         //	RENAME
         //------------------------------------
         case "rename":
             $file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
             $filename_new = AJXP_Utils::decodeSecureMagic($httpVars["filename_new"]);
             $dest = null;
             if (isset($httpVars["dest"])) {
                 $dest = AJXP_Utils::decodeSecureMagic($httpVars["dest"]);
                 $filename_new = "";
             }
             $this->filterUserSelectionToHidden(array($filename_new));
             $this->rename($file, $filename_new, $dest);
             $logMessage = SystemTextEncoding::toUTF8($file) . " {$mess['41']} " . SystemTextEncoding::toUTF8($filename_new);
             //$reloadContextNode = true;
             //$pendingSelection = $filename_new;
             if (!isset($nodesDiffs)) {
                 $nodesDiffs = $this->getNodesDiffArray();
             }
             if ($dest == null) {
                 $dest = AJXP_Utils::safeDirname($file);
             }
             $nodesDiffs["UPDATE"][$file] = new AJXP_Node($this->urlBase . $dest . "/" . $filename_new);
             $this->logInfo("Rename", array("original" => $this->addSlugToPath($file), "new" => $filename_new));
             break;
             //------------------------------------
             //	CREER UN REPERTOIRE / CREATE DIR
             //------------------------------------
         //------------------------------------
         //	CREER UN REPERTOIRE / CREATE DIR
         //------------------------------------
         case "mkdir":
             $messtmp = "";
             if (!isset($httpVars["dirname"])) {
                 $uniq = $selection->getUniqueFile();
                 $dir = AJXP_Utils::safeDirname($uniq);
                 $dirname = AJXP_Utils::safeBasename($uniq);
             } else {
                 $dirname = AJXP_Utils::decodeSecureMagic($httpVars["dirname"], AJXP_SANITIZE_FILENAME);
             }
             $dirname = substr($dirname, 0, ConfService::getCoreConf("NODENAME_MAX_LENGTH"));
             $this->filterUserSelectionToHidden(array($dirname));
             AJXP_Controller::applyHook("node.before_create", array(new AJXP_Node($dir . "/" . $dirname), -2));
             $error = $this->mkDir($dir, $dirname, isset($httpVars["ignore_exists"]) ? true : false);
             if (isset($error)) {
                 throw new AJXP_Exception($error);
             }
             $messtmp .= "{$mess['38']} " . SystemTextEncoding::toUTF8($dirname) . " {$mess['39']} ";
             if ($dir == "") {
                 $messtmp .= "/";
             } else {
                 $messtmp .= SystemTextEncoding::toUTF8($dir);
             }
开发者ID:biggtfish,项目名称:cms,代码行数:67,代码来源:class.fsAccessDriver.php

示例7: header

ConfService::start();
$confStorageDriver = ConfService::getConfStorageImpl();
require_once $confStorageDriver->getUserClassFileName();
//session_name("AjaXplorer");
//session_start();
AJXP_PluginsService::getInstance()->initActivePlugins();
AuthService::preLogUser(array_merge($_GET, $_POST));
if (AuthService::getLoggedUser() == null) {
    header('HTTP/1.0 401 Unauthorized');
    echo 'You are not authorized to access this API.';
    exit;
}
$authDriver = ConfService::getAuthDriverImpl();
ConfService::currentContextIsRestAPI("api");
$uri = $_SERVER["REQUEST_URI"];
$scriptUri = ltrim(AJXP_Utils::safeDirname($_SERVER["SCRIPT_NAME"]), '/') . "/api/";
$uri = substr($uri, strlen($scriptUri));
$uri = explode("/", trim($uri, "/"));
// GET REPO ID
$repoID = array_shift($uri);
// GET ACTION NAME
$action = array_shift($uri);
$path = "/" . implode("/", $uri);
if ($repoID == 'pydio') {
    ConfService::switchRootDir();
    $repo = ConfService::getRepository();
} else {
    $repo = ConfService::findRepositoryByIdOrAlias($repoID);
    if ($repo == null) {
        die("Cannot find repository with ID " . $repoID);
    }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:31,代码来源:rest.php

示例8: initFromArray

 /**
  *
  * Init from a simple array
  * @param $array
  */
 public function initFromArray($array)
 {
     if (!is_array($array)) {
         return;
     }
     if (isset($array[$this->varPrefix]) && $array[$this->varPrefix] != "") {
         $v = $array[$this->varPrefix];
         if (strpos($v, "base64encoded:") === 0) {
             $v = base64_decode(array_pop(explode(':', $v, 2)));
         }
         $this->files[] = AJXP_Utils::decodeSecureMagic($v);
         $this->isUnique = true;
         //return ;
     }
     if (isset($array[$this->varPrefix . "_0"])) {
         $index = 0;
         while (isset($array[$this->varPrefix . "_" . $index])) {
             $v = $array[$this->varPrefix . "_" . $index];
             if (strpos($v, "base64encoded:") === 0) {
                 $v = base64_decode(array_pop(explode(':', $v, 2)));
             }
             $this->files[] = AJXP_Utils::decodeSecureMagic($v);
             $index++;
         }
         $this->isUnique = false;
         if (count($this->files) == 1) {
             $this->isUnique = true;
         }
         //return ;
     }
     if (isset($array["nodes"]) && is_array($array["nodes"])) {
         $this->files = array();
         foreach ($array["nodes"] as $value) {
             $this->files[] = AJXP_Utils::decodeSecureMagic($value);
         }
         $this->isUnique = count($this->files) == 1;
     }
     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];
         }
     } else {
         if (!$this->isEmpty() && $this->isUnique()) {
             if ($test = $this->detectZip(AJXP_Utils::safeDirname($this->files[0]))) {
                 $this->inZip = true;
                 $this->zipFile = $test[0];
                 $this->localZipPath = $test[1];
             }
         }
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:59,代码来源:class.UserSelection.php


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