diff --git a/Changes b/Changes index 8b2edff14..62c105ef1 100755 --- a/Changes +++ b/Changes @@ -1,4 +1,30 @@ Revision history for ocsreports +2.10.0 + * Add PHP8 compatibility + * Add layout feature + * Add archive/restore actions to GUI LOGS + * Add CAS connection feature + * Add custom interval configuration to Last Contact in dashboard + * Add plugin deployment for unix systems + * Add configuration to exclude archive machines from the interface + * Improve archive/restore feature + * Improve LDAP connection feature + * Improve Software category regex display + * Update password encryption + * Fix subnets loading taking to much time on login + * Fix activate package display for every language + * Fix archive/restore action + * Fix multisearch query if IS NULL operator + * Fix software category deletion + * Fix SNMP read mib files + * Fix save search group for LDAP and CAS users + * Fix rights on actions column + * Fix CVE 2021-46355 + * Fix IpDiscover export + * Fix IpDiscover bugs + * Fix blank page after create networks type + * Remove overriding of profile rights on extensions pages + 2.9.2 * Add archive button on computer details page * Add local import diff --git a/ajax/calendarfield.php b/ajax/calendarfield.php index 72659e88f..bb6bcf9d2 100644 --- a/ajax/calendarfield.php +++ b/ajax/calendarfield.php @@ -1,4 +1,5 @@ + $fieldId = htmlspecialchars($fieldId, ENT_QUOTES, 'UTF-8'); + + return '
'.calendars($fieldId, $_SESSION['OCS']['DATE_FORMAT_LANG']).' -
'; - - return $html; + '; } -?> \ No newline at end of file diff --git a/backend/AUTH/auth.php b/backend/AUTH/auth.php index 6c9a2516f..79b9b76cf 100755 --- a/backend/AUTH/auth.php +++ b/backend/AUTH/auth.php @@ -38,6 +38,7 @@ // You don't have to change these variables anymore, see var.php $affich_method = get_affiche_methode(); $list_methode = get_list_methode(); +$limitAttempt = false; if ($affich_method == 'HTML' && isset($protectedPost['Valid_CNX']) && trim($protectedPost['LOGIN']) != "") { $login = $protectedPost['LOGIN']; @@ -85,7 +86,7 @@ if (isset($login) && isset($mdp)) { $i = 0; - while ($list_methode[$i]) { + while (array_key_exists($i, $list_methode) && $list_methode[$i]) { require_once('methode/' . $list_methode[$i]); if ($login_successful == "OK") break; @@ -94,7 +95,7 @@ } // login ok? -if ($login_successful == "OK" && isset($login_successful) && !$limitAttempt) { +if (isset($login_successful) && $login_successful == "OK" && !$limitAttempt) { $_SESSION['OCS']["loggeduser"] = $login; $_SESSION['OCS']['cnx_origine'] = $cnx_origine; $_SESSION['OCS']['user_group'] = $user_group; @@ -166,7 +167,7 @@ } } else { if ($auth['ivalue']['SECURITY_AUTHENTICATION_BLOCK_IP'] == 1){ - if ($login != ""){ + if (!empty($login)){ $sql = "INSERT INTO auth_attempt (`DATETIMEATTEMPT`,`LOGIN`,`IP`,`SUCCESS`) VALUES ('%s','%s','%s','%s')"; $datetime = new DateTime(); @@ -179,6 +180,9 @@ if ($affich_method == 'HTML') { require_once (HEADER_HTML); if (isset($protectedPost['Valid_CNX'])) { + if (empty($_SESSION['OCS']["loggeduser"])) { + $login_successful = "No user provided"; + } msg_error($login_successful); flush(); //you can't send a new login/passwd before 2 seconds @@ -204,11 +208,11 @@
- ' placeholder="g(243); ?>"> + ' placeholder="g(243); ?>">
- ' placeholder="g(217); ?>"> + ' placeholder="g(217); ?>">
diff --git a/backend/AUTH/methode/ldap.php b/backend/AUTH/methode/ldap.php index ab2fdbe58..eaa90b5fd 100755 --- a/backend/AUTH/methode/ldap.php +++ b/backend/AUTH/methode/ldap.php @@ -107,11 +107,11 @@ function search_on_loginnt($login) { } // save user fields in session - $_SESSION['OCS']['details']['givenname'] = $info[0]['givenname'][0]; - $_SESSION['OCS']['details']['sn'] = $info[0]['sn'][0]; - $_SESSION['OCS']['details']['cn'] = $info[0]['cn'][0]; - $_SESSION['OCS']['details']['mail'] = $info[0]['mail'][0]; - $_SESSION['OCS']['details']['title'] = $info[0]['title'][0]; + $_SESSION['OCS']['details']['givenname'] = $info[0]['givenname'][0] ?? ''; + $_SESSION['OCS']['details']['sn'] = $info[0]['sn'][0] ?? ''; + $_SESSION['OCS']['details']['cn'] = $info[0]['cn'][0] ?? ''; + $_SESSION['OCS']['details']['mail'] = $info[0]['mail'][0] ?? ''; + $_SESSION['OCS']['details']['title'] = $info[0]['title'][0] ?? ''; return $info; } diff --git a/backend/AUTH/methode/local.php b/backend/AUTH/methode/local.php index 5ea1ca55a..9b49edb26 100755 --- a/backend/AUTH/methode/local.php +++ b/backend/AUTH/methode/local.php @@ -28,7 +28,7 @@ $resOp = mysql2_query_secure($reqOp, $_SESSION['OCS']["readServer"], $arg_reqOp); $rowOp = mysqli_fetch_object($resOp); -if ($rowOp->PASSWORD_VERSION === '0') { +if (isset($rowOp->PASSWORD_VERSION) && $rowOp->PASSWORD_VERSION === '0') { $reqOp = "SELECT ID, USER_GROUP FROM operators WHERE ID='%s' and PASSWD ='%s'"; $arg_reqOp = array($login, md5($protectedMdp)); @@ -68,7 +68,7 @@ } } - if ($login_status == true || hash(PASSWORD_CRYPT, $mdp) == $rowOp->PASSWD) { + if ($login_status == true || (isset($rowOp->PASSWD) && hash(PASSWORD_CRYPT, $mdp) == $rowOp->PASSWD)) { $login_successful = "OK"; $user_group = $rowOp->USER_GROUP; $type_log = 'CONNEXION'; diff --git a/backend/identity/identity.php b/backend/identity/identity.php index c334c5573..035b479db 100755 --- a/backend/identity/identity.php +++ b/backend/identity/identity.php @@ -1,4 +1,5 @@ $error) { + foreach ($tab_error as $error) { $LIST_ERROR .= $error; addLog('ERROR_IDENTITY', $error); } $_SESSION['OCS']["mesmachines"] = "NOTAG"; } elseif (isset($tab_tag)) { - foreach ($list_methode as $prio => $script) { + foreach ($list_methode as $script) { if (isset($tab_tag[$script])) { foreach ($tab_tag[$script] as $tag => $lbl) { $list_tag[$tag] = $tag; @@ -71,7 +69,5 @@ $_SESSION['OCS']["mytag"] = $lbl_list_tag; $_SESSION['OCS']['TAGS'] = $list_tag; } - if (isset($lvluser)) $_SESSION['OCS']["lvluser"] = $lvluser; -?> \ No newline at end of file diff --git a/backend/identity/methode/cas.php b/backend/identity/methode/cas.php index 400f80fe1..cced85915 100644 --- a/backend/identity/methode/cas.php +++ b/backend/identity/methode/cas.php @@ -64,11 +64,11 @@ $arg_insert = array($_SESSION['OCS']["loggeduser"], 'Default', - $_SESSION['OCS']['details']['sn'], + $_SESSION['OCS']['details']['sn'] ?? '', "", "CAS", $defaultRole, - $_SESSION['OCS']['details']['mail'], + $_SESSION['OCS']['details']['mail'] ?? '', "NULL" ); } else { @@ -78,7 +78,7 @@ WHERE ID='%s'"; $arg_insert = array( - $_SESSION['OCS']['details']['mail'], + $_SESSION['OCS']['details']['mail'] ?? '', $_SESSION['OCS']["loggeduser"]); } connexion_local_write(); diff --git a/backend/identity/methode/ldap.php b/backend/identity/methode/ldap.php index f2827d4bc..7c9a9d479 100644 --- a/backend/identity/methode/ldap.php +++ b/backend/identity/methode/ldap.php @@ -1,4 +1,5 @@ NAME] = $item->TVALUE; } - // checks if the user already exists $reqOp = "SELECT new_accesslvl as accesslvl FROM operators WHERE id='%s'"; $argOp = array($_SESSION['OCS']["loggeduser"]); @@ -82,14 +79,13 @@ if (isset($_SESSION['OCS']['details']["filter"])) { $defaultRole = $config[$_SESSION['OCS']['details']["filter"]]; } - // uncomment this section for DEBUG // note: cannot use the global DEBUG variable because this happens before the toggle is available. /* - echo ("field1: ".$f1_name." value=".$f1_value." condition: ".$config['LDAP_CHECK_FIELD1_VALUE']." role=".$config['LDAP_CHECK_FIELD1_ROLE']." level=".$config['LDAP_CHECK_FIELD1_USERLEVEL']."
"); - echo ("field2: ".$item['CONEX_LDAP_CHECK_FIELD2_NAME']." value=".$f2_value." condition: ".$config['LDAP_CHECK_FIELD2_VALUE']." role=".$config['LDAP_CHECK_FIELD2_ROLE']." level=".$config['LDAP_CHECK_FIELD2_USERLEVEL']."
"); - echo ("user: ".$_SESSION['OCS']["loggeduser"]." will have level=".$defaultLevel." and role=".$defaultRole."
"); - */ + echo ("field1: ".$f1_name." value=".$f1_value." condition: ".$config['LDAP_CHECK_FIELD1_VALUE']." role=".$config['LDAP_CHECK_FIELD1_ROLE']." level=".$config['LDAP_CHECK_FIELD1_USERLEVEL']."
"); + echo ("field2: ".$item['CONEX_LDAP_CHECK_FIELD2_NAME']." value=".$f2_value." condition: ".$config['LDAP_CHECK_FIELD2_VALUE']." role=".$config['LDAP_CHECK_FIELD2_ROLE']." level=".$config['LDAP_CHECK_FIELD2_USERLEVEL']."
"); + echo ("user: ".$_SESSION['OCS']["loggeduser"]." will have level=".$defaultLevel." and role=".$defaultRole."
"); +*/ //if defaultRole is define if (isset($defaultRole) && trim($defaultRole) != '') { // if it doesn't exist, create the user record diff --git a/backend/identity/methode/local.php b/backend/identity/methode/local.php index 4b76077cc..14aa0b6e6 100644 --- a/backend/identity/methode/local.php +++ b/backend/identity/methode/local.php @@ -1,4 +1,5 @@ accesslvl)) { $lvluser = $rowOp->accesslvl; @@ -95,4 +93,3 @@ } else { $ERROR = $l->g(894); } -?> \ No newline at end of file diff --git a/backend/ipdiscover/ipdiscover.php b/backend/ipdiscover/ipdiscover.php index 8e8884cd6..39ae6ec90 100755 --- a/backend/ipdiscover/ipdiscover.php +++ b/backend/ipdiscover/ipdiscover.php @@ -1,4 +1,5 @@ "local.php"); - if (!isset($_SESSION['OCS']["ipdiscover"])) { $i = 0; //methode pour le calcul des droits - while ($list_methode[$i]) { + while (isset($list_methode[$i]) == true) { require_once('methode/' . $list_methode[$i]); //on garde les droits de l'utilisateur sur l'ipdiscover if (isset($list_ip)) { @@ -40,7 +39,7 @@ } unset($list_ip); if (isset($tab_ip)) { - foreach ($list_methode as $prio => $script) { + foreach ($list_methode as $script) { if (isset($tab_ip[$script])) { foreach ($tab_ip[$script] as $ip => $lbl) { $list_ip[$ip] = $lbl; @@ -58,4 +57,3 @@ $_SESSION['OCS']["ipdiscover"] = $tab_info; $_SESSION['OCS']["ipdiscover_methode"] = $base; } -?> \ No newline at end of file diff --git a/backend/ipdiscover/methode/local.php b/backend/ipdiscover/methode/local.php index 5db3964fe..5819fdc5d 100755 --- a/backend/ipdiscover/methode/local.php +++ b/backend/ipdiscover/methode/local.php @@ -71,7 +71,7 @@ /* applied again patch of revision 484 ( fix bug: https://bugs.launchpad.net/ocsinventory-ocsreports/+bug/637834 ) */ - if (is_array($subnetToBlacklist)) { + if (isset($subnetToBlacklist) && is_array($subnetToBlacklist)) { foreach ($subnetToBlacklist as $key => $value) { if ($key == $row->ipsubnet) { $id = '--' . $l->g(703) . '--'; @@ -95,7 +95,7 @@ /* applied again patch of revision 484 ( fix bug: https://bugs.launchpad.net/ocsinventory-ocsreports/+bug/637834 ) */ - if (is_array($subnetToBlacklist)) { + if (isset($subnetToBlacklist) && is_array($subnetToBlacklist)) { foreach ($subnetToBlacklist as $key => $value) { if ($key == $row->ipsubnet) { $id = '--' . $l->g(703) . '--'; diff --git a/backend/require/auth.manager.php b/backend/require/auth.manager.php index b5ac6520c..b83ccc861 100644 --- a/backend/require/auth.manager.php +++ b/backend/require/auth.manager.php @@ -1,4 +1,5 @@ - "local.php" ); - break; case 2: return array( 0 => "local.php", 1 => "ldap.php" ); - break; case 3: return array( 0 => "ldap.php" ); - break; case 4: - if($identity){ - return array( - 0 => "ldap.php" - ); - }else{ - return array( - 0 => "always_ok.php" - ); - } - - break; case 5: if($identity){ @@ -87,6 +72,5 @@ function get_list_methode($identity = false){ return array( 0 => "local.php" ); - break; } -} \ No newline at end of file +} diff --git a/config/main_menu.xml b/config/main_menu.xml index 46500f5ee..5963568e0 100644 --- a/config/main_menu.xml +++ b/config/main_menu.xml @@ -180,10 +180,6 @@ ms_wiki - - - ms_irc - ms_ask diff --git a/config/profiles/admin.xml b/config/profiles/admin.xml index e13d99ab3..05cbd4c68 100755 --- a/config/profiles/admin.xml +++ b/config/profiles/admin.xml @@ -38,7 +38,6 @@ ms_ipdiscover ms_doubles ms_wiki - ms_irc ms_offers ms_ask ms_console diff --git a/config/profiles/ladmin.xml b/config/profiles/ladmin.xml index a6e33ab89..d3e527699 100755 --- a/config/profiles/ladmin.xml +++ b/config/profiles/ladmin.xml @@ -52,7 +52,6 @@ ms_qrcode ms_server_infos ms_wiki - ms_irc ms_offers ms_ask ms_cve_search diff --git a/config/profiles/read-only.xml b/config/profiles/read-only.xml index cb77d2ae9..9a52e91be 100755 --- a/config/profiles/read-only.xml +++ b/config/profiles/read-only.xml @@ -32,7 +32,6 @@ ms_custom_groups ms_help ms_custom_info - ms_irc ms_custom_lock ms_offers ms_opt_ipdiscover diff --git a/config/profiles/sadmin.xml b/config/profiles/sadmin.xml index b976882ba..2da6af326 100755 --- a/config/profiles/sadmin.xml +++ b/config/profiles/sadmin.xml @@ -101,7 +101,6 @@ ms_stats_top ms_server_infos ms_wiki - ms_irc ms_offers ms_ask ms_extensionmanager diff --git a/config/teledeploy/options/installpluginlinuxopt.xml b/config/teledeploy/options/installpluginlinuxopt.xml index b99311617..b0f86339a 100644 --- a/config/teledeploy/options/installpluginlinuxopt.xml +++ b/config/teledeploy/options/installpluginlinuxopt.xml @@ -100,18 +100,18 @@ sh installplugin.sh - :NOTIFY_USER: + 0 - :NOTIFY_TEXT: + - :NOTIFY_COUNTDOWN: + - :NOTIFY_CAN_ABORT: + 0 - :NOTIFY_CAN_DELAY: + 0 - :NEED_DONE_ACTION: + 0 - :NEED_DONE_ACTION_TEXT: + \ No newline at end of file diff --git a/config/urls.xml b/config/urls.xml index 6d29cf0ea..e31b46422 100644 --- a/config/urls.xml +++ b/config/urls.xml @@ -268,10 +268,6 @@ wiki ms_help - - irc - ms_help - offers ms_help diff --git a/crontab/cron_cve_computer.php b/crontab/cron_cve_computer.php index 7d60321b3..de7ca9b75 100644 --- a/crontab/cron_cve_computer.php +++ b/crontab/cron_cve_computer.php @@ -24,7 +24,7 @@ 'EXCLUDE_ARCHIVE_COMPUTER' => 'EXCLUDE_ARCHIVE_COMPUTER' ]; - $configValues = look_config_default_values($configToLookOut)['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']; + $configValues = look_config_default_values($configToLookOut)['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] ?? ''; $sql = 'SELECT *, p.PUBLISHER, c.LINK as id, h.NAME as computer, h.ID as computerid, n.NAME as softname FROM cve_search c diff --git a/crontab/cron_wol.php b/crontab/cron_wol.php index 7fe91b5ac..dfd28b0e9 100644 --- a/crontab/cron_wol.php +++ b/crontab/cron_wol.php @@ -24,19 +24,22 @@ ]; } -for($i = 0; $wol[$i] != null; $i++){ - $date_wol = date('Y-m-d H:i', strtotime($wol[$i]['WOL_DATE'])); - $id = explode(',', $wol[$i]['WOL_ID']); - - if($date_wol == $today){ - foreach($id as $key => $value){ - $sql_computer = "SELECT MACADDR,IPADDRESS FROM networks WHERE (hardware_id=%s) AND status='Up'"; - $sql_arg = array($value); - $resultDetails = mysql2_query_secure($sql_computer, $_SESSION['OCS']["readServer"], $sql_arg); - - while ($wol_item = mysqli_fetch_object($resultDetails)) { - $wol_class->look_config_wol($wol_item->IPADDRESS, $wol_item->MACADDR); +if (!empty($wol)) { + for($i = 0; $wol[$i] != null; $i++){ + $date_wol = date('Y-m-d H:i', strtotime($wol[$i]['WOL_DATE'])); + $id = explode(',', $wol[$i]['WOL_ID']); + + if($date_wol == $today){ + foreach($id as $value){ + $sql_computer = "SELECT MACADDR,IPADDRESS FROM networks WHERE (hardware_id=%s) AND status='Up'"; + $sql_arg = array($value); + $resultDetails = mysql2_query_secure($sql_computer, $_SESSION['OCS']["readServer"], $sql_arg); + + while ($wol_item = mysqli_fetch_object($resultDetails)) { + $wol_class->look_config_wol($wol_item->IPADDRESS, $wol_item->MACADDR); + } } } } } + diff --git a/index.php b/index.php index cc0e260ed..341229588 100644 --- a/index.php +++ b/index.php @@ -42,7 +42,9 @@ } require ('require/header.php'); -addLog('PAGE', $protectedGet[PAG_INDEX]); +if (isset($protectedGet[PAG_INDEX])) { + addLog('PAGE', $protectedGet[PAG_INDEX]); +} if (!AJAX && !isset($protectedGet["popup"]) && !isset($protectedGet["no_footer"])) { require (FOOTER_HTML); diff --git a/install.php b/install.php index 3e41216f5..fd4b70509 100755 --- a/install.php +++ b/install.php @@ -135,8 +135,9 @@ function exec_fichier_sql($fichier, $link) { } else { //update $res = mysql2_query_secure("select tvalue from config where name='GUI_VERSION'", $link); - $item = mysqli_fetch_object($res); - if ($item->tvalue < 7006) { + + $item = $res ? mysqli_fetch_object($res) : null; + if (!isset($item) || $item->tvalue < 7006) { $db_file = "files/ocsbase.sql"; $name_connect = $_POST["name"]; $pass_connect = $_POST["pass"]; @@ -163,7 +164,7 @@ function exec_fichier_sql($fichier, $link) { } } - if (!$error) { + if (!isset($error)) { ob_flush(); flush(); msg_info($l->g(2030)); @@ -185,7 +186,7 @@ function exec_fichier_sql($fichier, $link) { fclose($ch); $dbc = mysqli_init(); - if(isset($_POST["enablessl"]) == 1) { + if($_POST["enablessl"] == 1) { $dbc->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); $dbc->ssl_set($_POST["sslkey"], $_POST["sslcert"], $_POST["cacert"], NULL, NULL); if($_POST["sslmode"] == "MYSQLI_CLIENT_SSL") { @@ -199,7 +200,7 @@ function exec_fichier_sql($fichier, $link) { $dbc->options(MYSQLI_INIT_COMMAND, "SET NAMES 'utf8'"); $dbc->options(MYSQLI_INIT_COMMAND, "SET sql_mode='NO_ENGINE_SUBSTITUTION'"); - $link = mysqli_real_connect($dbc, $_POST["host"], $_POST["name"], $_POST["pass"], NULL, $_POST["port"], NULL, $connect); + $link = mysqli_real_connect($dbc, $_POST["host"], $_POST["name"], $_POST["pass"], NULL, $_POST["port"], NULL, $connect ?? NULL); if (!$link) { if (mysqli_connect_errno() == 0) { @@ -222,6 +223,7 @@ function exec_fichier_sql($fichier, $link) { unlink(CONF_MYSQL); } else { msg_success("" . $l->g(2050) . "

" . $l->g(2051) . ""); + require(CONF_MYSQL); unset($_SESSION['OCS']['SQL_BASE_VERS']); } die(); @@ -231,72 +233,73 @@ function exec_fichier_sql($fichier, $link) { } //die(); } -//use values in mysql config file -if (is_readable(CONF_MYSQL)) { +if(is_readable(CONF_MYSQL)) { require(CONF_MYSQL); - if (defined('COMPTE_BASE')) { - $valNme = COMPTE_BASE; - } else { - $valNme = ''; - } - if (defined('PSWD_BASE')) { - $valPass = PSWD_BASE; - } else { - $valPass = ''; - } - if (defined('SERVER_WRITE')) { - $valServ = SERVER_WRITE; - } else { - $valServ = ''; - } - if (defined('SERVER_PORT')) { - $valPort = SERVER_PORT; - } else { - $valPort = 3306; - } - if (defined('DB_NAME')) { - $valdatabase = DB_NAME; - } else { - $valdatabase = ''; - } - if (defined('ENABLE_SSL')) { - $valenablessl = [ - "1" => $l->g(455), - "0" => $l->g(454) - ]; - } else { - $valenablessl = [ - "1" => $l->g(455), - "0" => $l->g(454) - ]; - } - if (defined('SSL_MODE')) { - $valsslmode = [ - "MYSQLI_CLIENT_SSL" => "MYSQLI_CLIENT_SSL", - "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" => "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" - ]; - } else { - $valsslmode = [ - "MYSQLI_CLIENT_SSL" => "MYSQLI_CLIENT_SSL", - "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" => "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" - ]; - } - if (defined('SSL_KEY')) { - $valsslkey = SSL_KEY; - } else { - $valsslkey = ''; - } - if (defined('SSL_CERT')) { - $valsslcert = SSL_CERT; - } else { - $valsslcert = ''; - } - if (defined('CA_CERT')) { - $valcacert = CA_CERT; - } else { - $valcacert = ''; - } } +//use values in mysql config file +if (defined('COMPTE_BASE')) { + $valNme = COMPTE_BASE; +} else { + $valNme = ''; +} +if (defined('PSWD_BASE')) { + $valPass = PSWD_BASE; +} else { + $valPass = ''; +} +if (defined('SERVER_WRITE')) { + $valServ = SERVER_WRITE; +} else { + $valServ = ''; +} +if (defined('SERVER_PORT')) { + $valPort = SERVER_PORT; +} else { + $valPort = 3306; +} +if (defined('DB_NAME')) { + $valdatabase = DB_NAME; +} else { + $valdatabase = ''; +} +if (defined('ENABLE_SSL')) { + $valenablessl = [ + "1" => $l->g(455), + "0" => $l->g(454) + ]; +} else { + $valenablessl = [ + "1" => $l->g(455), + "0" => $l->g(454) + ]; +} +if (defined('SSL_MODE')) { + $valsslmode = [ + "MYSQLI_CLIENT_SSL" => "MYSQLI_CLIENT_SSL", + "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" => "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" + ]; +} else { + $valsslmode = [ + "MYSQLI_CLIENT_SSL" => "MYSQLI_CLIENT_SSL", + "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" => "MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT" + ]; +} +if (defined('SSL_KEY')) { + $valsslkey = SSL_KEY; +} else { + $valsslkey = ''; +} +if (defined('SSL_CERT')) { + $valsslcert = SSL_CERT; +} else { + $valsslcert = ''; +} +if (defined('CA_CERT')) { + $valcacert = CA_CERT; +} else { + $valcacert = ''; +} + //show first form $form_name = 'fsub'; $name_field = array("name", "pass", "database", "host", "port", "enablessl", "sslmode", "sslkey", "sslcert", "cacert"); @@ -308,7 +311,7 @@ function exec_fichier_sql($fichier, $link) { $value_field = array($valNme, $valPass, $valdatabase, $valServ, $valPort, $valenablessl, $valsslmode, $valsslkey, $valsslcert, $valcacert); } $tab_typ_champ = show_field($name_field, $type_field, $value_field); -modif_values($tab_name, $tab_typ_champ, $tab_hidden, array( +modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? "", array( 'button_name' => 'INSTALL', 'show_button' => 'BUTTON', 'form_name' => $form_name diff --git a/plugins/computer_detail/cd_admininfo/cd_admininfo.php b/plugins/computer_detail/cd_admininfo/cd_admininfo.php index dd375335b..5856ba7be 100644 --- a/plugins/computer_detail/cd_admininfo/cd_admininfo.php +++ b/plugins/computer_detail/cd_admininfo/cd_admininfo.php @@ -42,7 +42,7 @@ $list_tab = find_all_account_tab('TAB_ACCOUNTAG', 'COMPUTERS', 1); if ($list_tab != '') { - if ($protectedPost['Valid_modif'] != "" && $protectedPost['NOTE'] == "" && $protectedPost['NOTE_MODIF'] == "") { + if (isset($protectedPost['Valid_modif']) && empty($protectedPost['NOTE']) && empty($protectedPost['NOTE_MODIF'])) { if (!is_defined($protectedPost['onglet']) || !is_numeric($protectedPost['onglet'])) { $protectedPost['onglet'] = $list_tab['FIRST']; } @@ -62,7 +62,7 @@ foreach ($protectedPost as $field => $value) { $temp_field = explode('_', $field); - if (array_key_exists($temp_field[0] . '_' . $temp_field[1], $info_account_id) || $temp_field[0] == 'TAG') { + if ((isset($temp_field[1]) && (array_key_exists($temp_field[0] . '_' . $temp_field[1], $info_account_id))) || $temp_field[0] == 'TAG') { //cas of checkbox if (isset($temp_field[2])) { $data_fields_account[$temp_field[0] . "_" . $temp_field[1]] .= $temp_field[2] . "&&&"; @@ -70,6 +70,7 @@ $data_fields_account[$field] = $value; } } + } updateinfo_computer($systemid, $data_fields_account); //search all admininfo for this computer @@ -97,7 +98,7 @@ unset($list_tab['FIRST']); echo open_form($form_name, '', '', 'form-horizontal'); - if (!$show_all_column) { + if (!isset($show_all_column)) { onglet($list_tab, $form_name, "onglet", 6); $sql_admin_info = "select ID,TYPE,NAME,COMMENT,NAME_ACCOUNTINFO,SHOW_ORDER,DEFAULT_VALUE from accountinfo_config where ID_TAB = %s and account_type='COMPUTERS' order by SHOW_ORDER ASC"; @@ -107,7 +108,7 @@ order by SHOW_ORDER ASC"; $arg_admin_info = array('COMPUTERS'); } - if ($_SESSION['OCS']['profile']->getConfigValue('ACCOUNTINFO') == 'YES' && !$show_all_column) { + if ($_SESSION['OCS']['profile']->getConfigValue('ACCOUNTINFO') == 'YES' && !isset($show_all_column)) { $show_admin_button = ""; if (isset($_SESSION['OCS']['ADMIN']['ACCOUNTINFO'])) { $show_admin_button .= ""; @@ -157,7 +158,7 @@ or $val_admin_info['TYPE'] == 11) { array_push($config['JAVASCRIPT'], ''); array_push($config['SIZE'], ''); - if ($admin_accountinfo) { + if (isset($admin_accountinfo)) { array_push($config['COMMENT_AFTER'], $up_png . ""); } else { array_push($config['COMMENT_AFTER'], ''); @@ -230,7 +231,7 @@ array_push($config['SIZE'], 'width=80 height=80'); } else { array_push($value_field, $info_account_id[$name_accountinfo]); - if ($admin_accountinfo) { + if (isset($admin_accountinfo)) { array_push($config['COMMENT_AFTER'], $up_png); } else { array_push($config['COMMENT_AFTER'], ""); @@ -270,7 +271,7 @@ if ($_SESSION['OCS']['profile']->getConfigValue('ACCOUNTINFO') == 'YES') { $tab_hidden = array('ADMIN' => '', 'UP' => '', 'DOWN' => ''); } - if ($show_all_column || $admin_accountinfo) { + if (isset($show_all_column) || isset($admin_accountinfo)) { $showbutton = false; } else { $showbutton = true; @@ -288,7 +289,7 @@ } echo "
"; - modif_values($tab_name, $tab_typ_champ, $tab_hidden, array( + modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? [], array( 'show_button' => $showbutton, 'form_name' => $form_name = 'NO_FORM', 'top_action' => $show_admin_button, diff --git a/plugins/computer_detail/cd_bios/cd_bios.php b/plugins/computer_detail/cd_bios/cd_bios.php index 051188bf0..50592c572 100755 --- a/plugins/computer_detail/cd_bios/cd_bios.php +++ b/plugins/computer_detail/cd_bios/cd_bios.php @@ -1,4 +1,5 @@ g(273)); if (!isset($protectedPost['SHOW'])) { $protectedPost['SHOW'] = 'NOSHOW'; } -if ($protectedPost['OTHER_BIS'] != '') { +if (isset($protectedPost['OTHER_BIS'])) { $sql = "INSERT INTO blacklist_serials (SERIAL) value ('%s')"; $arg = array($protectedPost['OTHER_BIS']); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } -if ($protectedPost['OTHER'] != '') { +if (isset($protectedPost['OTHER'])) { $sql = "DELETE FROM blacklist_serials WHERE SERIAL='%s'"; $arg = array($protectedPost['OTHER']); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } + +$form_name = 'cd_bios'; echo open_form($form_name, '', '', 'form-horizontal'); $list_fields = array($l->g(36) => 'SSN', $l->g(64) => 'SMANUFACTURER', @@ -63,9 +64,9 @@ $resultDetails = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $item = mysqli_fetch_object($resultDetails); $sql = "select ID from blacklist_serials where SERIAL='%s'"; -$arg = array($item->SSN); +$arg = array($item->SSN) ?? ''; $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); -if ($_SESSION['OCS']['ADMIN_BLACKLIST']['SERIAL'] == 'YES') { +if (isset($_SESSION['OCS']['ADMIN_BLACKLIST']['SERIAL']) && $_SESSION['OCS']['ADMIN_BLACKLIST']['SERIAL'] == 'YES') { if (mysqli_num_rows($result) == 1) { $tab_options['OTHER'][$l->g(36)][$item->SSN] = $item->SSN; $tab_options['OTHER']['IMG'] = 'image/red.png'; @@ -74,25 +75,21 @@ $tab_options['OTHER_BIS']['IMG'] = 'image/green.png'; } } - -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del[$l->g(36)] = $l->g(36); } - $default_fields = $list_fields; $queryDetails = "SELECT "; -foreach ($list_fields as $lbl => $value) { +foreach ($list_fields as $value) { $queryDetails .= $value . ","; } $queryDetails = substr($queryDetails, 0, -1) . " FROM bios WHERE (hardware_id=$systemid)"; ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); - echo close_form(); if (AJAX) { ob_end_clean(); tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options); ob_start(); } -?> \ No newline at end of file diff --git a/plugins/computer_detail/cd_comments/cd_comments.php b/plugins/computer_detail/cd_comments/cd_comments.php index bc3c040be..c7b287e78 100644 --- a/plugins/computer_detail/cd_comments/cd_comments.php +++ b/plugins/computer_detail/cd_comments/cd_comments.php @@ -42,7 +42,7 @@ echo open_form($form_name, '', '', 'form-horizontal'); //delete a list of notes -if ($protectedPost['del_check'] != '') { +if (isset($protectedPost['del_check'])) { $arg_sql = array(); $sql = "update itmgmt_comments set visible=0 where id in "; $sql = mysql2_prepare($sql, $arg_sql, $protectedPost['del_check']); @@ -85,7 +85,7 @@ $tab_options['CACHE'] = 'RESET'; } } -if ($protectedPost['ADD_NOTE']) { +if (isset($protectedPost['ADD_NOTE'])) { unset($tab_name, $tab_typ_champ); $tab_name[1] = $l->g(1126) . ": "; $tab_name[2] = $l->g(1127) . ": "; @@ -94,9 +94,11 @@ $tab_typ_champ[2]['DEFAULT_VALUE'] = $_SESSION['OCS']["loggeduser"]; $tab_typ_champ[1]['INPUT_TYPE'] = 0; $tab_typ_champ[2]['INPUT_TYPE'] = 13; + $tab_typ_champ[1]['INPUT_NAME'] = 'NOTE'; + $tab_typ_champ[2]['INPUT_NAME'] = 'NOTE'; $tab_typ_champ[3]['INPUT_NAME'] = 'NOTE'; $tab_typ_champ[3]['INPUT_TYPE'] = 1; - modif_values($tab_name, $tab_typ_champ, $tab_hidden); + modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? ''); } $queryDetails = "SELECT ID,DATE_INSERT,USER_INSERT,COMMENTS,ACTION FROM itmgmt_comments WHERE (visible is null or visible =1) and hardware_id=$systemid"; @@ -105,7 +107,7 @@ $l->g(51) => 'COMMENTS', $l->g(443) => 'ACTION'); -if (!$show_all_column) { +if (!isset($show_all_column)) { // modif management $list_fields['MODIF'] = 'ID'; @@ -119,7 +121,7 @@ $default_fields = $list_fields; ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); -if (!$show_all_column) { +if (!isset($show_all_column)) { echo "

"; del_selection($form_name); } @@ -138,6 +140,8 @@ $tab_typ_champ[3]['DEFAULT_VALUE'] = $item['COMMENTS']; $tab_typ_champ[1]['INPUT_TYPE'] = 0; $tab_typ_champ[2]['INPUT_TYPE'] = 13; + $tab_typ_champ[1]['INPUT_NAME'] = 'NOTE_MODIF'; + $tab_typ_champ[2]['INPUT_NAME'] = 'NOTE_MODIF'; $tab_typ_champ[3]['INPUT_NAME'] = 'NOTE_MODIF'; $tab_typ_champ[3]['INPUT_TYPE'] = 1; $tab_hidden['USER_INSERT'] = $item['USER_INSERT']; diff --git a/plugins/computer_detail/cd_configuration/cd_configuration.php b/plugins/computer_detail/cd_configuration/cd_configuration.php index a618a4339..28c30c26f 100644 --- a/plugins/computer_detail/cd_configuration/cd_configuration.php +++ b/plugins/computer_detail/cd_configuration/cd_configuration.php @@ -82,8 +82,10 @@ } $reqGroups .= " order by h.name"; $resGroups = mysql2_query_secure($reqGroups, $_SESSION['OCS']["readServer"]); - while ($valGroups = mysqli_fetch_array($resGroups)) { - echo ""; + if ($resGroups) { + while ($valGroups = mysqli_fetch_array($resGroups)) { + echo ""; + } } ?> @@ -120,7 +122,7 @@ function url(id) { } else { $returnIP = $l->g(493); } -optperso("IPDISCOVER", $l->g(489), "IPDISCOVER", $optPerso, '', $returnIP); +optperso("IPDISCOVER", $l->g(489), "IPDISCOVER", $optPerso ?? '', '', $returnIP); //FREQUENCY if (isset($optPerso["FREQUENCY"])) { @@ -134,7 +136,7 @@ function url(id) { } else { $returnFrequency = $l->g(497); } -optperso("FREQUENCY", $l->g(494), "FREQUENCY", $optPerso, '', $returnFrequency); +optperso("FREQUENCY", $l->g(494), "FREQUENCY", $optPerso ?? '', '', $returnFrequency); //DOWNLOAD_SWITCH if (isset($optPerso["DOWNLOAD_SWITCH"])) { @@ -152,29 +154,29 @@ function url(id) { $returnDL = $l->g(733); } } -optperso("DOWNLOAD", $l->g(417), "DOWNLOAD", $optPerso, '', $returnDL); +optperso("DOWNLOAD", $l->g(417), "DOWNLOAD", $optPerso ?? '', '', $returnDL); //DOWNLOAD_CYCLE_LATENCY -optperso("DOWNLOAD_CYCLE_LATENCY", $l->g(720), "DOWNLOAD_CYCLE_LATENCY", $optPerso, $optdefault['ivalue']["DOWNLOAD_CYCLE_LATENCY"], $l->g(511)); +optperso("DOWNLOAD_CYCLE_LATENCY", $l->g(720), "DOWNLOAD_CYCLE_LATENCY", $optPerso ?? '', $optdefault['ivalue']["DOWNLOAD_CYCLE_LATENCY"], $l->g(511)); //DOWNLOAD_FRAG_LATENCY -optperso("DOWNLOAD_FRAG_LATENCY", $l->g(721), "DOWNLOAD_FRAG_LATENCY", $optPerso, $optdefault['ivalue']["DOWNLOAD_FRAG_LATENCY"], $l->g(511)); +optperso("DOWNLOAD_FRAG_LATENCY", $l->g(721), "DOWNLOAD_FRAG_LATENCY", $optPerso ?? '', $optdefault['ivalue']["DOWNLOAD_FRAG_LATENCY"], $l->g(511)); //DOWNLOAD_PERIOD_LATENCY -optperso("DOWNLOAD_PERIOD_LATENCY", $l->g(722), "DOWNLOAD_PERIOD_LATENCY", $optPerso, $optdefault['ivalue']["DOWNLOAD_PERIOD_LATENCY"], $l->g(511)); +optperso("DOWNLOAD_PERIOD_LATENCY", $l->g(722), "DOWNLOAD_PERIOD_LATENCY", $optPerso ?? '', $optdefault['ivalue']["DOWNLOAD_PERIOD_LATENCY"], $l->g(511)); //DOWNLOAD_PERIOD_LENGTH -optperso("DOWNLOAD_PERIOD_LENGTH", $l->g(723), "DOWNLOAD_PERIOD_LENGTH", $optPerso, $optdefault['ivalue']["DOWNLOAD_PERIOD_LENGTH"]); +optperso("DOWNLOAD_PERIOD_LENGTH", $l->g(723), "DOWNLOAD_PERIOD_LENGTH", $optPerso ?? '', $optdefault['ivalue']["DOWNLOAD_PERIOD_LENGTH"]); //PROLOG_FREQ -optperso("PROLOG_FREQ", $l->g(724), "PROLOG_FREQ", $optPerso, $optdefault['ivalue']["PROLOG_FREQ"], $l->g(730)); +optperso("PROLOG_FREQ", $l->g(724), "PROLOG_FREQ", $optPerso ?? '', $optdefault['ivalue']["PROLOG_FREQ"], $l->g(730)); //PROLOG_FREQ -optperso("DOWNLOAD_TIMEOUT", $l->g(424), "DOWNLOAD_TIMEOUT", $optPerso, $optdefault['ivalue']["DOWNLOAD_TIMEOUT"], $l->g(496)); +optperso("DOWNLOAD_TIMEOUT", $l->g(424), "DOWNLOAD_TIMEOUT", $optPerso ?? '', $optdefault['ivalue']["DOWNLOAD_TIMEOUT"], $l->g(496)); //DOWNLOAD_SWITCH -optperso("SNMP_SWITCH", $l->g(1197), "SNMP_SWITCH", $optPerso, '', ($optPerso["SNMP_SWITCH"]["IVALUE"] == 1) ? $l->g(733) : $l->g(205)); +optperso("SNMP_SWITCH", $l->g(1197), "SNMP_SWITCH", $optPerso ?? '', '', (isset($optPerso["SNMP_SWITCH"]["IVALUE"]) && $optPerso["SNMP_SWITCH"]["IVALUE"] == 1) ? $l->g(733) : $l->g(205)); //GROUPS $sql_groups = "SELECT static, name, group_id,workgroup diff --git a/plugins/computer_detail/cd_controllers/cd_controllers.php b/plugins/computer_detail/cd_controllers/cd_controllers.php index 118d4c0d1..d1ce72787 100755 --- a/plugins/computer_detail/cd_controllers/cd_controllers.php +++ b/plugins/computer_detail/cd_controllers/cd_controllers.php @@ -1,4 +1,5 @@ g(93)); if (!isset($protectedPost['SHOW'])) $protectedPost['SHOW'] = 'NOSHOW'; @@ -42,25 +42,21 @@ $l->g(80) => 'CAPTION', $l->g(53) => 'DESCRIPTION', $l->g(277) => 'VERSION'); - -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del[$l->g(66)] = $l->g(66); } - $default_fields = array($l->g(64) => $l->g(64), $l->g(49) => $l->g(49), $l->g(66) => $l->g(66)); $queryDetails = "SELECT "; -foreach ($list_fields as $lbl => $value) { +foreach ($list_fields as $value) { $queryDetails .= $value . ","; } $queryDetails = substr($queryDetails, 0, -1) . " FROM controllers WHERE (hardware_id=$systemid)"; ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); - echo close_form(); if (AJAX) { ob_end_clean(); tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options); ob_start(); } -?> \ No newline at end of file diff --git a/plugins/computer_detail/cd_cve/cd_cve.php b/plugins/computer_detail/cd_cve/cd_cve.php index 187353822..63365aaf8 100644 --- a/plugins/computer_detail/cd_cve/cd_cve.php +++ b/plugins/computer_detail/cd_cve/cd_cve.php @@ -45,7 +45,7 @@ $l->g(1467) => 'LINK' ); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del[$l->g(8104)] = $l->g(8104); diff --git a/plugins/computer_detail/cd_drives/cd_drives.php b/plugins/computer_detail/cd_drives/cd_drives.php index b760fd9fd..81f9c5e24 100755 --- a/plugins/computer_detail/cd_drives/cd_drives.php +++ b/plugins/computer_detail/cd_drives/cd_drives.php @@ -44,7 +44,7 @@ $l->g(87) . " (MB)" => 'TOTAL', "PERCENT_BAR" => 'CAPACITY'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array('PERCENT_BAR' => 'PERCENT_BAR', $l->g(85) => $l->g(85)); diff --git a/plugins/computer_detail/cd_inputs/cd_inputs.php b/plugins/computer_detail/cd_inputs/cd_inputs.php index 8bda9968a..158675d89 100755 --- a/plugins/computer_detail/cd_inputs/cd_inputs.php +++ b/plugins/computer_detail/cd_inputs/cd_inputs.php @@ -41,7 +41,7 @@ $l->g(53) => 'DESCRIPTION', $l->g(84) => 'INTERFACE'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(66) => $l->g(66), $l->g(84) => $l->g(84)); diff --git a/plugins/computer_detail/cd_memories/cd_memories.php b/plugins/computer_detail/cd_memories/cd_memories.php index 932f6c393..549d53e3a 100755 --- a/plugins/computer_detail/cd_memories/cd_memories.php +++ b/plugins/computer_detail/cd_memories/cd_memories.php @@ -44,7 +44,7 @@ $l->g(94) => 'NUMSLOTS', $l->g(36) => 'SERIALNUMBER'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(80) => $l->g(80), $l->g(83) => $l->g(83)); diff --git a/plugins/computer_detail/cd_modems/cd_modems.php b/plugins/computer_detail/cd_modems/cd_modems.php index 8277f7714..66550fbef 100755 --- a/plugins/computer_detail/cd_modems/cd_modems.php +++ b/plugins/computer_detail/cd_modems/cd_modems.php @@ -40,7 +40,7 @@ $l->g(65) => 'MODEL', $l->g(53) => 'DESCRIPTION', $l->g(66) => 'TYPE'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(49) => $l->g(49), $l->g(66) => $l->g(66)); diff --git a/plugins/computer_detail/cd_monitors/cd_monitors.php b/plugins/computer_detail/cd_monitors/cd_monitors.php index c73610314..460b0e437 100755 --- a/plugins/computer_detail/cd_monitors/cd_monitors.php +++ b/plugins/computer_detail/cd_monitors/cd_monitors.php @@ -40,7 +40,7 @@ $l->g(360) => 'DESCRIPTION', $l->g(66) => 'TYPE', $l->g(36) => 'SERIAL'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(64) => $l->g(64), $l->g(36) => $l->g(36)); diff --git a/plugins/computer_detail/cd_networks/cd_networks.php b/plugins/computer_detail/cd_networks/cd_networks.php index 1bc9f728e..0a1e03d5a 100755 --- a/plugins/computer_detail/cd_networks/cd_networks.php +++ b/plugins/computer_detail/cd_networks/cd_networks.php @@ -1,4 +1,5 @@ g(82)); if (!isset($protectedPost['SHOW'])) { $protectedPost['SHOW'] = 'NOSHOW'; } $tab_options = $protectedPost; - -if ($protectedPost['OTHER_BIS'] != '') { +if (isset($protectedPost['OTHER_BIS'])) { //verify @mac if (preg_match('/([0-9A-F]{2}:){5}[0-9A-F]{2}$/i', $protectedPost['OTHER_BIS'])) { $sql = "INSERT INTO blacklist_macaddresses (macaddress) value ('%s')"; @@ -41,7 +40,7 @@ $tab_options['CACHE'] = 'RESET'; } } -if ($protectedPost['OTHER'] != '') { +if (isset($protectedPost['OTHER'])) { //verify @mac if (preg_match('/([0-9A-F]{2}:){5}[0-9A-F]{2}$/i', $protectedPost['OTHER'])) { $sql = "DELETE FROM blacklist_macaddresses WHERE macaddress='%s'"; @@ -50,7 +49,6 @@ $tab_options['CACHE'] = 'RESET'; } } - $form_name = "affich_networks"; $table_name = $form_name; $tab_options['form_name'] = $form_name; @@ -67,7 +65,7 @@ $l->g(207) => 'IPGATEWAY', $l->g(331) => 'IPSUBNET', $l->g(281) => 'IPDHCP'); -if ($_SESSION['OCS']['ADMIN_BLACKLIST']['MACADD'] == "YES") { +if (isset($_SESSION['OCS']['ADMIN_BLACKLIST']['MACADD']) && $_SESSION['OCS']['ADMIN_BLACKLIST']['MACADD'] == "YES") { $sql = "select MACADDR from networks WHERE (hardware_id=%s)"; $arg = $systemid; $resultDetails = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); @@ -84,16 +82,14 @@ } } } - -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del[$l->g(34)] = $l->g(34); } - $default_fields = $list_fields; $queryDetails = "SELECT "; -foreach ($list_fields as $lbl => $value) { +foreach ($list_fields as $value) { $queryDetails .= $value . ","; } $queryDetails = substr($queryDetails, 0, -1) . " FROM networks WHERE (hardware_id=$systemid)"; @@ -104,4 +100,3 @@ tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options); ob_start(); } -?> \ No newline at end of file diff --git a/plugins/computer_detail/cd_saas/cd_saas.php b/plugins/computer_detail/cd_saas/cd_saas.php index adfe01207..017eec0a8 100644 --- a/plugins/computer_detail/cd_saas/cd_saas.php +++ b/plugins/computer_detail/cd_saas/cd_saas.php @@ -43,7 +43,7 @@ $l->g(8106) => 's.TTL', ); - if ($show_all_column) { + if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del[$l->g(8104)] = $l->g(8104); @@ -51,7 +51,7 @@ $default_fields = array($l->g(49) => $l->g(49), $l->g(8104) => $l->g(8104), $l->g(8105) => $l->g(8105)); $queryDetails = "SELECT DISTINCT "; - foreach ($list_fields as $lbl => $value) { + foreach ($list_fields as $value) { $queryDetails .= $value . ","; } $queryDetails = substr($queryDetails, 0, -1) . " FROM saas s LEFT JOIN saas_exp e ON e.ID = s.SAAS_EXP_ID WHERE (hardware_id=$systemid)"; diff --git a/plugins/computer_detail/cd_softwares/cd_softwares.php b/plugins/computer_detail/cd_softwares/cd_softwares.php index bbb0d553a..dd3de613f 100755 --- a/plugins/computer_detail/cd_softwares/cd_softwares.php +++ b/plugins/computer_detail/cd_softwares/cd_softwares.php @@ -45,9 +45,9 @@ $all_soft = [0 => $l->g(765)]; $list_cat = $softCat->onglet_cat_cd($systemid); -$i = $list_cat['i']; -$first_onglet = $list_cat['first_onglet']; -$categorie_id = $list_cat['category_name']; +$i = $list_cat['i'] ?? ""; +$first_onglet = $list_cat['first_onglet'] ?? ""; +$categorie_id = $list_cat['category_name'] ?? ""; unset($list_cat['i']); unset($list_cat['first_onglet']); @@ -96,7 +96,7 @@ $list_fields[$l->g(277)] = 'VERSION'; $list_fields[$l->g(51)] = 'COMMENTS'; -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(49) => $l->g(49)); diff --git a/plugins/computer_detail/cd_sounds/cd_sounds.php b/plugins/computer_detail/cd_sounds/cd_sounds.php index 0f725e750..961d4c320 100755 --- a/plugins/computer_detail/cd_sounds/cd_sounds.php +++ b/plugins/computer_detail/cd_sounds/cd_sounds.php @@ -38,7 +38,7 @@ $list_fields = array($l->g(49) => 'NAME', $l->g(64) => 'MANUFACTURER', $l->g(53) => 'DESCRIPTION'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(49) => $l->g(49)); diff --git a/plugins/computer_detail/cd_storages/cd_storages.php b/plugins/computer_detail/cd_storages/cd_storages.php index 42f0100c5..ee59d1616 100755 --- a/plugins/computer_detail/cd_storages/cd_storages.php +++ b/plugins/computer_detail/cd_storages/cd_storages.php @@ -40,7 +40,7 @@ $l->g(67) . " (MB)" => 'DISKSIZE', $l->g(36) => 'SERIALNUMBER', $l->g(1229) => 'FIRMWARE'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(49) => $l->g(49)); diff --git a/plugins/computer_detail/cd_videos/cd_videos.php b/plugins/computer_detail/cd_videos/cd_videos.php index f43aa3aab..4846ae475 100755 --- a/plugins/computer_detail/cd_videos/cd_videos.php +++ b/plugins/computer_detail/cd_videos/cd_videos.php @@ -39,7 +39,7 @@ $l->g(276) => 'CHIPSET', $l->g(26) . " (MB)" => 'MEMORY', $l->g(62) => 'RESOLUTION'); -if ($show_all_column) { +if (isset($show_all_column)) { $list_col_cant_del = $list_fields; } else { $list_col_cant_del = array($l->g(49) => $l->g(49)); diff --git a/plugins/language/en_GB/en_GB.txt b/plugins/language/en_GB/en_GB.txt index 9b7932809..a823e3714 100755 --- a/plugins/language/en_GB/en_GB.txt +++ b/plugins/language/en_GB/en_GB.txt @@ -1715,6 +1715,7 @@ 9033 Authentication Protocol 9034 Privacy Protocol 9035 Privacy Password +9036 No OID found 9100 SSL key path 9101 SSL certificat path @@ -1839,4 +1840,7 @@ 9907 Manage layouts 9908 Show all layouts 9909 Add new layout -9910 Available layouts : \ No newline at end of file +9910 Available layouts : +9911 Layout name +9912 Layout description +9913 Table name \ No newline at end of file diff --git a/plugins/language/fr_FR/fr_FR.txt b/plugins/language/fr_FR/fr_FR.txt index 588e49393..bf903d695 100644 --- a/plugins/language/fr_FR/fr_FR.txt +++ b/plugins/language/fr_FR/fr_FR.txt @@ -1710,6 +1710,7 @@ 9033 Protocole d'authentification 9034 Protocole de confidentialité 9035 Mot de passe de confidentialité +9036 Aucun OID trouvé 9100 Chemin de la clé SSL 9101 Chemin du certificat SSL @@ -1835,4 +1836,7 @@ 9907 Gestion des dispositions 9908 Afficher les dispositions 9909 Ajouter une disposition -9910 Dispositions disponibles : \ No newline at end of file +9910 Dispositions disponibles : +9911 Nom de la disposition +9912 Description de la disposition +9913 Nom du tableau \ No newline at end of file diff --git a/plugins/main_sections/ms_admininfo/ms_admininfo.php b/plugins/main_sections/ms_admininfo/ms_admininfo.php index 4df07b323..967c8ba07 100644 --- a/plugins/main_sections/ms_admininfo/ms_admininfo.php +++ b/plugins/main_sections/ms_admininfo/ms_admininfo.php @@ -82,20 +82,20 @@ $hidden = $protectedPost['MODIF']; } -if (isset($protectedPost['MODIF_OLD']) && is_numeric($protectedPost['MODIF_OLD']) && $protectedPost['Valid_modif'] != "" && $protectedPost['onglet'] == 2) { +if (isset($protectedPost['MODIF_OLD']) && is_numeric($protectedPost['MODIF_OLD']) && !empty($protectedPost['Valid_modif']) && $protectedPost['onglet'] == 2) { //UPDATE VALUE $msg = update_accountinfo($protectedPost['MODIF_OLD'], array('TYPE' => $protectedPost['newtype'], 'NAME' => $protectedPost['newfield'], 'COMMENT' => $protectedPost['newlbl'], 'ID_TAB' => $protectedPost['account_tab'], - 'DEFAULT_VALUE' => $protectedPost['default_value']), $protectedPost['accountinfo']); + 'DEFAULT_VALUE' => $protectedPost['default_value'] ?? ''), $protectedPost['accountinfo']); $hidden = $protectedPost['MODIF_OLD']; -} elseif ($protectedPost['Valid_modif'] != "") { +} elseif (!empty($protectedPost['Valid_modif'])) { //ADD NEW VALUE - $msg = add_accountinfo($protectedPost['newfield'], $protectedPost['newtype'], $protectedPost['newlbl'], $protectedPost['account_tab'], $protectedPost['accountinfo'], $protectedPost['default_value']); + $msg = add_accountinfo($protectedPost['newfield'], $protectedPost['newtype'] ?? '', $protectedPost['newlbl'] ?? '', $protectedPost['account_tab'] ?? '', $protectedPost['accountinfo'] ?? '', $protectedPost['default_value'] ?? ''); } -if (isset($msg['ERROR'])) { +if (!empty($msg['ERROR'])) { msg_error($msg['ERROR']); } if (isset($msg['SUCCESS'])) { @@ -103,7 +103,7 @@ $protectedPost['onglet'] = 1; } -if (isset($protectedPost['MODIF_OLD']) && is_numeric($protectedPost['MODIF_OLD']) && $protectedPost['Valid_modif'] != "" && $protectedPost['onglet'] == 4) { +if (isset($protectedPost['MODIF_OLD']) && is_numeric($protectedPost['MODIF_OLD']) && !empty($protectedPost['Valid_modif']) && $protectedPost['onglet'] == 4) { //UPDATE VALUE update_config("TAB_ACCOUNTAG_" . $protectedPost['MODIF_OLD'], 'TVALUE', $protectedPost['newfield']); if (isset($protectedPost['2newfield'])) { @@ -111,7 +111,7 @@ } $hidden = $protectedPost['MODIF_OLD']; $protectedPost['onglet'] = 3; -} elseif ($protectedPost['Valid_modif'] != "" && $protectedPost['onglet'] == 4) { +} elseif (!empty($protectedPost['Valid_modif']) && $protectedPost['onglet'] == 4) { //ADD NEW VALUE //vérification que le nom du champ n'existe pas pour les nouveaux champs if (trim($protectedPost['newfield']) != '') { @@ -153,7 +153,7 @@ mysql2_query_secure($sql_insert, $_SESSION['OCS']["writeServer"], $arg_insert); //si on ajoute un champ, il faut créer la colonne dans la table downloadwk_pack msg_success($l->g(1069)); - if ($protectedGet['form']) { + if (isset($protectedGet['form']) && $protectedGet['form']) { reloadform_closeme($protectedGet['form']); } $protectedPost['onglet'] = 3; @@ -193,13 +193,13 @@
g(56), '', '', $protectedPost['ACCOUNTINFO_CHOISE'], '', $accountinfo_choise, $accountinfo_choise, 'onchange="document.admin_info.submit();"'); + formGroup('select', 'ACCOUNTINFO_CHOISE', $l->g(56), '', '', $protectedPost['ACCOUNTINFO_CHOISE'] ?? '', '', $accountinfo_choise, $accountinfo_choise, 'onchange="document.admin_info.submit();"'); ?>
g(56) . ": ", $l->g(1070) . ": "); - if (isset($protectedPost['MODIF_OLD']) || $protectedPost['MODIF'] != '') { - $hidden = ($protectedPost['MODIF'] != '' ? $protectedPost['MODIF'] : $protectedPost['MODIF_OLD']); + if (isset($protectedPost['MODIF_OLD']) || !empty($protectedPost['MODIF'])) { + $hidden = (!empty($protectedPost['MODIF']) ? $protectedPost['MODIF'] : $protectedPost['MODIF_OLD']); $type_field = array(3, 3); $value_field = array($protectedPost['accountinfo'], $protectedPost['newfield']); } else { $type_field = array(2, 0); - $value_field = array($accountinfo_choise, $protectedPost['newfield']); + $value_field = array($accountinfo_choise, $protectedPost['newfield'] ?? ''); } if (isset($hidden) && is_numeric($hidden)) { @@ -275,7 +275,7 @@ array_push($name_field, "newlbl"); array_push($tab_name, $l->g(80) . ":"); array_push($type_field, 0); - array_push($value_field, $protectedPost['newlbl']); + array_push($value_field, $protectedPost['newlbl'] ?? ''); array_push($name_field, "newtype"); array_push($tab_name, $l->g(1071) . ":"); @@ -287,7 +287,7 @@ array_push($type_field, 2); array_push($value_field, $array_tab_account); - if ($protectedPost['newtype'] == 8) { //for QRCODE type + if (isset($protectedPost['newtype']) && $protectedPost['newtype'] == 8) { //for QRCODE type array_push($name_field, "default_value"); array_push($tab_name, $l->g(1099) . ":"); array_push($type_field, 2); @@ -298,22 +298,22 @@ $tab_typ_champ[3]['COMMENT_AFTER']=""; - if( (isset($protectedPost['MODIF']) && $protectedPost['MODIF'] != "") || (isset($protectedPost['MODIF_OLD']) && $protectedPost['MODIF_OLD'] != "") ){ - formGroup('hidden', 'MODIF_OLD', '', '', '', $protectedPost['MODIF'], '', '', '', ''); + if( (isset($protectedPost['MODIF']) && !empty($protectedPost['MODIF'])) || (isset($protectedPost['MODIF_OLD']) && !empty($protectedPost['MODIF_OLD'])) ){ + formGroup('hidden', 'MODIF_OLD', '', '', '', $protectedPost['MODIF'] ?? '', '', '', '', ''); formGroup('hidden', 'newfield', '', '', '', $protectedPost['newfield']); formGroup('hidden', 'accountinfo', '', '', '', $protectedPost['accountinfo']); formGroup('text', 'accountinfo', $l->g(56), '', '', $protectedPost['accountinfo'], '', '', '', "disabled"); formGroup('text', 'newfield', $l->g(1070), 30, 255, $protectedPost['newfield'], '', '', '', "disabled"); }else{ - formGroup('select', 'accountinfo', $l->g(56), '', '', $protectedPost['ACCOUNTINFO_CHOISE'], '', $tab_typ_champ[0]['DEFAULT_VALUE'], $tab_typ_champ[0]['DEFAULT_VALUE'], "onKeyPress=\"return scanTouche(event,/[0-9a-zA-Z_-]/)\" onkeydown='convertToUpper(this)' onkeyup='convertToUpper(this)' onblur='convertToUpper(this)'"); - formGroup('text', 'newfield', $l->g(1070), 30, 255, $protectedPost['newfield'], '', '', '', "onkeypress='return scanTouche(event,/[0-9a-zA-Z_-]/)' onkeydown='convertToUpper(this)' onkeyup='convertToUpper(this)' onblur='convertToUpper(this)'"); + formGroup('select', 'accountinfo', $l->g(56), '', '', $protectedPost['ACCOUNTINFO_CHOISE'] ?? '', '', $tab_typ_champ[0]['DEFAULT_VALUE'], $tab_typ_champ[0]['DEFAULT_VALUE'], "onKeyPress=\"return scanTouche(event,/[0-9a-zA-Z_-]/)\" onkeydown='convertToUpper(this)' onkeyup='convertToUpper(this)' onblur='convertToUpper(this)'"); + formGroup('text', 'newfield', $l->g(1070), 30, 255, $protectedPost['newfield'] ?? '', '', '', '', "onkeypress='return scanTouche(event,/[0-9a-zA-Z_-]/)' onkeydown='convertToUpper(this)' onkeyup='convertToUpper(this)' onblur='convertToUpper(this)'"); } - formGroup('text', 'newlbl', $l->g(80), 30, 255, $protectedPost['newlbl']); - formGroup('select', 'newtype', $l->g(1071), '', '', $protectedPost['newtype'], '', $tab_typ_champ[3]['DEFAULT_VALUE'], $tab_typ_champ[3]['DEFAULT_VALUE'], "onchange='document.admin_info.submit();'"); - formGroup('select', 'account_tab', $l->g(1061), '', '', $protectedPost['account_tab'], '', $tab_typ_champ[4]['DEFAULT_VALUE'], $tab_typ_champ[4]['DEFAULT_VALUE'],'', $tab_typ_champ[3]['COMMENT_AFTER']); + formGroup('text', 'newlbl', $l->g(80), 30, 255, $protectedPost['newlbl'] ?? ''); + formGroup('select', 'newtype', $l->g(1071), '', '', $protectedPost['newtype'] ?? '', '', $tab_typ_champ[3]['DEFAULT_VALUE'], $tab_typ_champ[3]['DEFAULT_VALUE'], "onchange='document.admin_info.submit();'"); + formGroup('select', 'account_tab', $l->g(1061), '', '', $protectedPost['account_tab'] ?? '', '', $tab_typ_champ[4]['DEFAULT_VALUE'], $tab_typ_champ[4]['DEFAULT_VALUE'],'', $tab_typ_champ[3]['COMMENT_AFTER']); - if($protectedPost['newtype'] == 8){ + if(isset($protectedPost['newtype']) && $protectedPost['newtype'] == 8){ formGroup('select', 'default_value', $l->g(1099), '', '', $protectedPost['default_value'], '', $tab_typ_champ[5]['DEFAULT_VALUE'], $tab_typ_champ[5]['DEFAULT_VALUE'], '', ''); } @@ -366,7 +366,7 @@ //traitement par lot if ($are_result) { del_selection($form_name); - if ($protectedGet['form']) { + if (isset($protectedGet['form'])) { reloadform_closeme($protectedGet['form']); } } @@ -377,12 +377,12 @@ $name_field = array("newfield"); $tab_name[0] = $l->g(80); $type_field = array(0); - $value_field = array($protectedPost['newfield']); + $value_field = array($protectedPost['newfield'] ?? '') ; $tab_typ_champ = show_field($name_field, $type_field, $value_field); $tab_typ_champ[0]['CONFIG']['SIZE'] = 20; - modif_values($tab_name, $tab_typ_champ, $tab_hidden, array( + modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? '', array( 'form_name' => 'NO_FORM' )); @@ -414,7 +414,7 @@ msg_info($l->g(9608)); msg_success($l->g(9607)); // display form for CSV field selection - formGroup('select', 'csv_field', $l->g(9600), '', '', $protectedPost['csv_field'], '', $protectedPost['csv_header'], $protectedPost['csv_header']); + formGroup('select', 'csv_field', $l->g(9600), '', '', ($protectedPost['csv_field'] ?? 0), '', $protectedPost['csv_header'], $protectedPost['csv_header']); echo "



"; echo ""; // close file @@ -430,13 +430,13 @@ } else { $defaultTable = null; } - + // association with OCS fields is achieved with 2 fields hardware>NAME or bios>SSN $tabs_available = array('hardware - machine name', 'bios - serial number'); // display form for OCS field selection echo open_form('csv_assoc', '', '', ''); ?> - +
g(9609)); ?>
@@ -457,15 +457,15 @@
- +



- - + + readCSVHeader(); // delete csv field of reconciliation from header > cant link it with any other field unset($header[$protectedPost['csv_field']]); - + // get ocs fields from accountinfo_config $req = "SELECT ID, NAME from accountinfo_config WHERE account_type = 'computers'"; $ocs_fields = mysql2_query_secure($req, $_SESSION['OCS']["readServer"]); $ocs_fields = mysqli_fetch_all($ocs_fields, MYSQLI_ASSOC); - array_unshift($ocs_fields, "----"); + $emptyfields = [ + 'ID' => 0, + 'NAME' => "----" + ]; + array_unshift($ocs_fields, $emptyfields); echo '
'; msg_info($l->g(9610)); @@ -495,8 +499,8 @@ echo ' '; echo ' '.$column.''; echo '
"; - - + + // 5th - results @@ -548,6 +552,8 @@ function logCSVErrors($lvl) { // req to retrieve hardware id $sql_h_id = "SELECT %s FROM %s WHERE %s = '%s'"; $i = 0; + $success = null; + while ($line = $csvObj->readCSVLine()) { $i++; // first line means header @@ -597,14 +603,14 @@ function logCSVErrors($lvl) { $delete_csv = $csvObj->deleteCSV($protectedPost['csv_filename']); echo "


"; - if ($success != '') { + if (!is_null($success)) { msg_info($l->g(9605)); } foreach ($errors as $key => $error) { $error = "CSV line $key : ".$l->g($error); msg_error($error); } - + // 1st - import csv } else { // Open new form for csv file @@ -613,7 +619,7 @@ function logCSVErrors($lvl) {
"; echo "

"; - formGroup('file', 'csv_file', 'Import CSV file :', '', '', $protectedPost['csv_file'], '', '', '', "accept='.csv'"); + formGroup('file', 'csv_file', 'Import CSV file :', '', '', $protectedPost['csv_file'] ?? '', '', '', '', "accept='.csv'"); echo "

"; echo "
"; } diff --git a/plugins/main_sections/ms_all_computers/ms_all_computers.php b/plugins/main_sections/ms_all_computers/ms_all_computers.php index 1949abf7d..e946c34d5 100644 --- a/plugins/main_sections/ms_all_computers/ms_all_computers.php +++ b/plugins/main_sections/ms_all_computers/ms_all_computers.php @@ -53,7 +53,7 @@ } //del the selection -if ($protectedPost['DEL_ALL'] != '') { +if (!empty($protectedPost['DEL_ALL'])) { foreach ($protectedPost as $key => $value) { $checkbox = explode('check', $key); if (isset($checkbox[1])) { @@ -64,36 +64,32 @@ } //delete one computer -if ($protectedPost['SUP_PROF'] != '') { +if (!empty($protectedPost['SUP_PROF'])) { deleteDid($protectedPost['SUP_PROF']); $tab_options['CACHE'] = 'RESET'; } //archive one computer -if ($protectedPost['ARCHIVER'] != '') { +if (!empty($protectedPost['ARCHIVER'])) { $archive->archive($protectedPost['ARCHIVER']); $tab_options['CACHE'] = 'RESET'; unset($protectedPost['ARCHIVER']); } //archive one computer -if ($protectedPost['RESTORE'] != '') { +if (!empty($protectedPost['RESTORE'])) { $archive->restore($protectedPost['RESTORE']); $tab_options['CACHE'] = 'RESET'; unset($protectedPost['RESTORE']); } -if (!isset($protectedPost['tri_' . $table_name]) || $protectedPost['tri_' . $table_name] == "") { - $protectedPost['tri_' . $table_name] = "h.lastdate"; - $protectedPost['sens_' . $table_name] = "DESC"; -} echo open_form($form_name, '', '', 'form-horizontal'); $def_onglets['ALL'] = $l->g(1557); $def_onglets['ACTIVE'] = $l->g(1555); $def_onglets['ARCHIVE'] = $l->g(1554); -if ($protectedPost['onglet'] == "") { +if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "ACTIVE"; } @@ -109,7 +105,8 @@ } //BEGIN SHOW ACCOUNTINFO -$accountinfo_value = interprete_accountinfo($list_fields, $tab_options); + +$accountinfo_value = interprete_accountinfo($list_fields ?? null, $tab_options); if (array($accountinfo_value['TAB_OPTIONS'])) { $tab_options = $accountinfo_value['TAB_OPTIONS']; } @@ -295,7 +292,7 @@ $list_pag["image/cadena_ferme.png"] = $pages_refs["ms_custom_lock"]; $list_pag["image/mass_affect.png"] = $pages_refs["ms_custom_tag"]; -add_trait_select($list_fonct, $list_id, $form_name, $list_pag, true); +add_trait_select($list_fonct, $list_id ?? null, $form_name, $list_pag, true); echo "

"; if ($entete && $_SESSION['OCS']['profile']->getConfigValue('DELETE_COMPUTERS') == "YES") { diff --git a/plugins/main_sections/ms_all_soft/ms_all_soft.php b/plugins/main_sections/ms_all_soft/ms_all_soft.php index e07996d0c..fc0300771 100644 --- a/plugins/main_sections/ms_all_soft/ms_all_soft.php +++ b/plugins/main_sections/ms_all_soft/ms_all_soft.php @@ -35,7 +35,7 @@ $softCat = new SoftwareCategory(); //If RESET -if ($protectedPost['RESET']) { +if (isset($protectedPost['RESET'])) { unset($protectedPost['NAME_RESTRICT']); unset($protectedPost['NBRE']); unset($protectedPost['CLASS']); @@ -43,7 +43,7 @@ } //If SUBMIT -if ($protectedPost['SUBMIT_FORM']) { +if (isset($protectedPost['SUBMIT_FORM'])) { $tab_options['CACHE'] = 'RESET'; } @@ -94,14 +94,14 @@ echo open_form($form_name, '', '', 'form-horizontal'); $list_cat = $softCat->onglet_cat(); -$first_onglet = $list_cat['first_onglet']; -$categorie_id = $list_cat['category_name']; -$os = $list_cat['OS']; +$first_onglet = $list_cat['first_onglet'] ?? ''; +$categorie_id = $list_cat['category_name'] ?? ''; +$os = $list_cat['OS'] ?? ''; //definition of onglet $def_onglets['ALL'] = $l->g(765); //Category list. $def_onglets['WITHOUT'] = $l->g(1516); //Category list. -for($i=1; $list_cat[$i] != null; $i++){ +for($i=1; isset($list_cat[$i]); $i++){ $def_onglets[$list_cat['category_name'][$list_cat[$i]]] = $list_cat[$i]; } @@ -109,7 +109,7 @@ if (isset($protectedGet['onglet']) && !isset($protectedPost['old_onglet'])){ $protectedPost['onglet'] = $protectedGet['onglet']; } -if ($protectedPost['onglet'] == "") { +if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "ALL"; } @@ -169,7 +169,7 @@ $list_col_cant_del = $default_fields; $tab_options['LBL']['name'] = $l->g(847); $tab_options['LBL']['nbre'] = $l->g(1120); - $tab_options['ARG_SQL'] = $sql['ARG']; + $tab_options['ARG_SQL'] = $sql['ARG'] ?? ''; $tab_options['form_name'] = $form_name; $tab_options['table_name'] = $form_name; $result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); @@ -300,7 +300,7 @@ +
diff --git a/plugins/main_sections/ms_config/ms_notification.php b/plugins/main_sections/ms_config/ms_notification.php index ed02138d3..0fbfba8ea 100644 --- a/plugins/main_sections/ms_config/ms_notification.php +++ b/plugins/main_sections/ms_config/ms_notification.php @@ -40,7 +40,7 @@ $def_onglets['NOTIF_PERSO'] = $l->g(8012); //Notification personnalisation //default => first onglet -if ($protectedPost['onglet'] == "") { +if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "NOTIF_CONFIG"; } @@ -66,7 +66,7 @@ if($protectedPost['onglet'] == 'NOTIF_CONFIG'){ - if ($protectedPost['Valid'] == $l->g(103)) { + if (isset($protectedPost['Valid']) && $protectedPost['Valid'] == $l->g(103)) { $mail->insert_info_smtp($protectedPost); } @@ -78,7 +78,7 @@ $send_mode = array('nonsecure' => 'SMTP'/*, 'PHP' => 'PHP'*/,'ssl' => 'SMTP+SSL', 'tls'=>'SMTP+TLS'); echo $mail->div['NOTIF_FOLLOW']; - if($mail->info['NOTIF_FOLLOW'] == 'ON'){ + if(isset($mail->info['NOTIF_FOLLOW']) && $mail->info['NOTIF_FOLLOW'] == 'ON'){ echo "ON
"; echo "OFF"; $required = "required"; @@ -89,23 +89,23 @@ } echo ""; echo $mail->div['NOTIF_MAIL_ADMIN']; - echo ""; + echo ""; echo ""; echo $mail->div['NOTIF_NAME_ADMIN']; - echo ""; + echo ""; echo ""; echo $mail->div['NOTIF_MAIL_REPLY']; - echo ""; + echo ""; echo "

" . $l->g(8010) . "

"; echo ""; echo $mail->div['NOTIF_NAME_REPLY']; - echo ""; + echo ""; echo "

" . $l->g(8010) . "

"; echo ""; echo $mail->div['NOTIF_SEND_MODE']; echo ""; echo ""; echo $mail->div['NOTIF_SMTP_HOST']; - echo ""; + echo ""; echo ""; echo $mail->div['NOTIF_PORT_SMTP']; - echo ""; + echo ""; echo ""; echo $mail->div['NOTIF_USER_SMTP']; - echo ""; + echo ""; echo "

" . $l->g(8010) . "

"; echo ""; echo $mail->div['NOTIF_PASSWD_SMTP']; - echo ""; + echo ""; echo "

" . $l->g(8010) . "

"; echo ""; echo $mail->div['NOTIF_PROG_TIME']; - echo ""; + echo ""; echo ""; echo $mail->div['NOTIF_PROG_DAY']; @@ -155,7 +155,7 @@ if($protectedPost['onglet'] == 'NOTIF_PERSO'){ echo "

"; - if ($protectedPost['Send'] == $l->g(103)) { + if (isset($protectedPost['Send']) && $protectedPost['Send'] == $l->g(103)) { $mail->update_perso($protectedPost['notif_choice']); if($protectedPost['notif_choice'] == 'PERSO'){ $result =$mail->upload_file($_FILES, $protectedPost['subject']); @@ -176,7 +176,7 @@ echo ''.$l->g(488).'
'.$l->g(8012).' -


'; +


'; msg_warning($l->g(8016)); echo '
'; @@ -185,7 +185,7 @@ echo '
'; //Default - echo "
"; + echo "
"; echo "
"; $output = $mail->replace_value('require/mail/Templates/OCS_template.html', 'DEFAULT'); @@ -198,7 +198,7 @@ if(!$output){ $output = $l->g(8020); } - echo "
"; + echo "
"; echo "
"; echo $output; diff --git a/plugins/main_sections/ms_config/ms_snmp_config.php b/plugins/main_sections/ms_config/ms_snmp_config.php index 4136fd584..eed1f92ce 100644 --- a/plugins/main_sections/ms_config/ms_snmp_config.php +++ b/plugins/main_sections/ms_config/ms_snmp_config.php @@ -54,7 +54,7 @@ } //default => first onglet -if ($protectedPost['onglet'] == "") { +if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "SNMP_RULE"; } @@ -147,7 +147,7 @@ unset($protectedPost['create_type_condition']); } - if($protectedPost['type_filter'] != "empty" && $protectedPost['type_filter'] != null) { + if(isset($protectedPost['type_filter']) && $protectedPost['type_filter'] != "empty" && $protectedPost['type_filter'] != null) { $filter = " WHERE c.TYPE_ID = ".$protectedPost['type_filter']; } else { $filter = ""; @@ -174,7 +174,7 @@ echo "
"; - formGroup('select', 'type_filter', $l->g(9011), '', '', $protectedPost['type_filter'], '', $filter_type, $filter_type); + formGroup('select', 'type_filter', $l->g(9011), '', '', $protectedPost['type_filter'] ?? '', '', $filter_type, $filter_type); echo "
"; echo "
"; echo ""; @@ -265,7 +265,7 @@ } if(isset($protectedPost['update_snmp'])) { - $result = $snmp->snmp_config($protectedPost['type_id'], $protectedPost['label_id'], $protectedPost['oid'], $protectedPost['reconciliation']); + $result = $snmp->snmp_config($protectedPost['type_id'], $protectedPost['label_id'], $protectedPost['oid'], $protectedPost['reconciliation'] ?? ''); if($result == 0){ msg_success($l->g(572)); }else{ @@ -274,7 +274,7 @@ unset($protectedPost['update_snmp']); } - if($protectedPost['type_filter'] != "empty" && $protectedPost['type_filter'] != null) { + if(isset($protectedPost['type_filter']) && $protectedPost['type_filter'] != "empty" && $protectedPost['type_filter'] != null) { $filter = " WHERE c.TYPE_ID ='".$protectedPost['type_filter']."'"; } else { $filter = ""; @@ -302,7 +302,7 @@ echo "
"; - formGroup('select', 'type_filter', $l->g(9011), '', '', $protectedPost['type_filter'], '', $filter_type, $filter_type); + formGroup('select', 'type_filter', $l->g(9011), '', '', $protectedPost['type_filter'] ?? '', '', $filter_type, $filter_type); echo "
"; echo "
"; echo ""; @@ -346,9 +346,13 @@ } if(isset($protectedPost['update_snmp'])) { - $result_oids = $command->get_mib_oid($protectedPost['mib_file']); - - $protectedPost['select_mib'] = true; + $result_oids = $command->get_mib_oid($protectedPost['mib_file'] ?? ''); + if(!empty($result_oids)) { + $protectedPost['select_mib'] = true; + } else { + msg_error($l->g(9036)); + } + unset($protectedPost['update_snmp']); } diff --git a/plugins/main_sections/ms_console/ms_console.php b/plugins/main_sections/ms_console/ms_console.php index 4a8565268..a2bcb6d7b 100644 --- a/plugins/main_sections/ms_console/ms_console.php +++ b/plugins/main_sections/ms_console/ms_console.php @@ -50,7 +50,7 @@ ); $values = look_config_default_values($champs); -if($values['ivalue']['ACTIVE_NEWS'] == 1){ +if(isset($values) && $values['ivalue']['ACTIVE_NEWS'] == 1 ?? 0){ $result_test = $news->test_connect(); if($result_test == 'true'){ $obj = $news->get_json_news(); diff --git a/plugins/main_sections/ms_cve_correspondance/ms_cve_correspondance.php b/plugins/main_sections/ms_cve_correspondance/ms_cve_correspondance.php index af0e276e7..2f97ab270 100644 --- a/plugins/main_sections/ms_cve_correspondance/ms_cve_correspondance.php +++ b/plugins/main_sections/ms_cve_correspondance/ms_cve_correspondance.php @@ -41,7 +41,7 @@ $def_onglets['LIST_CORR'] = $l->g(1474); //New category //default => first onglet -if ($protectedPost['onglet'] == "") { +if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "NEW_CORR"; } @@ -89,7 +89,7 @@ echo "".$l->g(1480).""; echo "

"; - formGroup('file', 'csv_file', $l->g(1478).' :', '', '', $protectedPost['csv_file'], '', '', '', "accept='.csv'"); + formGroup('file', 'csv_file', $l->g(1478).' :', '', '', $protectedPost['csv_file'] ?? '', '', '', '', "accept='.csv'"); echo ""; echo "
"; } @@ -123,7 +123,7 @@ $list_col_cant_del = array('SUP' => 'SUP', 'CHECK' => 'CHECK'); $default_fields = $list_fields; $list_col_cant_del = $default_fields; - $tab_options['ARG_SQL'] = $sql['ARG']; + $tab_options['ARG_SQL'] = $sql['ARG'] ?? ''; $tab_options['form_name'] = $form_name; $tab_options['table_name'] = $form_name; diff --git a/plugins/main_sections/ms_cve_search/ms_cve_search.php b/plugins/main_sections/ms_cve_search/ms_cve_search.php index 4e8aa8aca..2489a2a05 100644 --- a/plugins/main_sections/ms_cve_search/ms_cve_search.php +++ b/plugins/main_sections/ms_cve_search/ms_cve_search.php @@ -35,7 +35,7 @@ printEnTete($l->g(1463)); //If RESET -if ($protectedPost['RESET']) { +if (isset($protectedPost['RESET'])) { unset($protectedPost['FILTRE1']); unset($protectedPost['FILTRE2']); } @@ -55,7 +55,7 @@ $def_onglets['BY_COMPUTER'] = $l->g(1486); //All CVE by computer. //default => first onglet - if ($protectedPost['onglet'] == "") { + if (empty($protectedPost['onglet'])) { $protectedPost['onglet'] = "BY_CVSS"; } @@ -68,7 +68,7 @@ if($protectedPost['onglet'] == "BY_CVSS"){ //Filter CVSS - if ($protectedPost['FILTRE1'] != "" && $protectedPost['FILTRE2'] != "") { + if (!empty($protectedPost['FILTRE1']) && !empty($protectedPost['FILTRE2'])) { $query = " WHERE c.CVSS BETWEEN %s AND %s "; $sql['ARG'] = array($protectedPost['FILTRE1'], $protectedPost['FILTRE2']); } @@ -78,7 +78,7 @@ LEFT JOIN software_publisher p ON p.ID = c.PUBLISHER_ID LEFT JOIN software_version v ON v.ID = c.VERSION_ID'; - if($query != null) { + if(!empty($query)) { $sql['SQL'] .= $query; } @@ -141,7 +141,7 @@ $tab_options['LIEN_LBL']['Link'] = ' '; $tab_options['LIEN_CHAMP']['Link'] = 'LINK'; $tab_options['LBL']['Link'] = $l->g(1467); - $tab_options['ARG_SQL'] = $sql['ARG']; + $tab_options['ARG_SQL'] = $sql['ARG'] ?? ''; $tab_options['form_name'] = $form_name; $tab_options['table_name'] = $form_name; $result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); @@ -158,11 +158,11 @@
- '; + '; echo '
- +
diff --git a/plugins/main_sections/ms_debug/ms_debug.php b/plugins/main_sections/ms_debug/ms_debug.php index bc1783d80..a8ae4bbcd 100755 --- a/plugins/main_sections/ms_debug/ms_debug.php +++ b/plugins/main_sections/ms_debug/ms_debug.php @@ -24,7 +24,7 @@ $form_name = 'debug'; -if ($protectedPost["MODE"] == 5 && !isset($_SESSION['OCS']['TRUE_USER'])){ +if (isset($protectedPost["MODE"]) && $protectedPost["MODE"] == 5 && !isset($_SESSION['OCS']['TRUE_USER'])){ msg_info($_SESSION['OCS']['loggeduser'] . " " . $l->g(889) . " " . $protectedPost["FUSER"]); } @@ -54,7 +54,7 @@ $tab_field_name[0] = "form-group form-group-debug"; //VALUE FOR FUSER INPUT -$tab_typ_champ[1]['DEFAULT_VALUE'] = $protectedPost['FUSER']; +$tab_typ_champ[1]['DEFAULT_VALUE'] = $protectedPost['FUSER'] ?? ''; $tab_typ_champ[1]['INPUT_NAME'] = "FUSER"; $tab_typ_champ[1]['INPUT_TYPE'] = 0; $tab_name[1] = $l->g(926) . " "; diff --git a/plugins/main_sections/ms_dict/ms_dict.php b/plugins/main_sections/ms_dict/ms_dict.php index 7cab9a514..a850644ee 100644 --- a/plugins/main_sections/ms_dict/ms_dict.php +++ b/plugins/main_sections/ms_dict/ms_dict.php @@ -48,11 +48,11 @@ $def_onglets['IGNORED'] = $l->g(1029); //ignor. $def_onglets['UNCHANGED'] = $l->g(1030); //unchanged //défault => first onglet -if ($protectedPost['onglet'] == "") { +if (!isset($protectedPost['onglet']) || $protectedPost['onglet'] == "") { $protectedPost['onglet'] = "CAT"; } //reset search -if ($protectedPost['RESET'] == "RESET") { +if (isset($protectedPost['RESET']) && $protectedPost['RESET'] == "RESET") { unset($protectedPost['custom_search']); } //filtre @@ -60,7 +60,7 @@ $search_cache = " and cache.name like '%" . mysqli_real_escape_string( $_SESSION['OCS']["readServer"], $protectedPost['custom_search']) . "%' "; $search_count = " and extracted like '%" . mysqli_real_escape_string($_SESSION['OCS']["readServer"], $protectedPost['custom_search']) . "%' "; } else { - $search = ""; + $search_cache = ""; $search_count = ""; } //show first lign of onglet @@ -73,8 +73,8 @@ /* * ************************************ACTION ON DICO SOFT************************************* */ //transfert soft -if ($protectedPost['TRANS'] == "TRANS") { - if ($protectedPost['all_item'] != '') { +if (isset($protectedPost['TRANS']) && $protectedPost['TRANS'] == "TRANS") { + if (isset($protectedPost['all_item']) && $protectedPost['all_item'] != '') { $list_check = search_all_item(); } else { @@ -86,13 +86,13 @@ } // If list check and protected post are OK for transfer - if ($list_check != '' && ( isset($protectedPost['NEW_CAT']) || isset($protectedPost['EXIST_CAT']) ) ) { - if($protectedPost['EXIST_CAT'] != "NONE"){ + if (!empty($list_check) && ( isset($protectedPost['NEW_CAT']) || isset($protectedPost['EXIST_CAT']) ) ) { + if(isset($protectedPost['EXIST_CAT']) && $protectedPost['EXIST_CAT'] != "NONE"){ trans($protectedPost['onglet'], $list_check, $protectedPost['AFFECT_TYPE'], '', $protectedPost['EXIST_CAT']); unset($protectedPost['EXIST_CAT']); } - if($protectedPost['NEW_CAT'] != ""){ + if(isset($protectedPost['NEW_CAT']) && $protectedPost['NEW_CAT'] != ""){ trans($protectedPost['onglet'], $list_check, $protectedPost['AFFECT_TYPE'], $protectedPost['NEW_CAT'], ''); unset($protectedPost['NEW_CAT']); } @@ -104,12 +104,12 @@ } } //delete a soft in list => return in 'NEW' liste -if ($protectedPost['SUP_PROF'] != "") { +if (isset($protectedPost['SUP_PROF']) && $protectedPost['SUP_PROF'] != "") { del_soft($protectedPost['onglet'], array($protectedPost['SUP_PROF'])); } /* * **********************************END ACTION************************************* */ -if ($protectedPost['onglet'] != $protectedPost['old_onglet']) { +if (isset($protectedPost['old_onlget']) && $protectedPost['onglet'] != $protectedPost['old_onglet']) { unset($protectedPost['onglet_soft']); } /* * *****************************************************CAS OF CATEGORIES****************************************************** */ @@ -119,6 +119,7 @@ from dico_soft where extracted!=formatted " . $search_count . " group by formatted"; $result_list_cat = mysqli_query($_SESSION['OCS']["readServer"], $sql_list_cat); $i = 1; + $list_cat = []; while ($item_list_cat = mysqli_fetch_object($result_list_cat)) { if ($i == 1) { $first_onglet = $i; @@ -126,49 +127,60 @@ $list_cat[$i] = $item_list_cat->name; $i++; } + + $list_fields = array('SOFT_NAME' => 'EXTRACTED', + 'ID' => 'ID', + 'SUP' => 'ID', + 'CHECK' => 'ID' + ); + + //delete categorie if (is_defined($protectedPost['SUP_CAT'])) { - if ($protectedPost['SUP_CAT'] == 1) { - $first_onglet = 2; - } + $reqDcat = "DELETE FROM dico_soft WHERE formatted='" . $list_cat[$protectedPost['SUP_CAT']] . "'"; mysqli_query($_SESSION['OCS']["writeServer"], $reqDcat) or die(mysqli_error($_SESSION['OCS']["writeServer"])); unset($list_cat[$protectedPost['SUP_CAT']]); + if ($protectedPost['SUP_CAT'] == 1) { + $first_onglet = 2; + } + unset($protectedPost['SUP_CAT']); } - //no selected? default=>first onglet - if ($protectedPost['onglet_soft'] == "" || !isset($list_cat[$protectedPost['onglet_soft']])) { + + //no selected? default=>first onglet + if ((!empty($first_onglet)) && (empty($protectedPost['onglet_soft']) || !isset($list_cat[$protectedPost['onglet_soft']]))) { $protectedPost['onglet_soft'] = $first_onglet; } + //show all categories - if ($i <= 20) { - echo "

"; + if ($i <= 20 && isset($protectedPost['onglet_soft'])) { + echo "

"; onglet($list_cat, $form_name, "onglet_soft", 5); echo "

"; - } else { + } elseif(isset($protectedPost['onglet_soft'])) { echo "

" . $l->g(398) . ": " . show_modif($list_cat, 'onglet_soft', 2, $form_name) . "

"; } //You can delete or not? if ($i != 1 && isset($list_cat[$protectedPost['onglet_soft']])) { echo "g(640) . "\");'>" . $l->g(921) . ""; } - $list_fields = array('SOFT_NAME' => 'EXTRACTED', - 'ID' => 'ID', - 'SUP' => 'ID', - 'CHECK' => 'ID' - ); + $table_name = "CAT_EXIST"; $default_fields = array('SOFT_NAME' => 'SOFT_NAME', 'SUP' => 'SUP', 'CHECK' => 'CHECK'); $list_col_cant_del = array('SOFT_NAME' => 'SOFT_NAME', 'SUP' => 'SUP', 'CHECK' => 'CHECK'); - $querydico = 'SELECT '; - foreach ($list_fields as $key => $value) { - if ($key != 'SUP' && $key != 'CHECK') { - $querydico .= $value . ','; + if (!empty($list_cat)) { + $querydico = 'SELECT '; + foreach ($list_fields as $key => $value) { + if ($key != 'SUP' && $key != 'CHECK') { + $querydico .= $value . ','; + } } + $querydico = substr($querydico, 0, -1); + $querydico .= " from dico_soft left join " . $table . " cache on dico_soft.extracted=cache.name + where formatted='" . mysqli_real_escape_string($_SESSION['OCS']["readServer"], $list_cat[$protectedPost['onglet_soft']] ?? '') . "' " . $search_count . " group by EXTRACTED"; } - $querydico = substr($querydico, 0, -1); - $querydico .= " from dico_soft left join " . $table . " cache on dico_soft.extracted=cache.name - where formatted='" . mysqli_real_escape_string($_SESSION['OCS']["readServer"], $list_cat[$protectedPost['onglet_soft']]) . "' " . $search_count . " group by EXTRACTED"; + } /* ******************************************************CAS OF NEW****************************************************** */ if ($protectedPost['onglet'] == 'NEW') { @@ -193,18 +205,18 @@ } //execute the query only if necessary $_SESSION['OCS']['REQ_ONGLET_SOFT'] = $sql_list_alpha; - $_SESSION['OCS']['ONGLET_SOFT'] = $list_alpha; + $_SESSION['OCS']['ONGLET_SOFT'] = $list_alpha ?? null; $_SESSION['OCS']['FIRST_DICO'] = $first; if (!isset($protectedPost['onglet_soft'])) { $protectedPost['onglet_soft'] = $_SESSION['OCS']['FIRST_DICO']; } echo "

"; - onglet($list_alpha, $form_name, "onglet_soft", 20); + onglet($list_alpha ?? '', $form_name, "onglet_soft", 20); echo "

"; //search all soft for the tab as selected $search_soft = "select distinct trim(name) name from " . $table . " cache - where name like '" . $_SESSION['OCS']['ONGLET_SOFT'][$protectedPost['onglet_soft']] . "%' + where name like '" . ($_SESSION['OCS']['ONGLET_SOFT'][$protectedPost['onglet_soft']] ?? '') . "%' and name not in (select extracted name from dico_soft) and name not in (select extracted name from dico_ignored) " . $search_cache; $result_search_soft = mysqli_query($_SESSION['OCS']["readServer"], $search_soft); @@ -256,6 +268,7 @@ $querydico .= $value . ','; } } + $modif_search = ""; if ($search_count != "") { $modif_search = " where " . substr($search_count, 5); } @@ -292,6 +305,8 @@ $tab_options['LBL']['SOFT_NAME'] = $l->g(382); $tab_options['LBL']['QTE'] = $l->g(55); $result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); +} else { + msg_warning($l->g(1506)); } //récupération de toutes les catégories @@ -312,7 +327,7 @@ ?>
- g(1051), '', '', $protectedPost['custom_search']); ?> + g(1051), '', '', $protectedPost['custom_search'] ?? ""); ?>
@@ -326,13 +341,13 @@ " . $l->g(384); ?>
g(1381), '', '', $protectedPost['AFFECT_TYPE'], '', $choix_affect, $choix_affect, 'onchange="document.admin_param.submit();"'); + formGroup('select', 'AFFECT_TYPE', $l->g(1381), '', '', $protectedPost['AFFECT_TYPE'] ?? 0, '', $choix_affect, $choix_affect, 'onchange="document.admin_param.submit();"'); if(isset($protectedPost['AFFECT_TYPE']) && $protectedPost['AFFECT_TYPE'] != "NONE"){ if ($protectedPost['AFFECT_TYPE'] == "NEW_CAT") { - formGroup('text', 'NEW_CAT', $l->g(391), '', 100, $protectedPost['NEW_CAT']); + formGroup('text', 'NEW_CAT', $l->g(391), '', 100, $protectedPost['NEW_CAT'] ?? ""); }elseif($protectedPost['AFFECT_TYPE'] == "EXIST_CAT"){ - formGroup('select', 'EXIST_CAT', $l->g(388), '', 100, $protectedPost['EXIST_CAT'], '', $list_categories, $list_categories); + formGroup('select', 'EXIST_CAT', $l->g(388), '', 100, $protectedPost['EXIST_CAT'] ?? 0, '', $list_categories, $list_categories); } echo ""; echo ""; @@ -349,7 +364,7 @@ echo ""; echo close_form(); -if(isset($protectedPost['custom_search'])){ +if(!empty($protectedPost['custom_search'])){ unset($tab_options['custom_search']); } diff --git a/plugins/main_sections/ms_doubles/ms_doubles.php b/plugins/main_sections/ms_doubles/ms_doubles.php index dd3ce6bae..508a818df 100644 --- a/plugins/main_sections/ms_doubles/ms_doubles.php +++ b/plugins/main_sections/ms_doubles/ms_doubles.php @@ -1,4 +1,5 @@ g(923); @@ -39,7 +39,6 @@ } else { $tab_id_mes_machines = ""; } - printEnTete($l->g(199)); // sort an array by key @@ -56,14 +55,14 @@ function groupBy($key, $data) { } // merge selected duplicates -if ($protectedPost['FUSION']) { +if (isset($protectedPost['FUSION'])) { // if duplicates selection is coming from checkbox "all" if (isset($protectedPost['selected_grp_dupli'])) { foreach ($protectedPost['selected_grp_dupli'] as $dpl) { // oh boy $dpl = json_decode(html_entity_decode($dpl), true); $selectedDuplis[] = $dpl; - $dup_grp = groupBy($criteria, $dpl); + $dup_grp = groupBy($criteria ?? '', $dpl); foreach ($dup_grp as $grp) { if (count($grp) >= 2) { $afus = array(); @@ -92,7 +91,7 @@ function groupBy($key, $data) { } // grouping the reconstructed array by criteria to merge duplicates coherently - $groupedDuplis = groupBy($criteria, $selectedDuplis); + $groupedDuplis = groupBy($criteria ?? '', $selectedDuplis); // iterate through each group of duplicates foreach ($groupedDuplis as $correspDuplis) { @@ -121,7 +120,7 @@ function groupBy($key, $data) { // merge all duplicates -if ($protectedPost['FUSION_ALL']) { +if (isset($protectedPost['FUSION_ALL'])) { // $grpDuplis as already been grouped by criteria and contains all duplicates foreach ($grpDuplis as $dup) { $afus = array(); @@ -140,14 +139,12 @@ function groupBy($key, $data) { /* * ********************** hostname double ************************************** */ $sql_doublon['hostname'] = "SELECT NAME val FROM hardware "; $arg_doublon['hostname'] = array(); - if (is_defined($tab_id_mes_machines)) { $sql = mysql2_prepare($sql_doublon['hostname'] . ' WHERE id IN ', $arg_doublon['hostname'], $tab_id_mes_machines); $sql_doublon['hostname'] = $sql['SQL']; $arg_doublon['hostname'] = $sql['ARG']; } $sql_doublon['hostname'] .= " GROUP BY NAME HAVING COUNT(NAME)>1"; - /* * ********************** serial number double ************************************** */ $sql_doublon['ssn'] = "SELECT SSN val FROM bios,hardware h WHERE h.id=bios.hardware_id AND SSN NOT IN (SELECT serial FROM blacklist_serials) "; $arg_doublon['ssn'] = array(); @@ -157,7 +154,6 @@ function groupBy($key, $data) { $arg_doublon['ssn'] = $sql['ARG']; } $sql_doublon['ssn'] .= " GROUP BY SSN HAVING COUNT(SSN)>1"; - /* * ********************** macaddress double ************************************** */ $sql_doublon['macaddress'] = "SELECT h.id, MACADDR val FROM (SELECT hardware_id,MACADDR FROM networks GROUP BY hardware_id,MACADDR) networks,hardware h @@ -169,7 +165,6 @@ function groupBy($key, $data) { $sql_doublon['macaddress'] = $sql['SQL']; $arg_doublon['macaddress'] = $sql['ARG']; } - /* * ***************************request execution**************************************** */ $sql_doublon['macaddress'] .= " GROUP BY MACADDR HAVING COUNT(MACADDR)>1"; foreach ($sql_doublon as $name => $sql_value) { @@ -178,7 +173,6 @@ function groupBy($key, $data) { $doublon[$name][] = $val->val; } } - //search id of computers => serial number if (isset($doublon['ssn'])) { $sql_id_doublon['ssn'] = " SELECT DISTINCT hardware_id id,SSN info1 FROM bios,hardware h WHERE h.id=bios.hardware_id AND SSN IN "; @@ -189,7 +183,6 @@ function groupBy($key, $data) { } else { $count_id['ssn'] = 0; } - ////search id of computers => macaddresses if (isset($doublon['macaddress'])) { $sql_id_doublon['macaddress'] = "SELECT DISTINCT CONCAT(hardware_id,MACADDR), hardware_id id,MACADDR info1 @@ -203,7 +196,6 @@ function groupBy($key, $data) { } else { $count_id['macaddress'] = 0; } - //search id of computers => hostname if (isset($doublon['hostname'])) { $sql_id_doublon['hostname'] = " SELECT id, NAME info1 @@ -217,7 +209,6 @@ function groupBy($key, $data) { } else { $count_id['hostname'] = 0; } - //search id of computers => hostname + serial number $sql_id_doublon['hostname_serial'] = "SELECT DISTINCT CONCAT(h.id,h.name,b.ssn), h.id,h.name info1,b.ssn info2 FROM hardware h @@ -227,13 +218,11 @@ function groupBy($key, $data) { WHERE b2.hardware_id = h2.id AND h.id <> h2.id AND b.ssn NOT IN (SELECT serial FROM blacklist_serials) "; $arg_id_doublon['hostname_serial'] = array(); - if (is_defined($tab_id_mes_machines)) { $sql = mysql2_prepare($sql_id_doublon['hostname_serial'] . ' AND h.id IN ', $arg_id_doublon['hostname_serial'], $tab_id_mes_machines); $sql_id_doublon['hostname_serial'] = $sql['SQL']; $arg_id_doublon['hostname_serial'] = $sql['ARG']; } - //search id of computers => hostname + mac address $sql_id_doublon['hostname_macaddress'] = "SELECT DISTINCT h.id,n.macaddr info1, h.name info2 FROM hardware h @@ -248,7 +237,6 @@ function groupBy($key, $data) { $sql_id_doublon['hostname_macaddress'] = $sql['SQL']; $arg_id_doublon['hostname_macaddress'] = $sql['ARG']; } - $sql_id_doublon['macaddress_serial'] = "SELECT DISTINCT h.id, n1.macaddr info1, b.ssn info2 FROM hardware h LEFT JOIN bios b ON b.hardware_id = h.id @@ -261,13 +249,11 @@ function groupBy($key, $data) { AND b.ssn NOT IN (SELECT serial FROM blacklist_serials) AND n1.macaddr NOT IN (SELECT macaddress FROM blacklist_macaddresses)"; $arg_id_doublon['macaddress_serial'] = array(); - if (is_defined($tab_id_mes_machines)) { $sql = mysql2_prepare($sql_id_doublon['macaddress_serial'] . ' AND h.id IN ', $arg_id_doublon['macaddress_serial'], $tab_id_mes_machines); $sql_id_doublon['macaddress_serial'] = $sql['SQL']; $arg_id_doublon['macaddress_serial'] = $sql['ARG']; } - foreach($sql_id_doublon as $name=>$sql_value){ $res = mysql2_query_secure($sql_value, $_SESSION['OCS']["readServer"],$arg_id_doublon[$name]); $count_id[$name] = 0; @@ -284,7 +270,6 @@ function groupBy($key, $data) { $list_info[$name][]=$val->info1; } } - $form_name='doublon'; $table_name='DOUBLON'; $tab_options=$protectedPost; @@ -292,19 +277,17 @@ function groupBy($key, $data) { $tab_options['table_name']=$table_name; echo open_form($form_name, '', '', 'form-horizontal'); echo "
"; - function returnTrad($lbl){ global $l; switch($lbl) { - case "hostname_serial": return $l->g(193); break; - case "hostname_macaddress": return $l->g(194); break; - case "macaddress_serial": return $l->g(195); break; - case "hostname": return $l->g(196); break; - case "ssn": return $l->g(197); break; - case "macaddress": return $l->g(198); break; + case "hostname_serial": return $l->g(193); + case "hostname_macaddress": return $l->g(194); + case "macaddress_serial": return $l->g(195); + case "hostname": return $l->g(196); + case "ssn": return $l->g(197); + case "macaddress": return $l->g(198); } } - // show number of duplis for each category (hostname, serial, etc.) foreach ($count_id as $lbl=>$count_value){ echo "
"; @@ -326,21 +309,19 @@ function returnTrad($lbl){ echo "
"; echo "
"; - if ($protectedPost['detail'] == $lbl and $count_value == 0) + if (isset($protectedPost['detail']) && $protectedPost['detail'] == $lbl and $count_value == 0) unset($protectedPost['detail']); } echo ""; -echo ""; - +echo ""; //show details for category -if ($protectedPost['detail'] != '') { +if (!empty($protectedPost['detail'])) { // category reminder echo "

". $l->g(9502) ." ".returnTrad($protectedPost['detail'])."

"; //BEGIN SHOW ACCOUNTINFO require_once('require/function_admininfo.php'); - $accountinfo_value = interprete_accountinfo($list_fields, $tab_options); - + $accountinfo_value = interprete_accountinfo($list_fields ?? array(), $tab_options); if (array($accountinfo_value['TAB_OPTIONS'])) { $tab_options = $accountinfo_value['TAB_OPTIONS']; } @@ -422,8 +403,7 @@ function returnTrad($lbl){ case "ssn": $criteria = 'ssn'; break; case "macaddress": $criteria = 'macaddr'; break; } - $grpDuplis = groupBy($criteria, $duplicates); - + $grpDuplis = groupBy($criteria ?? '', $duplicates); $i = 0; // iterate through each group of duplicates to build collapsible foreach ($grpDuplis as $item) { @@ -478,11 +458,8 @@ function returnTrad($lbl){ # echo "

"; echo ""; } - echo close_form(); - // END MODIF DUPLICATES if (AJAX) { ob_end_clean(); } -?> \ No newline at end of file diff --git a/plugins/main_sections/ms_export/ms_csv.php b/plugins/main_sections/ms_export/ms_csv.php index ffb745649..a47bfdd79 100644 --- a/plugins/main_sections/ms_export/ms_csv.php +++ b/plugins/main_sections/ms_export/ms_csv.php @@ -32,7 +32,7 @@ $toBeWritten = ""; // Export DB data -if (isset($_SESSION['OCS']['csv']['SQL'][$protectedGet['tablename']])) { +if (isset($protectedGet['tablename']) && isset($_SESSION['OCS']['csv']['SQL'][$protectedGet['tablename']])) { // Gestion des entetes foreach ($_SESSION['OCS']['visible_col'][$protectedGet['tablename']] as $name => $nothing) { @@ -67,7 +67,7 @@ } } - if ($_SESSION['OCS']['csv']['ARG'][$protectedGet['tablename']]) { + if (isset($_SESSION['OCS']['csv']['ARG'][$protectedGet['tablename']])) { $arg = $_SESSION['OCS']['csv']['ARG'][$protectedGet['tablename']]; } else { $arg = ''; @@ -141,15 +141,15 @@ } $i = 0; - while ($data[$i]) { + while (isset($data[$i])) { $toBeWritten .= "\r\n"; - foreach ($data[$i] as $field_name => $donnee) { + foreach ($data[$i] as $donnee) { if (substr($donnee, 0 , 1) != "\"") { $toBeWritten .= "\""; } // decode html entities (single and double quotes are preserved) $toBeWritten .= htmlspecialchars_decode($donnee, ENT_QUOTES); - if ($donnee[strlen($donnee)-1] != "\"") { + if (empty($donnee) || $donnee[strlen($donnee)-1] != "\"") { $toBeWritten .= "\""; } $toBeWritten .= $separator; diff --git a/plugins/main_sections/ms_export/ms_export_ocs.php b/plugins/main_sections/ms_export/ms_export_ocs.php index 32cb8746a..ecb830fad 100755 --- a/plugins/main_sections/ms_export/ms_export_ocs.php +++ b/plugins/main_sections/ms_export/ms_export_ocs.php @@ -43,20 +43,22 @@ $arg = array($tablename, $protectedGet['systemid']); $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); - while ($item = mysqli_fetch_object($res)) { - $xml .= "\t\t<" . mb_strtoupper($tablename) . ">\n"; - foreach ($_SESSION['OCS']['SQL_TABLE'][$tablename] as $field_name => $field_type) { - if ($field_name != 'HARDWARE_ID') { - if (replace_entity_xml($item->$field_name) != '') { - $xml .= "\t\t\t<" . $field_name . ">"; - $xml .= replace_entity_xml($item->$field_name); - $xml .= "\n"; - } else { - $xml .= "\t\t\t<" . $field_name . " />\n"; + if($res) { + while ($item = mysqli_fetch_object($res)) { + $xml .= "\t\t<" . mb_strtoupper($tablename) . ">\n"; + foreach ($_SESSION['OCS']['SQL_TABLE'][$tablename] as $field_name => $field_type) { + if ($field_name != 'HARDWARE_ID') { + if (replace_entity_xml($item->$field_name) != '') { + $xml .= "\t\t\t<" . $field_name . ">"; + $xml .= replace_entity_xml($item->$field_name); + $xml .= "\n"; + } else { + $xml .= "\t\t\t<" . $field_name . " />\n"; + } } } + $xml .= "\t\t\n"; } - $xml .= "\t\t\n"; } } } diff --git a/plugins/main_sections/ms_extensionmanager/ms_extensionmanager.php b/plugins/main_sections/ms_extensionmanager/ms_extensionmanager.php index f0e4671a8..47b859767 100755 --- a/plugins/main_sections/ms_extensionmanager/ms_extensionmanager.php +++ b/plugins/main_sections/ms_extensionmanager/ms_extensionmanager.php @@ -41,7 +41,7 @@ $extMgr = new ExtensionManager(); if($extMgr->checkPrerequisites()){ $extMgr->checkInstallableExtensions(); - + $extensions_errors = ''; if (!empty($extMgr->installableExtensions_errors)) { $extensions_errors .= '
'; } /** @@ -116,9 +116,8 @@ public function generateOptions($os, $linkedOption, $language) { $optionInfos = $this->packageBuilderParseXml->parseOptions($linkedOption); $html = '

'.$l->g(intval($optionInfos->name)).'


'; - $html .= $this->packageBuilderFormOptions->generateOptions($optionInfos, $l); - return $html; + return $html . $this->packageBuilderFormOptions->generateOptions($optionInfos, $l); } /** @@ -133,7 +132,7 @@ public function generateResume($packageInfos) { $html = '

Resume



'; - $html .= '
+ return $html . ('
@@ -156,8 +155,6 @@ public function generateResume($packageInfos) {
-
'; - - return $html; +
'); } } \ No newline at end of file diff --git a/require/teledeploy/PackageBuilderFormInteractions.php b/require/teledeploy/PackageBuilderFormInteractions.php index 55a092b45..7b00c0859 100644 --- a/require/teledeploy/PackageBuilderFormInteractions.php +++ b/require/teledeploy/PackageBuilderFormInteractions.php @@ -28,7 +28,8 @@ class PackageBuilderFormInteractions { private $packageBuilderParseXml; - function __construct($packageBuilderParseXml) { + function __construct($packageBuilderParseXml) + { $this->packageBuilderParseXml = $packageBuilderParseXml; } @@ -62,7 +63,7 @@ public function generateInteractionCollapse($interactions) { global $l; $html = ""; - $orderInteractions = $this->orderInteractions($interactions); + $this->orderInteractions($interactions); foreach($interactions as $interactionDetails) { $xmlInteractionDetails = $this->packageBuilderParseXml->parseInteractions($interactionDetails); $html .= '
diff --git a/require/teledeploy/PackageBuilderFormOperatingSystem.php b/require/teledeploy/PackageBuilderFormOperatingSystem.php index 096dc1fc8..ca0ceb380 100644 --- a/require/teledeploy/PackageBuilderFormOperatingSystem.php +++ b/require/teledeploy/PackageBuilderFormOperatingSystem.php @@ -32,8 +32,7 @@ class PackageBuilderFormOperatingSystem */ public function generateTile($system) { global $l; - - $tile = '
+ return ''; - return $tile; } } \ No newline at end of file diff --git a/require/teledeploy/PackageBuilderFormOptions.php b/require/teledeploy/PackageBuilderFormOptions.php index a2b9c4a00..85b60dee2 100644 --- a/require/teledeploy/PackageBuilderFormOptions.php +++ b/require/teledeploy/PackageBuilderFormOptions.php @@ -20,18 +20,11 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - - /** - * Class for PackageBuilderFormOptions - */ +/** + * Class for PackageBuilderFormOptions + */ class PackageBuilderFormOptions { - private $packageBuilderParseXml; - - function __construct($packageBuilderParseXml) { - $this->packageBuilderParseXml = $packageBuilderParseXml; - } - /** * Generate Options */ @@ -116,7 +109,6 @@ function changeLabelAction(){ "; } return $select; - break; case 'code': return '
@@ -142,7 +134,6 @@ function changeLabelAction(){ }); '; - break; default: return 'javascript.' '.$formblockDetails->mandatory.'>'; diff --git a/require/teledeploy/Teledeploy.php b/require/teledeploy/Teledeploy.php index 158cef36a..2843ecbb3 100644 --- a/require/teledeploy/Teledeploy.php +++ b/require/teledeploy/Teledeploy.php @@ -28,7 +28,7 @@ class Teledeploy { public function get_package($timestamp){ - $zipfile = new zipArchive(); + new zipArchive(); $sql_document_root = "SELECT tvalue FROM config WHERE NAME='DOWNLOAD_PACK_DIR'"; diff --git a/require/views/forms.php b/require/views/forms.php index a8b9f4252..8c80bf28f 100755 --- a/require/views/forms.php +++ b/require/views/forms.php @@ -25,7 +25,7 @@ function show_form_field($data, $errors, $type, $name, $label, $options = array( $id = str_replace(array('[', ']'), '_', $name); if (isset($errors[$id]) && $errors[$id]) { - echo '
'; + echo '
'; echo '
    '; foreach ($errors[$id] as $err) { @@ -34,7 +34,8 @@ function show_form_field($data, $errors, $type, $name, $label, $options = array( echo '
'; } else { - echo '
'; + $field_class = $options['field_class'] ?? null; + echo '
'; } if (is_defined($data[$name])) { diff --git a/tools/cron_mailer.php b/tools/cron_mailer.php index addfa224b..02f8c8c63 100644 --- a/tools/cron_mailer.php +++ b/tools/cron_mailer.php @@ -14,7 +14,7 @@ $week = array('MON' => 'Monday', 'TUE' => 'Tuesday', 'WED' => 'Wednesday', 'THURS' => 'Thursday', 'FRI' => 'Friday', 'SAT' => 'Saturday', 'SUN' => 'Sunday'); $values = $mail->get_info_smtp(); -foreach ($values as $key => $value){ +foreach ($values as $value){ if(array_key_exists($value, $week)){ $day[$week[$value]] = $week[$value]; } diff --git a/tools/recompose_paquet.php b/tools/recompose_paquet.php index 29a24cba6..11ae9c752 100755 --- a/tools/recompose_paquet.php +++ b/tools/recompose_paquet.php @@ -1,4 +1,5 @@ PROBLEME AVEC LE NOM DU FICHIER
"; $valid = 'KO'; } if (substr($info_traite[6], 0, 5) != 'FRAGS') { - "PROBLEME AVEC LE NOMBRE DE FRAGMENT
"; $valid = 'KO'; } $name = substr($name, 6); @@ -85,4 +83,3 @@ } else { echo "PAGE INDISPONIBLE"; } -?> \ No newline at end of file diff --git a/update.php b/update.php index 2d2bcb8d4..e64c6d131 100644 --- a/update.php +++ b/update.php @@ -72,7 +72,7 @@ while ($version_database < GUI_VER) { $version_database++; if (in_array($version_database . ".sql", $list_fichier['name'])) { - if ($_SESSION['OCS']['DEBUG'] == 'ON') { + if (isset($_SESSION['OCS']['DEBUG']) && $_SESSION['OCS']['DEBUG'] == 'ON') { msg_success("Mise à jour effectuée: " . $version_database . ".sql"); } exec_fichier_sql($rep_maj . '/' . $version_database . ".sql"); @@ -90,7 +90,7 @@ //Logout after update(s) //Contrib of FranciX (http://forums.ocsinventory-ng.org/viewtopic.php?pid=41923#p41923) - if ($_SESSION['OCS']['cnx_origine'] == "CAS") { + if (isset($_SESSION['OCS']['cnx_origine']) && $_SESSION['OCS']['cnx_origine'] == "CAS") { $sql_update = 'update'; require(BACKEND . 'AUTH/methode/cas.php'); $config = get_cas_config(); diff --git a/var.php b/var.php index d8a7596b5..3c0610106 100644 --- a/var.php +++ b/var.php @@ -78,7 +78,7 @@ /** * GUI Version */ -define('GUI_VER_SHOW', '2.9.2'); +define('GUI_VER_SHOW', '2.10.0'); /** * Default GUI language */