本文整理汇总了PHP中AJXP_XMLWriter::writeBookmarks方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::writeBookmarks方法的具体用法?PHP AJXP_XMLWriter::writeBookmarks怎么用?PHP AJXP_XMLWriter::writeBookmarks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::writeBookmarks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
//.........这里部分代码省略.........
}
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) {
$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();
if ($userObject == null) {
exit(1);
}
$i = 0;
while (isset($_GET["pref_name_" . $i]) && isset($_GET["pref_value_" . $i])) {
$prefName = $_GET["pref_name_" . $i];
$prefValue = $_GET["pref_value_" . $i];
if ($prefName != "password") {
$userObject->setPref($prefName, $prefValue);
$userObject->save();
AuthService::updateUser($userObject);
setcookie("AJXP_{$prefName}", $prefValue);
} else {
if (isset($_GET["crt"]) && AuthService::checkPassword($userObject->getId(), $_GET["crt"], false, $_GET["pass_seed"])) {
AuthService::updatePassword($userObject->getId(), $prefValue);
} else {
//$errorMessage = "Wrong password!";
header("Content-Type:text/plain");
print "PASS_ERROR";
exit(1);
}
示例2: switchAction
//.........这里部分代码省略.........
if ($title == "" && $bmPath == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark($bmPath, $title);
if ($driver) {
$node = new AJXP_Node($driver->getResourceUrl($bmPath));
$node->setMetadata("ajxp_bookmarked", array("ajxp_bookmarked" => "true"), true, AJXP_METADATA_SCOPE_REPOSITORY, true);
}
} else {
if ($httpVars["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($bmPath);
if ($driver) {
$node = new AJXP_Node($driver->getResourceUrl($bmPath));
$node->removeMetadata("ajxp_bookmarked", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
}
} else {
if ($httpVars["bm_action"] == "rename_bookmark" && isset($httpVars["bm_title"])) {
$title = AJXP_Utils::decodeSecureMagic($httpVars["bm_title"]);
$bmUser->renameBookmark($bmPath, $title);
}
}
}
AJXP_Controller::applyHook("msg.instant", array("<reload_bookmarks/>", ConfService::getRepository()->getId()));
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser->save("user");
AuthService::updateUser($bmUser);
} else {
if (!AuthService::usersEnabled()) {
$bmUser->save("user");
}
}
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::writeBookmarks($bmUser->getBookmarks(), true, isset($httpVars["format"]) ? $httpVars["format"] : "legacy");
AJXP_XMLWriter::close();
break;
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
case "save_user_pref":
$userObject = AuthService::getLoggedUser();
$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");
AuthService::updateUser($userObject);
//setcookie("AJXP_$prefName", $prefValue);
$i++;
}
header("Content-Type:text/plain");
print "SUCCESS";
break;
//------------------------------------
// SAVE USER PREFERENCE
示例3: getUserXML
/**
* Extract all the user data and put it in XML
* @static
* @param null $userObject * @internal param bool $details
* @return string
*/
public static function getUserXML($userObject = null)
{
$buffer = "";
$loggedUser = AuthService::getLoggedUser();
$confDriver = ConfService::getConfStorageImpl();
if ($userObject != null) {
$loggedUser = $userObject;
}
if (!AuthService::usersEnabled()) {
$buffer .= "<user id=\"shared\">";
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRepositoryId() . "\" write=\"1\" read=\"1\"/>";
$buffer .= AJXP_XMLWriter::writeRepositoriesData(null);
$buffer .= "</user>";
} else {
if ($loggedUser != null) {
$lock = $loggedUser->getLock();
$buffer .= "<user id=\"" . $loggedUser->id . "\">";
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRepositoryId() . "\" write=\"" . ($loggedUser->canWrite(ConfService::getCurrentRepositoryId()) ? "1" : "0") . "\" read=\"" . ($loggedUser->canRead(ConfService::getCurrentRepositoryId()) ? "1" : "0") . "\"/>";
$buffer .= AJXP_XMLWriter::writeRepositoriesData($loggedUser);
$buffer .= "<preferences>";
$preferences = $confDriver->getExposedPreferences($loggedUser);
foreach ($preferences as $prefName => $prefData) {
$atts = "";
if (isset($prefData["exposed"]) && $prefData["exposed"] == true) {
foreach ($prefData as $k => $v) {
if ($k == "name") {
continue;
}
if ($k == "value") {
$k = "default";
}
$atts .= "{$k}='{$v}' ";
}
}
if (isset($prefData["pluginId"])) {
$atts .= "pluginId='" . $prefData["pluginId"] . "' ";
}
if ($prefData["type"] == "string") {
$buffer .= "<pref name=\"{$prefName}\" value=\"" . $prefData["value"] . "\" {$atts}/>";
} else {
if ($prefData["type"] == "json") {
$buffer .= "<pref name=\"{$prefName}\" {$atts}><![CDATA[" . $prefData["value"] . "]]></pref>";
}
}
}
$buffer .= "</preferences>";
$buffer .= "<special_rights is_admin=\"" . ($loggedUser->isAdmin() ? "1" : "0") . "\" " . ($lock !== false ? "lock=\"{$lock}\"" : "") . "/>";
$bMarks = $loggedUser->getBookmarks();
if (count($bMarks)) {
$buffer .= "<bookmarks>" . AJXP_XMLWriter::writeBookmarks($bMarks, false) . "</bookmarks>";
}
$buffer .= "</user>";
}
}
return $buffer;
}
示例4: 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::getRepositoriesList();
/** @var $repository_id string */
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("user");
}
//$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($httpVars["bm_action"]) && isset($httpVars["bm_path"])) {
if ($httpVars["bm_action"] == "add_bookmark") {
$title = "";
if (isset($httpVars["bm_title"])) {
$title = $httpVars["bm_title"];
}
if ($title == "" && $httpVars["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark(SystemTextEncoding::magicDequote($httpVars["bm_path"]), SystemTextEncoding::magicDequote($title));
} else {
if ($httpVars["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($httpVars["bm_path"]);
} else {
if ($httpVars["bm_action"] == "rename_bookmark" && isset($httpVars["bm_title"])) {
$bmUser->renameBookmark($httpVars["bm_path"], $httpVars["bm_title"]);
}
}
}
}
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser->save("user");
AuthService::updateUser($bmUser);
} else {
if (!AuthService::usersEnabled()) {
$bmUser->save("user");
}
}
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();
//.........这里部分代码省略.........
示例5: getUserXML
function getUserXML($userObject = null, $details = false)
{
$buffer = "";
$loggedUser = AuthService::getLoggedUser();
if ($userObject != null) {
$loggedUser = $userObject;
}
if (!AuthService::usersEnabled()) {
$buffer .= "<user id=\"shared\">";
if (!$details) {
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRootDirIndex() . "\" write=\"1\" read=\"1\"/>";
}
$buffer .= AJXP_XMLWriter::writeRepositoriesData(null, $details);
$buffer .= "</user>";
} else {
if ($loggedUser != null) {
$buffer .= "<user id=\"" . $loggedUser->id . "\">";
if (!$details) {
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRootDirIndex() . "\" write=\"" . ($loggedUser->canWrite(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\" read=\"" . ($loggedUser->canRead(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\"/>";
}
$buffer .= AJXP_XMLWriter::writeRepositoriesData($loggedUser, $details);
$buffer .= "<preferences>";
$buffer .= "<pref name=\"display\" value=\"" . $loggedUser->getPref("display") . "\"/>";
$buffer .= "<pref name=\"lang\" value=\"" . $loggedUser->getPref("lang") . "\"/>";
$buffer .= "<pref name=\"diapo_autofit\" value=\"" . $loggedUser->getPref("diapo_autofit") . "\"/>";
$buffer .= "<pref name=\"sidebar_splitter_size\" value=\"" . $loggedUser->getPref("sidebar_splitter_size") . "\"/>";
$buffer .= "<pref name=\"vertical_splitter_size\" value=\"" . $loggedUser->getPref("vertical_splitter_size") . "\"/>";
$buffer .= "<pref name=\"history_last_repository\" value=\"" . $loggedUser->getArrayPref("history", "last_repository") . "\"/>";
$buffer .= "<pref name=\"history_last_listing\" value=\"" . AJXP_Utils::xmlEntities(stripslashes($loggedUser->getArrayPref("history", ConfService::getCurrentRootDirIndex()))) . "\"/>";
$buffer .= "<pref name=\"thumb_size\" value=\"" . $loggedUser->getPref("thumb_size") . "\"/>";
$buffer .= "<pref name=\"columns_size\" value=\"" . stripslashes(str_replace("\"", "'", $loggedUser->getPref("columns_size"))) . "\"/>";
$buffer .= "<pref name=\"columns_visibility\" value=\"" . stripslashes(str_replace("\"", "'", $loggedUser->getPref("columns_visibility"))) . "\"/>";
$buffer .= "<pref name=\"ls_history\" value=\"" . stripslashes(str_replace("\"", "'", $loggedUser->getPref("ls_history"))) . "\"/>";
$buffer .= "<pref name=\"upload_auto_send\" value=\"" . $loggedUser->getPref("upload_auto_send") . "\"/>";
$buffer .= "<pref name=\"upload_auto_close\" value=\"" . $loggedUser->getPref("upload_auto_close") . "\"/>";
$buffer .= "<pref name=\"upload_existing\" value=\"" . $loggedUser->getPref("upload_existing") . "\"/>";
$buffer .= "</preferences>";
$buffer .= "<special_rights is_admin=\"" . ($loggedUser->isAdmin() ? "1" : "0") . "\"/>";
$bMarks = $loggedUser->getBookmarks();
if (count($bMarks)) {
$buffer .= "<bookmarks>" . AJXP_XMLWriter::writeBookmarks($bMarks, false) . "</bookmarks>";
}
$buffer .= "</user>";
}
}
return $buffer;
}
示例6: 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;
//.........这里部分代码省略.........
示例7: getUserXML
/**
* Extract all the user data and put it in XML
* @static
* @param null $userObject
* @param bool $details
* @return string
*/
static function getUserXML($userObject = null, $details = false)
{
$buffer = "";
$loggedUser = AuthService::getLoggedUser();
$confDriver = ConfService::getConfStorageImpl();
if ($userObject != null) {
$loggedUser = $userObject;
}
if (!AuthService::usersEnabled()) {
$buffer .= "<user id=\"shared\">";
if (!$details) {
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRootDirIndex() . "\" write=\"1\" read=\"1\"/>";
}
$buffer .= AJXP_XMLWriter::writeRepositoriesData(null, $details);
$buffer .= "</user>";
} else {
if ($loggedUser != null) {
$buffer .= "<user id=\"" . $loggedUser->id . "\">";
if (!$details) {
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRootDirIndex() . "\" write=\"" . ($loggedUser->canWrite(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\" read=\"" . ($loggedUser->canRead(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\"/>";
} else {
$buffer .= "<ajxp_roles>";
foreach ($loggedUser->getRoles() as $roleId => $boolean) {
if ($boolean === true) {
$buffer .= "<role id=\"{$roleId}\"/>";
}
}
$buffer .= "</ajxp_roles>";
}
$buffer .= AJXP_XMLWriter::writeRepositoriesData($loggedUser, $details);
$buffer .= "<preferences>";
$preferences = $confDriver->getExposedPreferences($loggedUser);
foreach ($preferences as $prefName => $prefData) {
if ($prefData["type"] == "string") {
$buffer .= "<pref name=\"{$prefName}\" value=\"" . $prefData["value"] . "\"/>";
} else {
if ($prefData["type"] == "json") {
$buffer .= "<pref name=\"{$prefName}\"><![CDATA[" . $prefData["value"] . "]]></pref>";
}
}
}
$buffer .= "</preferences>";
$buffer .= "<special_rights is_admin=\"" . ($loggedUser->isAdmin() ? "1" : "0") . "\"/>";
$bMarks = $loggedUser->getBookmarks();
if (count($bMarks)) {
$buffer .= "<bookmarks>" . AJXP_XMLWriter::writeBookmarks($bMarks, false) . "</bookmarks>";
}
$buffer .= "</user>";
}
}
return $buffer;
}