Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-01-26 13:31:08 +01:00
commit 23f17e291e
6 changed files with 25 additions and 5 deletions

View File

@ -97,6 +97,8 @@ class Settings { /* {{{ */
var $_coreDir = null;
// Path to SeedDMS_Lucene
var $_luceneClassDir = null;
// The base URL without _httpRoot
var $_baseUrl = "";
// The relative path in the URL, after the domain part.
var $_httpRoot = "/seeddms/";
// Where the uploaded files are stored (best to choose a directory that
@ -615,6 +617,7 @@ class Settings { /* {{{ */
if($node) {
$tab = $node[0]->attributes();
$this->_rootDir = strval($tab["rootDir"]);
$this->_baseUrl = strval($tab["baseUrl"]);
$this->_httpRoot = strval($tab["httpRoot"]);
$this->_contentDir = strval($tab["contentDir"]);
if($this->_contentDir && substr($this->_contentDir, -1, 1) != DIRECTORY_SEPARATOR)
@ -1003,6 +1006,7 @@ class Settings { /* {{{ */
$this->getXMLNode($xml, '/configuration', 'system');
$node = $this->getXMLNode($xml, '/configuration/system', 'server');
$this->setXMLAttributValue($node, "rootDir", $this->_rootDir);
$this->setXMLAttributValue($node, "baseUrl", $this->_baseUrl);
$this->setXMLAttributValue($node, "httpRoot", $this->_httpRoot);
$this->setXMLAttributValue($node, "contentDir", $this->_contentDir);
$this->setXMLAttributValue($node, "cacheDir", $this->_cacheDir);

View File

@ -807,7 +807,21 @@ function sendFile($filename) { /* {{{ */
* @return string
*/
function getBaseUrl() { /* {{{ */
return "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'];
global $settings;
if(!empty($settings->_baseUrl))
return $settings->_baseUrl;
if(isset($_SERVER['X-Forwarded-Host']))
$host = $_SERVER['X-Forwarded-Host'];
else
$host = $_SERVER['HTTP_HOST'];
if(isset($_SERVER['X-Forwarded-Proto']))
$ssl = $_SERVER['X-Forwarded-Proto'] == 'https';
else
$ssl = (isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0));
return "http".($ssl ? "s" : "")."://".$host;
} /* }}} */
function getToken($length){ /* {{{ */

View File

@ -169,6 +169,7 @@ if ($action == "saveSettings")
// SETTINGS - SYSTEM - SERVER
setDirValue("rootDir");
setStrValue("baseUrl");
setStrValue("httpRoot");
setDirValue("contentDir");
setDirValue("cacheDir");

View File

@ -424,6 +424,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
-->
<?php $this->showConfigHeadline('settings_Server'); ?>
<?php $this->showConfigText('settings_rootDir', 'rootDir'); ?>
<?php $this->showConfigText('settings_baseUrl', 'baseUrl'); ?>
<?php $this->showConfigText('settings_httpRoot', 'httpRoot'); ?>
<?php $this->showConfigText('settings_contentDir', 'contentDir'); ?>
<?php $this->showConfigText('settings_backupDir', 'backupDir'); ?>

View File

@ -1407,14 +1407,14 @@ $(document).ready(function() { /* {{{ */
);
SeedDMSTask.add = function(task) {
tasks.push(task);
return tasks.push(task);
}
SeedDMSTask.run = function() {
for(let task of tasks) {
if(counter % task.interval == 0) {
// console.log("Running task '" + task.name + "'");
task.func();
task.func(task);
}
}
//console.log(counter);

View File

@ -1463,14 +1463,14 @@ $(document).ready(function() { /* {{{ */
);
SeedDMSTask.add = function(task) {
tasks.push(task);
return tasks.push(task);
}
SeedDMSTask.run = function() {
for(let task of tasks) {
if(counter % task.interval == 0) {
// console.log("Running task '" + task.name + "'");
task.func();
task.func(task);
}
}
//console.log(counter);