diff --git a/debian/changelog b/debian/changelog index 9d2f073..2d1289b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,17 @@ -nagiosql (3.2.0-4) UNRELEASED; urgency=medium +nagiosql (3.3.0-1) UNRELEASED; urgency=medium + + * Bump to 3.3.0 + + -- Mario Fetka Fri, 20 Oct 2017 15:11:38 +0200 + +nagiosql (3.2.0-5) UNRELEASED; urgency=medium * Bump to 3.2.0 branch with servicepack 3 * drop dpatch and switch to quilt * switch to nagios4 for default nagios implementation * many small bugfixes for mysqli - -- Mario Fetka Sun, 21 May 2017 19:21:36 +0200 + -- Mario Fetka Fri, 20 Oct 2017 15:07:22 +0200 nagiosql (3.0.3-1ubuntu2) lucid; urgency=low diff --git a/debian/patches/10_service_pack_1_additional_fixes_only.patch b/debian/patches/10_service_pack_1_additional_fixes_only.patch deleted file mode 100644 index 5c29d16..0000000 --- a/debian/patches/10_service_pack_1_additional_fixes_only.patch +++ /dev/null @@ -1,280 +0,0 @@ -diff -uNr nagiosql32.orig/admin/contacts.php nagiosql32/admin/contacts.php ---- nagiosql32.orig/admin/contacts.php 2012-04-20 12:39:53.983095000 +0200 -+++ nagiosql32/admin/contacts.php 2012-04-20 12:39:56.000000000 +0200 -@@ -10,7 +10,7 @@ - // Project : NagiosQL - // Component : Contact definitions - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-20 12:39:53 +0200 (Fri, 20 Apr 2012) $ -+// Date : $LastChangedDate: 2012-04-20 12:39:53 +0200 (Fr, 20. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 - // Revision : $LastChangedRevision: 1323 $ -diff -uNr nagiosql32.orig/admin/hosts.php nagiosql32/admin/hosts.php ---- nagiosql32.orig/admin/hosts.php 2012-04-17 12:09:50.082574000 +0200 -+++ nagiosql32/admin/hosts.php 2012-04-17 11:54:12.000000000 +0200 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Host definition - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-17 12:09:50 +0200 (Tue, 17 Apr 2012) $ -+// Date : $LastChangedDate: 2012-04-05 08:11:59 +0200 (Do, 05. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1321 $ -+// Revision : $LastChangedRevision: 1315 $ - // - /////////////////////////////////////////////////////////////////////////////// - // -diff -uNr nagiosql32.orig/admin/services.php nagiosql32/admin/services.php ---- nagiosql32.orig/admin/services.php 2012-04-17 12:09:50.082574000 +0200 -+++ nagiosql32/admin/services.php 2012-04-17 11:53:36.000000000 +0200 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Service definition - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-17 12:09:50 +0200 (Tue, 17 Apr 2012) $ -+// Date : $LastChangedDate: 2012-04-05 08:11:59 +0200 (Do, 05. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1321 $ -+// Revision : $LastChangedRevision: 1315 $ - // - /////////////////////////////////////////////////////////////////////////////// - // -diff -uNr nagiosql32.orig/admin/templatedefinitions.php nagiosql32/admin/templatedefinitions.php ---- nagiosql32.orig/admin/templatedefinitions.php 2012-04-05 08:11:59.091878000 +0200 -+++ nagiosql32/admin/templatedefinitions.php 2012-04-05 08:12:08.000000000 +0200 -@@ -10,7 +10,7 @@ - // Project : NagiosQL - // Component : Template definition list - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-05 08:11:59 +0200 (Thu, 05 Apr 2012) $ -+// Date : $LastChangedDate: 2012-04-05 08:11:59 +0200 (Do, 05. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 - // Revision : $LastChangedRevision: 1315 $ -diff -uNr nagiosql32.orig/functions/config_class.php nagiosql32/functions/config_class.php ---- nagiosql32.orig/functions/config_class.php 2013-01-10 09:46:11.799949000 +0100 -+++ nagiosql32/functions/config_class.php 2012-04-17 11:59:16.000000000 +0200 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Configuration Class - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2013-01-10 09:46:11 +0100 (Thu, 10 Jan 2013) $ -+// Date : $LastChangedDate: 2012-04-17 11:47:05 +0200 (Di, 17. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1351 $ -+// Revision : $LastChangedRevision: 1319 $ - // - /////////////////////////////////////////////////////////////////////////////////////////////// - // -@@ -710,8 +710,6 @@ - } else { - $this->myDataClass->writeLog(translate('Writing of the configuration failed - no dataset or not activated dataset found')); - $this->processClassMessage(translate('Writing of the configuration failed - no dataset or not activated dataset found')."::",$this->strErrorMessage); -- $configtp->parse(); -- $booReturn = $this->writeConfigFile($configtp->get(),$strFile,0,$intConfigID,$resConfigFile,$strConfigFile); - return(1); - } - $configtp->parse(); -@@ -1254,7 +1252,7 @@ - if ($strDataValue == 2) {$strDataValue = "*,";} else {$strDataValue = "";} - foreach ($arrDataRel AS $data) { - if ($data['exclude'] == 0) { -- $strDataValue .= $data['strSlave'].","; -+ $strDataValue .= $data['strSlave'].","; - } else if ($this->intNagVersion >=3) { - $strDataValue .= "!".$data['strSlave'].","; - } -diff -uNr nagiosql32.orig/functions/import_class.php nagiosql32/functions/import_class.php ---- nagiosql32.orig/functions/import_class.php 2012-09-18 10:44:22.198475000 +0200 -+++ nagiosql32/functions/import_class.php 2012-04-17 11:47:08.000000000 +0200 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Import Class - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-09-18 10:44:22 +0200 (Tue, 18 Sep 2012) $ -+// Date : $LastChangedDate: 2012-04-17 11:47:05 +0200 (Di, 17. Apr 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1346 $ -+// Revision : $LastChangedRevision: 1319 $ - // - /////////////////////////////////////////////////////////////////////////////////////////////// - // -@@ -899,7 +899,6 @@ - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - $intSlaveId = $this->myDBClass->intLastId; -- - // Special processing for serviceextinfo - if (($strDataTable == "tbl_serviceextinfo") && ($strKey == "service_description")) { - $strSQL = "SELECT `id` FROM `tbl_host` WHERE `host_name`='".$arrImportData['host_name']['value']."'"; -@@ -997,7 +996,7 @@ - } - // Does the entry already exist? - $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` $strLink WHERE `".$arrRelData['target1']."` = '".$elem."' -- $strWhere AND `config_id`=".$this->intDomainId; -+ $strWhere AND `active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -@@ -1014,7 +1013,7 @@ - } - // Insert relations - $strSQL = "INSERT INTO `".$arrRelData['linkTable']."` SET `idMaster` = ".$intDataId.", `idSlave` = ".$intSlaveId.", -- `exclude`=".$intExclude; -+ `exclude`=".$intExclude; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - // Keep values -@@ -1105,7 +1104,7 @@ - // Process data values - foreach ($arrValues AS $elem) { - // Does the template already exist? (table 1) -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' AND `active`='1' - AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { -@@ -1114,7 +1113,7 @@ - } - if ($intSlaveId == 0) { - // Does the template already exist? (table 2) -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName2']."` WHERE `".$arrRelData['target2']."` = '".$elem."' -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName2']."` WHERE `".$arrRelData['target2']."` = '".$elem."' AND `active`='1' - AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { -@@ -1219,8 +1218,7 @@ - // Process data values - foreach ($arrValues AS $elem) { - // Does the entry already exist? -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' -- AND `config_id`=".$this->intDomainId; -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' AND `active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -@@ -1422,7 +1420,7 @@ - } - // Does the entry already exist? - $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' -- $strWhere AND `config_id`=".$this->intDomainId; -+ $strWhere AND `active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -diff -uNr nagiosql32.orig/functions/prepend_adm.php nagiosql32/functions/prepend_adm.php ---- nagiosql32.orig/functions/prepend_adm.php 2013-01-10 09:46:11.799949000 +0100 -+++ nagiosql32/functions/prepend_adm.php 2012-03-27 12:47:58.000000000 +0200 -@@ -9,14 +9,14 @@ - // Project : NagiosQL - // Component : Preprocessing script - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2013-01-10 09:46:11 +0100 (Thu, 10 Jan 2013) $ -+// Date : $LastChangedDate: 2012-03-27 12:47:56 +0200 (Di, 27. Mär 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1351 $ -+// Revision : $LastChangedRevision: 1308 $ - // - /////////////////////////////////////////////////////////////////////////////// - //error_reporting(E_ALL); --error_reporting(E_ALL & ~E_STRICT); -+error_reporting(E_ALL); - // - // Security Protection - // =================== -@@ -253,7 +253,7 @@ - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url']."admin.php"; -- $_SESSION['timestamp'] = time(); -+ $_SESSION['timestamp'] = mktime(); - $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; - // Update language settings -@@ -273,10 +273,8 @@ - } - } - if (($_SESSION['logged_in'] == 0) && isset($chkInsName) && ($chkInsName != "") && ($intError == 0)) { -- $chkInsName = mysql_real_escape_string($chkInsName); -- $chkInsPasswd = mysql_real_escape_string($chkInsPasswd); -- $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".$chkInsName."' -- AND `password`=MD5('".$chkInsPasswd."') AND `active`='1'"; -+ $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".mysql_real_escape_string($chkInsName)."' -+ AND `password`=MD5('$chkInsPasswd') AND `active`='1'"; - $booReturn = $myDBClass->getDataArray($strSQL,$arrDataUser,$intDataCount); - if ($booReturn == false) { - $myVisClass->processMessage(translate('Error while selecting data from database:'),$strErrorMessage); -@@ -288,7 +286,7 @@ - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] ."admin.php"; -- $_SESSION['timestamp'] = time(); -+ $_SESSION['timestamp'] = mktime(); - $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; - // Update language settings -@@ -329,9 +327,9 @@ - $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage); - } else if ($intDataCount == 1) { - // Time expired? -- if (time() - $_SESSION['timestamp'] > $_SESSION['SETS']['security']['logofftime']) { -+ if (mktime() - $_SESSION['timestamp'] > $_SESSION['SETS']['security']['logofftime']) { - // Force new login -- $myDataClass->writeLog(translate('Session timeout reached - Seconds:')." ".(time() - $_SESSION['timestamp']." - User: ".$_SESSION['username'])); -+ $myDataClass->writeLog(translate('Session timeout reached - Seconds:')." ".(mktime() - $_SESSION['timestamp']." - User: ".$_SESSION['username'])); - $_SESSION['logged_in'] = 0; - - header("Location: ".$_SESSION['SETS']['path']['protocol']."://".$_SERVER['HTTP_HOST'].$_SESSION['SETS']['path']['base_url']."index.php"); -@@ -347,7 +345,7 @@ - } - } - // Update login time -- $_SESSION['timestamp'] = time(); -+ $_SESSION['timestamp'] = mktime(); - if (isset($preContent) && ($preContent == "index.tpl.htm")) { - header("Location: ".$_SESSION['SETS']['path']['protocol']."://".$_SERVER['HTTP_HOST'].$_SESSION['startsite']); - } -diff -uNr nagiosql32.orig/functions/prepend_content.php nagiosql32/functions/prepend_content.php ---- nagiosql32.orig/functions/prepend_content.php 2012-05-03 15:15:32.673020000 +0200 -+++ nagiosql32/functions/prepend_content.php 2012-04-04 07:30:16.000000000 +0200 -@@ -144,14 +144,14 @@ - $chkButValue3 = isset($_POST['butValue3']) ? $_POST['butValue3'] : ""; // Common button value - $chkButValue4 = isset($_POST['butValue4']) ? $_POST['butValue4'] : ""; // Common button value - $chkButValue5 = isset($_POST['butValue5']) ? $_POST['butValue5'] : ""; // Common button value --$chkTfNullVal1 = (isset($_POST['tfNullVal1']) && ($_POST['tfNullVal1'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal1'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal2 = (isset($_POST['tfNullVal2']) && ($_POST['tfNullVal2'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal2'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal3 = (isset($_POST['tfNullVal3']) && ($_POST['tfNullVal3'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal3'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal4 = (isset($_POST['tfNullVal4']) && ($_POST['tfNullVal4'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal4'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal5 = (isset($_POST['tfNullVal5']) && ($_POST['tfNullVal5'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal5'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal6 = (isset($_POST['tfNullVal6']) && ($_POST['tfNullVal6'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal6'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal7 = (isset($_POST['tfNullVal7']) && ($_POST['tfNullVal7'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal7'])+0 : "NULL"; // Common text NULL field value --$chkTfNullVal8 = (isset($_POST['tfNullVal8']) && ($_POST['tfNullVal8'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal8'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal1 = (isset($_POST['tfNullVal1']) && ($_POST['tfNullVal1'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal1']) : "NULL"; // Common text NULL field value -+$chkTfNullVal2 = (isset($_POST['tfNullVal2']) && ($_POST['tfNullVal2'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal2']) : "NULL"; // Common text NULL field value -+$chkTfNullVal3 = (isset($_POST['tfNullVal3']) && ($_POST['tfNullVal3'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal3']) : "NULL"; // Common text NULL field value -+$chkTfNullVal4 = (isset($_POST['tfNullVal4']) && ($_POST['tfNullVal4'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal4']) : "NULL"; // Common text NULL field value -+$chkTfNullVal5 = (isset($_POST['tfNullVal5']) && ($_POST['tfNullVal5'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal5']) : "NULL"; // Common text NULL field value -+$chkTfNullVal6 = (isset($_POST['tfNullVal6']) && ($_POST['tfNullVal6'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal6']) : "NULL"; // Common text NULL field value -+$chkTfNullVal7 = (isset($_POST['tfNullVal7']) && ($_POST['tfNullVal7'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal7']) : "NULL"; // Common text NULL field value -+$chkTfNullVal8 = (isset($_POST['tfNullVal8']) && ($_POST['tfNullVal8'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal8']) : "NULL"; // Common text NULL field value - // - // Quote special characters - // ========================== -diff -uNr nagiosql32.orig/templates/admin/user.tpl.htm nagiosql32/templates/admin/user.tpl.htm ---- nagiosql32.orig/templates/admin/user.tpl.htm 2012-03-27 12:47:56.208241000 +0200 -+++ nagiosql32/templates/admin/user.tpl.htm 2012-03-27 12:47:58.000000000 +0200 -@@ -3,7 +3,7 @@ - - - -- -+ - - - diff --git a/debian/patches/20_service_pack_2_additional_fixes_only.patch b/debian/patches/20_service_pack_2_additional_fixes_only.patch deleted file mode 100644 index 2bfac09..0000000 --- a/debian/patches/20_service_pack_2_additional_fixes_only.patch +++ /dev/null @@ -1,248 +0,0 @@ -diff -uNr nagiosql32.orig/admin/verify.php nagiosql32/admin/verify.php ---- nagiosql32.orig/admin/verify.php 2012-09-24 14:42:29.052342000 +0200 -+++ nagiosql32/admin/verify.php 2012-09-24 13:42:30.000000000 +0200 -@@ -10,7 +10,7 @@ - // Project : NagiosQL - // Component : Configuration verification - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-09-24 14:42:29 +0200 (Mon, 24 Sep 2012) $ -+// Date : $LastChangedDate: 2012-09-24 14:42:29 +0200 (Mo, 24. Sep 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 - // Revision : $LastChangedRevision: 1347 $ -diff -uNr nagiosql32.orig/functions/config_class.php nagiosql32/functions/config_class.php ---- nagiosql32.orig/functions/config_class.php 2017-05-20 19:36:57.228000000 +0200 -+++ nagiosql32/functions/config_class.php 2013-01-10 09:46:14.000000000 +0100 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Configuration Class - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-17 11:47:05 +0200 (Di, 17. Apr 2012) $ -+// Date : $LastChangedDate: 2013-01-10 09:46:11 +0100 (Do, 10. Jan 2013) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1319 $ -+// Revision : $LastChangedRevision: 1351 $ - // - /////////////////////////////////////////////////////////////////////////////////////////////// - // -@@ -710,6 +710,8 @@ - } else { - $this->myDataClass->writeLog(translate('Writing of the configuration failed - no dataset or not activated dataset found')); - $this->processClassMessage(translate('Writing of the configuration failed - no dataset or not activated dataset found')."::",$this->strErrorMessage); -+ $configtp->parse(); -+ $booReturn = $this->writeConfigFile($configtp->get(),$strFile,0,$intConfigID,$resConfigFile,$strConfigFile); - return(1); - } - $configtp->parse(); -@@ -1252,7 +1254,7 @@ - if ($strDataValue == 2) {$strDataValue = "*,";} else {$strDataValue = "";} - foreach ($arrDataRel AS $data) { - if ($data['exclude'] == 0) { -- $strDataValue .= $data['strSlave'].","; -+ $strDataValue .= $data['strSlave'].","; - } else if ($this->intNagVersion >=3) { - $strDataValue .= "!".$data['strSlave'].","; - } -diff -uNr nagiosql32.orig/functions/import_class.php nagiosql32/functions/import_class.php ---- nagiosql32.orig/functions/import_class.php 2017-05-20 19:36:57.228000000 +0200 -+++ nagiosql32/functions/import_class.php 2012-09-18 09:44:24.000000000 +0200 -@@ -10,10 +10,10 @@ - // Project : NagiosQL - // Component : Import Class - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-04-17 11:47:05 +0200 (Di, 17. Apr 2012) $ -+// Date : $LastChangedDate: 2012-09-18 10:44:22 +0200 (Di, 18. Sep 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1319 $ -+// Revision : $LastChangedRevision: 1346 $ - // - /////////////////////////////////////////////////////////////////////////////////////////////// - // -@@ -899,6 +899,7 @@ - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - $intSlaveId = $this->myDBClass->intLastId; -+ - // Special processing for serviceextinfo - if (($strDataTable == "tbl_serviceextinfo") && ($strKey == "service_description")) { - $strSQL = "SELECT `id` FROM `tbl_host` WHERE `host_name`='".$arrImportData['host_name']['value']."'"; -@@ -996,7 +997,7 @@ - } - // Does the entry already exist? - $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` $strLink WHERE `".$arrRelData['target1']."` = '".$elem."' -- $strWhere AND `active`='1' AND `config_id`=".$this->intDomainId; -+ $strWhere AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -@@ -1013,7 +1014,7 @@ - } - // Insert relations - $strSQL = "INSERT INTO `".$arrRelData['linkTable']."` SET `idMaster` = ".$intDataId.", `idSlave` = ".$intSlaveId.", -- `exclude`=".$intExclude; -+ `exclude`=".$intExclude; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - // Keep values -@@ -1104,7 +1105,7 @@ - // Process data values - foreach ($arrValues AS $elem) { - // Does the template already exist? (table 1) -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' AND `active`='1' -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' - AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { -@@ -1113,7 +1114,7 @@ - } - if ($intSlaveId == 0) { - // Does the template already exist? (table 2) -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName2']."` WHERE `".$arrRelData['target2']."` = '".$elem."' AND `active`='1' -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName2']."` WHERE `".$arrRelData['target2']."` = '".$elem."' - AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { -@@ -1218,7 +1219,8 @@ - // Process data values - foreach ($arrValues AS $elem) { - // Does the entry already exist? -- $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' AND `active`='1' AND `config_id`=".$this->intDomainId; -+ $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' -+ AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -@@ -1420,7 +1422,7 @@ - } - // Does the entry already exist? - $strSQL = "SELECT `id` FROM `".$arrRelData['tableName1']."` WHERE `".$arrRelData['target1']."` = '".$elem."' -- $strWhere AND `active`='1' AND `config_id`=".$this->intDomainId; -+ $strWhere AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != "") { - $intSlaveId = $strId+0; -diff -uNr nagiosql32.orig/functions/nag_class.php nagiosql32/functions/nag_class.php ---- nagiosql32.orig/functions/nag_class.php 2012-10-03 10:00:02.307645000 +0200 -+++ nagiosql32/functions/nag_class.php 2012-10-03 09:00:04.000000000 +0200 -@@ -10,7 +10,7 @@ - // Project : NagiosQL - // Component : Visualization Class - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-10-03 10:00:02 +0200 (Wed, 03 Oct 2012) $ -+// Date : $LastChangedDate: 2012-10-03 10:00:02 +0200 (Mi, 03. Okt 2012) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 - // Revision : $LastChangedRevision: 1349 $ -diff -uNr nagiosql32.orig/functions/prepend_adm.php nagiosql32/functions/prepend_adm.php ---- nagiosql32.orig/functions/prepend_adm.php 2017-05-20 19:36:57.232000000 +0200 -+++ nagiosql32/functions/prepend_adm.php 2013-01-10 09:46:14.000000000 +0100 -@@ -9,14 +9,14 @@ - // Project : NagiosQL - // Component : Preprocessing script - // Website : http://www.nagiosql.org --// Date : $LastChangedDate: 2012-03-27 12:47:56 +0200 (Di, 27. Mär 2012) $ -+// Date : $LastChangedDate: 2013-01-10 09:46:11 +0100 (Do, 10. Jan 2013) $ - // Author : $LastChangedBy: martin $ - // Version : 3.2.0 --// Revision : $LastChangedRevision: 1308 $ -+// Revision : $LastChangedRevision: 1351 $ - // - /////////////////////////////////////////////////////////////////////////////// - //error_reporting(E_ALL); --error_reporting(E_ALL); -+error_reporting(E_ALL & ~E_STRICT); - // - // Security Protection - // =================== -@@ -253,7 +253,7 @@ - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url']."admin.php"; -- $_SESSION['timestamp'] = mktime(); -+ $_SESSION['timestamp'] = time(); - $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; - // Update language settings -@@ -273,8 +273,10 @@ - } - } - if (($_SESSION['logged_in'] == 0) && isset($chkInsName) && ($chkInsName != "") && ($intError == 0)) { -- $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".mysql_real_escape_string($chkInsName)."' -- AND `password`=MD5('$chkInsPasswd') AND `active`='1'"; -+ $chkInsName = mysql_real_escape_string($chkInsName); -+ $chkInsPasswd = mysql_real_escape_string($chkInsPasswd); -+ $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".$chkInsName."' -+ AND `password`=MD5('".$chkInsPasswd."') AND `active`='1'"; - $booReturn = $myDBClass->getDataArray($strSQL,$arrDataUser,$intDataCount); - if ($booReturn == false) { - $myVisClass->processMessage(translate('Error while selecting data from database:'),$strErrorMessage); -@@ -286,7 +288,7 @@ - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] ."admin.php"; -- $_SESSION['timestamp'] = mktime(); -+ $_SESSION['timestamp'] = time(); - $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; - // Update language settings -@@ -327,9 +329,9 @@ - $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage); - } else if ($intDataCount == 1) { - // Time expired? -- if (mktime() - $_SESSION['timestamp'] > $_SESSION['SETS']['security']['logofftime']) { -+ if (time() - $_SESSION['timestamp'] > $_SESSION['SETS']['security']['logofftime']) { - // Force new login -- $myDataClass->writeLog(translate('Session timeout reached - Seconds:')." ".(mktime() - $_SESSION['timestamp']." - User: ".$_SESSION['username'])); -+ $myDataClass->writeLog(translate('Session timeout reached - Seconds:')." ".(time() - $_SESSION['timestamp']." - User: ".$_SESSION['username'])); - $_SESSION['logged_in'] = 0; - - header("Location: ".$_SESSION['SETS']['path']['protocol']."://".$_SERVER['HTTP_HOST'].$_SESSION['SETS']['path']['base_url']."index.php"); -@@ -345,7 +347,7 @@ - } - } - // Update login time -- $_SESSION['timestamp'] = mktime(); -+ $_SESSION['timestamp'] = time(); - if (isset($preContent) && ($preContent == "index.tpl.htm")) { - header("Location: ".$_SESSION['SETS']['path']['protocol']."://".$_SERVER['HTTP_HOST'].$_SESSION['startsite']); - } -diff -uNr nagiosql32.orig/functions/prepend_content.php nagiosql32/functions/prepend_content.php ---- nagiosql32.orig/functions/prepend_content.php 2017-05-20 19:36:57.232000000 +0200 -+++ nagiosql32/functions/prepend_content.php 2012-05-03 08:10:06.000000000 +0200 -@@ -144,14 +144,14 @@ - $chkButValue3 = isset($_POST['butValue3']) ? $_POST['butValue3'] : ""; // Common button value - $chkButValue4 = isset($_POST['butValue4']) ? $_POST['butValue4'] : ""; // Common button value - $chkButValue5 = isset($_POST['butValue5']) ? $_POST['butValue5'] : ""; // Common button value --$chkTfNullVal1 = (isset($_POST['tfNullVal1']) && ($_POST['tfNullVal1'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal1']) : "NULL"; // Common text NULL field value --$chkTfNullVal2 = (isset($_POST['tfNullVal2']) && ($_POST['tfNullVal2'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal2']) : "NULL"; // Common text NULL field value --$chkTfNullVal3 = (isset($_POST['tfNullVal3']) && ($_POST['tfNullVal3'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal3']) : "NULL"; // Common text NULL field value --$chkTfNullVal4 = (isset($_POST['tfNullVal4']) && ($_POST['tfNullVal4'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal4']) : "NULL"; // Common text NULL field value --$chkTfNullVal5 = (isset($_POST['tfNullVal5']) && ($_POST['tfNullVal5'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal5']) : "NULL"; // Common text NULL field value --$chkTfNullVal6 = (isset($_POST['tfNullVal6']) && ($_POST['tfNullVal6'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal6']) : "NULL"; // Common text NULL field value --$chkTfNullVal7 = (isset($_POST['tfNullVal7']) && ($_POST['tfNullVal7'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal7']) : "NULL"; // Common text NULL field value --$chkTfNullVal8 = (isset($_POST['tfNullVal8']) && ($_POST['tfNullVal8'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal8']) : "NULL"; // Common text NULL field value -+$chkTfNullVal1 = (isset($_POST['tfNullVal1']) && ($_POST['tfNullVal1'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal1'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal2 = (isset($_POST['tfNullVal2']) && ($_POST['tfNullVal2'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal2'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal3 = (isset($_POST['tfNullVal3']) && ($_POST['tfNullVal3'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal3'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal4 = (isset($_POST['tfNullVal4']) && ($_POST['tfNullVal4'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal4'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal5 = (isset($_POST['tfNullVal5']) && ($_POST['tfNullVal5'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal5'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal6 = (isset($_POST['tfNullVal6']) && ($_POST['tfNullVal6'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal6'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal7 = (isset($_POST['tfNullVal7']) && ($_POST['tfNullVal7'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal7'])+0 : "NULL"; // Common text NULL field value -+$chkTfNullVal8 = (isset($_POST['tfNullVal8']) && ($_POST['tfNullVal8'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal8'])+0 : "NULL"; // Common text NULL field value - // - // Quote special characters - // ========================== -diff -uNr nagiosql32.orig/templates/admin/servicedependencies.tpl.htm nagiosql32/templates/admin/servicedependencies.tpl.htm ---- nagiosql32.orig/templates/admin/servicedependencies.tpl.htm 2013-01-10 09:46:11.799949000 +0100 -+++ nagiosql32/templates/admin/servicedependencies.tpl.htm 2013-01-10 09:46:14.000000000 +0100 -@@ -3,7 +3,7 @@ - - - -- -+ - - - diff --git a/debian/patches/30_service_pack_3_additional_fixes_only.patch b/debian/patches/30_service_pack_3_additional_fixes_only.patch deleted file mode 100644 index 0e24c76..0000000 --- a/debian/patches/30_service_pack_3_additional_fixes_only.patch +++ /dev/null @@ -1,1494 +0,0 @@ -diff -uNr nagiosql32.orig/admin/cgicfg.php nagiosql32/admin/cgicfg.php ---- nagiosql32.orig/admin/cgicfg.php 2012-03-07 10:38:34.457096000 +0100 -+++ nagiosql32/admin/cgicfg.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,19 +1,16 @@ - getConfigData($intConfigId,"method",$intMethod); - $myConfigClass->getConfigData($intConfigId,"nagiosbasedir",$strBaseDir); - $strConfigfile = str_replace("//","/",$strBaseDir."/cgi.cfg"); --$strLocalBackup = str_replace("//","/",$strBaseDir."/cgi.cfg_old_").date("YmdHis",mktime()); -+$strLocalBackup = str_replace("//","/",$strBaseDir."/cgi.cfg_old_").date("YmdHis",time()); - // - // Convert Windows to UNIX - // ======================= -diff -uNr nagiosql32.orig/admin/nagioscfg.php nagiosql32/admin/nagioscfg.php ---- nagiosql32.orig/admin/nagioscfg.php 2012-03-07 10:38:34.457096000 +0100 -+++ nagiosql32/admin/nagioscfg.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,19 +1,16 @@ - getConfigData($intConfigId,"method",$intMethod); - $myConfigClass->getConfigData($intConfigId,"nagiosbasedir",$strBaseDir); - $myConfigClass->getConfigData($intConfigId,"conffile",$strConfigfile); --$strLocalBackup = $strConfigfile."_old_".date("YmdHis",mktime()); -+$strLocalBackup = $strConfigfile."_old_".date("YmdHis",time()); - // - // Convert Windows to UNIX - // ======================= -diff -uNr nagiosql32.orig/admin/verify.php nagiosql32/admin/verify.php ---- nagiosql32.orig/admin/verify.php 2017-05-20 19:39:02.224000000 +0200 -+++ nagiosql32/admin/verify.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,19 +1,16 @@ - getDataArray($strSQL,$arrData,$intDataCount); -- $intError = 0; -+ $intError = 0; - if ($intDataCount != 0) { - foreach ($arrData AS $data) { - $intReturn = $myConfigClass->createConfigSingle("tbl_service",$data['id']); -@@ -126,7 +123,7 @@ - } - } - // Write servicetemplate configuration -- $intReturn = $myConfigClass->createConfig("tbl_servicetemplate"); -+ $intReturn = $myConfigClass->createConfig("tbl_servicetemplate"); - if ($intReturn == 0) { - $myVisClass->processMessage(translate("Write")." servicetemplates.cfg ...",$strInfo); - $myVisClass->processMessage("Servicetemplates: ".$myConfigClass->strInfoMessage,$strInfo); -@@ -342,7 +339,7 @@ - } - if (file_exists($strPidfile) && isset($arrExec[0])) { - if (file_exists($strCommandfile) && is_writable($strCommandfile)) { -- $strCommandString = "[".mktime()."] RESTART_PROGRAM;".mktime(); -+ $strCommandString = "[".time()."] RESTART_PROGRAM\n"; - $timeout = 3; - $old = ini_set('default_socket_timeout', $timeout); - $resCmdFile = fopen($strCommandfile,"w"); -@@ -354,9 +351,11 @@ - fclose($resCmdFile); - $myDataClass->writeLog(translate('Nagios daemon successfully restarted')); - $myVisClass->processMessage(translate('Restart command successfully send to Nagios'),$strInfoMessage); -+ - } else { - $myDataClass->writeLog(translate('Restart failed - Nagios command file not found or no rights to execute')); -- $myVisClass->processMessage(translate('Nagios command file not found or no rights to write!'),$strErrorMessage); -+ $myVisClass->processMessage(translate('Nagios command file not found or no rights to write!'),$strErrorMessage); -+ - } - } else { - -diff -uNr nagiosql32.orig/doc/CHANGELOG.txt nagiosql32/doc/CHANGELOG.txt ---- nagiosql32.orig/doc/CHANGELOG.txt 1970-01-01 01:00:00.000000000 +0100 -+++ nagiosql32/doc/CHANGELOG.txt 2017-02-09 15:55:19.000000000 +0100 -@@ -0,0 +1,6 @@ -+CHANGELOG 3.2.0 Service Pack 3 -+--------------- -+ -+- [OK] Updating files for compatibility with mysqli -+- [OK] Updating files for compatibility with PHP 7 -+ -diff -uNr nagiosql32.orig/doc/LICENSE.txt nagiosql32/doc/LICENSE.txt ---- nagiosql32.orig/doc/LICENSE.txt 1970-01-01 01:00:00.000000000 +0100 -+++ nagiosql32/doc/LICENSE.txt 2017-02-09 15:55:19.000000000 +0100 -@@ -0,0 +1,28 @@ -+NagiosQL Service Pack 3 License - based on BSD License -+ -+Copyright (c) 2016, Fabio Lucchiari -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+1. Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+2. Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+3. All advertising materials mentioning features or use of this software -+ must display the following acknowledgement: -+ This product includes software developed by Fabio Lucchiari - https://tecnologicasduvidas.blogspot.com.br -+ -+ -+THIS SOFTWARE IS PROVIDED BY THE NAGIOSQL TEAM AND THE COPYRIGHT HOLDER ''AS IS'' AND ANY -+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE NAGIOSQL TEAM AND THE COPYRIGHT HOLDER BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -diff -uNr nagiosql32.orig/functions/config_class.php nagiosql32/functions/config_class.php ---- nagiosql32.orig/functions/config_class.php 2017-05-20 19:39:02.224000000 +0200 -+++ nagiosql32/functions/config_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - arrSettings = $_SESSION['SETS']; -@@ -123,7 +120,7 @@ - if ($arrConfigId != 1) { - // Define variables - $strTimeFile = "unknown"; -- $intFileStamp = mktime(); -+ $intFileStamp = time(); - foreach($arrConfigId AS $intConfigId) { - // Get configuration file data - $this->getConfigData($intConfigId,"target",$strTarget); -@@ -226,7 +223,7 @@ - if ($arrConfigId != 1) { - // Define variables - $strTimeFile = "unknown"; -- $intFileStamp = mktime(); -+ $intFileStamp = time(); - foreach($arrConfigId AS $intConfigId) { - // Get configuration file data - $this->getConfigData($intConfigId,"target",$strTarget); -@@ -333,7 +330,7 @@ - if ($strMethod == 1) { - // Save configuration file - if (file_exists($strConfigDir."/".$strName) && is_writable($strBackupDir) && is_writable($strConfigDir)) { -- $strOldDate = date("YmdHis",mktime()); -+ $strOldDate = date("YmdHis",time()); - copy($strConfigDir."/".$strName,$strBackupDir."/".$strName."_old_".$strOldDate); - unlink($strConfigDir."/".$strName); - } else if (!is_writable($strBackupDir)) { -@@ -350,7 +347,7 @@ - // Save configuration file - $intFileStamp = ftp_mdtm($this->resConnectId, $strConfigDir."/".$strName); - if ($intFileStamp > -1) { -- $strOldDate = date("YmdHis",mktime()); -+ $strOldDate = date("YmdHis",time()); - $intErrorReporting = error_reporting(); - error_reporting(0); - $intReturn = ftp_rename($this->resConnectId,$strConfigDir."/".$strName,$strBackupDir."/".$strName."_old_".$strOldDate); -@@ -374,7 +371,7 @@ - $intFileStamp = $arrInfo['mtime']; - if ($intFileStamp > -1) { - -- $strOldDate = date("YmdHis",mktime()); -+ $strOldDate = date("YmdHis",time()); - $intReturn = ssh2_sftp_rename($this->resSFTP,$strConfigDir."/".$strName,$strBackupDir."/".$strName."_old_".$strOldDate); - if (!$intReturn) { - $this->processClassMessage(translate('Cannot backup the old configuration file because the permissions are wrong (remote SFTP)!')."::",$this->strErrorMessage); -@@ -583,7 +580,7 @@ - $configtp = new HTML_Template_IT($this->arrSettings['path']['base_path']."/templates/files/"); - $configtp->loadTemplatefile($setTemplate, true, true); - $configtp->setOptions($arrTplOptions); -- $configtp->setVariable("CREATE_DATE",date("Y-m-d H:i:s",mktime())); -+ $configtp->setVariable("CREATE_DATE",date("Y-m-d H:i:s",time())); - $this->getConfigData($intConfigID,"version",$this->intNagVersion); - $configtp->setVariable("NAGIOS_QL_VERSION",$this->arrSettings['db']['version']); - if ($this->intNagVersion == 3) $strVersion = "Nagios 3.x config file"; -@@ -812,7 +809,7 @@ - $configtp = new HTML_Template_IT($this->arrSettings['path']['base_path']."/templates/files/"); - $configtp->loadTemplatefile($setTemplate, true, true); - $configtp->setOptions($arrTplOptions); -- $configtp->setVariable("CREATE_DATE",date("Y-m-d H:i:s",mktime())); -+ $configtp->setVariable("CREATE_DATE",date("Y-m-d H:i:s",time())); - if ($this->intNagVersion == 0) { - $this->getConfigData($intConfigID,"version",$this->intNagVersion); - } -diff -uNr nagiosql32.orig/functions/content_class.php nagiosql32/functions/content_class.php ---- nagiosql32.orig/functions/content_class.php 2012-02-27 13:01:17.338352000 +0100 -+++ nagiosql32/functions/content_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - arrSettings = $_SESSION['SETS']; - if (isset($_SESSION['domain'])) $this->intDomainId = $_SESSION['domain']; -@@ -456,7 +453,7 @@ - if ($arrData['dependent_service_description'] == 2) { - $strField .= "*"; - } else if ($arrData['dependent_service_description'] != 0) { -- $strSQLService = "SELECT `strSlave` FROM `tbl_lnkServicedependencyToService_DS` WHERE `idMaster`=".$arrData['id']." ORDER BY `strSlave`"; -+ $strSQLService = "SELECT `strSlave` FROM `tbl_lnkServicedependencyToService_DS` WHERE `idMaster`=".$arrData['id']." ORDER BY `strSlave`"; - $booReturn = $this->myDBClass->getDataArray($strSQLService,$arrDataService,$intDCService); - if ($intDCService != 0) { - foreach($arrDataService AS $elem) { -@@ -475,6 +472,7 @@ - } - } - } -+ print_r($strSQLService); - } - // Serviceescalation table - if ($strTableName == "tbl_serviceescalation") { -diff -uNr nagiosql32.orig/functions/data_class.php nagiosql32/functions/data_class.php ---- nagiosql32.orig/functions/data_class.php 2012-03-05 07:55:49.966817000 +0100 -+++ nagiosql32/functions/data_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - arrSettings = $_SESSION['SETS']; -diff -uNr nagiosql32.orig/functions/mysql_class.php nagiosql32/functions/mysql_class.php ---- nagiosql32.orig/functions/mysql_class.php 2012-02-21 14:10:41.579203000 +0100 -+++ nagiosql32/functions/mysql_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - arrSettings = $_SESSION['SETS']; -@@ -104,18 +101,25 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function getFieldData($strSQL) { - // Send an SQL Statement to the server -- $resQuery = mysql_query($strSQL); -+ $resQuery = $this->strDBId->query($strSQL); - // Error processing -- if ($resQuery && (mysql_num_rows($resQuery) != 0) && (mysql_error() == "")) { -- // return the field value at postition 0/0 -- return mysql_result($resQuery,0,0); -- } else if (mysql_error() != "") { -- $this->strErrorMessage .= mysql_error()."::"; -+ if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == "")) { -+ // return the field value at postition 0/0 -+ return $this->mysqli_result($resQuery,0,0); -+ } else if (mysqli_error($this->strDBId) != "") { -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return(""); - } - return(""); - } -+ -+ function mysqli_result($res, $row, $field=0) { -+ $res->data_seek($row); -+ $datarow = $res->fetch_array(); -+ return $datarow[$field]; -+ -+ } - - /////////////////////////////////////////////////////////////////////////////////////////// - // Function: Get a single dataset -@@ -134,14 +138,14 @@ - function getSingleDataset($strSQL,&$arrDataset) { - $arrDataset = ""; - // Send an SQL Statement to the server -- $resQuery = mysql_query($strSQL); -+ $resQuery = $this->strDBId->query($strSQL); - // Error processing -- if ($resQuery && (mysql_num_rows($resQuery) != 0) && (mysql_error() == "")) { -+ if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == "")) { - // Fill the data to the array -- $arrDataset = mysql_fetch_array($resQuery,MYSQL_ASSOC); -+ $arrDataset = $resQuery->fetch_array(MYSQLI_ASSOC); - return true; -- } else if (mysql_error() != "") { -- $this->strErrorMessage .= mysql_error()."::"; -+ } else if (mysqli_error($this->strDBId) != "") { -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -@@ -167,21 +171,23 @@ - $arrDataset = ""; - $intDataCount = 0; - // Send an SQL Statement to the server -- $resQuery = mysql_query($strSQL); -+ $resQuery = $this->strDBId->query($strSQL); -+ - // Error processing -- if ($resQuery && (mysql_num_rows($resQuery) != 0) && (mysql_error() == "")) { -- $intDataCount = mysql_num_rows($resQuery); -+ if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == "")) { -+ $intDataCount = mysqli_num_rows($resQuery); -+ - $i = 0; -- // Fill array -- while ($arrDataTemp = mysql_fetch_array($resQuery, MYSQL_ASSOC)) { -+ // Fill array -+ while ($arrDataTemp = $resQuery->fetch_array(MYSQLI_ASSOC)) { - foreach ($arrDataTemp AS $key => $value) { - $arrDataset[$i][$key] = $value; - } - $i++; - } - return true; -- } else if (mysql_error() != "") { -- $this->strErrorMessage .= mysql_error()."::"; -+ } else if (mysqli_error($this->strDBId) != "") { -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -@@ -206,14 +212,14 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function insertData($strSQL) { - // Send an SQL Statement to the server -- $resQuery = mysql_query($strSQL); -+ $resQuery = $this->strDBId->query($strSQL); - // Error processing -- if (mysql_error() == "") { -- $this->intLastId = mysql_insert_id(); -- $this->intAffectedRows = mysql_affected_rows(); -+ if (mysqli_error($this->strDBId) == "") { -+ $this->intLastId = $this->strDBId->insert_id; -+ $this->intAffectedRows = $this->strDBId->affected_rows; - return true; - } else { -- $this->strErrorMessage .= mysql_error()."::"; -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -@@ -234,12 +240,12 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function countRows($strSQL) { - // Send an SQL Statement to the server -- $resQuery = mysql_query($strSQL); -+ $resQuery = $this->strDBId->query($strSQL); - // Error processing -- if ($resQuery && (mysql_error() == "")) { -- return mysql_num_rows($resQuery); -+ if ($resQuery && (mysqli_error($this->strDBId) == "")) { -+ return mysqli_num_rows($resQuery); - } else { -- $this->strErrorMessage .= mysql_error()."::"; -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return 0; - } -@@ -270,11 +276,11 @@ - $this->error = true; - return false; - } -- $this->strDBId = @mysql_connect($dbserver.":".$dbport,$dbuser,$dbpasswd); -+ $this->strDBId = @mysqli_connect($dbserver.":".$dbport,$dbuser,$dbpasswd); - // Session cannot be etablished - if(!$this->strDBId) { - $this->strErrorMessage .= "[".$this->arrSettings['db']['server']."] ".translate("Connection to the database server has failed by reason:")."::"; -- $this->strErrorMessage .= mysql_error()."::"; -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -@@ -299,17 +305,17 @@ - $this->error = true; - return false; - } -- $bolConnect = @mysql_select_db($database); -+ $bolConnect = $this->strDBId->select_db($database); - // Session cannot be etablished - if(!$bolConnect) { - $this->strErrorMessage .= "[".$this->arrSettings['db']['server']."] ".translate("Connection to the database server has failed by reason:")."::"; -- $this->strErrorMessage .= mysql_error()."::"; -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -- $resQuery = mysql_query("set names 'utf8'"); -- if (mysql_error() != "") { -- $this->strErrorMessage .= mysql_error()."::"; -+ $resQuery = $this->strDBId->query("set names 'utf8'"); -+ if (mysqli_error($this->strDBId) != "") { -+ $this->strErrorMessage .= mysqli_error($this->strDBId)."::"; - $this->error = true; - return false; - } -@@ -326,6 +332,7 @@ - function dbdisconnect() { - @mysql_close($this->strDBId); - return true; -- } -+ } -+ - } - ?> -\ Kein Zeilenumbruch am Dateiende. -diff -uNr nagiosql32.orig/functions/nag_class.php nagiosql32/functions/nag_class.php ---- nagiosql32.orig/functions/nag_class.php 2017-05-20 19:39:02.228000000 +0200 -+++ nagiosql32/functions/nag_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - arrSettings = $_SESSION['SETS']; - if (isset($_SESSION['domain'])) $this->intDomainId = $_SESSION['domain']; -@@ -229,7 +226,7 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function tfSecure($strKey) { - $strKey = stripslashes($strKey); -- $strKey = mysql_real_escape_string($strKey); -+ $strKey = $strKey; - return($strKey); - } - -@@ -960,14 +957,16 @@ - $strSQL = "SELECT `tbl_service`.`id` AS `key`, CONCAT(`tbl_service`.`config_name`, ' - ', `tbl_service`.`service_description`) AS `value`, `active` - FROM `tbl_service` WHERE $strDomainWhere1 AND `tbl_service`.`config_name` <> '' - AND `tbl_service`.`config_name` IS NOT NULL AND `tbl_service`.`service_description` <> '' AND `tbl_service`.`service_description` IS NOT NULL -- AND `access_group` IN ($strAccess) ORDER BY `value"; -+ AND `access_group` IN ($strAccess) ORDER BY `value`"; - } else { - // Common statement - $strSQL = "SELECT `id` AS `key`, `".$strTabField."` AS `value`, `config_id`, `active` FROM `".$strTable."` WHERE $strDomainWhere1 - AND `".$strTabField."` <> '' AND `".$strTabField."` IS NOT NULL AND `access_group` IN ($strAccess) ORDER BY `".$strTabField."`"; -+ - } -- // Process data -+ // Process data - $booReturn = $this->myDBClass->getDataArray($strSQL,$arrDataRaw,$intDataCount); -+ - if (($booReturn == false) && ($strSQL != "")) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - if ($strTable == 'tbl_group') { - $arrTemp = ""; -@@ -975,9 +974,9 @@ - $arrTemp['value'] = translate('Unrestricted access'); - $arrData[] = $arrTemp; - } -- if ($booReturn && ($intDataCount != 0)) { -+ if ($booReturn && ($intDataCount != 0)) { - foreach ($arrDataRaw AS $elem) { -- $arrData[] = $elem; -+ $arrData[] = $elem; - } - return(0); - } else { -@@ -1000,11 +999,12 @@ - $strSQL = "SELECT * FROM `".$strLinkTable."` WHERE `idSlave`=".$this->dataId; - } else { - $strSQL = "SELECT * FROM `".$strLinkTable."` WHERE `idMaster`=".$this->dataId; -- } -+ } - // Process data -- $booReturn = $this->myDBClass->getDataArray($strSQL,$arrSelectedRaw,$intDataCount); -+ $booReturn = $this->myDBClass->getDataArray($strSQL,$arrSelectedRaw,$intDataCount); - if ($booReturn == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - if ($booReturn && ($intDataCount != 0)) { -+ - foreach($arrSelectedRaw AS $elem) { - // Multi tables - if ($strLinkTable == 'tbl_lnkServicegroupToService') { -diff -uNr nagiosql32.orig/functions/prepend_adm.php nagiosql32/functions/prepend_adm.php ---- nagiosql32.orig/functions/prepend_adm.php 2017-05-20 19:39:02.232000000 +0200 -+++ nagiosql32/functions/prepend_adm.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,18 +1,16 @@ - error == true) { - $strErrorMessage .= translate('Error while connecting to database:')."::".$myDBClass->strErrorMessage; - $intError = 1; -+ - } - // - // Get additional configuration from the table tbl_settings - // ======================================================== - if ($intError == 0) { -- $strSQL = "SELECT `category`,`name`,`value` FROM `tbl_settings`"; -- $booReturn = $myDBClass->getDataArray($strSQL,$arrDataLines,$intDataCount); -+ $strSQL = "SELECT `category`,`name`,`value` FROM `tbl_settings`"; -+ $booReturn = $myDBClass->getDataArray($strSQL,$arrDataLines,$intDataCount); - if ($booReturn == false) { - $strErrorMessage .= translate('Error while selecting data from database:')."::".$myDBClass->strErrorMessage; -- $intError = 1; -+ $intError = 1; - } else if ($intDataCount != 0) { -- if (isset($_SESSION['SETS']['data']['locale']) && ($_SESSION['SETS']['data']['locale'] != "")) $strStoreLanguage = $_SESSION['SETS']['data']['locale']; -+ if (isset($_SESSION['SETS']['data']['locale']) && ($_SESSION['SETS']['data']['locale'] != "")) $strStoreLanguage = $_SESSION['SETS']['data']['locale']; - // Save additional configuration information - for ($i=0;$i<$intDataCount;$i++) { - // We use the path settings from file -@@ -264,7 +263,7 @@ - $SETS['data']['locale'] = $strUserLocale; - } - // Update last login time -- $strSQLUpdate = "UPDATE `tbl_user` SET `last_login`=NOW() WHERE `username`='".mysql_real_escape_string($chkInsName)."'"; -+ $strSQLUpdate = "UPDATE `tbl_user` SET `last_login`=NOW() WHERE `username`='".$chkInsName."'"; - $booReturn = $myDBClass->insertData($strSQLUpdate); - $myDataClass->writeLog(translate('Webserver login successfull')); - $_SESSION['strLoginMessage'] = ""; -@@ -273,11 +272,12 @@ - } - } - if (($_SESSION['logged_in'] == 0) && isset($chkInsName) && ($chkInsName != "") && ($intError == 0)) { -- $chkInsName = mysql_real_escape_string($chkInsName); -- $chkInsPasswd = mysql_real_escape_string($chkInsPasswd); -+ -+ $chkInsName = $chkInsName; -+ $chkInsPasswd = $chkInsPasswd; - $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".$chkInsName."' - AND `password`=MD5('".$chkInsPasswd."') AND `active`='1'"; -- $booReturn = $myDBClass->getDataArray($strSQL,$arrDataUser,$intDataCount); -+ $booReturn = $myDBClass->getDataArray($strSQL,$arrDataUser,$intDataCount); - if ($booReturn == false) { - $myVisClass->processMessage(translate('Error while selecting data from database:'),$strErrorMessage); - $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage); -@@ -298,8 +298,8 @@ - $_SESSION['SETS']['data']['locale'] = $strUserLocale; - $SETS['data']['locale'] = $strUserLocale; - } -- // Update last login time -- $strSQLUpdate = "UPDATE `tbl_user` SET `last_login`=NOW() WHERE `username`='".mysql_real_escape_string($chkInsName)."'"; -+ // Update last login time -+ $strSQLUpdate = "UPDATE `tbl_user` SET `last_login`=NOW() WHERE `username`='".$chkInsName."'"; - $booReturn = $myDBClass->insertData($strSQLUpdate); - $myDataClass->writeLog(translate('Login successfull')); - $_SESSION['strLoginMessage'] = ""; -@@ -322,7 +322,7 @@ - // Review and update login - // ======================= - if (($_SESSION['logged_in'] == 1) && ($intError == 0)) { -- $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".mysql_real_escape_string($_SESSION['username'])."'"; -+ $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".($_SESSION['username'])."'"; - $booReturn = $myDBClass->getDataArray($strSQL,$arrDataUser,$intDataCount); - if ($booReturn == false) { - $myVisClass->processMessage(translate('Error while selecting data from database:'),$strErrorMessage); -diff -uNr nagiosql32.orig/install/functions/initial_settings.php nagiosql32/install/functions/initial_settings.php ---- nagiosql32.orig/install/functions/initial_settings.php 2012-02-28 14:35:54.942895000 +0100 -+++ nagiosql32/install/functions/initial_settings.php 2017-02-09 15:55:19.000000000 +0100 -@@ -3,22 +3,22 @@ - ?> - ;/////////////////////////////////////////////////////////////////////////////// - ; --; NagiosQL -+; NagiosQL Service Pack 3 - ; - ;/////////////////////////////////////////////////////////////////////////////// - ; --; Project : NagiosQL --; Component: Initial configuration settings --; Website : http://www.nagiosql.org --; Date : May 27, 2011, 2:35 pm --; Version : 3.2.0 --; $LastChangedRevision: 1058 $ -+; (c) 2016 by Fabio Lucchiari -+; -+; Project : NagiosQL Service Pack 3 -+; Component : Configuration verification -+; Website : https://tecnologicasduvidas.blogspot.com.br -+; Date : $LastChangedDate: 2017-01-02 16:00:00 -0300$ - ; - ; DO NOT USE THIS FILE AS NAGIOSQL SETTINGS FILE! - ; - ;/////////////////////////////////////////////////////////////////////////////// - [db] --type = mysql -+type = mysqli - server = localhost - port = 3306 - database = db_nagiosql_v32 -diff -uNr nagiosql32.orig/install/functions/install_class.php nagiosql32/install/functions/install_class.php ---- nagiosql32.orig/install/functions/install_class.php 2012-02-27 08:09:07.338196000 +0100 -+++ nagiosql32/install/functions/install_class.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,21 +1,18 @@ - host = $_SESSION['install']['dbserver']; -+ $this->port = $_SESSION['install']['dbport']; -+ $this->user = $_SESSION['install']['dbuser']; -+ $this->pass = $_SESSION['install']['dbpass']; -+ } else { -+ $this->host = $_SESSION['install']['dbserver']; -+ $this->port = $_SESSION['install']['dbport']; -+ $this->user = $_SESSION['install']['admuser']; -+ $this->pass = $_SESSION['install']['admpass']; -+ } -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - $intStatus = 0; - // Connect to database server -- if ($intMode == 1 ) { -- $resDBSLink = @mysql_connect($_SESSION['install']['dbserver'].":".$_SESSION['install']['dbport'],$_SESSION['install']['dbuser'],$_SESSION['install']['dbpass']); -- } else { -- $resDBSLink = @mysql_connect($_SESSION['install']['dbserver'].":".$_SESSION['install']['dbport'],$_SESSION['install']['admuser'],$_SESSION['install']['admpass']); -- } -- if (!$resDBSLink) { -- $strErrorMessage .= translate('Error while connecting to database:')."
".mysql_error()."
\n"; -- $intStatus = 1; -- } -+ $this->mysqli = new mysqli($this->host.":".$this->port, $this->user, $this->pass); -+ if ($this->mysqli->connect_error) { -+ $strErrorMessage .= translate('Error while connecting to database:')."
".$this->mysqli->connect_errno."
\n"; -+ $intStatus = 1; -+ } - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - // Connect to database server - if ($intMode == 1 ) { -@@ -130,14 +139,14 @@ - // Return values: Status variable (0=ok,1=failed) - // - /////////////////////////////////////////////////////////////////////////////////////////// -- function openDatabase(&$strStatusMessage,&$strErrorMessage,$intMode=0) { -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $intStatus = 0; -- // Connect to database -- $resDBId = @mysql_select_db($_SESSION['install']['dbname']); -+ function openDatabase(&$strStatusMessage,&$strErrorMessage,$intMode=0) { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $intStatus = 0; -+ // Connect to database -+ $resDBId = $this->mysqli->select_db($_SESSION['install']['dbname']); - if (!$resDBId) { -- $strErrorMessage .= translate('Error while connecting to database:')."
".mysql_error()."
\n"; -- $intStatus = 1; -+ $strErrorMessage .= translate('Error while connecting to database:')."
".mysqli_error($this->mysqli)."
\n"; -+ $intStatus = 1; - } - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - // Connect to database -@@ -152,16 +161,18 @@ - } - } else { - $strErrorMessage .= translate("Database type not defined!")." (".$_SESSION['install']['dbtype'].")
\n"; -- $strStatusMessage = "".translate("failed").""; -+ $strStatusMessage = "".translate("failed").""; - return(1); - } - if ($intStatus == 0) { - $strStatusMessage = "".translate("passed").""; -- return(0); -+ return(0); - } else { -- $strStatusMessage = "".translate("failed").""; -- return(1); -+ $strStatusMessage = "".translate("failed").""; -+ return(1); - } -+ -+ - } - /////////////////////////////////////////////////////////////////////////////////////////// - // Function: Check database version -@@ -176,10 +187,13 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function checkDBVersion(&$strStatusMessage,&$strErrorMessage,&$setVersion) { - // Read version string from DB -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $setVersion = @mysql_result(@mysql_query("SHOW VARIABLES LIKE 'version'"),0,1); -- $strDBError = mysql_error(); -- $intVersion = version_compare($setVersion,"4.1.0"); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $q = $this->mysqli->query("SHOW VARIABLES LIKE 'version'"); -+ while ($row = $q->fetch_array()) { -+ $setVersion = $row['Value']; -+ } -+ $strDBError = mysqli_error($this->mysqli); -+ $intVersion = version_compare($setVersion,"4.1.0"); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - $setVersion = @pg_fetch_result(@pg_query("SHOW VARIABLES LIKE 'version'"),0,1); - $strDBError = pg_last_error(); -@@ -193,17 +207,17 @@ - // Is the currrent version supported? - if ($intVersion >=0) { - $strStatusMessage = "".translate("supported").""; -- return(0); -+ return(0); - } else { - $strStatusMessage = "".translate("not supported").""; -- return(1); -+ return(1); - } - } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = "".translate("failed").""; - $setVersion = "unknown"; - return(1); -- } -+ } - } - /////////////////////////////////////////////////////////////////////////////////////////// - // Function: Check NagiosQL version -@@ -219,7 +233,7 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function checkQLVersion(&$strStatusMessage,&$strErrorMessage,&$arrUpdate,&$setVersion) { - // Read version string from DB -- if ($_SESSION['install']['dbtype'] == "mysql") { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - $setVersion = @mysql_result(@mysql_query("SELECT `value` FROM `tbl_settings` WHERE `category`='db' AND `name`='version'"),0,0); - $strDBError = mysql_error(); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { -@@ -293,9 +307,9 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function dropDB(&$strStatusMessage,&$strErrorMessage) { - // Drop database -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $booReturn = @mysql_query("DROP DATABASE `".$_SESSION['install']['dbname']."`"); -- $strDBError = mysql_error(); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $booReturn = $this->mysqli->query("DROP DATABASE `".$_SESSION['install']['dbname']."`"); -+ $strDBError = mysqli_error($this->mysqli); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - $setVersion = @pg_query("DROP DATABASE `".$_SESSION['install']['dbname']."`"); - $strDBError = pg_last_error(); -@@ -325,9 +339,9 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function createDB(&$strStatusMessage,&$strErrorMessage) { - // Create database -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $booReturn = @mysql_query("CREATE DATABASE `".$_SESSION['install']['dbname']."` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"); -- $strDBError = mysql_error(); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $booReturn = $this->mysqli->query("CREATE DATABASE `".$_SESSION['install']['dbname']."` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"); -+ $strDBError = mysqli_error($this->mysqli); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - $setVersion = @pg_query("CREATE DATABASE `".$_SESSION['install']['dbname']."` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"); - $strDBError = pg_last_error(); -@@ -357,31 +371,31 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function grantDBUser(&$strStatusMessage,&$strErrorMessage) { - // Grant user -- if ($_SESSION['install']['dbtype'] == "mysql") { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - // does the user exist? - $intUserError = 0; -- $resQuery = @mysql_query("FLUSH PRIVILEGES"); -- $resQuery1 = @mysql_query("SELECT * FROM `mysql`.`user` WHERE `Host`='".$_SESSION['install']['localsrv']."' AND `User`='".$_SESSION['install']['dbuser']."'"); -- if ($resQuery1 && (mysql_num_rows($resQuery1) == 0)) { -- $resQuery2 = @mysql_query("CREATE USER '".$_SESSION['install']['dbuser']."'@'".$_SESSION['install']['localsrv']."' IDENTIFIED BY '".$_SESSION['install']['dbpass']."'"); -+ $resQuery = $this->mysqli->query("FLUSH PRIVILEGES"); -+ $resQuery1 = $this->mysqli->query("SELECT * FROM `mysql`.`user` WHERE `Host`='".$_SESSION['install']['localsrv']."' AND `User`='".$_SESSION['install']['dbuser']."'"); -+ if ($resQuery1 && (mysqli_num_rows($resQuery1) == 0)) { -+ $resQuery2 = $this->mysqli->query("CREATE USER '".$_SESSION['install']['dbuser']."'@'".$_SESSION['install']['localsrv']."' IDENTIFIED BY '".$_SESSION['install']['dbpass']."'"); - if (!$resQuery2) { - $intUserError = 1; -- $strDBError = mysql_error(); -+ $strDBError = mysqli_error($this->mysqli); - } -- } else if (mysql_error() == ""){ -+ } else if (mysqli_error($this->mysqli) == ""){ - $intUserError = 2; - } else { - $intUserError = 1; -- $strDBError = mysql_error(); -+ $strDBError = mysqli_error($this->mysqli); - } - if ($intUserError != 1) { -- $resQuery = @mysql_query("FLUSH PRIVILEGES"); -- $resQuery = @mysql_query("GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES ON `".$_SESSION['install']['dbname']."`.* TO '".$_SESSION['install']['dbuser']."'@'".$_SESSION['install']['localsrv']."'"); -+ $resQuery = $this->mysqli->query("FLUSH PRIVILEGES"); -+ $resQuery = $this->mysqli->query("GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES ON `".$_SESSION['install']['dbname']."`.* TO '".$_SESSION['install']['dbuser']."'@'".$_SESSION['install']['localsrv']."'"); - if (!$resQuery) { - $intUserError = 1; -- $strDBError = mysql_error(); -+ $strDBError = mysqli_error($this->mysqli); - } -- $resQuery = @mysql_query("FLUSH PRIVILEGES"); -+ $resQuery = $this->mysqli->query("FLUSH PRIVILEGES"); - } - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - // does the user exist? -@@ -450,7 +464,7 @@ - $strSqlCommand = ""; - $intSQLError = 0; - $intLineCount = 0; -- if ($_SESSION['install']['dbtype'] == "mysql") $booReturn = @mysql_query("SET NAMES `utf8`"); -+ if ($_SESSION['install']['dbtype'] == "mysqli") $booReturn = $this->mysqli->query("SET NAMES `utf8`"); - if ($_SESSION['install']['dbtype'] == "pgsql") $booReturn = @pg_query("SET NAMES `utf8`"); - while (!feof($filSqlNew)) { - $strLine = fgets($filSqlNew); -@@ -461,11 +475,11 @@ - if (substr($strLine,0,2) == "--") continue; // skip comment lines - $strSqlCommand .= $strLine; - if (substr($strSqlCommand,-1) == ";") { -- if ($_SESSION['install']['dbtype'] == "mysql") $booReturn = @mysql_query($strSqlCommand); -+ if ($_SESSION['install']['dbtype'] == "mysqli") $booReturn = $this->mysqli->query($strSqlCommand); - if ($_SESSION['install']['dbtype'] == "pgsql") $booReturn = @pg_query($strSqlCommand); - if (!$booReturn) { - $intSQLError = 1; -- if ($_SESSION['install']['dbtype'] == "mysql") $strErrorMessage .= mysql_error()."
\n"; -+ if ($_SESSION['install']['dbtype'] == "mysqli") $strErrorMessage .= mysqli_error($this->mysqli)."
\n"; - if ($_SESSION['install']['dbtype'] == "pgsql") $strErrorMessage .= pg_last_error()."
\n"; - $intError = 1; - } -@@ -514,14 +528,18 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function createNQLAdmin(&$strStatusMessage,&$strErrorMessage) { - // Create admin user -- $strSQL = "SELECT `id` FROM `tbl_language` WHERE `locale`='".$_SESSION['install']['locale']."'"; -- $intLang = @mysql_result(@mysql_query($strSQL),0,0)+0; -+ $strSQL = "SELECT `id` FROM `tbl_language` WHERE `locale`='".$_SESSION['install']['locale']."'"; -+ $q = $this->mysqli->query($strSQL); -+ while ($row = $q->fetch_array()) { -+ $intLang = $row['id']; -+ } -+ //$intLang = @mysql_result(@mysql_query($strSQL),0,0)+0; - if ($intLang == 0) $intLang = 1; - $strSQL = "INSERT INTO `tbl_user` (`id`, `username`, `alias`, `password`, `admin_enable`, `wsauth`, `active`, `nodelete`, `language`, `domain`, `last_login`, `last_modified`) - VALUES (1, '".$_SESSION['install']['qluser']."', 'Administrator', md5('".$_SESSION['install']['qlpass']."'), '1', '0', '1', '1', '".$intLang."', '1', '', NOW());"; -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $booReturn = @mysql_query($strSQL); -- $strDBError = mysql_error(); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $booReturn = $this->mysqli->query($strSQL); -+ $strDBError = mysqli_error($this->mysqli); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { - $setVersion = @pg_query($strSQL); - $strDBError = pg_last_error(); -@@ -562,10 +580,10 @@ - foreach ($arrInitial AS $elem) { - $strSQL1 = "SELECT `value` FROM `tbl_settings` WHERE `category`='".$elem['category']."' AND `name`='".$elem['name']."'"; - $strSQL2 = "INSERT INTO `tbl_settings` (`category`, `name`, `value`) VALUES ('".$elem['category']."', '".$elem['name']."', '".$elem['value']."')"; -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $resQuery1 = @mysql_query($strSQL1); -- if ($resQuery1 && (mysql_num_rows($resQuery1) == 0)) { -- $resQuery2 = @mysql_query($strSQL2); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $resQuery1 = $this->mysqli->query($strSQL1); -+ if ($resQuery1 && (mysqli_num_rows($resQuery1) == 0)) { -+ $resQuery2 = $this->mysqli->query($strSQL2); - if (!$resQuery2) { - $strStatusMessage = "".translate("failed").""; - $strErrorMessage .= translate("Inserting initial data to settings database has failed:")."
".mysql_error()."
\n"; -@@ -606,9 +624,9 @@ - $arrSettings[] = array('category'=>'data','name'=>'locale','value'=>$_SESSION['install']['locale']); - foreach ($arrSettings AS $elem) { - $strSQL = "UPDATE `tbl_settings` SET `value`='".$elem['value']."' WHERE `category` = '".$elem['category']."' AND `name` = '".$elem['name']."'"; -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $resQuery = @mysql_query($strSQL); -- if (mysql_error() != '') { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $resQuery = $this->mysqli->query($strSQL); -+ if (mysqli_error($this->mysqli) != '') { - $strStatusMessage = "".translate("failed").""; - $strErrorMessage .= translate("Inserting initial data to settings database has failed:")." ".mysql_error()."
\n"; - return(1); -@@ -706,11 +724,11 @@ - `conffile`='".$strNagiosPath."nagios.cfg', - `last_modified`=NOW() - WHERE `target`='localhost'"; -- if ($_SESSION['install']['dbtype'] == "mysql") { -- $resQuery1 = @mysql_query($strSQL); -+ if ($_SESSION['install']['dbtype'] == "mysqli") { -+ $resQuery1 = $this->mysqli->query($strSQL); - if (!$resQuery1) { - $strStatusMessage = "".translate("failed").""; -- $strErrorMessage .= translate("Inserting path data to database has failed:")." ".mysql_error()."
\n"; -+ $strErrorMessage .= translate("Inserting path data to database has failed:")." ".mysqli_error($this->mysqli)."
\n"; - return(1); - } - } else if ($_SESSION['install']['dbtype'] == "pgsql") { -@@ -758,7 +776,7 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function convQLDB(&$strStatusMessage,&$strErrorMessage) { - // Read version string from DB -- if ($_SESSION['install']['dbtype'] == "mysql") { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - $resQuery = @mysql_query("ALTER DATABASE `".$_SESSION['install']['dbname']."` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci"); - $strDBError = mysql_error(); - } else if ($_SESSION['install']['dbtype'] == "pgsql") { -@@ -790,7 +808,7 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function convQLDBTables(&$strStatusMessage,&$strErrorMessage) { - // Read version string from DB -- if ($_SESSION['install']['dbtype'] == "mysql") { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - $resQuery = @mysql_query("SHOW TABLES FROM `".$_SESSION['install']['dbname']); - $strDBError = mysql_error(); - if ($resQuery && ($strDBError == "")) { -@@ -836,7 +854,7 @@ - /////////////////////////////////////////////////////////////////////////////////////////// - function convQLDBFields(&$strStatusMessage,&$strErrorMessage) { - // Read version string from DB -- if ($_SESSION['install']['dbtype'] == "mysql") { -+ if ($_SESSION['install']['dbtype'] == "mysqli") { - $resQuery = @mysql_query("SHOW TABLES FROM `".$_SESSION['install']['dbname']); - $strDBError = mysql_error(); - if ($resQuery && ($strDBError == "")) { -diff -uNr nagiosql32.orig/install/functions/prepend_install.php nagiosql32/install/functions/prepend_install.php ---- nagiosql32.orig/install/functions/prepend_install.php 2012-02-21 14:10:41.579203000 +0100 -+++ nagiosql32/install/functions/prepend_install.php 2017-02-09 15:55:19.000000000 +0100 -@@ -1,18 +1,16 @@ - 'pgsql' - //); - $arrSupportedDBs = array ( -- 'MySQL' => 'mysql' -+ 'MySQLi' => 'mysqli' - ); - - $arrIniCheck = array ( -diff -uNr nagiosql32.orig/libraries/pear/HTML/Template/IT.php nagiosql32/libraries/pear/HTML/Template/IT.php ---- nagiosql32.orig/libraries/pear/HTML/Template/IT.php 2010-10-31 18:44:44.400158000 +0100 -+++ nagiosql32/libraries/pear/HTML/Template/IT.php 2017-02-09 15:55:19.000000000 +0100 -@@ -407,7 +407,8 @@ - * @see setRoot() - * @access public - */ -- function HTML_Template_IT($root = '', $options = null) -+ function __construct($root = '', $options = null) -+ //function HTML_Template_IT($root = '', $options = null) - { - if (!is_null($options)) { - $this->setOptions($options); -@@ -473,7 +474,7 @@ - if (is_array($options)) { - foreach ($options as $option => $value) { - $error = $this->setOption($option, $value); -- if (PEAR::isError($error)) { -+ if ((new PEAR)->isError($error)) { - return $error; - } - } -@@ -560,10 +561,11 @@ - static $regs, $values; - - if (!isset($this->blocklist[$block])) { -- return PEAR::raiseError( -+ return (new PEAR)->raiseError( - $this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'", - IT_BLOCK_NOT_FOUND - ); -+ - } - - if ($block == '__global__') { -@@ -1022,8 +1024,9 @@ - if (isset($this->blocklist[$blockname])) { - $msg = $this->errorMessage(IT_BLOCK_DUPLICATE, $blockname); - -- $this->err[] = PEAR::raiseError($msg, IT_BLOCK_DUPLICATE); -- -+ //$this->err[] = PEAR::raiseError($msg, IT_BLOCK_DUPLICATE); -+ -+ $this->err[] = (new PEAR)->raiseError($msg, IT_BLOCK_DUPLICATE); - $this->flagBlocktrouble = true; - } - -@@ -1088,10 +1091,10 @@ - $content = fread($fh, $fsize); - fclose($fh); - -- return preg_replace( -- "##ime", -- "\$this->getFile('\\1')", -- $content -+ return preg_replace_callback( -+ "##im", -+ array($this, 'getFile'), -+ $content - ); - } // end func getFile - -@@ -1174,8 +1177,8 @@ - IT_UNKNOWN_OPTION => 'Unknown option' - ); - } -- -- if (PEAR::isError($value)) { -+ -+ if ((new PEAR)->isError($value)) { - $value = $value->getCode(); - } - -diff -uNr nagiosql32.orig/libraries/pear/PEAR.php nagiosql32/libraries/pear/PEAR.php ---- nagiosql32.orig/libraries/pear/PEAR.php 2010-10-31 18:44:44.400158000 +0100 -+++ nagiosql32/libraries/pear/PEAR.php 2017-02-09 15:55:19.000000000 +0100 -@@ -152,8 +152,7 @@ - * @access public - * @return void - */ -- function PEAR($error_class = null) -- { -+ function __construct($error_class = null) { - $classname = strtolower(get_class($this)); - if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; -@@ -863,7 +862,7 @@ - * @access public - * - */ -- function PEAR_Error($message = 'unknown error', $code = null, -+ function __construct($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - if ($mode === null) { -diff -uNr nagiosql32.orig/README.md nagiosql32/README.md ---- nagiosql32.orig/README.md 1970-01-01 01:00:00.000000000 +0100 -+++ nagiosql32/README.md 2017-02-09 15:55:19.000000000 +0100 -@@ -0,0 +1,6 @@ -+# nagiosql service pack 3 -+ -+Created by Fabio Lucchiari -+ -+Updating files from nagiosql for compatibility with Nagios Core 4x, mysqli and PHP 7 -+ diff --git a/debian/patches/31_service_pack_3_additional_fixes_only_mysqli.patch b/debian/patches/31_service_pack_3_additional_fixes_only_mysqli.patch deleted file mode 100644 index bce349a..0000000 --- a/debian/patches/31_service_pack_3_additional_fixes_only_mysqli.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -uNr nagiosql32/functions/data_class.php nsql/functions/data_class.php ---- nagiosql32/functions/data_class.php 2017-05-21 04:16:26.144000000 +0200 -+++ nsql/functions/data_class.php 2017-01-06 14:55:10.000000000 +0100 -@@ -110,7 +110,7 @@ - $strSQL = "DELETE FROM `".$strTableName."` WHERE `id` = $intDataId $strNoDelete"; - $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { -- $this->processClassMessage(translate('Delete failed because a database error:')."::".mysql_error()."::",$this->strInfoMessage); -+ $this->processClassMessage(translate('Delete failed because a database error:')."::".mysqli_error()."::",$this->strInfoMessage); - return(1); - } else if ($this->myDBClass->intAffectedRows == 0) { - $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist or it is protected from delete.')."::",$this->strErrorMessage); -@@ -134,7 +134,7 @@ - $strSQL = "DELETE FROM `".$strTableName."` WHERE `id` = ".$elem['id']; - $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { -- $this->processClassMessage(translate('Delete failed because a database error:')."::".mysql_error()."::",$this->strInfoMessage); -+ $this->processClassMessage(translate('Delete failed because a database error:')."::".mysqli_error()."::",$this->strInfoMessage); - return(1); - } else { - $intDeleteCount = $intDeleteCount + $this->myDBClass->intAffectedRows; -diff -uNr nagiosql32/functions/import_class.php nsql/functions/import_class.php ---- nagiosql32/functions/import_class.php 2017-05-21 04:16:11.976000000 +0200 -+++ nsql/functions/import_class.php 2017-01-04 13:11:32.000000000 +0100 -@@ -632,8 +632,8 @@ - if ($strKeyField == "") {$strKey = $strConfigName;} else {$strKey = $strKeyField;} - if ($booResult != true) { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; -- if ($strKeyField != "") $this->strErrorMessage .= translate('Entry')." ".$strKey." -> ".$arrImportData[$strKeyField]['value']." ".translate('inside')." ".$strTable." ".translate('could not be inserted:')." ".mysql_error()."::"; -- if ($strKeyField == "") $this->strErrorMessage .= translate('Entry')." ".$strTemp1." -> ".$strTemp2.translate('inside')." ".$strTable." ".$strTable." ".translate('could not be inserted:')." ".mysql_error()."::"; -+ if ($strKeyField != "") $this->strErrorMessage .= translate('Entry')." ".$strKey." -> ".$arrImportData[$strKeyField]['value']." ".translate('inside')." ".$strTable." ".translate('could not be inserted:')." ".mysqli_error()."::"; -+ if ($strKeyField == "") $this->strErrorMessage .= translate('Entry')." ".$strTemp1." -> ".$strTemp2.translate('inside')." ".$strTable." ".$strTable." ".translate('could not be inserted:')." ".mysqli_error()."::"; - return(1); - } else { - if ($strKeyField != "") $this->strInfoMessage .= translate('Entry')." ".$strKey." -> ".$arrImportData[$strKeyField]['value']." ".translate('inside')." ".$strTable." ".translate('successfully inserted')."::"; -@@ -1236,7 +1236,7 @@ - // Update data in master table - $arrCommand[0] = $intSlaveId; - $strValue = implode("!",$arrCommand); -- $strSQL = "UPDATE `".$strDataTable."` SET `".$arrRelData['fieldName']."` = '".mysql_real_escape_string($strValue)."' WHERE `id` = ".$intDataId; -+ $strSQL = "UPDATE `".$strDataTable."` SET `".$arrRelData['fieldName']."` = '".mysqli_real_escape_string($strValue)."' WHERE `id` = ".$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } -diff -uNr nagiosql32/functions/mysql_class.php nsql/functions/mysql_class.php ---- nagiosql32/functions/mysql_class.php 2017-05-21 04:16:26.144000000 +0200 -+++ nsql/functions/mysql_class.php 2017-01-06 14:55:18.000000000 +0100 -@@ -330,7 +330,7 @@ - // - /////////////////////////////////////////////////////////////////////////////////////////// - function dbdisconnect() { -- @mysql_close($this->strDBId); -+ @mysqli_close($this->strDBId); - return true; - } - -diff -uNr nagiosql32/functions/prepend_content.php nsql/functions/prepend_content.php ---- nagiosql32/functions/prepend_content.php 2017-05-21 04:16:11.980000000 +0200 -+++ nsql/functions/prepend_content.php 2017-01-06 15:15:59.000000000 +0100 -@@ -321,7 +321,7 @@ - if ($intSuccess != 0) $myVisClass->processMessage(translate('Configuration files successfully written!'),$strInfoMessage); - if ($intError != 0) $myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, not found or you do not have write permission!'),$strErrorMessage); - } else if ($preTableName == 'tbl_service') { -- $strSQL = "SELECT `id`, `$preKeyField` FROM `$preTableName` WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1' GROUP BY `$preKeyField`"; -+ $strSQL = "SELECT `id`, `$preKeyField` FROM `$preTableName` WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1' GROUP BY `$preKeyField`, `id`"; - $myDBClass->getDataArray($strSQL,$arrData,$intDataCount); - if ($booReturn == false) $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage); - if ($booReturn && ($intDataCount != 0)) { diff --git a/debian/patches/series b/debian/patches/series index 62f73b6..f2c28ac 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,6 +1,2 @@ -10_service_pack_1_additional_fixes_only.patch -20_service_pack_2_additional_fixes_only.patch -30_service_pack_3_additional_fixes_only.patch -31_service_pack_3_additional_fixes_only_mysqli.patch 40_settings_php.patch 50_nagios4_debian_pathes.patch