diff --git a/Dockerfile b/Dockerfile index 9199d73..055b6b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,6 +70,12 @@ RUN unzip /var/www/html/remoteCP_v4.0.3.5.zip -d /var/www/html \ && chmod -R 777 /var/www/html/remotecp/xml/settings \ && chown -R www-data:www-data /var/www/html/remotecp/ +# Fix PHP-Warnungen in RemoteCP CustomPoints-Plugin (undefined constants) +# RemoteCP nutzt bare constants (pt_custom, pt_points, ...), die in PHP 7.2+ +# Warnungen ausloesen. Das gepatchte Plugin nutzt stattdessen defined()-Pruefungen. +COPY assets/config/remotecp/plugins/CustomPoints/index.php /var/www/html/remotecp/plugins/CustomPoints/index.php +RUN chown www-data:www-data /var/www/html/remotecp/plugins/CustomPoints/index.php + # AdminServ- und RemoteCP-Dateien als Default-Template sichern (wird beim ersten Start ins Volume kopiert) RUN cp -a /var/www/html /opt/tmserver/default-controlpanel diff --git a/assets/bin/RunTrackmaniaServer.sh b/assets/bin/RunTrackmaniaServer.sh index 0f4a504..d2ef431 100644 --- a/assets/bin/RunTrackmaniaServer.sh +++ b/assets/bin/RunTrackmaniaServer.sh @@ -18,7 +18,7 @@ else echo "==> PHP-Debug-Modus deaktiviert" cat > "$PHP_INI_DIR/99-adminserv-debug.ini" < Patche CustomPoints-Plugin (PHP-Warnungen beheben)..." + cp "$CUSTOMPOINTS_DEFAULT" "$CUSTOMPOINTS_FILE" + chown www-data:www-data "$CUSTOMPOINTS_FILE" + echo " CustomPoints-Plugin erfolgreich gepatcht." +fi + echo "Starting apache server" service apache2 start diff --git a/assets/config/remotecp/plugins/CustomPoints/index.php b/assets/config/remotecp/plugins/CustomPoints/index.php new file mode 100644 index 0000000..5e43f48 --- /dev/null +++ b/assets/config/remotecp/plugins/CustomPoints/index.php @@ -0,0 +1,135 @@ + 'editgamesettings', + 'setPointsPreset' => 'editgamesettings' + ); + public $presets; + + public function onLoad() + { + $this->presets = Core::getObject('session')->loadXML( + Core::getSetting('pluginpath') . $this->id . '/presets.xml' + ); + } + + public function onOutput() + { + $CustomPoints = array(); + + if (Core::getObject('gbx')->query('GetRoundCustomPoints')) { + $CustomPoints = Core::getObject('gbx')->getResponse(); + } + + if (!is_array($CustomPoints)) { + $CustomPoints = array(); + } + + if (!Core::getObject('session')->checkPerm('editgamesettings')) { + return; + } + + echo "
"; + echo "
"; + + echo "
" . (defined('pt_custom') ? pt_custom : 'Custom Points') . "
"; + + echo "
+ +
+ +
" . (defined('pt_commasep') ? pt_commasep : 'Comma separated') . "
+
"; + echo "
"; + + echo "
"; + + echo ""; + echo ""; + echo ""; + echo "
"; + + echo "
"; + echo "
"; + + echo "
" . (defined('pt_presets') ? pt_presets : 'Presets') . "
"; + + if ($this->presets && is_object($this->presets)) { + foreach ($this->presets->children() as $preset) { + + $name = isset($preset['name']) ? $preset['name'] : 'Preset'; + $points = isset($preset['points']) ? (string)$preset['points'] : ''; + + echo "
+ +
"; + + echo " "; + + if (strlen($points) > 25) { + echo substr($points, 0, 25) . "..."; + } else { + echo $points; + } + + echo "
"; + echo "
"; + } + } + + echo "
"; + + echo ""; + echo ""; + echo ""; + echo "
"; + } + + public function setPoints() + { + if (!array_key_exists('points', $_REQUEST)) return; + + $str = preg_replace("/[^0-9,]/", "", $_REQUEST['points']); + $array = $this->makeIntArray(explode(',', $str)); + + Core::getObject('actions')->add('SetRoundCustomPoints', $array, true); + } + + public function setPointsPreset() + { + if (!array_key_exists('preset', $_REQUEST)) return; + + $str = preg_replace("/[^0-9,]/", "", $_REQUEST['preset']); + $array = $this->makeIntArray(explode(',', $str)); + + Core::getObject('actions')->add('SetRoundCustomPoints', $array, true); + } + + private function makeIntArray($array) + { + foreach ($array as $key => $value) { + $array[$key] = (int)$value; + } + return $array; + } +} diff --git a/docs/umgebungsvariablen.md b/docs/umgebungsvariablen.md index 5af2ea8..71093d6 100644 --- a/docs/umgebungsvariablen.md +++ b/docs/umgebungsvariablen.md @@ -116,9 +116,11 @@ XAseco ist ein Server-Controller für Rekorde, Karma, Jukebox und mehr. Siehe [X | Variable | Beschreibung | Standard | |----------|-------------|----------| -| `PHP_DISPLAY_ERRORS` | Zeigt PHP-Fehlermeldungen im Browser an (nur zur Fehlersuche!) | `false` | +| `PHP_DISPLAY_ERRORS` | Aktiviert den PHP-Debug-Modus: Fehlermeldungen im Browser + vollständige Warnungen im Log (nur zur Fehlersuche!) | `false` | > **Hinweis:** Der Debug-Modus erfordert **keinen** Rebuild des Images. Es genügt, die Variable in der `.env`-Datei zu ändern und den Container neu zu starten (`docker compose restart`). Im Produktivbetrieb sollte `PHP_DISPLAY_ERRORS` immer auf `false` stehen. +> +> Bei `false` werden nur schwerwiegende Fehler geloggt (keine Warnungen/Notices). Bei `true` werden zusätzlich alle Warnungen und Hinweise angezeigt und geloggt – nützlich zur Fehlersuche bei Problemen mit RemoteCP oder AdminServ. > **Hinweis:** Bei `FORCE_CONFIG_UPDATE=true` wird die `dedicated_cfg.txt` aus dem Template neu erzeugt und alle Platzhalter mit den aktuellen Umgebungsvariablen ersetzt. Manuelle Änderungen gehen dabei verloren! Nach dem Update sollte `FORCE_CONFIG_UPDATE` wieder auf `false` gesetzt werden.