本文整理汇总了PHP中AJXP_XMLWriter::sendUserData方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::sendUserData方法的具体用法?PHP AJXP_XMLWriter::sendUserData怎么用?PHP AJXP_XMLWriter::sendUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::sendUserData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
//.........这里部分代码省略.........
示例2: switchAction
//.........这里部分代码省略.........
$role = AuthService::getRole($httpVars["role_id"]);
if ($role === false) {
throw new Exception("Cannot find role!");
}
$role->setDefault($httpVars["default_value"] == "true");
AuthService::updateRole($role);
AJXP_XMLWriter::header("admin_data");
print AJXP_XMLWriter::writeRoleRepositoriesData($role);
AJXP_XMLWriter::close("admin_data");
break;
case "get_custom_params":
$confStorage = ConfService::getConfStorageImpl();
AJXP_XMLWriter::header("admin_data");
$confDriver = ConfService::getConfStorageImpl();
$customData = $confDriver->options['CUSTOM_DATA'];
if (is_array($customData) && count($customData) > 0) {
print "<custom_data>";
foreach ($customData as $custName => $custValue) {
print "<param name=\"{$custName}\" type=\"string\" label=\"{$custValue}\" description=\"\" value=\"\"/>";
}
print "</custom_data>";
}
AJXP_XMLWriter::close("admin_data");
break;
case "edit_user":
$confStorage = ConfService::getConfStorageImpl();
$userId = $httpVars["user_id"];
if (!AuthService::userExists($userId)) {
throw new Exception("Invalid user id!");
}
$userObject = $confStorage->createUserObject($userId);
//print_r($userObject);
AJXP_XMLWriter::header("admin_data");
AJXP_XMLWriter::sendUserData($userObject, true);
// Add CUSTOM USER DATA
$confDriver = ConfService::getConfStorageImpl();
$customData = $confDriver->options['CUSTOM_DATA'];
if (is_array($customData) && count($customData) > 0) {
$userCustom = $userObject->getPref("CUSTOM_PARAMS");
print "<custom_data>";
foreach ($customData as $custName => $custValue) {
$value = isset($userCustom[$custName]) ? $userCustom[$custName] : '';
print "<param name=\"{$custName}\" type=\"string\" label=\"{$custValue}\" description=\"\" value=\"{$value}\"/>";
}
print "</custom_data>";
}
// Add WALLET DATA : DEFINITIONS AND VALUES
print "<drivers>";
print AJXP_XMLWriter::replaceAjxpXmlKeywords(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") . "\"/>";
示例3: exit
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$currentRepo = ConfService::getRepositoryById(ConfService::getCurrentRootDirIndex());
if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) || $currentRepo->getAccessType() == "ajxp_conf" && ENABLE_USERS && !$loggedUser->isAdmin()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
if ($loggedUser == null) {
$requireAuth = true;
}
if (isset($loggingResult) || isset($_GET["get_action"]) && $_GET["get_action"] == "logged_user") {
AJXP_XMLWriter::header();
if (isset($loggingResult)) {
AJXP_XMLWriter::loggingResult($loggingResult, $rememberLogin, $rememberPass);
}
AJXP_XMLWriter::sendUserData();
AJXP_XMLWriter::close();
exit(1);
}
}
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
if ($loggedUser->getPref("lang") != "") {
ConfService::setLanguage($loggedUser->getPref("lang"));
}
}
$mess = ConfService::getMessages();
foreach ($_GET as $getName => $getValue) {
${$getName} = Utils::securePath($getValue);
}
foreach ($_POST as $getName => $getValue) {
示例4: switchAction
//.........这里部分代码省略.........
AJXP_XMLWriter::close();
//exit(1);
break;
case "update_role_actions":
if (!isset($httpVars["role_id"]) || !isset($httpVars["disabled_actions"])) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]);
AJXP_XMLWriter::close();
return;
}
$role = AuthService::getRole($httpVars["role_id"]);
$actions = array_map("trim", explode(",", $httpVars["disabled_actions"]));
// Clear and reload actions
foreach ($role->getSpecificActionsRights("ajxp.all") as $actName => $actValue) {
$role->setSpecificActionRight("ajxp.all", $actName, true);
}
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"]);