本文整理汇总了PHP中ConfService::getConfStorageImpl方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getConfStorageImpl方法的具体用法?PHP ConfService::getConfStorageImpl怎么用?PHP ConfService::getConfStorageImpl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getConfStorageImpl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* Filter the very basic keywords from the XML : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
* Calls the vars.filter hooks.
* @static
* @param $value
* @param AbstractAjxpUser|String $resolveUser
* @return mixed|string
*/
public static function filter($value, $resolveUser = null)
{
if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
if (AuthService::usersEnabled()) {
if ($resolveUser != null) {
if (is_string($resolveUser)) {
$resolveUserId = $resolveUser;
} else {
$resolveUserId = $resolveUser->getId();
}
$value = str_replace("AJXP_USER", $resolveUserId, $value);
} else {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
if ($loggedUser->hasParent() && $loggedUser->getResolveAsParent()) {
$loggedUserId = $loggedUser->getParent();
} else {
$loggedUserId = $loggedUser->getId();
}
$value = str_replace("AJXP_USER", $loggedUserId, $value);
} else {
return "";
}
}
} else {
$value = str_replace("AJXP_USER", "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_GROUP_PATH") !== false) {
if (AuthService::usersEnabled()) {
if ($resolveUser != null) {
if (is_string($resolveUser) && AuthService::userExists($resolveUser)) {
$loggedUser = ConfService::getConfStorageImpl()->createUserObject($resolveUser);
} else {
$loggedUser = $resolveUser;
}
} else {
$loggedUser = AuthService::getLoggedUser();
}
if ($loggedUser != null) {
$gPath = $loggedUser->getGroupPath();
$value = str_replace("AJXP_GROUP_PATH_FLAT", str_replace("/", "_", trim($gPath, "/")), $value);
$value = str_replace("AJXP_GROUP_PATH", $gPath, $value);
} else {
return "";
}
} else {
$value = str_replace(array("AJXP_GROUP_PATH", "AJXP_GROUP_PATH_FLAT"), "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
$value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
}
if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
$value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
}
$tab = array(&$value);
AJXP_Controller::applyIncludeHook("vars.filter", $tab);
return $value;
}
示例2: __construct
public function __construct()
{
$storage = \ConfService::getConfStorageImpl();
if ($storage->getId() == "conf.sql") {
$this->storage = $storage;
}
}
示例3: AbstractAjxpUser
function AbstractAjxpUser($id, $storage = null)
{
$this->id = $id;
if ($storage == null) {
$storage = ConfService::getConfStorageImpl();
}
$this->storage = $storage;
$this->load();
}
示例4: authenticate
public function authenticate(Sabre\DAV\Server $server, $realm)
{
$auth = new Sabre\HTTP\BasicAuth();
$auth->setHTTPRequest($server->httpRequest);
$auth->setHTTPResponse($server->httpResponse);
$auth->setRealm($realm);
$userpass = $auth->getUserPass();
if (!$userpass) {
$auth->requireLogin();
throw new Sabre\DAV\Exception\NotAuthenticated('No basic authentication headers were found');
}
// Authenticates the user
//AJXP_Logger::info(__CLASS__,"authenticate",$userpass[0]);
$confDriver = ConfService::getConfStorageImpl();
$userObject = $confDriver->createUserObject($userpass[0]);
$webdavData = $userObject->getPref("AJXP_WEBDAV_DATA");
if (empty($webdavData) || !isset($webdavData["ACTIVE"]) || $webdavData["ACTIVE"] !== true) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $userpass[0], "error" => "WebDAV user not found or disabled"));
throw new Sabre\DAV\Exception\NotAuthenticated();
}
// check if there are cached credentials. prevents excessive authentication calls to external
// auth mechanism.
$cachedPasswordValid = 0;
$secret = defined("AJXP_SECRET_KEY") ? AJXP_SECRET_KEY : "CDAFx¨op#";
$encryptedPass = md5($userpass[1] . $secret . date('YmdHi'));
if (isset($webdavData["TMP_PASS"]) && $encryptedPass == $webdavData["TMP_PASS"]) {
$cachedPasswordValid = true;
//AJXP_Logger::debug("Using Cached Password");
}
if (!$cachedPasswordValid && !$this->validateUserPass($userpass[0], $userpass[1])) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $userpass[0], "error" => "Invalid WebDAV user or password"));
$auth->requireLogin();
throw new Sabre\DAV\Exception\NotAuthenticated('Username or password does not match');
}
$this->currentUser = $userpass[0];
$res = AuthService::logUser($this->currentUser, $userpass[1], true);
if ($res < 1) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
$this->updateCurrentUserRights(AuthService::getLoggedUser());
if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
AJXP_Safe::storeCredentials($this->currentUser, $userpass[1]);
}
if (isset($this->repositoryId) && ConfService::getRepositoryById($this->repositoryId)->getOption("AJXP_WEBDAV_DISABLED") === true) {
throw new Sabre\DAV\Exception\NotAuthenticated('You are not allowed to access this workspace');
}
ConfService::switchRootDir($this->repositoryId);
// the method used here will invalidate the cached password every minute on the minute
if (!$cachedPasswordValid) {
$webdavData["TMP_PASS"] = $encryptedPass;
$userObject->setPref("AJXP_WEBDAV_DATA", $webdavData);
$userObject->save("user");
AuthService::updateUser($userObject);
}
return true;
}
示例5: listUsers
public function listUsers($baseGroup = "/")
{
$users = AJXP_Utils::loadSerialFile($this->usersSerFile);
if (AuthService::ignoreUserCase()) {
$users = array_combine(array_map("strtolower", array_keys($users)), array_values($users));
}
ConfService::getConfStorageImpl()->filterUsersByGroup($users, $baseGroup, false);
ksort($users);
return $users;
}
示例6: getAccessDriver
/**
* @return AjxpWebdavProvider
* @throws ezcBaseFileNotFoundException
*/
protected function getAccessDriver()
{
if (!isset($this->accessDriver)) {
$confDriver = ConfService::getConfStorageImpl();
$this->accessDriver = ConfService::loadRepositoryDriver();
if (!$this->accessDriver instanceof AjxpWebdavProvider) {
throw new ezcBaseFileNotFoundException($this->repository->getUniqueId());
}
$wrapperData = $this->accessDriver->detectStreamWrapper(true);
$this->wrapperClassName = $wrapperData["classname"];
}
return $this->accessDriver;
}
示例7: getAccessDriver
/**
* @return AjxpWrapperProvider
* @throws \Sabre\DAV\Exception\NotFound
*/
public function getAccessDriver()
{
if (!isset($this->accessDriver)) {
//$RID = $this->repository->getId();
//ConfService::switchRootDir($RID);
ConfService::getConfStorageImpl();
$this->accessDriver = ConfService::loadDriverForRepository($this->repository);
if (!$this->accessDriver instanceof AjxpWrapperProvider) {
throw new Sabre\DAV\Exception\NotFound($this->repository->getId());
}
$this->accessDriver->detectStreamWrapper(true);
}
return $this->accessDriver;
}
示例8: countAdminUsers
function countAdminUsers()
{
$confDriver = ConfService::getConfStorageImpl();
$authDriver = ConfService::getAuthDriverImpl();
$count = 0;
$users = $authDriver->listUsers();
foreach (array_keys($users) as $userId) {
$userObject = $confDriver->createUserObject($userId);
$userObject->load();
if ($userObject->isAdmin()) {
$count++;
}
}
return $count;
}
示例9: receiveAction
public function receiveAction($action, $httpVars, $filesVars)
{
$provider = $this->getFilteredOption("AVATAR_PROVIDER");
$type = $this->getFilteredOption("GRAVATAR_TYPE");
if ($action == "get_avatar_url") {
$url = "";
$suffix = "";
switch ($provider) {
case "gravatar":
default:
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
$url = "https://secure.gravatar.com";
} else {
$url = "http://www.gravatar.com";
}
$url .= "/avatar/";
$suffix .= "?s=80&r=g&d=" . $type;
break;
case "libravatar":
$url = "";
// Federated Servers are not supported here without libravatar.org. Should query DNS server first.
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
$url = "https://seccdn.libravatar.org";
} else {
$url = "http://cdn.libravatar.org";
}
$url .= "/avatar/";
$suffix = "?s=80&d=" . $type;
break;
}
if (isset($httpVars["userid"])) {
$userid = $httpVars["userid"];
if (AuthService::usersEnabled() && AuthService::userExists($userid)) {
$confDriver = ConfService::getConfStorageImpl();
$user = $confDriver->createUserObject($userid);
$userEmail = $user->personalRole->filterParameterValue("core.conf", "email", AJXP_REPO_SCOPE_ALL, "");
if (!empty($userEmail)) {
$url .= md5(strtolower(trim($userEmail)));
}
}
}
$url .= $suffix;
print $url;
}
}
示例10: getDigestHash
public function getDigestHash($realm, $username)
{
if (!AuthService::userExists($username)) {
return false;
}
$confDriver = ConfService::getConfStorageImpl();
$user = $confDriver->createUserObject($username);
$webdavData = $user->getPref("AJXP_WEBDAV_DATA");
if (empty($webdavData) || !isset($webdavData["ACTIVE"]) || $webdavData["ACTIVE"] !== true || !isset($webdavData["PASS"]) && !isset($webdavData["HA1"])) {
return false;
}
if (isset($webdavData["HA1"])) {
return $webdavData["HA1"];
} else {
$pass = $this->_decodePassword($webdavData["PASS"], $username);
return md5("{$username}:{$realm}:{$pass}");
}
}
示例11: orbitExtensionActive
private function orbitExtensionActive()
{
$confs = ConfService::getConfStorageImpl()->loadPluginConfig("gui", "ajax");
if (!isset($confs) || !isset($confs["GUI_THEME"])) {
$confs["GUI_THEME"] = "orbit";
}
if ($confs["GUI_THEME"] == "orbit") {
$pServ = AJXP_PluginsService::getInstance();
$activePlugs = $pServ->getActivePlugins();
$streamWrappers = $pServ->getStreamWrapperPlugins();
$streamActive = false;
foreach ($streamWrappers as $sW) {
if (array_key_exists($sW, $activePlugs) && $activePlugs[$sW] === true) {
$streamActive = true;
break;
}
}
return $streamActive;
}
return false;
}
示例12: logoutCallback
public function logoutCallback($actionName, $httpVars, $fileVars)
{
$safeCredentials = AJXP_Safe::loadCredentials();
$crtUser = $safeCredentials["user"];
if (isset($_SESSION["AJXP_DYNAMIC_FTP_DATA"])) {
unset($_SESSION["AJXP_DYNAMIC_FTP_DATA"]);
}
AJXP_Safe::clearCredentials();
$adminUser = $this->options["AJXP_ADMIN_LOGIN"];
if (isset($this->options["ADMIN_USER"])) {
$adminUser = $this->options["AJXP_ADMIN_LOGIN"];
}
$subUsers = array();
if ($crtUser != $adminUser && $crtUser != "") {
ConfService::getConfStorageImpl()->deleteUser($crtUser, $subUsers);
}
AuthService::disconnect();
session_destroy();
session_write_close();
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult(2);
AJXP_XMLWriter::close();
}
示例13: updateUserObject
//.........这里部分代码省略.........
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValueWithPrefix)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValueWithPrefix, $valueFilters)) {
continue;
}
$roleToAdd = AuthService::getRole($uniqValueWithPrefix, true);
$roleToAdd->setLabel($uniqValue);
AuthService::updateRole($roleToAdd);
$userObject->addRole($roleToAdd);
$changes = true;
}
} else {
foreach ($entry[$key] as $uniqValue) {
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValue)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValue, $valueFilters)) {
continue;
}
if (!in_array($uniqValue, array_keys($userObject->getRoles())) && !empty($uniqValue)) {
$userObject->addRole(AuthService::getRole($uniqValue, true));
$changes = true;
}
}
}
break;
case "group_path":
if ($key == "memberof") {
$filter = $params["MAPPING_LOCAL_PARAM"];
if (strpos($filter, "preg:") !== false) {
$matchFilter = "/" . str_replace("preg:", "", $filter) . "/i";
} else {
if (!empty($filter)) {
$valueFilters = array_map("trim", explode(",", $filter));
}
}
foreach ($memberValues as $uniqValue => $fullDN) {
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValue)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValue, $valueFilters)) {
continue;
}
if ($userObject->personalRole->filterParameterValue("auth.ldap", "MEMBER_OF", AJXP_REPO_SCOPE_ALL, "") == $fullDN) {
//break;
}
$humanName = $uniqValue;
$branch = array();
$this->buildGroupBranch($uniqValue, $branch);
$parent = "/";
if (count($branch)) {
$parent = "/" . implode("/", array_reverse($branch));
}
if (!ConfService::getConfStorageImpl()->groupExists(rtrim(AuthService::filterBaseGroup($parent), "/") . "/" . $fullDN)) {
AuthService::createGroup($parent, $fullDN, $humanName);
}
$userObject->setGroupPath(rtrim($parent, "/") . "/" . $fullDN, true);
// Update Roles from groupPath
$b = array_reverse($branch);
$b[] = $fullDN;
for ($i = 1; $i <= count($b); $i++) {
$userObject->addRole(AuthService::getRole("AJXP_GRP_/" . implode("/", array_slice($b, 0, $i)), true));
}
$userObject->personalRole->setParameterValue("auth.ldap", "MEMBER_OF", $fullDN);
$userObject->recomputeMergedRole();
$changes = true;
}
}
break;
case "profile":
if ($userObject->getProfile() != $value) {
$changes = true;
$userObject->setProfile($value);
AuthService::updateAutoApplyRole($userObject);
}
break;
case "plugin_param":
default:
if (strpos($params["MAPPING_LOCAL_PARAM"], "/") !== false) {
list($pId, $param) = explode("/", $params["MAPPING_LOCAL_PARAM"]);
} else {
$pId = $this->getId();
$param = $params["MAPPING_LOCAL_PARAM"];
}
if ($userObject->personalRole->filterParameterValue($pId, $param, AJXP_REPO_SCOPE_ALL, "") != $value) {
$userObject->personalRole->setParameterValue($pId, $param, $value);
$userObject->recomputeMergedRole();
$changes = true;
}
break;
}
}
}
}
if ($changes) {
$userObject->save("superuser");
}
}
}
示例14: userExists
public function userExists($login)
{
// Check if local storage exists for the user. If it does, assume the user
// exists. This prevents a barrage of ldap_connect/ldap_bind/ldap_search
// calls.
$confDriver = ConfService::getConfStorageImpl();
$userObject = $confDriver->instantiateAbstractUserImpl($login);
if ($userObject->storageExists()) {
//return true;
}
$entries = $this->getUserEntries($login);
if (!is_array($entries)) {
return false;
}
if (AuthService::ignoreUserCase()) {
$res = strcasecmp($login, $entries[0][$this->ldapUserAttr][0]) == 0;
} else {
$res = strcmp($login, $entries[0][$this->ldapUserAttr][0]) == 0;
}
$this->logDebug(__FUNCTION__, 'checking if user ' . $login . ' exists : ' . $res);
return $res;
}
示例15: header
//------------------------------------------------------------
// SPECIAL HANDLING FOR FANCY UPLOADER RIGHTS FOR THIS ACTION
//------------------------------------------------------------
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($action == "upload" && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRepositoryId() . "")) && isset($_FILES['Filedata'])) {
header('HTTP/1.0 ' . '410 Not authorized');
die('Error 410 Not authorized!');
}
}
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
$confDriver = ConfService::getConfStorageImpl();
$Driver = ConfService::loadRepositoryDriver();
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($action, array_merge($_GET, $_POST), $_FILES);
if ($xmlResult !== false && $xmlResult != "") {
AJXP_XMLWriter::header();
print $xmlResult;
AJXP_XMLWriter::close();
} else {
if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
}