本文整理汇总了PHP中ConfService::getCoreConf方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getCoreConf方法的具体用法?PHP ConfService::getCoreConf怎么用?PHP ConfService::getCoreConf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getCoreConf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
public function authenticate(Sabre\DAV\Server $server, $realm)
{
//AJXP_Logger::debug("Try authentication on $realm", $server);
try {
$success = parent::authenticate($server, $realm);
} catch (Exception $e) {
$success = 0;
$errmsg = $e->getMessage();
if ($errmsg != "No digest authentication headers were found") {
$success = false;
}
}
if ($success) {
$res = AuthService::logUser($this->currentUser, null, true);
if ($res < 1) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
$this->updateCurrentUserRights(AuthService::getLoggedUser());
if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
$webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
}
} else {
if ($success === false) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
}
throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
}
ConfService::switchRootDir($this->repositoryId);
return true;
}
示例2: doTest
public function doTest()
{
$tmpDir = ini_get("upload_tmp_dir");
if (!$tmpDir) {
$tmpDir = realpath(sys_get_temp_dir());
}
if (ConfService::getCoreConf("AJXP_TMP_DIR") != "") {
$tmpDir = ConfService::getCoreConf("AJXP_TMP_DIR");
}
if (defined("AJXP_TMP_DIR") && AJXP_TMP_DIR != "") {
$tmpDir = AJXP_TMP_DIR;
}
$this->testedParams["Upload Tmp Dir Writeable"] = @is_writable($tmpDir);
$this->testedParams["PHP Upload Max Size"] = $this->returnBytes(ini_get("upload_max_filesize"));
$this->testedParams["PHP Post Max Size"] = $this->returnBytes(ini_get("post_max_size"));
foreach ($this->testedParams as $paramName => $paramValue) {
$this->failedInfo .= "\n{$paramName}={$paramValue}";
}
if (!$this->testedParams["Upload Tmp Dir Writeable"]) {
$this->failedLevel = "error";
$this->failedInfo = "The temporary folder used by PHP to upload files is either incorrect or not writeable! Upload will not work. Please check : " . ini_get("upload_tmp_dir");
$this->failedInfo .= "<p class='suggestion'><b>Suggestion</b> : Set the AJXP_TMP_DIR parameter in the <i>conf/bootstrap_conf.php</i> file</p>";
return FALSE;
}
$this->failedLevel = "info";
return FALSE;
}
示例3: buildPublicHtaccessContent
function buildPublicHtaccessContent()
{
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
$dlURL = ConfService::getCoreConf("PUBLIC_DOWNLOAD_URL");
if ($dlURL != "") {
$url = rtrim($dlURL, "/");
} else {
$fullUrl = AJXP_Utils::detectServerURL(true);
$url = str_replace("\\", "/", rtrim($fullUrl, "/") . rtrim(str_replace(AJXP_INSTALL_PATH, "", $downloadFolder), "/"));
}
$htaccessContent = "Order Deny,Allow\nAllow from all\n";
$htaccessContent .= "\n<Files \".ajxp_*\">\ndeny from all\n</Files>\n";
$path = parse_url($url, PHP_URL_PATH);
$htaccessContent .= '
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase ' . $path . '
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)\\.php$ share.php?hash=$1 [QSA]
RewriteRule ^([a-zA-Z0-9_-]+)--([a-z]+)$ share.php?hash=$1&lang=$2 [QSA]
RewriteRule ^([a-zA-Z0-9_-]+)$ share.php?hash=$1 [QSA]
</IfModule>
';
return $htaccessContent;
}
示例4: doTest
public function doTest()
{
$this->testedParams["Users enabled"] = AuthService::usersEnabled();
$this->testedParams["Guest enabled"] = ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth");
$this->failedLevel = "info";
return FALSE;
}
示例5: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
switch ($action) {
case "get_secure_token":
HTMLWriter::charsetHeader("text/plain");
print AuthService::generateSecureToken();
//exit(0);
break;
//------------------------------------
// CHANGE USER PASSWORD
//------------------------------------
//------------------------------------
// CHANGE USER PASSWORD
//------------------------------------
case "pass_change":
$userObject = AuthService::getLoggedUser();
if ($userObject == null || $userObject->getId() == "guest") {
header("Content-Type:text/plain");
print "SUCCESS";
break;
}
$oldPass = $httpVars["old_pass"];
$newPass = $httpVars["new_pass"];
$passSeed = $httpVars["pass_seed"];
if (strlen($newPass) < ConfService::getCoreConf("PASSWORD_MINLENGTH", "auth")) {
header("Content-Type:text/plain");
print "PASS_ERROR";
break;
}
if (AuthService::checkPassword($userObject->getId(), $oldPass, false, $passSeed)) {
AuthService::updatePassword($userObject->getId(), $newPass);
if ($userObject->getLock() == "pass_change") {
$userObject->removeLock();
$userObject->save("superuser");
}
} else {
header("Content-Type:text/plain");
print "PASS_ERROR";
break;
}
header("Content-Type:text/plain");
print "SUCCESS";
break;
default:
break;
}
return "";
}
示例6: generateDirectoryIndex
public function generateDirectoryIndex($path)
{
$html = parent::generateDirectoryIndex($path);
$html = str_replace("image/vnd.microsoft.icon", "image/png", $html);
$title = ConfService::getCoreConf("APPLICATION_TITLE");
$html = preg_replace("/<title>(.*)<\\/title>/i", '<title>' . $title . '</title>', $html);
$repoString = "</h1>";
if (!empty($this->repositoryLabel)) {
$repoString = " - " . $this->repositoryLabel . "</h1><h2>Index of " . $this->escapeHTML($path) . "/</h2>";
}
$html = preg_replace("/<h1>(.*)<\\/h1>/i", "<h1>" . $title . $repoString, $html);
$html = str_replace("h1 { font-size: 150% }", "h1 { font-size: 150% } \n h2 { font-size: 115% }", $html);
return $html;
}
示例7: init
function init($options)
{
$this->slaveMode = $options["SLAVE_MODE"] == "true";
if ($this->slaveMode && ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth")) {
// Make sure "login" is disabled, or it will re-appear if GUEST browsing is enabled!
// OLD WAY : unset($this->actions["login"]);
// NEW WAY : Modify manifest dynamically (more coplicated...)
$contribs = $this->xPath->query("registry_contributions/external_file");
foreach ($contribs as $contribNode) {
if ($contribNode->getAttribute('filename') == 'plugins/core.auth/standard_auth_actions.xml') {
$contribNode->parentNode->removeChild($contribNode);
}
}
}
parent::init($options);
$this->usersSerFile = $options["USERS_FILEPATH"];
$this->secret = $options["SECRET"];
$this->urls = array($options["LOGIN_URL"], $options["LOGOUT_URL"]);
}
示例8: updateSharePhpFile
function updateSharePhpFile()
{
$dlFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
if (is_file($dlFolder . "/share.php")) {
$loader_content = '<' . '?' . 'php
define("AJXP_EXEC", true);
require_once("' . str_replace("\\", "/", AJXP_INSTALL_PATH) . '/core/classes/class.AJXP_Utils.php");
$hash = AJXP_Utils::securePath(AJXP_Utils::sanitize($_GET["hash"], AJXP_SANITIZE_ALPHANUM));
if(file_exists($hash.".php")){
require_once($hash.".php");
}else{
require_once("' . str_replace("\\", "/", AJXP_INSTALL_PATH) . '/publicLet.inc.php");
ShareCenter::loadShareByHash($hash);
}
';
if (@file_put_contents($dlFolder . "/share.php", $loader_content) === FALSE) {
echo "Could not rewrite the content of the public folder share.php file. Please remove it and create a new shared link to regenerate this file.";
}
}
}
示例9: authenticate
public function authenticate(Sabre\DAV\Server $server, $realm)
{
//AJXP_Logger::debug("Try authentication on $realm", $server);
$success = parent::authenticate($server, $realm);
if ($success) {
$res = AuthService::logUser($this->currentUser, null, true);
if ($res < 1) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
$this->updateCurrentUserRights(AuthService::getLoggedUser());
if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
$webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
}
}
if ($success === false) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
ConfService::switchRootDir($this->repositoryId);
return true;
}
示例10: init
public function init($options)
{
// Migrate new version of the options
if (isset($options["CMS_TYPE"])) {
// Transform MASTER_URL + LOGIN_URI to MASTER_HOST, MASTER_URI, LOGIN_URL, LOGOUT_URI
$options["SLAVE_MODE"] = "false";
$cmsOpts = $options["CMS_TYPE"];
if ($cmsOpts["cms"] != "custom") {
$loginURI = $cmsOpts["LOGIN_URI"];
if (strpos($cmsOpts["MASTER_URL"], "http") === 0) {
$parse = parse_url($cmsOpts["MASTER_URL"]);
$rootHost = $parse["host"];
$rootURI = $parse["path"];
} else {
$rootHost = "";
$rootURI = $cmsOpts["MASTER_URL"];
}
$cmsOpts["MASTER_HOST"] = $rootHost;
$cmsOpts["LOGIN_URL"] = $cmsOpts["MASTER_URI"] = AJXP_Utils::securePath("/" . $rootURI . "/" . $loginURI);
$logoutAction = $cmsOpts["LOGOUT_ACTION"];
switch ($cmsOpts["cms"]) {
case "wp":
$cmsOpts["LOGOUT_URL"] = $logoutAction == "back" ? $cmsOpts["MASTER_URL"] : $cmsOpts["MASTER_URL"] . "/wp-login.php?action=logout";
break;
case "joomla":
$cmsOpts["LOGOUT_URL"] = $cmsOpts["LOGIN_URL"];
break;
case "drupal":
$cmsOpts["LOGOUT_URL"] = $logoutAction == "back" ? $cmsOpts["LOGIN_URL"] : $cmsOpts["MASTER_URL"] . "/user/logout";
break;
default:
break;
}
}
$options = array_merge($options, $cmsOpts);
}
$this->slaveMode = $options["SLAVE_MODE"] == "true";
if ($this->slaveMode && ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth")) {
$contribs = $this->xPath->query("registry_contributions/external_file");
foreach ($contribs as $contribNode) {
if ($contribNode->getAttribute('filename') == 'plugins/core.auth/standard_auth_actions.xml') {
$contribNode->parentNode->removeChild($contribNode);
}
}
}
parent::init($options);
$options = $this->options;
$this->usersSerFile = $options["USERS_FILEPATH"];
$this->secret = $options["SECRET"];
$this->urls = array($options["LOGIN_URL"], $options["LOGOUT_URL"]);
}
示例11: doTest
public function doTest()
{
if (!is_writable(AJXP_CACHE_DIR)) {
$this->testedParams["Command Line Available"] = "No";
$this->failedLevel = "warning";
$this->failedInfo = "Php command line not detected (cache directory not writeable), this is NOT BLOCKING, but enabling it could allow to send some long tasks in background. If you do not have the ability to tweak your server, you can safely ignore this warning.";
return FALSE;
}
$windows = PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows";
$sModeExecDir = ini_get("safe_mode_exec_dir");
$safeEnabled = ini_get("safe_mode") || !empty($sModeExecDir);
$disabled_functions = explode(',', ini_get('disable_functions'));
$fName = $windows ? "popen" : "exec";
$notFoundFunction = in_array($fName, $disabled_functions) || !function_exists($fName) || !is_callable($fName);
$comEnabled = class_exists("COM");
$useCOM = false;
if ($safeEnabled || $notFoundFunction) {
if ($comEnabled) {
$useCOM = true;
} else {
$this->testedParams["Command Line Available"] = "No";
$this->failedLevel = "warning";
$this->failedInfo = "Php command line not detected (there seem to be some safe_mode or a-like restriction), this is NOT BLOCKING, but enabling it could allow to send some long tasks in background. If you do not have the ability to tweak your server, you can safely ignore this warning.";
return FALSE;
}
}
$defaultCli = ConfService::getCoreConf("CLI_PHP");
if ($defaultCli == null) {
$defaultCli = "php";
}
$token = md5(time());
$robustCacheDir = str_replace("/", DIRECTORY_SEPARATOR, AJXP_CACHE_DIR);
$logDir = $robustCacheDir . DIRECTORY_SEPARATOR . "cmd_outputs";
if (!is_dir($logDir)) {
mkdir($logDir, 0755);
}
$logFile = $logDir . "/" . $token . ".out";
$testScript = AJXP_CACHE_DIR . "/cli_test.php";
file_put_contents($testScript, "<?php file_put_contents('" . $robustCacheDir . DIRECTORY_SEPARATOR . "cli_result.php', 'cli'); ?>");
$cmd = $defaultCli . " " . $robustCacheDir . DIRECTORY_SEPARATOR . "cli_test.php";
if ($windows) {
/* Next 2 lines modified by rmeske: Need to wrap the folder and file paths in double quotes. */
$cmd = $defaultCli . " " . chr(34) . $robustCacheDir . DIRECTORY_SEPARATOR . "cli_test.php" . chr(34);
$cmd .= " > " . chr(34) . $logFile . chr(34);
$comCommand = $cmd;
if ($useCOM) {
$WshShell = new COM("WScript.Shell");
$res = $WshShell->Run("cmd /C {$comCommand}", 0, false);
} else {
$tmpBat = implode(DIRECTORY_SEPARATOR, array(str_replace("/", DIRECTORY_SEPARATOR, AJXP_INSTALL_PATH), "data", "tmp", md5(time()) . ".bat"));
$cmd .= "\n DEL " . chr(34) . $tmpBat . chr(34);
file_put_contents($tmpBat, $cmd);
/* Following 1 line modified by rmeske: The windows Start command identifies the first parameter in quotes as a title for the window. Therefore, when enclosing a command with double quotes you must include a window title first
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME] [/WAIT] [/B] [command / program] [parameters]
*/
@pclose(@popen('start /b "CLI" "' . $tmpBat . '"', 'r'));
sleep(1);
// Failed, but we can try with COM
if (!is_file(AJXP_CACHE_DIR . "/cli_result.php") && $comEnabled) {
$useCOM = true;
$WshShell = new COM("WScript.Shell");
$res = $WshShell->Run("cmd /C {$comCommand}", 0, false);
}
}
} else {
new UnixProcess($cmd, $logFile);
}
sleep(1);
$availability = true;
if (is_file(AJXP_CACHE_DIR . "/cli_result.php")) {
$this->testedParams["Command Line Available"] = "Yes";
unlink(AJXP_CACHE_DIR . "/cli_result.php");
if ($useCOM) {
$this->failedLevel = "warning";
$availability = true;
$this->failedInfo = "Php command line detected, but using the windows COM extension. Just make sure to <b>enable COM</b> in the Pydio Core Options";
} else {
$this->failedInfo = "Php command line detected, this will allow to send some tasks in background. Enable it in the Pydio Core Options";
}
} else {
if (is_file($logFile)) {
$log = file_get_contents($logFile);
unlink($logFile);
}
$this->testedParams["Command Line Available"] = "No : {$log}";
$this->failedLevel = "warning";
$this->failedInfo = "Php command line not detected, this is NOT BLOCKING, but enabling it could allow to send some long tasks in background. If you do not have the ability to tweak your server, you can safely ignore this warning.";
if ($windows) {
$this->failedInfo .= "<br> On Windows, try to activate the php COM extension, and set correct rights to the cmd exectuble to make it runnable by the web server, this should solve the problem.";
}
$availability = false;
}
unlink(AJXP_CACHE_DIR . "/cli_test.php");
return $availability;
}
示例12: switchAction
//.........这里部分代码省略.........
if ($xmlNode->getAttribute("expose") == "true") {
$parentNode = $xmlNode->parentNode->parentNode;
$pluginId = $parentNode->getAttribute("id");
if (empty($pluginId)) {
$pluginId = $parentNode->nodeName . "." . $parentNode->getAttribute("name");
}
$name = $xmlNode->getAttribute("name");
if (isset($data[$name]) || $data[$name] === "") {
if ($data[$name] == "__AJXP_VALUE_SET__") {
continue;
}
if ($data[$name] === "" || $userObject->parentRole == null || $userObject->parentRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name] || $userObject->personalRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name]) {
$userObject->personalRole->setParameterValue($pluginId, $name, $data[$name]);
$rChanges = true;
}
}
}
}
}
if ($rChanges) {
AuthService::updateRole($userObject->personalRole, $userObject);
$userObject->recomputeMergedRole();
if ($action == "custom_data_edit") {
AuthService::updateUser($userObject);
}
}
if ($action == "user_create_user") {
AJXP_Controller::applyHook($updating ? "user.after_update" : "user.after_create", array($userObject));
if (isset($data["send_email"]) && $data["send_email"] == true && !empty($data["email"])) {
$mailer = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("mailer");
if ($mailer !== false) {
$mess = ConfService::getMessages();
$link = AJXP_Utils::detectServerURL();
$apptitle = ConfService::getCoreConf("APPLICATION_TITLE");
$subject = str_replace("%s", $apptitle, $mess["507"]);
$body = str_replace(array("%s", "%link", "%user", "%pass"), array($apptitle, $link, $data["new_user_id"], $data["new_password"]), $mess["508"]);
$mailer->sendMail(array($data["email"]), $subject, $body);
}
}
echo "SUCCESS";
} else {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage($mess["241"], null);
AJXP_XMLWriter::close();
}
break;
case "user_update_user":
if (!isset($httpVars["user_id"])) {
throw new Exception("invalid arguments");
}
$userId = $httpVars["user_id"];
if (!AuthService::userExists($userId)) {
throw new Exception("Cannot find user");
}
$userObject = ConfService::getConfStorageImpl()->createUserObject($userId);
if ($userObject->getParent() != AuthService::getLoggedUser()->getId()) {
throw new Exception("Cannot find user");
}
$paramsString = ConfService::getCoreConf("NEWUSERS_EDIT_PARAMETERS", "conf");
$result = array();
$params = explode(",", $paramsString);
foreach ($params as $p) {
$result[$p] = $userObject->personalRole->filterParameterValue("core.conf", $p, AJXP_REPO_SCOPE_ALL, "");
}
HTMLWriter::charsetHeader("application/json");
echo json_encode($result);
示例13: createOrLoadSharedRepository
/**
* @param array $httpVars
* @param bool $update
* @return Repository
* @throws Exception
*/
protected function createOrLoadSharedRepository($httpVars, &$update)
{
if (!isset($httpVars["repo_label"]) || $httpVars["repo_label"] == "") {
$mess = ConfService::getMessages();
throw new Exception($mess["349"]);
}
if (isset($httpVars["repository_id"])) {
$editingRepo = ConfService::getRepositoryById($httpVars["repository_id"]);
$update = true;
}
// CHECK REPO DOES NOT ALREADY EXISTS WITH SAME LABEL
$label = AJXP_Utils::sanitize(AJXP_Utils::securePath($httpVars["repo_label"]), AJXP_SANITIZE_HTML);
$description = AJXP_Utils::sanitize(AJXP_Utils::securePath($httpVars["repo_description"]), AJXP_SANITIZE_HTML);
$exists = $this->checkRepoWithSameLabel($label, isset($editingRepo) ? $editingRepo : null);
if ($exists) {
$mess = ConfService::getMessages();
throw new Exception($mess["share_center.352"]);
}
$loggedUser = AuthService::getLoggedUser();
if (isset($editingRepo)) {
$this->getShareStore()->testUserCanEditShare($editingRepo->getOwner(), $editingRepo->options);
$newRepo = $editingRepo;
$replace = false;
if ($editingRepo->getDisplay() != $label) {
$newRepo->setDisplay($label);
$replace = true;
}
if ($editingRepo->getDescription() != $description) {
$newRepo->setDescription($description);
$replace = true;
}
$newScope = isset($httpVars["share_scope"]) && $httpVars["share_scope"] == "public" ? "public" : "private";
$oldScope = $editingRepo->getOption("SHARE_ACCESS");
$currentOwner = $editingRepo->getOwner();
if ($newScope != $oldScope && $currentOwner != AuthService::getLoggedUser()->getId()) {
$mess = ConfService::getMessages();
throw new Exception($mess["share_center.224"]);
}
if ($newScope !== $oldScope) {
$editingRepo->addOption("SHARE_ACCESS", $newScope);
$replace = true;
}
if (isset($httpVars["transfer_owner"])) {
$newOwner = $httpVars["transfer_owner"];
if ($newOwner != $currentOwner && $currentOwner != AuthService::getLoggedUser()->getId()) {
$mess = ConfService::getMessages();
throw new Exception($mess["share_center.224"]);
}
$editingRepo->setOwnerData($editingRepo->getParentId(), $newOwner, $editingRepo->getUniqueUser());
$replace = true;
}
if ($replace) {
ConfService::replaceRepository($newRepo->getId(), $newRepo);
}
} else {
$options = $this->accessDriver->makeSharedRepositoryOptions($httpVars, $this->repository);
// TMP TESTS
$options["SHARE_ACCESS"] = $httpVars["share_scope"];
$newRepo = $this->repository->createSharedChild($label, $options, $this->repository->getId(), $loggedUser->getId(), null);
$gPath = $loggedUser->getGroupPath();
if (!empty($gPath) && !ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf")) {
$newRepo->setGroupPath($gPath);
}
$newRepo->setDescription($description);
// Smells like dirty hack!
$newRepo->options["PATH"] = SystemTextEncoding::fromStorageEncoding($newRepo->options["PATH"]);
if (isset($httpVars["filter_nodes"])) {
$newRepo->setContentFilter(new ContentFilter($httpVars["filter_nodes"]));
}
ConfService::addRepository($newRepo);
}
return $newRepo;
}
示例14: replaceAjxpXmlKeywords
/**
* Dynamically replace XML keywords with their live values.
* AJXP_SERVER_ACCESS, AJXP_MIMES_*,AJXP_ALL_MESSAGES, etc.
* @static
* @param string $xml
* @param bool $stripSpaces
* @return mixed
*/
public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
{
$messages = ConfService::getMessages();
$confMessages = ConfService::getMessagesConf();
$matches = array();
if (isset($_SESSION["AJXP_SERVER_PREFIX_URI"])) {
//$xml = str_replace("AJXP_THEME_FOLDER", $_SESSION["AJXP_SERVER_PREFIX_URI"].AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", $_SESSION["AJXP_SERVER_PREFIX_URI"] . AJXP_SERVER_ACCESS, $xml);
} else {
//$xml = str_replace("AJXP_THEME_FOLDER", AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", AJXP_SERVER_ACCESS, $xml);
}
$xml = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $xml);
$xml = str_replace("AJXP_MIMES_EDITABLE", AJXP_Utils::getAjxpMimes("editable"), $xml);
$xml = str_replace("AJXP_MIMES_IMAGE", AJXP_Utils::getAjxpMimes("image"), $xml);
$xml = str_replace("AJXP_MIMES_AUDIO", AJXP_Utils::getAjxpMimes("audio"), $xml);
$xml = str_replace("AJXP_MIMES_ZIP", AJXP_Utils::getAjxpMimes("zip"), $xml);
$authDriver = ConfService::getAuthDriverImpl();
if ($authDriver != NULL) {
$loginRedirect = $authDriver->getLoginRedirect();
$xml = str_replace("AJXP_LOGIN_REDIRECT", $loginRedirect !== false ? "'" . $loginRedirect . "'" : "false", $xml);
}
$xml = str_replace("AJXP_REMOTE_AUTH", "false", $xml);
$xml = str_replace("AJXP_NOT_REMOTE_AUTH", "true", $xml);
$xml = str_replace("AJXP_ALL_MESSAGES", "MessageHash=" . json_encode(ConfService::getMessages()) . ";", $xml);
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
$xml = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $xml);
}
}
if (preg_match_all("/CONF_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("CONF_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if (preg_match_all("/MIXIN_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("MIXIN_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if ($stripSpaces) {
$xml = preg_replace("/[\n\r]?/", "", $xml);
$xml = preg_replace("/\t/", " ", $xml);
}
$xml = str_replace(array('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"'), "", $xml);
$tab = array(&$xml);
AJXP_Controller::applyIncludeHook("xml.filter", $tab);
return $xml;
}
示例15: switchAction
//.........这里部分代码省略.........
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) {
$content = str_replace("//AJXP_JSON_START_PARAMETERS", "startParameters = " . $JSON_START_PARAMETERS . ";", $content);
}
print $content;
}
break;
//------------------------------------
// GET CONFIG FOR BOOT
//------------------------------------
//------------------------------------
// GET CONFIG FOR BOOT
//------------------------------------
case "get_boot_conf":
if (isset($_GET["server_prefix_uri"])) {
$_SESSION["AJXP_SERVER_PREFIX_URI"] = $_GET["server_prefix_uri"];
}
$config = array();
$config["ajxpResourcesFolder"] = "plugins/gui.ajax/res";
$config["ajxpServerAccess"] = AJXP_SERVER_ACCESS;
$config["zipEnabled"] = ConfService::zipEnabled();
$config["multipleFilesDownloadEnabled"] = ConfService::getCoreConf("ZIP_CREATION");
$config["customWording"] = array("welcomeMessage" => $this->pluginConf["CUSTOM_WELCOME_MESSAGE"], "title" => ConfService::getCoreConf("APPLICATION_TITLE"), "icon" => $this->pluginConf["CUSTOM_ICON"], "iconWidth" => $this->pluginConf["CUSTOM_ICON_WIDTH"], "iconHeight" => $this->pluginConf["CUSTOM_ICON_HEIGHT"], "iconOnly" => $this->pluginConf["CUSTOM_ICON_ONLY"], "titleFontSize" => $this->pluginConf["CUSTOM_FONT_SIZE"]);
$config["usersEnabled"] = AuthService::usersEnabled();
$config["loggedUser"] = AuthService::getLoggedUser() != null;
$config["currentLanguage"] = ConfService::getLanguage();
$config["session_timeout"] = intval(ini_get("session.gc_maxlifetime"));
if (!isset($this->pluginConf["CLIENT_TIMEOUT_TIME"]) || $this->pluginConf["CLIENT_TIMEOUT_TIME"] == "") {
$to = $config["session_timeout"];
} else {
$to = $this->pluginConf["CLIENT_TIMEOUT_TIME"];
}
$config["client_timeout"] = $to;
$config["client_timeout_warning"] = $this->pluginConf["CLIENT_TIMEOUT_WARN"];
$config["availableLanguages"] = ConfService::getConf("AVAILABLE_LANG");
$config["usersEditable"] = ConfService::getAuthDriverImpl()->usersEditable();
$config["ajxpVersion"] = AJXP_VERSION;
$config["ajxpVersionDate"] = AJXP_VERSION_DATE;
if (stristr($_SERVER["HTTP_USER_AGENT"], "msie 6")) {
$config["cssResources"] = array("css/pngHack/pngHack.css");
}
if (!empty($this->pluginConf['GOOGLE_ANALYTICS_ID'])) {
$config["googleAnalyticsData"] = array("id" => $this->pluginConf['GOOGLE_ANALYTICS_ID'], "domain" => $this->pluginConf['GOOGLE_ANALYTICS_DOMAIN'], "event" => $this->pluginConf['GOOGLE_ANALYTICS_EVENT']);
}
$config["i18nMessages"] = ConfService::getMessages();
$config["password_min_length"] = ConfService::getCoreConf("PASSWORD_MINLENGTH", "auth");
$config["SECURE_TOKEN"] = AuthService::generateSecureToken();
$config["streaming_supported"] = "true";
$config["theme"] = $this->pluginConf["GUI_THEME"];
header("Content-type:application/json;charset=UTF-8");
print json_encode($config);
break;
default:
break;
}
return false;
}