OrderSprinter 1.3.22

This commit is contained in:
Geno 2020-11-19 23:03:43 +01:00
parent ab8822c3e7
commit e872007aca
23 changed files with 520 additions and 91 deletions

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.21");
Database::setVersion($pdo,$prefix,"1.3.22");
Database::setAccessPassword($pdo,$prefix,$adminpass);
Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour
return array("status" => "OK","msg" => "Installation successful");

Binary file not shown.

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -9,8 +9,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.22">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -215,7 +215,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.3.21"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.22"},500);
}
}

View File

@ -725,7 +725,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.3.21</button>
<button id="updatebtn">Update -> 1.3.22</button>
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
</td>
<td>&nbsp;</td>

View File

@ -64,7 +64,7 @@ return $pdo;
}
function checkPhpStatus() {
$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib","curl");
$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib","curl","zip","ftp");
$missing = array();
$extensions_status = 1;
@ -2450,6 +2450,34 @@ return false;
}
function updateUserTable1321_1322($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.21") {
$ret = $this->updateUserTable1320_1321($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.3.20 to 1.3.21 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$this->execSqlWithParam($pdo, "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)", array('tmpdir',''));
$this->execSqlWithParam($pdo, "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)", array('ftphost',''));
$this->execSqlWithParam($pdo, "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)", array('ftpuser',''));
$this->execSqlWithParam($pdo, "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)", array('ftppass',''));
$this->updateVersion($pdo, '1.3.22');
return true;
} catch (PDOException $e) {
echo "Error in v1.3.21 to 1.3.22: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
@ -2576,7 +2604,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$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.3.21')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.22')");
$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')");
@ -2623,6 +2651,10 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'hs3refresh', '60')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'memorylimit', '512')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'updateurl', 'http://www.ordersprinter.de/update')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'tmpdir', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'ftphost', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'ftpuser', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'ftppass', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'restaurantmode', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'dblog', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'priceinlist', '0')");
@ -3016,7 +3048,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.21";
$installerVersion = "1.3.22";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -3047,7 +3079,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30",
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.2.10","1.2.11","1.2.12","1.2.13","1.2.14","1.2.15","1.2.16","1.2.17",
"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7","1.3.8","1.3.9","1.3.10","1.3.11","1.3.12",
"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20"
"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20","1.3.21"
);
if (!in_array($version, $supportedVersions)) {
@ -3055,7 +3087,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1320_1321($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1321_1322($_POST['prefix'], $version, $_POST['db']);
if(session_id() == '') {
session_start();

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -204,6 +204,7 @@ var MAN_BAK_BTN = ["Sicherung (Konfiguration)","Backup (Configuration)","Exporta
var MAN_BAK_GUEST_BTN = ["Sicherung (Konfiguration + Gäste)","Backup (Configuration + guests)","Exportar (configuración y clientes)"];
var MAN_BAK_BTN_ALL = ["Sicherung (Alles ohne Logs)","Backup (all without logs)","Exportar (todo sin protocolo)"];
var MAN_BAK_BTN_ALL_LOGS = ["Sicherung (Alles mit Logs)","Backup (all with logs)","Exportar (todo y protocolo)"];
var MAN_BAK_FTP_ALL = ["FTP-Sicherung (Alles ohne Logs)","Ftp backup (all without logs)","Ftp (todo sin protocolo)"];
var MAN_UPDATE_HEAD = ["Versionsupdate","Version update","Actualizar la versión"];
var MAN_CHECK_UPDATE_BTN = ["Update starten","Start update","Empezar actualizar"];
var MAN_UPDATE_HINT = ["Das Updaten über diesen Weg funktioniert nur, wenn die Dateien im Webverzeichnis beschreibbar sind und eine Verbindung zum OrderSprinter-Webserver besteht.",
@ -283,6 +284,10 @@ var MAN_DISCOUNTNAME2 = ["Bezeichnung Rabatt 2","Name of discount 2","Nombre del
var MAN_DISCOUNTNAME3 = ["Bezeichnung Rabatt 3","Name of discount 3","Nombre del descuento 3"];
var MAN_MEMORYLIMIT = ["PHP Memory Limit (MB)","PHP Memory Limit (MB)","PHP Memory Limit (MB)"];
var MAN_UPDATEURL = ["Update-Server","Update server","Servidor de actualizar"];
var MAN_TMPDIR = ["PHP-Temp-Verzeichnis","PHP temp directory","PHP Tmp"];
var MAN_FTPHOST = ["Ftp-Server","Ftp server","Ftp servidor"];
var MAN_FTPUSER = ["Ftp-Benutzername","Ftp user name","Ftp usario"];
var MAN_FTPPASS = ["Ftp-Passwort","Ftp password","Ftp contraseña"];
var MAN_HS3REFRESH = ["HS/3 Updateinterval (Sek.)","HS/3 Update interval (sec.)","HS/3 Update Interval (sec)"];
var MAN_WEBIMPRESSUM = ["Webimpressum","Web company info","www café info"];
var MAN_TAX_ASSIGN = ["Umsatzsteuer-Zuweisung","Taxes assigment","Asignar impuestos"];
@ -382,6 +387,9 @@ var MAN_DASHSLOT1 = ["Dashboard Slot 1","Dashboard Slot 1","Dashboard Slot 1"];
var MAN_DASHSLOT2 = ["Dashboard Slot 2","Dashboard Slot 2","Dashboard Slot 2"];
var MAN_DASHSLOT3 = ["Dashboard Slot 3","Dashboard Slot 3","Dashboard Slot 3"];
var MAN_CREATECLOS_TXT = ["Tageserfassung erstellen","Create closing","Crear cerramiento"];
var MAN_TMPDIRHINT = ["Wird das PHP-Tmp-Verzeichnis angegeben, so können z.B. komprimierte Backups erstellt werden. In der Regel sollte der Default-Wert der PHP-Umgebung stimmen, aber einige Provider biegen den Pfad um, ohne die PHP-Konfiguration anzupassen!",
"If the PHP tmp directory is set it is possible to create compressed backups and more. Usually the default value of the PHP framework should fit, but sometimes the providers change the tmp directory without adapting the PHP framework!",
"Si el tmp esta espcificado es posible crear backups comprimidos por ejemplo. Normalmente el valor default es corecto pero de vez en cuando los providers cambian el valor sin adaptar el PHP framework!"];
var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1,0,1,0,0,1,1, 1,1,1,1,1,1,1,1,1,1, 1,2,3, 1,0, 1,0];
@ -393,6 +401,7 @@ var version = '';
var newerversionavailable = 0;
var adminIsLoggedIn = false;
var managerIsLoggedIn = false;
var defaulttmp = '';
var generalValuesSettings = [
["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"],
@ -476,6 +485,10 @@ var generalValuesSettings = [
["memorylimit",MAN_MEMORYLIMIT[lang],"i",0,""],
["updateurl",MAN_UPDATEURL[lang],"i",0,""],
["tmpdir",MAN_TMPDIR[lang],"i",0,""],
["ftphost",MAN_FTPHOST[lang],"i",0,""],
["ftpuser",MAN_FTPUSER[lang],"i",0,""],
["ftppass",MAN_FTPPASS[lang],"i",0,""],
["hs3refresh",MAN_HS3REFRESH[lang],"i",0,""],
["dashslot1",MAN_DASHSLOT1[lang],"s",35],
["dashslot2",MAN_DASHSLOT2[lang],"s",36],
@ -547,6 +560,11 @@ function setLanguage(l) {
$("#memorylimittxt").html(MAN_MEMORYLIMIT[l]);
$("#updateurltxt").html(MAN_UPDATEURL[l]);
$("#tmpdirtxt").html(MAN_TMPDIR[l]);
$("#tmpdirhint").html(MAN_TMPDIRHINT[l]);
$("#ftphosttxt").html(MAN_FTPHOST[l]);
$("#ftpusertxt").html(MAN_FTPUSER[l]);
$("#ftppasstxt").html(MAN_FTPPASS[l]);
$("#hs3refreshtxt").html(MAN_HS3REFRESH[l]);
$("#paydeskidtxt").html(MAN_PAYDESKID[l]);
@ -573,7 +591,8 @@ function setLanguage(l) {
$("#backupbtntxt").html(MAN_BAK_BTN[l]);
$("#backupguestsbtntxt").html(MAN_BAK_GUEST_BTN[l]);
$("#backupbtntxtall").html(MAN_BAK_BTN_ALL[l]);
$("#backupbtntxtalllogs").html(MAN_BAK_BTN_ALL_LOGS[l])
$("#backupbtntxtalllogs").html(MAN_BAK_BTN_ALL_LOGS[l]);
$("#backupbtnftptxtall").html(MAN_BAK_FTP_ALL[l]);
$("#golivetxt").html(MAN_GO_LIVE[l]);
$("#shutdownbtntxt").html(MAN_SHUTDOWN[l]);
@ -840,6 +859,8 @@ function insertGeneralConfigItems(configResult) {
generalVals[40] = values.dblog;
generalVals[41] = values.priceinlist;
defaulttmp = values.defaulttmp;
$("#smtphost").val(values.smtphost);
$("#partOfSmtpauth").html(createSMTPAuth(values.smtpauth));
$("#smtpuser").val(values.smtpuser);
@ -854,6 +875,10 @@ function insertGeneralConfigItems(configResult) {
$("#memorylimit").val(values.memorylimit);
$("#updateurl").val(values.updateurl);
$("#tmpdir").val(values.tmpdir);
$("#ftphost").val(values.ftphost);
$("#ftpuser").val(values.ftpuser);
$("#ftppass").val(values.ftppass);
$("#hs3refresh").val(values.hs3refresh);
$("#paydeskid").val(values.paydeskid);
@ -1177,7 +1202,7 @@ function initRestoreFileUpload() {
var settings = {
url: "php/contenthandler.php?module=admin&command=restore",
method: "POST",
allowedTypes:"json",
allowedTypes:"json,zip",
fileName: "userfile",
multiple: false,
uploadQueueOrder: 'replace',
@ -1192,7 +1217,7 @@ function initRestoreFileUpload() {
} else {
alert("Import war erfolgreich.");
setTimeout(function(){
document.location.href = "index.html?v=1.3.21";
document.location.href = "index.html?v=1.3.22";
},250);
}
},
@ -1570,6 +1595,12 @@ function binding() {
window.location.href = "php/contenthandler.php?module=admin&command=backup&type=alllogs";
});
$("#backup_btnftpall").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
doAjax("GET","php/contenthandler.php?module=admin&command=ftpbackup&type=all",null,handleFtpResult,null);
});
$("#backupguests_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
@ -1655,7 +1686,12 @@ function binding() {
doAjax("POST","php/contenthandler.php?module=admin&command=assignTaxes",data,confirmMsg,"Problem Steuersatzzuweisung");
});
$("#defaulttmpbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#tmpdir").val(defaulttmp);
$("#tmpdir").data("changed",true);
});
bindSelectionsWithActions();
}
@ -1682,6 +1718,14 @@ function insertAvailableUpdateVersion(answer) {
}
}
function handleFtpResult(answer) {
if (answer.status != "OK") {
alert("Error: " + answer.msg);
return;
}
alert("Aktion durchgeführt");
}
function handleUpdateCheckResult(answer) {
if (answer.status != "OK") {
alert("Error: " + answer.msg);
@ -1713,9 +1757,9 @@ function handleUpdateCheckResult(answer) {
var millis=getMillis();
setTimeout(function(){
document.location.href = "install.html?v=1.3.21&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.3.22&mode=onlyupdate&n=" + millis;
},250);
document.location.href = "install.html?v=1.3.21&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.3.22&mode=onlyupdate&n=" + millis;
}
function handleUpdateReplace(answer) {
@ -2545,7 +2589,7 @@ function createClosingPart (aText,id,totalsum,cashsum,usersums,taxessums,cashops
var receiverEmail = $("#receiveremail").val();
closingPart += '<fieldset class="ui-grid-a" id="emailfieldset' + id + '">';
closingPart += '<div class="ui-block-a">';
closingPart += '<input type="text" name="email_' + id + '" id="email_' + id + '" value="' + receiverEmail + '" /></div>';
closingPart += '<input type="text" name="email_' + id + '" id="email_' + id + '" value="' + receiverEmail + '" class="whiteinput" /></div>';
closingPart += '<div class="ui-block-b"><button type="submit" data-theme="c" class="csvEmailAllButton" data-icon="arrow-r" id="csvallemail_' + id + '">' + MAN_EMAIL_DATA[lang] + '</button></div>';
closingPart += '<button type="submit" data-theme="f" class="printButton" data-icon="check" id="printexport_' + id + '">' + MAN_PRINT_ALL[lang] + '</button>';
@ -3245,6 +3289,28 @@ $(document).on("pageinit", "#admin-page", function () {
<label for="updateurl"><span id="updateurltxt">Update-Server:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="updateurl" data-theme="c" class="genConfigEl"/>
</div>
<div class="grouparea">
<div data-role="fieldcontain">
<label for="tmpdir"><span id="tmpdirtxt">PHP-Tmp:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="tmpdir" data-theme="c" class="genConfigEl"/><br><br>
<button type="submit" data-theme="f" data-icon="check" id="defaulttmpbtn">Default</button><br>
<i><span id="tmpdirhint">Hinweis</span></i>
</div>
</div>
<div data-role="fieldcontain">
<label for="ftphost"><span id="ftphosttxt">FTP-Server:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="ftphost" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="ftpuser"><span id="ftpusertxt">FTP-User:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="ftpuser" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="ftppass"><span id="ftppasstxt">FTP-Pass:</span></label>
<input type="password" value="" data-mini="true" placeholder="" id="ftppass" data-theme="c" class="genConfigEl"/>
</div>
<div id="partOfAustria"></div>
@ -3618,6 +3684,7 @@ $(document).on("pageinit", "#admin-page", function () {
<form action='dummy'>
<button type="submit" data-theme="f" id="backup_btnall"><span id="backupbtntxtall">Sicherung</span></button>
<button type="submit" data-theme="f" id="backup_btnalllogs"><span id="backupbtntxtalllogs">Sicherung</span></button>
<button type="submit" data-theme="f" id="backup_btnftpall"><span id="backupbtnftptxtall">FTPSicherung</span></button>
</form>
</div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -51,8 +51,10 @@ class Admin {
"getPayPrintType" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getPayments" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"autobackup" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"autoftpbackup" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"shutdown" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"optimize" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"ftpbackup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"backup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"restore" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"golive" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
@ -212,6 +214,8 @@ class Admin {
$this->getPayments();
} else if ($command == 'autobackup') {
$this->backup('auto',$_POST['remoteaccesscode']);
} else if ($command == 'autoftpbackup') {
$this->ftpbackup('auto',$_POST['remoteaccesscode']);
} else if ($command == 'fill') {
$this->fillSampleContent();
echo json_encode(array("status" => "OK"));
@ -220,6 +224,9 @@ class Admin {
} else if ($command == 'backup') {
$this->backup($_GET['type'],null);
return;
} else if ($command == 'ftpbackup') {
$this->ftpbackup($_GET['type'],null);
return;
} else if ($command == 'restore') {
$this->restore();
return;
@ -1046,6 +1053,11 @@ class Admin {
$memorylimit = CommonUtils::getConfigValueStmt($pdo,$stmt,"memorylimit",256);
$updateurl = CommonUtils::getConfigValueStmt($pdo,$stmt,"updateurl","");
$tmpdir = CommonUtils::getConfigValueStmt($pdo,$stmt,"tmpdir","");
$ftphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftphost","");
$ftpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftpuser","");
$ftppass = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftppass","");
$hs3refresh = CommonUtils::getConfigValueStmt($pdo,$stmt, "hs3refresh", 60);
$paydeskid = CommonUtils::getConfigValueStmt($pdo,$stmt,"paydeskid","");
@ -1063,6 +1075,8 @@ class Admin {
$right_changeprice = ($_SESSION['right_changeprice'] ? 1 : 0);
}
$defaultTmp = sys_get_temp_dir();
date_default_timezone_set(DbUtils::getTimeZone());
$now = getdate();
@ -1080,7 +1094,7 @@ class Admin {
"smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkrecf" => $oneprodworkrecf, "oneprodworkrecd" => $oneprodworkrecd,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "updateurl" => $updateurl, "hs3refresh" => $hs3refresh,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "updateurl" => $updateurl, "tmpdir" => $tmpdir, "hs3refresh" => $hs3refresh,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"restaurantmode" => $restaurantmode,
"discountname1" => $discountname1,"discountname2" => $discountname2,"discountname3" => $discountname3, "dblog" => $dblog,"startprodsearch" => $startprodsearch,
@ -1093,7 +1107,9 @@ class Admin {
"showpayment7" => $showpayment7,
"showpayment8" => $showpayment8,
"dashslot1" => $dashslot1,"dashslot2" => $dashslot2,"dashslot3" => $dashslot3,
"priceinlist" => $priceinlist
"priceinlist" => $priceinlist,
"defaulttmp" => $defaultTmp,
"ftphost" => $ftphost,"ftpuser" => $ftpuser, "ftppass" => $ftppass
);
@ -1186,7 +1202,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.21");
echo json_encode($view . "?v=1.3.22");
}
}
@ -1393,27 +1409,27 @@ class Admin {
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.21"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.22"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.21"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.22"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.21"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.21"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.21"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.22"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.22"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.22"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.21"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.22"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.21"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.21"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.21"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.21"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.21"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.21"); };
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.3.21"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.21"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.21");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.3.21");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.21");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.22"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.22"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.22"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.22"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.22"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.22"); };
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.3.22"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.22"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.22");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.3.22");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.22");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1421,7 +1437,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.21",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.22",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1830,6 +1846,10 @@ class Admin {
"memorylimit" => array("dbcol" => "memorylimit","checknum" => 0),
"updateurl" => array("dbcol" => "updateurl","checknum" => 0),
"tmpdir" => array("dbcol" => "tmpdir","checknum" => 0),
"ftphost" => array("dbcol" => "ftphost","checknum" => 0),
"ftpuser" => array("dbcol" => "ftpuser","checknum" => 0),
"ftppass" => array("dbcol" => "ftppass","checknum" => 0),
"hs3refresh" => array("dbcol" => "hs3refresh","checknum" => 0),
"paydeskid" => array("dbcol" => "paydeskid","checknum" => 0),
@ -1886,7 +1906,7 @@ class Admin {
}
}
if ($name == "updateurl") {
if (($name == "updateurl") || ($name == "tmpdir") || ($name == "ftphost") || ($name == "ftpuser")) {
$aVal = trim($aVal);
}
@ -2300,13 +2320,39 @@ class Admin {
"extras","extrasprods","queueextras");
}
public function backup($theType,$remoteaccesscode) {
public function ftpbackup($theType,$remoteaccesscode) {
if (!extension_loaded("ftp")) {
echo json_encode(array("status" => "ERROR","msg" => "PHP-Extension ftp ist nicht installiert"));
return;
}
$pdo = DbUtils::openDbAndReturnPdoStatic();
$ftphost = CommonUtils::getConfigValue($pdo, 'ftphost', '');
$ftpuser = CommonUtils::getConfigValue($pdo, 'ftpuser', '');
$ftppass = CommonUtils::getConfigValue($pdo, 'ftppass', '');
$pdo = null;
if (($ftphost == '') || ($ftpuser == '') || ($ftppass = '')) {
echo json_encode(array("status" => "ERROR","msg" => "Ftp-Verbindung wurde nicht konfiguriert"));
} else {
$ok = $this->backup($theType, $remoteaccesscode,true);
echo json_encode($ok);
}
}
public function backup($theType,$remoteaccesscode,$doFtp = false) {
set_time_limit(60*60);
date_default_timezone_set(DbUtils::getTimeZone());
$nowtime = date('Y-m-d');
$zipExtension = true;
if (!extension_loaded("zip")) {
$zipExtension = false;
}
$pdo = DButils::openDbAndReturnPdoStatic();
$tmpdir = CommonUtils::getConfigValue($pdo, 'tmpdir', '');
if ($theType == "auto") {
$code = CommonUtils::getConfigValue($pdo, 'remoteaccesscode', null);
@ -2329,13 +2375,18 @@ class Admin {
$genInfo = $this->getGeneralConfigItems(false, $pdo);
$version = $genInfo["version"];
$fileName = "backup-" . $version . "_" . $nowtime . "-configuration.json";
$extension = "json";
if (($tmpdir != '') && $zipExtension) {
$extension = "zip";
}
$fileName = "backup-" . $version . "_" . $nowtime . "-configuration.$extension";
if ($theType == "all") {
$fileName = "backup-" . $version . "_" . $nowtime . "-all.json";
$fileName = "backup-" . $version . "_" . $nowtime . "-all.$extension";
} else if ($theType == "alllogs") {
$fileName = "backup-" . $version . "_" . $nowtime . "-all-logs.json";
$fileName = "backup-" . $version . "_" . $nowtime . "-all-logs.$extension";
} else if ($theType == "confandguests") {
$fileName = "backup-" . $version . "_" . $nowtime . "-guests.json";
$fileName = "backup-" . $version . "_" . $nowtime . "-guests.$extension";
}
if ($theType == "configuration") {
@ -2352,6 +2403,9 @@ class Admin {
$binaryFields = array("signature","img","setting","content");
$dbcontent = array();
$filenames = array();
foreach($tables as $table) {
$sql = "DESCRIBE %$table%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -2364,42 +2418,135 @@ class Admin {
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$tableContent = array();
foreach($result as $row) {
$fieldContent = array();
foreach($fields as $field) {
if (in_array($field,$binaryFields)) {
$aFieldEntry = array("fieldname" => $field,"value" => base64_encode($row[$field]));
$aFieldEntry = array("f" => $field,"v" => base64_encode($row[$field]));
} else {
$aFieldEntry = array("fieldname" => $field,"value" => $row[$field]);
$aFieldEntry = array("f" => $field,"v" => $row[$field]);
}
$fieldContent[] = $aFieldEntry;
};
$tableContent[] = $fieldContent;
}
$dbcontent[] = array("table" => $table, "content" => $tableContent);
if (($tmpdir == '') || !$zipExtension) {
$dbcontent[] = array("t" => $table, "c" => $tableContent);
} else {
try {
$tempfile=tempnam($tmpdir,"$table");
$contentToWrite = json_encode($tableContent);
$success = file_put_contents($tempfile, $contentToWrite);
if ($success == FALSE) {
echo "Fehler: Ist das PHP-Tmp-Verzeichnis richtig gesetzt?";
}
$filenames[] = array("table" => $table,"file" => $tempfile);
} catch (Exception $ex) {
echo "Fehler: " . $ex->getMessage() . " - Ist das PHP-Tmp-Verzeichnis richtig gesetzt?";
}
}
}
$pdo->commit();
$retStr = json_encode($dbcontent);
if (($tmpdir == '') || !$zipExtension) {
$retStr = json_encode($dbcontent);
if ($doFtp) {
return $this->doFtp($pdo, $fileName, $retStr, null);
} else {
ob_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$fileName\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ". strlen($retStr));
ob_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$fileName\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ". strlen($retStr));
echo $retStr;
ob_end_flush();
}
} else {
$zipfile = tempnam($tmpdir,"zip");
$zip = new ZipArchive();
if ($zip->open($zipfile, ZipArchive::CREATE)!==TRUE) {
exit("cannot open <$zipfile>\n");
}
foreach($filenames as $afilename) {
$theTable = $afilename["table"];
$theFilename = $afilename["file"];
$str = file_get_contents($theFilename);
$substr = substr($str, 1,10);
$zip->addFile($theFilename,$theTable);
}
$zip->addFromString("version",$version);
$zip->close();
if ($doFtp) {
return $this->doFtp($pdo, $fileName, null,$zipfile);
} else {
header('Content-Description: File Transfer');
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="'.basename($fileName).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($zipfile));
echo $retStr;
ob_end_flush();
readfile($zipfile);
}
// REM now clean up
foreach($filenames as $afilename) {
unlink($afilename["file"]);
}
unlink($zipfile);
exit;
}
}
private function doFtp($pdo,$filename,$content,$zipfile) {
try {
$ftphost = CommonUtils::getConfigValue($pdo, 'ftphost', '');
$ftpuser = CommonUtils::getConfigValue($pdo, 'ftpuser', '');
$ftppass = CommonUtils::getConfigValue($pdo, 'ftppass', '');
$conn_id = ftp_connect($ftphost);
$login_result = ftp_login($conn_id, $ftpuser, $ftppass);
ftp_pasv($conn_id, true);
if ((!$conn_id) || (!$login_result)) {
return array("status" => "ERROR","msg" => "Ftp-Verbindung zum Server $ftphost konnte nicht hergestellt werden!");
}
if (is_null($zipfile)) {
$fp = fopen('php://temp', 'r+');
//fwrite($fp, $content);
fwrite($fp,$content);
rewind($fp);
$upload = ftp_fput($conn_id, $filename, $fp, FTP_BINARY);
} else {
$upload = ftp_put($conn_id, $filename, $zipfile, FTP_BINARY);
}
ftp_close($conn_id);
if (!$upload) {
return array("status" => "ERROR","msg" => "Ftp-Upload war nicht erfolgreich");
} else {
return array("status" => "OK");
}
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => "Ftp-Upload war nicht erfolgreich: " . $ex->getMessage());
}
}
private function restore() {
@ -2420,7 +2567,27 @@ class Admin {
echo json_encode(array("status" => "ERROR","msg" => "Datei konnte nicht hochgeladen werden."));
exit();
}
$zipExtension = true;
if (!extension_loaded("zip")) {
$zipExtension = false;
}
$origname = $_FILES['userfile']['name'];
$pdo = DbUtils::openDbAndReturnPdoStatic();
if (CommonUtils::strEndsWith($origname, '.zip')) {
if ($zipExtension) {
$this->restoreFromZip($pdo);
} else {
echo json_encode(array("status" => "ERROR","msg" => "PHP-Zip-Extension ist nicht installiert."));
exit();
}
} else {
$this->restoreFromJson($pdo);
}
}
private function restoreFromJson($pdo) {
$binaryFields = array("signature","img","setting","content");
$content = file_get_contents($_FILES['userfile']['tmp_name']);
@ -2429,7 +2596,6 @@ class Admin {
$basedb->setPrefix(TAB_PREFIX);
$basedb->setTimeZone(DbUtils::getTimeZone());
$pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction();
$genInfo = $this->getGeneralConfigItems(false, $pdo);
@ -2445,7 +2611,7 @@ class Admin {
$foundConfigItem = null;
foreach($table['content'] as $aConfigItem) {
foreach($aConfigItem as $aConfigDbPart) {
if (($aConfigDbPart['fieldname'] == 'name') && ($aConfigDbPart['value'] == 'version')) {
if (($aConfigDbPart['f'] == 'name') && ($aConfigDbPart['v'] == 'version')) {
$foundConfigItem = $aConfigItem;
break;
}
@ -2453,8 +2619,8 @@ class Admin {
}
if (!is_null($foundConfigItem)) {
foreach($foundConfigItem as $aConfigDbPart) {
if ($aConfigDbPart['fieldname'] == 'setting') {
$bakVersion = base64_decode($aConfigDbPart['value']);
if ($aConfigDbPart['f'] == 'setting') {
$bakVersion = base64_decode($aConfigDbPart['v']);
if ($bakVersion != $version) {
echo json_encode(array("status" => "ERROR","msg" => "Backup hat die falsche Version $bakVersion."));
exit();
@ -2475,14 +2641,14 @@ class Admin {
self::doSql($pdo, "SET foreign_key_checks = 0;", null);
foreach($dbContent as $table) {
$tablename = "%" . $table['table'] . "%";
$tablecontent = $table['content'];
$tablename = "%" . $table['t'] . "%";
$tablecontent = $table['c'];
if ($table['table'] == "queue") {
if ($table['t'] == "queue") {
$typeIsOnlyConfig = false;
}
if ($table['table'] == "bill") {
if ($table['t'] == "bill") {
$sql = "SET FOREIGN_KEY_CHECKS = 0";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
@ -2493,12 +2659,12 @@ class Admin {
$vals = array();
$quests = array();
foreach ($row as $field) {
$fieldname = $field['fieldname'];
$fieldname = $field['f'];
$cols[] = $fieldname;
if (in_array($fieldname, $binaryFields)) {
$vals[] = base64_decode($field['value']);
$vals[] = base64_decode($field['v']);
} else {
$vals[] = $field['value'];
$vals[] = $field['v'];
}
$quests[] = '?';
@ -2516,7 +2682,7 @@ class Admin {
}
}
if ($table['table'] == "bill") {
if ($table['t'] == "bill") {
$sql = "SET FOREIGN_KEY_CHECKS = 1";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
@ -2568,6 +2734,165 @@ class Admin {
echo json_encode(array("status" => "OK"));
}
private function restoreFromZip($pdo) {
$tmpdir = CommonUtils::getConfigValue($pdo, 'tmpdir', '');
if ($tmpdir == '') {
echo json_encode(array("status" => "ERROR","msg" => "Zip-Files können nur importiert werden, wenn ein PHP Temp. Directory konfiguriert ist."));
exit();
}
$zip = new ZipArchive;
$zipFile = $_FILES['userfile']['tmp_name'];
$jsonFiles = array();
if ($zip->open($zipFile) == TRUE) {
for ($i = 0; $i < $zip->numFiles; $i++) {
$jsonFiles[] = $zip->getNameIndex($i);
}
$zip->extractTo($tmpdir, $jsonFiles);
$zip->close();
} else {
echo json_encode(array("status" => "ERROR","msg" => "Hochgeladenes Zip-File kann nicht geöffnet werden."));
exit();
}
$binaryFields = array("signature","img","setting","content");
$basedb = new Basedb();
$basedb->setPrefix(TAB_PREFIX);
$basedb->setTimeZone(DbUtils::getTimeZone());
$genInfo = $this->getGeneralConfigItems(false, $pdo);
$version = $genInfo["version"];
$timezone = DbUtils::getTimeZone();
$versionOfUploadedFile = file_get_contents($tmpdir . "/version");
if ($versionOfUploadedFile != $version) {
echo json_encode(array("status" => "ERROR","msg" => "Backup hat die falsche Version $versionOfUploadedFile."));
exit();
}
$pdo->beginTransaction();
$basedb->dropTables($pdo);
$basedb->createEmptyTables($pdo);
$typeIsOnlyConfig = true;
self::doSql($pdo, "SET foreign_key_checks = 0;", null);
foreach($jsonFiles as $table) {
if ($table == "version") {
continue;
}
$tablename = "%" . $table . "%";
$tablecontent = json_decode(file_get_contents($tmpdir . "/" . $table),true);
if ($table == "queue") {
$typeIsOnlyConfig = false;
}
if ($table == "bill") {
$sql = "SET FOREIGN_KEY_CHECKS = 0";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
foreach($tablecontent as $row) {
$cols = array();
$vals = array();
$quests = array();
foreach ($row as $field) {
try {
$fieldname = $field['f'];
$cols[] = $fieldname;
if (in_array($fieldname, $binaryFields)) {
$vals[] = base64_decode($field['v']);
} else {
$vals[] = $field['v'];
}
$quests[] = '?';
} catch (Exception $ex) {
echo $ex->getMessage();
exit;
}
}
$colstr = implode(",",$cols);
$queststr = implode(",",$quests);
$sql = "INSERT INTO $tablename ($colstr) VALUES ($queststr)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
try {
$stmt->execute($vals);
} catch (Exception $e) {
$errorMsg = $e->getMessage();
}
}
if ($table == "bill") {
$sql = "SET FOREIGN_KEY_CHECKS = 1";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
}
foreach($jsonFiles as $table) {
unlink($tmpdir . "/" . $table);
}
if (!$typeIsOnlyConfig) {
HistFiller::insertRestoreHistEntry($pdo);
}
self::doSql($pdo, "SET foreign_key_checks = 1;", null);
$basedb->signLastBillid($pdo);
$setVersion = "update %config% set setting=? where name='version'";
$stmt = $pdo->prepare($basedb->resolveTablenamesInSqlString($setVersion));
$stmt->execute(array($version));
$sql = "SELECT name FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("timezone"));
$row = $stmt->fetchObject();
if ($stmt->rowCount() == 0) {
$this->changeOneConfigDbItem($pdo, "timezone", $timezone, "%config%", true);
}
$pdo->commit();
if(session_id() == '') {
session_start();
}
$_SESSION = array();
// Swipe via memory
if (ini_get("session.use_cookies")) {
// Prepare and swipe cookies
$params = session_get_cookie_params();
// clear cookies and sessions
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
ini_set('session.gc_max_lifetime', 0);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 1);
session_destroy();
echo json_encode(array("status" => "OK"));
}
private function shutdown() {
try {
if (substr(php_uname(), 0, 7) == "Windows"){

View File

@ -517,11 +517,11 @@ private function getClosingByTaxAndUser($pdo,$closingid) {
$sql = "SELECT sum(price) as sumprice,%queue%.tax as thetax,username ";
$sql .= "FROM %bill%,%billproducts%,%queue%,%user% ";
$sql .= "WHERE %billproducts%.billid=%bill%.id AND %bill%.closingid=? AND %bill%.userid=%user%.id AND %billproducts%.queueid=%queue%.id ";
$sql .= "AND (%bill%.status is null OR %bill%.status != ?) ";
$sql .= "AND (%bill%.status is null OR %bill%.status != (? OR ? OR ?)) ";
$sql .= "GROUP BY username,thetax ";
$decpoint = CommonUtils::getConfigValue($pdo, "decpoint", ",");
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($closingid,'c'));
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($closingid,'c','x','s'));
$count = count($result);
if ($count == 0) {

View File

@ -401,4 +401,9 @@ class CommonUtils {
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
public static function strEndsWith($haystack, $needle)
{
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
}
}

View File

@ -117,7 +117,7 @@ class Updater {
$infoFileLines = $infoFile["msg"];
if (count($infoFileLines) > 1) {
$checkIfNewerVersion = self::isV2Newer('1.3.21',trim($infoFileLines[0]));
$checkIfNewerVersion = self::isV2Newer('1.3.22',trim($infoFileLines[0]));
return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url,"neweravailable" => ($checkIfNewerVersion ? 1 : 0));
} else {
return array("status" => "ERROR","msg" => "Info file not valid","url" => $url);

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,8 +4,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.22">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />