本文整理汇总了PHP中AJXP_Utils::isHidden方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::isHidden方法的具体用法?PHP AJXP_Utils::isHidden怎么用?PHP AJXP_Utils::isHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Utils
的用法示例。
在下文中一共展示了AJXP_Utils::isHidden方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterFile
public function filterFile($fileName, $hiddenTest = false)
{
$pathParts = pathinfo($fileName);
if ($hiddenTest) {
$showHiddenFiles = $this->getFilteredOption("SHOW_HIDDEN_FILES", $this->repository->getId());
if (AJXP_Utils::isHidden($pathParts["basename"]) && !$showHiddenFiles) {
return true;
}
}
$hiddenFileNames = $this->getFilteredOption("HIDE_FILENAMES", $this->repository->getId());
$hiddenExtensions = $this->getFilteredOption("HIDE_EXTENSIONS", $this->repository->getId());
if (!empty($hiddenFileNames)) {
if (!is_array($hiddenFileNames)) {
$hiddenFileNames = explode(",", $hiddenFileNames);
}
foreach ($hiddenFileNames as $search) {
if (strcasecmp($search, $pathParts["basename"]) == 0) {
return true;
}
}
}
if (!empty($hiddenExtensions)) {
if (!is_array($hiddenExtensions)) {
$hiddenExtensions = explode(",", $hiddenExtensions);
}
foreach ($hiddenExtensions as $search) {
if (strcasecmp($search, $pathParts["extension"]) == 0) {
return true;
}
}
}
return false;
}
示例2: postProcess
//.........这里部分代码省略.........
}
} else {
if (file_exists($destStreamURL . $userfile_name)) {
$partitions_length += filesize($destStreamURL . $userfile_name);
}
}
}
if (!$all_in_place || $partitions_length != floatval($fileLength)) {
echo "Error: Upload validation error!";
/* we delete all the uploaded partitions */
if ($httpVars["partitionCount"] > 1) {
for ($i = 0; $i < $partitionCount; $i++) {
if (file_exists($destStreamURL . "{$fileHash}.{$fileId}.{$i}")) {
unlink($destStreamURL . "{$fileHash}.{$fileId}.{$i}");
}
}
} else {
$fileName = $httpVars["partitionRealName"];
unlink($destStreamURL . $fileName);
}
return;
}
if (count($subs) > 0 && !self::$remote) {
$curDir = "";
if (substr($curDir, -1) == "/") {
$curDir = substr($curDir, 0, -1);
}
// Create the folder tree as necessary
foreach ($subs as $key => $spath) {
$messtmp = "";
$dirname = AJXP_Utils::decodeSecureMagic($spath, AJXP_SANITIZE_FILENAME);
$dirname = substr($dirname, 0, ConfService::getCoreConf("NODENAME_MAX_LENGTH"));
//$this->filterUserSelectionToHidden(array($dirname));
if (AJXP_Utils::isHidden($dirname)) {
$folderForbidden = true;
break;
}
if (file_exists($destStreamURL . "{$curDir}/{$dirname}")) {
// if the folder exists, traverse
$this->logDebug("{$curDir}/{$dirname} existing, traversing for {$userfile_name} out of", $httpVars["relativePath"]);
$curDir .= "/" . $dirname;
continue;
}
$this->logDebug($destStreamURL . $curDir);
$dirMode = 0775;
$chmodValue = $repository->getOption("CHMOD_VALUE");
if (isset($chmodValue) && $chmodValue != "") {
$dirMode = octdec(ltrim($chmodValue, "0"));
if ($dirMode & 0400) {
$dirMode |= 0100;
}
// Owner is allowed to read, allow to list the directory
if ($dirMode & 040) {
$dirMode |= 010;
}
// Group is allowed to read, allow to list the directory
if ($dirMode & 04) {
$dirMode |= 01;
}
// Other are allowed to read, allow to list the directory
}
$url = $destStreamURL . $curDir . "/" . $dirname;
$old = umask(0);
mkdir($url, $dirMode);
umask($old);
AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($url), false));
示例3: countFiles
function countFiles($dirName, $foldersOnly = false, $nonEmptyCheckOnly = false)
{
$handle = opendir($dirName);
$count = 0;
while (strlen($file = readdir($handle)) > 0) {
if ($file != "." && $file != ".." && !(AJXP_Utils::isHidden($file) && !$this->driverConf["SHOW_HIDDEN_FILES"]) && !($foldersOnly && is_file($dirName . "/" . $file))) {
$count++;
if ($nonEmptyCheckOnly) {
return 1;
}
}
}
closedir($handle);
return $count;
}
示例4: recursivePurge
public function recursivePurge($dirName, $hardPurgeTime, $softPurgeTime = 0)
{
$handle = opendir($dirName);
while (false !== ($entry = readdir($handle))) {
if ($entry == "" || $entry == ".." || AJXP_Utils::isHidden($entry)) {
continue;
}
$fileName = $dirName . "/" . $entry;
if (is_file($fileName)) {
$docAge = time() - filemtime($fileName);
if ($hardPurgeTime > 0 && $docAge > $hardPurgeTime) {
$this->purge($fileName);
} elseif ($softPurgeTime > 0 && $docAge > $softPurgeTime) {
if (!ShareCenter::isShared(new AJXP_Node($fileName))) {
$this->purge($fileName);
}
}
} else {
$this->recursivePurge($fileName, $hardPurgeTime, $softPurgeTime);
}
}
closedir($handle);
}
示例5: recursivePurge
public function recursivePurge($dirName, $hardPurgeTime, $softPurgeTime = 0)
{
$handle = opendir($dirName);
$shareCenter = false;
if (class_exists("ShareCenter")) {
$shareCenter = ShareCenter::getShareCenter("action.share");
}
if ($handle === false) {
$this->logError(__FUNCTION__, "Cannot open folder " . $dirName);
return;
}
while (false !== ($entry = readdir($handle))) {
if ($entry == "" || $entry == ".." || AJXP_Utils::isHidden($entry)) {
continue;
}
$fileName = $dirName . "/" . $entry;
if (is_file($fileName)) {
$docAge = time() - filemtime($fileName);
if ($hardPurgeTime > 0 && $docAge > $hardPurgeTime) {
$this->purge($fileName);
} elseif ($softPurgeTime > 0 && $docAge > $softPurgeTime) {
if ($shareCenter !== false && $shareCenter->isShared(new AJXP_Node($fileName))) {
$this->purge($fileName);
}
}
} else {
$this->recursivePurge($fileName, $hardPurgeTime, $softPurgeTime);
}
}
closedir($handle);
}
示例6: getChildren
/**
* Returns an array with all the child nodes
*
* @return Sabre\DAV\INode[]
*/
public function getChildren()
{
if (isset($this->children)) {
return $this->children;
}
$contents = array();
$errors = array();
$nodes = scandir($this->getUrl());
foreach ($nodes as $file) {
if ($file == "." || $file == "..") {
continue;
}
if (!$this->repository->getOption("SHOW_HIDDEN_FILES") && AJXP_Utils::isHidden($file)) {
continue;
}
if (is_dir($this->getUrl() . "/" . $file)) {
// Add collection without any children
$contents[] = new AJXP_Sabre_Collection($this->path . "/" . $file, $this->repository, $this->getAccessDriver());
} else {
// Add files without content
$contents[] = new AJXP_Sabre_NodeLeaf($this->path . "/" . $file, $this->repository, $this->getAccessDriver());
}
}
$this->children = $contents;
$ajxpNode = new AJXP_Node($this->getUrl());
AJXP_Controller::applyHook("node.read", array(&$ajxpNode));
return $contents;
}
示例7: getCollectionMembers
/**
* Returns members of collection.
*
* Returns an array with the members of the collection identified by $path.
* The returned array can contain {@link ezcWebdavCollection}, and {@link
* ezcWebdavResource} instances and might also be empty, if the collection
* has no members.
*
* @param string $path
* @return array(ezcWebdavResource|ezcWebdavCollection)
*/
protected function getCollectionMembers($path)
{
$path = $this->fixPath($path);
$url = $this->getAccessDriver()->getRessourceUrl($path);
$contents = array();
$errors = array();
$nodes = scandir($url);
AJXP_Logger::debug("getCollectionMembers " . $path);
foreach ($nodes as $file) {
if (isset($this->options->hideDotFiles) && $this->options->hideDotFiles !== false && AJXP_Utils::isHidden($file)) {
continue;
}
if (is_dir($url . "/" . $file)) {
// Add collection without any children
$contents[] = new ezcWebdavCollection($this->urlEncodePath(SystemTextEncoding::toUTF8($path, true) . ($path == "/" ? "" : "/") . SystemTextEncoding::toUTF8($file, true)));
} else {
// Add files without content
$contents[] = new ezcWebdavResource($this->urlEncodePath(SystemTextEncoding::toUTF8($path, true) . ($path == "/" ? "" : "/") . SystemTextEncoding::toUTF8($file, true)));
}
}
return $contents;
}
示例8: recursivePurge
function recursivePurge($dirName, $purgeTime)
{
$handle = opendir($dirName);
$count = 0;
while (strlen($file = readdir($handle)) > 0) {
if ($file == "" || $file == ".." || AJXP_Utils::isHidden($file)) {
continue;
}
if (is_file($dirName . "/" . $file)) {
$time = filemtime($dirName . "/" . $file);
$docAge = time() - $time;
if ($docAge > $purgeTime) {
$node = new AJXP_Node($dirName . "/" . $file);
AJXP_Controller::applyHook("node.before_change", array($node));
unlink($dirName . "/" . $file);
AJXP_Controller::applyHook("node.change", array($node));
AJXP_Logger::logAction("Purge", array("file" => $dirName . "/" . $file));
print " - Purging document : " . $dirName . "/" . $file . "\n";
}
} else {
$this->recursivePurge($dirName . "/" . $file, $purgeTime);
}
}
closedir($handle);
}
示例9: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (isset($httpVars["simple_uploader"]) || isset($httpVars["xhr_uploader"])) {
return;
}
if (self::$skipDecoding) {
}
if (!isset($httpVars["partitionRealName"]) && !isset($httpVars["checkRelativePath"])) {
return;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
if (isset($httpVars["partitionRealName"])) {
$count = intval($httpVars["partitionCount"]);
$index = intval($httpVars["partitionIndex"]);
$fileId = $httpVars["fileId"];
$clientId = $httpVars["ajxp_sessid"];
AJXP_Logger::debug("Should now rebuild file!", $httpVars);
$newDest = fopen($destStreamURL . $httpVars["partitionRealName"], "w");
AJXP_LOGGER::debug("PartitionRealName", $destStreamURL . $httpVars["partitionRealName"]);
for ($i = 0; $i < $count; $i++) {
$part = fopen($destStreamURL . "{$clientId}.{$fileId}.{$i}", "r");
while (!feof($part)) {
fwrite($newDest, fread($part, 4096));
}
fclose($part);
unlink($destStreamURL . "{$clientId}.{$fileId}.{$i}");
}
fclose($newDest);
}
if (isset($httpVars["checkRelativePath"])) {
AJXP_LOGGER::debug("Now dispatching relativePath dest:", $httpVars["relativePath"]);
$subs = explode("/", $httpVars["relativePath"]);
$userfile_name = array_pop($subs);
$subpath = "";
$curDir = "";
// remove trailing slash from current dir if we've got subdirs
if (count($subs) > 0) {
if (substr($curDir, -1) == "/") {
$curDir = substr($curDir, 0, -1);
}
$folderForbidden = false;
// Create the folder tree as necessary
foreach ($subs as $key => $spath) {
$messtmp = "";
$dirname = AJXP_Utils::decodeSecureMagic($spath, AJXP_SANITIZE_HTML_STRICT);
$dirname = substr($dirname, 0, ConfService::getCoreConf("NODENAME_MAX_LENGTH"));
//$this->filterUserSelectionToHidden(array($dirname));
if (AJXP_Utils::isHidden($dirname)) {
$folderForbidden = true;
break;
}
if (file_exists($destStreamURL . "{$curDir}/{$dirname}")) {
// if the folder exists, traverse
AJXP_Logger::debug("{$curDir}/{$dirname} existing, traversing for {$userfile_name} out of", $httpVars["relativePath"]);
$curDir .= "/" . $dirname;
continue;
}
AJXP_Logger::debug($destStreamURL . $curDir);
$dirMode = 0775;
$chmodValue = $repository->getOption("CHMOD_VALUE");
if (isset($chmodValue) && $chmodValue != "") {
$dirMode = octdec(ltrim($chmodValue, "0"));
if ($dirMode & 0400) {
$dirMode |= 0100;
}
// User is allowed to read, allow to list the directory
if ($dirMode & 040) {
$dirMode |= 010;
}
// Group is allowed to read, allow to list the directory
if ($dirMode & 04) {
$dirMode |= 01;
}
// Other are allowed to read, allow to list the directory
}
$old = umask(0);
mkdir($destStreamURL . $curDir . "/" . $dirname, $dirMode);
umask($old);
$curDir .= "/" . $dirname;
}
// Now move the final file to the right folder
// Currently the file is at the base of the current
$relPath = AJXP_Utils::decodeSecureMagic($httpVars["relativePath"]);
$current = $destStreamURL . basename($relPath);
$target = $destStreamURL . $relPath;
if (!$folderForbidden) {
$err = copy($current, $target);
if ($err !== false) {
unlink($current);
}
} else {
// Remove the file, as it should not have been uploaded!
unlink($current);
//.........这里部分代码省略.........