fix: implement some minor fixes

This commit is contained in:
Marvin Flock
2025-03-18 20:34:09 +01:00
parent 1eed53ae9c
commit 5d85be8937
@@ -5,7 +5,7 @@
// kein direkter Zugriff
defined('_JEXEC') or die('Restricted access');
define("SPORTS_MANAGER_VERSION", "2.0.0");
const SPORTS_MANAGER_VERSION = "2.0.0";
//ini_set('display_errors', '1');
@@ -28,25 +28,24 @@ function laufzeitAusgeben($zwischenstand = NULL) {
$laufzeit_delta_zwischenstand = $laufzeit_aktuell - $laufzeit_zwischenstand;
$laufzeit_delta_zwischenstand = $laufzeit_aktuell - (empty($zwischenstand) ? $laufzeit_beginn : $laufzeit_zwischenstand);
$laufzeit_zwischenstand = $laufzeit_aktuell;
echo("" . (!empty($zwischenstand) ? htmlentities_utf8($zwischenstand) : "Seitenaufbau in") . ": " . sprintf('%f', $laufzeit_delta) . " Sekunden" . (empty($zwischenstand) ? "" : (sprintf(' (+%f)', $laufzeit_delta_zwischenstand))) . ".<br />");
echo(!empty($zwischenstand) ? htmlentities_utf8($zwischenstand) : "Seitenaufbau in" . ": " . sprintf('%f', $laufzeit_delta) . " Sekunden" . (empty($zwischenstand) ? "" : (sprintf(' (+%f)', $laufzeit_delta_zwischenstand))) . ".<br />");
}
laufzeitInit();
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'tools.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'tools.php');
setMinMemoryLimit('64M');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'api.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'admin.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controller.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'database.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'mathparser.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view.html.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view.json.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_admin.php');
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_ticker.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'api.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'admin.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'controller.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'database.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'mathparser.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'views/sportsmanager/view.html.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'views/sportsmanager/view.json.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_admin.php');
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_ticker.php');
jimport('joomla.filesystem.file');
@@ -79,7 +78,7 @@ if ($task == "spielerbild") {
terminDokument();
} else if ($task == "spieler_details") {
spielerDetails();
} else if (substr($task, 0, 6) == "admin_") {
} else if (str_starts_with($task, "admin_")) {
switch ($task) {
case 'admin_einstellungen':
adminEinstellungen();
@@ -1067,7 +1066,6 @@ function redirectSportsManagerURL($weitereParameter = NULL, $nachricht = '') {
}
$app->redirect(SportsManagerURL($weitereParameter), 200);
exit;
return;
}
function redirectCurrentURL() {
@@ -1109,7 +1107,7 @@ function berechnungen() {
. "\n WHERE " . (empty($session_id) ? ("session_id < SUBTIME(NOW(), '00:10:00')") : ("session_id = '" . $session_id . "'"))
. "\n ), 1, 0)";
$db->setQuery($query);
if (!$result = $db->execute()) {
if (!$db->execute()) {
die($db->stderr(true));
}
$berechnungen = $db->loadResult();
@@ -1155,7 +1153,7 @@ function benutzerModerator() {
. "\n FROM #__sportsmanager_moderator"
. "\n WHERE moderator_user_id = $user_id";
$db->setQuery($query);
if (!$result = $db->execute()) {
if (!$db->execute()) {
die($db->stderr(true));
}
$gefunden = $db->loadResult();
@@ -4040,62 +4038,6 @@ function teamSpielplanXML() {
die();
}
function bildKopierenAngepasst($quelle, $ziel, $ziel_breite, $ziel_hoehe, $zuschneiden) {
$len = strlen($ziel);
if ($len < 4 || $ziel[$len - 4] != ".")
return false;
$ext = strtolower(substr($ziel, $len - 3));
if ($ext != "jpg" && $ext != "png")
return false;
$quelle_image = $ext == "png" ? imagecreatefrompng($quelle) : imagecreatefromjpeg($quelle);
if ($quelle_image === false)
return false;
$quelle_breite = imagesx($quelle_image);
$quelle_hoehe = imagesy($quelle_image);
if ($quelle_breite == $ziel_breite && $quelle_hoehe == $ziel_hoehe)
return JFile::copy($quelle, $ziel);
$ziel_image = imagecreatetruecolor($ziel_breite, $ziel_hoehe);
$hintergrund = $ext == "png" ? imagecolorallocatealpha($ziel_image, 0, 0, 0, 127) : imagecolorallocate($ziel_image, 64, 64, 64);
imagefill($ziel_image, 0, 0, $hintergrund);
$quelle_proportionen = $quelle_breite / $quelle_hoehe;
$ziel_proportionen = $ziel_breite / $ziel_hoehe;
if ($zuschneiden) {
if ($ziel_proportionen >= $quelle_proportionen) {
$quelle_teilhoehe = round($quelle_breite / $ziel_proportionen);
if (!imagecopyresampled($ziel_image, $quelle_image, 0, 0, 0, round(($quelle_hoehe - $quelle_teilhoehe) / 2), $ziel_breite, $ziel_hoehe, $quelle_breite, $quelle_teilhoehe))
return false;
} else {
$quelle_teilbreite = round($quelle_hoehe * $ziel_proportionen);
if (!imagecopyresampled($ziel_image, $quelle_image, 0, 0, round(($quelle_breite - $quelle_teilbreite) / 2), 0, $ziel_breite, $ziel_hoehe, $quelle_teilbreite, $quelle_hoehe))
return false;
}
} else {
if ($ziel_proportionen >= $quelle_proportionen) {
$ziel_teilbreite = round($ziel_hoehe * $quelle_proportionen);
if (!imagecopyresampled($ziel_image, $quelle_image, round(($ziel_breite - $ziel_teilbreite) / 2), 0, 0, 0, $ziel_teilbreite, $ziel_hoehe, $quelle_breite, $quelle_hoehe))
return false;
} else {
$ziel_teilhoehe = round($ziel_breite / $quelle_proportionen);
if (!imagecopyresampled($ziel_image, $quelle_image, 0, round(($ziel_hoehe - $ziel_teilhoehe) / 2), 0, 0, $ziel_breite, $ziel_teilhoehe, $quelle_breite, $quelle_hoehe))
return false;
}
}
ob_start();
if ($ext == "png") {
imagesavealpha($ziel_image, true);
if (!imagepng($ziel_image))
return false;
} else {
if (!imagejpeg($ziel_image))
return false;
}
$output = ob_get_contents();
ob_end_clean();
JFile::write($ziel, $output);
return true;
}
function bildAnpassen($typ, $id = 0) {
global $sportsmanager_joomla_path;
$jinput = JFactory::getApplication()->input;