diff options
Diffstat (limited to 'modules-available/main')
-rw-r--r-- | modules-available/main/hooks/cron.inc.php | 4 | ||||
-rw-r--r-- | modules-available/main/hooks/translation.inc.php | 5 | ||||
-rw-r--r-- | modules-available/main/install.inc.php | 74 | ||||
-rw-r--r-- | modules-available/main/lang/de/template-tags.json | 1 | ||||
-rw-r--r-- | modules-available/main/lang/en/template-tags.json | 9 | ||||
-rw-r--r-- | modules-available/main/page.inc.php | 4 | ||||
-rw-r--r-- | modules-available/main/templates/main-menu.html | 4 |
7 files changed, 82 insertions, 19 deletions
diff --git a/modules-available/main/hooks/cron.inc.php b/modules-available/main/hooks/cron.inc.php index 89c91fcc..5b20b6d0 100644 --- a/modules-available/main/hooks/cron.inc.php +++ b/modules-available/main/hooks/cron.inc.php @@ -10,6 +10,10 @@ case 3: case 4: 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 92ad4db1..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` )"); } // ####################### @@ -80,6 +120,29 @@ 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/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/template-tags.json b/modules-available/main/lang/en/template-tags.json index 6b7ded26..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 installation. 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}} |