本文整理汇总了PHP中ConfService::getRepositoryByAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getRepositoryByAlias方法的具体用法?PHP ConfService::getRepositoryByAlias怎么用?PHP ConfService::getRepositoryByAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getRepositoryByAlias方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findRepositoryByIdOrAlias
/**
* @param $idOrAlias
* @return null|Repository
*/
public static function findRepositoryByIdOrAlias($idOrAlias)
{
$repository = ConfService::getRepositoryById($idOrAlias);
if ($repository != null) {
return $repository;
}
$repository = ConfService::getRepositoryByAlias($idOrAlias);
if ($repository != null) {
return $repository;
}
return null;
}
示例2: trim
if (ConfService::getCoreConf("WEBDAV_BASEHOST") != "") {
$baseURL = ConfService::getCoreConf("WEBDAV_BASEHOST");
} else {
$baseURL = AJXP_Utils::detectServerURL();
}
$baseURI = ConfService::getCoreConf("WEBDAV_BASEURI");
$requestUri = $_SERVER["REQUEST_URI"];
$end = trim(substr($requestUri, strlen($baseURI . "/")));
$rId = null;
if ((!empty($end) || $end === "0") && $end[0] != "?") {
$parts = explode("/", $end);
$pathBase = $parts[0];
$repositoryId = $pathBase;
$repository = ConfService::getRepositoryById($repositoryId);
if ($repository == null) {
$repository = ConfService::getRepositoryByAlias($repositoryId);
if ($repository != null) {
$repositoryId = $repository->getId();
}
}
if ($repository == null) {
AJXP_Logger::debug("not found, dying {$repositoryId}");
die('You are not allowed to access this service');
}
$rId = $repositoryId;
$rootDir = new AJXP_Sabre_Collection("/", $repository, null);
$server = new Sabre\DAV\Server($rootDir);
$server->setBaseUri($baseURI . "/" . $pathBase);
} else {
$rootDir = new AJXP_Sabre_RootCollection("root");
$server = new Sabre\DAV\Server($rootDir);
示例3: authenticate
/**
* Authenticates the user based on the current request.
*
* If authentication is successful, true must be returned.
* If authentication fails, an exception must be thrown.
*
* @param DAV\Server $server
* @param string $realm
* @throws DAV\Exception\NotAuthenticated
* @return bool
*/
public function authenticate(DAV\Server $server, $realm)
{
$auth = new BasicAuthNoPass();
$auth->setHTTPRequest($server->httpRequest);
$auth->setHTTPResponse($server->httpResponse);
$auth->setRealm($realm);
$userpass = $auth->getUserPass();
if (!$userpass) {
$auth->requireLogin();
throw new DAV\Exception\NotAuthenticated('No basic authentication headers were found');
}
// Authenticates the user
$token = $userpass[0];
$shareStore = new \ShareStore(\ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"));
$shareData = $shareStore->loadShare($token);
if (is_array($shareData)) {
$this->shareData = $shareData;
} else {
$auth->requireLogin();
throw new DAV\Exception\NotAuthenticated('Username or password does not match');
}
if (!$this->validateUserPass($userpass[0], $userpass[1])) {
$auth->requireLogin();
throw new DAV\Exception\NotAuthenticated('Username or password does not match');
}
$repositoryId = $this->shareData["REPOSITORY"];
$repository = \ConfService::getRepositoryById($repositoryId);
if ($repository == null) {
$repository = \ConfService::getRepositoryByAlias($repositoryId);
}
if ($repository == null) {
throw new DAV\Exception\NotAuthenticated('Username cannot access any repository');
} else {
$this->rootCollection->updateRepository($repository);
}
$this->currentUser = $userpass[0];
return true;
}
示例4: parseApplicationGetParameters
/**
* Utilitary to pass some parameters directly at startup :
* + repository_id / folder
* + compile & skipDebug
* + update_i18n, extract, create
* + external_selector_type
* + skipIOS
* + gui
* @static
* @param $parameters
* @param $output
* @param $session
* @return void
*/
public static function parseApplicationGetParameters($parameters, &$output, &$session)
{
$output["EXT_REP"] = "/";
if (isset($parameters["repository_id"]) && isset($parameters["folder"]) || isset($parameters["goto"])) {
if (isset($parameters["goto"])) {
$explode = explode("/", ltrim($parameters["goto"], "/"));
$repoId = array_shift($explode);
$parameters["folder"] = str_replace($repoId, "", ltrim($parameters["goto"], "/"));
} else {
$repoId = $parameters["repository_id"];
}
$repository = ConfService::getRepositoryById($repoId);
if ($repository == null) {
$repository = ConfService::getRepositoryByAlias($repoId);
if ($repository != null) {
$parameters["repository_id"] = $repository->getId();
}
} else {
$parameters["repository_id"] = $repository->getId();
}
require_once AJXP_BIN_FOLDER . "/class.SystemTextEncoding.php";
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && $loggedUser->canSwitchTo($parameters["repository_id"])) {
$output["FORCE_REGISTRY_RELOAD"] = true;
$output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
$loggedUser->setArrayPref("history", "last_repository", $parameters["repository_id"]);
$loggedUser->setPref("pending_folder", SystemTextEncoding::toUTF8(AJXP_Utils::decodeSecureMagic($parameters["folder"])));
$loggedUser->save("user");
AuthService::updateUser($loggedUser);
} else {
$session["PENDING_REPOSITORY_ID"] = $parameters["repository_id"];
$session["PENDING_FOLDER"] = SystemTextEncoding::toUTF8(AJXP_Utils::decodeSecureMagic($parameters["folder"]));
}
} else {
ConfService::switchRootDir($parameters["repository_id"]);
$output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
}
}
if (isset($parameters["skipDebug"])) {
ConfService::setConf("JS_DEBUG", false);
}
if (ConfService::getConf("JS_DEBUG") && isset($parameters["compile"])) {
require_once AJXP_BIN_FOLDER . "/class.AJXP_JSPacker.php";
AJXP_JSPacker::pack();
}
if (ConfService::getConf("JS_DEBUG") && isset($parameters["update_i18n"])) {
if (isset($parameters["extract"])) {
self::extractConfStringsFromManifests();
}
self::updateAllI18nLibraries(isset($parameters["create"]) ? $parameters["create"] : "");
}
if (ConfService::getConf("JS_DEBUG") && isset($parameters["clear_plugins_cache"])) {
@unlink(AJXP_PLUGINS_CACHE_FILE);
@unlink(AJXP_PLUGINS_REQUIRES_FILE);
}
if (AJXP_SERVER_DEBUG && isset($parameters["extract_application_hooks"])) {
self::extractHooksToDoc();
}
if (isset($parameters["external_selector_type"])) {
$output["SELECTOR_DATA"] = array("type" => $parameters["external_selector_type"], "data" => $parameters);
}
if (isset($parameters["skipIOS"])) {
setcookie("SKIP_IOS", "true");
}
if (isset($parameters["skipANDROID"])) {
setcookie("SKIP_ANDROID", "true");
}
if (isset($parameters["gui"])) {
setcookie("AJXP_GUI", $parameters["gui"]);
if ($parameters["gui"] == "light") {
$session["USE_EXISTING_TOKEN_IF_EXISTS"] = true;
}
} else {
if (isset($session["USE_EXISTING_TOKEN_IF_EXISTS"])) {
unset($session["USE_EXISTING_TOKEN_IF_EXISTS"]);
}
setcookie("AJXP_GUI", null);
}
if (isset($session["OVERRIDE_GUI_START_PARAMETERS"])) {
$output = array_merge($output, $session["OVERRIDE_GUI_START_PARAMETERS"]);
}
}
示例5: downloadFile
public function downloadFile($nodeName)
{
$nodeName = urldecode($nodeName);
//ob_start();
$alreadyInstanciated = true;
if (AuthService::getLoggedUser() == null) {
AuthService::logUser($this->authLogin, $this->authPwd, true);
$alreadyInstanciated = false;
}
$parts = explode("/", trim($nodeName, "/"));
$repoAlias = array_shift($parts);
$fileName = implode("/", $parts);
$nbRep = ConfService::getRepositoryByAlias($repoAlias);
$defaultRepoId = $nbRep->getId();
ConfService::switchRootDir($defaultRepoId);
ConfService::getConfStorageImpl();
ConfService::loadRepositoryDriver();
if (!$alreadyInstanciated) {
AJXP_PluginsService::getInstance()->initActivePlugins();
}
//ob_end_clean();
AJXP_Controller::findActionAndApply("download", array("file" => "/" . $fileName), array());
exit;
}