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

This commit is contained in:
Uwe Steinmann 2020-12-01 18:38:22 +01:00
commit 3e0e8a1b8d
9 changed files with 60 additions and 26 deletions

View File

@ -117,7 +117,7 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
}
if($settings->_enableEmail) {
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword));
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword), 'email');
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {

View File

@ -30,25 +30,35 @@ class SeedDMS_NotificationService {
$this->services = array();
}
public function addService($service) {
$this->services[] = $service;
public function addService($service, $name='') {
$this->services[$name ? $name : md5(uniqid())] = $service;
}
public function getServices() {
return $this->services;
}
public function toIndividual($sender, $recipient, $subject, $message, $params=array()) {
foreach($this->services as $service) {
return $service->toIndividual($sender, $recipient, $subject, $message, $params);
foreach($this->services as $name => $service) {
if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipient, $subject, $message, $params)) {
return $service->toIndividual($sender, $recipient, $subject, $message, $params);
}
}
}
public function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) {
foreach($this->services as $service) {
return $service->toGroup($sender, $groupRecipient, $subject, $message, $params);
foreach($this->services as $name => $service) {
if(!is_callable([$service, 'filter']) || $service->filter($sender, $groupRecipient, $subject, $message, $params)) {
return $service->toGroup($sender, $groupRecipient, $subject, $message, $params);
}
}
}
public function toList($sender, $recipients, $subject, $message, $params=array()) {
foreach($this->services as $service) {
return $service->toList($sender, $recipients, $subject, $message, $params);
foreach($this->services as $name => $service) {
if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipients, $subject, $message, $params)) {
return $service->toList($sender, $recipients, $subject, $message, $params);
}
}
}

View File

@ -140,6 +140,10 @@ class Settings { /* {{{ */
var $_availablelanguages = array();
// default language (name of a subfolder in folder "languages")
var $_language = "en_GB";
// default date format
var $_dateformat = "Y-m-d";
// default date/time format
var $_datetimformat = "Y-m-d H:i:s";
// users are notified about document-changes that took place within the last $_updateNotifyTime seconds
var $_updateNotifyTime = 86400;
// files with one of the following endings can be viewed online
@ -501,6 +505,8 @@ class Settings { /* {{{ */
$this->_footNote = strval($tab["footNote"]);
$this->_printDisclaimer = Settings::boolVal($tab["printDisclaimer"]);
$this->_language = strval($tab["language"]);
$this->_dateformat = strval($tab["dateformat"]);
$this->_datetimeformat = strval($tab["datetimeformat"]);
if(trim(strval($tab["availablelanguages"])))
$this->_availablelanguages = explode(',',strval($tab["availablelanguages"]));
$this->_theme = strval($tab["theme"]);
@ -892,6 +898,8 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "footNote", $this->_footNote);
$this->setXMLAttributValue($node, "printDisclaimer", $this->_printDisclaimer);
$this->setXMLAttributValue($node, "language", $this->_language);
$this->setXMLAttributValue($node, "dateformat", $this->_dateformat);
$this->setXMLAttributValue($node, "datetimeformat", $this->_datetimeformat);
$this->setXMLAttributValue($node, "availablelanguages", implode(',', $this->_availablelanguages));
$this->setXMLAttributValue($node, "theme", $this->_theme);
$this->setXMLAttributValue($node, "overrideTheme", $this->_overrideTheme);

View File

@ -27,11 +27,23 @@ function formatted_size($size_bytes) { /* {{{ */
} /* }}} */
function getReadableDate($timestamp) { /* {{{ */
return date("Y-m-d", $timestamp);
global $settings;
if(!is_numeric($timestamp))
$timestamp = strtotime($timestamp);
if($settings->_dateformat)
return date($settings->_dateformat, $timestamp);
else
return date("Y-m-d", $timestamp);
} /* }}} */
function getLongReadableDate($timestamp) { /* {{{ */
return date("Y-m-d H:i:s", $timestamp);
global $settings;
if(!is_numeric($timestamp))
$timestamp = strtotime($timestamp);
if($settings->_datetimeformat)
return date($settings->_datetimeformat, $timestamp);
else
return date("Y-m-d H:i:s", $timestamp);
} /* }}} */
/*

View File

@ -16,21 +16,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.Utils.php");
include("../inc/inc.Language.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassNotificationService.php");
include("../inc/inc.ClassEmailNotify.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassController.php");
require_once("../inc/inc.Settings.php");
require_once("../inc/inc.LogInit.php");
require_once("../inc/inc.Utils.php");
require_once("../inc/inc.Language.php");
require_once("../inc/inc.Init.php");
require_once("../inc/inc.Extension.php");
require_once("../inc/inc.DBInit.php");
require_once("../inc/inc.ClassNotificationService.php");
require_once("../inc/inc.ClassEmailNotify.php");
require_once("../inc/inc.ClassUI.php");
require_once("../inc/inc.ClassController.php");
require_once("../inc/inc.ClassSession.php");
include("../inc/inc.ClassPasswordStrength.php");
include("../inc/inc.ClassPasswordHistoryManager.php");
require_once("../inc/inc.ClassPasswordStrength.php");
require_once("../inc/inc.ClassPasswordHistoryManager.php");
/* Load session */
if (isset($_COOKIE["mydms_session"])) {

View File

@ -59,6 +59,8 @@ if ($action == "saveSettings")
$settings->_footNote = $_POST["footNote"];
$settings->_printDisclaimer = getBoolValue("printDisclaimer");
$settings->_language = $_POST["language"];
$settings->_dateformat = $_POST["dateformat"];
$settings->_datetimeformat = $_POST["datetimeformat"];
if(empty($_POST["availablelanguages"]))
$settings->_availablelanguages = array();
else

View File

@ -2845,7 +2845,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<a draggable=\"false\" href=\"../out/out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a>";
if(isset($extracontent['below_title']))
$content .= $extracontent['below_title'];
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $latestContent->getDate())."</b>".($document->expires() ? ", ".getMLText('expires').": <b>".getReadableDate($document->getExpires())."</b>" : "")."</span>";
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".getReadableDate($document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".getReadableDate($latestContent->getDate())."</b>".($document->expires() ? ", ".getMLText('expires').": <b>".getReadableDate($document->getExpires())."</b>" : "")."</span>";
if($comment) {
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
}

View File

@ -646,7 +646,7 @@ foreach($facets as $facetname=>$values) {
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart();
$txt = $this->callHook('searchListHeader', $orderby, $orderdir);
$txt = $this->callHook('searchListHeader', $orderby, 'asc');
if(is_string($txt))
echo $txt;
else {

View File

@ -286,6 +286,8 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
<?php $this->showConfigCheckbox('settings_printDisclaimer', 'printDisclaimer'); ?>
<?php $this->showConfigOption('settings_available_languages', 'availablelanguages', getAvailableLanguages(), true, true); ?>
<?php $this->showConfigOption('settings_language', 'language', getAvailableLanguages(), false, true); ?>
<?php $this->showConfigText('settings_dateformat', 'dateformat'); ?>
<?php $this->showConfigText('settings_datetimeformat', 'datetimeformat'); ?>
<?php $this->showConfigOption('settings_theme', 'theme', UI::getStyles(), false, false); ?>
<?php $this->showConfigCheckbox('settings_overrideTheme', 'overrideTheme'); ?>
<?php $this->showConfigCheckbox('settings_onePageMode', 'onePageMode'); ?>