From 68ff204f10adf9c1040f9bf735e7a57efc378925 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 12 Oct 2023 22:49:20 +0000 Subject: [PATCH] todos fixed --- .../defaultExcelExporter.xls.php | 1 - Admin/Install/settings.php | 2 +- Controller/ApiController.php | 31 +-------------- Controller/CliController.php | 16 +++++++- Theme/Api/Lang/de.lang.php | 2 +- Theme/Api/Lang/en.lang.php | 2 +- Theme/Backend/Lang/Navigation.de.lang.php | 4 +- Theme/Backend/Lang/da.lang.php | 2 +- Theme/Backend/Lang/de.lang.php | 38 +++++++++---------- Theme/Backend/Lang/en.lang.php | 8 ++-- 10 files changed, 45 insertions(+), 61 deletions(-) diff --git a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php index 9259928..ad89ed8 100755 --- a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php +++ b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php @@ -33,7 +33,6 @@ $excel = new DefaultExcel(); foreach ($data as $i => $row) { foreach ($row as $j => $cell) { - // @todo: fix 26 column overflow. $excel->getActiveSheet()->setCellValue(StringUtils::intToAlphabet($j + 1) . ($i + 1), $cell); } } diff --git a/Admin/Install/settings.php b/Admin/Install/settings.php index 99b0c95..2ac995a 100755 --- a/Admin/Install/settings.php +++ b/Admin/Install/settings.php @@ -19,7 +19,7 @@ return [ [ 'type' => 'setting', 'name' => SettingsEnum::PASSWORD_PATTERN, - 'content' => '/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[.,\/\(\)\{\}\[\]#?!@$%^&*+=\':"-]).{8,}$/', + 'content' => '/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[.,\/\(\)\{\}\[\]#?!@$%^&*+=\':-]).{8,}$/', 'module' => 'Admin', ], [ diff --git a/Controller/ApiController.php b/Controller/ApiController.php index a45f4ba..f39ec9d 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -633,20 +633,7 @@ final class ApiController extends Controller $new->group = $group ?? $new->group; $new->account = $account ?? $new->account; - // @todo: this function call seems stupid, it should just pass the $new object. - $this->app->appSettings->set([ - [ - 'id' => $new->id, - 'name' => $new->name, - 'content' => $new->content, - 'unit' => $new->unit, - 'app' => $new->app, - 'module' => $new->module, - 'group' => $new->group, - 'account' => $new->account, - 'isEncrypted' => $new->isEncrypted, - ], - ], false); + $this->app->appSettings->set([$new], false); $this->updateModel($request->header->account, $old, $new, SettingMapper::class, 'settings', $request->getOrigin()); } @@ -1332,8 +1319,6 @@ final class ApiController extends Controller * * @return array * - * @todo: implement - * * @since 1.0.0 */ private function validateGroupDelete(RequestAbstract $request) : array @@ -1981,6 +1966,7 @@ final class ApiController extends Controller || ($val['unit'] = !$request->hasData('unit')) || ($val['app'] = !$request->hasData('app')) || ($val['password'] = !$request->hasData('password')) + || ($val['terms'] = (($request->getDataBool('terms_required') ?? false) && ($request->getDataBool('terms') ?? false))) ) { return $val; } @@ -2094,13 +2080,6 @@ final class ApiController extends Controller */ private function createProfileForAccount(Account $account, RequestAbstract $request) : void { - // @todo: why do we need the following lines? - if (($request->getDataString('password') ?? '') === '' - || ($request->getDataString('user') ?? '') === '' - ) { - return; - } - $request->setData('iaccount-idlist', $account->id); $internalResponse = new HttpResponse(); @@ -3209,8 +3188,6 @@ final class ApiController extends Controller * * @return array * - * @todo: implement - * * @since 1.0.0 */ private function validateSettingsDelete(RequestAbstract $request) : array @@ -3277,8 +3254,6 @@ final class ApiController extends Controller * * @return array * - * @todo: implement - * * @since 1.0.0 */ private function validateApplicationUpdate(RequestAbstract $request) : array @@ -3326,8 +3301,6 @@ final class ApiController extends Controller * * @return array * - * @todo: implement - * * @since 1.0.0 */ private function validateApplicationDelete(RequestAbstract $request) : array diff --git a/Controller/CliController.php b/Controller/CliController.php index 8f6089c..1c6bfd1 100755 --- a/Controller/CliController.php +++ b/Controller/CliController.php @@ -15,6 +15,8 @@ declare(strict_types=1); namespace Modules\Admin\Controller; use Model\SettingMapper; +use Modules\Admin\Models\SettingsEnum; +use phpOMS\Application\ApplicationStatus; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; @@ -135,7 +137,14 @@ final class CliController extends Controller */ public function runEncryptionChangeFromHook(mixed ...$data) : void { - // @todo: start read only mode + /** @var \Model\Setting $setting */ + $setting = $this->app->appSettings->get(null, names: SettingsEnum::LOGIN_STATUS); + $oldMode = $setting->content; + + // Enter read only mode + $setting->content = (string) ApplicationStatus::READ_ONLY; + $this->app->appSetting->save([$setting]); + $mapper = SettingMapper::yield() ->where('isEncrypted', true); @@ -152,6 +161,9 @@ final class CliController extends Controller SettingMapper::update()->execute($setting); } - // @todo: end read only mode + + // Restore old mode + $setting->content = $oldMode; + $this->app->appSetting->save([$setting]); } } diff --git a/Theme/Api/Lang/de.lang.php b/Theme/Api/Lang/de.lang.php index 26bfc01..e5f2ec2 100755 --- a/Theme/Api/Lang/de.lang.php +++ b/Theme/Api/Lang/de.lang.php @@ -13,7 +13,7 @@ declare(strict_types=1); return ['Admin' => [ - 'AccountCreateMsg' => 'Account successfully created. Link: Account"', + 'AccountCreateMsg' => 'Account successfully created. Link: Account""', 'AccountCreateTitle' => 'Account', 'FormDataInvalid' => 'Form data invalid, please check your input', 'LOGIN_ERROR' => 'Login failed due to wrong login information.', diff --git a/Theme/Api/Lang/en.lang.php b/Theme/Api/Lang/en.lang.php index 26bfc01..e5f2ec2 100755 --- a/Theme/Api/Lang/en.lang.php +++ b/Theme/Api/Lang/en.lang.php @@ -13,7 +13,7 @@ declare(strict_types=1); return ['Admin' => [ - 'AccountCreateMsg' => 'Account successfully created. Link: Account"', + 'AccountCreateMsg' => 'Account successfully created. Link: Account""', 'AccountCreateTitle' => 'Account', 'FormDataInvalid' => 'Form data invalid, please check your input', 'LOGIN_ERROR' => 'Login failed due to wrong login information.', diff --git a/Theme/Backend/Lang/Navigation.de.lang.php b/Theme/Backend/Lang/Navigation.de.lang.php index 5f53dd2..f03caba 100755 --- a/Theme/Backend/Lang/Navigation.de.lang.php +++ b/Theme/Backend/Lang/Navigation.de.lang.php @@ -20,9 +20,9 @@ return ['Navigation' => [ 'Front' => 'Vorderseite', 'General' => 'Allgemein', 'Groups' => 'Gruppen', - 'Hooks' => '', + 'Hooks' => 'Hooks', 'Info' => 'Die Info', - 'List' => 'Aufführen', + 'List' => 'Liste', 'Log' => 'Protokoll', 'Members' => 'Mitglieder', 'Modules' => 'Module', diff --git a/Theme/Backend/Lang/da.lang.php b/Theme/Backend/Lang/da.lang.php index fd7660e..e1e22a3 100755 --- a/Theme/Backend/Lang/da.lang.php +++ b/Theme/Backend/Lang/da.lang.php @@ -188,7 +188,7 @@ return ['Admin' => [ 'Zip' => 'Zip.', 'active' => '', 'available' => '', - 'i:LoginRetries' => "Mængden af \u{200b}\u{200b}tilladte retries (-1 = ubegrænset)", + 'i:LoginRetries' => 'Mængden af ​​tilladte retries (-1 = ubegrænset)', 'i:PasswordChangeInterval' => 'Interval, hvor passager skal ændres (-1 = aldrig)', 'i:PasswordHistory' => 'Ny adgangskode skal være forskellig fra de sidste N-adgangskoder', 'i:PasswordRegex' => 'Adgangskode krav til brugere', diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 3a44a1f..475d5fa 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -52,7 +52,7 @@ return ['Admin' => [ 'Delete' => 'Löschen', 'Description' => 'Beschreibung', 'Design' => 'Entwurf', - 'Destination' => '', + 'Destination' => 'Ziel', 'Ele' => 'Ele.', 'Element' => 'Element', 'Email' => 'Email', @@ -68,9 +68,9 @@ return ['Admin' => [ 'GroupStatus4' => 'Versteckt', 'Groups' => 'Gruppen', 'Heavy' => 'Schwer', - 'Hook' => '', - 'Hooks' => '', - 'Images' => 'Bilde', + 'Hook' => 'Hook', + 'Hooks' => 'Hooks', + 'Images' => 'Bilder', 'Inactive' => 'Inaktiv', 'Install' => 'Installieren', 'Installed' => 'Eingerichtet', @@ -107,9 +107,9 @@ return ['Admin' => [ 'Numeric' => 'Numerisch', 'Organization' => 'Organisation', 'OrganizationName' => 'Organisationsname', - 'OwnPermission' => '', - 'Page' => 'Buchseite', - 'Pages' => '', + 'OwnPermission' => 'Eigene Rechte', + 'Page' => 'Seite', + 'Pages' => 'Seiten', 'Parent' => 'Elternteil', 'Parents' => 'Eltern', 'Password' => 'Passwort', @@ -127,16 +127,16 @@ return ['Admin' => [ 'Read' => 'Lesen', 'Release' => 'Freisetzung', 'Reset' => 'Zurücksetzen', - 'Route' => '', - 'Routes' => '', + 'Route' => 'Route', + 'Routes' => 'Routes', 'Running' => 'Betrieb', 'Sea' => 'Meer', 'Search' => 'Suche', 'Security' => 'Sicherheit', - 'ServerMode-1' => '', - 'ServerMode-2' => '', - 'ServerMode-3' => '', - 'ServerStatus' => '', + 'ServerMode-1' => 'Normal', + 'ServerMode-2' => 'Lesezugang', + 'ServerMode-3' => 'Deaktiviert', + 'ServerStatus' => 'Serverstatus', 'Settings' => 'Einstellungen', 'SettingsGeneral' => 'Einstellungen - Allgemein', 'Short' => 'Kurz', @@ -163,15 +163,15 @@ return ['Admin' => [ 'Timestamp' => 'Zeitstempel', 'Timezone' => 'Zeitzone', 'Total' => 'Gesamt', - 'Trigger' => '', + 'Trigger' => 'Trigger', 'Type' => 'Typ', 'Uninstall' => 'Deinstallieren', 'Unit' => 'Einheit', 'Update' => 'Aktualisieren', 'Uppercase' => 'In Großbuchstaben.', 'Username' => 'Nutzername', - 'Value' => '', - 'Verb' => '', + 'Value' => 'Wert', + 'Verb' => 'Verb', 'Version' => 'Ausführung', 'VeryFast' => 'Sehr schnell', 'VeryHeavy' => 'Sehr schwer', @@ -186,8 +186,8 @@ return ['Admin' => [ 'Website' => 'Webseite', 'Weight' => 'Gewicht', 'Zip' => 'Reißverschluss', - 'active' => '', - 'available' => '', + 'active' => 'aktiv', + 'available' => 'verfügbar', 'i:LoginRetries' => 'Betrag der erlaubten Wiederholungen (-1 = unbegrenzt)', 'i:PasswordChangeInterval' => 'Intervall, in dem die Passweiterung geändert werden müssen (-1 = niemals)', 'i:PasswordHistory' => 'Neues Passwort muss sich von den letzten n Kennwörtern unterscheiden', @@ -199,5 +199,5 @@ return ['Admin' => [ 'i:rc' => 'RE-Cache für jeden Benutzer zwingen.', 'i:rem' => 'IP-Adresse oder URL für den Fernzugriff.', 'i:timef' => 'Zeitformat.', - 'inactive' => '', + 'inactive' => 'inaktiv', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 0f71dec..79b7c9e 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -109,7 +109,7 @@ return ['Admin' => [ 'OrganizationName' => 'Organization Name', 'OwnPermission' => '', 'Page' => 'Page', - 'Pages' => '', + 'Pages' => 'Pages', 'Parent' => 'Parent', 'Parents' => 'Parents', 'Password' => 'Password', @@ -186,8 +186,8 @@ return ['Admin' => [ 'Website' => 'Website', 'Weight' => 'Weight', 'Zip' => 'Zip', - 'active' => '', - 'available' => '', + 'active' => 'active', + 'available' => 'available', 'i:LoginRetries' => 'Amount of allowed retries (-1 = unlimited)', 'i:PasswordChangeInterval' => 'Interval in which passwards need to be changed (-1 = never)', 'i:PasswordHistory' => 'New password has to be different from the last N passwords', @@ -199,5 +199,5 @@ return ['Admin' => [ 'i:rc' => 'Forcing re-cache for every user.', 'i:rem' => 'IP address or URL for remote access.', 'i:timef' => 'Time format.', - 'inactive' => '', + 'inactive' => 'inactive', ]];