本文整理汇总了PHP中ConfService::getRootDirsList方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getRootDirsList方法的具体用法?PHP ConfService::getRootDirsList怎么用?PHP ConfService::getRootDirsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getRootDirsList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
//.........这里部分代码省略.........
$this->parseParameters($repDef, $options);
if (count($options)) {
$repDef["DRIVER_OPTIONS"] = $options;
}
// NOW SAVE THIS REPOSITORY!
$newRep = ConfService::createRepositoryFromArray(0, $repDef);
if (is_file(INSTALL_PATH . "/server/tests/plugins/test.ajxp_" . $newRep->getAccessType() . ".php")) {
chdir(INSTALL_PATH . "/server/tests/plugins");
include INSTALL_PATH . "/server/tests/plugins/test.ajxp_" . $newRep->getAccessType() . ".php";
$className = "ajxp_" . $newRep->getAccessType();
$class = new $className();
$result = $class->doRepositoryTest($newRep);
if (!$result) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $class->failedInfo);
AJXP_XMLWriter::close();
exit(1);
}
}
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, "The conf directory is not writeable");
} else {
AJXP_XMLWriter::sendMessage("Successfully created repository", null);
AJXP_XMLWriter::reloadFileList($newRep->getDisplay());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
exit(1);
break;
case "edit_repository":
$repId = $httpVars["repository_id"];
$repList = ConfService::getRootDirsList();
//print_r($repList);
AJXP_XMLWriter::header("admin_data");
if (!isset($repList[$repId])) {
AJXP_XMLWriter::close("admin_data");
exit(1);
}
$repository = $repList[$repId];
$nested = array();
print "<repository index=\"{$repId}\"";
foreach ($repository as $name => $option) {
if (!is_array($option)) {
if (is_bool($option)) {
$option = $option ? "true" : "false";
}
print " {$name}=\"" . SystemTextEncoding::toUTF8(Utils::xmlEntities($option)) . "\" ";
} else {
if (is_array($option)) {
$nested[] = $option;
}
}
}
if (count($nested)) {
print ">";
foreach ($nested as $option) {
foreach ($option as $key => $optValue) {
if (is_bool($optValue)) {
$optValue = $optValue ? "true" : "false";
}
print "<param name=\"{$key}\" value=\"{$optValue}\"/>";
}
}
print "</repository>";
示例2: updateAdminRights
/**
* Update a user with admin rights and return it
* @param AJXP_User $adminUser
* @return AJXP_User
*/
static function updateAdminRights($adminUser)
{
foreach (array_keys(ConfService::getRootDirsList()) as $rootDirIndex) {
$adminUser->setRight($rootDirIndex, "rw");
}
$adminUser->save();
return $adminUser;
}
示例3: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$xmlBuffer = "";
foreach ($httpVars as $getName => $getValue) {
${$getName} = Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// SWITCH THE ROOT REPOSITORY
//------------------------------------
case "switch_root_dir":
if (!isset($root_dir_index)) {
break;
}
$dirList = ConfService::getRootDirsList();
if (!isset($dirList[$root_dir_index])) {
$errorMessage = "Trying to switch to an unkown folder!";
break;
}
ConfService::switchRootDir($root_dir_index);
$logMessage = "Successfully Switched!";
AJXP_Logger::logAction("Switch Repository", array("rep. id" => $root_dir_index));
break;
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
case "get_template":
header("Content-type:text/html; charset:UTF-8");
if (isset($template_name) && is_file(CLIENT_RESOURCES_FOLDER . "/html/" . $template_name)) {
if ($template_name == "gui_tpl.html") {
include CLIENT_RESOURCES_FOLDER . "/html/usertemplate_top.html";
}
include CLIENT_RESOURCES_FOLDER . "/html/" . $template_name;
if ($template_name == "gui_tpl.html") {
include CLIENT_RESOURCES_FOLDER . "/html/usertemplate_bottom.html";
}
}
exit(0);
break;
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
case "get_i18n_messages":
header("Content-type:text/javascript");
HTMLWriter::writeI18nMessagesClass(ConfService::getMessages());
exit(0);
break;
//------------------------------------
// BOOKMARK BAR
//------------------------------------
//------------------------------------
// BOOKMARK BAR
//------------------------------------
case "get_bookmarks":
$bmUser = null;
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser = AuthService::getLoggedUser();
} else {
if (!AuthService::usersEnabled()) {
$confStorage = ConfService::getConfStorageImpl();
$bmUser = $confStorage->createUserObject("shared");
}
}
if ($bmUser == null) {
exit(1);
}
if (isset($_GET["bm_action"]) && isset($_GET["bm_path"])) {
if ($_GET["bm_action"] == "add_bookmark") {
$title = "";
if (isset($_GET["title"])) {
$title = $_GET["title"];
}
if ($title == "" && $_GET["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark($_GET["bm_path"], $title);
} else {
if ($_GET["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($_GET["bm_path"]);
} else {
if ($_GET["bm_action"] == "rename_bookmark" && isset($_GET["bm_title"])) {
$bmUser->renameBookmark($_GET["bm_path"], $_GET["bm_title"]);
}
}
}
}
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
//.........这里部分代码省略.........
示例4: switchAction
//.........这里部分代码省略.........
}
$metaSourceOptions[$metaID] = $defaultParams;
}
$newRep->addOption("META_SOURCES", $metaSourceOptions);
}
}
}
if ($this->repositoryExists($newRep->getDisplay())) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.50"]);
AJXP_XMLWriter::close();
return;
}
if ($isTemplate) {
$newRep->isTemplate = true;
}
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.51"]);
} else {
$loggedUser = AuthService::getLoggedUser();
$loggedUser->setRight($newRep->getUniqueId(), "rw");
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess["ajxp_conf.52"], null);
AJXP_XMLWriter::reloadDataNode("", $newRep->getUniqueId());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
case "edit_repository":
$repId = $httpVars["repository_id"];
$repList = ConfService::getRootDirsList();
//print_r($repList);
if (!isset($repList[$repId])) {
throw new Exception("Cannot find repository with id {$repId}");
}
$repository = $repList[$repId];
$pServ = AJXP_PluginsService::getInstance();
$plug = $pServ->getPluginById("access." . $repository->accessType);
if ($plug == null) {
throw new Exception("Cannot find access driver (" . $repository->accessType . ") for repository!");
}
AJXP_XMLWriter::header("admin_data");
$slug = $repository->getSlug();
if ($slug == "" && $repository->isWriteable()) {
$repository->setSlug();
ConfService::replaceRepository($repId, $repository);
}
$nested = array();
print "<repository index=\"{$repId}\"";
foreach ($repository as $name => $option) {
if (strstr($name, " ") > -1) {
continue;
}
if (!is_array($option)) {
if (is_bool($option)) {
$option = $option ? "true" : "false";
}
print " {$name}=\"" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($option)) . "\" ";
} else {
if (is_array($option)) {
$nested[] = $option;
}
}
示例5: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$xmlBuffer = "";
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// SWITCH THE ROOT REPOSITORY
//------------------------------------
case "switch_repository":
if (!isset($repository_id)) {
break;
}
$dirList = ConfService::getRootDirsList();
if (!isset($dirList[$repository_id])) {
$errorMessage = "Trying to switch to an unkown repository!";
break;
}
ConfService::switchRootDir($repository_id);
// Load try to init the driver now, to trigger an exception
// if it's not loading right.
ConfService::loadRepositoryDriver();
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$user = AuthService::getLoggedUser();
$activeRepId = ConfService::getCurrentRootDirIndex();
$user->setArrayPref("history", "last_repository", $activeRepId);
$user->save();
}
//$logMessage = "Successfully Switched!";
AJXP_Logger::logAction("Switch Repository", array("rep. id" => $repository_id));
break;
//------------------------------------
// BOOKMARK BAR
//------------------------------------
//------------------------------------
// BOOKMARK BAR
//------------------------------------
case "get_bookmarks":
$bmUser = null;
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser = AuthService::getLoggedUser();
} else {
if (!AuthService::usersEnabled()) {
$confStorage = ConfService::getConfStorageImpl();
$bmUser = $confStorage->createUserObject("shared");
}
}
if ($bmUser == null) {
exit(1);
}
if (isset($_GET["bm_action"]) && isset($_GET["bm_path"])) {
if ($_GET["bm_action"] == "add_bookmark") {
$title = "";
if (isset($_GET["bm_title"])) {
$title = $_GET["bm_title"];
}
if ($title == "" && $_GET["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark(SystemTextEncoding::magicDequote($_GET["bm_path"]), SystemTextEncoding::magicDequote($title));
} else {
if ($_GET["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($_GET["bm_path"]);
} else {
if ($_GET["bm_action"] == "rename_bookmark" && isset($_GET["bm_title"])) {
$bmUser->renameBookmark($_GET["bm_path"], $_GET["bm_title"]);
}
}
}
}
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser->save();
AuthService::updateUser($bmUser);
} else {
if (!AuthService::usersEnabled()) {
$bmUser->save();
}
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::writeBookmarks($bmUser->getBookmarks());
AJXP_XMLWriter::close();
exit(1);
break;
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
case "save_user_pref":
$userObject = AuthService::getLoggedUser();
$i = 0;
//.........这里部分代码省略.........
示例6: switchAction
//.........这里部分代码省略.........
$result = $class->doRepositoryTest($newRep);
if (!$result) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $class->failedInfo);
AJXP_XMLWriter::close();
exit(1);
}
}
if ($this->repositoryExists($newRep->getDisplay())) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.50"]);
AJXP_XMLWriter::close();
exit(1);
}
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.51"]);
} else {
$confStorage = ConfService::getConfStorageImpl();
$loggedUser = AuthService::getLoggedUser();
$loggedUser->setRight($newRep->getUniqueId(), "rw");
$loggedUser->save();
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess["ajxp_conf.52"], null);
AJXP_XMLWriter::reloadFileList($newRep->getDisplay());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
exit(1);
break;
case "edit_repository":
$repId = $httpVars["repository_id"];
$repList = ConfService::getRootDirsList();
//print_r($repList);
AJXP_XMLWriter::header("admin_data");
if (!isset($repList[$repId])) {
AJXP_XMLWriter::close("admin_data");
exit(1);
}
$repository = $repList[$repId];
$nested = array();
print "<repository index=\"{$repId}\"";
foreach ($repository as $name => $option) {
if (!is_array($option)) {
if (is_bool($option)) {
$option = $option ? "true" : "false";
}
print " {$name}=\"" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($option)) . "\" ";
} else {
if (is_array($option)) {
$nested[] = $option;
}
}
}
if (count($nested)) {
print ">";
foreach ($nested as $option) {
foreach ($option as $key => $optValue) {
if (is_array($optValue) && count($optValue)) {
print "<param name=\"{$key}\"><![CDATA[" . json_encode($optValue) . "]]></param>";
} else {
if (is_bool($optValue)) {
$optValue = $optValue ? "true" : "false";
}
print "<param name=\"{$key}\" value=\"{$optValue}\"/>";