add sql-query of last statement to sql-debug for debugging purposes; fix default-ssl-ip setting and allow 'none' value
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -71,7 +71,7 @@ class Database {
|
||||
try {
|
||||
$stmt->execute($params);
|
||||
} catch (PDOException $e) {
|
||||
self::_showerror($e, $showerror, $json_response);
|
||||
self::_showerror($e, $showerror, $json_response, $stmt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ class Database {
|
||||
* @param PDOException $error
|
||||
* @param bool $showerror if set to false, the error will be logged but we go on
|
||||
*/
|
||||
private static function _showerror($error, $showerror = true, $json_response = false) {
|
||||
private static function _showerror($error, $showerror = true, $json_response = false, PDOStatement $stmt = null) {
|
||||
global $userinfo, $theme, $linker;
|
||||
|
||||
// include userdata.inc.php
|
||||
@@ -374,6 +374,8 @@ class Database {
|
||||
if ($showerror) {
|
||||
if (empty($sql['debug'])) {
|
||||
$error_trace = '';
|
||||
} elseif (!is_null($stmt)) {
|
||||
$error_trace .= "<br><br>".$stmt->queryString;
|
||||
}
|
||||
|
||||
// fallback
|
||||
|
||||
@@ -64,5 +64,6 @@ function getIpPortCombinations($ssl = false) {
|
||||
}
|
||||
|
||||
function getSslIpPortCombinations() {
|
||||
return getIpPortCombinations(true);
|
||||
global $lng;
|
||||
return array('' => $lng['panel']['none_value']) + getIpPortCombinations(true);
|
||||
}
|
||||
|
||||
@@ -95,23 +95,35 @@ function storeSettingDefaultSslIp($fieldname, $fielddata, $newfieldvalue) {
|
||||
if (count($ids) > 0) {
|
||||
$defaultips_new = explode(',', $newfieldvalue);
|
||||
|
||||
if (!empty($defaultips_old) && !empty($newfieldvalue))
|
||||
{
|
||||
$in_value = $defaultips_old . ", " . $newfieldvalue;
|
||||
} elseif (!empty($defaultips_old) && empty($newfieldvalue))
|
||||
{
|
||||
$in_value = $defaultips_old;
|
||||
} else {
|
||||
$in_value = $newfieldvalue;
|
||||
}
|
||||
|
||||
// Delete the existing mappings linking to default IPs
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_DOMAINTOIP . "`
|
||||
WHERE `id_domain` IN (" . implode(', ', $ids) . ")
|
||||
AND `id_ipandports` IN (" . $defaultips_old . ", " . $newfieldvalue . ")
|
||||
AND `id_ipandports` IN (" . $in_value . ")
|
||||
");
|
||||
Database::pexecute($del_stmt);
|
||||
|
||||
// Insert the new mappings
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_DOMAINTOIP . "`
|
||||
SET `id_domain` = :domainid, `id_ipandports` = :ipandportid
|
||||
");
|
||||
if (count($defaultips_new) > 0) {
|
||||
// Insert the new mappings
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_DOMAINTOIP . "`
|
||||
SET `id_domain` = :domainid, `id_ipandports` = :ipandportid
|
||||
");
|
||||
|
||||
foreach ($ids as $id) {
|
||||
foreach ($defaultips_new as $defaultip_new) {
|
||||
Database::pexecute($ins_stmt, array('domainid' => $id, 'ipandportid' => $defaultip_new));
|
||||
foreach ($ids as $id) {
|
||||
foreach ($defaultips_new as $defaultip_new) {
|
||||
Database::pexecute($ins_stmt, array('domainid' => $id, 'ipandportid' => $defaultip_new));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2119,3 +2119,4 @@ $lng['admin']['plans']['use_plan'] = 'Apply plan';
|
||||
$lng['question']['plan_reallydelete'] = 'Do you really want to delete the hosting plan %s?';
|
||||
$lng['admin']['notryfiles']['title'] = 'No autogenerated try_files';
|
||||
$lng['admin']['notryfiles']['description'] = 'Say yes here if you want to specify a custom try_files directive in specialsettings (needed for some wordpress plugins for example).';
|
||||
$lng['panel']['none_value'] = 'None';
|
||||
|
||||
@@ -1769,3 +1769,4 @@ $lng['admin']['plans']['use_plan'] = 'Plan übernehmen';
|
||||
$lng['question']['plan_reallydelete'] = 'Wollen Sie den Hosting-Plan "%s" wirklich löschen?';
|
||||
$lng['admin']['notryfiles']['title'] = 'Keine generierte try_files Anweisung';
|
||||
$lng['admin']['notryfiles']['description'] = 'Wähle "Ja", wenn eine eigene try_files Direktive in den "eigenen Vhost Einstellungen" angegeben werden soll (z.B. nötig für manche Wordpress Plugins).';
|
||||
$lng['panel']['none_value'] = 'Keine';
|
||||
|
||||
Reference in New Issue
Block a user