#137: Enhance game addons

This commit is contained in:
Ulrich Block 2013-10-19 16:20:33 +02:00
parent 3415f2bfd3
commit 095d4a086d
28 changed files with 1461 additions and 1333 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,68 +40,79 @@
if (!isset($updateinclude) or $updateinclude == false) {
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
define('EASYWIDIR', dirname(dirname(__FILE__)));
function isinteger($value) {
if (preg_match("/^[\d+(.\d+|$)]+$/", $value) or $value == 0) {
return true;
}
}
class UpdateResponse {
public $response = '';
function __construct() {
$this->response = '';
}
function add ($newtext) {
$this->response .= $newtext;
}
function printresponse () {
return $this->response;
}
function __destruct() {
unset($this->response);
}
}
include(EASYWIDIR . '/stuff/config.php');
try {
$sql=new PDO("$databanktype:host=$host;dbname=$db", $user, $pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
catch(PDOException $error) {
echo $error->getMessage();
die();
}
$response=new UpdateResponse();
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
define('EASYWIDIR', dirname(dirname(__FILE__)));
function isinteger($value) {
return (preg_match("/^[\d+(.\d+|$)]+$/", $value) or $value == 0) ? true : false;
}
class UpdateResponse {
public $response = '';
function __construct() {
$this->response = '';
}
function add ($newtext) {
$this->response .= $newtext;
}
function printresponse () {
return $this->response;
}
function __destruct() {
unset($this->response);
}
}
include(EASYWIDIR . '/stuff/config.php');
try {
$sql = new PDO("$databanktype:host=$host;dbname=$db", $user, $pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
catch(PDOException $error) {
echo $error->getMessage();
die();
}
$response = new UpdateResponse();
} else if (!defined('EASYWIDIR')) {
define('EASYWIDIR', dirname(dirname(__FILE__)));
}
function versioncheck ($current,$new,$file,$response,$sql) {
function versioncheck ($current, $new ,$file ,$response) {
$include = true;
if ($current<$new) {
$response->add("Upgrading Databe from $current to $new<br />");
if (is_file(EASYWIDIR . '/' . $file)) {
$response->add("Found updaterfile ".$file.". Executing it now<br />");
include(EASYWIDIR . '/' . $file);
} else if (is_file(EASYWIDIR . '/install/'.$file)) {
$response->add("Found updaterfile ".'install/'.$file.". Executing it now<br />");
include(EASYWIDIR . '/install/'.$file);
} else {
die("File $file is missing<br />");
}
if ($new<'2.08') {
$update_easywiversion = $sql->prepare("UPDATE `easywi_version` SET `version`=?");
$update_easywiversion->execute(array($new));
$response->add('<br />Action: update_easywiversion done: ');
$error = $update_easywiversion->errorinfo();
$update_easywiversion->closecursor();
if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) $response->add($error[2].'<br />');
else $response->add('OK<br />');
}
return true;
} else {
return false;
}
if ($current < $new) {
$response->add("Upgrading Databe from $current to $new<br />");
if (is_file(EASYWIDIR . '/' . $file)) {
$response->add('Found updaterfile ' . $file . '. Executing it now<br>');
include(EASYWIDIR . '/' . $file);
} else if (is_file(EASYWIDIR . '/install/' . $file)) {
$response->add('Found updaterfile ' . EASYWIDIR . 'install/' . $file . '. Executing it now<br>');
include(EASYWIDIR . '/install/' . $file);
} else {
die("File $file is missing<br />");
}
if ($new < '2.08' and isset($sql)) {
$update_easywiversion = $sql->prepare("UPDATE `easywi_version` SET `version`=?");
$update_easywiversion->execute(array($new));
$response->add('<br />Action: update_easywiversion done: ');
$error = $update_easywiversion->errorinfo();
$update_easywiversion->closecursor();
if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) $response->add($error[2].'<br />');
else $response->add('OK<br />');
}
return true;
} else {
return false;
}
}
$query = $sql->prepare("SELECT `version` FROM `easywi_version` ORDER BY `id` DESC LIMIT 1");
$query->execute();
$version = $query->fetchColumn();
@ -110,50 +121,115 @@ $main = 1;
$reseller_id = 0;
$error = $query->errorinfo();
if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) {
$response->add("Current database version: 1.9<br />");
$version="1.9";
$response->add("Current database version: 1.9<br />");
$version = '1.9';
} else {
$response->add("Current database version: $version<br />");
$response->add("Current database version: $version<br />");
}
include(EASYWIDIR . '/stuff/keyphrasefile.php');
if (versioncheck ($version,'2.00','update_1x-20.php',$response,$sql)) $version='2.00';
if (versioncheck ($version,'2.01','update_200-201.php',$response,$sql)) $version='2.01';
if (versioncheck ($version,'2.02','update_201-202.php',$response,$sql)) $version='2.02';
if (versioncheck ($version,'2.03','update_202-203.php',$response,$sql)) $version='2.03';
if (versioncheck ($version,'2.04','update_203-204.php',$response,$sql)) $version='2.04';
if (versioncheck ($version,'2.05','update_204-205.php',$response,$sql)) $version='2.05';
if (versioncheck ($version,'2.06','update_205-206.php',$response,$sql)) $version='2.06';
if (versioncheck ($version,'2.07','update_206-207.php',$response,$sql)) $version='2.07';
if (versioncheck ($version,'2.08','update_207-208.php',$response,$sql)) $version='2.08';
if (versioncheck ($version,'2.09','update_208-209.php',$response,$sql)) $version='2.09';
if (versioncheck ($version,'2.10','update_209-210.php',$response,$sql)) $version='2.10';
if (versioncheck ($version, '2.00', 'update_1x-20.php', $response)) {
$version = '2.00';
}
if (versioncheck ($version, '2.01', 'update_200-201.php', $response)) {
$version = '2.01';
}
if (versioncheck ($version, '2.02', 'update_201-202.php', $response)) {
$version = '2.02';
}
if (versioncheck ($version, '2.03', 'update_202-203.php', $response)) {
$version = '2.03';
}
if (versioncheck ($version, '2.04', 'update_203-204.php', $response)) {
$version = '2.04';
}
if (versioncheck ($version, '2.05', 'update_204-205.php', $response)) {
$version = '2.05';
}
if (versioncheck ($version, '2.06', 'update_205-206.php', $response)) {
$version = '2.06';
}
if (versioncheck ($version, '2.07', 'update_206-207.php', $response)) {
$version = '2.07';
}
if (versioncheck ($version, '2.08', 'update_207-208.php', $response)) {
$version = '2.08';
}
if (versioncheck ($version, '2.09', 'update_208-209.php', $response)) {
$version = '2.09';
}
if (versioncheck ($version, '2.10', 'update_209-210.php', $response)) {
$version = '2.10';
}
include(EASYWIDIR . '/stuff/tables_add.php');
if (versioncheck ($version,'2.11','update_210-211.php',$response,$sql)) $version='2.11';
if (versioncheck ($version,'3.00','update_211-300.php',$response,$sql)) $version='3.00';
if (versioncheck ($version,'3.01','update_300-301.php',$response,$sql)) $version='3.01';
if (versioncheck ($version,'3.02','update_301-302.php',$response,$sql)) $version='3.02';
if (versioncheck ($version,'3.03','update_302-303.php',$response,$sql)) $version='3.03';
if (versioncheck ($version,'3.04','update_303-304.php',$response,$sql)) $version='3.04';
if (versioncheck ($version,'3.05','update_304-305.php',$response,$sql)) $version='3.05';
if (versioncheck ($version,'3.06','update_305-306.php',$response,$sql)) $version='3.06';
if (versioncheck ($version,'3.07','update_306-307.php',$response,$sql)) $version='3.07';
if (versioncheck ($version,'3.08','update_307-308.php',$response,$sql)) $version='3.08';
if (versioncheck ($version,'3.09','update_308-309.php',$response,$sql)) $version='3.09';
if (versioncheck ($version,'3.10','update_309-310.php',$response,$sql)) $version='3.10';
if (versioncheck ($version,'3.20','update_310-320.php',$response,$sql)) $version='3.20';
if (versioncheck ($version,'3.30','update_320-330.php',$response,$sql)) $version='3.30';
if (versioncheck ($version,'3.40','update_330-340.php',$response,$sql)) $version='3.40';
if (versioncheck ($version,'3.60','update_340-360.php',$response,$sql)) $version='3.60';
if (versioncheck ($version,'3.70','update_360-370.php',$response,$sql)) $version='3.70';
if (versioncheck ($version,'4.00','update_370-400.php',$response,$sql)) $version='4.00';
if (versioncheck ($version,'4.10','update_400-410.php',$response,$sql)) $version='4.10';
if (versioncheck ($version, '2.11', 'update_210-211.php', $response)) {
$version = '2.11';
}
if (versioncheck ($version, '3.00', 'update_211-300.php', $response)) {
$version = '3.00';
}
if (versioncheck ($version, '3.01', 'update_300-301.php', $response)) {
$version = '3.01';
}
if (versioncheck ($version, '3.02', 'update_301-302.php', $response)) {
$version = '3.02';
}
if (versioncheck ($version, '3.03', 'update_302-303.php', $response)) {
$version = '3.03';
}
if (versioncheck ($version, '3.04', 'update_303-304.php', $response)) {
$version = '3.04';
}
if (versioncheck ($version, '3.05', 'update_304-305.php', $response)) {
$version = '3.05';
}
if (versioncheck ($version, '3.06', 'update_305-306.php', $response)) {
$version = '3.06';
}
if (versioncheck ($version, '3.07', 'update_306-307.php', $response)) {
$version = '3.07';
}
if (versioncheck ($version, '3.08', 'update_307-308.php', $response)) {
$version = '3.08';
}
if (versioncheck ($version, '3.09', 'update_308-309.php', $response)) {
$version = '3.09';
}
if (versioncheck ($version, '3.10', 'update_309-310.php', $response)) {
$version = '3.10';
}
if (versioncheck ($version, '3.20', 'update_310-320.php', $response)) {
$version = '3.20';
}
if (versioncheck ($version, '3.30', 'update_320-330.php', $response)) {
$version = '3.30';
}
if (versioncheck ($version, '3.40', 'update_330-340.php', $response)) {
$version = '3.40';
}
if (versioncheck ($version, '3.60', 'update_340-360.php', $response)) {
$version = '3.60';
}
if (versioncheck ($version, '3.70', 'update_360-370.php', $response)) {
$version = '3.70';
}
if (versioncheck ($version, '4.00', 'update_370-400.php', $response)) {
$version = '4.00';
}
if (versioncheck ($version, '4.10', 'update_400-410.php', $response)) {
$version = '4.10';
}
$response->add('Repairing tables if needed.');
include(EASYWIDIR . '/stuff/tables_repair.php');
# Ende
if (!isset($updateinclude) or $updateinclude == false) {
$response->add("<br />Database successfully updated!<br /> <b> Please remove the \"install/\" folder and all of it´s content.</b>");
echo $response->printresponse();
$sql = null;
$response->add("<br />Database successfully updated!<br /> <b> Please remove the \"install/\" folder and all of it´s content.</b>");
echo $response->printresponse();
$sql = null;
}

View File

@ -40,28 +40,37 @@
if (isset($include) and $include == true) {
$query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES
('4.10','<div align=\"right\">31.08.2013</div>
('4.10','<div align=\"right\">16.10.2013</div>
<b>Änderungen:</b><br/>
<ul>
</ul>
<br/><br/>
<b>Bugfixes:</b><br />
<ul>
</ul>
','<div align=\"right\">08.31.2013</div>
','<div align=\"right\">10.16.2013</div>
<b>Changes:</b><br/>
<ul>
</ul>
<br/><br/>
<b>Bugfixes:</b><br />
<ul>
</ul>
')");
$query->execute();
$response->add('Action: insert_easywi_version done: ');
$query->closecursor();
$query="CREATE TABLE IF NOT EXISTS `addons_allowed` (
`addon_id` int(10) unsigned NOT NULL,
`servertype_id` int(10) unsigned NOT NULL,
`reseller_id` int(10) unsigned NULL DEFAULT 0,
PRIMARY KEY (`addon_id`,`servertype_id`),KEY(`reseller_id`)
) ENGINE=InnoDB";
$add = $sql->prepare($query);
$add->execute();
$query = $sql->prepare("SELECT s.`id` AS `servertype_id`,s.`resellerid`,a.`id` AS `addon_id` FROM `servertypes` AS s LEFT JOIN `addons` AS a ON s.`shorten`=a.`shorten` OR s.`qstat`=a.`shorten` WHERE a.`id` IS NOT NULL");
$query2 = $sql->prepare("INSERT INTO `addons_allowed` (`addon_id`,`servertype_id`,`reseller_id`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `addon_id`=`addon_id`");
$query->execute();
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($row['addon_id'],$row['servertype_id'],$row['resellerid']));
}
$query = $sql->prepare("SELECT 1 FROM `servertypes` WHERE `shorten`='samp' AND `resellerid`=0 LIMIT 1");
$query->execute();
if ($query->rowCount() == 0) {

View File

@ -14,7 +14,7 @@
<addon_ud>Das Addon wurde erfolgreich aktualisiert</addon_ud>
<add_addon>Addon erstellen</add_addon>
<all>Alles</all>
<aname>Addonname:</aname>
<aname>Addonname</aname>
<bin>Binary</bin>
<bin_folder>Binaryverzeichnis(z.B. orangebox)</bin_folder>
<configs>Configs, die vom User editierbar sein sollen</configs>
@ -37,8 +37,8 @@
<maps>Mappackages</maps>
<mod>Modverzeichnis (z.B. cstrike und dod)</mod>
<modcmds>Befehle für Gamemods</modcmds>
<mods2>Mod zum Spiel:</mods2>
<mods>Spielemodifikation:</mods>
<mods2>Mod zum Spiel</mods2>
<mods>Spielemodifikation</mods>
<multi>Plattform</multi>
<password>Passwort</password>
<port>Gameserverport</port>
@ -52,8 +52,8 @@
<requires>Benötigt</requires>
<rmcmd>entferne vom Startbefehl</rmcmd>
<servername>Servername</servername>
<showg>Zeige Addons zu:</showg>
<shown>Ergebnisse pro Seite:</shown>
<showg>Zeige Addons zu</showg>
<shown>Ergebnisse pro Seite</shown>
<single>Spiel</single>
<slots>Serverslots</slots>
<start>Startbefehl</start>
@ -66,6 +66,6 @@
<tool>Servertool</tool>
<tools>Servertool, Addons, Configpakete</tools>
<tvport>SourceTV Port</tvport>
<type2>Addon für:</type2>
<type2>Addon für</type2>
<type>Map, oder Servertool</type>
</sprache>

View File

@ -14,7 +14,7 @@
<addon_ud>Addon blevet opdateret</addon_ud>
<add_addon>Opret Addon</add_addon>
<all>ALLE</all>
<aname>Addonnavn:</aname>
<aname>Addonnavn</aname>
<bin>Binary</bin>
<bin_folder>Binary mappe (for eksempel orangebox)</bin_folder>
<configs>Bruger Redigerbar configs</configs>
@ -37,8 +37,8 @@
<maps>Kort Pakker</maps>
<mod>Modmappe (for eksempel cstrike and dod)</mod>
<modcmds>Kommandoer for Spiltilstande</modcmds>
<mods2>Mod for spillet:</mods2>
<mods>Modifikation:</mods>
<mods2>Mod for spillet</mods2>
<mods>Modifikation</mods>
<multi>Platform</multi>
<password>Adgangskode</password>
<port>Spilserverport</port>
@ -52,8 +52,8 @@
<requires>Kræver</requires>
<rmcmd>fjerne fra startkommando</rmcmd>
<servername>Servernavn</servername>
<showg>Vis addons for:</showg>
<shown>Resultater per side:</shown>
<showg>Vis addons for</showg>
<shown>Resultater per side</shown>
<single>Spil</single>
<slots>Serverantal</slots>
<start>Start Kommando</start>
@ -66,6 +66,6 @@
<tool>Server værktøj</tool>
<tools>Serverværktøj, Addons, Configpakker</tools>
<tvport>SourceTV Port</tvport>
<type2>Addon for:</type2>
<type2>Addon for</type2>
<type>Kort eller Serverværktøj</type>
</sprache>

View File

@ -14,7 +14,7 @@
<addon_ud>Addon successfully updated</addon_ud>
<add_addon>Create Addon</add_addon>
<all>ALL</all>
<aname>Addonname:</aname>
<aname>Addonname</aname>
<bin>Binary</bin>
<bin_folder>Binaryfolder (for example orangebox)</bin_folder>
<configs>Usereditable configs</configs>
@ -37,8 +37,8 @@
<maps>Mappackages</maps>
<mod>Modfolder (for example cstrike and dod)</mod>
<modcmds>Commands regarding Gamemods</modcmds>
<mods2>Mod for the game:</mods2>
<mods>Modification:</mods>
<mods2>Mod for the game</mods2>
<mods>Modification</mods>
<multi>Plattform</multi>
<password>Password</password>
<port>Gameserverport</port>
@ -52,8 +52,8 @@
<requires>Requires</requires>
<rmcmd>remove from startcommand</rmcmd>
<servername>Servername</servername>
<showg>Show addons for:</showg>
<shown>Results per page:</shown>
<showg>Show addons for</showg>
<shown>Results per page</shown>
<single>Game</single>
<slots>Serverslots</slots>
<start>Startcommand</start>
@ -66,6 +66,6 @@
<tool>Servertool</tool>
<tools>Servertool, Addons, Configpackages</tools>
<tvport>SourceTV Port</tvport>
<type2>Addon for:</type2>
<type2>Addon for</type2>
<type>Map, or Servertool</type>
</sprache>

View File

@ -1,4 +1,5 @@
<?php
/**
* File: serverallocation.php.
* Author: Ulrich Block
@ -41,6 +42,7 @@ include(EASYWIDIR . '/stuff/class_validator.php');
include(EASYWIDIR . '/stuff/vorlage.php');
include(EASYWIDIR . '/stuff/config.php');
include(EASYWIDIR . '/stuff/settings.php');
$die = false;
if (!isset($admin_id) and !isset($user_id)) {
redirect('login.php');
@ -51,9 +53,11 @@ if (!isset($admin_id) and !isset($user_id)) {
} else {
$die = true;
}
if (!isset($pa) or count($pa)==0 or ((!isset($admin_id) and !isset($user_id)) or (((!$pa['gserver']) and !$pa['voiceserver'] and !$pa['voicemasterserver'] and !$pa['traffic'] and !$pa['user'] and !rsellerpermisions($admin_id) and !$pa['usertickets']) and (!$pa['restart'] and !$pa['usertickets'])))) {
$die = true;
}
if ($ui->smallletters('w',5, 'get') == 'check') {
$return='bad';
if ($ui->w('method',40, 'get')) {
@ -62,10 +66,13 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
else if ($ui->$method('check', 'get')) $return='ok';
}
echo $return;
} else if ($die == true) {
redirect('login.php');
} else if ($ui->username('mapgroup','50', 'get')) {
$sprache = getlanguagefile('gserver', $user_language, $reseller_id);
$query = $sql->prepare("SELECT `mapGroup` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($ui->username('mapgroup','50', 'get'), $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
@ -74,6 +81,7 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
require_once IncludeTemplate($template_to_use,'ajax_userpanel_mapgroup.tpl');
}
}
} else if ($ui->id('id',19, 'get') and $ui->st('d', 'get')=="vs" and ($pa['addvserver'] or $pa['root'])) {
$sprache = getlanguagefile('reseller', $user_language, $reseller_id);
if ($reseller_id != 0 and $admin_id != $reseller_id) {
@ -162,8 +170,10 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
}
}
require_once IncludeTemplate($template_to_use,'ajax_admin_vserver_allocation.tpl');
} else if ($ui->st('d', 'get')=="ui" and $ui->id('id',19, 'get')) {
foreach (freeips($ui->id('id',19, 'get')) as $ip) echo $ip."<br />";
} else if ($ui->st('d', 'get')=="my" and $ui->id('id',19, 'get')) {
$query = $sql->prepare("SELECT s.`ip`,s.`max_databases`,COUNT(d.`id`) AS `installed` FROM `mysql_external_servers` s LEFT JOIN `mysql_external_dbs` d ON s.`id`=d.`sid` WHERE s.`id`=? AND s.`active`='Y' AND s.`resellerid`=? LIMIT 1");
$query->execute(array($ui->id('id',19, 'get'), $reseller_id));
@ -176,6 +186,7 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
$max_databases = 0;
}
require_once IncludeTemplate($template_to_use,'ajax_admin_mysql_server.tpl');
} else if ($ui->st('d', 'get')=="tr" and $ui->st('w', 'get')) {
if ($ui->st('w', 'get')=="su") {
if ($reseller_id == 0) {
@ -371,6 +382,9 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
$rootServer->setUpdating();
echo $sprache->root_updatemaster." ( ".implode(", ", $gamelist)." )";
}
if (isset($debug) and $debug == 1) {
echo '<br>' . implode('<br>', $rootServer->sshcmd);
}
}
} else if (($pa['voiceserver'] or $pa['voiceserver']) and $ui->st('d', 'get')=="vo" and $ui->id('id',19, 'get')) {
$sprache = getlanguagefile('voice', $user_language, $reseller_id);

View File

@ -1,4 +1,5 @@
<?php
/**
* File: addons.php.
* Author: Ulrich Block
@ -39,7 +40,8 @@ if ((!isset($admin_id) or !$main == 1) or (isset($admin_id) and !$pa['addons']))
header('Location: admin.php');
die('No acces');
}
$sprache = getlanguagefile('images',$user_language,$reseller_id);
$sprache = getlanguagefile('images', $user_language, $reseller_id);
$loguserid = $admin_id;
$logusername = getusername($admin_id);
$logusertype = 'admin';
@ -47,27 +49,37 @@ if ($reseller_id == 0) {
$logreseller = 0;
$logsubuser = 0;
} else {
$logsubuser=(isset($_SESSION['oldid'])) ? $_SESSION['oldid'] : 0;
$logsubuser = (isset($_SESSION['oldid'])) ? $_SESSION['oldid'] : 0;
$logreseller = 0;
}
if ($reseller_id != 0 and $admin_id != $reseller_id) $reseller_id = $admin_id;
if ($ui->w('action', 4, 'post') and !token(true)) {
if ($reseller_id != 0 and $admin_id != $reseller_id) {
$reseller_id = $admin_id;
}
// CSFR protection with hidden tokens. If token(true) returns false, we likely have an attack
if ($ui->w('action',4, 'post') and !token(true)) {
$template_file = $spracheResponse->token;
// A simple exporter. Offers the current addon settings as download
} else if ($ui->st('d', 'get') == 'ex' and $ui->id('id', 10, 'get')) {
$xml=new DOMDocument('1.0','utf-8');
$xml = new DOMDocument('1.0','utf-8');
$element = $xml->createElement('addon');
$query = $sql->prepare("SELECT * FROM `addons` WHERE `id`=? AND `resellerid`=?");
$query->execute(array($ui->id('id', 10, 'get'),$reseller_id));
$query->execute(array($ui->id('id', 10, 'get'), $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$addon = $row['addon'];
foreach ($row as $k=>$v) {
if (!in_array($k, array('id','resellerid','depending'))) {
$key = $xml->createElement($k,$v);
$key = $xml->createElement($k, $v);
$element->appendChild($key);
}
}
}
$xml->appendChild($element);
if (isset($addon)) {
header("Cache-Control: public");
header("Content-Description: File Transfer");
@ -80,343 +92,346 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
} else {
$template_file = 'admin_404.tpl';
}
} else if ($ui->st('d', 'get') == 'ad') {
if ($ui->smallletters('action',2, 'post') == 'ad' and $ui->id('import',1, 'post')!=1) {
$fail = 0;
$template_file = '';
if (!$ui->gamestring('shorten', 'post')) {
$template_file .="Shorten<br />";
$fail = 1;
}
if (!$ui->smallletters('type',99, 'post')) {
$template_file .="type<br />";
$fail = 1;
}
if (!$ui->gamestring('addon', 'post')) {
$template_file .="Addon<br />";
$fail = 1;
}
if (!$ui->description('menudescription', 'post')) {
$template_file .="Menuescription<br />";
$fail = 1;
}
if (!$ui->active('paddon', 'post')) {
$fail = 1;
}
if (!$ui->id('depending',19, 'post') and $ui->escaped('depending', 'post') != 0) {
$fail = 1;
}
if ($fail!=1){
$shorten = $ui->gamestring('shorten', 'post');
$type = $ui->smallletters('type',99, 'post');
$addon = $ui->gamestring('addon', 'post');
$paddon = $ui->active('paddon', 'post');
$depending = $ui->escaped('depending', 'post');
$folder = $ui->folder('folders', 'post');
$active = $ui->active('active', 'post');
$menudescription = $ui->description('menudescription', 'post');
$configs = $ui->startparameter('configs', 'post');
$cmd = $ui->startparameter('cmd', 'post');
$rmcmd = $ui->startparameter('rmcmd', 'post');
if ($reseller_id == 0) {
$query2 = $sql->prepare("SELECT `id` FROM `userdata` WHERE `accounttype`='r'");
$query2->execute();
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` WHERE ((`shorten`=? AND `addon`=?) OR `folder`=?) AND `resellerid`=? LIMIT 1");
$query->execute(array($shorten,$addon,$folder,$reseller_id));
if ($query->fetchColumn()<=0) {
$query = $sql->prepare("INSERT INTO `addons` (`shorten`,`type`,`addon`,`paddon`,`folder`,`active`,`menudescription`,`configs`,`cmd`,`rmcmd`,`depending`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
$query->execute(array($shorten,$type,$addon,$paddon,$folder,$active,$menudescription,$configs,$cmd,$rmcmd,$depending,$reseller_id));
$query = $sql->prepare("SELECT `id` FROM `addons` WHERE `shorten`=? AND `addon`=? AND `menudescription`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($shorten,$addon,$menudescription,$reseller_id));
$id = $query->fetchColumn();
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ad',?,?,?,?) ON DUPLICATE KEY UPDATE `resellerID`=`resellerID`");
if ($ui->smallletters('language',2, 'post')) {
$array=(array)$ui->smallletters('language',2, 'post');
foreach($array as $language) {
if (small_letters_check($language, '2')) {
$query->execute(array($id,$language,$ui->description("description_$language", 'post'),$reseller_id));
// Add and modify entries. Same validation can be used.
} else if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
// At this point all variables are defined that can come from the user
$id = $ui->id('id', 10, 'get');
$shortens = (array) $ui->id('shorten', 10, 'post');
$type = (string) $ui->smallletters('type', 99, 'post');
$addon = (string) $ui->gamestring('addon', 'post');
$folder = (string) $ui->folder('folders', 'post');
$active = (string) $ui->active('active', 'post');
$menudescription = (string) $ui->description('menudescription', 'post');
$configs = (string) $ui->startparameter('configs', 'post');
$cmd = (string) $ui->startparameter('cmd', 'post');
$rmcmd = (string) $ui->startparameter('rmcmd', 'post');
// Default variables. Mostly needed for the add operation
$gamesAssigned = array();
$dependings = array();
$foundLanguages = array();
$default_language = $rSA['language'];
$paddon = ($ui->active('paddon', 'post')) ? (string) $ui->active('paddon', 'post') : 'N';
$depending = ($ui->id('depending',19, 'post')) ? (int) $ui->id('depending', 19, 'post') : 0;
// Error handling. Check if required attributes are set and can be validated
$errors = array();
// Add or mod is opened
if (!$ui->smallletters('action', 2, 'post') or $ui->id('import', 1, 'post')) {
// Gather data for adding if needed and define add template
if ($ui->st('d', 'get') == 'ad' or $ui->id('import',1, 'post') == 1) {
$token = token();
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `type`='tool' AND `resellerid`=? ORDER BY `menudescription`");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$dependings[] = '<option value="'.$row['id'].'">'.$row['menudescription'].'</option>';
}
if ($ui->id('import',1, 'post') == 1 and $_FILES["file"]["error"] == 0 and $_FILES["file"]["type"] == 'text/xml') {
$shorten = $_FILES["file"]["name"];
try {
$xml=new DOMDocument();
if (@$xml->load($_FILES["file"]["tmp_name"]) !== false) {
$childNodes = $xml->documentElement;
foreach ($childNodes->childNodes AS $node) {
if ($node->nodeName == 'active') {
$active = $node->nodeValue;
}
if ($node->nodeName == 'paddon') {
$paddon = $node->nodeValue;
}
if ($node->nodeName == 'addon') {
$addon = $node->nodeValue;
}
if ($node->nodeName == 'type') {
$type = $node->nodeValue;
}
if ($node->nodeName == 'folder') {
$folder = $node->nodeValue;
}
if ($node->nodeName == 'menudescription') {
$menudescription = $node->nodeValue;
}
if ($node->nodeName == 'configs') {
$configs = $node->nodeValue;
}
if ($node->nodeName == 'cmd') {
$cmd = $node->nodeValue;
}
if ($node->nodeName == 'rmcmd') {
$rmcmd = $node->nodeValue;
}
}
}
$template_file = $sprache->addon_add;
} else {
$template_file = 'Error: Addon with the same name already exists';
}
} else {
$query2 = $sql->prepare("SELECT `id` FROM `userdata` WHERE `accounttype`='r' AND `resellerid`=? LIMIT 1");
$query2->execute(array($reseller_id));
}
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row) {
$resellerid = $row['id'];
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` WHERE ((`shorten`=? AND `addon`=?) OR `folder`=?) AND `resellerid`=? LIMIT 1");
$query->execute(array($shorten,$addon,$folder,$resellerid));
if ($query->fetchColumn()<=0) {
$query = $sql->prepare("INSERT INTO `addons` (`shorten`,`type`,`addon`,`paddon`,`folder`,`active`,`menudescription`,`configs`,`cmd`,`rmcmd`,`depending`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
$query->execute(array($shorten,$type,$addon,$paddon,$folder,$active,$menudescription,$configs,$cmd,$rmcmd,$depending,$resellerid));
$query = $sql->prepare("SELECT `id` FROM `addons` WHERE `shorten`=? AND `addon`=? AND `menudescription`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($shorten,$addon,$menudescription,$resellerid));
$id = $query->fetchColumn();
if ($ui->smallletters('language',2, 'post')) {
$array=(array)$ui->smallletters('language',2, 'post');
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ad',?,?,?,?) ON DUPLICATE KEY UPDATE `resellerID`=`resellerID`");
foreach($array as $language) {
if (small_letters_check($language, '2')) {
$query->execute(array($id,$language,$ui->description("description_$language", 'post'),$resellerid));
}
}
}
$template_file = $sprache->addon_add;
} catch(Exception $error) {
$active = '';
}
}
if (!isset($template_file)) {
$template_file = $sprache->error_exist;
$template_file = 'admin_addons_add.tpl';
// Gather data for modding in case we have an ID and define mod template
} else if ($ui->st('d', 'get') == 'md' and $id) {
$query = $sql->prepare("SELECT * FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$shorten = $row['shorten'];
$type = $row['type'];
$addon = $row['addon'];
$paddon = $row['paddon'];
$folder = $row['folder'];
$active = $row['active'];
$configs = $row['configs'];
$menudescription = $row['menudescription'];
$cmd = $row['cmd'];
$rmcmd = $row['rmcmd'];
$depending = $row['depending'];
}
$loguseraction="%add% %addon% $addon";
$insertlog->execute();
$rowCount = $query->rowCount();
$query = $sql->prepare("SELECT `servertype_id` FROM `addons_allowed` WHERE `addon_id`=? AND `reseller_id`=?");
$query->execute(array($id, $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$shortens[] = $row['servertype_id'];
}
$rowCount += $query->rowCount();
// Check if database entry exists and if not display 404 page
$template_file = ($rowCount > 0) ? 'admin_addons_md.tpl' : 'admin_404.tpl';
// Show 404 if GET parameters did not add up or no ID was given with mod
} else {
$template_file = "Error: ".$template_file;
$template_file = 'admin_404.tpl';
}
} else {
$token=token();
$table = array();
$query = $sql->prepare("SELECT `shorten`,`description` FROM `servertypes` WHERE `resellerid`=?");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table[] = array('shorten' => $row['shorten'], 'description' => $row['description']);
// Form is submitted
} else if ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') {
if (!$ui->active('active', 'post')) {
$errors['active'] = $sprache->active;
}
$query = $sql->prepare("SELECT `qstat`,`description` FROM `qstatshorten`");
$query->execute();
$table2 = array();
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$exist = $row['qstat'];
$query2 = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `servertypes` WHERE `qstat`=? AND `resellerid`=? LIMIT 1");
$query2->execute(array($exist,$reseller_id));
if ($query2->fetchColumn()>0) {
$table2[] = array('qstat' => $row['qstat'], 'description' => $row['description']);
}
}
$foundlanguages = array();
foreach ($languages as $row) {
if (small_letters_check($row, '2')) {
if ($row==$rSA['language']) {
$style = '';
$displayNone = '';
$checkbox='<input type="checkbox" name="language[]" value="'.$row.'" onclick="textdrop('."'".$row."'".');" checked /> ';
} else {
$style='style="display: none;"';
$displayNone='display_none';
$checkbox='<input type="checkbox" name="language[]" value="'.$row.'" onclick="textdrop('."'".$row."'".');" /> ';
}
$foundlanguages[] = array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'display' => $displayNone);
}
}
$dependings = array();
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `type`='tool' AND `resellerid`=? ORDER BY `menudescription`");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$dependings[] = '<option value="'.$row['id'].'">'.$row['menudescription'].'</option>';
}
$active = '';
$paddon = '';
$shorten = '';
$addon = '';
$type = '';
$folder = '';
$menudescription = '';
$configs = '';
$cmd = '';
$rmcmd = '';
if ($ui->id('import',1, 'post')==1 and $_FILES["file"]["error"]==0 and $_FILES["file"]["type"] == 'text/xml') {
$shorten = $_FILES["file"]["name"];
try {
$xml=new DOMDocument();
if (@$xml->load($_FILES["file"]["tmp_name"]) !== false) {
$childNodes = $xml->documentElement;
foreach ($childNodes->childNodes AS $node) {
if ($node->nodeName == 'active') $active = $node->nodeValue;
if ($node->nodeName == 'paddon ') $paddon = $node->nodeValue;
if ($node->nodeName == 'shorten') $shorten = $node->nodeValue;
if ($node->nodeName == 'addon') $addon = $node->nodeValue;
if ($node->nodeName == 'type') $type = $node->nodeValue;
if ($node->nodeName == 'folder') $folder = $node->nodeValue;
if ($node->nodeName == 'menudescription') $menudescription = $node->nodeValue;
if ($node->nodeName == 'configs') $configs = $node->configs;
if ($node->nodeName == 'cmd') $cmd = $node->nodeValue;
if ($node->nodeName == 'rmcmd') $rmcmd = $node->nodeValue;
}
}
} catch(Exception $error) {
$active = '';
}
}
$template_file = "admin_addons_add.tpl";
}
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id','30', 'get')) {
$addonid = $ui->id('id','30', 'get');
if (!isset($action)) {
$query = $sql->prepare("SELECT `menudescription` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
$menudescription = $query->fetchColumn();
$template_file = "admin_addons_dl.tpl";
} else if ($action == 'dl'){
$query = $sql->prepare("SELECT menudescription,type,folder,addon FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$menudescription = $row['menudescription'];
$type = $row['type'];
$folder = $row['folder'];
$addon = $row['addon'];
}
$query = $sql->prepare("DELETE FROM `addons_installed` WHERE `addonid`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
$query = $sql->prepare("DELETE FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=?");
$query->execute(array($addonid,$reseller_id));
$loguseraction="%del% %addon% $addon";
$insertlog->execute();
$template_file = $sprache->addon_del;
} else {
$template_file = 'admin_404.tpl';
}
} else if ($ui->st('d', 'get') == 'md' and $ui->id('id','30', 'get')) {
$addonid = $ui->id('id','30', 'get');
if (!isset($action)) {
$table = array();
$table2 = array();
$query = $sql->prepare("SELECT `shorten`,`description` FROM `servertypes` WHERE `resellerid`=?");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table[] = array('shorten' => $row['shorten'], 'description' => $row['description']);
}
$query = $sql->prepare("SELECT `qstat`,`description` FROM `qstatshorten`");
$countp = $sql->prepare("SELECT `id` FROM `servertypes` WHERE `qstat`=? AND `resellerid`=? LIMIT 1");
$query->execute();
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$exist = $row['qstat'];
$countp->execute(array($exist,$reseller_id));
$exnum = $countp->rowCount();
if ($exnum>=1) {
$table2[] = array('qstat' => $row['qstat'], 'description' => $row['description']);
}
}
$query = $sql->prepare("SELECT * FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$shorten = $row['shorten'];
$type = $row['type'];
$addon = $row['addon'];
$paddon = $row['paddon'];
$folder = $row['folder'];
$active = $row['active'];
$configs = $row['configs'];
$menudescription = $row['menudescription'];
$cmd = $row['cmd'];
$rmcmd = $row['rmcmd'];
$depending = $row['depending'];
}
$default_language = $rSA['language'];
$foundlanguages = array();
$query = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
foreach ($languages as $row) {
if (small_letters_check($row, '2')) {
unset($lang);
$description = '';
$query->execute(array($addonid, $row,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$lang = $row2['lang'];
$description = $row2['text'];
}
if (isset($lang)) {
$style = '';
$displayNone = '';
$checkbox="<input type=\"checkbox\" name=\"language[]\" value=\"$row\" onclick=\"textdrop('$row');\" checked /> ";
} else {
$displayNone='display_none';
$style="style=\"display: none;\"";
$checkbox="<input type=\"checkbox\" name=\"language[]\" value=\"$row\" onclick=\"textdrop('$row');\" /> ";
}
$foundlanguages[] = array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'description' => $description,'display' => $displayNone);
}
}
$dependings = array();
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `type`='tool' AND `type`=? AND `resellerid`=? ORDER BY `menudescription`");
$query->execute(array($type,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (isset($depending) and $depending==$row['id']) $dependings[] = '<option value="'.$row['id'].'" selected="selected">'.$row['menudescription'].'</option>';
else $dependings[] = '<option value="'.$row['id'].'">'.$row['menudescription'].'</option>';
}
$template_file = "admin_addons_md.tpl";
} else if ($action == 'md'){
$fail = 0;
$template_file = '';
if (!$ui->gamestring('shorten', 'post')) {
$template_file .="Shorten<br />";
$fail = 1;
}
if (!$ui->smallletters('type',99, 'post')) {
$template_file .="type<br />";
$fail = 1;
}
if (!$ui->gamestring('addon', 'post')) {
$template_file .="Addon<br />";
$fail = 1;
if (!$ui->smallletters('type', 99, 'post')) {
$errors['type'] = $sprache->type;
}
if (!$ui->description('menudescription', 'post')) {
$template_file .="Menuescription<br />";
$fail = 1;
$errors['menudescription'] = $sprache->addon2;
}
if (!$ui->active('paddon', 'post')) {
$fail = 1;
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` WHERE `addon`=? AND `id`!=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addon, (int) $id, $reseller_id));
if ($query->fetchColumn() > 0) {
$errors['addon'] = $sprache->addon;
}
if (!$ui->id('depending',19, 'post') and $ui->escaped('depending', 'post') != 0) {
$fail = 1;
}
if ($fail!=1){
$shorten = $ui->gamestring('shorten', 'post');
$type = $ui->smallletters('type',99, 'post');
$addon = $ui->gamestring('addon', 'post');
$paddon = $ui->active('paddon', 'post');
$depending = $ui->escaped('depending', 'post');
$folder = $ui->folder('folders', 'post');
$active = $ui->active('active', 'post');
$menudescription = $ui->description('menudescription', 'post');
$configs = $ui->startparameter('configs', 'post');
$cmd = $ui->startparameter('cmd', 'post');
$rmcmd = $ui->startparameter('rmcmd', 'post');
$query = $sql->prepare("UPDATE `addons` SET `shorten`=?,`menudescription`=?,`active`=?,`folder`=?,`addon`=?,`paddon`=?,`type`=?,`configs`=?,`cmd`=?,`rmcmd`=?,`depending`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($shorten,$menudescription,$active,$folder,$addon,$paddon,$type,$configs,$cmd,$rmcmd,$depending,$addonid,$reseller_id));
if ($ui->smallletters('language',2, 'post')) {
$array=(array)$ui->smallletters('language',2, 'post');
$query2 = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ad',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
// Submitted values are OK
if (count($errors) == 0) {
// Make the inserts or updates define the log entry and get the affected rows from insert
if ($ui->st('action', 'post') == 'ad') {
$query = $sql->prepare("INSERT INTO `addons` (`type`,`addon`,`paddon`,`folder`,`active`,`menudescription`,`configs`,`cmd`,`rmcmd`,`depending`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
$query->execute(array($type, $addon, $paddon, $folder, $active, $menudescription, $configs, $cmd, $rmcmd, $depending, $reseller_id));
$id = $sql->lastInsertId();
$rowCount = $query->rowCount();
$loguseraction = '%add% %addon% ' . $addon;
} else if ($ui->st('action', 'post') == 'md') {
$query = $sql->prepare("UPDATE `addons` SET `menudescription`=?,`active`=?,`folder`=?,`addon`=?,`paddon`=?,`type`=?,`configs`=?,`cmd`=?,`rmcmd`=?,`depending`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($menudescription, $active, $folder, $addon, $paddon, $type, $configs, $cmd, $rmcmd, $depending, $id, $reseller_id));
$rowCount = $query->rowCount();
$loguseraction = '%mod% %addon% ' . $addon;
}
// Insert and update translations
if ($id > 0 and $ui->smallletters('language', 2, 'post')) {
$array = (array) $ui->smallletters('language', 2, 'post');
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ad',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach($array as $language) {
if (small_letters_check($language, '2')) {
$description = $ui->description("description_$language", 'post');
$query2->execute(array($addonid,$language,$description,$reseller_id));
if (small_letters_check($language, 2)) {
$description = $ui->description('description', 'post', $language);
$query->execute(array($id, $language, $description, $reseller_id));
$rowCount += $query->rowCount();
}
}
$query = $sql->prepare("SELECT `lang` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=?");
$query->execute(array($addonid,$reseller_id));
$query2 = $sql->prepare("DELETE FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row2) {
if (!in_array($row2['lang'],$array)) {
$query2->execute(array($addonid, $row2['lang'],$reseller_id));
$query->execute(array($id, $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (!in_array($row['lang'], $array)) {
$query2->execute(array($id, $row['lang'], $reseller_id));
$rowCount += $query2->rowCount();
}
}
} else {
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=?");
$query->execute(array($addonid,$reseller_id));
$query->execute(array($id, $reseller_id));
$rowCount += $query->rowCount();
}
$template_file = $sprache->addon_ud;
$loguseraction="%mod% %addon% $addon";
$insertlog->execute();
// Insert and update game relations
if ($id > 0 and count($shortens) > 0) {
$query = $sql->prepare("INSERT INTO `addons_allowed` (`addon_id`,`servertype_id`,`reseller_id`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `addon_id`=`addon_id`");
foreach ($shortens as $shorten) {
$query->execute(array($id, $shorten, $reseller_id));
$rowCount += $query->rowCount();
}
$query = $sql->prepare("SELECT `servertype_id` FROM `addons_allowed` WHERE `addon_id`=? AND `reseller_id`=?");
$query2 = $sql->prepare("DELETE FROM `addons_allowed` WHERE `addon_id`=? AND `servertype_id`=? AND `reseller_id`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (!in_array($row['servertype_id'], $shortens)) {
$query2->execute(array($id, $row['servertype_id'], $reseller_id));
$rowCount += $query2->rowCount();
}
}
} else {
$query = $sql->prepare("DELETE FROM `addons_allowed` WHERE `addon_id`=? AND `reseller_id`=?");
$query->execute(array($id, $reseller_id));
$rowCount += $query->rowCount();
}
// Check if a row was affected during insert or update
if (isset($rowCount) and $rowCount > 0) {
$insertlog->execute();
$template_file = $spracheResponse->table_add;
// No update or insert failed
} else {
$template_file = $spracheResponse->error_table;
}
// An error occurred during validation unset the redirect information and display the form again
} else {
$template_file = "Error:<br />".$template_file;
unset($header, $text);
$token = token();
$template_file = ($ui->st('d', 'get') == 'ad') ? 'admin_addons_add.tpl' : 'admin_addons_md.tpl';
}
}
$query = $sql->prepare("SELECT `id`,`description` FROM `servertypes` WHERE `resellerid`=?");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$gamesAssigned[$row['id']] = $row['description'];
}
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `type`='tool' AND `type`=? AND `resellerid`=? ORDER BY `menudescription`");
$query->execute(array($type,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$dependings[] = (isset($depending) and $depending == $row['id']) ? '<option value="' . $row['id'] . '" selected="selected">' . $row['menudescription'] . '</option>' : '<option value="' . $row['id'] . '">' . $row['menudescription'] . '</option>';
}
$query = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
foreach ($languages as $row) {
if (small_letters_check($row, 2)) {
unset($lang);
$description = '';
$query->execute(array($id, $row,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$lang = $row2['lang'];
$description = $row2['text'];
}
if (isset($lang)) {
$style = '';
$displayNone = '';
$checkbox = '<input type="checkbox" name="language[]" value="' . $row . '" onclick="textdrop(' . "'" . $row . "'" . ');" checked>';
} else {
$displayNone = 'display_none';
$style = 'style="display: none;"';
$checkbox = '<input type="checkbox" name="language[]" value="' . $row . '" onclick="textdrop(' . "'" . $row . "'" . ');">';
}
$foundLanguages[] = array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'description' => $description,'display' => $displayNone);
}
}
// Remove entries in case we have an ID given with the GET request
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id', 10, 'get')) {
// Define the ID variable which will be used at the form and SQLs
$id = $ui->id('id', 10, 'get');
// Nothing submitted yet, display the delete form
if (!$ui->st('action', 'post')) {
$query = $sql->prepare("SELECT `menudescription` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
$menudescription = $query->fetchColumn();
// Check if we could find an entry and if not display 404 page
$template_file = ($query->rowCount() > 0) ? 'admin_addons_dl.tpl' : 'admin_404.tpl';
// User submitted remove the entry
} else if ($ui->st('action', 'post') == 'dl') {
$query = $sql->prepare("SELECT `addon` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
$addon = $query->fetchColumn();
// Check if a row was affected meaning an entry could be deleted. If yes add log entry and display success message
if ($query->rowCount()>0) {
$query = $sql->prepare("DELETE FROM `addons_allowed` WHERE `addon_id`=? AND `reseller_id`=?");
$query->execute(array($id, $reseller_id));
$query = $sql->prepare("DELETE FROM `addons_installed` WHERE `addonid`=? AND `resellerid`=?");
$query->execute(array($id, $reseller_id));
$query = $sql->prepare("DELETE FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=?");
$query->execute(array($id, $reseller_id));
$template_file = $spracheResponse->table_del;
$loguseraction = '%del% %addon% ' . $addon;
$insertlog->execute();
// Nothing was deleted, display an error
} else {
$template_file = $spracheResponse->error_table;
}
// GET Request did not add up. Display 404 error.
} else {
$template_file = 'admin_404.tpl';
}
// List the available entries
} else {
$table = array();
if (!isset($start)) {
$start = 0;
}
if (!isset($amount)) {
$amount = 20;
}
$o = $ui->st('o', 'get');
if ($ui->st('o', 'get') == 'ds') {
$orderby = '`active` DESC';
@ -440,23 +455,36 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$o = 'ai';
$orderby = '`id` ASC';
}
$table = array();
$pselect = $sql->prepare("SELECT `id`,`menudescription`,`shorten`,`active`,`type` FROM `addons` $where ORDER BY $orderby LIMIT $start,$amount");
$pselect->execute(array(':reseller_id' => $reseller_id));
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
$atype = '';
$gtype = '';
$shorten = $row['shorten'];
$pselect2 = $sql->prepare("SELECT `description` FROM `qstatshorten` WHERE `qstat`=? LIMIT 1");
$pselect2->execute(array($shorten));
foreach ($pselect2->fetchAll(PDO::FETCH_ASSOC) as $exrow) {
$atype = $sprache->multi;
$gtype = $exrow['description'];
}
if ($atype == '') {
$atype = $sprache->single;
$gtype = $shorten;
}
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` WHERE `resellerid`=?");
$query->execute(array($reseller_id));
$colcount = $query->fetchColumn();
$next = $start + $amount;
$vor = ($colcount>$next) ? $next : $start;
$back = $start - $amount;
$zur = ($back >= 0) ? ($start - $amount) : $start;
$pageamount = ceil($colcount / $amount);
$link = '<a href="admin.php?w=ad&amp;d=md&amp;o=' . $o . '&amp;a=' . $amount;
$link .= ($start == 0) ? '&amp;p=0" class="bold">1</a>' : '&amp;p=0">1</a>';
$i = 2;
$pages[] = $link;
while ($i <= $pageamount) {
$selectpage = ($i - 1) * $amount;
$pages[] = ($start == $selectpage) ? '<a href="admin.php?w=ad&amp;d=md&amp;o='.$o.'&amp;a=' . $amount . '&p=' . $selectpage . '" class="bold">' . $i . '</a>' : '<a href="admin.php?w=ad&amp;d=md&amp;o='.$o.'&amp;a=' . $amount . '&p=' . $selectpage . '">' . $i . '</a>';
$i++;
}
$pages = implode(', ', $pages);
$query = $sql->prepare("SELECT `id`,`menudescription`,`active`,`type` FROM `addons` WHERE `resellerid`=? ORDER BY $orderby LIMIT $start,$amount");
$query2 = $sql->prepare("SELECT GROUP_CONCAT(DISTINCT s.`shorten` ORDER BY s.`shorten` ASC SEPARATOR ', ') AS `list`, COUNT(s.`id`) AS `amount` FROM `addons_allowed` AS a INNER JOIN `servertypes` AS s ON a.`servertype_id`=s.`id` WHERE a.`addon_id`=? AND s.`resellerid`=?");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$gamesList = '(0)';
if ($row['active'] == 'Y') {
$imgName = '16_ok';
$imgAlt = 'Active';
@ -464,76 +492,19 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$imgName = '16_bad';
$imgAlt = 'Inactive';
}
if ($row['type'] == 'map') {
$type = $sprache->map;
} else {
$type = $sprache->tool;
$query2->execute(array($row['id'], $reseller_id));
foreach ($query2 as $row2) {
$gamesList = '(' . $row2['amount'] . ') ' . $row2['list'];
}
$table[] = array('id' => $row['id'], 'active' => $row['active'], 'img' => $imgName,'alt' => $imgAlt,'gametype' => "${gtype} (${atype})",'description' => $row['menudescription'], 'type' => $type);
}
$table2 = array();
$pselect2 = $sql->prepare("SELECT DISTINCT(`shorten`) FROM `addons` WHERE `resellerid`=:reseller_id");
$pselect2->execute(array(':reseller_id' => $reseller_id));
foreach ($pselect2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$atype = '';
$gtype = '';
$shorten = $row2['shorten'];
$pselect3 = $sql->prepare("SELECT `description` FROM `qstatshorten` WHERE `qstat`=:shorten LIMIT 1");
$pselect3->execute(array(':shorten' => $shorten));
foreach ($pselect3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
$atype = $sprache->multi;
$gtype = $row3['description'];
$query2->fetchColumn();
if (strlen($gamesList) > 40) {
$gamesList = substr($gamesList, 0, 40) . '...';
}
if ($atype == '') {
$atype = $sprache->single;
$gtype = $shorten;
}
$gametype="$gtype ($atype)";
$table2[] = array('shorten' => $shorten,'description' => $gametype);
$table[] = array('id' => $row['id'], 'active' => $row['active'], 'img' => $imgName,'alt' => $imgAlt, 'gametype' => $gamesList, 'description' => $row['menudescription'], 'type' => ($row['type'] == 'map') ? $sprache->map : $sprache->tool);
}
$next = $start+$amount;
$countp = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` $where");
$countp->execute(array(':reseller_id' => $reseller_id));
foreach ($countp->fetchAll(PDO::FETCH_ASSOC) as $row) {
$colcount = $row['amount'];
}
if ($colcount>$next) {
$vor = $start+$amount;
} else {
$vor = $start;
}
$back = $start - $amount;
if ($back>=0){
$zur = $start - $amount;
} else {
$zur = $start;
}
if (!isset($list_gtype) or $list_gtype == '') {
$list_gtype='all';
}
$pageamount = ceil($colcount / $amount);
$link='<a href="admin.php?w=ad&amp;d=md&amp;o='.$o.'&amp;a=';
if (!isset($amount)) {
$link .="20";
} else {
$link .= $amount;
}
if ($start==0) {
$link .= '&p=0&amp;t='.$list_type.'&amp;g='.$list_gtype.'" class="bold">1</a>';
} else {
$link .= '&p=0&amp;t='.$list_type.'&amp;g='.$list_gtype.'">1</a>';
}
$i = 2;
$pages[] = $link;
while ($i<=$pageamount) {
$selectpage = ($i - 1) * $amount;
if ($start==$selectpage) {
$pages[] = '<a href="admin.php?w=ad&amp;d=md&amp;o='.$o.'&amp;a=' . $amount . '&p=' . $selectpage . '&amp;t='.$list_type.'&amp;g='.$list_gtype.'" class="bold">' . $i . '</a>';
} else {
$pages[] = '<a href="admin.php?w=ad&amp;d=md&amp;o='.$o.'&amp;a=' . $amount . '&p=' . $selectpage . '&amp;t='.$list_type.'&amp;g='.$list_gtype.'">' . $i . '</a>';
}
$i++;
}
$pages=implode(', ',$pages);
$template_file = "admin_addons_list.tpl";
$template_file = 'admin_addons_list.tpl';
}

View File

@ -279,8 +279,8 @@ if (isset($ui->get['q'])) {
foreach($words as $word) {
$word="%${word}%";
if ($ad == true) {
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `resellerid`=? ".notIN($adIDs,'`id`')." AND (LOWER(`menudescription`) LIKE ? OR LOWER(`shorten`) LIKE ?)");
$query->execute(array($reseller_id,$word,$word));
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `resellerid`=? ".notIN($adIDs,'`id`')." AND LOWER(`menudescription`) LIKE ?");
$query->execute(array($reseller_id,$word));
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$adIDs[] = $row['id'];
$results["ad-${row['id']}"] = array('type' => $gsprache->addon,'id' => $row['id'], 'name' => $row['menudescription'], 'owner' => '','edit' => '?w=ad&amp;d=md&amp;id='.$row['id'], 'delete' => '?w=ad&amp;d=dl&amp;id='.$row['id']);

View File

@ -165,11 +165,11 @@ class masterServer {
// if an ID is given collect only data for this ID, else collect all game data for this rootserver
if ($all === true) {
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? ${extraSQL}");
$query = $sql->prepare("SELECT t.`id` AS `servertype_id`,t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? ${extraSQL}");
$query->execute(array($this->rootID));
} else {
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? AND r.`servertypeid`=? ${extraSQL} LIMIT 1");
$query = $sql->prepare("SELECT t.`id` AS `servertype_id`,t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? AND r.`servertypeid`=? ${extraSQL} LIMIT 1");
$query->execute(array($this->rootID, $all));
}
@ -281,22 +281,20 @@ class masterServer {
if (($row['supdates'] == 1 or $row['supdates'] == 4) and ($row['updates'] == 1 or $row['updates'] == 4)) {
// collect maps
$query2 = $sql->prepare("SELECT `addon` FROM `addons` WHERE `type`='map' AND `shorten`=? AND `resellerid`=?");
$query2->execute(array($row['shorten'], $this->resellerID));
$query2 = $sql->prepare("SELECT DISTINCT(t.`addon`) FROM `addons_allowed` AS a INNER JOIN `addons` t ON a.`addon_id`=t.`id` WHERE t.`type`='map' AND a.`servertype_id`=? AND a.`reseller_id`=?");
$query2->execute(array($row['servertype_id'], $this->resellerID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$this->maps[] = $row2['addon'];
}
// collect addons
$query2 = $sql->prepare("SELECT `addon` FROM `addons` WHERE `type`='tool' AND (`shorten`=? OR `shorten`=?) AND `resellerid`=?");
$query2->execute(array($row['shorten'], $row['qstat'], $this->resellerID));
$query2 = $sql->prepare("SELECT DISTINCT(t.`addon`) FROM `addons_allowed` AS a INNER JOIN `addons` t ON a.`addon_id`=t.`id` WHERE t.`type`='tool' AND a.`servertype_id`=? AND a.`reseller_id`=?");
$query2->execute(array($row['servertype_id'], $this->resellerID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$this->addons[] = $row2['addon'];
}
}
}
$this->addons = array_unique($this->addons);
$this->maps = array_unique($this->maps);
}
// return command only for outdated servers
@ -479,7 +477,7 @@ class masterServer {
// sync maps and addons
if (isset($sshcmd) and $addonCount>0) {
if ($addonCount>0) {
$tempCmd[] = './control.sh syncaddons '.$this->imageserver . ' "' . implode(' ', $this->maps).'" "'.implode(' ', $this->addons).'"';
}
@ -488,6 +486,7 @@ class masterServer {
#print_r($this->sshcmd);
return $this->sshcmd;
}
public function setUpdating () {
global $sql;
@ -497,6 +496,7 @@ class masterServer {
$query->execute(array($id));
}
}
private function makeSteamCmd ($array) {
$steamCmd = '';

View File

@ -416,14 +416,14 @@ if (!function_exists('passwordgenerate')) {
if (isips($exip)) {
$exploded_ip = explode('.', $exip);
if (is_numeric($exploded_ip[3])){
if (isset($exploded_ip[3]) and is_numeric($exploded_ip[3])){
$ips_array[] = $exip;
} else {
} else if (isset($exploded_ip[3])) {
$range = explode('/', $exploded_ip[3]);
$i = $range[0];
while ($i <= $range[1]) {
while (isset($range[1]) and $i <= $range[1]) {
$ips_array[] = $exploded_ip[0] . '.' . $exploded_ip[1] . '.' . $exploded_ip[2] . '.' . $i;
$i++;
}

View File

@ -492,12 +492,12 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lG']) and $licen
if ($ui->id('installGames',1, 'post')==2) $gamestring=array($ui->escaped('primary', 'post'));
$gamestring=count($gamestring) . '_' . implode('_',$gamestring);
if ($ui->id('installGames',1, 'post')!=3) $cmds[]="sudo -u ${gsuser} ./control.sh addserver ${gsuser} ${gamestring} ${gsfolder}";
ssh2_execute('gs',$serverid,$cmds);
$reply = ssh2_execute('gs', $serverid, $cmds);
} else {
$reply="Could not insert data into database";
$reply = "Could not insert data into database";
}
if ($reply=="Could not connect to Server" or $reply=="The login data does not work" or $reply=="Could not insert data into database") {
$template_file = $sprache->cant_install.'<br />'.$reply;
if ($reply === false) {
$template_file = $sprache->cant_install.'<br />';
} else {
$loguseraction="%add% %gserver% $serverip:$port";
$insertlog->execute();

View File

@ -68,9 +68,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
} else if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
$errors = array();
$id = $ui->id('id', 10, 'get');
$cores = ($ui->id('cores', 3, 'post')) ? $ui->id('cores', 3, 'post') : 4;
$externalId = $ui->escaped('externalID', 'post');
$externalID = $ui->escaped('externalID', 'post');
$steamAccount = $ui->username('steamAccount', 255, 'post');
$steamPassword = $ui->password('steamPassword', 255, 'post');
$keyname = $ui->startparameter('keyname', 'post');
@ -103,7 +105,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query->execute(array(':aeskey' => $aeskey, ':id' => $id, ':reseller_id' => $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$active = $row['active'];
$externalId = $row['externalID'];
$externalID = $row['externalID'];
$hyperthreading = $row['hyperthreading'];
$cores = $row['cores'];
$os = $row['os'];
@ -137,7 +139,6 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
}
} else if ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') {
$errors = array();
if (!$ui->active('active', 'post')) {
$errors['active'] = $sprache->active;
}

View File

@ -431,7 +431,7 @@ if ($w=="ma" and $d=="ud" and isset($action) and $action=="ud" and $ui->descript
}
if ($i>0) {
$posted_gamestring = $i . $gamestring_buf;
$ajaxonload .= "onloaddata('serverallocation.php?gamestring = $posted_gamestring&id=','$id','$id');";
$ajaxonload .= "onloaddata('serverallocation.php?gamestring=$posted_gamestring&id=','$id','$id');";
}
}
$ajaxonload .= '}</script>';

View File

@ -42,6 +42,7 @@ if (!function_exists('ssh2_execute')) {
global $sql, $rSA, $aeskey;
$return = '';
$error = false;
if ($type == 'eac') {
$query = $sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `decryptedport`,AES_DECRYPT(`user`,:aeskey) AS `decrypteduser`,AES_DECRYPT(`pass`,:aeskey) AS `decryptedpass` FROM `eac` WHERE resellerid=:serverID LIMIT 1");
@ -108,7 +109,7 @@ if (!function_exists('ssh2_execute')) {
$error = true;
}
if (isset($error)) {
if ($error === true) {
$notified++;
} else {
$notified = 0;
@ -133,7 +134,7 @@ if (!function_exists('ssh2_execute')) {
}
$query->execute(array($notified, $serverID));
return $return;
return ($error === true) ? false: $return;
}
}
return false;

View File

@ -62,6 +62,15 @@ $query="CREATE TABLE IF NOT EXISTS `addons` (
$add = $sql->prepare($query);
$add->execute();
$query="CREATE TABLE IF NOT EXISTS `addons_allowed` (
`addon_id` int(10) unsigned NOT NULL,
`servertype_id` int(10) unsigned NOT NULL,
`reseller_id` int(10) unsigned NULL DEFAULT 0,
PRIMARY KEY (`addon_id`,`servertype_id`),KEY(`reseller_id`)
) ENGINE=InnoDB";
$add = $sql->prepare($query);
$add->execute();
$query="CREATE TABLE IF NOT EXISTS `addons_installed` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userid` int(10) unsigned NOT NULL,
@ -1035,7 +1044,7 @@ $query="CREATE TABLE IF NOT EXISTS `userdata` (
`active` enum('Y','N','R') NOT NULL DEFAULT 'Y',
`salutation` smallint(1),
`cname` varchar(255) NOT NULL,
`security` blob NOT NULL,
`security` varchar(255),
`salt` varchar(32) DEFAULT NULL,
`token` varchar(32) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,

View File

@ -57,6 +57,11 @@ $defined['addons'] = array('id' => array("Type"=>"int(10) unsigned","Null"=>"NO"
'resellerid' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
);
$defined['addons_allowed'] = array('addon_id' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>""),
'servertype_id' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>""),
'reseller_id' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
);
$defined['addons_installed'] = array('id' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
'userid' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"","Extra"=>""),
'addonid' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"","Extra"=>""),
@ -827,7 +832,7 @@ $defined['userdata'] = array('id' => array("Type"=>"int(10) unsigned","Null"=>"N
'active' => array("Type"=>"enum('Y','N','R')","Null"=>"NO","Key"=>"","Default"=>"Y","Extra"=>""),
'salutation' => array("Type"=>"int(1)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'cname' => array("Type"=>"varchar(255)","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
'security' => array("Type"=>"blob","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
'security' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'salt' => array("Type"=>"varchar(32)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'token' => array("Type"=>"varchar(32)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'name' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),

View File

@ -251,21 +251,29 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query->execute($intos);
}
}
$query = $sql->prepare("SELECT * FROM `addons` WHERE `resellerid`=?");
$query2 = $sql->prepare("INSERT INTO `addons` (`active`,`shorten`,`addon`,`type`,`folder`,`menudescription`,`configs`,`cmd`,`paddon`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?)");
$query3 = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=? LIMIT 1");
$query4 = $sql->prepare("INSERT INTO `translations` (`type`,`lang`,`text`,`transID`,`resellerID`) VALUES ('ad',?,?,?,?)");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($row['active'], $row['shorten'], $row['addon'], $row['type'], $row['folder'], $row['menudescription'], $row['configs'], $row['cmd'], $row['paddon'],$id));
$newID = $sql->lastInsertId();
$query3->execute(array($row['id'],$reseller_id));
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) $query4->execute(array($row3['lang'], $row3['text'],$newID,$id));
}
CopyAdminTable('servertypes',$id,$reseller_id,'',$sql);
CopyAdminTable('settings',$id,$reseller_id,'LIMIT 1',$sql);
CopyAdminTable('voice_stats_settings',$id,$reseller_id,'LIMIT 1',$sql);
CopyAdminTable('usergroups',$id,$reseller_id,'',$sql,"AND `active`='Y' AND `name` IS NOT NULL AND `grouptype`='u'");
$query = $sql->prepare("SELECT * FROM `addons` WHERE `resellerid`=?");
$query2 = $sql->prepare("INSERT INTO `addons` (`active`,`addon`,`type`,`folder`,`menudescription`,`configs`,`cmd`,`paddon`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?)");
$query3 = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `resellerID`=? LIMIT 1");
$query4 = $sql->prepare("INSERT INTO `translations` (`type`,`lang`,`text`,`transID`,`resellerID`) VALUES ('ad',?,?,?,?)");
$query5 = $sql->prepare("SELECT t2.`id` FROM `addons_allowed` AS a INNER JOIN `servertypes` AS t1 ON a.`servertype_id`=t1.`id` INNER JOIN `servertypes` AS t2 ON t1.`shorten`=t2.`shorten` AND t2.`resellerid`=? WHERE a.`addon_id`=? AND a.`reseller_id`=?");
$query6 = $sql->prepare("INSERT INTO `addons_allowed` (`addon_id`,`servertype_id`,`reseller_id`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `addon_id`=`addon_id`");
$query->execute(array($reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($row['active'], $row['addon'], $row['type'], $row['folder'], $row['menudescription'], $row['configs'], $row['cmd'], $row['paddon'],$id));
$newID = $sql->lastInsertId();
$query3->execute(array($row['id'], $reseller_id));
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
$query4->execute(array($row3['lang'], $row3['text'], $newID, $id));
}
$query5->execute(array($id, $row['id'], $reseller_id));
foreach ($query5->fetchAll(PDO::FETCH_ASSOC) as $row3) {
$query6->execute(array($newID, $row3['id'], $id));
}
}
$query = $sql->prepare("SELECT * FROM `lendsettings` WHERE `resellerid`=? LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `lendsettings` (`active`,`mintime`,`maxtime`,`timesteps`,`minplayer`,`maxplayer`,`playersteps`,`vomintime`,`vomaxtime`,`votimesteps`,`vominplayer`,`vomaxplayer`,`voplayersteps`,`shutdownempty`,`shutdownemptytime`,`ftpupload`,`ftpuploadpath`,`lendaccess`,`lastcheck`,`oldcheck`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'0xe4bca9cd69b8488c9c5ee5b7d32c12f3a3cdae349a54edbe6659fc2817ccc86489b12864ebbb43eff607be85611da6c4','3',?,?,?)");
$query->execute(array($reseller_id));
@ -445,7 +453,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
}
if ($accounttype == 'r' and $reseller_id == 0) $lookUpID = $id;
$query = $sql->prepare("SELECT `groupID` FROM `userdata_groups` WHERE `userID`=? AND `resellerID`=?");
$query->execute(array($id,$lookUpID));
$query->execute(array($id, $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$groupsAssigned[] = $row['groupID'];
}
@ -529,7 +537,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$country = $ui->st('country', 'post');
$fax = $ui->phone('fax',50, 'post');
$useractive=($ui->active('useractive', 'post')) ? $ui->active('useractive', 'post') : 'N';
if ($ui->ips('ips', 'post') or $ui->id('maxuser',10, 'post') and $accounttype='r') {
if ($ui->ips('ips', 'post') or $ui->id('maxuser',10, 'post') and $accounttype == 'r') {
if ($reseller_id == 0) {
$availableips=freeips($reseller_id);
} else if ($resellerlockupid==0 or $resellerlockupid==$admin_id) {
@ -582,16 +590,24 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
}
$query = $sql->prepare("UPDATE `userdata` SET `updateTime`=NOW(),`salutation`=?,`birthday`=?,`country`=?,`fax`=?,`name`=?,`vname`=?,`mail`=?,`phone`=?,`handy`=?,`city`=?,`cityn`=?,`street`=?,`streetn`=?,`fdlpath`=?,`mail_backup`=?,`mail_gsupdate`=?,`mail_securitybreach`=?,`mail_serverdown`=?,`mail_ticket`=?,`mail_vserver`=?$jobPending WHERE `id`=? and `resellerid`=? LIMIT 1");
$query->execute(array($salutation,$birthday,$country,$fax,$name,$vname,$mail,$phone,$handy,$city,$cityn,$street,$streetn,$fdlpath,$mail_backup,$mail_gsupdate,$mail_securitybreach,$mail_serverdown,$mail_ticket,$mail_vserver,$id,$resellerlockupid));
customColumns('U',$id,'save');
customColumns('U', $id, 'save');
if ($id != $admin_id) {
$tempArray = array();
$query=($accounttype == 'r' and $reseller_id == 0) ? $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=0 LIMIT 1") : $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=? LIMIT 1");
$query = ($accounttype == 'r' and $reseller_id == 0) ? $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=0 LIMIT 1") : $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=? LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `userdata_groups` (`userID`,`groupID`,`resellerID`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `groupID`=VALUES(`groupID`)");
foreach ($ui->id('groups',10, 'post') as $gid) {
$tempArray[] = $gid;
if ($accounttype == 'r' and $reseller_id == 0) $query->execute(array($gid,$accounttype));
else $query->execute(array($gid,$accounttype,$resellerlockupid));
if (isid($query->fetchColumn(),10)) $query2->execute(array($id,$gid,$resellerlockupid));
if ($accounttype == 'r' and $reseller_id == 0) {
$query->execute(array($gid, $accounttype));
} else {
$query->execute(array($gid, $accounttype, $resellerlockupid));
}
if (isid($query->fetchColumn(),10)) {
$query2->execute(array($id, $gid, $resellerlockupid));
}
}
$query = $sql->prepare("SELECT `groupID` FROM `userdata_groups` WHERE `userID`=? AND `resellerID`=?");
$query2 = $sql->prepare("DELETE FROM `userdata_groups` WHERE `groupID`=? AND `userID`=? AND `resellerID`=? LIMIT 1");

View File

@ -1,4 +1,5 @@
<?php
/**
* File: userpanel_ao.php.
* Author: Ulrich Block
@ -34,15 +35,21 @@
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*/
include(EASYWIDIR . '/stuff/ssh_exec.php');
include(EASYWIDIR . '/stuff/keyphrasefile.php');
if ((!isset($user_id) or $main != 1) or (isset($user_id) and !$pa['useraddons'])) {
header('Location: userpanel.php');
die('No acces');
}
$sprache = getlanguagefile('images',$user_language,$reseller_id);
$loguserid = $user_id;
$logusername=getusername($user_id);
$logusertype="user";
$logusertype = 'user';
$logreseller = 0;
if (isset($admin_id)) {
$logsubuser = $admin_id;
} else if (isset($subuser_id)) {
@ -50,9 +57,11 @@ if (isset($admin_id)) {
} else {
$logsubuser = 0;
}
if (isset($admin_id) and $reseller_id != 0 and $admin_id != $reseller_id) {
$reseller_id = $admin_id;
}
if (isset($admin_id)) {
$logsubuser = $admin_id;
} else if (isset($subuser_id)) {
@ -60,12 +69,13 @@ if (isset($admin_id)) {
} else {
$logsubuser = 0;
}
if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->smallletters('action',2, 'get'), array('ad','dl')) and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'),$substituteAccess['gs']))) {
include(EASYWIDIR . '/stuff/ssh_exec.php');
include(EASYWIDIR . '/stuff/keyphrasefile.php');
$gameserverid = $ui->id('id',19, 'get');
$gameserverid = (int) $ui->id('id',19, 'get');
$addonid = $ui->id('adid',10, 'get');
$action = $ui->smallletters('action',2, 'get');
$query = $sql->prepare("SELECT g.`rootID`,g.`newlayout`,g.`serverid`,g.`serverip`,g.`port`,g.`protected`,AES_DECRYPT(g.`ftppassword`,?) AS `dftpppassword`,AES_DECRYPT(g.`ppassword`,?) AS `decryptedppassword`, t.`modfolder`,t.`shorten`,s.`servertemplate`,u.`cname` FROM `gsswitch` g INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? LIMIT 1");
$query->execute(array($aeskey,$aeskey,$gameserverid,$user_id,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
@ -78,15 +88,13 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
$ppassword = $row['decryptedppassword'];
$ftppass = $row['dftpppassword'];
$servertemplate = $row['servertemplate'];
if ($servertemplate==1) {
$shorten = $row['shorten'];
} else {
$shorten = $row['shorten'] . '-' . $servertemplate;
}
$customer = $row['cname'];
$newlayout = $row['newlayout'];
$customer = ($newlayout == 'Y') ? $row['cname'] . '-' . $gameserverid : $row['cname'];
$shorten = ($servertemplate == 1) ? $row['shorten'] : $row['shorten'] . '-' . $servertemplate;
}
if (isset($rootID)) {
$query = $sql->prepare("SELECT `addon`,`paddon`,`type`,`folder` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($addonid,$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
@ -95,42 +103,41 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
$type = $row['type'];
$folder = $row['folder'];
}
$rdata=serverdata('root',$rootID,$aeskey);
$sship = $rdata['ip'];
$sshport = $rdata['port'];
$sshuser = $rdata['user'];
$sshpass = $rdata['pass'];
if ($newlayout == 'Y') {
$customer = $customer . '-' . $gameserverid;
}
if ($protected=="N") {
$serverfolder = $customer.'/server/'.$serverip . '_' . $port. '/' . $shorten;
if (isset($protected) and $protected == 'N') {
$serverfolder = $customer . '/server/' . $serverip . '_' . $port . '/' . $shorten;
} else {
$serverfolder = $customer . '/pserver/' . $serverip . '_' . $port. '/' . $shorten;
$serverfolder = $customer . '/pserver/' . $serverip . '_' . $port . '/' . $shorten;
$ftppass = $ppassword;
$customer = $customer."-p";
$customer .= '-p';
}
if ($ui->st('action', 'get') == 'ad' and ($protected=="N" or ($protected=="Y" and $paddon=="Y"))) {
if (ssh2_execute('gs',$rootID,"sudo -u $customer ./control.sh addaddon $type $addon \"$serverfolder\" \"$modfolder\"") !== false){
if ($ui->st('action', 'get') == 'ad' and ($protected == 'N' or ($protected == 'Y' and $paddon == 'Y'))) {
if (ssh2_execute('gs', $rootID, "sudo -u $customer ./control.sh addaddon $type $addon \"$serverfolder\" \"$modfolder\"") !== false){
$query = $sql->prepare("INSERT INTO `addons_installed` (`userid`,`addonid`,`serverid`,`servertemplate`,`paddon`,`resellerid`) VALUES (?,?,?,?,?,?)");
$query->execute(array($user_id,$addonid,$serverid,$servertemplate,$protected,$reseller_id));
$template_file = $sprache->addon_inst;
$actionstatus="ok";
$actionstatus = 'ok';
} else {
$template_file = $sprache->failed;
$actionstatus="fail";
$actionstatus = 'fail';
}
} else if ($ui->st('action', 'get') == 'dl' and $ui->id('rid',19, 'get')) {
$installedid = $ui->id('rid',19, 'get');
$cmds = array();
$cmds[]="sudo -u $customer ./control.sh deladdon $type $addon \"$serverfolder\" \"$modfolder\" \"$folder\"";
$delids = $addonid;
$cmds = array();
$cmds[] = "sudo -u $customer ./control.sh deladdon $type $addon \"$serverfolder\" \"$modfolder\" \"$folder\"";
while (isset($delids) and isset($installedid)) {
$query = $sql->prepare("SELECT `id`,`folder`,`addon` FROM `addons` WHERE `depending`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($delids,$reseller_id));
if (isset($installedid)) {
$query2 = $sql->prepare("DELETE FROM `addons_installed` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query2->execute(array($installedid,$reseller_id));
$query2->execute(array($installedid, $reseller_id));
unset($installedid);
if (isset($deladdon)) {
$cmds[]="sudo -u $customer ./control.sh deladdon $type $deladdon \"$serverfolder\" \"$modfolder\" \"$delfolder\"";
@ -144,36 +151,40 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
$delfolder = $row['folder'];
$deladdon = $row['addon'];
$query2 = $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `addonid`=? AND `serverid`=? AND `servertemplate`=? AND `resellerid`=? LIMIT 1");
$query2->execute(array($delids,$serverid,$servertemplate,$reseller_id));
$query2->execute(array($delids, $serverid, $servertemplate, $reseller_id));
$installedid = $query2->fetchColumn();
}
}
if (ssh2_execute('gs',$rootID,$cmds) !== false){
if (ssh2_execute('gs', $rootID, $cmds) !== false){
$template_file = $sprache->addon_del;
$actionstatus="ok";
$actionstatus = 'ok';
} else {
$template_file = $sprache->failed;
$actionstatus="fail";
$actionstatus = 'fail';
}
}
if (isset($actionstatus) and ($protected=="N" or ($protected=="Y" and $paddon=="Y"))) {
$loguseraction="%$action% %addon% $addon $serverip:$port %$actionstatus%";
if (isset($actionstatus) and ($protected=="N" or ($protected == 'Y' and $paddon == 'Y'))) {
$loguseraction = "%$action% %addon% $addon $serverip:$port %$actionstatus%";
$insertlog->execute();
} else {
$template_file = $sprache->failed;
}
} else {
$template_file = $sprache->failed;
}
} else if ($ui->id('id',19, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'),$substituteAccess['gs']))) {
$username=getusername($user_id);
} else if ($ui->id('id',19, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'), $substituteAccess['gs']))) {
$table = array();
$default_language = $rSA['language'];
$username = getusername($user_id);
$switchID = $ui->id('id',19, 'get');
$table = array();
$query = $sql->prepare("SELECT `language` FROM `settings` WHERE `resellerid`=? LIMIT 1");
$query->execute(array($reseller_id));
$default_language = $query->fetchColumn();
$query = $sql->prepare("SELECT g.`serverid`,g.`serverip`,g.`port`,g.`protected`,g.`queryName`,s.`servertemplate`,t.`shorten`,t.`qstat` FROM `gsswitch` g INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`userid`=? AND g.`id`=? AND g.`resellerid`=? LIMIT 1");
$query->execute(array($user_id,$switchID,$reseller_id));
$query = $sql->prepare("SELECT g.`serverid`,g.`serverip`,g.`port`,g.`protected`,g.`queryName`,s.`servertemplate`,t.`shorten`,t.`id` AS `servertype_id` FROM `gsswitch` g INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`userid`=? AND g.`id`=? AND g.`resellerid`=? LIMIT 1");
$query->execute(array($user_id, $switchID, $reseller_id));
$i = 0;
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table2 = array();
@ -181,41 +192,44 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
$description = '';
$serverip = $row['serverip'];
$serverport = $row['port'];
$qstat = $row['qstat'];
$serverid = $row['serverid'];
$servershorten = $row['shorten'];
$servertemplate = $row['servertemplate'];
$currentTemplate = $servershorten;
if ($servertemplate>1) $currentTemplate = $servershorten . '-' . $servertemplate;
if ($servertemplate > 1) {
$currentTemplate = $servershorten . '-' . $servertemplate;
}
$protected = $row['protected'];
$description = $row['queryName'];
if ($protected== 'Y') {
$query2 = $sql->prepare("SELECT `id`,`menudescription`,`depending`,`type` FROM `addons` WHERE `active`='Y' AND (`shorten`=? OR `shorten`=?) AND `paddon`='Y' AND `resellerid`=? ORDER BY `shorten`,`depending`,`menudescription`");
$query2 = $sql->prepare("SELECT a.`addon_id`,t.`menudescription`,t.`depending`,t.`type` FROM `addons_allowed` AS a INNER JOIN `addons` t ON a.`addon_id`=t.`id` AND a.`reseller_id`=t.`resellerid` WHERE t.`active`='Y' AND t.`paddon`='Y' AND a.`servertype_id`=? AND a.`reseller_id`=? ORDER BY t.`depending`,t.`menudescription`");
} else {
$query2 = $sql->prepare("SELECT `id`,`menudescription`,`depending`,`type` FROM `addons` WHERE `active`='Y' AND (`shorten`=? OR `shorten`=?) AND `resellerid`=? ORDER BY `shorten`,`depending`,`menudescription`");
$query2 = $sql->prepare("SELECT a.`addon_id`,t.`menudescription`,t.`depending`,t.`type` FROM `addons_allowed` AS a INNER JOIN `addons` t ON a.`addon_id`=t.`id` AND a.`reseller_id`=t.`resellerid` WHERE t.`active`='Y' AND a.`servertype_id`=? AND a.`reseller_id`=? ORDER BY t.`depending`,t.`menudescription`");
}
$query2->execute(array($servershorten,$qstat,$reseller_id));
$query2->execute(array($row['servertype_id'], $reseller_id));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$adid = $row2['id'];
$adid = $row2['addon_id'];
$depending = $row2['depending'];
$menudescription = $row2['menudescription'];
$descriptionrow = '';
$lang = '';
$query3 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
$query3->execute(array($adid,$user_language,$reseller_id));
$query3->execute(array($adid, $user_language, $reseller_id));
$descriptionrow = $query3->fetchColumn();
if (empty($descriptionrow)) {
$query3 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
$query3->execute(array($adid,$default_language,$reseller_id));
$query3->execute(array($adid, $default_language, $reseller_id));
$descriptionrow = $query->fetchColumn();
}
$addescription=nl2br($descriptionrow);
if ($protected=="Y") {
if ($protected == 'Y') {
$query3 = $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `addonid`=? AND `servertemplate`=? AND `paddon`='Y' AND `resellerid`=? LIMIT 1");
} else {
$query3 = $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `addonid`=? AND `servertemplate`=? AND `resellerid`=? LIMIT 1");
}
$query3->execute(array($user_id,$serverid,$adid,$servertemplate,$reseller_id));
$query3->execute(array($user_id, $serverid, $adid, $servertemplate, $reseller_id));
$installedid = $query3->fetchColumn();
$delete = '';
if (isid($installedid,19)){
@ -226,7 +240,7 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
$delete='&amp;rid='.$installedid;
} else {
$query3 = $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `servertemplate`=? AND `addonid`=? AND `resellerid`=?");
$query3->execute(array($user_id,$serverid,$servertemplate,$depending,$reseller_id));
$query3->execute(array($user_id, $serverid, $servertemplate, $depending, $reseller_id));
$colcount = $query3->rowcount();
if ($row2['type'] == 'map' or $depending==0 or ($depending>0 and $colcount>0)) {
$action='ad';
@ -236,13 +250,13 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
} else {
$action='none';
$query3 = $sql->prepare("SELECT `menudescription` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query3->execute(array($depending,$reseller_id));
$query3->execute(array($depending, $reseller_id));
$imgName='16_notice';
$bootstrap='icon-warning-sign';
$imgAlt = $sprache->requires. ': ' .$query3->fetchColumn();
}
}
$link='userpanel.php?w=ao&amp;id='.$switchID.'&amp;adid='.$adid.'&amp;action='.$action.$delete.'&amp;r=gs';
$link='userpanel.php?w=ao&amp;id=' . $switchID . '&amp;adid=' . $adid . '&amp;action=' . $action . $delete . '&amp;r=gs';
if ($row2['type'] == 'tool') {
$table2[] = array('adid' => $adid,'menudescription' => $menudescription,'addescription' => $addescription,'installedid' => $installedid,'img' => $imgName,'bootstrap' => $bootstrap,'alt' => $imgAlt,'link' => $link);
} else if ($row2['type'] == 'map') {
@ -250,9 +264,9 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10, 'get') and in_array($ui->sma
}
}
$table=array('id' => $switchID,'serverip' => $serverip,'port' => $serverport,'tools' => $table2,'maps' => $table3,'name' => $description);
unset($table2,$table3);
unset($table2, $table3);
}
$template_file = "userpanel_gserver_addon.tpl";
$template_file = 'userpanel_gserver_addon.tpl';
} else {
$template_file = 'userpanel_404.tpl';
}

View File

@ -28,6 +28,13 @@
</div>
</div>
<hr>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Error(s)</h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<div class="row-fluid">
<div class="span6">
<form class="form-horizontal" action="admin.php?w=ad&amp;d=ad&amp;r=ad" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
@ -36,9 +43,8 @@
<div class="control-group">
<label class="control-label" for="inputGame2"><?php echo $sprache->game2;?></label>
<div class="controls">
<select id="inputGame2" name="shorten">
<?php foreach ($table as $table_row){ ?><option value="<?php echo $table_row['shorten'];?>" <?php if($table_row['shorten']==$shorten) echo 'selected="selected"';?>><?php echo $sprache->single?>: <?php echo $table_row['description'];?></option><?php } ?>
<?php foreach ($table2 as $table_row2){ ?><option value="<?php echo $table_row2['qstat'];?>" <?php if($table_row2['qstat']==$shorten) echo 'selected="selected"';?>><?php echo $sprache->multi?>: <?php echo $table_row2['description'];?></option><?php } ?>
<select id="inputGame2" multiple="multiple" name="shorten[]">
<?php foreach ($gamesAssigned as $sid => $shorten){ ?><option value="<?php echo $sid;?>" <?php if(in_array($sid,$shortens)) echo 'selected="selected"';?>><?php echo $shorten;?></option><?php }?>
</select>
</div>
</div>
@ -60,7 +66,7 @@
</select>
</div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['type'])) echo ' error';?>">
<label class="control-label" for="inputType"><?php echo $sprache->type;?></label>
<div class="controls">
<select id="inputType" name="type">
@ -69,15 +75,15 @@
</select>
</div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['addon'])) echo ' error';?>">
<label class="control-label" for="inputAddon"><?php echo $sprache->addon;?></label>
<div class="controls"><input id="inputAddon" type="text" name="addon" value="<?php echo $addon;?>"></div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['menudescription'])) echo ' error';?>">
<label class="control-label" for="inputAddon2"><?php echo $sprache->addon2;?></label>
<div class="controls"><input id="inputAddon2" type="text" name="menudescription" value="<?php echo $menudescription;?>"></div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['active'])) echo ' error';?>">
<label class="control-label" for="inputActive"><?php echo $sprache->active;?></label>
<div class="controls">
<select id="inputActive" name="active">
@ -92,12 +98,12 @@
</div>
<div class="control-group">
<label class="control-label" for="inputDescription"><?php echo $sprache->description;?></label>
<div class="controls"><?php foreach ($foundlanguages as $array) echo '<label class="checkbox inline">'.$array['checkbox'].'<img src="images/flags/'.$array['lang'].'.png" alt="Flag: '.$array['lang'].'.png"/></label>';?></div>
<div class="controls"><?php foreach ($foundLanguages as $array) echo '<label class="checkbox inline">'.$array['checkbox'].'<img src="images/flags/'.$array['lang'].'.png" alt="Flag: '.$array['lang'].'.png"/></label>';?></div>
</div>
<?php foreach ($foundLanguages as $array) { ?>
<div id="<?php echo $array['lang'];?>" class="control-group <?php echo $array['display'];?>">
<label class="control-label" for="inputLangs-<?php echo $array['lang'];?>"><img src="images/flags/<?php echo $array['lang'];?>.png" alt="Flag: 16_<?php echo $array['lang'];?>'.png"/></label>
<div class="controls"><textarea id="inputLangs-<?php echo $array['lang'];?>" name="description_<?php echo $array['lang'];?>"></textarea></div>
<div class="controls"><textarea id="inputLangs-<?php echo $array['lang'];?>" name="description[<?php echo $array['lang'];?>]"></textarea></div>
</div>
<?php } ?>
<div class="control-group">
@ -115,7 +121,7 @@
<div class="control-group">
<label class="control-label" for="inputEdit"></label>
<div class="controls">
<button class="btn btn-primary pull-right" id="inputEdit" type="submit"><i class="icon-edit icon-white"></i></button>
<button class="btn btn-primary pull-right" id="inputEdit" type="submit"><i class="icon-plus-sign icon-white"></i></button>
</div>
</div>
</form>

View File

@ -16,13 +16,13 @@
</div>
<div class="row-fluid">
<div class="span6">
<form class="form-horizontal" action="admin.php?w=ad&amp;d=dl&amp;id=<?php echo $addonid;?>&amp;r=ad" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<form class="form-horizontal" action="admin.php?w=ad&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=ad" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
<div class="control-group">
<label class="control-label" for="inputEdit"></label>
<div class="controls">
<button class="btn btn-primary pull-right" id="inputEdit" type="submit"><i class="icon-edit icon-white"></i></button>
<button class="btn btn-danger pull-right" id="inputEdit" type="submit"><i class="icon-remove-sign icon-white"></i></button>
</div>
</div>
</form>

View File

@ -15,11 +15,11 @@
<div class="row-fluid">
<div class="span11 pagination">
<ul>
<li><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $zur;?>"><i class="icon-step-backward"></i></a></li>
<li><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $zur;?>"><i class="icon-step-backward"></i></a></li>
<li><a href="admin.php?w=ad&amp;o=<?php echo $o;?>&amp;a=20&amp;p=<?php echo $start; ?>">20</a></li>
<li><a href="admin.php?w=ad&amp;o=<?php echo $o;?>&amp;a=50&amp;p=<?php echo $start; ?>">50</a></li>
<li><a href="admin.php?w=ad&amp;o=<?php echo $o;?>&amp;a=100&amp;p=<?php echo $start; ?>">100</a></li>
<li><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $vor;?>"><i class="icon-step-forward"></i></a></li>
<li><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $vor;?>"><i class="icon-step-forward"></i></a></li>
</ul>
</div>
</div>
@ -29,11 +29,11 @@
<table class="table table-bordered table-hover table-striped footable">
<thead>
<tr>
<th data-class="expand"><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;t=<?php echo $list_type; ?>&amp;g=<?php echo $list_gtype; ?>&amp;o=<?php if ($o=='an') { echo 'dn'; } else { echo 'an'; } ?>"><?php echo $sprache->aname;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;t=<?php echo $list_type; ?>&amp;g=<?php echo $list_gtype; ?>&amp;o=<?php if ($o=='ai') { echo 'di'; } else { echo 'ai'; } ?>">ID</a></th>
<th data-hide="phone"><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;t=<?php echo $list_type; ?>&amp;g=<?php echo $list_gtype; ?>&amp;o=<?php if ($o=='as') { echo 'ds'; } else { echo 'as'; } ?>"><?php echo $gsprache->status;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;t=<?php echo $list_type; ?>&amp;g=<?php echo $list_gtype; ?>&amp;o=<?php if ($o=='at') { echo 'dt'; } else { echo 'at'; } ?>"><?php echo $sprache->type2;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;d=md&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;t=<?php echo $list_type; ?>&amp;g=<?php echo $list_gtype; ?>&amp;o=<?php if ($o=='at') { echo 'dt'; } else { echo 'at'; } ?>"><?php echo $sprache->type;?></a></th>
<th data-class="expand"><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='an') { echo 'dn'; } else { echo 'an'; } ?>"><?php echo $sprache->aname;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='ai') { echo 'di'; } else { echo 'ai'; } ?>">ID</a></th>
<th data-hide="phone"><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='as') { echo 'ds'; } else { echo 'as'; } ?>"><?php echo $gsprache->status;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='at') { echo 'dt'; } else { echo 'at'; } ?>"><?php echo $sprache->type2;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=ad&amp;a=<?php echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='at') { echo 'dt'; } else { echo 'at'; } ?>"><?php echo $sprache->type;?></a></th>
<th><?php echo $gsprache->export;?></a></th>
<th><?php echo $gsprache->del;?></a></th>
<th><?php echo $gsprache->mod;?></a></th>

View File

@ -8,17 +8,23 @@
</ul>
</div>
</div>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Error(s)</h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<div class="row-fluid">
<div class="span6">
<form class="form-horizontal" action="admin.php?w=ad&amp;d=md&amp;id=<?php echo $addonid;?>&amp;r=ad" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<form class="form-horizontal" action="admin.php?w=ad&amp;d=md&amp;id=<?php echo $id;?>&amp;r=ad" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="md">
<div class="control-group">
<label class="control-label" for="inputGame2"><?php echo $sprache->game2;?></label>
<div class="controls">
<select id="inputGame2" name="shorten">
<?php foreach ($table as $table_row){ ?><option value="<?php echo $table_row['shorten'];?>" <?php if($table_row['shorten']==$shorten) echo 'selected="selected"';?>><?php echo $sprache->single?>: <?php echo $table_row['description'];?></option><?php } ?>
<?php foreach ($table2 as $table_row2){ ?><option value="<?php echo $table_row2['qstat'];?>" <?php if($table_row2['qstat']==$shorten) echo 'selected="selected"';?>><?php echo $sprache->multi?>: <?php echo $table_row2['description'];?></option><?php } ?>
<select id="inputGame2" multiple="multiple" name="shorten[]">
<?php foreach ($gamesAssigned as $sid => $shorten){ ?><option value="<?php echo $sid;?>" <?php if(in_array($sid,$shortens)) echo 'selected="selected"';?>><?php echo $shorten;?></option><?php }?>
</select>
</div>
</div>
@ -40,7 +46,7 @@
</select>
</div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['type'])) echo ' error';?>">
<label class="control-label" for="inputType"><?php echo $sprache->type;?></label>
<div class="controls">
<select id="inputType" name="type">
@ -49,7 +55,7 @@
</select>
</div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['addon'])) echo ' error';?>">
<label class="control-label" for="inputAddon"><?php echo $sprache->addon;?></label>
<div class="controls"><input id="inputAddon" type="text" name="addon" value="<?php echo $addon;?>"></div>
</div>
@ -57,7 +63,7 @@
<label class="control-label" for="inputAddon2"><?php echo $sprache->addon2;?></label>
<div class="controls"><input id="inputAddon2" type="text" name="menudescription" value="<?php echo $menudescription;?>"></div>
</div>
<div class="control-group">
<div class="control-group<?php if(isset($errors['active'])) echo ' error';?>">
<label class="control-label" for="inputActive"><?php echo $sprache->active;?></label>
<div class="controls">
<select id="inputActive" name="active">
@ -72,12 +78,12 @@
</div>
<div class="control-group">
<label class="control-label" for="inputDescription"><?php echo $sprache->description;?></label>
<div class="controls"><?php foreach ($foundlanguages as $array) echo '<label class="checkbox inline">'.$array['checkbox'].'<img src="images/flags/'.$array['lang'].'.png" alt="Flag: '.$array['lang'].'.png"/></label>';?></div>
<div class="controls"><?php foreach ($foundLanguages as $array) echo '<label class="checkbox inline">'.$array['checkbox'].'<img src="images/flags/'.$array['lang'].'.png" alt="Flag: '.$array['lang'].'.png"/></label>';?></div>
</div>
<?php foreach ($foundlanguages as $array) { ?>
<?php foreach ($foundLanguages as $array) { ?>
<div id="<?php echo $array['lang'];?>" class="control-group <?php echo $array['display'];?>">
<label class="control-label" for="inputLangs-<?php echo $array['lang'];?>"><img src="images/flags/<?php echo $array['lang'];?>.png" alt="Flag: 16_<?php echo $array['lang'];?>'.png"/></label>
<div class="controls"><textarea id="inputLangs-<?php echo $array['lang'];?>" name="description_<?php echo $array['lang'];?>"><?php echo $array['description'];?></textarea></div>
<div class="controls"><textarea id="inputLangs-<?php echo $array['lang'];?>" name="description[<?php echo $array['lang'];?>]"><?php echo $array['description'];?></textarea></div>
</div>
<?php } ?>
<div class="control-group">

View File

@ -157,7 +157,7 @@
<input id="inputUCname" type="text" name="cname" value="user">
</div>
</div>
<div class="u display_none switch control-group">
<div class="r display_none switch control-group">
<label class="control-label" for="inputRCname"><?php echo $gsprache->user;?></label>
<div class="controls">
<input id="inputRCname" type="text" name="rcname" value="reseller">

View File

@ -14,10 +14,10 @@
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
<dl class="dl-horizontal">
<dt><?php echo $sprache->fname;?></dt>
<dd><?php echo $name;?></dd>
<dt><?php echo $sprache->user;?></dt>
<dd><?php echo $cname;?></dd>
<dt><?php echo $sprache->fname;?></dt>
<dd><?php echo $name;?></dd>
</dl>
<div class="control-group">
<label class="control-label" for="inputDelete"></label>

View File

@ -13,9 +13,9 @@
<dl class="dl-horizontal">
<dt><?php echo $sprache->user;?></dt>
<dd><?php echo $cname;?></dd>
<dt><?php echo $sprache->creationTime;?></dt>
<dt>creationTime</dt>
<dd><?php echo $creationTime;?></dd>
<dt><?php echo $sprache->updateTime;?></dt>
<dt>updateTime</dt>
<dd><?php echo $updateTime;?></dd>
<dt><?php echo $sprache->accounttype;?></dt>
<dd><?php ;if($accounttype=='r'){ echo $sprache->accounttype_reseller;}else if($accounttype=='a'){ echo $sprache->accounttype_admin;}else{ echo $sprache->accounttype_user;}?></dd>

View File

@ -2,7 +2,7 @@
</div><!--/row-->
<hr>
<footer>
<p>&copy; Easy-WI 2011 - <?php echo date('Y'); ?> <a href="<?php echo $page_data->pages['sitemap']['link'];?>" class="pull-right"><?php echo $page_data->pages['sitemap']['linkname'];?></a></p>
<p>&copy; <a href="https://easy-wi.com" target="_blank" title="free gameserver, voiceserver, dedicated and virtualserver webinterface easy-wi.com">Easy-WI.com</a> 2011 - <?php echo date('Y'); ?> <a href="<?php echo $page_data->pages['sitemap']['link'];?>" class="pull-right"><?php echo $page_data->pages['sitemap']['linkname'];?></a></p>
</footer>
</div><!--/.fluid-container-->
</body>

View File

@ -43,7 +43,7 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Easy-WI.com<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://wiki.easy-wi.com" target="_blank" title="easy-wi.com wiki">Wiki</a></li>
<li><a href="https://easy-wi.com" target="_blank" title="free gameserver voiceserver dedicated and virtualserver webinterface easy-wi.com">About</a></li>
<li><a href="https://easy-wi.com" target="_blank" title="free gameserver, voiceserver, dedicated and virtualserver webinterface easy-wi.com">About</a></li>
<li><a href="https://easy-wi.com/forum/" target="_blank" title="easy-wi.com forum">Forum</a></li>
</ul>
</li>