From d3f3ca5779a2ff14d5f51612646a9cef3a117783 Mon Sep 17 00:00:00 2001 From: Anonymous Contributor Date: Wed, 23 Aug 2023 18:16:35 +0200 Subject: [PATCH] Fix include/template paths --- api/onlineDisplay.php | 2 +- api/viewerWelcomeSite.php | 2 +- app/HTML.php | 18 +++++++++++------- cron/IARMonitor.php | 2 +- cron/offlineIM.php | 2 +- cron/regionChecker.php | 2 +- crone.php | 2 +- index.php | 2 ++ pages/dashboard.php | 4 ++-- pages/friends.php | 4 ++-- pages/groups.php | 4 ++-- pages/identities.php | 4 ++-- pages/invite.php | 2 +- pages/login.php | 2 +- pages/password.php | 4 ++-- pages/profile.php | 4 ++-- pages/regions.php | 4 ++-- pages/register.php | 4 ++-- pages/user-online-state.php | 4 ++-- pages/users.php | 4 ++-- plugins/default-html.php | 4 ++-- 21 files changed, 43 insertions(+), 37 deletions(-) diff --git a/api/onlineDisplay.php b/api/onlineDisplay.php index c31b441..8ab67f1 100644 --- a/api/onlineDisplay.php +++ b/api/onlineDisplay.php @@ -15,7 +15,7 @@ echo ''; $entryColor = TRUE; - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); while($row = $statement->fetch()) { diff --git a/api/viewerWelcomeSite.php b/api/viewerWelcomeSite.php index cad745c..1f46e56 100644 --- a/api/viewerWelcomeSite.php +++ b/api/viewerWelcomeSite.php @@ -1,5 +1,5 @@ HTMLHeader = file_get_contents($file); + $this->HTMLHeader = file_get_contents($RUNTIME['BASEDIR'].'/templates/'.$file); $this->isBuild = false; } @@ -90,8 +90,9 @@ } public function importHTMLMenu($file){ + global $RUNTIME; //Das Komplette Men� wird aus einer Datei ausgelesen und das alte �berschrieben. - $this->DasMenu = file_get_contents($file); + $this->DasMenu = file_get_contents($RUNTIME['BASEDIR'].'/templates/'.$file); $this->isBuild = false; } @@ -106,8 +107,9 @@ //Der Seiten HTML Quelcode wird eingelesen. public function importHTML($file){ + global $RUNTIME; //Der HTML Quelltext wird aus einer Datei eingelesen. - $this->HTMLDatei = file_get_contents($file); + $this->HTMLDatei = file_get_contents($RUNTIME['BASEDIR'].'/templates/'.$file); $this->isBuild = false; } @@ -138,8 +140,9 @@ //Der inhalt der Seite wird zusammen gesetzt (nicht der quelltext) (%%EchoInhalt%%) public function importSeitenInhalt($file){ + global $RUNTIME; //L�d einen fertigen Text aus einer datei. - $this->DerInhalt = file_get_contents($file); + $this->DerInhalt = file_get_contents($RUNTIME['BASEDIR'].'/templates/'.$file); $this->isBuild = false; } @@ -150,8 +153,9 @@ } public function importAndAddSeitenInhalt($file){ + global $RUNTIME; //L�d einen fertigen Text aus einer datei. - $this->DerInhalt = $this->DerInhalt.file_get_contents($file); + $this->DerInhalt = $this->DerInhalt.file_get_contents($RUNTIME['BASEDIR'].'/templates/'.$file); $this->isBuild = false; } diff --git a/cron/IARMonitor.php b/cron/IARMonitor.php index 2da7792..8c3da73 100644 --- a/cron/IARMonitor.php +++ b/cron/IARMonitor.php @@ -1,5 +1,5 @@ prepare("CREATE TABLE IF NOT EXISTS `iarstates` (`userID` VARCHAR(36) NOT NULL COLLATE 'utf8_unicode_ci', `filesize` BIGINT(20) NOT NULL DEFAULT '0', `iarfilename` VARCHAR(64) NOT NULL COLLATE 'utf8_unicode_ci', `running` INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`userID`) USING BTREE) COLLATE='utf8_unicode_ci' ENGINE=InnoDB;"); diff --git a/cron/offlineIM.php b/cron/offlineIM.php index 3ccbbb5..5b053b6 100644 --- a/cron/offlineIM.php +++ b/cron/offlineIM.php @@ -39,7 +39,7 @@ while($row = $statement->fetch()) { - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $email = $opensim->getUserMail($row['PrincipalID']); diff --git a/cron/regionChecker.php b/cron/regionChecker.php index e88377a..4a92ab1 100644 --- a/cron/regionChecker.php +++ b/cron/regionChecker.php @@ -19,7 +19,7 @@ if($result == FALSE || $result == "") { - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; echo "Die Region ".$row['regionName']." von ".$opensim->getUserName($row['owner_uuid'])." ist nicht erreichbar.\n"; diff --git a/crone.php b/crone.php index 641cb0f..5b2911e 100644 --- a/crone.php +++ b/crone.php @@ -7,9 +7,9 @@ include_once("app/utils.php"); include_once("app/HTML.php"); $RUNTIME = array(); +$RUNTIME['BASEDIR'] = __DIR__; include_once("config.php"); - if ($handle = opendir('./cron/')) { while (false !== ($entry = readdir($handle))) diff --git a/index.php b/index.php index e6ff5d7..ff0fdfe 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,8 @@ date_default_timezone_set("Europe/Berlin"); error_reporting(E_ALL); include_once("config.php"); +$RUNTIME['BASEDIR'] = __DIR__; +set_include_path('.:'.$RUNTIME['BASEDIR']); session_set_cookie_params([ 'lifetime' => 86400, diff --git a/pages/dashboard.php b/pages/dashboard.php index 92b73f0..d2b132e 100644 --- a/pages/dashboard.php +++ b/pages/dashboard.php @@ -1,9 +1,9 @@ setHTMLTitle("Dashboard"); - $HTML->importSeitenInhalt("../templates/dashboard-home.html"); + $HTML->importSeitenInhalt("dashboard-home.html"); $HTML->ReplaceSeitenInhalt("%%GLOBAL-USER-COUNT%%", $opensim->getUserCount()); $HTML->ReplaceSeitenInhalt("%%GLOBAL-REGION-COUNT%%", $opensim->getRegionCount()); diff --git a/pages/friends.php b/pages/friends.php index d33e8c4..642f59a 100644 --- a/pages/friends.php +++ b/pages/friends.php @@ -12,7 +12,7 @@ } $HTML->setHTMLTitle("Online Anzeige"); - $HTML->importSeitenInhalt("../templates/online-anzeige.html"); + $HTML->importSeitenInhalt("online-anzeige.html"); $table = '
NameRegion
%%ENTRY%%
NameOptionen
'; @@ -25,7 +25,7 @@ $FriendData = explode(";", $row['Friend']); $Friend = $FriendData[0]; - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $entry = ''.trim($opensim->getUserName($Friend)).'LÖSCHEN'; diff --git a/pages/groups.php b/pages/groups.php index a2c26a4..86b1353 100644 --- a/pages/groups.php +++ b/pages/groups.php @@ -8,11 +8,11 @@ die(); } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $HTML->setHTMLTitle("Gruppen"); - $HTML->importSeitenInhalt("../templates/deine-regionen.html"); + $HTML->importSeitenInhalt("deine-regionen.html"); $table = '%%ENTRY%%
NameGründerAktionen
'; diff --git a/pages/identities.php b/pages/identities.php index f4eda6b..c3a8e37 100644 --- a/pages/identities.php +++ b/pages/identities.php @@ -1,6 +1,6 @@ setHTMLTitle("Identitäten"); - $HTML->importSeitenInhalt("../templates/identities.html"); + $HTML->importSeitenInhalt("identities.html"); $statementCreateTable = $RUNTIME['PDO']->prepare("CREATE TABLE IF NOT EXISTS `UserIdentitys` (`PrincipalID` VARCHAR(38) NOT NULL, `IdentityID` VARCHAR(38) NOT NULL, PRIMARY KEY (`IdentityID`))"); $statementCreateTable->execute(); @@ -64,7 +64,7 @@ } } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); if(isset($_REQUEST['createIdent']) && isset($_REQUEST['newName']) && $_REQUEST['createIdent'] == "" && $_REQUEST['newName'] != "") diff --git a/pages/invite.php b/pages/invite.php index 8b410da..cdf8361 100644 --- a/pages/invite.php +++ b/pages/invite.php @@ -9,7 +9,7 @@ } $HTML->setHTMLTitle("Benutzer"); - $HTML->importSeitenInhalt("../templates/users.html"); + $HTML->importSeitenInhalt("users.html"); $HTML->ReplaceSeitenInhalt("%%link%%", ' '); diff --git a/pages/login.php b/pages/login.php index 03edcef..bed6d8d 100644 --- a/pages/login.php +++ b/pages/login.php @@ -1,7 +1,7 @@ setHTMLTitle("Login"); - $HTML->importHTML("../templates/login.html"); + $HTML->importHTML("login.html"); if(isset($_POST['login'])) { diff --git a/pages/password.php b/pages/password.php index 3898a23..71782b1 100644 --- a/pages/password.php +++ b/pages/password.php @@ -1,7 +1,7 @@ setHTMLTitle("Passwort ändern"); - $HTML->importSeitenInhalt("../templates/profile.html"); + $HTML->importSeitenInhalt("profile.html"); if(isset($_REQUEST['oldPassword']) || @$_REQUEST['oldPassword'] != "") { @@ -56,7 +56,7 @@ } } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $PartnerName = ""; diff --git a/pages/profile.php b/pages/profile.php index b622b21..30ace76 100644 --- a/pages/profile.php +++ b/pages/profile.php @@ -3,7 +3,7 @@ $statement->execute(); $HTML->setHTMLTitle("Dein Profile"); - $HTML->importSeitenInhalt("../templates/profile.html"); + $HTML->importSeitenInhalt("profile.html"); //Prüfe ob IAR grade erstellt wird. $IARRUNNING = FALSE; @@ -101,7 +101,7 @@ $statement->execute(['IMState' => 'false', 'PrincipalID' => $_SESSION['UUID']]); } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); if(isset($_REQUEST['formInputFeldPartnerName']) && $_REQUEST['formInputFeldPartnerName'] != "") diff --git a/pages/regions.php b/pages/regions.php index 2d8a5a1..894a967 100644 --- a/pages/regions.php +++ b/pages/regions.php @@ -1,6 +1,6 @@ setHTMLTitle("Deine Regionen"); - $HTML->importSeitenInhalt("../templates/deine-regionen.html"); + $HTML->importSeitenInhalt("deine-regionen.html"); function cleanSize($bytes) { @@ -61,7 +61,7 @@ $statement = $RUNTIME['PDO']->prepare("SELECT uuid,regionName,owner_uuid,locX,locY FROM regions ".($showAll ? "ORDER BY owner_uuid ASC" : "WHERE owner_uuid = ? ORDER BY uuid ASC")); $statement->execute(array($_SESSION['UUID'])); - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); while($row = $statement->fetch()) diff --git a/pages/register.php b/pages/register.php index 9bdc47b..af039b0 100644 --- a/pages/register.php +++ b/pages/register.php @@ -4,7 +4,7 @@ global $RUNTIME; $HTML = new HTML(); $HTML->setHTMLTitle("Registrieren"); - $HTML->importHTML("../templates/register.html"); + $HTML->importHTML("register.html"); $HTML->ReplaceLayoutInhalt("%%MESSAGE%%", $message); $HTML->ReplaceLayoutInhalt("%%tosURL%%", $RUNTIME['TOOLS']['TOS'] ); @@ -92,7 +92,7 @@ displayPage("Der gewählte Standardavatar existiert nicht."); } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $avatarUUID = $opensim->gen_uuid(); diff --git a/pages/user-online-state.php b/pages/user-online-state.php index 7944d69..5256a9e 100644 --- a/pages/user-online-state.php +++ b/pages/user-online-state.php @@ -1,9 +1,9 @@ setHTMLTitle("Online Anzeige"); - $HTML->importSeitenInhalt("../templates/online-anzeige.html"); + $HTML->importSeitenInhalt("online-anzeige.html"); $table = '%%ENTRY%%
BenutzernameRegion
'; diff --git a/pages/users.php b/pages/users.php index fd394e2..bb3383a 100644 --- a/pages/users.php +++ b/pages/users.php @@ -12,11 +12,11 @@ die(); } - include '../app/OpenSim.php'; + include 'app/OpenSim.php'; $opensim = new OpenSim(); $HTML->setHTMLTitle("Benutzer"); - $HTML->importSeitenInhalt("../templates/users.html"); + $HTML->importSeitenInhalt("users.html"); if(@$_REQUEST['action'] == 'genpw' && @$_REQUEST['userid'] != '') { diff --git a/plugins/default-html.php b/plugins/default-html.php index 1891df4..1d51a49 100644 --- a/plugins/default-html.php +++ b/plugins/default-html.php @@ -2,10 +2,10 @@ $HTML = new HTML(); if(@$_SESSION['LOGIN'] == 'true') { - $HTML->importHTML("../templates/dashboard.html"); + $HTML->importHTML("dashboard.html"); if(@$_SESSION['LEVEL'] > 100) - $HTML->importHTML("../templates/dashboard-admin.html"); + $HTML->importHTML("dashboard-admin.html"); $HTML->ReplaceLayoutInhalt("%%USERNAME%%", htmlspecialchars(@$_SESSION['DISPLAYNAME'])); }