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


PHP Access::getAllowedPaths方法代码示例

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


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

示例1: sendError

    sendError(400);
}
if ($_GET["share"] === "submit") {
    if (empty($_POST["files"]) || is_array($_POST["files"]) === false) {
        sendError(400);
    }
    $pathID = Access::verifyCurrentPathAccess();
    $shareID = loadPicFile("helpers/share/submit.php", array("pathID" => $pathID, "files" => $_POST["files"]));
    if (!$shareID) {
        sendError(500);
    }
    header("Content-type: text/plain");
    echo $shareID;
} elseif ($_GET["share"] === "receive") {
    if (empty($_POST["shareID"])) {
        sendError(400);
    }
    $decodedShareID = loadPicFile("helpers/share/receive.php", array("shareID" => $_POST["shareID"]));
    if (!$decodedShareID) {
        sendError(404);
    }
    list($pathID, $files) = $decodedShareID;
    $allowedPaths = Access::getAllowedPaths();
    if (!isset($allowedPaths[$pathID])) {
        sendError(404);
    }
    header("Content-type: application/json");
    echo json_encode(array("path" => $pathID, "files" => $files));
} else {
    sendError(404);
}
开发者ID:djmattyg007,项目名称:pictorials,代码行数:31,代码来源:share.php

示例2: loadPicFile

<?php

if (empty($_POST)) {
    $appConf = loadPicFile("conf/app.json");
    $pathSelect = PicDB::newSelect();
    $pathSelect->cols(array("id", "name"))->from("paths")->where("id IN (:ids)")->bindValue("ids", Access::getAllowedPaths());
    $templateVars = array("paths" => PicDB::fetch($pathSelect, "pairs"), "imageSizes" => $appConf["image_sizes"]);
    if (isset($appConf["mapbox"])) {
        $templateVars["mapboxConf"] = $appConf["mapbox"];
    }
    loadPicTemplate("templates/filebrowser.phtml", $templateVars);
    exit;
}
$path = Access::getCurrentPath();
if (!empty($_POST["relpath"])) {
    $relpath = loadPicFile("helpers/filenamereject.php", array("filename" => $_POST["relpath"]));
    if (!is_dir($path->path . "/" . $relpath)) {
        sendError(404);
    }
}
use Symfony\Component\Finder\Finder;
$directoryFinder = new Finder();
$directoryFinder->directories()->ignoreUnreadableDirs()->depth(0)->sortByName();
if ($path->hasPermission("symlinks")) {
    $directoryFinder->followLinks();
}
if (!empty($relpath)) {
    $directoryFinder->path($relpath)->depth(substr_count($relpath, "/") + 1);
}
if ($path->hasPermission("nsfw") === false) {
    $directoryFinder->notPath("/.*\\/NSFW\\/.*/")->notPath("/NSFW\\/.*/")->notPath("/.*\\/NSFW/");
开发者ID:djmattyg007,项目名称:pictorials,代码行数:31,代码来源:filebrowser.php


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