本文整理汇总了PHP中ConfService::getAuthDriverImpl方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getAuthDriverImpl方法的具体用法?PHP ConfService::getAuthDriverImpl怎么用?PHP ConfService::getAuthDriverImpl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getAuthDriverImpl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajxp_gluecode_updateRole
function ajxp_gluecode_updateRole($loginData, &$userObject)
{
$authPlug = ConfService::getAuthDriverImpl();
if (property_exists($authPlug, "drivers") && is_array($authPlug->drivers) && $authPlug->drivers["remote"]) {
$authPlug = $authPlug->drivers["remote"];
}
$rolesMap = $authPlug->getOption("ROLES_MAP");
if (!isset($rolesMap) || strlen($rolesMap) == 0) {
return;
}
// String like {key:value,key2:value2,key3:value3}
$rolesMap = explode(",", $rolesMap);
$newMap = array();
foreach ($rolesMap as $value) {
$parts = explode(":", trim($value));
$roleId = trim($parts[1]);
$roleObject = AuthService::getRole($roleId);
if ($roleObject != null) {
$newMap[trim($parts[0])] = $roleObject;
$userObject->removeRole($roleId);
}
}
$rolesMap = $newMap;
if (isset($loginData["roles"]) && is_array($loginData["roles"])) {
foreach ($loginData["roles"] as $role) {
if (isset($rolesMap[$role])) {
$userObject->addRole($rolesMap[$role]);
}
}
}
}
示例2: applyAction
function applyAction($actionName, $httpVars, $filesVar)
{
if ($actionName == "get_ajxp_actions") {
AJXP_XMLWriter::header();
$this->sendActionsToClient(false, null, null);
$authDriver = ConfService::getAuthDriverImpl();
$authDriver->sendActionsToClient(false, null, null);
$confDriver = ConfService::getConfStorageImpl();
$confDriver->sendActionsToClient(false, null, null);
AJXP_XMLWriter::close();
exit(1);
} else {
parent::applyAction($actionName, $httpVars, $filesVar);
}
}
示例3: 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;
}
示例4: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
parent::accessPreprocess($action, $httpVars, $fileVars);
$loggedUser = AuthService::getLoggedUser();
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
return;
}
if (AuthService::usersEnabled()) {
$currentBookmarks = AuthService::getLoggedUser()->getBookmarks();
// FLATTEN
foreach ($currentBookmarks as $bm) {
$this->currentBookmarks[] = $bm["PATH"];
}
}
if ($action == "edit") {
if (isset($httpVars["sub_action"])) {
$action = $httpVars["sub_action"];
}
}
$mess = ConfService::getMessages();
$currentUserIsGroupAdmin = AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != "/";
if ($currentUserIsGroupAdmin && ConfService::getAuthDriverImpl()->isAjxpAdmin(AuthService::getLoggedUser()->getId())) {
$currentUserIsGroupAdmin = false;
}
switch ($action) {
//------------------------------------
// BASIC LISTING
//------------------------------------
case "ls":
$rootNodes = array("data" => array("LABEL" => $mess["ajxp_conf.110"], "ICON" => "user.png", "DESCRIPTION" => $mess["ajxp_conf.137"], "CHILDREN" => array("repositories" => array("AJXP_MIME" => "workspaces_zone", "LABEL" => $mess["ajxp_conf.3"], "DESCRIPTION" => $mess["ajxp_conf.138"], "ICON" => "hdd_external_unmount.png", "LIST" => "listRepositories"), "users" => array("AJXP_MIME" => "users_zone", "LABEL" => $mess["ajxp_conf.2"], "DESCRIPTION" => $mess["ajxp_conf.139"], "ICON" => "users-folder.png", "LIST" => "listUsers"), "roles" => array("AJXP_MIME" => "roles_zone", "LABEL" => $mess["ajxp_conf.69"], "DESCRIPTION" => $mess["ajxp_conf.140"], "ICON" => "user-acl.png", "LIST" => "listRoles"))), "config" => array("AJXP_MIME" => "plugins_zone", "LABEL" => $mess["ajxp_conf.109"], "ICON" => "preferences_desktop.png", "DESCRIPTION" => $mess["ajxp_conf.136"], "CHILDREN" => array("core" => array("AJXP_MIME" => "plugins_zone", "LABEL" => $mess["ajxp_conf.98"], "DESCRIPTION" => $mess["ajxp_conf.133"], "ICON" => "preferences_desktop.png", "LIST" => "listPlugins"), "plugins" => array("AJXP_MIME" => "plugins_zone", "LABEL" => $mess["ajxp_conf.99"], "DESCRIPTION" => $mess["ajxp_conf.134"], "ICON" => "folder_development.png", "LIST" => "listPlugins"), "core_plugins" => array("AJXP_MIME" => "plugins_zone", "LABEL" => $mess["ajxp_conf.123"], "DESCRIPTION" => $mess["ajxp_conf.135"], "ICON" => "folder_development.png", "LIST" => "listPlugins"))), "admin" => array("LABEL" => $mess["ajxp_conf.111"], "ICON" => "toggle_log.png", "DESCRIPTION" => $mess["ajxp_conf.141"], "CHILDREN" => array("logs" => array("LABEL" => $mess["ajxp_conf.4"], "DESCRIPTION" => $mess["ajxp_conf.142"], "ICON" => "toggle_log.png", "LIST" => "listLogFiles"), "diagnostic" => array("LABEL" => $mess["ajxp_conf.5"], "DESCRIPTION" => $mess["ajxp_conf.143"], "ICON" => "susehelpcenter.png", "LIST" => "printDiagnostic"))), "developer" => array("LABEL" => $mess["ajxp_conf.144"], "ICON" => "applications_engineering.png", "DESCRIPTION" => $mess["ajxp_conf.145"], "CHILDREN" => array("actions" => array("LABEL" => $mess["ajxp_conf.146"], "DESCRIPTION" => $mess["ajxp_conf.147"], "ICON" => "book.png", "LIST" => "listActions"), "hooks" => array("LABEL" => $mess["ajxp_conf.148"], "DESCRIPTION" => $mess["ajxp_conf.149"], "ICON" => "book.png", "LIST" => "listHooks"))));
if ($currentUserIsGroupAdmin) {
unset($rootNodes["config"]);
unset($rootNodes["admin"]);
unset($rootNodes["developer"]);
}
AJXP_Controller::applyHook("ajxp_conf.list_config_nodes", array(&$rootNodes));
$parentName = "";
$dir = trim(AJXP_Utils::decodeSecureMagic(isset($httpVars["dir"]) ? $httpVars["dir"] : ""), " /");
if ($dir != "") {
$hash = null;
if (strstr(urldecode($dir), "#") !== false) {
list($dir, $hash) = explode("#", urldecode($dir));
}
$splits = explode("/", $dir);
$root = array_shift($splits);
if (count($splits)) {
$returnNodes = false;
if (isset($httpVars["file"])) {
$returnNodes = true;
}
$child = $splits[0];
if (isset($rootNodes[$root]["CHILDREN"][$child])) {
$atts = array();
if ($child == "users") {
$atts["remote_indexation"] = "admin_search";
}
$callback = $rootNodes[$root]["CHILDREN"][$child]["LIST"];
if (is_string($callback) && method_exists($this, $callback)) {
if (!$returnNodes) {
AJXP_XMLWriter::header("tree", $atts);
}
$res = call_user_func(array($this, $callback), implode("/", $splits), $root, $hash, $returnNodes, isset($httpVars["file"]) ? $httpVars["file"] : '');
if (!$returnNodes) {
AJXP_XMLWriter::close();
}
} else {
if (is_array($callback)) {
$res = call_user_func($callback, implode("/", $splits), $root, $hash, $returnNodes, isset($httpVars["file"]) ? $httpVars["file"] : '');
}
}
if ($returnNodes) {
AJXP_XMLWriter::header("tree", $atts);
if (isset($res["/" . $dir . "/" . $httpVars["file"]])) {
print $res["/" . $dir . "/" . $httpVars["file"]];
}
AJXP_XMLWriter::close();
}
return;
}
} else {
$parentName = "/" . $root . "/";
$nodes = $rootNodes[$root]["CHILDREN"];
}
} else {
$parentName = "/";
$nodes = $rootNodes;
}
if (isset($httpVars["file"])) {
$parentName = $httpVars["dir"] . "/";
$nodes = array(basename($httpVars["file"]) => array("LABEL" => basename($httpVars["file"])));
}
if (isset($nodes)) {
AJXP_XMLWriter::header();
if (!isset($httpVars["file"])) {
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchDisplayMode="detail"><column messageId="ajxp_conf.1" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.102" attributeName="description" sortType="String"/></columns>');
}
foreach ($nodes as $key => $data) {
//.........这里部分代码省略.........
示例5: createSharedRepository
//.........这里部分代码省略.........
if (isset($editingRepo)) {
$currentRights = $this->computeSharedRepositoryAccessRights($httpVars["repository_id"], false, $this->urlBase . $file);
$originalUsers = array_keys($currentRights["USERS"]);
$removeUsers = array_diff($originalUsers, $users);
if (count($removeUsers)) {
foreach ($removeUsers as $user) {
if (AuthService::userExists($user)) {
$userObject = $confDriver->createUserObject($user);
$userObject->personalRole->setAcl($newRepoUniqueId, "");
$userObject->save("superuser");
}
if ($this->watcher !== false) {
$this->watcher->removeWatchFromFolder(new AJXP_Node($this->urlBase . $file), $user, true);
}
}
}
$originalGroups = array_keys($currentRights["GROUPS"]);
$removeGroups = array_diff($originalGroups, $groups);
if (count($removeGroups)) {
foreach ($removeGroups as $groupId) {
$role = AuthService::getRole($groupId);
if ($role !== false) {
$role->setAcl($newRepoUniqueId, "");
AuthService::updateRole($role);
}
}
}
}
foreach ($users as $userName) {
if (AuthService::userExists($userName, "r")) {
// check that it's a child user
$userObject = $confDriver->createUserObject($userName);
} else {
if (ConfService::getAuthDriverImpl()->getOptionAsBool("TRANSMIT_CLEAR_PASS")) {
$pass = $uPasses[$userName];
} else {
$pass = md5($uPasses[$userName]);
}
if (!isset($httpVars["minisite"])) {
// This is an explicit user creation - check possible limits
AJXP_Controller::applyHook("user.before_create", array($userName, null, false, false));
$limit = $loggedUser->personalRole->filterParameterValue("core.conf", "USER_SHARED_USERS_LIMIT", AJXP_REPO_SCOPE_ALL, "");
if (!empty($limit) && intval($limit) > 0) {
$count = count(ConfService::getConfStorageImpl()->getUserChildren($loggedUser->getId()));
if ($count >= $limit) {
$mess = ConfService::getMessages();
throw new Exception($mess['483']);
}
}
}
AuthService::createUser($userName, $pass, false, isset($httpVars["minisite"]));
$userObject = $confDriver->createUserObject($userName);
$userObject->personalRole->clearAcls();
$userObject->setParent($loggedUser->id);
$userObject->setGroupPath($loggedUser->getGroupPath());
$userObject->setProfile("shared");
if (isset($httpVars["minisite"])) {
$mess = ConfService::getMessages();
$userObject->setHidden(true);
$userObject->personalRole->setParameterValue("core.conf", "USER_DISPLAY_NAME", "[" . $mess["share_center.109"] . "] " . AJXP_Utils::sanitize($newRepo->getDisplay(), AJXP_SANITIZE_EMAILCHARS));
}
AJXP_Controller::applyHook("user.after_create", array($userObject));
}
// CREATE USER WITH NEW REPO RIGHTS
$userObject->personalRole->setAcl($newRepoUniqueId, $uRights[$userName]);
// FORK MASK IF THERE IS ANY
示例6: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$loggedUser = AuthService::getLoggedUser();
if (ENABLE_USERS && !$loggedUser->isAdmin()) {
return;
}
if ($action == "edit") {
if (isset($httpVars["sub_action"])) {
$action = $httpVars["sub_action"];
}
}
switch ($action) {
//------------------------------------
// BASIC LISTING
//------------------------------------
case "ls":
$rootNodes = array("users" => array("LABEL" => "Users", "ICON" => "yast_kuser.png"), "repositories" => array("LABEL" => "Repositories", "ICON" => "folder_red.png"), "logs" => array("LABEL" => "Logs", "ICON" => "toggle_log.png"), "diagnostic" => array("LABEL" => "Diagnostic", "ICON" => "susehelpcenter.png"));
$dir = isset($httpVars["dir"]) ? $httpVars["dir"] : "";
$splits = explode("/", $dir);
if (count($splits)) {
if ($splits[0] == "") {
array_shift($splits);
}
if (count($splits)) {
$strippedDir = strtolower(urldecode($splits[0]));
} else {
$strippedDir = "";
}
}
if (array_key_exists($strippedDir, $rootNodes)) {
AJXP_XMLWriter::header();
if ($strippedDir == "users") {
$this->listUsers();
} else {
if ($strippedDir == "repositories") {
$this->listRepositories();
} else {
if ($strippedDir == "logs") {
$this->listLogFiles($dir);
} else {
if ($strippedDir == "diagnostic") {
$this->printDiagnostic();
}
}
}
}
AJXP_XMLWriter::close();
exit(1);
} else {
AJXP_XMLWriter::header();
print '<columns switchGridMode="filelist"><column messageString="Configuration Data" attributeName="ajxp_label" sortType="String"/></columns>';
foreach ($rootNodes as $key => $data) {
$src = '';
if ($key == "logs") {
$src = 'src="content.php?dir=' . $key . '"';
}
print '<tree text="' . $data["LABEL"] . '" icon="' . $data["ICON"] . '" filename="/' . $key . '" parentname="/" ' . $src . ' />';
}
AJXP_XMLWriter::close();
exit(1);
}
break;
case "edit_user":
$confStorage = ConfService::getConfStorageImpl();
$userId = $httpVars["user_id"];
$userObject = $confStorage->createUserObject($userId);
//print_r($userObject);
AJXP_XMLWriter::header("admin_data");
AJXP_XMLWriter::sendUserData($userObject, true);
// Add WALLET DATA : DEFINITIONS AND VALUES
print "<drivers>";
print ConfService::availableDriversToXML("user_param");
print "</drivers>";
$wallet = $userObject->getPref("AJXP_WALLET");
if (is_array($wallet) && count($wallet) > 0) {
print "<user_wallet>";
foreach ($wallet as $repoId => $options) {
foreach ($options as $optName => $optValue) {
print "<wallet_data repo_id=\"{$repoId}\" option_name=\"{$optName}\" option_value=\"{$optValue}\"/>";
}
}
print "</user_wallet>";
}
$editPass = $userId != "guest" ? "1" : "0";
$authDriver = ConfService::getAuthDriverImpl();
if (!$authDriver->passwordsEditable()) {
$editPass = "0";
}
print "<edit_options edit_pass=\"" . $editPass . "\" edit_admin_right=\"" . ($userId != "guest" && $userId != $loggedUser->getId() ? "1" : "0") . "\" edit_delete=\"" . ($userId != "guest" && $userId != $loggedUser->getId() && $authDriver->usersEditable() ? "1" : "0") . "\"/>";
AJXP_XMLWriter::close("admin_data");
exit(1);
break;
case "create_user":
if (!isset($_GET["new_user_login"]) || $_GET["new_user_login"] == "" || !isset($_GET["new_user_pwd"]) || $_GET["new_user_pwd"] == "") {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, "Wrong Arguments!");
AJXP_XMLWriter::close();
//.........这里部分代码省略.........
示例7: replaceAjxpXmlKeywords
/**
* Dynamically replace XML keywords with their live values.
* AJXP_SERVER_ACCESS, AJXP_MIMES_*,AJXP_ALL_MESSAGES, etc.
* @static
* @param string $xml
* @param bool $stripSpaces
* @return mixed
*/
public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
{
$messages = ConfService::getMessages();
$confMessages = ConfService::getMessagesConf();
$matches = array();
if (isset($_SESSION["AJXP_SERVER_PREFIX_URI"])) {
//$xml = str_replace("AJXP_THEME_FOLDER", $_SESSION["AJXP_SERVER_PREFIX_URI"].AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", $_SESSION["AJXP_SERVER_PREFIX_URI"] . AJXP_SERVER_ACCESS, $xml);
} else {
//$xml = str_replace("AJXP_THEME_FOLDER", AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", AJXP_SERVER_ACCESS, $xml);
}
$xml = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $xml);
$xml = str_replace("AJXP_MIMES_EDITABLE", AJXP_Utils::getAjxpMimes("editable"), $xml);
$xml = str_replace("AJXP_MIMES_IMAGE", AJXP_Utils::getAjxpMimes("image"), $xml);
$xml = str_replace("AJXP_MIMES_AUDIO", AJXP_Utils::getAjxpMimes("audio"), $xml);
$xml = str_replace("AJXP_MIMES_ZIP", AJXP_Utils::getAjxpMimes("zip"), $xml);
$authDriver = ConfService::getAuthDriverImpl();
if ($authDriver != NULL) {
$loginRedirect = $authDriver->getLoginRedirect();
$xml = str_replace("AJXP_LOGIN_REDIRECT", $loginRedirect !== false ? "'" . $loginRedirect . "'" : "false", $xml);
}
$xml = str_replace("AJXP_REMOTE_AUTH", "false", $xml);
$xml = str_replace("AJXP_NOT_REMOTE_AUTH", "true", $xml);
$xml = str_replace("AJXP_ALL_MESSAGES", "MessageHash=" . json_encode(ConfService::getMessages()) . ";", $xml);
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
$xml = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $xml);
}
}
if (preg_match_all("/CONF_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("CONF_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if (preg_match_all("/MIXIN_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("MIXIN_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if ($stripSpaces) {
$xml = preg_replace("/[\n\r]?/", "", $xml);
$xml = preg_replace("/\t/", " ", $xml);
}
$xml = str_replace(array('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"'), "", $xml);
$tab = array(&$xml);
AJXP_Controller::applyIncludeHook("xml.filter", $tab);
return $xml;
}
示例8: header
ConfService::setLanguage($_COOKIE["AJXP_lang"]);
}
}
//------------------------------------------------------------
// 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();
示例9: die
}
}
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);
$server->setBaseUri($baseURI);
}
if ((AJXP_Sabre_AuthBackendBasic::detectBasicHeader() || ConfService::getCoreConf("WEBDAV_FORCE_BASIC")) && ConfService::getAuthDriverImpl()->getOption("TRANSMIT_CLEAR_PASS")) {
$authBackend = new AJXP_Sabre_AuthBackendBasic($rId);
} else {
$authBackend = new AJXP_Sabre_AuthBackendDigest($rId);
}
$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend, ConfService::getCoreConf("WEBDAV_DIGESTREALM"));
$server->addPlugin($authPlugin);
if (!is_dir(AJXP_DATA_PATH . "/plugins/server.sabredav")) {
mkdir(AJXP_DATA_PATH . "/plugins/server.sabredav", 0755);
$fp = fopen(AJXP_DATA_PATH . "/plugins/server.sabredav/locks", "w");
fwrite($fp, "");
fclose($fp);
}
$lockBackend = new Sabre\DAV\Locks\Backend\File(AJXP_DATA_PATH . "/plugins/server.sabredav/locks");
$lockPlugin = new Sabre\DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);
示例10: replaceAjxpXmlKeywords
static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
{
$messages = ConfService::getMessages();
$matches = array();
$xml = str_replace("AJXP_CLIENT_RESOURCES_FOLDER", CLIENT_RESOURCES_FOLDER, $xml);
if (isset($_SESSION["AJXP_SERVER_PREFIX_URI"])) {
$xml = str_replace("AJXP_THEME_FOLDER", $_SESSION["AJXP_SERVER_PREFIX_URI"] . AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", $_SESSION["AJXP_SERVER_PREFIX_URI"] . SERVER_ACCESS, $xml);
} else {
$xml = str_replace("AJXP_THEME_FOLDER", AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", SERVER_ACCESS, $xml);
}
$xml = str_replace("AJXP_MIMES_EDITABLE", AJXP_Utils::getAjxpMimes("editable"), $xml);
$xml = str_replace("AJXP_MIMES_IMAGE", AJXP_Utils::getAjxpMimes("image"), $xml);
$xml = str_replace("AJXP_MIMES_AUDIO", AJXP_Utils::getAjxpMimes("audio"), $xml);
$xml = str_replace("AJXP_MIMES_ZIP", AJXP_Utils::getAjxpMimes("zip"), $xml);
$loginRedirect = ConfService::getAuthDriverImpl()->getLoginRedirect();
$xml = str_replace("AJXP_LOGIN_REDIRECT", $loginRedirect !== false ? "'" . $loginRedirect . "'" : "false", $xml);
$xml = str_replace("AJXP_REMOTE_AUTH", "false", $xml);
$xml = str_replace("AJXP_NOT_REMOTE_AUTH", "true", $xml);
$xml = str_replace("AJXP_ALL_MESSAGES", "MessageHash=" . json_encode(ConfService::getMessages()) . ";", $xml);
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
$xml = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $xml);
}
}
if ($stripSpaces) {
$xml = preg_replace("/[\n\r]?/", "", $xml);
$xml = preg_replace("/\t/", " ", $xml);
}
return $xml;
}
示例11: switchAction
//.........这里部分代码省略.........
foreach ($actions as $action) {
if ($action == "") {
continue;
}
$role->setSpecificActionRight("ajxp.all", $action, false);
}
AuthService::updateRole($role);
AJXP_XMLWriter::header("admin_data");
print AJXP_XMLWriter::writeRoleRepositoriesData($role);
AJXP_XMLWriter::close("admin_data");
break;
case "edit_user":
$confStorage = ConfService::getConfStorageImpl();
$userId = $httpVars["user_id"];
$userObject = $confStorage->createUserObject($userId);
//print_r($userObject);
AJXP_XMLWriter::header("admin_data");
AJXP_XMLWriter::sendUserData($userObject, true);
// Add WALLET DATA : DEFINITIONS AND VALUES
print "<drivers>";
print ConfService::availableDriversToXML("user_param");
print "</drivers>";
$wallet = $userObject->getPref("AJXP_WALLET");
if (is_array($wallet) && count($wallet) > 0) {
print "<user_wallet>";
foreach ($wallet as $repoId => $options) {
foreach ($options as $optName => $optValue) {
print "<wallet_data repo_id=\"{$repoId}\" option_name=\"{$optName}\" option_value=\"{$optValue}\"/>";
}
}
print "</user_wallet>";
}
$editPass = $userId != "guest" ? "1" : "0";
$authDriver = ConfService::getAuthDriverImpl();
if (!$authDriver->passwordsEditable()) {
$editPass = "0";
}
print "<edit_options edit_pass=\"" . $editPass . "\" edit_admin_right=\"" . ($userId != "guest" && $userId != $loggedUser->getId() ? "1" : "0") . "\" edit_delete=\"" . ($userId != "guest" && $userId != $loggedUser->getId() && $authDriver->usersEditable() ? "1" : "0") . "\"/>";
print "<ajxp_roles>";
foreach (AuthService::getRolesList() as $roleId => $roleObject) {
print "<role id=\"{$roleId}\"/>";
}
print "</ajxp_roles>";
AJXP_XMLWriter::close("admin_data");
exit(1);
break;
case "create_user":
if (!isset($httpVars["new_user_login"]) || $httpVars["new_user_login"] == "" || !isset($httpVars["new_user_pwd"]) || $httpVars["new_user_pwd"] == "") {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]);
AJXP_XMLWriter::close();
exit(1);
}
$forbidden = array("guest", "share");
if (AuthService::userExists($httpVars["new_user_login"]) || in_array($httpVars["new_user_login"], $forbidden)) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.43"]);
AJXP_XMLWriter::close();
exit(1);
}
if (get_magic_quotes_gpc()) {
$httpVars["new_user_login"] = stripslashes($httpVars["new_user_login"]);
}
$httpVars["new_user_login"] = str_replace("'", "", $httpVars["new_user_login"]);
$confStorage = ConfService::getConfStorageImpl();
$newUser = $confStorage->createUserObject($httpVars["new_user_login"]);
示例12: createSharedRepository
//.........这里部分代码省略.........
$label = AJXP_Utils::decodeSecureMagic($httpVars["repo_label"]);
$rights = $httpVars["repo_rights"];
if ($rights != "r" && $rights != "w" && $rights != "rw") {
return 100;
}
if (isset($httpVars["repository_id"])) {
$editingRepo = ConfService::getRepositoryById($httpVars["repository_id"]);
}
// CHECK USER & REPO DOES NOT ALREADY EXISTS
$repos = ConfService::getRepositoriesList();
foreach ($repos as $obj) {
if ($obj->getDisplay() == $label && (!isset($editingRepo) || $editingRepo != $obj)) {
return 101;
}
}
$confDriver = ConfService::getConfStorageImpl();
foreach ($users as $userName) {
if (AuthService::userExists($userName)) {
// check that it's a child user
$userObject = $confDriver->createUserObject($userName);
if (ConfService::getCoreConf("ALLOW_CROSSUSERS_SHARING") != true && (!$userObject->hasParent() || $userObject->getParent() != $loggedUser->id)) {
return 102;
}
} else {
if (AuthService::isReservedUserId($userName)) {
return 102;
}
if (!isset($httpVars["shared_pass"]) || $httpVars["shared_pass"] == "") {
return 100;
}
}
}
// CREATE SHARED OPTIONS
$options = $accessDriver->makeSharedRepositoryOptions($httpVars, $repository);
$customData = array();
foreach ($httpVars as $key => $value) {
if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
$customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
}
}
if (count($customData)) {
$options["PLUGINS_DATA"] = $customData;
}
if (isset($editingRepo)) {
$newRepo = $editingRepo;
$newRepo->setDisplay($label);
$newRepo->options = array_merge($newRepo->options, $options);
ConfService::replaceRepository($httpVars["repository_id"], $newRepo);
} else {
if ($repository->getOption("META_SOURCES")) {
$options["META_SOURCES"] = $repository->getOption("META_SOURCES");
foreach ($options["META_SOURCES"] as $index => $data) {
if (isset($data["USE_SESSION_CREDENTIALS"]) && $data["USE_SESSION_CREDENTIALS"] === true) {
$options["META_SOURCES"][$index]["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
}
}
}
$newRepo = $repository->createSharedChild($label, $options, $repository->id, $loggedUser->id, null);
ConfService::addRepository($newRepo);
}
if (isset($httpVars["original_users"])) {
$originalUsers = explode(",", $httpVars["original_users"]);
$removeUsers = array_diff($originalUsers, $users);
if (count($removeUsers)) {
foreach ($removeUsers as $user) {
if (AuthService::userExists($user)) {
$userObject = $confDriver->createUserObject($user);
$userObject->removeRights($newRepo->getUniqueId());
$userObject->save("superuser");
}
}
}
}
foreach ($users as $userName) {
if (AuthService::userExists($userName)) {
// check that it's a child user
$userObject = $confDriver->createUserObject($userName);
} else {
if (ConfService::getAuthDriverImpl()->getOption("TRANSMIT_CLEAR_PASS")) {
$pass = $httpVars["shared_pass"];
} else {
$pass = md5($httpVars["shared_pass"]);
}
AuthService::createUser($userName, $pass);
$userObject = $confDriver->createUserObject($userName);
$userObject->clearRights();
$userObject->setParent($loggedUser->id);
}
// CREATE USER WITH NEW REPO RIGHTS
$userObject->setRight($newRepo->getUniqueId(), $rights);
$userObject->setSpecificActionRight($newRepo->getUniqueId(), "share", false);
$userObject->save("superuser");
}
// METADATA
if (!isset($editingRepo) && $this->metaStore != null) {
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$this->metaStore->setMetadata(new AJXP_Node($this->urlBase . $file), "ajxp_shared", array("element" => $newRepo->getUniqueId()), true, AJXP_METADATA_SCOPE_REPOSITORY);
}
return 200;
}
示例13: deleteUser
/**
* Static function for deleting a user
*
* @param String $userId
* @param Array $deletedSubUsers
*/
static function deleteUser($userId, &$deletedSubUsers)
{
$storage = ConfService::getConfStorageImpl();
$serialDir = AJXP_VarsFilter::filter($storage->getOption("USERS_DIRPATH"));
$files = glob($serialDir . "/" . $userId . "/*.ser");
if (is_array($files) && count($files)) {
foreach ($files as $file) {
unlink($file);
}
}
if (is_dir($serialDir . "/" . $userId)) {
rmdir($serialDir . "/" . $userId);
}
$authDriver = ConfService::getAuthDriverImpl();
$confDriver = ConfService::getConfStorageImpl();
$users = $authDriver->listUsers();
foreach (array_keys($users) as $id) {
$object = $confDriver->createUserObject($id);
if ($object->hasParent() && $object->getParent() == $userId) {
AJXP_User::deleteUser($id, $deletedSubUsers);
$deletedSubUsers[] = $id;
}
}
}
示例14: listUsersIds
protected function listUsersIds($baseGroup = "/")
{
$authDriver = ConfService::getAuthDriverImpl();
$pairs = $authDriver->listUsers($baseGroup);
return array_keys($pairs);
}
示例15: computeBootConf
public function computeBootConf()
{
if (isset($_GET["server_prefix_uri"])) {
$_SESSION["AJXP_SERVER_PREFIX_URI"] = str_replace("_UP_", "..", $_GET["server_prefix_uri"]);
}
$currentIsMinisite = strpos(session_name(), "AjaXplorer_Shared") === 0;
$config = array();
$config["ajxpResourcesFolder"] = "plugins/gui.ajax/res";
if ($currentIsMinisite) {
$config["ajxpServerAccess"] = "index_shared.php";
} else {
$config["ajxpServerAccess"] = AJXP_SERVER_ACCESS;
}
$config["zipEnabled"] = ConfService::zipBrowsingEnabled();
$config["multipleFilesDownloadEnabled"] = ConfService::zipCreationEnabled();
$customIcon = $this->getFilteredOption("CUSTOM_ICON");
self::filterXml($customIcon);
$config["customWording"] = array("welcomeMessage" => $this->getFilteredOption("CUSTOM_WELCOME_MESSAGE"), "title" => ConfService::getCoreConf("APPLICATION_TITLE"), "icon" => $customIcon, "iconWidth" => $this->getFilteredOption("CUSTOM_ICON_WIDTH"), "iconHeight" => $this->getFilteredOption("CUSTOM_ICON_HEIGHT"), "iconOnly" => $this->getFilteredOption("CUSTOM_ICON_ONLY"), "titleFontSize" => $this->getFilteredOption("CUSTOM_FONT_SIZE"));
$cIcBin = $this->getFilteredOption("CUSTOM_ICON_BINARY");
if (!empty($cIcBin)) {
$config["customWording"]["icon_binary_url"] = "get_action=get_global_binary_param&binary_id=" . $cIcBin;
}
$config["usersEnabled"] = AuthService::usersEnabled();
$config["loggedUser"] = AuthService::getLoggedUser() != null;
$config["currentLanguage"] = ConfService::getLanguage();
$config["session_timeout"] = intval(ini_get("session.gc_maxlifetime"));
$timeoutTime = $this->getFilteredOption("CLIENT_TIMEOUT_TIME");
if (empty($timeoutTime)) {
$to = $config["session_timeout"];
} else {
$to = $timeoutTime;
}
if ($currentIsMinisite) {
$to = -1;
}
$config["client_timeout"] = intval($to);
$config["client_timeout_warning"] = floatval($this->getFilteredOption("CLIENT_TIMEOUT_WARN"));
$config["availableLanguages"] = ConfService::getConf("AVAILABLE_LANG");
$config["usersEditable"] = ConfService::getAuthDriverImpl()->usersEditable();
$config["ajxpVersion"] = AJXP_VERSION;
$config["ajxpVersionDate"] = AJXP_VERSION_DATE;
$analytic = $this->getFilteredOption('GOOGLE_ANALYTICS_ID');
if (!empty($analytic)) {
$config["googleAnalyticsData"] = array("id" => $analytic, "domain" => $this->getFilteredOption('GOOGLE_ANALYTICS_DOMAIN'), "event" => $this->getFilteredOption('GOOGLE_ANALYTICS_EVENT'));
}
$config["i18nMessages"] = ConfService::getMessages();
$config["SECURE_TOKEN"] = AuthService::generateSecureToken();
$config["streaming_supported"] = "true";
$config["theme"] = $this->pluginConf["GUI_THEME"];
return $config;
}