ordersprinter/webapp/install/installer.php

1615 lines
68 KiB
PHP

<?php
error_reporting(E_ALL);
if (is_readable("../php/config1.php")) {
require_once( "../php/config1.php" );
} else {
require_once( "../php/config.php" );
}
require_once ('../php/utilities/basedb.php');
require_once ('../php/admin.php');
class ConfigWriter {
function getConfigVals() {
if (!is_readable("../php/config.php") && (!is_readable("../php/config1.php"))) {
echo json_encode(array("status" => "Failed"));
}
$retArray = array(
"host" => MYSQL_HOST,
"db" => MYSQL_DB,
"user" => MYSQL_USER,
"password" => MYSQL_PASSWORD,
"tabprefix" => TAB_PREFIX);
echo json_encode(array("status" => "OK","result" => $retArray));
}
}
class InstallAdmin {
var $pdo;
var $basedb;
var $timezone;
function __construct() {
$this->basedb = new Basedb();
}
function setPrefix($pre) {
$this->basedb->setPrefix($pre);
}
function setPdo($pdo) {
$this->pdo = $pdo;
}
function setTimeZone($zone) {
$this->timezone = $zone;
}
function openDbAndReturnPdo ($host,$db,$user,$password) {
$dsn = 'mysql:host=' . $host . ';dbname=' . $db;
$pdo = null;
try {
$pdo = new PDO($dsn, $user, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
echo 'Verbindungsproblem: ' . $e->getMessage();
$pdo = null;
}
return $pdo;
}
function checkPhpStatus() {
$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib");
$missing = array();
$extensions_status = 1;
foreach($extensions as $anExtension) {
if (!extension_loaded($anExtension)) {
$missing[] = $anExtension;
$extensions_status = 0;
}
}
set_time_limit(60*5+1);
ini_set('session.gc_maxlifetime',65535);
session_set_cookie_params(65535);
$max_execution_status = 1;
// 5 minutes = 5*60
if (ini_get('max_execution_time') < (5*60)) {
$max_execution_status = 0;
}
$session_lifetime_status = 1;
if (ini_get('session.gc_maxlifetime') < (10*60*60)) {
$session_lifetime_status = 0;
}
$ret = array("extensions_status" => $extensions_status, "missing_extensions" => join(",",$missing),
"max_execution_status" => $max_execution_status, "max_execution_time" => ini_get('max_execution_time'),
"session_lifetime_status" => $session_lifetime_status, "session_gc_maxlifetime" => ini_get('session.gc_maxlifetime')
);
echo json_encode($ret);
}
function updateUserTable1013_1014() {
$pdo = $this->pdo;
try {
$prkey = file_get_contents("../php/privkey.pem");
$cert = file_get_contents("../php/cert.pem");
if ((strlen($prkey) < 10) || (strlen($cert) < 10)) {
echo json_encode('Fehler: Vorversion falsch oder Inhalt des php-Verzeichnisses ungueltig!');
} else {
$sql = "ALTER TABLE `%work%` MODIFY signature VARBINARY(4000)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array("privkey","privkey",$prkey));
$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array("cert","cert",$cert));
$this->updateVersion($pdo, '1.0.14');
unlink("../php/privkey.pem");
unlink("../php/cert.pem");
}
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1014_1015() {
$pdo = $this->pdo;
try {
$add_favorite_col_sql = "ALTER TABLE %products% ADD favorite INT(1) NULL AFTER category";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($add_favorite_col_sql));
$stmt->execute();
$sql = "UPDATE %products% SET favorite=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('0'));
$add_favorite_col_sql = "ALTER TABLE %histprod% ADD favorite INT(1) NULL AFTER available";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($add_favorite_col_sql));
$stmt->execute();
$sql = "UPDATE %histprod% SET favorite=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('0'));
$this->updateVersion($pdo, '1.0.15');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1015_1016() {
$pdo = $this->pdo;
try {
$this->updateVersion($pdo, '1.0.16');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1016_1017() {
$pdo = $this->pdo;
try {
$sql = "ALTER TABLE %user% ADD right_rating INT(1) NULL AFTER right_reservation";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "UPDATE %user% SET right_rating=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('0'));
$sql = "ALTER TABLE %user% MODIFY right_rating INT(1) NOT NULL DEFAULT '0'";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "ALTER TABLE %histuser% ADD right_rating INT(1) NULL AFTER right_reservation";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "UPDATE %histuser% SET right_rating=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('0'));
$sql = "ALTER TABLE %histuser% MODIFY right_rating INT(1) NOT NULL DEFAULT '0'";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$this->basedb->createRatingsTable($pdo);
$this->updateVersion($pdo, '1.0.17');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateVersion($pdo,$version) {
$setVersion = "update %config% set setting=? where name='version'";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($setVersion));
$stmt->execute(array($version));
$sql = "SELECT id FROM %config% WHERE name=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('version'));
$row = $stmt->fetchObject();
$sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histconfig));
$stmt->execute(array($row->id,$version));
$newRefIdForHist = $pdo->lastInsertId();
$sql = "SELECT setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('timezone'));
$row = $stmt->fetchObject();
date_default_timezone_set($row->setting);
$currentTime = date('Y-m-d H:i:s');
$sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)";
$stmt_insert_hist = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_hist));
$stmt_insert_hist->execute(array($currentTime, '6', $newRefIdForHist));
}
function updateUserTable1018_1019() {
$pdo = $this->pdo;
try {
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('remoteaccesscode',null));
$this->updateVersion($pdo, '1.0.19');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1019_1020() {
$pdo = $this->pdo;
try {
$this->updateVersion($pdo, '1.0.20');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1022_1023($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$adminCl->changeOneConfigDbItem($pdo,"timezone","Europe/Berlin","%config%",true);
$this->updateVersion($pdo, '1.0.23');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1023_1024($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %user% ADD right_changeprice INT (1) NULL AFTER right_rating";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %user% SET right_changeprice=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$sql = "ALTER TABLE %user% MODIFY right_changeprice INT (1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %histuser% ADD right_changeprice INT (1) NULL AFTER right_rating";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %histuser% SET right_changeprice=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$sql = "ALTER TABLE %histuser% MODIFY right_changeprice INT (1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %user% ADD prefertablemap INT(1) NULL AFTER prodbtnsize";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %user% SET prefertablemap=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$this->basedb->createTableMapsTable($pdo);
$this->basedb->createTablePosTable($pdo);
$this->updateVersion($pdo, '1.0.24');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1024_1025($prefix) {
return $this->setVersion($prefix, '1.0.25');
}
function updateUserTable1025_1026($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% DROP payinprogress";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.0.26');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1026_1027($prefix) {
return $this->setVersion($prefix, '1.0.27');
}
function updateUserTable1027_1028($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% MODIFY tablenr INT( 3 ) NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.0.28');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1028_1029($prefix) {
return $this->setVersion($prefix, '1.0.29');
}
function updateUserTable1029_1030($prefix) {
return $this->setVersion($prefix, '1.0.30');
}
function updateUserTable1030_1031($prefix) {
return $this->setVersion($prefix, '1.0.31');
}
function updateUserTable1031_1032($prefix) {
return $this->setVersion($prefix, '1.0.32');
}
function updateUserTable1032_1033($prefix) {
return $this->setVersion($prefix, '1.0.33');
}
function updateUserTable1033_1034($prefix) {
return $this->setVersion($prefix, '1.0.34');
}
function updateUserTable1034_1035($prefix) {
return $this->setVersion($prefix, '1.0.35');
}
function updateUserTable1035_1036($prefix) {
return $this->setVersion($prefix, '1.0.36');
}
function updateUserTable1036_1037($prefix) {
return $this->setVersion($prefix, '1.0.37');
}
function updateUserTable1037_1038($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% DROP action";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "ALTER TABLE %queue% ADD tax DECIMAL (5,2) NULL AFTER price";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "UPDATE %queue%,%bill% SET %queue%.tax = %bill%.tax WHERE %queue%.billid=%bill%.id";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
// at this point all queue items have the tax from the bill, if their billid was set - otherwise they keep being NULL
$sql = "UPDATE %queue%,%config% SET %queue%.tax = %config%.setting WHERE %queue%.billid is NULL AND %config%.name='tax' AND %queue%.tablenr is not null;";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "UPDATE %queue%,%config% SET %queue%.tax = %config%.setting WHERE %queue%.billid is NULL AND %config%.name='togotax' AND %queue%.tablenr is null;";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
// at this point all unpaid products have the normal tax
// allow bill table to have no taxes (tax column is needed for signature of old bills (verifyBill)
$sql = "ALTER TABLE %bill% MODIFY tax decimal(5,2) NULL";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "ALTER TABLE %queue% MODIFY tax DECIMAL (5,2) NOT NULL";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "ALTER TABLE %products% ADD tax DECIMAL (5,2) NULL AFTER priceC";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "ALTER TABLE %histprod% ADD tax DECIMAL (5,2) NULL AFTER priceC";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$this->updateVersion($pdo, "1.0.38");
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1038_1039($prefix) {
return $this->setVersion($prefix, '1.0.39');
}
function updateUserTable1039_1040($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('cancelunpaidcode',''));
$sql = "ALTER TABLE %hist% MODIFY refid INT (10) NULL";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.0.40');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1040_1041($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %prodtype% ADD printer INT(2) NULL AFTER kind";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %prodtype% SET printer=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$sql = "UPDATE %printjobs% SET printer=? WHERE (type=1 OR type=2) AND printer is null";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$this->updateVersion($pdo, '1.0.41');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1041_1042($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$this->updateVersion($pdo, '1.0.42');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1042_1043($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% ADD orderuser INT(10) NULL AFTER ordertime";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
// get the first user - at least the admin should be aways there
$sql = "SELECT id FROM %user% WHERE active=? ORDER BY id LIMIT 1";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$row = $stmt->fetchObject();
$userid = $row->id;
$sql = "UPDATE %queue% SET orderuser=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
$sql = "ALTER TABLE %queue% MODIFY orderuser INT(10) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %room% ADD printer INT(2) NULL AFTER roomname";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.0.43');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1043_1100($prefix) {
return $this->setVersion($prefix, '1.1.0');
}
function updateUserTable1100_1101($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %user% ADD keeptypelevel INT(1) NULL AFTER prefertablemap";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %user% SET keeptypelevel=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$sql = "ALTER TABLE %user% MODIFY keeptypelevel INT(1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('bigfontworkreceipt','0'));
$this->updateVersion($pdo, '1.1.1');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1101_1102($prefix) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% ADD isclosed INT(1) NULL AFTER workprinted";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "select max(closingdate) as lastdate from %closing%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$row = $stmt->fetchObject();
$lastclosingdate = $row->lastdate;
if (!is_null($lastclosingdate)) {
$sql = "UPDATE %queue% SET isclosed=? WHERE ordertime <= ?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1,$lastclosingdate));
}
$this->updateVersion($pdo, '1.1.2');
return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1102_1103($prefix) {
return $this->setVersion($prefix, '1.1.3');
}
function updateUserTable1103_1104($prefix) {
return $this->setVersion($prefix, '1.1.4');
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$this->updateVersion($pdo, $theVersion);
return true;
} catch (PDOException $e) {
return false;
}
}
function signLastBillId() {
$pdo = $this->pdo;
$this->basedb->signLastBillid($pdo);
}
function createTables($decpoint,$billlanguage,$currency,$timezone)
{
$pdo = $this->pdo;
$this->basedb->setTimeZone($timezone);
$this->basedb->dropTables($pdo);
$this->basedb->createRatingsTable($pdo);
$this->createPaymentTable($pdo);
$this->basedb->createUserTable($pdo);
$this->basedb->createRoomTable($pdo);
$this->basedb->createRestTables($pdo);
$this->basedb->createTableMapsTable($pdo);
$this->basedb->createTablePosTable($pdo);
$this->basedb->createConfigTable($pdo);
$this->basedb->createProdTypeTable($pdo);
$this->basedb->createProductTable($pdo);
$this->basedb->createPriceLevelTable($pdo);
$this->basedb->createClosingTable($pdo);
$this->basedb->createBillTable($pdo);
$this->basedb->createQueueTable($pdo);
$this->basedb->createBillProductsTable($pdo);
$this->basedb->createHistTables($pdo);
$this->defineHistActions($pdo);
$this->basedb->createPrintJobsTable($pdo);
$this->basedb->createWorkTable($pdo);
$this->basedb->createCommentsTable($pdo);
$this->basedb->createReservationsTable($pdo);
$this->basedb->createLogoTable($pdo);
$this->basedb->createExtrasTable($pdo);
$this->basedb->createExtrasprodsTable($pdo);
$this->basedb->createQueueExtrasTable($pdo);
$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('1', 'A', 'Normale Preisstufe', 'Normal', 'Normal')");
$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('2', 'B', 'Wochenendtarif', 'Weekend prices','Tarifa del fin de semana')");
$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('3', 'C', 'Happy Hour', 'Happy Hour','Happy Hour')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'pricelevel', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'tax', '19.0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'togotax', '7.0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'stornocode', '123')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'printpass', 'printen')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'companyinfo', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')");
$resTxt = 'Vielen Dank für Ihre Reservierung am DATUM um ZEIT Uhr für ANZAHL Personen.\n\nWir freuen uns auf Ihren Besuch!\n\nBETRIEBSINFO';
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'reservationnote', '$resTxt')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'serverurl', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'email', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiveremail', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'payprinttype', 's')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.4')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'timezone', '$timezone')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'webimpressum', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'cancelunpaidcode', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'bigfontworkreceipt', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtphost', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpauth', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpuser', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtppass', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpsecure', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpport', '587')");
// prepare for later inconsistency check if version is obsolete
date_default_timezone_set($timezone);
$installDate = date('Y-m-d H:i:s');
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'installdate', '$installDate')");
$this->readConfigTableAndSendToHist($pdo);
return;
}
public function getCurrentVersion() {
try {
$pdo = $this->pdo;
$sql = "SELECT setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array("version"));
$row = $stmt->fetchObject();
return($row->setting);
} catch (Exception $e) {
return null;
}
}
public function isTherePreviousVersion($db,$prefix) {
try {
$pdo = $this->pdo;
$sql = "SELECT count(*) as thecount FROM information_schema.tables WHERE table_schema = '$db' AND table_name = '" . $prefix . "config' LIMIT 1";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row = $stmt->fetchObject();
if ($row->thecount == 1) {
return true;
} else {
return false;
}
} catch (Exception $e) {
return false;
}
}
function readConfigTableAndSendToHist($pdo) {
$sql_query = "SELECT * FROM %config%";
$sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES (NULL,?,?)";
$stmt_query = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_query));
$stmt_insert_histconfig = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histconfig));
$stmt_query->execute();
$result = $stmt_query->fetchAll();
foreach($result as $row){
$stmt_insert_histconfig->execute(array($row['id'],$row['setting']));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '2', $newRefIdForHist);
}
}
private function insertIntoHist($pdo,$action,$refIdForHist) {
date_default_timezone_set($this->timezone);
$currentTime = date('Y-m-d H:i:s');
$sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)";
$stmt_insert_hist = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_hist));
$stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist));
}
function insertUser($username,$adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,
$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,
$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap) {
$md5adminpass = md5($adminpass);
$pdo = $this->pdo;
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`keeptypelevel`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1')";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap,1));
$newUserIdForHist = $pdo->lastInsertId();
// now insert into hist
$sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` ,
`is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,
`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_reservation`,`right_rating`,`active`) VALUES (
NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt_insert_histuser = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histuser));
$stmt_insert_histuser->execute(array($newUserIdForHist,$username,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,1));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '3', $newRefIdForHist);
}
function createPaymentTable($pdo) {
$this->basedb->createPaymentTable($pdo);
$sql = "INSERT INTO %payment% (id,name,name_en,name_esp) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('1', 'Barzahlung', 'Cash', 'Contado'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('2', 'EC-Kartenzahlung','Electr. purse (EC)','Pago con tarjeta EC'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('3', 'Kreditkartenzahlung','Credit card','Tarjeta de credito'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('4', 'Rechnung','bill','Factura'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('5', 'Ueberweisung','Bank transfer','Transferencia'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('6', 'Lastschrift','Debit','Cargo en cuenta'));
}
public function defineHistActions ($pdo) {
$sql = "INSERT INTO %histactions% (id,name,description) VALUES (?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('1', 'ProdInit', 'Initiales Befuellen der Produkttabelle'));
$stmt->execute(array('2', 'ConfigInit', 'Initiales Befuellen der Konfigurationstabelle'));
$stmt->execute(array('3', 'UserInit', 'Initiales Befuellen der Benutzertabelle'));
$stmt->execute(array('4', 'ProdChange', 'Modifikation der Produktdaten'));
$stmt->execute(array('5', 'ProdCreation', 'Neues Produkt'));
$stmt->execute(array('6', 'ConfigChange', 'Modifikation der Konfiguration'));
$stmt->execute(array('7', 'UserCreation', 'Neuer Benutzer'));
$stmt->execute(array('8', 'UserChange', 'Modifikation eines Benutzers'));
}
function testDbConnection($host,$dbname,$user,$pass) {
$pdo = $this->openDbAndReturnPdo($host,$dbname,$user,$pass);
if (!is_null($pdo)) {
echo json_encode("OK");
} else {
echo json_encode("ERROR");
}
}
function writeConfigFile($host,$db,$user,$password,$prefix) {
$errorlevel = "<?php\nerror_reporting(E_ERROR);\n\n"; // development: E_ALL
$hostlines = "// Zum Aufbau der Verbindung zur Datenbank\n";
$hostlines .= "// die Daten erhalten Sie von Ihrem Provider\n";
$hostlines .= "defined('MYSQL_HOST') || define ( 'MYSQL_HOST','$host' );";
$userlines = "defined('MYSQL_USER') || define ( 'MYSQL_USER', '$user' );";
$dbpasslines = "defined('MYSQL_PASSWORD') || define ( 'MYSQL_PASSWORD', '$password' );";
$dblines = "defined('MYSQL_DB') || define ( 'MYSQL_DB', '$db' );";
$dbloglines = "defined('LOG') || define ( 'LOG', false );";
$prefixlines = "defined('TAB_PREFIX') || define ('TAB_PREFIX', '$prefix');";
$installstatusline = "defined('INSTALLSTATUS') || define ('INSTALLSTATUS', 'installed');";
$configText = "$errorlevel\n$hostlines\n$userlines\n$dbpasslines\n$dblines\n$dbloglines\n$prefixlines\n$installstatusline\n?>";
file_put_contents("../php/config.php", $configText);
try {
file_put_contents("../php/config1.php", $configText);
} catch (Exception $e) {
// nothing
}
}
function createSslKeys($pdo) {
$sslconfig = array(
"digest_alg" => "sha512",
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);
// thus the signature is exactly 512 bytes
// Create the private and public key
$res = openssl_pkey_new($sslconfig);
if (is_null($res) || ($res=="")) {
// openssl may be incorrectly installed
return false;
}
// Extract the private key from $res to $privKey
openssl_pkey_export($res, $privKey);
// Extract the public key from $res to $pubKey
$pubKey = openssl_pkey_get_details($res);
$pubKey = $pubKey["key"];
$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array("privkey","privkey",$privKey));
$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array("cert","cert",$pubKey));
return true;
}
static function insertSampleMenu($pdo,$adminCl) {
$menu = file_get_contents("../customer/speisekarte.txt");
$adminCl->fillSpeisekarteCore($pdo, $menu);
}
function insertSample($level,$lang,$adminpass,$workflow,$timezone) {
$pdo = $this->pdo;
$adminCl = new Admin();
$adminCl::overruleTimeZone($timezone);
$adminCl->changeOneConfigDbItem($pdo,"workflowconfig",$workflow,"%config%",true);
if ($level == 1) {
// nothing to do - empty db
} else {
$roomTxt1 = array("Raum 1 (Tischkarte)","Room 1 (table map)","Espacio 1 (mapa de mesas)");
$roomTxt2 = array("Raum 2 (Tischbuttons)","Room 2 (table buttons)","Espacio (botones des mesas)");
$tableTxt = array("Tisch","Table","Mesa");
$waiterTxt = array("Karl Kellner","Walter Waiter","Carlo Camarero");
$cookTxt = array("Koch 1","Charlie Cook","Cocinero 1");
$bossTxt = array("Charlie Chef","Maggy Manager","Jefe");
$sql = "INSERT INTO `%room%` (`id`, `roomname`) VALUES (?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1,$roomTxt1[$lang]));
if ($level == 3) {
$stmt->execute(array(2,$roomTxt2[$lang]));
}
$sql = "INSERT INTO `%resttables%` (`id` , `tableno`, `roomid`) VALUES (? ,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
for ($i=1;$i<7;$i++) {
$stmt->execute(array($i,$tableTxt[$lang] . " $i",1));
if ($level == 3) {
$stmt->execute(array($i + 6,$tableTxt[$lang] . " " . ($i + 6),2));
}
}
if ($level == 3) {
$sql = "INSERT INTO `%tablemaps%` (`id` , `roomid`, `img`,`sizex`,`sizey`) VALUES (NULL ,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$room = file_get_contents("../customer/innenraum.png");
$stmt->execute(array(1,$room,739,490));
$sql = "INSERT INTO `%tablepos%` (`id` , `tableid`, `x`,`y`) VALUES (NULL ,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1,70,74));
$stmt->execute(array(2,9,57));
$stmt->execute(array(3,19,37));
$stmt->execute(array(4,30,21));
$stmt->execute(array(5,49,21));
$stmt->execute(array(6,76,22));
}
if ($workflow == 2) {
// only receipts - no views kitchen,bar,supply
$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,0,1,0,1,0,0,0,1,0,$lang,1);
if ($level == 3) {
$this->insertUser($bossTxt[$lang],$adminpass ,0,1,0,0,0,1,1,1,1,1,1,1,1,$lang,1);
}
} else {
$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,1,1,0,1,0,0,0,1,0,$lang,1);
if ($level == 3) {
$this->insertUser($cookTxt[$lang],$adminpass ,0,0,1,1,1,0,0,0,0,0,0,0,0,$lang,1);
$this->insertUser($bossTxt[$lang],$adminpass ,0,1,1,1,1,1,1,1,1,1,1,1,1,$lang,1);
}
}
$logoimg = file_get_contents("../customer/logo.png");
$sql = "INSERT INTO %logo% (id,name,setting) VALUES(1,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("logoimg",$logoimg));
self::insertSampleMenu($pdo,$adminCl);
}
}
}
$command = $_GET["command"];
if ($command == 'checkWriteAccess') {
$checker = new Checks();
$checker->checkWriteAccess();
} else if ($command == 'checkPhpStatus') {
$checker = new InstallAdmin();
$checker->checkPhpStatus();
} else if ($command == 'testDbConnection') {
$admin = new InstallAdmin();
try {
if (isset($_POST['host']) && isset($_POST['dbname']) && isset($_POST['user']) && isset($_POST['pass'])) {
$admin->testDbConnection($_POST['host'],$_POST['dbname'],$_POST['user'],$_POST['pass']);
} else {
echo json_encode("ERROR");
}
} catch (Exception $e) {
echo json_encode("ERROR");
}
} else if ($command == 'getConfig') {
$configWriter = new ConfigWriter();
$configWriter->getConfigVals();
} else if ($command == 'install') {
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
$admin->setPdo($pdo);
$admin->setPrefix($_POST['prefix']);
$admin->setTimeZone($_POST['timezone']);
DbUtils::overruleTimeZone($_POST['timezone']);
DbUtils::overrulePrefix($_POST['prefix']);
set_time_limit(60*5);
$admin->createTables($_POST['point'],$_POST['lang'],$_POST['currency'],$_POST['timezone']);
$ok = $admin->createSslKeys($pdo);
$admin->signLastBillId();
if (!$ok) {
echo json_encode("Fehler: Ist OpenSSL richtig installiert?");
return;
}
$admin->insertUser("admin",$_POST['adminpass'],1,0,0,0,0,0,0,0,0,1,1,0,0,$_POST['lang'],1);
$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']);
if(session_id() == '') {
session_start();
}
session_destroy();
echo json_encode("OK");
} else if ($command == 'insertsamplecontent') {
try {
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
$admin->setPdo($pdo);
$admin->setPrefix($_POST['prefix']);
$admin->setTimeZone($_POST["timezone"]);
$admin->insertSample(intval($_POST["level"]),intval($_POST["lang"]),$_POST['adminpass'],$_POST["workflow"],$_POST["timezone"]);
echo json_encode("OK");
}
catch (PDOException $e) {
echo json_encode("ERROR: $e");
}
} else if ($command == 'gettimezones') {
$timezone_identifiers = DateTimeZone::listIdentifiers();
$zones = array();
for ($i=0; $i < count($timezone_identifiers); $i++) {
$zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
$admin->setPdo($pdo);
$admin->setPrefix($_POST['prefix']);
$isPreviousInstallation = $admin->isTherePreviousVersion($_POST['db'],$_POST['prefix']);
if (!$isPreviousInstallation) {
echo json_encode("Stimmt der Tabellenpräfix?");
return;
}
$version = $admin->getCurrentVersion();
if (is_null($version)) {
echo json_encode("Version nicht bestimmbar");
return;
}
$ret = true;
if ($version == "1.0.13") {
$ret &= $admin->updateUserTable1013_1014();
$ret &= $admin->updateUserTable1014_1015();
$ret &= $admin->updateUserTable1015_1016();
$ret &= $admin->updateUserTable1016_1017();
$ret &= $admin->updateUserTable1017_1018();
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if ($version == "1.0.14") {
$ret &= $admin->updateUserTable1014_1015();
$ret &= $admin->updateUserTable1015_1016();
$ret &= $admin->updateUserTable1016_1017();
$ret &= $admin->updateUserTable1017_1018();
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if ($version == "1.0.15") {
$ret &= $admin->updateUserTable1015_1016();
$ret &= $admin->updateUserTable1016_1017();
$ret &= $admin->updateUserTable1017_1018();
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if ($version == "1.0.16") {
$ret &= $admin->updateUserTable1016_1017();
$ret &= $admin->updateUserTable1017_1018();
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.17") || ($version == "1.0.18")) {
$ret &= $admin->updateUserTable1018_1019();
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if ($version == "1.0.19") {
$ret &= $admin->updateUserTable1019_1020();
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.20") || ($version == "1.0.21")) {
// nothing to do... :) (but maybe user has pressed though)
} else if (($version == "1.0.22")) {
$ret &= $admin->updateUserTable1022_1023($_POST['prefix']);
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.23")) {
$ret &= $admin->updateUserTable1023_1024($_POST['prefix']);
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.24")) {
$ret &= $admin->updateUserTable1024_1025($_POST['prefix']);
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.25")) {
$ret &= $admin->updateUserTable1025_1026($_POST['prefix']);
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.26")) {
$ret &= $admin->updateUserTable1026_1027($_POST['prefix']);
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.27")) {
$ret &= $admin->updateUserTable1027_1028($_POST['prefix']);
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.28")) {
$ret &= $admin->updateUserTable1028_1029($_POST['prefix']);
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.29")) {
$ret &= $admin->updateUserTable1029_1030($_POST['prefix']);
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.30")) {
$ret &= $admin->updateUserTable1030_1031($_POST['prefix']);
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.31")) {
$ret &= $admin->updateUserTable1031_1032($_POST['prefix']);
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.32")) {
$ret &= $admin->updateUserTable1032_1033($_POST['prefix']);
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.33")) {
$ret &= $admin->updateUserTable1033_1034($_POST['prefix']);
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.34")) {
$ret &= $admin->updateUserTable1034_1035($_POST['prefix']);
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.35")) {
$ret &= $admin->updateUserTable1035_1036($_POST['prefix']);
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.36")) {
$ret &= $admin->updateUserTable1036_1037($_POST['prefix']);
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.37")) {
$ret &= $admin->updateUserTable1037_1038($_POST['prefix']);
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.38")) {
$ret &= $admin->updateUserTable1038_1039($_POST['prefix']);
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.39")) {
$ret &= $admin->updateUserTable1039_1040($_POST['prefix']);
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.40")) {
$ret &= $admin->updateUserTable1040_1041($_POST['prefix']);
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.41")) {
$ret &= $admin->updateUserTable1041_1042($_POST['prefix']);
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.42")) {
$ret &= $admin->updateUserTable1042_1043($_POST['prefix']);
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.0.43")) {
$ret &= $admin->updateUserTable1043_1100($_POST['prefix']);
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.1.0")) {
$ret &= $admin->updateUserTable1100_1101($_POST['prefix']);
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.1.1")) {
$ret &= $admin->updateUserTable1101_1102($_POST['prefix']);
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.1.2")) {
$ret &= $admin->updateUserTable1102_1103($_POST['prefix']);
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else if (($version == "1.1.3")) {
$ret &= $admin->updateUserTable1103_1104($_POST['prefix']);
} else {
echo json_encode("Quellversion nicht unterstützt");
return;
}
if(session_id() == '') {
session_start();
}
session_destroy();
if ($ret) {
$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']);
echo json_encode("OK");
} else {
echo json_encode("ERROR");
}
}
?>