本文整理汇总了PHP中ConfService::getUserPersonalParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getUserPersonalParameter方法的具体用法?PHP ConfService::getUserPersonalParameter怎么用?PHP ConfService::getUserPersonalParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getUserPersonalParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: repositoryToXML
/**
* @param string $repoId
* @param Repository $repoObject
* @param array $exposed
* @param array $streams
* @param AbstractAjxpUser $loggedUser
* @param string $accessStatus
* @return string
* @throws Exception
*/
public static function repositoryToXML($repoId, $repoObject, $exposed, $streams, $loggedUser, $accessStatus = "")
{
$statusString = " repository_type=\"" . $repoObject->getRepositoryType() . "\"";
if (empty($accessStatus)) {
$accessStatus = $repoObject->getAccessStatus();
}
if (!empty($accessStatus)) {
$statusString .= " access_status=\"{$accessStatus}\" ";
} else {
if ($loggedUser != null) {
$lastConnected = $loggedUser->getArrayPref("repository_last_connected", $repoId);
if (!empty($lastConnected)) {
$statusString .= " last_connection=\"{$lastConnected}\" ";
}
}
}
$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
if ($repoObject->hasContentFilter()) {
$streamString .= " hasContentFilter=\"true\"";
}
$slugString = "";
$slug = $repoObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = "";
$currentUserIsOwner = false;
$ownerLabel = null;
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
if (AuthService::usersEnabled() && AuthService::getLoggedUser()->getId() == $uId) {
$currentUserIsOwner = true;
}
$label = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $uId, "core.conf", $uId);
$ownerLabel = $label;
$isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
}
if ($repoObject->securityScope() == "USER" || $currentUserIsOwner) {
$streamString .= " userScope=\"true\"";
}
$descTag = "";
$public = false;
if (!empty($_SESSION["CURRENT_MINISITE"])) {
$public = true;
}
$description = $repoObject->getDescription($public, $ownerLabel);
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$roleString = "";
if ($loggedUser != null) {
$merged = $loggedUser->mergedRole;
$params = array();
foreach ($exposed as $exposed_prop) {
$metaOptions = $repoObject->getOption("META_SOURCES");
if (!isset($metaOptions[$exposed_prop["PLUGIN_ID"]])) {
continue;
}
$value = $exposed_prop["DEFAULT"];
if (isset($metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]])) {
$value = $metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]];
}
$value = $merged->filterParameterValue($exposed_prop["PLUGIN_ID"], $exposed_prop["NAME"], $repoId, $value);
if ($value !== null) {
if ($value === true || $value === false) {
$value = $value === true ? "true" : "false";
}
$params[] = '<repository_plugin_param plugin_id="' . $exposed_prop["PLUGIN_ID"] . '" name="' . $exposed_prop["NAME"] . '" value="' . AJXP_Utils::xmlEntities($value) . '"/>';
$roleString .= str_replace(".", "_", $exposed_prop["PLUGIN_ID"]) . "_" . $exposed_prop["NAME"] . '="' . AJXP_Utils::xmlEntities($value) . '" ';
}
}
$roleString .= 'acl="' . $merged->getAcl($repoId) . '"';
if ($merged->hasMask($repoId)) {
$roleString .= ' hasMask="true" ';
}
}
return "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$statusString} {$streamString} {$slugString} {$isSharedString} {$roleString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
}
示例2: switchAction
//.........这里部分代码省略.........
$users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label='{$crtValue}'><span class='user_entry_label'>{$crtValue} (" . $mess["448"] . ")</span></li>";
} else {
if ($existingOnly && !empty($crtValue)) {
$users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label='{$crtValue}' data-entry_id='{$crtValue}'><span class='user_entry_label'>{$crtValue}</span></li>";
}
}
$mess = ConfService::getMessages();
if ($regexp == null && !$usersOnly) {
$users .= "<li class='complete_group_entry' data-group='AJXP_GRP_/' data-label=\"" . $mess["447"] . "\"><span class='user_entry_label'>" . $mess["447"] . "</span></li>";
}
$indexGroup = 0;
if (!$usersOnly && isset($allGroups) && is_array($allGroups)) {
foreach ($allGroups as $groupId => $groupLabel) {
if ($regexp == null || preg_match("/{$regexp}/i", $groupLabel)) {
$users .= "<li class='complete_group_entry' data-group='{$groupId}' data-label=\"{$groupLabel}\" data-entry_id='{$groupId}'><span class='user_entry_label'>" . $groupLabel . "</span></li>";
$indexGroup++;
}
if ($indexGroup == $limit) {
break;
}
}
}
if ($regexp == null && method_exists($this, "listUserTeams")) {
$teams = $this->listUserTeams();
foreach ($teams as $tId => $tData) {
$users .= "<li class='complete_group_entry' data-group='/AJXP_TEAM/{$tId}' data-label=\"[team] " . $tData["LABEL"] . "\"><span class='user_entry_label'>[team] " . $tData["LABEL"] . "</span></li>";
}
}
foreach ($allUsers as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
if (!$userObject->hasParent() && ConfService::getCoreConf("ALLOW_CROSSUSERS_SHARING", "conf") || $userObject->getParent() == $loggedUser->getId()) {
$userLabel = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $userObject, "core.conf", $userId);
//if($regexp != null && ! (preg_match("/$regexp/i", $userId) || preg_match("/$regexp/i", $userLabel)) ) continue;
$userDisplay = $userLabel == $userId ? $userId : $userLabel . " ({$userId})";
if (ConfService::getCoreConf("USERS_LIST_HIDE_LOGIN", "conf") == true && $userLabel != $userId) {
$userDisplay = $userLabel;
}
$users .= "<li class='complete_user_entry' data-label=\"{$userLabel}\" data-entry_id='{$userId}'><span class='user_entry_label'>" . $userDisplay . "</span></li>";
$index++;
}
if ($index == $limit) {
break;
}
}
if (strlen($users)) {
print "<ul>" . $users . "</ul>";
}
AuthService::setGroupFiltering(true);
break;
case "load_repository_info":
$data = array();
$repo = ConfService::getRepository();
if ($repo != null) {
$users = AuthService::countUsersForRepository(ConfService::getRepository()->getId(), true);
$data["core.users"] = $users;
if (isset($httpVars["collect"]) && $httpVars["collect"] == "true") {
AJXP_Controller::applyHook("repository.load_info", array(&$data));
}
}
HTMLWriter::charsetHeader("application/json");
echo json_encode($data);
break;
case "get_binary_param":
if (isset($httpVars["tmp_file"])) {
示例3: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser * @internal param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
$exposed = array();
$cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']");
if ($cacheHasExposed !== null && is_array($cacheHasExposed)) {
$exposed = $cacheHasExposed;
} else {
$exposed_props = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'repository') and @expose='true']", "node", false, false, true);
foreach ($exposed_props as $exposed_prop) {
$pluginId = $exposed_prop->parentNode->parentNode->getAttribute("id");
$paramName = $exposed_prop->getAttribute("name");
$paramDefault = $exposed_prop->getAttribute("default");
$exposed[] = array("PLUGIN_ID" => $pluginId, "NAME" => $paramName, "DEFAULT" => $paramDefault);
}
AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']", $exposed);
}
$accessible = ConfService::getAccessibleRepositories($loggedUser, false, false);
foreach ($accessible as $repoId => $repoObject) {
$rightString = "";
$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
$slugString = "";
$slug = $repoObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = "";
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
$label = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $uId, "core.conf", $uId);
$isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
}
$descTag = "";
$public = false;
if (!empty($_SESSION["CURRENT_MINISITE"])) {
$public = true;
}
$description = $repoObject->getDescription($public);
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$roleString = "";
if ($loggedUser != null) {
$merged = $loggedUser->mergedRole;
$params = array();
foreach ($exposed as $exposed_prop) {
$metaOptions = $repoObject->getOption("META_SOURCES");
if (!isset($metaOptions[$exposed_prop["PLUGIN_ID"]])) {
continue;
}
$value = $exposed_prop["DEFAULT"];
if (isset($metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]])) {
$value = $metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]];
}
$value = $merged->filterParameterValue($exposed_prop["PLUGIN_ID"], $exposed_prop["NAME"], $repoId, $value);
if ($value !== null) {
if ($value === true || $value === false) {
$value = $value === true ? "true" : "false";
}
$params[] = '<repository_plugin_param plugin_id="' . $exposed_prop["PLUGIN_ID"] . '" name="' . $exposed_prop["NAME"] . '" value="' . AJXP_Utils::xmlEntities($value) . '"/>';
$roleString .= str_replace(".", "_", $exposed_prop["PLUGIN_ID"]) . "_" . $exposed_prop["NAME"] . '="' . AJXP_Utils::xmlEntities($value) . '" ';
}
}
$roleString .= 'acl="' . $merged->getAcl($repoId) . '"';
if ($merged->hasMask($repoId)) {
$roleString .= ' hasMask="true" ';
}
}
$st .= "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString} {$streamString} {$slugString} {$isSharedString} {$roleString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
}
$st .= "</repositories>";
return $st;
}
示例4: listRepositories
public function listRepositories()
{
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.9" attributeName="parent_label" sortType="String"/><column messageId="user_dash.9" attributeName="repo_accesses" sortType="String"/></columns>');
$repoArray = array();
$loggedUser = AuthService::getLoggedUser();
$count = 0;
$repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => $loggedUser->getId()), $count);
$searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($searchAll || $displayAll) {
$baseGroup = "/";
} else {
$baseGroup = AuthService::filterBaseGroup("/");
}
AuthService::setGroupFiltering(false);
$users = AuthService::listUsers($baseGroup);
$minisites = $this->listSharedFiles("minisites");
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
continue;
}
if (is_numeric($repoIndex)) {
$repoIndex = "" . $repoIndex;
}
$name = (isset($minisites[$repoIndex]) ? "[Minisite] " : "") . AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
$repoArray[$name] = $repoIndex;
}
// Sort the list now by name
ksort($repoArray);
foreach ($repoArray as $name => $repoIndex) {
$repoObject =& $repos[$repoIndex];
$repoAccesses = array();
foreach ($users as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
$label = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $userObject, "core.conf", $userId);
$acl = $userObject->mergedRole->getAcl($repoObject->getId());
if (!empty($acl)) {
$repoAccesses[] = $label . " (" . $acl . ")";
}
}
$parent = $repoObject->getParentId();
$parentRepo =& $repos[$parent];
$parentLabel = $this->metaIcon("folder-open") . $parentRepo->getDisplay();
$repoPath = $repoObject->getOption("PATH");
$parentPath = $parentRepo->getOption("PATH");
$parentLabel .= " (" . str_replace($parentPath, "", $repoPath) . ")";
$metaData = array("repository_id" => $repoIndex, "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "parent_label" => $parentLabel, "repo_accesses" => count($repoAccesses) ? $this->metaIcon("share-sign") . implode(", ", $repoAccesses) : "", "ajxp_mime" => "shared_repository");
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例5: listUsers
//.........这里部分代码省略.........
$nodeKey = "/data/" . $root . "/";
$meta = array("icon" => "users-folder.png", "icon_class" => "icon-home", "ajxp_mime" => "group", "object_id" => "/");
$mess = ConfService::getMessages();
$xml = AJXP_XMLWriter::renderNode($nodeKey, $mess["ajxp_conf.151"], true, $meta, true, false);
if (!$returnNodes) {
print $xml;
} else {
$allNodes[$nodeKey] = $xml;
}
}
foreach ($groups as $groupId => $groupLabel) {
$nodeKey = "/data/" . $root . "/" . ltrim($groupId, "/");
$meta = array("icon" => "users-folder.png", "icon_class" => "icon-folder-close", "ajxp_mime" => "group", "object_id" => $groupId);
if (in_array($nodeKey, $this->currentBookmarks)) {
$meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
}
$xml = AJXP_XMLWriter::renderNode($nodeKey, $groupLabel, false, $meta, true, false);
if (!$returnNodes) {
print $xml;
} else {
$allNodes[$nodeKey] = $xml;
}
}
$mess = ConfService::getMessages();
$loggedUser = AuthService::getLoggedUser();
$userArray = array();
$logger = AJXP_Logger::getInstance();
if (method_exists($logger, "usersLastConnection")) {
$allUserIds = array();
}
foreach ($users as $userObject) {
$label = $userObject->getId();
if (isset($allUserIds)) {
$allUserIds[] = $label;
}
if ($userObject->hasParent()) {
$label = $userObject->getParent() . "000" . $label;
} else {
$children = ConfService::getConfStorageImpl()->getUserChildren($label);
foreach ($children as $addChild) {
$userArray[$label . "000" . $addChild->getId()] = $addChild;
}
}
$userArray[$label] = $userObject;
}
if (isset($allUserIds) && count($allUserIds)) {
$connections = $logger->usersLastConnection($allUserIds);
}
ksort($userArray);
foreach ($userArray as $userObject) {
$repos = ConfService::getConfStorageImpl()->listRepositories($userObject);
$isAdmin = $userObject->isAdmin();
$userId = $userObject->getId();
$icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
$iconClass = "icon-user";
if ($userObject->hasParent()) {
$icon = "user_child";
$iconClass = "icon-angle-right";
}
if ($isAdmin) {
$rightsString = $mess["ajxp_conf.63"];
} else {
$r = array();
foreach ($repos as $repoId => $repository) {
if ($repository->getAccessType() == "ajxp_shared") {
continue;
}
if (!$userObject->canRead($repoId) && !$userObject->canWrite($repoId)) {
continue;
}
$rs = $userObject->canRead($repoId) ? "r" : "";
$rs .= $userObject->canWrite($repoId) ? "w" : "";
$r[] = $repository->getDisplay() . " (" . $rs . ")";
}
$rightsString = implode(", ", $r);
}
$nodeLabel = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $userObject, "core.conf", $userId);
$scheme = AuthService::getAuthScheme($userId);
$nodeKey = "/data/{$root}/" . $userId;
$roles = array_filter(array_keys($userObject->getRoles()), array($this, "filterReservedRoles"));
$meta = array("isAdmin" => $mess[$isAdmin ? "ajxp_conf.14" : "ajxp_conf.15"], "icon" => $icon . ".png", "icon_class" => $iconClass, "object_id" => $userId, "auth_scheme" => $scheme != null ? $scheme : "", "rights_summary" => $rightsString, "ajxp_roles" => implode(", ", $roles), "ajxp_mime" => "user" . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : ""), "json_merged_role" => json_encode($userObject->mergedRole->getDataArray(true)));
if ($userObject->hasParent()) {
$meta["shared_user"] = "true";
}
if (isset($connections) && isset($connections[$userObject->getId()]) && !empty($connections[$userObject->getId()])) {
$meta["last_connection"] = strtotime($connections[$userObject->getId()]);
$meta["last_connection_readable"] = AJXP_Utils::relativeDate($meta["last_connection"], $mess);
}
if (in_array($nodeKey, $this->currentBookmarks)) {
$meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
}
$xml = AJXP_XMLWriter::renderNode($nodeKey, $nodeLabel, true, $meta, true, false);
if (!$returnNodes) {
print $xml;
} else {
$allNodes[$nodeKey] = $xml;
}
}
return $allNodes;
}