本文整理汇总了PHP中AuthService::preLogUser方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::preLogUser方法的具体用法?PHP AuthService::preLogUser怎么用?PHP AuthService::preLogUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthService
的用法示例。
在下文中一共展示了AuthService::preLogUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
$token = $_POST["secure_token"];
}
}
if ($token == "" || !AuthService::checkSecureToken($token)) {
throw new Exception("You are not allowed to access this resource.");
}
}
if (AuthService::usersEnabled()) {
$httpVars = array_merge($_GET, $_POST);
AuthService::logUser(null, null);
// Check that current user can access current repository, try to switch otherwise.
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser == null) {
// Try prelogging user if the session expired but the logging data is in fact still present
// For example, for basic_http auth.
AuthService::preLogUser(isset($httpVars["remote_session"]) ? $httpVars["remote_session"] : "");
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser == null) {
$requireAuth = true;
}
}
if ($loggedUser != null) {
$res = ConfService::switchUserToActiveRepository($loggedUser, isset($httpVars["tmp_repository_id"]) ? $httpVars["tmp_repository_id"] : "-1");
if (!$res) {
AuthService::disconnect();
$requireAuth = true;
}
}
} else {
AJXP_Logger::debug(ConfService::getCurrentRepositoryId());
}
示例2: switchAction
//.........这里部分代码省略.........
}
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
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 {
示例3: session_name
session_name("AjaXplorer");
session_start();
$outputArray = array();
$testedParams = 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');
示例4: switchAction
//.........这里部分代码省略.........
//------------------------------------
// GET BOOT GUI
//------------------------------------
case "get_boot_gui":
HTMLWriter::internetExplorerMainDocumentHeader();
HTMLWriter::charsetHeader();
if (!is_file(TESTS_RESULT_FILE)) {
$outputArray = array();
$testedParams = array();
$passed = AJXP_Utils::runTests($outputArray, $testedParams);
if (!$passed && !isset($httpVars["ignore_tests"])) {
AJXP_Utils::testResultsToTable($outputArray, $testedParams);
die;
} else {
AJXP_Utils::testResultsToFile($outputArray, $testedParams);
}
}
$root = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$configUrl = ConfService::getCoreConf("SERVER_URL");
if (!empty($configUrl)) {
$root = '/' . ltrim(parse_url($configUrl, PHP_URL_PATH), '/');
if (strlen($root) > 1) {
$root = rtrim($root, '/') . '/';
}
} else {
preg_match('/ws-(.)*\\/|settings|dashboard|welcome|user/', $root, $matches, PREG_OFFSET_CAPTURE);
if (count($matches)) {
$capture = $matches[0][1];
$root = substr($root, 0, $capture);
}
}
$START_PARAMETERS = array("BOOTER_URL" => "index.php?get_action=get_boot_conf", "MAIN_ELEMENT" => "ajxp_desktop", "APPLICATION_ROOT" => $root, "REBASE" => $root);
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::getCurrentRepositoryId()) && AuthService::getDefaultRootId() != ConfService::getCurrentRepositoryId()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$confErrors = ConfService::getErrors();
if (count($confErrors)) {
$START_PARAMETERS["ALERT"] = implode(", ", array_values($confErrors));
}
// PRECOMPUTE BOOT CONF
if (!preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
$preloadedBootConf = $this->computeBootConf();
AJXP_Controller::applyHook("loader.filter_boot_conf", array(&$preloadedBootConf));
$START_PARAMETERS["PRELOADED_BOOT_CONF"] = $preloadedBootConf;
}
// PRECOMPUTE REGISTRY
if (!isset($START_PARAMETERS["FORCE_REGISTRY_RELOAD"])) {
$clone = ConfService::getFilteredXMLRegistry(true, true);
$clonePath = new DOMXPath($clone);
$serverCallbacks = $clonePath->query("//serverCallback|hooks");
foreach ($serverCallbacks as $callback) {
$callback->parentNode->removeChild($callback);
}
$START_PARAMETERS["PRELOADED_REGISTRY"] = AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
示例5: set_error_handler
include_once "base.conf.php";
set_error_handler(array("AJXP_XMLWriter", "catchError"), E_ALL & ~E_NOTICE & ~E_STRICT);
set_exception_handler(array("AJXP_XMLWriter", "catchException"));
$pServ = AJXP_PluginsService::getInstance();
ConfService::$useSession = false;
AuthService::$useSession = false;
ConfService::init();
$confPlugin = ConfService::getInstance()->confPluginSoftLoad($pServ);
$pServ->loadPluginsRegistry(AJXP_INSTALL_PATH . "/plugins", $confPlugin);
ConfService::start();
$confStorageDriver = ConfService::getConfStorageImpl();
require_once $confStorageDriver->getUserClassFileName();
//session_name("AjaXplorer");
//session_start();
AJXP_PluginsService::getInstance()->initActivePlugins();
AuthService::preLogUser(array_merge($_GET, $_POST));
if (AuthService::getLoggedUser() == null) {
header('HTTP/1.0 401 Unauthorized');
echo 'You are not authorized to access this API.';
exit;
}
$authDriver = ConfService::getAuthDriverImpl();
ConfService::currentContextIsRestAPI("api");
$uri = $_SERVER["REQUEST_URI"];
$scriptUri = ltrim(AJXP_Utils::safeDirname($_SERVER["SCRIPT_NAME"]), '/') . "/api/";
$uri = substr($uri, strlen($scriptUri));
$uri = explode("/", trim($uri, "/"));
// GET REPO ID
$repoID = array_shift($uri);
// GET ACTION NAME
$action = array_shift($uri);
示例6: Exception
}
}
if ($token == "" || !AuthService::checkSecureToken($token)) {
throw new Exception("You are not allowed to access this resource.");
}
}
if (AuthService::usersEnabled()) {
$httpVars = array_merge($_GET, $_POST);
AuthService::logUser(null, null);
// Check that current user can access current repository, try to switch otherwise.
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser == null || $loggedUser->getId() == "guest") {
// Try prelogging user if the session expired but the logging data is in fact still present
// For example, for basic_http auth.
AJXP_PluginsService::getInstance()->initActivePlugins();
AuthService::preLogUser($httpVars);
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser == null) {
$requireAuth = true;
}
}
if ($loggedUser != null) {
$res = ConfService::switchUserToActiveRepository($loggedUser, isset($httpVars["tmp_repository_id"]) ? $httpVars["tmp_repository_id"] : "-1");
if (!$res) {
AuthService::disconnect();
$requireAuth = true;
}
}
} else {
AJXP_Logger::debug(ConfService::getCurrentRepositoryId());
}
示例7: switchAction
//.........这里部分代码省略.........
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
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":
HTMLWriter::internetExplorerMainDocumentHeader();
HTMLWriter::charsetHeader();
if (!is_file(TESTS_RESULT_FILE)) {
$outputArray = array();
$testedParams = array();
$passed = AJXP_Utils::runTests($outputArray, $testedParams);
if (!$passed && !isset($_GET["ignore_tests"])) {
AJXP_Utils::testResultsToTable($outputArray, $testedParams);
die;
} 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::getCurrentRepositoryId()) && AuthService::getDefaultRootId() != ConfService::getCurrentRepositoryId()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$confErrors = ConfService::getErrors();
if (count($confErrors)) {
$START_PARAMETERS["ALERT"] = implode(", ", array_values($confErrors));
}
// PRECOMPUTE BOOT CONF
if (!preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
$START_PARAMETERS["PRELOADED_BOOT_CONF"] = $this->computeBootConf();
}
// PRECOMPUTE REGISTRY
if (!isset($START_PARAMETERS["FORCE_REGISTRY_RELOAD"])) {
$regDoc = AJXP_PluginsService::getXmlRegistry();
$changes = AJXP_Controller::filterRegistryFromRole($regDoc);
if ($changes) {
AJXP_PluginsService::updateXmlRegistry($regDoc);
}
$clone = $regDoc->cloneNode(true);
$clonePath = new DOMXPath($clone);
$serverCallbacks = $clonePath->query("//serverCallback|hooks");
foreach ($serverCallbacks as $callback) {