本文整理汇总了PHP中ConfService::getCurrentRootDirIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getCurrentRootDirIndex方法的具体用法?PHP ConfService::getCurrentRootDirIndex怎么用?PHP ConfService::getCurrentRootDirIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getCurrentRootDirIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
}
AJXP_XMLWriter::close();
exit(1);
}
if ($Driver->hasAction($action)) {
// CHECK RIGHTS
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($Driver->actionNeedsRight($action, "r") && ($loggedUser == null || !$loggedUser->canRead(ConfService::getCurrentRootDirIndex() . ""))) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess[208]);
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
exit(1);
}
if ($Driver->actionNeedsRight($action, "w") && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRootDirIndex() . ""))) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess[207]);
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
exit(1);
}
}
$xmlResult = $Driver->applyAction($action, array_merge($_GET, $_POST), $_FILES);
if ($xmlResult != "") {
AJXP_XMLWriter::header();
print $xmlResult;
AJXP_XMLWriter::close();
exit(1);
}
}
示例2: switchAction
//.........这里部分代码省略.........
//------------------------------------
case "display_doc":
HTMLWriter::charsetHeader();
echo HTMLWriter::getDocFile(AJXP_Utils::securePath(htmlentities($_GET["doc_file"])));
break;
//------------------------------------
// GET BOOT GUI
//------------------------------------
//------------------------------------
// GET BOOT GUI
//------------------------------------
case "get_boot_gui":
header("X-UA-Compatible: chrome=1");
HTMLWriter::charsetHeader();
if (!is_file(TESTS_RESULT_FILE)) {
$outputArray = array();
$testedParams = array();
$passed = AJXP_Utils::runTests($outputArray, $testedParams);
if (!$passed && !isset($_GET["ignore_tests"])) {
die(AJXP_Utils::testResultsToTable($outputArray, $testedParams));
} else {
AJXP_Utils::testResultsToFile($outputArray, $testedParams);
}
}
$START_PARAMETERS = array("BOOTER_URL" => "index.php?get_action=get_boot_conf", "MAIN_ELEMENT" => "ajxp_desktop");
if (AuthService::usersEnabled()) {
AuthService::preLogUser(isset($httpVars["remote_session"]) ? $httpVars["remote_session"] : "");
AuthService::bootSequence($START_PARAMETERS);
if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
if (AuthService::getDefaultRootId() == -1) {
AuthService::disconnect();
} else {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) && AuthService::getDefaultRootId() != ConfService::getCurrentRootDirIndex()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$confErrors = ConfService::getErrors();
if (count($confErrors)) {
$START_PARAMETERS["ALERT"] = implode(", ", array_values($confErrors));
}
$JSON_START_PARAMETERS = json_encode($START_PARAMETERS);
$crtTheme = $this->pluginConf["GUI_THEME"];
if (ConfService::getConf("JS_DEBUG")) {
if (!isset($mess)) {
$mess = ConfService::getMessages();
}
if (is_file(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui_debug.html")) {
include AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui_debug.html";
} else {
include AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/html/gui_debug.html";
}
} else {
if (is_file(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui.html")) {
$content = file_get_contents(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui.html");
} else {
$content = file_get_contents(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/html/gui.html");
}
if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
$content = str_replace("ajaxplorer_boot.js", "ajaxplorer_boot_protolegacy.js", $content);
}
$content = AJXP_XMLWriter::replaceAjxpXmlKeywords($content, false);
if ($JSON_START_PARAMETERS) {
示例3: findActionAndApply
public static function findActionAndApply($actionName, $httpVars, $fileVars)
{
if ($actionName == "cross_copy") {
$pService = AJXP_PluginsService::getInstance();
$actives = $pService->getActivePlugins();
$accessPlug = $pService->getPluginsByType("access");
if (count($accessPlug)) {
foreach ($accessPlug as $key => $objbect) {
if ($actives[$objbect->getId()] === true) {
call_user_func(array($pService->getPluginById($objbect->getId()), "crossRepositoryCopy"), $httpVars);
break;
}
}
}
return;
}
$xPath = self::initXPath();
$actions = $xPath->query("actions/action[@name='{$actionName}']");
if (!$actions->length) {
return false;
}
$action = $actions->item(0);
//Check Rights
$mess = ConfService::getMessages();
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if (AJXP_Controller::actionNeedsRight($action, $xPath, "adminOnly") && ($loggedUser == null || !$loggedUser->isAdmin())) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess[207]);
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
exit(1);
}
if (AJXP_Controller::actionNeedsRight($action, $xPath, "read") && ($loggedUser == null || !$loggedUser->canRead(ConfService::getCurrentRootDirIndex() . ""))) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess[208]);
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
exit(1);
}
if (AJXP_Controller::actionNeedsRight($action, $xPath, "write") && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRootDirIndex() . ""))) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess[207]);
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
exit(1);
}
}
$preCalls = self::getCallbackNode($xPath, $action, 'pre_processing/serverCallback', $actionName, $httpVars, $fileVars, true);
$postCalls = self::getCallbackNode($xPath, $action, 'post_processing/serverCallback[not(@capture="true")]', $actionName, $httpVars, $fileVars, true);
$captureCalls = self::getCallbackNode($xPath, $action, 'post_processing/serverCallback[@capture="true"]', $actionName, $httpVars, $fileVars, true);
$mainCall = self::getCallbackNode($xPath, $action, "processing/serverCallback", $actionName, $httpVars, $fileVars, false);
if ($captureCalls !== false) {
ob_start();
$params = array("pre_processor_results" => array(), "post_processor_results" => array());
}
if ($preCalls !== false) {
foreach ($preCalls as $preCall) {
// A Preprocessing callback can modify its input arguments (passed by ref)
$preResult = self::applyCallback($xPath, $preCall, $actionName, $httpVars, $fileVars);
if (isset($params)) {
$params["pre_processor_results"][$preCall->getAttribute("pluginId")] = $preResult;
}
}
}
if ($mainCall) {
$result = self::applyCallback($xPath, $mainCall, $actionName, $httpVars, $fileVars);
if (isset($params)) {
$params["processor_result"] = $result;
}
}
if ($postCalls !== false) {
foreach ($postCalls as $postCall) {
// A Preprocessing callback can modify its input arguments (passed by ref)
$postResult = self::applyCallback($xPath, $postCall, $actionName, $httpVars, $fileVars);
if (isset($params)) {
$params["post_processor_results"][$postCall->getAttribute("pluginId")] = $postResult;
}
}
}
if ($captureCalls !== false) {
$params["ob_output"] = ob_get_contents();
ob_end_clean();
foreach ($captureCalls as $captureCall) {
self::applyCallback($xPath, $captureCall, $actionName, $httpVars, $params);
}
} else {
if (isset($result)) {
return $result;
}
}
}
示例4: getBookmarks
function getBookmarks()
{
if (isset($this->bookmarks) && isset($this->bookmarks[ConfService::getCurrentRootDirIndex()])) {
return $this->bookmarks[ConfService::getCurrentRootDirIndex()];
}
return array();
}
示例5: array
$passed = true;
//if(!is_file(TESTS_RESULT_FILE)){
// $passed = AJXP_Utils::runTests($outputArray, $testedParams);
// if(!$passed && !isset($_GET["ignore_tests"])){
// die(AJXP_Utils::testResultsToTable($outputArray, $testedParams));
// }else{
// AJXP_Utils::testResultsToFile($outputArray, $testedParams);
// }
//}
$START_PARAMETERS = array("BOOTER_URL" => "cf_ajaxplorer_content.php?get_action=get_boot_conf", "MAIN_ELEMENT" => "ajxp_desktop", "SERVER_PREFIX_URI" => "../lib/ajaxplorer/");
if (AuthService::usersEnabled()) {
AuthService::preLogUser(isset($_GET["remote_session"]) ? $_GET["remote_session"] : "");
AuthService::bootSequence($START_PARAMETERS);
if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) && AuthService::getDefaultRootId() != ConfService::getCurrentRootDirIndex()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$JSON_START_PARAMETERS = json_encode($START_PARAMETERS);
if (ConfService::getConf("JS_DEBUG")) {
$mess = ConfService::getMessages();
include_once INSTALL_PATH . "/" . CLIENT_RESOURCES_FOLDER . "/html/gui_debug.html";
} else {
$content = file_get_contents(CAMILA_DIR . '/templates/ajaxplorer_gui.html');
$content = AJXP_XMLWriter::replaceAjxpXmlKeywords($content, false);
if ($JSON_START_PARAMETERS) {
$content = str_replace("//AJXP_JSON_START_PARAMETERS", "startParameters = " . $JSON_START_PARAMETERS . ";", $content);
$content = str_replace("CAMILA_APPLICATION_NAME", CAMILA_APPLICATION_NAME, $content);
示例6: renameBookmark
/**
* Rename a user bookmark.
*
* @param $path String Path of the bookmark to rename.
* @param $title New title to give the bookmark.
* @return null or -1 on error.
* @see server/classes/AbstractAjxpUser#renameBookmark($path, $title)
*/
function renameBookmark($path, $title)
{
$repId = ConfService::getCurrentRootDirIndex();
if (isset($this->bookmarks) && isset($this->bookmarks[$repId]) && is_array($this->bookmarks[$repId])) {
foreach ($this->bookmarks[$repId] as $k => $v) {
$toCompare = "";
if (is_string($v)) {
$toCompare = $v;
} else {
if (is_array($v)) {
$toCompare = $v["PATH"];
}
}
if ($toCompare == trim($path)) {
try {
dibi::query('UPDATE [ajxp_user_bookmarks] SET ', array('path' => trim($path), 'title' => $title), 'WHERE [login] = %s AND [repo_uuid] = %s AND [title] = %s', $this->getId(), $repId, $v["TITLE"]);
} catch (DibiException $e) {
$this->log('BOOKMARK RENAME FAILED: Reason: ' . $e->getMessage());
return -1;
}
$this->bookmarks[$repId][$k] = array("PATH" => trim($path), "TITLE" => $title);
}
}
}
}
示例7: 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;
}
示例8: 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();
//.........这里部分代码省略.........
示例9: 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;
//.........这里部分代码省略.........
示例10: isset
}
$mess = ConfService::getMessages();
$action = "";
if (isset($_GET["action"]) || isset($_GET["get_action"])) {
$action = isset($_GET["get_action"]) ? $_GET["get_action"] : $_GET["action"];
} else {
if (isset($_POST["action"]) || isset($_POST["get_action"])) {
$action = isset($_POST["get_action"]) ? $_POST["get_action"] : $_POST["action"];
}
}
//------------------------------------------------------------
// SPECIAL HANDLING FOR FANCY UPLOADER RIGHTS FOR THIS ACTION
//------------------------------------------------------------
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($action == "upload" && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRootDirIndex() . "")) && isset($_FILES['Filedata'])) {
header('HTTP/1.0 ' . '410 Not authorized');
die('Error 410 Not authorized!');
}
}
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$ajxpDriver->init(ConfService::getRepository());
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ALLOW_GUEST_BROWSING || AuthService::getLoggedUser() != null) {
$confDriver = ConfService::getConfStorageImpl();
$Driver = ConfService::loadRepositoryDriver();
}
ConfService::initActivePlugins();
require_once INSTALL_PATH . "/server/classes/class.AJXP_Controller.php";
示例11: sendUserData
function sendUserData($userObject = null, $details = false)
{
$loggedUser = AuthService::getLoggedUser();
if ($userObject != null) {
$loggedUser = $userObject;
}
if ($loggedUser != null) {
print "<user id=\"" . $loggedUser->id . "\">";
if (!$details) {
print "<active_repo id=\"" . ConfService::getCurrentRootDirIndex() . "\" write=\"" . ($loggedUser->canWrite(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\" read=\"" . ($loggedUser->canRead(ConfService::getCurrentRootDirIndex()) ? "1" : "0") . "\"/>";
}
print AJXP_XMLWriter::writeRepositoriesData($loggedUser, $details);
print "<preferences>";
print "<pref name=\"display\" value=\"" . $loggedUser->getPref("display") . "\"/>";
print "<pref name=\"lang\" value=\"" . $loggedUser->getPref("lang") . "\"/>";
print "<pref name=\"diapo_autofit\" value=\"" . $loggedUser->getPref("diapo_autofit") . "\"/>";
print "<pref name=\"sidebar_splitter_size\" value=\"" . $loggedUser->getPref("sidebar_splitter_size") . "\"/>";
print "<pref name=\"vertical_splitter_size\" value=\"" . $loggedUser->getPref("vertical_splitter_size") . "\"/>";
print "<pref name=\"history_last_repository\" value=\"" . $loggedUser->getPref("history_last_repository") . "\"/>";
print "<pref name=\"history_last_listing\" value=\"" . $loggedUser->getPref("history_last_listing") . "\"/>";
print "<pref name=\"thumb_size\" value=\"" . $loggedUser->getPref("thumb_size") . "\"/>";
print "</preferences>";
print "<special_rights is_admin=\"" . ($loggedUser->isAdmin() ? "1" : "0") . "\"/>";
print "</user>";
}
}
示例12: urldecode
}
}
$USERS_ENABLED = "true";
if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
$LOGGED_USER = "true";
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) && AuthService::getDefaultRootId() != ConfService::getCurrentRootDirIndex()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
$ROOT_DIR_NAME = "null";
$ROOT_DIR_ID = "null";
$ROOT_DIR_XML = "";
} else {
$ROOT_DIR_NAME = ConfService::getCurrentRootDirDisplay();
$ROOT_DIR_ID = ConfService::getCurrentRootDirIndex();
$ROOT_DIR_XML = HTMLWriter::repositoryDataAsJS();
}
$EXT_REP = "/";
if (isset($_GET["folder"])) {
$EXT_REP = urldecode($_GET["folder"]);
}
$CRT_USER = "shared_bookmarks";
if (isset($_GET["user"])) {
$CRT_USER = $_GET["user"];
}
$ZIP_ENABLED = ConfService::zipEnabled() ? "true" : "false";
$loggedUser = AuthService::getLoggedUser();
$DEFAULT_DISPLAY = "list";
if ($loggedUser != null && $loggedUser->getId() != "guest") {
if ($loggedUser->getPref("lang") != "") {
示例13: file_put_contents
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser == null) {
$requireAuth = true;
}
}
if (isset($loggingResult) && $loggingResult != 1) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult($loggingResult, false, false, "");
AJXP_XMLWriter::close();
if ($optStatusFile) {
file_put_contents($optStatusFile, "ERROR:No user logged");
}
exit(1);
}
} else {
AJXP_Logger::debug(ConfService::getCurrentRootDirIndex());
}
//Set language
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && $loggedUser->getPref("lang") != "") {
ConfService::setLanguage($loggedUser->getPref("lang"));
} else {
if (isset($_COOKIE["AJXP_lang"])) {
ConfService::setLanguage($_COOKIE["AJXP_lang"]);
}
}
$mess = ConfService::getMessages();
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$ajxpDriver->init(ConfService::getRepository());
$authDriver = ConfService::getAuthDriverImpl();
示例14: switchUserToActiveRepository
public static function switchUserToActiveRepository($loggedUser, $parameterId = -1)
{
if (isset($_SESSION["PENDING_REPOSITORY_ID"]) && isset($_SESSION["PENDING_FOLDER"])) {
$loggedUser->setArrayPref("history", "last_repository", $_SESSION["PENDING_REPOSITORY_ID"]);
$loggedUser->setPref("pending_folder", $_SESSION["PENDING_FOLDER"]);
$loggedUser->save("user");
AuthService::updateUser($loggedUser);
unset($_SESSION["PENDING_REPOSITORY_ID"]);
unset($_SESSION["PENDING_FOLDER"]);
}
$currentRepoId = ConfService::getCurrentRootDirIndex();
$lastRepoId = $loggedUser->getArrayPref("history", "last_repository");
$defaultRepoId = AuthService::getDefaultRootId();
if ($defaultRepoId == -1) {
return false;
} else {
if ($lastRepoId !== "" && $lastRepoId !== $currentRepoId && $parameterId == -1 && $loggedUser->canSwitchTo($lastRepoId)) {
ConfService::switchRootDir($lastRepoId);
} else {
if ($parameterId != -1 && $loggedUser->canSwitchTo($parameterId)) {
ConfService::switchRootDir($parameterId);
} else {
if (!$loggedUser->canSwitchTo($currentRepoId)) {
ConfService::switchRootDir($defaultRepoId);
}
}
}
}
return true;
}
示例15: 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;
}