本文整理汇总了PHP中ConfService::availableDriversToXML方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::availableDriversToXML方法的具体用法?PHP ConfService::availableDriversToXML怎么用?PHP ConfService::availableDriversToXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::availableDriversToXML方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
//.........这里部分代码省略.........
throw new Exception($mess["ajxp_conf.61"]);
}
$userId = AJXP_Utils::sanitize($httpVars["user_id"], AJXP_SANITIZE_EMAILCHARS);
if ($userId == $loggedUser->getId()) {
$userObject = $loggedUser;
} else {
$confStorage = ConfService::getConfStorageImpl();
$userObject = $confStorage->createUserObject($userId);
}
if (!AuthService::canAdministrate($userObject)) {
throw new Exception("Cannot update user data for " . $userId);
}
$i = 0;
while (isset($httpVars["pref_name_" . $i]) && isset($httpVars["pref_value_" . $i])) {
$prefName = AJXP_Utils::sanitize($httpVars["pref_name_" . $i], AJXP_SANITIZE_ALPHANUM);
$prefValue = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["pref_value_" . $i]));
if ($prefName == "password") {
continue;
}
if ($prefName != "pending_folder" && $userObject == null) {
$i++;
continue;
}
$userObject->setPref($prefName, $prefValue);
$userObject->save("user");
$i++;
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage("Succesfully saved user preference", null);
AJXP_XMLWriter::close();
break;
case "get_drivers_definition":
AJXP_XMLWriter::header("drivers", array("allowed" => $currentUserIsGroupAdmin ? "false" : "true"));
print AJXP_XMLWriter::replaceAjxpXmlKeywords(ConfService::availableDriversToXML("param", "", true));
AJXP_XMLWriter::close("drivers");
break;
case "get_templates_definition":
AJXP_XMLWriter::header("repository_templates");
$count = 0;
$repositories = ConfService::listRepositoriesWithCriteria(array("isTemplate" => '1'), $count);
foreach ($repositories as $repo) {
if (!$repo->isTemplate) {
continue;
}
$repoId = $repo->getUniqueId();
$repoLabel = SystemTextEncoding::toUTF8($repo->getDisplay());
$repoType = $repo->getAccessType();
print "<template repository_id=\"{$repoId}\" repository_label=\"{$repoLabel}\" repository_type=\"{$repoType}\">";
foreach ($repo->getOptionsDefined() as $optionName) {
print "<option name=\"{$optionName}\"/>";
}
print "</template>";
}
AJXP_XMLWriter::close("repository_templates");
break;
case "create_repository":
$repDef = $httpVars;
$isTemplate = isset($httpVars["sf_checkboxes_active"]);
unset($repDef["get_action"]);
unset($repDef["sf_checkboxes_active"]);
if (isset($httpVars["json_data"])) {
$repDef = json_decode(SystemTextEncoding::magicDequote($httpVars["json_data"]), true);
$options = $repDef["DRIVER_OPTIONS"];
} else {
$options = array();
$this->parseParameters($repDef, $options, null, true);
示例3: getMessages
function getMessages()
{
global $G_MESSAGES, $G_LANGUE;
if (!isset($G_MESSAGES)) {
require INSTALL_PATH . "/" . CLIENT_RESOURCES_FOLDER . "/i18n/{$G_LANGUE}.php";
$G_MESSAGES = $mess;
$xml = ConfService::availableDriversToXML("i18n");
$results = array();
preg_match_all("<i18n [^\\>]*\\/>", $xml, $results);
$libs = array();
//print_r($xml);
if (isset($results[0]) && count($results[0])) {
foreach ($results[0] as $found) {
$parts = explode(" ", $found);
$nameSpace = "";
$path = "";
foreach ($parts as $attPart) {
if (strstr($attPart, "=") === false) {
continue;
}
$split = explode("=", $attPart);
$attName = $split[0];
$attValue = substr($split[1], 1, strlen($split[1]) - 2);
if ($attName == "namespace") {
$nameSpace = $attValue;
} else {
if ($attName == "path") {
$path = $attValue;
}
}
}
$libs[$nameSpace] = $path;
}
}
//print_r($libs);
foreach ($libs as $nameSpace => $path) {
$lang = $G_LANGUE;
if (!is_file($path . "/" . $G_LANGUE . ".php")) {
$lang = "en";
// Default language, minimum required.
}
if (is_file($path . "/" . $lang . ".php")) {
require $path . "/" . $lang . ".php";
foreach ($mess as $key => $message) {
$G_MESSAGES[$nameSpace . "." . $key] = $message;
}
}
}
}
return $G_MESSAGES;
}
示例4: switchAction
//.........这里部分代码省略.........
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") . "\"/>";
print "<ajxp_roles>";
foreach (AuthService::getRolesList() as $roleId => $roleObject) {
print "<role id=\"" . AJXP_Utils::xmlEntities($roleId) . "\"/>";
}
print "</ajxp_roles>";
AJXP_XMLWriter::close("admin_data");
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();
return;
}
$new_user_login = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["new_user_login"]), AJXP_SANITIZE_EMAILCHARS);
示例5: switchAction
//.........这里部分代码省略.........
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"]);
AJXP_XMLWriter::close();
exit(1);
}