From 613f02894f4a91c08ebe7f956c6781cc4cb72fb0 Mon Sep 17 00:00:00 2001 From: Ulrich Block Date: Sat, 8 Jul 2017 14:34:49 +0200 Subject: [PATCH] #1014 Lendserver bugs --- lend.php | 3 ++- stuff/cms/init_page.php | 45 ++++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/lend.php b/lend.php index 953cd7d8..58ca8a89 100644 --- a/lend.php +++ b/lend.php @@ -38,6 +38,7 @@ if (isset($page_include)) { + $reseller_id = 0; } else { @@ -123,7 +124,7 @@ $slotselect = array(); $votimeselect = array(); $voslotselect = array(); -$query = $sql->prepare("SELECT `active` FROM `modules` WHERE `id`=5 LIMIT 1"); +$query = $sql->prepare("SELECT `active` FROM `modules` WHERE `sub`='le' LIMIT 1"); $query->execute(); $active = $query->fetchColumn(); $active = (active_check($active)) ? $active : 'Y'; diff --git a/stuff/cms/init_page.php b/stuff/cms/init_page.php index 53d20490..ee0fab07 100644 --- a/stuff/cms/init_page.php +++ b/stuff/cms/init_page.php @@ -88,23 +88,33 @@ if (isset($page_active) and $page_active == 'Y') { $what_to_be_included_array['imprint'] = 'imprint.php'; } + // The module itself is active if ($easywiModules['le'] === true) { - $what_to_be_included_array['lendserver'] = 'lend.php'; + + // Check if the module is configured in a way that prevents direct access via CMS + $query = $sql->prepare("SELECT `activeGS`,`activeVS`,`lendaccess` FROM `lendsettings` WHERE `resellerid`=0 LIMIT 1"); + $query->execute(); + while ($row = $query->fetch(PDO::FETCH_ASSOC)) { + + if ($row['lendaccess'] == 3) { + $easywiModules['le'] = false; + } else { + $page_data->SetData('lendactiveGS', $row['activeGS']); + $page_data->SetData('lendactiveVS', $row['activeVS']); + } + } + + if ($easywiModules['le'] === true) { + $what_to_be_included_array['lendserver'] = 'lend.php'; + } } - $query = $sql->prepare("SELECT `activeGS`,`activeVS` FROM `lendsettings` WHERE `resellerid`=0 LIMIT 1"); - $query->execute(); - while ($row = $query->fetch(PDO::FETCH_ASSOC)) { - $page_data->SetData('lendactiveGS', $row['activeGS']); - $page_data->SetData('lendactiveVS', $row['activeVS']); - } - - $query = $sql->prepare("SELECT `active` FROM `modules` WHERE `id`=5 LIMIT 1"); - $query->execute(); - $lendActive = $query->fetchColumn(); - $lendActive = (active_check($lendActive)) ? $lendActive : 'Y'; + // Var needed for legacy checks + $lendActive = ($easywiModules['le']) ? 'Y' : 'N'; $page_data->SetData('lendactive', $lendActive); + $protectioncheck = (!isset($protectioncheck)) ? 'N' : $protectioncheck; + $page_data->SetData('protectioncheck', $protectioncheck); $page_data->SetData('title', $title); @@ -175,9 +185,16 @@ if (isset($page_active) and $page_active == 'Y') { } if ($page_data->lendactive == 'Y') { + $page_data->SetMenu($gsprache->lendserver, array('site' => 'lendserver'), 'lendserver'); - $page_data->SetMenu($gsprache->gameserver, array('site' => 'lendserver', 'd' => 'gs'), 'lendservergs'); - $page_data->SetMenu($gsprache->voiceserver, array('site' => 'lendserver', 'd' => 'vo'), 'lendservervoice'); + + if ($page_data->lendactiveGS != 'N') { + $page_data->SetMenu($gsprache->gameserver, array('site' => 'lendserver', 'd' => 'gs'), 'lendservergs'); + } + + if ($page_data->lendactiveVS != 'N') { + $page_data->SetMenu($gsprache->voiceserver, array('site' => 'lendserver', 'd' => 'vo'), 'lendservervoice'); + } } if ($easywiModules['ip'] === true) {