Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 65 additions & 4 deletions config/_config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* For more information about this config.php file and options visit:
* @link https://module-loader.de/docs/config_config.php
Expand All @@ -9,31 +10,91 @@
* User specific settings used for logging in.
*
* The default password is 'root'. This will be overwritten when you create a new account.
* You can update the passwort via GUI or follow this link:
* https://module-loader.de/documentation.php#update-password
*/
'username' => 'root',
'password' => '$2y$12$h7klHtKaX4jDSHIf0KEvNeSNCCrlZFz6Fy5Y7e0wcfYu3I9W0JCIW',
'accessToken' => '',

/**
* Modules for the MMLC are downloaded in this folder.
*
* Default: 'Modules'
*/
'modulesLocalDir' => 'Modules',


/**
* The URL to the MMLS API that the MMLC can use to obtain modules and updates.
*
* Default: 'https://app.module-loader.de/api.php'
*/
'remoteAddress' => 'https://app.module-loader.de/api.php',

/**
* Settings revolving around MMLC itself.
* You can choose between copy and link. If you are using the MMLC in a live shop, select copy. If you are
* developing with the MMLC Module, choose link.
*
* @param string installMode copy
* @param string selfUpdate stable, latest
* Values: copy, link
* Default: 'copy'
*/
'installMode' => 'copy',

/**
* You can choose between strict and lax. With strict the dependencies of modules with a version lower than 1.0.0
* are controlled more precisely. If some modules fail to install, you can try lax. Note that in Lex mode there is
* a greater chance that different modules will not work well together.
*
* Values: lax, strict
* Default: lax
*/
'dependencyMode' => 'lax',


/**
* Should be updated to the next stable version of the MMLC or to the latest (alpha, beta, ...)
*
* Values: stable, latest
* Default: 'stable'
*/
'selfUpdate' => 'stable',

/**
* The MMLC can automatically find your admin directory even if it has been renamed. If that doesn't work, you can
* enter the name of the admin directory here. Leave the field blank if you want the MMLC to automatically try to
* find the admin directory.
*
* Default: ''
*/
'adminDir' => '',

/**
* Settings revolving around your modified-shop
*
* Overwrite the default shop path. If your MMLC installation is not inside
* of your modified-shop root and exists as a symbolic link, you may need to
* define your shop root here.
*
* Leave empty for default.
* Default: ''
*/
'shopRoot' => '',

/**
* Should (error) messages be logged in the ModifiedModuleLoaderClient/logs/ directory?
*
* Values: true, false
* Default: ture
*/
'logging' => 'true',


/**
* If the MMLC should display programming errors in the browser, you can enter the domain to which this applies.
* The exception monitor becomes active in the event of errors as soon as the domain stored is the same as that
* from which the MMLC is called. Example <code>www.example.org</code>
*
* Default: ''
*/
'exceptionMonitorDomain' => '',
];
10 changes: 10 additions & 0 deletions src/Classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@ public static function setExceptionMonitorMail(string $newExceptionMonitorMail):
self::writeConfiguration(['exceptionMonitorMail' => $newExceptionMonitorMail]);
}

/**
* Set logging in config.
*
* @param string $logging.
*/
public static function setLogging(string $logging): void
{
self::writeConfiguration(['logging' => $logging]);
}

/**
* Get logging from config.
*
Expand Down
12 changes: 12 additions & 0 deletions src/Classes/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ public function invokeSettings()
if ($this->isPostRequest()) {
$parsedBody = $this->serverRequest->getParsedBody();

if (isset($parsedBody['adminDir'])) {
Config::setAdminDir($parsedBody['adminDir']);
}

if (isset($parsedBody['username'])) {
Config::setUsername($parsedBody['username']);
}
Expand All @@ -636,6 +640,10 @@ public function invokeSettings()
Config::setModulesLocalDir($parsedBody['modulesLocalDir']);
}

if (isset($parsedBody['logging'])) {
Config::setLogging($parsedBody['logging']);
}

if (isset($parsedBody['installMode'])) {
Config::setInstallMode($parsedBody['installMode']);
}
Expand All @@ -644,6 +652,10 @@ public function invokeSettings()
Config::setDependencyMode($parsedBody['dependencyMode']);
}

if (isset($parsedBody['exceptionMonitorDomain'])) {
Config::setExceptionMonitorDomain($parsedBody['exceptionMonitorDomain']);
}

Notification::pushFlashMessage([
'text' => 'Einstellungen erfolgreich gespeichert.',
'type' => 'success'
Expand Down
33 changes: 30 additions & 3 deletions src/Templates/Settings.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function viewIsSelected(bool $value): string
<div class="tab-pane fade show active" id="v-pills-general" role="tabpanel" aria-labelledby="v-pills-general-tab">
<h2>Allgemein</h2>
<form action="?action=settings&section=general" method="post">

<!-- accessToken -->
<div class="form-group">
<label for="inputAccessToken">AccessToken</label>
<div class="input-group mb-3">
Expand All @@ -64,6 +66,13 @@ function viewIsSelected(bool $value): string
<p>Aus Sicherheitsgründen ist das Ändern des AccessTokens gesperrt. Der Wert kann unter <code style="word-break: break-all"><?= Config::path(); ?></code> geändert werden.</p>
</div>

<!-- adminDir -->
<div class="form-group">
<label for="inputAdminDir">Admin-Verzeichnis</label>
<input type="text" name="adminDir" class="form-control" id="inputAdminDir" value="<?= Config::getAdminDir(); ?>">
<p>Der MMLC kann dein Admin-Verzeichnis automatischen finden, auch wenn es umbenannt wurde. Sollte das nicht funktionieren, kann hier der Namen des Admin-Verzeichnis eintragen werden. Lasse das Feld leer, wenn der MMLC automatisch veruschen soll, das Admin-Verzeichnis zu finden. Standard-Wert ist kein Wert oder <code>admin</code></p>
</div>

<div class="form-group">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
Expand Down Expand Up @@ -107,13 +116,24 @@ function viewIsSelected(bool $value): string
<div class="form-group">
<label for="inputModulesLocalDir">Module Pfad</label>
<input type="text" name="modulesLocalDir" class="form-control" id="inputModulesLocalDir" value="<?= Config::getModulesLocalDir(); ?>">
<p>In diesem Ordner werden Module für den MMLC heruntergeladen.</p>
<p>In diesem Ordner werden Module für den MMLC heruntergeladen. Der Standard Wert ist <code>Modules</code></p>
</div>

<!-- installMode -->
<!-- logging -->
<div class="form-group">
<label for="inputLogging">Logging</label>
<select name="logging" class="form-control" id="inputLogging" size="1">
<option <?= viewIsSelected(Config::getLogging() === true) ?> value="true">true</option>
<option <?= viewIsSelected(Config::getLogging() === false) ?> value="false">false</option>
</select>

<p>Sollen (Fehler-) Meldungen im Verzeichnis <code>ModifiedModuleLoaderClient/logs</code> protokolliert werden?</p>
</div>

<!-- dependencyMode -->
<div class="form-group">
<label for="inputDependencyMode">Abhängigkeitsmodus</label>
<select name="dependencyMode" class="form-control" id="dependencyMode" size="1">
<select name="dependencyMode" class="form-control" id="inputDependencyMode" size="1">
<option <?= viewIsSelected(Config::getDependenyMode() === Comparator::CARET_MODE_STRICT) ?> value="strict">strict</option>
<option <?= viewIsSelected(Config::getDependenyMode() === Comparator::CARET_MODE_LAX) ?> value="lax">lax</option>
</select>
Expand All @@ -132,6 +152,13 @@ function viewIsSelected(bool $value): string
<p>Du kannst zwischen <code>copy</code> und <code>link</code> wählen. Hast du den MMLC in einem Live-Shop im Einsatz, wähle <code>copy</code>. Wenn du mit dem MMLC Module entwickelst, wähle <code>link</code>.</p>
</div>

<!-- exceptionMonitorDomain -->
<div class="form-group">
<label for="inputExceptionMonitorDomain">ExceptionMonitor Domain</label>
<input type="text" name="exceptionMonitorDomain" class="form-control" id="inputExceptionMonitorDomain" value="<?= Config::getExceptionMonitorDomain(); ?>">
<p>Wenn der MMLC programmierfehler im Browser anzeigen soll, kannst hier die Domain eintragen werden, für die dieses gilt. Der ExceptionMonitor wird bei Fehlern aktiv, sobald die Domain hinterlegte Domain die gleiche ist, von der der MMLC aufgerufen wird. Beispiel <code>www.example.org</code></p>
</div>

<div class="form-group">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
Expand Down