summaryrefslogtreecommitdiffstats
path: root/modules-available/main
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/main')
-rw-r--r--modules-available/main/hooks/cron.inc.php6
-rw-r--r--modules-available/main/hooks/translation.inc.php5
-rw-r--r--modules-available/main/install.inc.php76
-rw-r--r--modules-available/main/lang/de/categories.json1
-rw-r--r--modules-available/main/lang/de/messages.json1
-rw-r--r--modules-available/main/lang/de/template-tags.json1
-rw-r--r--modules-available/main/lang/en/messages.json1
-rw-r--r--modules-available/main/lang/en/template-tags.json7
-rw-r--r--modules-available/main/page.inc.php4
-rw-r--r--modules-available/main/templates/main-menu.html4
10 files changed, 85 insertions, 21 deletions
diff --git a/modules-available/main/hooks/cron.inc.php b/modules-available/main/hooks/cron.inc.php
index bab27287..5b20b6d0 100644
--- a/modules-available/main/hooks/cron.inc.php
+++ b/modules-available/main/hooks/cron.inc.php
@@ -8,8 +8,12 @@ case 3:
Database::exec("DELETE FROM property WHERE dateline <> 0 AND dateline < UNIX_TIMESTAMP()");
break;
case 4:
- Database::exec("DELETE FROM callback WHERE (UNIX_TIMESTAMP() - dateline) > 86400");
+ Database::exec("DELETE FROM callback WHERE (UNIX_TIMESTAMP() - 86400) > dateline");
break;
+default:
+ // Do nothing
}
Trigger::checkCallbacks();
+
+Mailer::flushQueue(); \ No newline at end of file
diff --git a/modules-available/main/hooks/translation.inc.php b/modules-available/main/hooks/translation.inc.php
index 7590dcb6..28247374 100644
--- a/modules-available/main/hooks/translation.inc.php
+++ b/modules-available/main/hooks/translation.inc.php
@@ -18,11 +18,8 @@ $HANDLER['subsections'] = array(
* Global tags.
* This just returns the union of global tags of all languages, as there is no
* way to define a definite set of required global tags.
- *
- * @param Module $module
- * @return array dem tags
*/
-$HANDLER['grep_global-tags'] = function($module) {
+$HANDLER['grep_global-tags'] = function(Module $module): array {
$want = array();
foreach (Dictionary::getLanguages() as $lang) {
$want += Dictionary::getArray($module->getIdentifier(), 'global-tags', $lang);
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php
index ec8554fd..69c0da8f 100644
--- a/modules-available/main/install.inc.php
+++ b/modules-available/main/install.inc.php
@@ -21,17 +21,20 @@ $res[] = tableCreate('permission', "
$res[] = tableCreate('property', "
`name` varchar(50) NOT NULL,
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
- `value` text NOT NULL,
+ `value` mediumblob NOT NULL,
PRIMARY KEY (`name`),
KEY `dateline` (`dateline`)
");
$res[] = tableCreate('property_list', "
`name` varchar(50) NOT NULL,
+ `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
- `value` text NOT NULL,
+ `value` mediumblob NOT NULL,
KEY (`name`),
- KEY `dateline` (`dateline`)
+ KEY `dateline` (`dateline`),
+ KEY (`subkey`),
+ UNIQUE KEY `compound` (`name`, `subkey`)
");
$res[] = tableCreate('user', "
@@ -48,13 +51,50 @@ $res[] = tableCreate('user', "
UNIQUE KEY `login` (`login`)
");
+$res[] = tableCreate('session', "
+ `sid` char(50) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+ `userid` int(10) unsigned NOT NULL,
+ `dateline` int(10) unsigned NOT NULL DEFAULT '0',
+ `lastip` varchar(45) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+ `fixedip` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `data` blob NOT NULL,
+ PRIMARY KEY (`sid`),
+ KEY `dateline` (`dateline`)
+");
+
+$res[] = tableCreate('mail_queue', "
+ `mailid` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `rcpt` varchar(200) NOT NULL,
+ `subject` varchar(500) NOT NULL,
+ `body` blob NOT NULL,
+ `dateline` int(10) unsigned NOT NULL,
+ `configid` int(10) unsigned NOT NULL,
+ `nexttry` int(10) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`mailid`),
+ KEY (`configid`),
+ KEY (`nexttry`)
+");
+
+$res[] = tableCreate('mail_config', "
+ `configid` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `host` varchar(100) NOT NULL,
+ `port` smallint(5) UNSIGNED NOT NULL,
+ `ssl` ENUM('FORCE_NONE', 'NONE', 'IMPLICIT', 'EXPLICIT') NOT NULL,
+ `senderaddress` varchar(100) NOT NULL,
+ `replyto` varchar(100) NOT NULL,
+ `username` varchar(100) NOT NULL,
+ `password` varchar(100) NOT NULL,
+ PRIMARY KEY (`configid`)
+");
+
// Update path
// #######################
// ##### 2014-05-28
// Add dateline field to property table
if (!tableHasColumn('property', 'dateline')) {
- Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name` , ADD INDEX ( `dateline` )");
+ Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name`,
+ ADD INDEX ( `dateline` )");
}
// #######################
@@ -75,11 +115,34 @@ if (!tableHasColumn('callback', 'args')) {
// #######################
// ##### 2018-03-19
-// In preparation for LDAP/AD auth: Column to rembember origin server
+// In preparation for LDAP/AD auth: Column to remember origin server
if (!tableHasColumn('user', 'serverid')) {
Database::exec("ALTER TABLE `user` ADD `serverid` int(10) unsigned NULL DEFAULT NULL");
}
+// #######################
+// ##### 2022-07-04
+// Add subkey to property_list, make value mediumblob instead of text
+if (!tableHasColumn('property_list', 'subkey')) {
+ $ret = Database::exec("ALTER TABLE property_list
+ ADD COLUMN `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT AFTER `name`,
+ ADD KEY (`subkey`),
+ ADD UNIQUE KEY `compound` (`name`, `subkey`)");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Cannot add subkey to property_list: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+foreach (['property', 'property_list'] as $table) {
+ if (stripos(tableColumnType($table, 'value'), 'mediumblob') === false) {
+ $ret = Database::exec("ALTER TABLE `$table` MODIFY `value` mediumblob NOT NULL");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, "Cannot change value column of $table to mediumblob: " . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+ }
+}
+
// Make sure that if any users exist, one of the has UID=1, otherwise if the permission module is
// used we'd lock out everyone
$someUser = Database::queryFirst('SELECT userid FROM user ORDER BY userid ASC LIMIT 1');
@@ -87,6 +150,9 @@ if ($someUser !== false && (int)$someUser['userid'] !== 1) {
Database::exec('UPDATE user SET userid = 1 WHERE userid = :oldid', ['oldid' => $someUser['userid']]);
}
+$res[] = tableAddConstraint('mail_queue', 'configid', 'mail_config', 'configid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+
// Create response for browser
if (in_array(UPDATE_DONE, $res)) {
diff --git a/modules-available/main/lang/de/categories.json b/modules-available/main/lang/de/categories.json
index 31f5bca0..5e06d259 100644
--- a/modules-available/main/lang/de/categories.json
+++ b/modules-available/main/lang/de/categories.json
@@ -1,5 +1,4 @@
{
- "beta": "Beta",
"content": "Inhalt",
"etc": "Weiteres",
"settings-client": "Einstellungen (Client)",
diff --git a/modules-available/main/lang/de/messages.json b/modules-available/main/lang/de/messages.json
index b6c2a5b3..13f89428 100644
--- a/modules-available/main/lang/de/messages.json
+++ b/modules-available/main/lang/de/messages.json
@@ -12,6 +12,7 @@
"task-error": "Ausf\u00fchrung fehlgeschlagen: {{0}}",
"taskmanager-error": "Verbindung zum Taskmanager fehlgeschlagen",
"taskmanager-format": "Taskmanager hat ung\u00fcltige Daten zur\u00fcckgeliefert",
+ "taskmanager-warning": "Taskmanager: {{0}}",
"token": "Ung\u00fcltiges Token. CSRF Angriff?",
"value-invalid": "Der Wert {{1}} ist ung\u00fcltig f\u00fcr die Option {{0}} und wurde ignoriert"
} \ No newline at end of file
diff --git a/modules-available/main/lang/de/template-tags.json b/modules-available/main/lang/de/template-tags.json
index 54373c56..1c9a97de 100644
--- a/modules-available/main/lang/de/template-tags.json
+++ b/modules-available/main/lang/de/template-tags.json
@@ -1,6 +1,5 @@
{
"lang_browserTime": "Browser",
- "lang_changePassword": "Passwort \u00e4ndern",
"lang_clockDriftWarn": "Die Uhrzeit des Satellitenservers weicht von der Uhrzeit des lokalen Systems\/Browsers ab. Bitte stellen Sie sicher, dass die Uhrzeit des Servers korrekt ist, da sonst zeitabh\u00e4ngige Einstellungen und Aufgaben evtl. nicht korrekt durchgef\u00fchrt werden.",
"lang_goTo": "Gehe zu",
"lang_intro": "Dies ist die bwLehrpool Konfigurationsoberfl\u00e4che.",
diff --git a/modules-available/main/lang/en/messages.json b/modules-available/main/lang/en/messages.json
index 2a9c9c0d..03e436cb 100644
--- a/modules-available/main/lang/en/messages.json
+++ b/modules-available/main/lang/en/messages.json
@@ -12,6 +12,7 @@
"task-error": "Execution failed: {{0}}",
"taskmanager-error": "Failed to connect to the Task Manager",
"taskmanager-format": "Task Manager has returned invalid data",
+ "taskmanager-warning": "Task Manager: {{0}}",
"token": "Invalid token. CSRF attack?",
"value-invalid": "The value {{1}} is invalid for option {{0}} and has been ignored"
} \ No newline at end of file
diff --git a/modules-available/main/lang/en/template-tags.json b/modules-available/main/lang/en/template-tags.json
index 1abd6dbb..9f2fee42 100644
--- a/modules-available/main/lang/en/template-tags.json
+++ b/modules-available/main/lang/en/template-tags.json
@@ -1,10 +1,9 @@
{
"lang_browserTime": "Browser",
- "lang_changePassword": "Change password",
"lang_clockDriftWarn": "The local system's\/browser's time doesn't match the server's time. Please make sure the server's clock is running correctly, otherwise time sensitive settings or tasks might not work properly.",
"lang_goTo": "Go to",
"lang_intro": "This is the bwLehrpool configuration interface.",
- "lang_introGuest": "This is the administration interface of the local bwLehrpool intallation. Please authenticate yourself to adjust settings.",
+ "lang_introGuest": "This is the administration interface of the local bwLehrpool installation. Please authenticate yourself to access settings.",
"lang_language": "Language",
"lang_loggedInPrefix": "Logged in as",
"lang_loggedInSuffix": " ",
@@ -14,8 +13,8 @@
"lang_noExistingAccount": "No account has been created yet. Sign up to become the administrator.",
"lang_register": "Register",
"lang_serverTime": "Server",
- "lang_toggleNavigation": "toggle navigation",
+ "lang_toggleNavigation": "Toggle navigation",
"lang_warning": "Warning",
- "lang_warningDebug": "Debug mode active!",
+ "lang_warningDebug": "Debug mode is enabled!",
"lang_welcome": "Welcome"
} \ No newline at end of file
diff --git a/modules-available/main/page.inc.php b/modules-available/main/page.inc.php
index baea8350..b0d7d125 100644
--- a/modules-available/main/page.inc.php
+++ b/modules-available/main/page.inc.php
@@ -33,12 +33,12 @@ class Page_Main extends Page
}
// Update warning state
- Property::setNeedsSetup($needSetup ? 1 : 0);
+ Property::setNeedsSetup($needSetup);
}
protected function doAjax()
{
- User::isLoggedIn();
+ User::load();
die('Status: DB running');
}
diff --git a/modules-available/main/templates/main-menu.html b/modules-available/main/templates/main-menu.html
index 35b7f57f..3f44e9b4 100644
--- a/modules-available/main/templates/main-menu.html
+++ b/modules-available/main/templates/main-menu.html
@@ -55,12 +55,11 @@
<ul class="nav navbar-nav navbar-right visible-xs visible-lg">
{{#user}}
- <li><span>{{lang_loggedInPrefix}} {{user}} {{lang_loggedInSuffix}}</span></li>
+ <li><span>{{lang_loggedInPrefix}} <a href="?do=session">{{user}}</a> {{lang_loggedInSuffix}}</span></li>
<li>
<form id="logoutForm" method="post" action="?do=session">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="logout">
- <a href="?do=session" class="btn btn-default btn-xs">{{lang_changePassword}}</a>
<button class="btn btn-default btn-xs" type="submit">{{lang_logout}}</button>
</form>
</li>
@@ -80,7 +79,6 @@
<ul class="dropdown-menu">
<!--<li><a href="#">Settings</a></li> -->
<!--<li role="separator" class="divider"></li> -->
- <li><a href="?do=session">{{lang_changePassword}}</a></li>
<li><a href="#" onclick="$('#logoutForm').submit();">{{lang_logout}}</a></li>
</ul>
{{/user}}