";
diff --git a/plugins/main_sections/ms_groups/ms_group_show.php b/plugins/main_sections/ms_groups/ms_group_show.php
index ffdfb909a..e7d1e9832 100644
--- a/plugins/main_sections/ms_groups/ms_group_show.php
+++ b/plugins/main_sections/ms_groups/ms_group_show.php
@@ -31,15 +31,19 @@
//BEGIN SHOW ACCOUNTINFO
require_once('require/function_admininfo.php');
-$accountinfo_value = interprete_accountinfo($list_fields, $tab_options);
-if (array($accountinfo_value['TAB_OPTIONS'])) {
- $tab_options = $accountinfo_value['TAB_OPTIONS'];
-}
-if (array($accountinfo_value['DEFAULT_VALUE'])) {
- $default_fields = $accountinfo_value['DEFAULT_VALUE'];
+if(isset($list_fields)) {
+ $accountinfo_value = interprete_accountinfo($list_fields, $tab_options);
+ if (array($accountinfo_value['TAB_OPTIONS'])) {
+ $tab_options = $accountinfo_value['TAB_OPTIONS'];
+
+ }
+ if (array($accountinfo_value['DEFAULT_VALUE'])) {
+ $default_fields = $accountinfo_value['DEFAULT_VALUE'];
+ }
+ $list_fields = $accountinfo_value['LIST_FIELDS'];
+ //END SHOW ACCOUNTINFO
}
-$list_fields = $accountinfo_value['LIST_FIELDS'];
-//END SHOW ACCOUNTINFO
+
$list_fields2 = array($l->g(949) => 'h.ID',
'DEVICEID' => 'h.DEVICEID',
@@ -61,16 +65,15 @@
$l->g(24) => 'h.userid',
$l->g(36) => 'b.ssn',
'CHECK' => 'h.ID');
-$list_fields = array_merge($list_fields, $list_fields2);
+$list_fields = isset($list_fields) ? array_merge($list_fields, $list_fields2) : $list_fields2;
$list_col_cant_del = array('NAME' => 'NAME', 'CHECK' => 'CHECK');
$default_fields2 = array('NAME' => 'NAME', $l->g(46) => $l->g(46), $l->g(820) => $l->g(820), $l->g(34) => $l->g(34), $l->g(24) => $l->g(24));
-$default_fields = array_merge($default_fields, $default_fields2);
+$default_fields = isset($default_fields) ? array_merge($default_fields, $default_fields2) : $default_fields2;
if (isset($protectedGet['systemid'])) {
$systemid = $protectedGet['systemid'];
if ($systemid == "") {
return $l->g(837);
- die();
}
} elseif (isset($protectedPost['systemid'])) {
$systemid = $protectedPost['systemid'];
@@ -106,7 +109,7 @@
}
//update values if user want modify groups' values
-if ($protectedPost['Valid_modif'] && !isset($protectedPost['modif']) && !isset($protectedPost['MODIF'])) {
+if (isset($protectedPost['Valid_modif']) && !isset($protectedPost['modif']) && !isset($protectedPost['MODIF'])) {
if (trim($protectedPost['NAME']) != '' && trim($protectedPost['DESCR']) != '') {
$req = "UPDATE hardware SET " .
"NAME='%s'," .
@@ -151,7 +154,7 @@
$tdpopup = "onclick=\"javascript: OuvrirPopup('group_chang_value.php', '', 'resizable=no, location=no, width=400, height=200, menubar=no, status=no, scrollbars=no, menubar=no')";
//if user clic on modify
-if ($protectedPost['MODIF_x']) {
+if (isset($protectedPost['MODIF_x'])) {
//don't show the botton modify
$img_modif = "";
//list of input we can modify
@@ -194,7 +197,7 @@
if ($item->XMLDEF != "") {
$tab_list_sql = regeneration_sql($item->XMLDEF);
$i = 1;
- while ($tab_list_sql[$i]) {
+ foreach ($tab_list_sql as $sql) {
$temp .= $i . ") => " . $tab_list_sql[$i];
$i++;
}
@@ -221,7 +224,7 @@
if ($_SESSION['OCS']['profile']->getConfigValue('GROUPS') == "YES") {
echo $button_valid;
- echo $button_reset;
+ echo $button_reset ?? '';
echo $img_modif;
}
@@ -364,7 +367,7 @@ function print_computers_real($systemid) {
$tab_list_sql = regeneration_sql($valGroup["xmldef"]);
$i = 1;
$tab_id = array();
- while ($tab_list_sql[$i]) {
+ while (isset($tab_list_sql[$i])) {
if ($tab_id != array()) {
if (strtolower(substr($tab_list_sql[$i], 0, 19)) == "select distinct id ") {
$tab_list_sql[$i] .= " and id in (" . implode(",", $tab_id) . ")";
@@ -498,7 +501,7 @@ function print_perso($systemid) {
}
- optpersoGroup('IPDISCOVER', $l->g(489), '', '', $default, $supp);
+ optpersoGroup('IPDISCOVER', $l->g(489), '', '', $default, $supp ?? '');
//FREQUENCY
if (isset($optPerso["FREQUENCY"])) {
@@ -515,7 +518,7 @@ function print_perso($systemid) {
$default = $l->g(497);
}
- optpersoGroup('FREQUENCY', $l->g(494), '', '', $default, $supp);
+ optpersoGroup('FREQUENCY', $l->g(494), '', '', $default, $supp ?? '');
//DOWNLOAD_SWITCH
if (isset($optPerso["DOWNLOAD_SWITCH"])) {
@@ -538,7 +541,7 @@ function print_perso($systemid) {
}
//DOWNLOAD
- optpersoGroup("DOWNLOAD", $l->g(417), "DOWNLOAD", '', $default, $supp);
+ optpersoGroup("DOWNLOAD", $l->g(417), "DOWNLOAD", '', $default, $supp ?? '');
if(isset($optPerso["DOWNLOAD_CYCLE_LATENCY"])){
$default = '';
@@ -549,7 +552,7 @@ function print_perso($systemid) {
}
//DOWNLOAD_CYCLE_LATENCY
- optpersoGroup("DOWNLOAD_CYCLE_LATENCY", $l->g(720), "DOWNLOAD_CYCLE_LATENCY", $optPerso, $default, $supp);
+ optpersoGroup("DOWNLOAD_CYCLE_LATENCY", $l->g(720), "DOWNLOAD_CYCLE_LATENCY", $optPerso ?? '', $default, $supp ?? '');
if(isset($optPerso['DOWNLOAD_FRAG_LATENCY']['IVALUE'])){
$default = '';
@@ -559,7 +562,7 @@ function print_perso($systemid) {
$supp = '';
}
//DOWNLOAD_FRAG_LATENCY
- optpersoGroup("DOWNLOAD_FRAG_LATENCY", $l->g(721), "DOWNLOAD_FRAG_LATENCY", $optPerso, $default, $supp);
+ optpersoGroup("DOWNLOAD_FRAG_LATENCY", $l->g(721), "DOWNLOAD_FRAG_LATENCY", $optPerso ?? '', $default, $supp ?? '');
if(isset($optPerso['DOWNLOAD_PERIOD_LATENCY']['IVALUE'])){
$default = '';
@@ -569,7 +572,7 @@ function print_perso($systemid) {
$supp = '';
}
//DOWNLOAD_PERIOD_LATENCY
- optpersoGroup("DOWNLOAD_PERIOD_LATENCY", $l->g(722), "DOWNLOAD_PERIOD_LATENCY", $optPerso, $default, $supp);
+ optpersoGroup("DOWNLOAD_PERIOD_LATENCY", $l->g(722), "DOWNLOAD_PERIOD_LATENCY", $optPerso ?? '', $default, $supp ?? '');
if(isset($optPerso['DOWNLOAD_PERIOD_LENGTH']['IVALUE'])){
@@ -580,7 +583,7 @@ function print_perso($systemid) {
$supp = '';
}
//DOWNLOAD_PERIOD_LENGTH
- optpersoGroup("DOWNLOAD_PERIOD_LENGTH", $l->g(723), "DOWNLOAD_PERIOD_LENGTH", $optPerso, $default, $supp);
+ optpersoGroup("DOWNLOAD_PERIOD_LENGTH", $l->g(723), "DOWNLOAD_PERIOD_LENGTH", $optPerso ?? '', $default, $supp ?? '');
if(isset($optPerso['PROLOG_FREQ']['IVALUE'])){
$default = '';
@@ -590,7 +593,7 @@ function print_perso($systemid) {
$supp = '';
}
//PROLOG_FREQ
- optpersoGroup("PROLOG_FREQ", $l->g(724), "PROLOG_FREQ", $optPerso, $default, $supp);
+ optpersoGroup("PROLOG_FREQ", $l->g(724), "PROLOG_FREQ", $optPerso ?? '', $default, $supp ?? '');
//SNMP_SWITCH
if (isset($optPerso["SNMP_SWITCH"])) {
@@ -604,7 +607,7 @@ function print_perso($systemid) {
}
} else {
$supp = '';
- if ($optdefault['ivalue']["SNMP"] == 1) {
+ if (isset($optdefault['ivalue']["SNMP"]) && $optdefault['ivalue']["SNMP"] == 1) {
$default = $l->g(205);
} else {
$default = $l->g(733);
diff --git a/plugins/main_sections/ms_groups/ms_groups.php b/plugins/main_sections/ms_groups/ms_groups.php
index 212d5eaa3..64ec11db2 100755
--- a/plugins/main_sections/ms_groups/ms_groups.php
+++ b/plugins/main_sections/ms_groups/ms_groups.php
@@ -32,7 +32,7 @@
require_once('require/function_groups.php');
require_once('require/function_computers.php');
//ADD new static group
-if ($protectedPost['Valid_modif']) {
+if (isset($protectedPost['Valid_modif'])) {
$result = creat_group($protectedPost['NAME'], $protectedPost['DESCR'], '', '', 'STATIC');
if ($result['RESULT'] == "ERROR") {
msg_error($result['LBL']);
@@ -43,7 +43,7 @@
$tab_options['CACHE'] = 'RESET';
}
//reset add static group
-if ($protectedPost['Reset_modif'] || ($protectedPost['onglet'] != $protectedPost['old_onglet'])) {
+if (isset($protectedPost['Reset_modif']) || (isset($protectedPost['onglet']) && isset($protectedPost['old_onglet']) && ($protectedPost['onglet'] != $protectedPost['old_onglet'] ))) {
unset($protectedPost['add_static_group']);
}
$tab_options = $protectedPost;
@@ -63,7 +63,7 @@
}
}
//if delete group
-if ($protectedPost['SUP_PROF'] != "") {
+if (!empty($protectedPost['SUP_PROF'])) {
$result = delete_group($protectedPost['SUP_PROF']);
if ($result['RESULT'] == "ERROR") {
msg_error($result['LBL']);
@@ -79,7 +79,7 @@
if ($_SESSION['OCS']['profile']->getConfigValue('GROUPS')=="YES"){
$def_onglets['DYNA']=$l->g(810); //Dynamic group
$def_onglets['STAT']=$l->g(809); //Static group centraux
- if ($protectedPost['onglet'] == "")
+ if (empty($protectedPost['onglet']))
$protectedPost['onglet']="STAT";
//show onglet
show_tabs($def_onglets,$form_name,"onglet",true);
@@ -192,8 +192,8 @@
g(577), '20', '', $protectedPost['NAME']);
- formGroup('text', 'DESCR', $l->g(53), '', '', $protectedPost['DESCR']);
+ formGroup('text', 'NAME', $l->g(577), '20', '', $protectedPost['NAME'] ?? '');
+ formGroup('text', 'DESCR', $l->g(53), '', '', $protectedPost['DESCR'] ?? '');
?>
diff --git a/plugins/main_sections/ms_help/ms_irc.php b/plugins/main_sections/ms_help/ms_irc.php
deleted file mode 100755
index 27a059463..000000000
--- a/plugins/main_sections/ms_help/ms_irc.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
-g(1123); ?>
-g(837));
require_once(FOOTER_HTML);
@@ -57,7 +57,7 @@
$data_on['ADMIN_SMTP']=$l->g(1205);
}
- if ($protectedPost['onglet'] != $protectedPost['old_onglet']) {
+ if ((isset($protectedPost['onglet']) && isset($protectedPost['old_onglet'])) && ($protectedPost['onglet'] != $protectedPost['old_onglet'])) {
unset($protectedPost['MODIF']);
}
@@ -80,7 +80,7 @@
$tab_options['CACHE'] = 'RESET';
}
if (isset($protectedPost['Valid_modif'])) {
- $result = $ipdiscover->add_subnet($protectedPost['ADD_IP'], $protectedPost['RSX_NAME'], $protectedPost['ID_NAME'], $protectedPost['ADD_SX_RSX'], $protectedPost['ADD_TAG']);
+ $result = $ipdiscover->add_subnet($protectedPost['ADD_IP'], $protectedPost['RSX_NAME'], $protectedPost['ID_NAME'], $protectedPost['ADD_SX_RSX'], $protectedPost['ADD_TAG'] ?? '');
if ($result) {
msg_error($result);
} else {
@@ -107,36 +107,36 @@
if (isset($protectedPost['ADD_SUB'])) {
echo "g(931);
$result = $ipdiscover->find_info_subnet($protectedPost['MODIF']);
if (!isset($protectedPost['RSX_NAME'])) {
- $protectedPost['RSX_NAME'] = $result->NAME;
+ $protectedPost['RSX_NAME'] = $result->NAME ?? '';
}
if (!isset($protectedPost['ID_NAME'])) {
- $protectedPost['ID_NAME'] = $result->ID;
+ $protectedPost['ID_NAME'] = $result->ID ?? 0;
}
if (!isset($protectedPost['ADD_TAG'])) {
- $protectedPost['ADD_TAG'] = $result->TAG;
+ $protectedPost['ADD_TAG'] = $result->TAG ?? '';
}
if (!isset($protectedPost['ADD_IP'])) {
- $protectedPost['ADD_IP'] = $result->NETID;
+ $protectedPost['ADD_IP'] = $result->NETID ?? '';
}
if (!isset($protectedPost['ADD_SX_RSX'])) {
- $protectedPost['ADD_SX_RSX'] = $result->MASK;
+ $protectedPost['ADD_SX_RSX'] = $result->MASK ?? '';
}
if (is_defined($protectedGet['value'])) {
$explode = explode(";", $protectedGet['value']);
$protectedPost['ADD_IP'] = $explode[0];
- $protectedPost['ADD_TAG'] = $explode[1];
+ $protectedPost['ADD_TAG'] = $explode[1] ?? '';
}
} else {
$title = $l->g(303);
@@ -159,14 +159,15 @@
$list_tag = $ipdiscover->get_tag();
$default_values = array(
- 'RSX_NAME' => $protectedPost['RSX_NAME'],
+ 'RSX_NAME' => $protectedPost['RSX_NAME'] ?? '',
'ID_NAME' => $list_subnet,
'ADD_TAG' => $list_tag,
- 'ADD_IP' => $protectedPost['ADD_IP'],
- 'ADD_SX_RSX' => $protectedPost['ADD_SX_RSX']
+ 'ADD_IP' => $protectedPost['ADD_IP'] ?? '',
+ 'ADD_SX_RSX' => $protectedPost['ADD_SX_RSX'] ?? ''
);
- $ipdiscover->form_add_subnet($title, $default_values, $form_name, $is_tag_linked['ivalue']['IPDISCOVER_LINK_TAG_NETWORK'], $protectedPost);
+
+ $ipdiscover->form_add_subnet($title, $default_values, $form_name, $is_tag_linked['ivalue']['IPDISCOVER_LINK_TAG_NETWORK'] ?? '', $protectedPost);
} else {
$sql = "SELECT NETID, NAME, ID, MASK, TAG, CONCAT(NETID,IFNULL(TAG, '')) as supsub FROM subnet";
@@ -204,7 +205,7 @@
}
if (isset($protectedPost['Valid_modif'])) {
- $result = $ipdiscover->add_type($protectedPost['TYPE_NAME'], $protectedPost['MODIF']);
+ $result = $ipdiscover->add_type($protectedPost['TYPE_NAME'], $protectedPost['MODIF'] ?? '');
if ($result) {
msg_error($result);
$protectedPost['ADD_TYPE'] = "VALID";
@@ -224,15 +225,15 @@
$info = $ipdiscover->find_info_type('', $protectedPost['MODIF']);
$protectedPost['TYPE_NAME'] = $info->NAME;
}
- $tab_typ_champ[0]['DEFAULT_VALUE'] = $protectedPost['TYPE_NAME'];
+ $tab_typ_champ[0]['DEFAULT_VALUE'] = $protectedPost['TYPE_NAME'] ?? '';
$tab_typ_champ[0]['INPUT_NAME'] = "TYPE_NAME";
$tab_typ_champ[0]['CONFIG']['SIZE'] = 60;
$tab_typ_champ[0]['CONFIG']['MAXLENGTH'] = 255;
$tab_typ_champ[0]['INPUT_TYPE'] = 0;
$tab_name[0] = $l->g(938) . ": ";
- $tab_hidden['pcparpage'] = $protectedPost["pcparpage"];
+ $tab_hidden['pcparpage'] = $protectedPost["pcparpage"] ?? 0;
modif_values($tab_name, $tab_typ_champ, $tab_hidden, array(
- 'title' => $title,
+ 'title' => $title ?? '',
'show_frame' => false
));
} else {
@@ -255,22 +256,23 @@
$result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
echo "";
+
}
}
/************************************* COMMUNITIES *************************************/
-if ($protectedPost['onglet'] == 'ADMIN_SMTP' && $_SESSION['OCS']['profile']->getConfigValue('MANAGE_SMTP_COMMUNITIES') == 'YES') {
+if ((isset($protectedPost['onglet']) && $protectedPost['onglet'] == 'ADMIN_SMTP') && $_SESSION['OCS']['profile']->getConfigValue('MANAGE_SMTP_COMMUNITIES') == 'YES') {
if (isset($protectedPost['Valid_modif'])) {
$msg_result = $ipdiscover->add_community(
- $protectedPost['MODIF'],
- $protectedPost['NAME'],
- $protectedPost['VERSION'],
- $protectedPost['USERNAME'],
- $protectedPost['AUTHPASSWD'],
- $protectedPost['AUTHPROTO'],
- $protectedPost['PRIVPROTO'],
- $protectedPost['LEVEL'],
- $protectedPost['PRIVPASSWD']
+ $protectedPost['MODIF'] ?? '',
+ $protectedPost['NAME'] ?? '',
+ $protectedPost['VERSION'] ?? '',
+ $protectedPost['USERNAME'] ?? '',
+ $protectedPost['AUTHPASSWD'] ?? '',
+ $protectedPost['AUTHPROTO'] ?? '',
+ $protectedPost['PRIVPROTO'] ?? '',
+ $protectedPost['LEVEL'] ?? '',
+ $protectedPost['PRIVPASSWD'] ?? ''
);
if (isset($msg_result['SUCCESS'])) {
unset($protectedPost['MODIF'], $protectedPost['ADD_COMM']);
@@ -298,7 +300,7 @@
msg_error($msg_error);
}
- if ($protectedPost['ADD_COMM'] == $l->g(116) || is_numeric($protectedPost['MODIF'])) {
+ if ((isset($protectedPost['ADD_COMM']) && $protectedPost['ADD_COMM'] == $l->g(116)) || (isset($protectedPost['MODIF']) && is_numeric($protectedPost['MODIF']))) {
$list_version = array('-1' => '2c', '1' => '1', '2' => '2', '3' => '3');
$list_authproto = array('md5' => 'MD5', 'sha' => 'SHA-1');
$list_privproto = array('des' => 'DES', 'aes' => 'AES');
@@ -324,17 +326,17 @@
$protectedPost['LEVEL'] = $info_com->LEVEL;
}
} else {
- $default_values = array('ID' => $protectedPost['ID'],
- 'NAME' => $protectedPost['NAME'],
+ $default_values = array('ID' => $protectedPost['ID'] ?? 0,
+ 'NAME' => $protectedPost['NAME'] ?? '',
'VERSION' => $list_version,
- 'USERNAME' => $protectedPost['USERNAME'],
+ 'USERNAME' => $protectedPost['USERNAME'] ?? '',
'LEVEL' => $list_level,
- 'AUTHPASSWD' => $protectedPost['AUTHPASSWD'],
+ 'AUTHPASSWD' => $protectedPost['AUTHPASSWD'] ?? '',
'AUTHPROTO' => $list_authproto,
- 'PRIVPASSWD' => $protectedPost['PRIVPASSWD'],
+ 'PRIVPASSWD' => $protectedPost['PRIVPASSWD'] ?? '',
'PRIVPROTO' => $list_privproto);
}
- $ipdiscover->form_add_community($title, $default_values, $form_name);
+ $ipdiscover->form_add_community($default_values, $form_name, $title);
} else {
$sql = "select * from snmp_communities";
$list_fields = array($l->g(277) => 'VERSION',
diff --git a/plugins/main_sections/ms_ipdiscover/ms_custom_info.php b/plugins/main_sections/ms_ipdiscover/ms_custom_info.php
index a8c87f0dd..b8840b764 100644
--- a/plugins/main_sections/ms_ipdiscover/ms_custom_info.php
+++ b/plugins/main_sections/ms_ipdiscover/ms_custom_info.php
@@ -29,7 +29,7 @@
require_once('require/function_ipdiscover.php');
-if (!isset($protectedPost['MODIF'])) {
+if (!isset($protectedPost['MODIF']) || (isset($protectedPost['MODIF']) && $protectedPost['MODIF'] == "")) {
echo "".$l->g(188)."";
}
@@ -49,7 +49,6 @@
if ($protectedGet['prov'] == "ident") {
//dismiss manufacturer name and mac to be able to remove it properly.
$exploded_data = explode(' ', $protectedPost['SUP_PROF']);
- //var_dump($exploded_data);
$protectedPost['SUP_PROF'] = $exploded_data[0];
}
@@ -72,7 +71,7 @@
}
if (!isset($ERROR)) {
- if ($protectedPost['USER_ENTER'] != '') {
+ if (!empty($protectedPost['USER_ENTER'])) {
$sql = "UPDATE network_devices
SET DESCRIPTION = '%s',
TYPE = '%s',
@@ -99,7 +98,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])) {
@@ -127,12 +126,15 @@
$protectedPost['USER'] = $val['USER'];
$protectedPost['MODIF_ID'] = $protectedPost['MODIF'];
}
- $tab_hidden['USER_ENTER'] = $protectedPost['USER'];
- $tab_hidden['MODIF_ID'] = $protectedPost['MODIF_ID'];
+
+ if(isset($protectedPost['USER']) && isset($protectedPost['MODIF_ID'])) {
+ $tab_hidden['USER_ENTER'] = $protectedPost['USER'];
+ $tab_hidden['MODIF_ID'] = $protectedPost['MODIF_ID'];
+ }
+
//si on est dans le cas d'une modif, on affiche le login qui a saisi la donnée
- if ($protectedPost['MODIF_ID'] != '') {
+ if (isset($protectedPost['MODIF_ID']) && $protectedPost['MODIF_ID'] != '') {
$tab_name[3] = $l->g(944) . ": ";
-
$title = $l->g(945);
} else {
$title = $l->g(946);
@@ -147,7 +149,7 @@
$tab_name = array($l->g(944), $l->g(95), $l->g(53), $l->g(66));
$name_field = array('USER', 'MAC', 'COMMENT', 'TYPE');
$type_field = array(13, 13, 0, 2);
- $value_field = array($protectedPost['USER'], $protectedPost['MODIF'], $protectedPost['COMMENT'], $list_type);
+ $value_field = array($protectedPost['USER'] ?? '', $protectedPost['MODIF'] ?? '', $protectedPost['COMMENT'] ?? '', $list_type ?? []);
$tab_typ_champ = show_field($name_field, $type_field, $value_field);
$tab_hidden['mac'] = $protectedPost['MODIF'];
@@ -157,7 +159,7 @@
foreach ($tab_typ_champ as $id => $values) {
if($tab_typ_champ[$id]["INPUT_TYPE"] == 2) {
- $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $protectedPost[$tab_typ_champ[$id]['INPUT_NAME']];
+ $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $protectedPost[$tab_typ_champ[$id]['INPUT_NAME']] ?? 0;
}
}
@@ -172,7 +174,7 @@
if (isset($protectedGet['value'])) {
$explode = explode(";", $protectedGet['value']);
$value_preg = preg_replace("/[^A-zA-Z0-9\._]/", "", $explode[0]);
- $tag = addslashes($explode[1]);
+ $tag = addslashes($explode[1] ?? '');
if ($protectedGet['prov'] == "no_inv") {
$title = $l->g(947);
@@ -231,16 +233,19 @@
$default_fields = array($l->g(34) => $l->g(34), $l->g(66) => $l->g(66), $l->g(53) => $l->g(53),
$l->g(95) => 'MAC', $l->g(232) => $l->g(232), $l->g(369) => $l->g(369), 'SUP' => 'SUP', 'MODIF' => 'MODIF');
} elseif ($protectedGet['prov'] == "inv" || $protectedGet['prov'] == "ipdiscover") {
- //BEGIN SHOW ACCOUNTINFO
- require_once('require/function_admininfo.php');
- $accountinfo_value = interprete_accountinfo($list_fields, $tab_options);
- if (array($accountinfo_value['TAB_OPTIONS']))
- $tab_options = $accountinfo_value['TAB_OPTIONS'];
- if (array($accountinfo_value['DEFAULT_VALUE']))
- $default_fields = $accountinfo_value['DEFAULT_VALUE'];
- $list_fields = $accountinfo_value['LIST_FIELDS'];
- $tab_options['FILTRE'] = array_flip($list_fields);
- //END SHOW ACCOUNTINFO
+ if(isset($list_fields)) {
+ //BEGIN SHOW ACCOUNTINFO
+ require_once('require/function_admininfo.php');
+ $accountinfo_value = interprete_accountinfo($list_fields, $tab_options);
+ if (array($accountinfo_value['TAB_OPTIONS']))
+ $tab_options = $accountinfo_value['TAB_OPTIONS'];
+ if (array($accountinfo_value['DEFAULT_VALUE']))
+ $default_fields = $accountinfo_value['DEFAULT_VALUE'];
+ $list_fields = $accountinfo_value['LIST_FIELDS'];
+ $tab_options['FILTRE'] = array_flip($list_fields);
+ //END SHOW ACCOUNTINFO
+ }
+
$list_fields2 = array($l->g(46) => "h.lastdate",
'NAME' => 'h.name',
$l->g(24) => "h.userid",
@@ -252,7 +257,7 @@
$l->g(557) => "h.userdomain");
$tab_options["replace_query_arg"]['MD5_DEVICEID'] = " md5(deviceid) ";
- $list_fields = array_merge($list_fields, $list_fields2);
+ $list_fields = isset($list_fields) ? array_merge($list_fields, $list_fields2) : $list_fields2;
$sql = prepare_sql_tab($list_fields);
$list_fields = array_merge($list_fields, array('MD5_DEVICEID' => "MD5_DEVICEID"));
$tab_options['ARG_SQL'] = $sql['ARG'];
diff --git a/plugins/main_sections/ms_ipdiscover/ms_ipdiscover.php b/plugins/main_sections/ms_ipdiscover/ms_ipdiscover.php
index 468d3667f..fab37d713 100644
--- a/plugins/main_sections/ms_ipdiscover/ms_ipdiscover.php
+++ b/plugins/main_sections/ms_ipdiscover/ms_ipdiscover.php
@@ -56,8 +56,7 @@
$list_index[$key] = $value;
}
asort($list_index);
-
- if ($protectedPost['onglet'] == "") {
+ if (!isset($protectedPost['onglet'])) {
$protectedPost['onglet'] = 1;
}
diff --git a/plugins/main_sections/ms_ipdiscover/ms_ipdiscover_analyse.php b/plugins/main_sections/ms_ipdiscover/ms_ipdiscover_analyse.php
index d7da5a108..e8135047b 100755
--- a/plugins/main_sections/ms_ipdiscover/ms_ipdiscover_analyse.php
+++ b/plugins/main_sections/ms_ipdiscover/ms_ipdiscover_analyse.php
@@ -52,7 +52,6 @@
$l->g(49) => "NAME",
$l->g(232) => "DATE",
$l->g(66) => "TYPE");
- $ret = array();
$ret = parse_xml_file($file_name, $tabBalises, "HOST");
if ($ret != array()) {
$sql = "select ";
diff --git a/plugins/main_sections/ms_layouts/ms_layouts.php b/plugins/main_sections/ms_layouts/ms_layouts.php
index 26d76c30f..d7e65877e 100644
--- a/plugins/main_sections/ms_layouts/ms_layouts.php
+++ b/plugins/main_sections/ms_layouts/ms_layouts.php
@@ -28,7 +28,11 @@
}
printEnTete($l->g(9907));
+
+$tab_options = $protectedPost;
$form_name = "layouts";
+$tab_options['form_name'] = $form_name;
+$tab_options['table_name'] = $form_name;
$layout = new Layout($protectedGet['value']);
//ADD new layout
@@ -38,17 +42,27 @@
if (!empty($dupli)) {
unset($protectedPost['Valid_modif']);
}
+}
+
+//delete layout
+if (isset($protectedPost['SUP_PROF']) && $protectedPost['SUP_PROF'] != '') {
+ $layout->deleteLayout($protectedPost['SUP_PROF']);
+ $tab_options['CACHE'] = 'RESET';
+}
+if (is_defined($protectedPost['del_check'])) {
+ $layout->deleteLayout($protectedPost['del_check']);
+ $tab_options['CACHE'] = 'RESET';
}
// if no layout has been added yet and user did not delete layout : show the form
if ((isset($protectedGet['tab']) && $protectedGet['tab'] == 'add') && (!isset($protectedPost['Valid_modif'])) && (!isset($protectedPost['SUP_PROF']) && !isset($protectedPost['del_check'])) && !isset($protectedPost['show_list'])) {
- echo open_form('layouts', '', '', 'form-horizontal');
+ echo open_form($form_name, '', '', 'form-horizontal');
?>
g(9911).' :', '', '', $protectedPost['LAYOUT_NAME'] ?? '');
+ formGroup('text', 'LAYOUT_DESCR', $l->g(9912).' :', '', '', $protectedPost['LAYOUT_DESCR'] ?? '');
?>
@@ -62,43 +76,27 @@
// show the table
} else {
- echo open_form('layouts', '', '', 'form-horizontal');
- //delete layout
- if (isset($protectedPost['SUP_PROF']) && $protectedPost['SUP_PROF'] != '') {
- $layout->deleteLayout($protectedPost['SUP_PROF']);
- $tab_options['CACHE'] = 'RESET';
- }
-
- if (is_defined($protectedPost['del_check'])) {
- $layout->deleteLayout($protectedPost['del_check']);
- $tab_options['CACHE'] = 'RESET';
- }
- $table_name = $form_name;
- $tab_options['form_name'] = $form_name;
- $tab_options['table_name'] = $table_name;
+ echo open_form($form_name, '', '', 'form-horizontal');
$list_fields = array(
- 'LAYOUT_NAME' => 'LAYOUT_NAME',
- 'USER' => 'USER',
- 'TABLE_NAME' => 'TABLE_NAME',
- 'DESCRIPTION' => 'DESCRIPTION',
+ $l->g(9911) => 'LAYOUT_NAME',
+ $l->g(243) => 'USER',
+ $l->g(9913) => 'TABLE_NAME',
+ $l->g(53) => 'DESCRIPTION',
+ 'SUP' => 'SUP',
+ 'CHECK' => 'CHECK'
);
- $list_col_cant_del = array(
- 'LAYOUT_NAME' => 'LAYOUT_NAME',
- 'USER' => 'USER',
- 'TABLE_NAME' => 'TABLE_NAME',
- 'SUP' => 'SUP',
- 'CHECK' => 'CHECK'
- );
+
+ $list_col_cant_del = $list_fields;
$list_fields['SUP'] = 'ID';
$list_fields['CHECK'] = 'ID';
+ $tab_options['LBL_POPUP']['SUP'] = 'LAYOUT_NAME';
$default_fields = $list_col_cant_del;
$queryDetails = "SELECT ID, LAYOUT_NAME, USER, TABLE_NAME, DESCRIPTION FROM `layouts` WHERE USER = '".$_SESSION['OCS']['loggeduser']."'";
ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
- $img['image/delete.png'] = $l->g(162);
del_selection($form_name);
echo close_form();
diff --git a/plugins/main_sections/ms_logs/ms_logs.php b/plugins/main_sections/ms_logs/ms_logs.php
index 6feaa5abe..3252556a2 100755
--- a/plugins/main_sections/ms_logs/ms_logs.php
+++ b/plugins/main_sections/ms_logs/ms_logs.php
@@ -1,4 +1,5 @@
g(766));
}
-
if (AJAX) {
ob_end_clean();
tab_req($list_fields, $default_fields, $list_col_cant_del, $sql, $tab_options);
}
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_multi_search/ms_custom_lock.php b/plugins/main_sections/ms_multi_search/ms_custom_lock.php
index 3b2c9d3fa..2f80f7525 100644
--- a/plugins/main_sections/ms_multi_search/ms_custom_lock.php
+++ b/plugins/main_sections/ms_multi_search/ms_custom_lock.php
@@ -37,7 +37,7 @@
echo "";
}
-if ($protectedPost['CHOISE'] != "") {
+if (isset($protectedPost['CHOISE']) && $protectedPost['CHOISE'] != "") {
echo " " . $l->g(978) . " ";
echo " ".$l->g(979)." ";
echo " ";
diff --git a/plugins/main_sections/ms_multi_search/ms_custom_sup.php b/plugins/main_sections/ms_multi_search/ms_custom_sup.php
index 53d5d7e7e..563bd2d8f 100644
--- a/plugins/main_sections/ms_multi_search/ms_custom_sup.php
+++ b/plugins/main_sections/ms_multi_search/ms_custom_sup.php
@@ -1,4 +1,5 @@
";
if (is_defined($protectedPost['SUP'])) {
$array_id = explode(',', $list_id);
- foreach ($array_id as $key => $hardware_id) {
+ foreach ($array_id as $hardware_id) {
deleteDid($hardware_id);
}
}
@@ -38,4 +39,3 @@
echo " ";
}
echo close_form();
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_multi_search/ms_custom_tag.php b/plugins/main_sections/ms_multi_search/ms_custom_tag.php
index 43c16a756..97ff2ef72 100644
--- a/plugins/main_sections/ms_multi_search/ms_custom_tag.php
+++ b/plugins/main_sections/ms_multi_search/ms_custom_tag.php
@@ -31,7 +31,6 @@
echo "";
$list_id = multi_lot($form_name, $l->g(601));
-
if (is_defined($list_id)) {
echo " ";
@@ -47,7 +46,7 @@
//cas of checkboxtag_search
foreach ($protectedPost as $field2 => $value2) {
$casofcheck = explode('_', $field2);
- if ($casofcheck[0] . '_' . $casofcheck[1] == $temp) {
+ if (isset($casofcheck[1]) && $casofcheck[0] . '_' . $casofcheck[1] == $temp) {
if (isset($casofcheck[2])) {
$data_fields_account[$temp] .= $casofcheck[2] . "&&&";
}
@@ -111,7 +110,7 @@
require_once('require/archive/ArchiveComputer.php');
$archive = new ArchiveComputer();
if (is_defined($protectedPost['ARCHIVER'])) {
- $result = $archive->archive($protectedGet['idchecked']);
+ $result = $archive->archive($list_id);
unset($protectedPost['ARCHIVER']);
if($result){
msg_success($l->g(572));
@@ -119,7 +118,7 @@
}
if (is_defined($protectedPost['RESTORE'])) {
- $result = $archive->restore($protectedGet['idchecked']);
+ $result = $archive->restore($list_id);
unset($protectedPost['RESTORE']);
if($result){
msg_success($l->g(572));
@@ -143,7 +142,7 @@
$def_onglets['ARCHIVE'] = $l->g(1556);
}
- if ($protectedPost['onglet'] == "") {
+ if (empty($protectedPost['onglet'])) {
$protectedPost['onglet'] = "TAG";
}
//show onglet
@@ -187,13 +186,13 @@
}
$tab_typ_champ[$i]['INPUT_NAME'] = $truename;
$tab_typ_champ[$i]['INPUT_TYPE'] = $field_of_accountinfo['LIST_TYPE'][$id];
- $tab_typ_champ[$i]['CONFIG']['JAVASCRIPT'] = $java . " onclick='document.getElementById(\"check" . $truename . "\").checked = true' ";
+ $tab_typ_champ[$i]['CONFIG']['JAVASCRIPT'] = ($java ?? '') . " onclick='document.getElementById(\"check" . $truename . "\").checked = true' ";
$tab_name[$i] = $lbl;
$i++;
}
}
- modif_values($tab_name, $tab_typ_champ, array('TAG_MODIF' => $protectedPost['MODIF'], 'FIELD_FORMAT' => $type_field[$protectedPost['MODIF']]), array(
+ modif_values($tab_name, $tab_typ_champ, array('TAG_MODIF' => $protectedPost['MODIF'] ?? '', 'FIELD_FORMAT' => $type_field[$protectedPost['MODIF'] ?? ''] ?? ''), array(
'title' => $l->g(895)
));
} elseif ($protectedPost['onglet'] == "SUP_PACK") {
@@ -201,6 +200,7 @@
from download_available d_a, download_enable d_e
where d_e.FILEID=d_a.FILEID group by d_a.NAME order by 1 desc";
$resultDetails = mysql2_query_secure($queryDetails, $_SESSION['OCS']["readServer"]);
+ $List = [];
while ($val = mysqli_fetch_array($resultDetails)) {
$List[$val["fileid"]] = $val["name"];
}
@@ -210,7 +210,7 @@
echo $select;
echo " ";
- if ($protectedPost['pack_list'] != "") {
+ if (!empty($protectedPost['pack_list'])) {
$sql = "select count(*) c, tvalue from download_enable d_e,devices d
where d.name='DOWNLOAD' and d.IVALUE=d_e.ID and d_e.fileid='%s'
and d.hardware_id in ";
@@ -240,10 +240,10 @@
$tab_name = array($l->g(8202));
$name_field = array("WOL_DATE");
$type_field = array(14);
- $value_field = '';
+ $value_field = array();
$tab_typ_champ = show_field($name_field, $type_field, $value_field, $config);
- modif_values($tab_name, $tab_typ_champ, $tab_hidden, array('show_button' => false));
+ modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? '', array('show_button' => false));
echo "";
echo " ";
} elseif ($protectedPost['onglet'] == "ARCHIVE") {
diff --git a/plugins/main_sections/ms_multi_search/ms_multi_search.php b/plugins/main_sections/ms_multi_search/ms_multi_search.php
index f7f82c4b3..f63003803 100644
--- a/plugins/main_sections/ms_multi_search/ms_multi_search.php
+++ b/plugins/main_sections/ms_multi_search/ms_multi_search.php
@@ -57,7 +57,7 @@
// Get search object to perform action and show result
//$legacySearch = new LegacySearch();
-$search = new Search($translationSearch, $databaseSearch, $accountinfoSearch, $groupSearch, $softwareSearch);
+$search = new Search($translationSearch, $databaseSearch, $accountInfoSearch, $groupSearch, $softwareSearch);
$sqlCache = new SQLCache($search, $softwareSearch);
$_SESSION['OCS']['DATE_FORMAT_LANG'] = $l->g(1270);
@@ -143,7 +143,7 @@
}
if(isset($protectedGet['fields'])){
- $search->link_index($protectedGet['fields'], $protectedGet['comp'], $protectedGet['values'], $protectedGet['values2']);
+ $search->link_index($protectedGet['fields'], $protectedGet['values'], $protectedGet['comp'], $protectedGet['values2']);
}
if(isset($protectedGet['prov'])){
@@ -160,7 +160,7 @@
}elseif($protectedGet['prov'] == 'stat'){
$options['idPackage'] = $databaseSearch->get_package_id($protectedGet['id_pack']);
$options['stat'] = $protectedGet['stat'];
- $search->link_multi($protectedGet['prov'], $protectedGet['value'], $options);
+ $search->link_multi($protectedGet['prov'], $protectedGet['value'] ?? null, $options);
}elseif($protectedGet['prov'] == 'saas'){
$search->link_multi($protectedGet['prov'], $protectedGet['value']);
}elseif($protectedGet['prov'] == 'querysave'){
@@ -181,21 +181,21 @@
}
foreach ($_SESSION['OCS']['multi_search'] as $table => $infos) {
- $i = 0;
-
+ $i = 0;
foreach ($infos as $uniqid => $values) {
?>
- returnFieldHtmlAndOr($uniqid, $values, $infos, $table, $values['comparator']);
- if($htmlComparator != ""){
- echo "
-
- ".$htmlComparator."
-
- ";
- }
- } ?>
+ returnFieldHtmlAndOr($uniqid, $values, $infos, $table, $values['comparator'] ?? null);
+ if($htmlComparator != ""){
+ echo "
+
+ ".$htmlComparator."
+
+ ";
+ }
+ } ?>
$value) {
foreach ($value as $k => $v) {
- if (is_null($v['value']) && $v['operator'] != "ISNULL") {
+ if (isset($v['value']) && (is_null($v['value'])) && $v['operator'] != "ISNULL") {
$isValid = false;
}
}
}
-if(($protectedPost['search_ok'] || $protectedGet['prov'] || $protectedGet['fields']) && $isValid){
+if((isset($protectedPost['search_ok']) || isset($protectedGet['prov']) || isset($protectedGet['fields'])) && $isValid){
unset($_SESSION['OCS']['SEARCH_SQL_GROUP']);
/**
* Generate Search fields
@@ -306,7 +306,7 @@
$option_comment['comment_be'] = $l->g(1210)." ";
$tab_options['REPLACE_VALUE'] = replace_tag_value('',$option_comment);
$tab_options['REPLACE_VALUE'][$l->g(66)] = $type_accountinfo;
- $tab_options['REPLACE_VALUE'][$l->g(1061)] = $array_tab_account;
+ // $tab_options['REPLACE_VALUE'][$l->g(1061)] = $array_tab_account;
ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
diff --git a/plugins/main_sections/ms_regconfig/ms_regconfig.php b/plugins/main_sections/ms_regconfig/ms_regconfig.php
index 535113b52..6ab4aae1e 100644
--- a/plugins/main_sections/ms_regconfig/ms_regconfig.php
+++ b/plugins/main_sections/ms_regconfig/ms_regconfig.php
@@ -48,7 +48,7 @@
$tab_options=$protectedPost;
show_tabs($tab,$form_name,"tab",true);
echo ' ';
-if ($ajax){
+if (isset($ajax)){
if (isset($protectedPost['REGKEY'])){
$protectedPost['tab']="VIEW";
}
@@ -123,13 +123,13 @@
formGroup('hidden', 'id', '', '', '', $protectedPost['MODIF'], '', '', '', '');
}
- formGroup('text', 'NAME', $l->g(252), '', 255, $protectedPost['NAME']);
+ formGroup('text', 'NAME', $l->g(252), '', 255, $protectedPost['NAME'] ?? '');
- formGroup('select', 'REGTREE', $l->g(253), '', '', $protectedPost['REGTREE'], '', $list_registry_key, $list_registry_key);
+ formGroup('select', 'REGTREE', $l->g(253), '', '', $protectedPost['REGTREE'] ?? '', '', $list_registry_key, $list_registry_key);
- formGroup('text', 'REGKEY', $l->g(254), '', 255, $protectedPost['REGKEY']);
+ formGroup('text', 'REGKEY', $l->g(254), '', 255, $protectedPost['REGKEY'] ?? '');
- formGroup('text', 'REGVALUE', $l->g(255), '', 255, $protectedPost['REGVALUE']);
+ formGroup('text', 'REGVALUE', $l->g(255), '', 255, $protectedPost['REGVALUE'] ?? '');
?>
diff --git a/plugins/main_sections/ms_regconfig/require/function_regconfig.php b/plugins/main_sections/ms_regconfig/require/function_regconfig.php
index c467f71e4..a57a70a42 100755
--- a/plugins/main_sections/ms_regconfig/require/function_regconfig.php
+++ b/plugins/main_sections/ms_regconfig/require/function_regconfig.php
@@ -55,7 +55,7 @@ function add_update_key($form_values, $update = false) {
$arg_verif = array($form_values["REGTREE"], $form_values["REGKEY"], $form_values["REGVALUE"]);
$res = mysql2_query_secure($sql_verif, $_SESSION['OCS']["readServer"], $arg_verif);
$row = mysqli_fetch_object($res);
- if (!is_numeric($row->ID)) {
+ if (!isset($row->ID)) {
$req = "INSERT INTO regconfig (NAME,REGTREE,REGKEY,REGVALUE)
VALUES('%s','%s','%s','%s')";
$arg_req = array($form_values["NAME"], $form_values["REGTREE"],
@@ -87,7 +87,7 @@ function delkey($id) {
$arg = $id;
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
$row = mysqli_fetch_object($res);
- $name = $row->name;
+ $name = $row->name ?? '';
//delete key
$sql_reg = "delete from regconfig where id =%s ";
mysql2_query_secure($sql_reg, $_SESSION['OCS']["writeServer"], $arg);
diff --git a/plugins/main_sections/ms_repart_tag/ms_repart_tag.php b/plugins/main_sections/ms_repart_tag/ms_repart_tag.php
index 5de34126e..f8f08188f 100755
--- a/plugins/main_sections/ms_repart_tag/ms_repart_tag.php
+++ b/plugins/main_sections/ms_repart_tag/ms_repart_tag.php
@@ -39,11 +39,11 @@
'EXCLUDE_ARCHIVE_COMPUTER' => 'EXCLUDE_ARCHIVE_COMPUTER'
];
-$excludeArchived = look_config_default_values($configToLookOut)['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'];
+$excludeArchived = look_config_default_values($configToLookOut)['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] ?? '';
//BEGIN SHOW ACCOUNTINFO
require_once('require/function_admininfo.php');
-$accountinfo_value = interprete_accountinfo($list_fields, $tab_options);
+$accountinfo_value = interprete_accountinfo($list_fields ?? null, $tab_options);
$list_fields = $accountinfo_value['LIST_FIELDS'];
$list_fields_flip = array_flip($list_fields);
diff --git a/plugins/main_sections/ms_saas_soft/ms_saas_soft.php b/plugins/main_sections/ms_saas_soft/ms_saas_soft.php
index e9bf363ae..09b726ffb 100644
--- a/plugins/main_sections/ms_saas_soft/ms_saas_soft.php
+++ b/plugins/main_sections/ms_saas_soft/ms_saas_soft.php
@@ -33,7 +33,7 @@
printEnTete($l->g(8100));
echo " ";
//ADD new static group
- if ($protectedPost['Valid_modif']) {
+ if (isset($protectedPost['Valid_modif'])) {
$result = $saas->add_saas($protectedPost['SAAS_NAME'], $protectedPost['DNS_SAAS']);
if (!$result) {
msg_error($l->g(8107));
@@ -44,14 +44,14 @@
$tab_options['CACHE'] = 'RESET';
}
//reset add saas
- if ($protectedPost['Reset_modif'] || ($protectedPost['onglet'] != $protectedPost['old_onglet'])) {
+ if (isset($protectedPost['Reset_modif']) || (isset($protectedPost['onglet']) && isset($protectedPost['old_onglet']) && ($protectedPost['onglet'] != $protectedPost['old_onglet']))) {
unset($protectedPost['SAAS_NAME']);
unset($protectedPost['DNS_SAAS']);
}
$tab_options = $protectedPost;
//if delete saas
- if ($protectedPost['SUP_PROF'] != "") {
+ if (!empty($protectedPost['SUP_PROF'])) {
$sqlQuery = "DELETE FROM `saas_exp` WHERE ID = %s";
$sqlArg = [$protectedPost['SUP_PROF']];
mysql2_query_secure($sqlQuery, $_SESSION['OCS']["writeServer"], $sqlArg);
@@ -69,7 +69,7 @@
$def_onglets['SAAS_LIST']=$l->g(8101); //Dynamic group
$def_onglets['SAAS_ADD']=$l->g(8102); //Static group centraux
- if ($protectedPost['onglet'] == ""){
+ if (empty($protectedPost['onglet'])){
$protectedPost['onglet']="SAAS_LIST";
}
@@ -94,7 +94,8 @@
$tab_options['LBL']['nb'] = $l->g(1120);
}elseif($protectedPost['onglet'] == "SAAS_ADD"){
-
+ $protectedPost['SAAS_NAME'] = isset($protectedPost['SAAS_NAME']) ? $protectedPost['SAAS_NAME'] : '';
+ $protectedPost['DNS_SAAS'] = isset($protectedPost['DNS_SAAS']) ? $protectedPost['DNS_SAAS'] : '';
?>
diff --git a/plugins/main_sections/ms_save_query/ms_save_query.php b/plugins/main_sections/ms_save_query/ms_save_query.php
index 3232084c4..a25a823d4 100644
--- a/plugins/main_sections/ms_save_query/ms_save_query.php
+++ b/plugins/main_sections/ms_save_query/ms_save_query.php
@@ -84,18 +84,18 @@
";
echo close_form();
-
if (AJAX) {
ob_end_clean();
}
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_snmp/require/function_snmp.php b/plugins/main_sections/ms_snmp/require/function_snmp.php
index a05c06b1d..c68c891dc 100755
--- a/plugins/main_sections/ms_snmp/require/function_snmp.php
+++ b/plugins/main_sections/ms_snmp/require/function_snmp.php
@@ -1,4 +1,5 @@
g(1215) => 'SNMP_BLADES', $l->g(1216) => 'SNMP_FIREWALLS', $l->g(1217) => 'SNMP_LOADBALANCERS',
$l->g(79) => 'SNMP_PRINTERS', $l->g(1218) => 'SNMP_SWITCHINFOS', $l->g(729) => 'SNMP_COMPUTERS');
-
$snmp_tables = array('SNMP_ACCOUNTINFO', 'SNMP_CARDS', 'SNMP_CARTRIDGES', 'SNMP_CPUS', 'SNMP_DRIVES',
'SNMP_FANS', 'SNMP_INPUTS', 'SNMP_LOCALPRINTERS', 'SNMP_MEMORIES',
'SNMP_MODEMS', 'SNMP_NETWORKS', 'SNMP_PORTS', 'SNMP_POWERSUPPLIES', 'SNMP_SOFTWARES',
'SNMP_SOUNDS', 'SNMP_STORAGES', 'SNMP_SWITCHS', 'SNMP_TRAYS', 'SNMP_VIDEOS', 'SNMP_VIRTUALMACHINES');
-
$all_snmp_table = array_merge($snmp_tables_type, $snmp_tables);
-
//is ID exist?
function info_snmp($snmp_id) {
global $l, $snmp_tables_type;
@@ -55,7 +53,6 @@ function info_snmp($snmp_id) {
return $array;
}
}
-
function subnet_name($systemid) {
if (!is_numeric($systemid))
return false;
@@ -68,7 +65,6 @@ function subnet_name($systemid) {
}
return $returnVal;
}
-
function print_item_header($text) {
echo " ";
echo "";
@@ -76,7 +72,6 @@ function print_item_header($text) {
echo " ";
echo " ";
}
-
function bandeau($data, $lbl_affich, $title = '', $class = 'mlt_bordure') {
$nb_col = 2;
$data_exist = false;
@@ -86,7 +81,7 @@ function bandeau($data, $lbl_affich, $title = '', $class = 'mlt_bordure') {
}
$show_table .= " ";
$i = 0;
- foreach ($data as $table => $values) {
+ foreach ($data as $values) {
if (is_object($values)) {
foreach ($values as $field => $field_value) {
$data_exist = true;
@@ -116,7 +111,6 @@ function bandeau($data, $lbl_affich, $title = '', $class = 'mlt_bordure') {
}
return false;
}
-
function deleteDid_snmp($id) {
global $all_snmp_table;
if (is_array($id)) {
@@ -135,12 +129,10 @@ function deleteDid_snmp($id) {
$del_sql = mysql2_prepare($sql, array(), $id_snmp, $nocot = true);
mysql2_query_secure($del_sql['SQL'], $_SESSION['OCS']["writeServer"], $del_sql['ARG'], true);
}
-
/*
* Find all accountinfo for
* snmp data
*/
-
function admininfo_snmp($id = "") {
global $l;
if (!is_numeric($id) && $id != "") {
@@ -156,10 +148,8 @@ function admininfo_snmp($id = "") {
}
$res_account_data = mysql2_query_secure($sql_account_data, $_SESSION['OCS']["readServer"], $arg_account_data);
- $val_account_data = mysqli_fetch_array($res_account_data);
- return $val_account_data;
+ return mysqli_fetch_array($res_account_data);
}
-
function updateinfo_snmp($id, $values, $list = '') {
global $l;
if (!is_numeric($id) && $list == '') {
@@ -184,5 +174,3 @@ function updateinfo_snmp($id, $values, $list = '') {
mysql2_query_secure($sql_account_data, $_SESSION['OCS']["writeServer"], $arg_account_data);
return $l->g(1121);
}
-
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_snmp_inventory/ms_snmp_inventory.php b/plugins/main_sections/ms_snmp_inventory/ms_snmp_inventory.php
index 62057b238..c94ff3453 100644
--- a/plugins/main_sections/ms_snmp_inventory/ms_snmp_inventory.php
+++ b/plugins/main_sections/ms_snmp_inventory/ms_snmp_inventory.php
@@ -41,7 +41,7 @@
//definition of onglet
foreach($typeList as $id => $values) {
$def_onglets[$id] = $values['TYPENAME'];
- if ($protectedPost['onglet'] == "") {
+ if (empty($protectedPost['onglet'])) {
$protectedPost['onglet'] = $id;
}
}
@@ -55,7 +55,7 @@
//show first lign of onglet
if($count < 15){
- show_tabs($def_onglets,$form_name,"onglet",true, $i);
+ show_tabs($def_onglets,$form_name,"onglet",true);
}
if ($count >= 15) {
@@ -94,7 +94,7 @@
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
- for($i = 0; $columns[$i] != null; $i++) {
+ for($i = 0; !empty($columns[$i]); $i++) {
if($i <= 3) {
$list_fields[$columns[$i]] = $columns[$i];
} else {
@@ -107,7 +107,7 @@
$list_col_cant_del = $list_fields;
$default_fields = $list_fields;
- if($list_fields2 != null) {
+ if(!empty($list_fields2)) {
$list_fields = array_merge($list_fields,$list_fields2);
}
diff --git a/plugins/main_sections/ms_soft_cat/ms_options_soft_cat.php b/plugins/main_sections/ms_soft_cat/ms_options_soft_cat.php
index aedbb8cf4..e08e33808 100644
--- a/plugins/main_sections/ms_soft_cat/ms_options_soft_cat.php
+++ b/plugins/main_sections/ms_soft_cat/ms_options_soft_cat.php
@@ -40,12 +40,15 @@
$MAX_RETURN = 10;
$i = 0;
-foreach ($liste as $element) {
- if ($i < $MAX_RETURN && strtolower(substr($element['NAME'], 0, strlen($debut))) == $debut) {
- echo(utf8_encode(""));
- $i++;
+if (!empty($liste)) {
+ foreach ($liste as $element) {
+ if ($i < $MAX_RETURN && strtolower(substr($element['NAME'], 0, strlen($debut))) == $debut) {
+ echo(utf8_encode(""));
+ $i++;
+ }
}
}
+
echo "\n" . '';
die();
?>
diff --git a/plugins/main_sections/ms_soft_cat/ms_soft_cat.php b/plugins/main_sections/ms_soft_cat/ms_soft_cat.php
index d04de3fcb..2b13b6eb6 100644
--- a/plugins/main_sections/ms_soft_cat/ms_soft_cat.php
+++ b/plugins/main_sections/ms_soft_cat/ms_soft_cat.php
@@ -49,11 +49,11 @@
$def_onglets['ADD_SOFT'] = $l->g(1503); //add soft to category
//default => first onglet
-if ($protectedPost['onglet'] == "") {
+if (!isset($protectedPost['onglet']) || $protectedPost['onglet'] == "") {
$protectedPost['onglet'] = "CAT_LIST";
}
//reset search
-if ($protectedPost['RESET'] == "RESET") {
+if (isset($protectedPost['RESET']) && $protectedPost['RESET'] == "RESET") {
unset($protectedPost['custom_search']);
}
//filtre
@@ -61,7 +61,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
@@ -86,9 +86,9 @@
$list_cat = $softCat->onglet_cat();
$i = $list_cat['i'];
- $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'] ?? '';
unset($list_cat['i']);
unset($list_cat['first_onglet']);
unset($list_cat['category_name']);
@@ -110,16 +110,16 @@
$list_cat = $softCat->onglet_cat();
$i = $list_cat['i'];
- $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'] ?? '';
unset($list_cat['i']);
unset($list_cat['first_onglet']);
unset($list_cat['category_name']);
unset($list_cat['OS']);
}
- if ($protectedPost['onglet_soft'] == "" || !isset($list_cat[$protectedPost['onglet_soft']])) {
+ if ((empty($protectedPost['onglet_soft'])) || !isset($list_cat[$protectedPost['onglet_soft']])) {
$protectedPost['onglet_soft'] = $first_onglet;
}
@@ -143,7 +143,7 @@
echo "g(640) . "\");'>" . $l->g(921) . "";
}
- if($os_version[$os[$list_cat[$protectedPost['onglet_soft']]]] != null){
+ if(!empty($protectedPost['onglet_soft'])){
echo "
".$l->g(274)." : ".$os_version[$os[$list_cat[$protectedPost['onglet_soft']]]]." ";
}else{
echo "
".$l->g(274)." : ".$l->g(1515)." ";
@@ -184,14 +184,14 @@
}
}
-/*******************************************LIST OF REAGEX*****************************************************/
+/*******************************************LIST OF REGEX*****************************************************/
if($protectedPost['onglet'] == 'REG_LIST'){
$list_cat = $softCat->onglet_cat();
$i = $list_cat['i'];
- $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'] ?? '';
unset($list_cat['i']);
unset($list_cat['first_onglet']);
unset($list_cat['category_name']);
@@ -222,15 +222,15 @@
unset($list_cat['OS']);
}
- if ($protectedPost['onglet_soft'] == "" || !isset($list_cat[$protectedPost['onglet_soft']])) {
+ if (!empty($list_cat) && (empty($protectedPost['onglet_soft']) || !isset($list_cat[$protectedPost['onglet_soft']]))) {
$protectedPost['onglet_soft'] = $first_onglet;
}
- if ($i <= 10) {
+ if ($i <= 10 && 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) . " ";
}
@@ -259,7 +259,7 @@
echo "g(640) . "\");'>" . $l->g(921) . "";
}
- if($os_version[$os[$list_cat[$protectedPost['onglet_soft']]]] != null){
+ if(!empty($protectedPost['onglet_soft']) && isset($os_version[$os[$list_cat[$protectedPost['onglet_soft']]]])){
echo "
".$l->g(274)." : ".$os_version[$os[$list_cat[$protectedPost['onglet_soft']]]]." ";
}else{
echo "
".$l->g(274)." : ".$l->g(1515)." ";
@@ -325,7 +325,7 @@
if(isset($protectedPost['valid_reg'])){
if($protectedPost['cat_select'] != 0){
- $result_reg = $softCat->insert_exp($protectedPost['cat_select'], $protectedPost['regular_exp'],$protectedPost['version_sign'], $protectedPost['version_soft'],$protectedPost['vendor_soft']);
+ $result_reg = $softCat->insert_exp($protectedPost['cat_select'], $protectedPost['regular_exp'],$protectedPost['version_sign'] ?? '', $protectedPost['version_soft'] ?? '',$protectedPost['vendor_soft'] ?? '');
if($result_reg == true){
msg_success($l->g(572));
unset($protectedPost['regular_exp']);
@@ -359,19 +359,19 @@
unset($protectedPost['vendor_soft']);
}
- formGroup('select', 'cat_select', $l->g(388).' :', '', '',$protectedPost['cat_select'] , '', $select_cat, $select_cat, 'required');
- formGroup('text', 'regular_exp', $l->g(382).' :', '', '', $protectedPost['regular_exp'], '', '', '', $resend);
+ formGroup('select', 'cat_select', $l->g(388).' :', '', '',$protectedPost['cat_select'] ?? 0, '', $select_cat, $select_cat, 'required');
+ formGroup('text', 'regular_exp', $l->g(382).' :', '', '', $protectedPost['regular_exp'] ?? '', '', '', '', $resend);
echo "".$l->g(358)." ";
echo ''.$l->g(1509).' ';
if(isset($protectedPost['advanced'])){
- $version = $softCat->search_version($protectedPost['regular_exp']);
- $vendor = $softCat->search_vendor($protectedPost['regular_exp']);
+ $version = $softCat->search_version($protectedPost['regular_exp'] ?? '');
+ $vendor = $softCat->search_vendor($protectedPost['regular_exp'] ?? '');
- formGroup('select', 'version_sign', $l->g(1510).' :', '', '',$protectedPost['version_sign'] , '', $operatorsArray, $operatorsArray);
- formGroup('select', 'version_soft', $l->g(1507).' :', '', '', $protectedPost['version_soft'], '', $version, $version);
- formGroup('select', 'vendor_soft', $l->g(1508).' :', '', '', $protectedPost['vendor_soft'], '', $vendor, $vendor);
+ formGroup('select', 'version_sign', $l->g(1510).' :', '', '',$protectedPost['version_sign'] ?? 0, '', $operatorsArray, $operatorsArray);
+ formGroup('select', 'version_soft', $l->g(1507).' :', '', '', $protectedPost['version_soft'] ?? 0, '', $version, $version);
+ formGroup('select', 'vendor_soft', $l->g(1508).' :', '', '', $protectedPost['vendor_soft'] ?? 0, '', $vendor, $vendor);
}
echo "";
diff --git a/plugins/main_sections/ms_teledeploy/ms_custom_pack.php b/plugins/main_sections/ms_teledeploy/ms_custom_pack.php
index 8e66ae138..12ca892cd 100644
--- a/plugins/main_sections/ms_teledeploy/ms_custom_pack.php
+++ b/plugins/main_sections/ms_teledeploy/ms_custom_pack.php
@@ -40,13 +40,15 @@
$ids = explode(',', $ids);
} else {
$ids = (array)$ids;
- if (info($protectedGet, $ids)->DEVICEID == '_SYSTEMGROUP_') {
+ $info = info($protectedGet, $ids);
+ if (isset($info) && $info->DEVICEID == '_SYSTEMGROUP_') {
$text_selection = $l->g(9202);
} else {
$text_selection = $l->g(9200);
}
}
+$name = '';
foreach ($ids as $value) {
$protectedPost['systemid'] = $value;
$item = info($protectedGet, $protectedPost['systemid']);
@@ -55,15 +57,10 @@
echo " $text_selection : ";
-?>
-
-
- {$name}
- "
-?>
+echo "
+ {$name}
+ ";
- '', 'NO' => $l->g(454), 'YES' => $l->g(455));
- formGroup('select', 'DWL_OPT', $l->g(1292), '', '', $protectedPost['DWL_OPT'], '', $selectValues, $selectValues);
+ formGroup('select', 'DWL_OPT', $l->g(1292), '', '', $protectedPost['DWL_OPT'] ?? '', '', $selectValues, $selectValues);
?>
'e.FILEID',
'INFO_LOC' => 'e.INFO_LOC',
diff --git a/plugins/main_sections/ms_teledeploy/ms_tele_activate.php b/plugins/main_sections/ms_teledeploy/ms_tele_activate.php
index 06f282117..09e11f97a 100644
--- a/plugins/main_sections/ms_teledeploy/ms_tele_activate.php
+++ b/plugins/main_sections/ms_teledeploy/ms_tele_activate.php
@@ -55,7 +55,7 @@
$data_on['AVAILABLE_PACKET'] = $l->g(2123);
$data_on['DELETED_PACKET'] = $l->g(2124);
-if ($protectedPost['onglet'] != $protectedPost['old_onglet']) {
+if (isset($protectedPost['onglet']) && isset($protectedPost['old_onglet']) && ($protectedPost['onglet'] != $protectedPost['old_onglet'])) {
unset($protectedPost['MODIF']);
}
@@ -90,13 +90,13 @@
$fragOk = true;
}
- if ($fragAvail) {
+ if (isset($fragOk) && !is_bool($fragAvail)) {
fclose($fragOk);
}
}
if (isset($protectedPost['Valid_modif']) || isset($protectedPost['YES'])) {
- if ($protectedPost['choix_activ'] == "MAN") {
+ if (isset($protectedPost['choix_activ']) && $protectedPost['choix_activ'] == "MAN") {
activ_pack($protectedGet["active"], $protectedPost["HTTPS_SERV"], $protectedPost['FILE_SERV']);
}
echo "";
@@ -109,12 +109,12 @@
if ($protectedPost['onglet'] == "AVAILABLE_PACKET") {
//only for profils who can activate packet
if (!$cant_active) {
- if ($protectedPost["SUP_PROF"] != "") {
+ if (!empty($protectedPost["SUP_PROF"])) {
del_pack($protectedPost["SUP_PROF"]);
$tab_options['CACHE'] = 'RESET';
}
//delete more than one packet
- if ($protectedPost['del_check'] != '') {
+ if (!empty($protectedPost['del_check'])) {
foreach (explode(",", $protectedPost['del_check']) as $key) {
del_pack($key);
$tab_options['CACHE'] = 'RESET';
@@ -122,7 +122,7 @@
}
}
- if (!$protectedPost['SHOW_SELECT']) {
+ if (!isset($protectedPost['SHOW_SELECT'])) {
$protectedPost['SHOW_SELECT'] = 'download';
$tab_options['SHOW_SELECT'] = 'download';
}
@@ -148,7 +148,7 @@
$config_document_root = "DOWNLOAD_REP_CREAT";
}
$info_document_root = look_config_default_values($config_document_root);
- $document_root = $info_document_root["tvalue"][$config_document_root];
+ $document_root = $info_document_root["tvalue"][$config_document_root] ?? '';
//if no directory in base, take $_SERVER["DOCUMENT_ROOT"]
if (!isset($document_root)) {
$document_root = VARLIB_DIR . '/download';
@@ -167,7 +167,7 @@
$tab_options['SHOW_ONLY']['ZIP'][$f] = $f;
}
}
- if (!$tab_options['SHOW_ONLY']['ZIP']) {
+ if (isset($tab_options['SHOW_ONLY']['ZIP']) && !$tab_options['SHOW_ONLY']['ZIP']) {
$tab_options['SHOW_ONLY']['ZIP'] = 'NULL';
}
} else {
@@ -280,7 +280,7 @@ function manualActive()
'SUCC' => $l->g(572),
'ERR_' => $l->g(344));
$tab_options['REQUEST']['STAT'] = 'select distinct fileid AS FIRST from devices d,download_enable de where d.IVALUE=de.ID ';
- if ($restrict_computers) {
+ if (isset($restrict_computers)) {
$tab_options['REQUEST']['STAT'] .= 'and d.hardware_id in ';
$temp = mysql2_prepare($tab_options['REQUEST']['STAT'], array(), $restrict_computers);
$tab_options['ARG']['STAT'] = $temp['ARG'];
@@ -291,7 +291,7 @@ function manualActive()
$tab_options['REQUEST']['SHOWACTIVE'] = 'select distinct fileid AS FIRST from download_enable';
$tab_options['FIELD']['SHOWACTIVE'] = 'FILEID';
//on force le tri desc pour l'ordre des paquets
- if (!$protectedPost['sens_' . $table_name]) {
+ if (!isset($protectedPost['sens_' . $table_name])) {
$protectedPost['sens_' . $table_name] = 'DESC';
}
@@ -314,7 +314,7 @@ function manualActive()
$_SESSION['OCS']['ARG_DATA_FIXE'][$table_name]['NOTI'] = array('NOTI', 'LIKE', 'NOTI%');
$_SESSION['OCS']['ARG_DATA_FIXE'][$table_name]['NO_NOTIF'] = array('NO_NOTIF', 'IS NULL');
- if ($restrict_computers) {
+ if (isset($restrict_computers)) {
$sql_data_fixe .= " and d.hardware_id in ";
$sql_data_fixe_bis .= " and d.hardware_id in ";
$sql_data_fixe_ter .= " and d.hardware_id in ";
@@ -323,7 +323,7 @@ function manualActive()
$temp_ter = mysql2_prepare($sql_data_fixe_ter, array(), $restrict_computers);
}
foreach ($_SESSION['OCS']['ARG_DATA_FIXE'][$table_name] as $key => $value) {
- if ($restrict_computers) {
+ if (isset($restrict_computers)) {
if ($key != 'NO_NOTIF' && $key != 'ERR_') {
$_SESSION['OCS']['ARG_DATA_FIXE'][$table_name][$key] = array_merge($_SESSION['OCS']['ARG_DATA_FIXE'][$table_name][$key], $temp['ARG']);
$_SESSION['OCS']['SQL_DATA_FIXE'][$table_name][$key] = $temp['SQL'] . " group by FILEID";
diff --git a/plugins/main_sections/ms_teledeploy/ms_tele_actives.php b/plugins/main_sections/ms_teledeploy/ms_tele_actives.php
index f7d0203fb..fbab46b64 100644
--- a/plugins/main_sections/ms_teledeploy/ms_tele_actives.php
+++ b/plugins/main_sections/ms_teledeploy/ms_tele_actives.php
@@ -1,4 +1,5 @@
getRestriction('TELEDIFF_ACTIVATE') == 'NO') {
$cant_active = false;
} else {
$cant_active = true;
}
-
if (!$cant_active) {
- if ($protectedPost['DEL_ALL'] != '') {
+ if (!empty($protectedPost['DEL_ALL'])) {
$sql_listIDdel = "select distinct ID from download_enable where FILEID=%s";
$arg_listIDdel = $protectedPost['DEL_ALL'];
$res_listIDdel = mysql2_query_secure($sql_listIDdel, $_SESSION['OCS']["readServer"], $arg_listIDdel);
@@ -44,14 +42,14 @@
$listIDdel[] = $val_listIDdel['ID'];
}
if ($listIDdel != '') {
- foreach ($listIDdel as $k => $v) {
+ foreach ($listIDdel as $v) {
desactive_packet('', $v);
}
}
mysql2_query_secure("DELETE FROM download_enable WHERE FILEID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['DEL_ALL']);
echo "";
}
- if ($protectedPost['SUP_PROF'] != '') {
+ if (!empty($protectedPost['SUP_PROF'])) {
desactive_packet('', $protectedPost['SUP_PROF']);
mysql2_query_secure("DELETE FROM download_enable WHERE ID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['SUP_PROF']);
}
@@ -102,4 +100,3 @@
ob_end_clean();
tab_req($list_fields, $default_fields, $list_col_cant_del, $querypack, $tab_options);
}
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_teledeploy/ms_tele_popup_active.php b/plugins/main_sections/ms_teledeploy/ms_tele_popup_active.php
index e32bef4d5..4aae26ea6 100755
--- a/plugins/main_sections/ms_teledeploy/ms_tele_popup_active.php
+++ b/plugins/main_sections/ms_teledeploy/ms_tele_popup_active.php
@@ -29,11 +29,11 @@
//ouverture du formulaire
echo open_form($form_name, $action_redirect, '', 'form-horizontal');
- if ((!isset($protectedPost['FILE_SERV']) && $protectedPost['choix_activ'] == 'MAN') || !isset($protectedPost['HTTPS_SERV'])) {
+ if ((!isset($protectedPost['FILE_SERV']) && isset($protectedPost['choix_activ']) && $protectedPost['choix_activ'] == 'MAN') || !isset($protectedPost['HTTPS_SERV'])) {
$default = $_SERVER["SERVER_ADDR"] . "/download";
$values = look_config_default_values(array('DOWNLOAD_URI_INFO', 'DOWNLOAD_URI_FRAG'));
- $protectedPost['FILE_SERV'] = $values['tvalue']['DOWNLOAD_URI_FRAG'];
- $protectedPost['HTTPS_SERV'] = $values['tvalue']['DOWNLOAD_URI_INFO'];
+ $protectedPost['FILE_SERV'] = $values['tvalue']['DOWNLOAD_URI_FRAG'] ?? '';
+ $protectedPost['HTTPS_SERV'] = $values['tvalue']['DOWNLOAD_URI_INFO'] ?? '';
if ($protectedPost['FILE_SERV'] == "") {
$protectedPost['FILE_SERV'] = $default;
}
@@ -68,13 +68,12 @@
}
}
}
- modif_values($tab_name, $tab_typ_champ, $tab_hidden, array(
+ modif_values($tab_name, $tab_typ_champ, $tab_hidden ?? '', array(
'title' => $l->g(465) . ' => ' . $info_id['NAME'] . " (" . $protectedGet["active"] . ")"
));
}
}
- //var_dump($tab_typ_champ);
//fermeture du formulaire.
echo close_form();
} else {
diff --git a/plugins/main_sections/ms_teledeploy/ms_tele_stats.php b/plugins/main_sections/ms_teledeploy/ms_tele_stats.php
index 78a61c7a6..80953fb42 100644
--- a/plugins/main_sections/ms_teledeploy/ms_tele_stats.php
+++ b/plugins/main_sections/ms_teledeploy/ms_tele_stats.php
@@ -157,6 +157,7 @@
" . $l->g(55) . " |
";
$j = 0;
+$nb = 0;
while ($j < $i) {
$nb += $count_value[$j];
echo "";
diff --git a/plugins/main_sections/ms_teledeploy/views/package_form_view.php b/plugins/main_sections/ms_teledeploy/views/package_form_view.php
index 4fb35fb39..0512f330f 100755
--- a/plugins/main_sections/ms_teledeploy/views/package_form_view.php
+++ b/plugins/main_sections/ms_teledeploy/views/package_form_view.php
@@ -1,4 +1,5 @@
';
}
-
function show_basic_info_frame($data, $errors) {
global $l;
@@ -162,7 +160,6 @@ function show_basic_info_frame($data, $errors) {
echo '';
}
-
function show_deploy_speed_frame($data, $errors) {
global $l;
@@ -196,8 +193,6 @@ function show_deploy_speed_frame($data, $errors) {
echo '';
}
-
-
function show_user_messages_frame($data, $errors) {
global $l;
@@ -258,5 +253,3 @@ function show_user_messages_frame($data, $errors) {
echo '';
echo '';
}
-
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_upload_file/ms_local_import.php b/plugins/main_sections/ms_upload_file/ms_local_import.php
index 8df689360..31928210f 100644
--- a/plugins/main_sections/ms_upload_file/ms_local_import.php
+++ b/plugins/main_sections/ms_upload_file/ms_local_import.php
@@ -1,4 +1,5 @@
g(1258));
-
$form_name="insert_computers";
-
echo open_form($form_name, '', '', 'form-horizontal');
-
echo "
";
-
//list fields for form
$form_fields_typeinput = array(
'COMPUTER_NAME_GENERIC' => $l->g(35),
@@ -70,17 +66,15 @@
}
}
//cas of checkbox
- if ($check_trait != array()) {
- foreach ($check_trait as $key => $value) {
- $fields[] = $key;
- $values_fields[] = $value;
- }
+ foreach ($check_trait as $key => $value) {
+ $fields[] = $key;
+ $values_fields[] = $value;
}
$i = 0;
while ($i < $protectedPost['NB_COMPUTERS']) {
$id_computer = insert_manual_computer($protectedPost,$protectedPost['NB_COMPUTERS']);
- if (!is_array($fields)) {
+ if (!isset($fields)) {
$fields[] = 'TAG';
$values_fields[] = '';
}
@@ -92,17 +86,15 @@
msg_error($l->g(684)." ".$error);
}
}
-
$i = 0;
$info_form['FIELDS']['name_field'][$i] = 'NB_COMPUTERS';
$info_form['FIELDS']['type_field'][$i] = 0;
-$info_form['FIELDS']['value_field'][$i] = ($protectedPost['NB_COMPUTERS'] != '' ? $protectedPost['NB_COMPUTERS']:'1');
+$info_form['FIELDS']['value_field'][$i] = (!empty($protectedPost['NB_COMPUTERS']) ? $protectedPost['NB_COMPUTERS']:'1');
$info_form['FIELDS']['tab_name'][$i] = $l->g(28);
$config[$i]['CONFIG']['SIZE'] = 4;
$config[$i]['CONFIG']['MAXLENGTH'] = 4;
$other_data['COMMENT_AFTER'][$i] = '';
$config[$i]['CONFIG']['JAVASCRIPT'] = $chiffres;
-
foreach ($form_fields_typeinput as $key => $value) {
$i++;
$info_form['FIELDS']['name_field'][$i] = $key;
@@ -116,9 +108,7 @@
$config[$i]['CONFIG']['SIZE'] = 30;
$other_data['COMMENT_AFTER'][$i] = '_M';
}
-
$accountinfo_form = show_accountinfo('','COMPUTERS','5');
-
//merge data
$info_form['FIELDS']['name_field'] = array_merge($info_form['FIELDS']['name_field'], $accountinfo_form['FIELDS']['name_field']);
$info_form['FIELDS']['type_field'] = array_merge($info_form['FIELDS']['type_field'], $accountinfo_form['FIELDS']['type_field']);
@@ -126,20 +116,15 @@
$info_form['FIELDS']['tab_name'] = array_merge($info_form['FIELDS']['tab_name'], $accountinfo_form['FIELDS']['tab_name']);
$config = array_merge($config, $accountinfo_form['CONFIG']);
$other_data['COMMENT_AFTER'] = array_merge($other_data['COMMENT_AFTER'], $accountinfo_form['COMMENT_AFTER']);
-
$tab_typ_champ = show_field($info_form['FIELDS']['name_field'], $info_form['FIELDS']['type_field'], $info_form['FIELDS']['value_field']);
-
foreach($config as $key=>$value) {
$tab_typ_champ[$key]['CONFIG'] = $value['CONFIG'];
$tab_typ_champ[$key]['COMMENT_AFTER'] = $other_data['COMMENT_AFTER'][$key];
}
-
if(isset($tab_typ_champ)) {
- modif_values($info_form['FIELDS']['tab_name'], $tab_typ_champ,$tab_hidden, array(
+ modif_values($info_form['FIELDS']['tab_name'], $tab_typ_champ,$tab_hidden ?? '', array(
'show_frame' => false
));
}
-
echo " ";
echo close_form();
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_users/lib/profile_functions.php b/plugins/main_sections/ms_users/lib/profile_functions.php
index 1a9f94a80..709a744d5 100644
--- a/plugins/main_sections/ms_users/lib/profile_functions.php
+++ b/plugins/main_sections/ms_users/lib/profile_functions.php
@@ -108,7 +108,9 @@ function remove_profile($profile_id) {
if (!is_writable(PROFILES_DIR)) {
msg_error($l->g(2116));
} else {
- unlink(PROFILES_DIR . $profile_id . '.xml');
+ if(file_exists(PROFILES_DIR . $profile_id . '.xml')) {
+ unlink(PROFILES_DIR . $profile_id . '.xml');
+ }
}
}
diff --git a/plugins/main_sections/ms_users/ms_custom_perim.php b/plugins/main_sections/ms_users/ms_custom_perim.php
index 470b3969f..b4ed6e3a1 100644
--- a/plugins/main_sections/ms_users/ms_custom_perim.php
+++ b/plugins/main_sections/ms_users/ms_custom_perim.php
@@ -1,4 +1,5 @@
$value) {
+ foreach ($info_tag as $value) {
$info_value_tag = accountinfo_tab($value['id']);
if (is_array($info_value_tag)) {
$tab_options['REPLACE_VALUE'][$value['comment']] = $info_value_tag;
@@ -48,9 +47,8 @@
}
}
//END SHOW ACCOUNTINFO
-
printEnTete($l->g(616) . " " . $protectedGet["id"]);
-if ($protectedPost['newtag'] != "") {
+if (isset($protectedPost['newtag']) && $protectedPost['newtag'] != "") {
if (isset($protectedPost['use_generic_0'])) {
if (is_array($info_value_tag)) {
$arg = str_replace(array("*", "?"), "", $protectedPost["newtag"]);
@@ -78,7 +76,6 @@
unset($protectedPost['newtag']);
}
-
//suppression d'une liste de tag
if (is_defined($protectedPost['del_check'])) {
$sql = "DELETE FROM tags WHERE tag in ";
@@ -89,24 +86,20 @@
mysql2_query_secure($sql['SQL'], $_SESSION['OCS']["writeServer"], $sql['ARG']);
$tab_options['CACHE'] = 'RESET';
}
-
if (isset($protectedPost['SUP_PROF'])) {
$sql = "DELETE FROM tags WHERE tag='%s' AND login='%s'";
$arg = array($protectedPost['SUP_PROF'], $protectedGet["id"]);
mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg);
}
echo " ";
-
echo open_form($form_name);
$list_fields = array('TAG' => 'tag',
);
-
$tab_options['FILTRE'] = array_flip($list_fields);
$tab_options['FILTRE']['NAME'] = $l->g(49);
asort($tab_options['FILTRE']);
$list_fields['SUP'] = 'tag';
$list_fields['CHECK'] = 'tag';
-
$list_col_cant_del = array('SUP' => 'SUP', 'CHECK' => 'CHECK');
$default_fields = array('TAG' => 'tag');
$sql = prepare_sql_tab($list_fields, $list_col_cant_del);
@@ -115,18 +108,15 @@
$tab_options['ARG_SQL'] = $sql['ARG'];
$queryDetails = $sql['SQL'];
$tab_options['LBL']['SUP'] = $l->g(122);
-
ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
$img['image/delete.png'] = $l->g(162);
del_selection($form_name);
-
if (is_array($info_value_tag) && !isset($protectedPost['use_generic_0'])) {
$type = 2;
} else {
$type = 0;
- $info_value_tag = $protectedPost['newtag'];
+ $info_value_tag = $protectedPost['newtag'] ?? "";
}
-
echo "";
echo " ";
$select_choise = show_modif($info_value_tag, 'newtag', $type);
@@ -137,9 +127,7 @@
echo " ";
echo " ";
echo close_form();
-
if (AJAX) {
ob_end_clean();
tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options);
}
-?>
\ No newline at end of file
diff --git a/plugins/main_sections/ms_users/ms_profiles.php b/plugins/main_sections/ms_users/ms_profiles.php
index e06f51d45..8693d16bc 100644
--- a/plugins/main_sections/ms_users/ms_profiles.php
+++ b/plugins/main_sections/ms_users/ms_profiles.php
@@ -32,7 +32,7 @@
global $l;
// Remove a profile ?
-if ($protectedGet['action'] == 'delete') {
+if (isset($protectedGet['action']) && $protectedGet['action'] == 'delete') {
remove_profile($protectedGet['profile_id']);
}
diff --git a/plugins/main_sections/ms_users/ms_users.php b/plugins/main_sections/ms_users/ms_users.php
index 962006bc7..128f98bc2 100755
--- a/plugins/main_sections/ms_users/ms_users.php
+++ b/plugins/main_sections/ms_users/ms_users.php
@@ -47,16 +47,16 @@
$data_on[5] = $l->g(1146);
}
+ if (!isset($protectedPost['onglet']) || $protectedPost['onglet'] == "") {
+ $protectedPost['onglet'] = current($data_on);
+ }
+
$form_name = "admins";
$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
echo open_form($form_name, '', '', 'form-horizontal');
$table_name = "TAB_ACCESSLVL" . $protectedPost['onglet'];
- if ($protectedPost['onglet'] == "") {
- $protectedPost['onglet'] = current($data_on);
- }
-
//suppression d'une liste de users
if (is_defined($protectedPost['del_check'])) {
delete_list_user($protectedPost['del_check']);
@@ -113,7 +113,7 @@
$user_groups[$val_user_groups['IVALUE']] = $val_user_groups['TVALUE'];
}
- $tab_options['REPLACE_VALUE'][$l->g(607)] = $user_groups;
+ $tab_options['REPLACE_VALUE'][$l->g(607)] = $user_groups ?? null;
$tab_options['LBL']['SUP'] = $l->g(122);
$tab_options['LBL']['CHECK'] = $l->g(1119);
diff --git a/plugins/main_sections/ms_users/views/profile_create_form.php b/plugins/main_sections/ms_users/views/profile_create_form.php
index a0b8ba3d5..6724c8f5c 100755
--- a/plugins/main_sections/ms_users/views/profile_create_form.php
+++ b/plugins/main_sections/ms_users/views/profile_create_form.php
@@ -37,9 +37,9 @@ function show_profile_create_form() {
echo open_form('create-profile', '#', '', 'form-horizontal');
- formGroup('text', 'name', $l->g(1396), '', '', $protectedPost['name']);
- formGroup('text', 'label', $l->g(1397), '', '', $protectedPost['label']);
- formGroup('select', 'duplicate_profile', $l->g(1398), '', '', $protectedPost['duplicate_profile'], '', get_profile_labels(), get_profile_labels());
+ formGroup('text', 'name', $l->g(1396), '', '', $protectedPost['name'] ?? "");
+ formGroup('text', 'label', $l->g(1397), '', '', $protectedPost['label'] ?? "");
+ formGroup('select', 'duplicate_profile', $l->g(1398), '', '', $protectedPost['duplicate_profile'] ?? "admin", '', get_profile_labels(), get_profile_labels());
?>
diff --git a/plugins/snmp_detail/sd_powersupplies/sd_powersupplies.php b/plugins/snmp_detail/sd_powersupplies/sd_powersupplies.php
index 681e2378c..85448301a 100755
--- a/plugins/snmp_detail/sd_powersupplies/sd_powersupplies.php
+++ b/plugins/snmp_detail/sd_powersupplies/sd_powersupplies.php
@@ -36,7 +36,6 @@
}
$table_name = "sd_powersupplies";
$tab_options = $protectedPost;
-$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
$list_fields = array($l->g(64) => 'MANUFACTURER',
@@ -58,4 +57,4 @@
tab_req($list_fields, $default_fields, $list_col_cant_del, $sql['SQL'], $tab_options);
ob_start();
}
-?>
\ No newline at end of file
+?>
diff --git a/require/CSV.class.php b/require/CSV.class.php
index e67cdaef0..6d620242a 100644
--- a/require/CSV.class.php
+++ b/require/CSV.class.php
@@ -15,7 +15,8 @@ class CSV {
function __construct() {
$values = look_config_default_values($this->champs);
- $this->separator = $values['tvalue']['EXPORT_SEP'];
+
+ $this->separator = ($values['tvalue']['EXPORT_SEP'] ?? ";");
// in case tmp dir path has not been set and created yet, tmp dir will be created at /var/lib/ocsinventory-reports/tmp_dir/
if (isset($values['tvalue']['TMP_DIR'])) {
$this->file_path = $values['tvalue']['TMP_DIR'];
diff --git a/require/archive/ArchiveComputer.php b/require/archive/ArchiveComputer.php
index 43a7fd873..fd286c709 100644
--- a/require/archive/ArchiveComputer.php
+++ b/require/archive/ArchiveComputer.php
@@ -90,10 +90,8 @@ public function restore($ids) {
public function isArchived($ids) {
$sql = "SELECT * FROM archive WHERE HARDWARE_ID = %s";
-
- $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $ids);
- return $result;
+ return mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $ids);
}
}
\ No newline at end of file
diff --git a/require/assets/AssetsCategory.php b/require/assets/AssetsCategory.php
index 2daf2afc9..dae13feea 100644
--- a/require/assets/AssetsCategory.php
+++ b/require/assets/AssetsCategory.php
@@ -33,6 +33,8 @@ public function get_assets(){
$sql = "SELECT * FROM assets_categories";
$result = mysqli_query($_SESSION['OCS']["readServer"], $sql);
+ $list_asset = [];
+
while ($item_asset = mysqli_fetch_array($result)) {
$list_asset[$item_asset['ID']]['CATEGORY_NAME'] = $item_asset['CATEGORY_NAME'];
$list_asset[$item_asset['ID']]['SQL_QUERY'] = $item_asset['SQL_QUERY'];
@@ -43,8 +45,8 @@ public function get_assets(){
}
public function get_computer_assets($list_asset){
-
- foreach($list_asset as $key => $values){
+ $nb_computer = array();
+ foreach($list_asset as $values){
$nb = [];
$asset = explode(",", $values['SQL_ARGS']);
$result_computer = mysql2_query_secure($values['SQL_QUERY'], $_SESSION['OCS']["readServer"], $asset);
@@ -68,7 +70,7 @@ public function get_table_html_asset($nb_computer){
';
if($nb_computer != null){
- foreach($nb_computer as $key => $value){
+ foreach($nb_computer as $value){
foreach($value as $name => $nb){
$this->html .= '
'.$name.' |
diff --git a/require/charts/StatsChartsRenderer.php b/require/charts/StatsChartsRenderer.php
index 18ba3747d..aa185da43 100644
--- a/require/charts/StatsChartsRenderer.php
+++ b/require/charts/StatsChartsRenderer.php
@@ -65,11 +65,7 @@ public function createChartCanvas($name, $legend = true, $offset = true){
$mainClass = "col-md-6 col-sm-6";
}
- if($offset){
- $offset = "";
- }else{
- $offset = "";
- }
+ $offset = "";
?>
@@ -142,7 +138,7 @@ public function createChart($chart, $seen = null, $quants_seen = null, $man = nu
},
title: {
display: true,
- text: ""
+ text: ""
},
animation: {
animateScale: true,
@@ -227,14 +223,14 @@ public function createChart($chart, $seen = null, $quants_seen = null, $man = nu
";
}
diff --git a/require/function_admininfo.php b/require/function_admininfo.php
index 3720ac747..f2677092d 100644
--- a/require/function_admininfo.php
+++ b/require/function_admininfo.php
@@ -37,22 +37,12 @@
'11' => 'VARCHAR(255)'
);
-$array_qr_values = array('URL' => $l->g(646),
- 'NAME' => $l->g(35),
- 'UID' => $l->g(1268),
- 'IPADDR' => $l->g(34));
-$array_qr_action = array('URL' => array('TYPE' => 'url', 'VALUE' => OCSREPORT_URL . "/index.php?" . PAG_INDEX . "=" . $pages_refs['ms_computer'] . "&head=1&systemid=" . $_GET['systemid']),
- 'NAME' => array('TYPE' => 'bdd', 'VALUE' => "hardware.name"),
- 'UID' => array('TYPE' => 'bdd', 'VALUE' => "hardware.uuid"),
- 'IPADDR' => array('TYPE' => 'bdd', 'VALUE' => "hardware.ipaddr"));
-
function accountinfo_tab($id) {
$info_tag = find_info_accountinfo($id);
if ($info_tag[$id]['type'] == 2
or $info_tag[$id]['type'] == 5
or $info_tag[$id]['type'] == 11) {
- $info = find_value_field('ACCOUNT_VALUE_' . $info_tag[$id]['name']);
- return $info;
+ return find_value_field('ACCOUNT_VALUE_' . $info_tag[$id]['name']);
} elseif ($info_tag[$id]['type'] == 8) {
return false;
}
@@ -120,9 +110,9 @@ function del_accountinfo($id) {
$arg_found_account_type = $id;
$result = mysql2_query_secure($sql_found_account_type, $_SESSION['OCS']["readServer"], $arg_found_account_type);
$val = mysqli_fetch_array($result);
- if ($val['account_type'] == "SNMP") {
+ if (isset($val['account_type']) && $val['account_type'] == "SNMP") {
$table = "snmp_accountinfo";
- } elseif ($val['account_type'] == "COMPUTERS") {
+ } elseif (isset($val['account_type']) && $val['account_type'] == "COMPUTERS") {
$table = "accountinfo";
} else {
return false;
@@ -168,7 +158,7 @@ function find_all_account_tab($tab_value, $onlyactiv = '', $first = '') {
}
$array_tab_account[$val_tab_account['IVALUE']] = $val_tab_account['TVALUE'];
}
- return $array_tab_account;
+ return $array_tab_account ?? '';
}
function find_value_field($name, $type = null) {
@@ -354,8 +344,6 @@ function dde_exist($name, $id = '', $type) {
//name can't be null
return $l->g(1068);
}
-
- return;
}
/*
@@ -431,8 +419,7 @@ function changeDateFormat($lang, $val){
$tab = array("fr_FR", "br_BR", "it_IT", "pl_PL", "pt_PT", "ru_RU", "si_SI", "es_ES", "tr_TR");
if(in_array($lang, $tab)){
$tab2 = explode("/", $val);
- $ret = $tab2[1]."/".$tab2[0]."/".$tab2[2];
- return $ret;
+ return $tab2[1]."/".$tab2[0]."/".$tab2[2];
}else{
return $val;
}
@@ -460,7 +447,7 @@ function show_accountinfo($id = '', $type = '', $exclu_type = '') {
$name_field[$i] = 'fields_' . $value;
} else {
$name_field[$i] = $v['name'];
- $value_field[$i] = $protectedPost[$v['name']];
+ $value_field[$i] = $protectedPost[$v['name']] ?? '';
}
break;
case "type":
@@ -496,7 +483,7 @@ function show_accountinfo($id = '', $type = '', $exclu_type = '') {
}
}
if (!isset($value_field[$i])) {
- $value_field[$i] = $protectedPost['fields_' . $v['id']];
+ $value_field[$i] = $protectedPost['fields_' . $v['id']] ?? '';
}
$i++;
}
@@ -538,7 +525,11 @@ function replace_tag_value($type = '', $option = array()) {
}
}
}
- return $tab_options;
+
+ if(isset($tab_options)) {
+ return $tab_options;
+ }
+
}
function find_value_in_field($tag, $value_2_find, $type = 'COMPUTERS') {
@@ -585,9 +576,7 @@ function interprete_accountinfo($list_fields, $tab_options) {
*
*/
function adminData_to_input($typeID){
-
switch ($typeID){
-
case '2':
return 'select';
case '4':
diff --git a/require/function_commun.php b/require/function_commun.php
index 25da98ad4..1a7784af9 100644
--- a/require/function_commun.php
+++ b/require/function_commun.php
@@ -35,13 +35,17 @@ function look_config_default_values($field_name, $like = '', $default_values = '
$arg['ARG'] = $field_name;
}
$resdefaultvalues = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["readServer"], $arg['ARG']);
- while ($item = mysqli_fetch_object($resdefaultvalues)) {
- $result['name'][$item->NAME] = $item->NAME;
- $result['ivalue'][$item->NAME] = $item->IVALUE;
- $result['tvalue'][$item->NAME] = $item->TVALUE;
- $result['comments'][$item->NAME] = $item->COMMENTS;
+
+ if ($resdefaultvalues != '') {
+ while ($item = mysqli_fetch_object($resdefaultvalues)) {
+ $result['name'][$item->NAME] = $item->NAME;
+ $result['ivalue'][$item->NAME] = $item->IVALUE;
+ $result['tvalue'][$item->NAME] = $item->TVALUE;
+ $result['comments'][$item->NAME] = $item->COMMENTS;
+ }
}
+
if (is_array($default_values)) {
foreach ($default_values as $key => $value) {
$key = strtolower($key);
@@ -55,7 +59,9 @@ function look_config_default_values($field_name, $like = '', $default_values = '
}
}
- return $result;
+ if (isset($result)) {
+ return $result;
+ }
}
/* * ****************************************************SQL FUNCTION*************************************************** */
@@ -66,7 +72,7 @@ function generate_secure_sql($sql, $arg = '') {
foreach ($arg as $value) {
$arg_array_escape_string[] = mysqli_real_escape_string($_SESSION['OCS']["readServer"], $value);
}
- $arg_escape_string = $arg_array_escape_string;
+ $arg_escape_string = $arg_array_escape_string ?? null;
} elseif ($arg != '') {
$arg_escape_string = mysqli_real_escape_string($_SESSION['OCS']["readServer"], $arg);
}
@@ -87,7 +93,7 @@ function mysql2_query_secure($sql, $link, $arg = '', $log = false) {
addLog($log, $query, $lbl_log);
}
- if ($_SESSION['OCS']['DEBUG'] == 'ON') {
+ if (isset($_SESSION['OCS']['DEBUG']) && $_SESSION['OCS']['DEBUG'] == 'ON') {
$_SESSION['OCS']['SQL_DEBUG'][] = html_entity_decode($query, ENT_QUOTES);
}
@@ -102,7 +108,7 @@ function mysql2_query_secure($sql, $link, $arg = '', $log = false) {
}
}
$result = mysqli_query($link, $query);
- if ($_SESSION['OCS']['DEBUG'] == 'ON' && !$result) {
+ if (isset($_SESSION['OCS']['DEBUG']) && $_SESSION['OCS']['DEBUG'] == 'ON' && !$result) {
msg_error(mysqli_error($link));
}
return $result;
@@ -168,7 +174,7 @@ function dbconnect($server, $compte_base, $pswd_base, $db = DB_NAME, $sslkey = S
$connect = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
}
} else {
- $connect = NULL;
+ $connect = 0;
}
$dbc->options(MYSQLI_INIT_COMMAND, "SET NAMES 'utf8'");
@@ -213,17 +219,20 @@ function dbGetFTIndex($tableName, $tableAlias) {
/* * *********************************END SQL FUNCTION***************************************** */
function addLog($type, $value = "", $lbl_sql = '') {
- if ($_SESSION['OCS']['LOG_GUI'] == 1) {
+ if (isset($_SESSION['OCS']['LOG_GUI']) && $_SESSION['OCS']['LOG_GUI'] == 1) {
//if (is_writable(LOG_FILE)) {
$logHandler = fopen(LOG_FILE, "a");
- $dte = getDate();
- $date = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $dte["mday"], $dte["mon"], $dte["year"], $dte["hours"], $dte["minutes"], $dte["seconds"]);
- if ($lbl_sql != '') {
- $value = $lbl_sql . ' => ' . $value;
+ if(!empty($logHandler)) {
+ $dte = getDate();
+ $date = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $dte["mday"], $dte["mon"], $dte["year"], $dte["hours"], $dte["minutes"], $dte["seconds"]);
+ if ($lbl_sql != '') {
+ $value = $lbl_sql . ' => ' . $value;
+ }
+ $towite = ($_SESSION['OCS']["loggeduser"] ?? ' '). ";" . $date . ";" . DB_NAME . ";" . $type . ";" . $value . ";" . $_SERVER['REMOTE_ADDR'] . ";\n";
+ fwrite($logHandler, $towite);
+ fclose($logHandler);
}
- $towite = $_SESSION['OCS']["loggeduser"] . ";" . $date . ";" . DB_NAME . ";" . $type . ";" . $value . ";" . $_SERVER['REMOTE_ADDR'] . ";\n";
- fwrite($logHandler, $towite);
- fclose($logHandler);
+
//}
}
}
@@ -289,8 +298,7 @@ function read_files($search, $ms_cfg_file, $writable = '') {
}
if (file_exists($ms_cfg_file)) {
- $profil_data = read_configuration($ms_cfg_file, $search);
- return $profil_data;
+ return read_configuration($ms_cfg_file, $search);
} else {
return false;
}
@@ -299,11 +307,11 @@ function read_files($search, $ms_cfg_file, $writable = '') {
function msg($txt, $css, $closeid = false) {
global $protectedPost;
- if (is_defined($protectedPost['close_alert'])) {
+ if (isset($protectedPost['close_alert']) && is_defined($protectedPost['close_alert'])) {
$_SESSION['OCS']['CLOSE_ALERT'][$protectedPost['close_alert']] = 1;
}
- if (!$_SESSION['OCS']['CLOSE_ALERT'][$closeid]) {
+ if (!isset($_SESSION['OCS']['CLOSE_ALERT'][$closeid])) {
echo " ";
if ($closeid != false) {
echo " ";
@@ -342,9 +350,11 @@ function msg_error($txt, $close = false) {
}
function html_header($noJavascript = false) {
- if ($_SESSION['OCS']['readServer']) {
- $value_theme = look_config_default_values('CUSTOM_THEME');
-
+ $value_theme = null;
+ if (is_readable(CONF_MYSQL) && isset($_SESSION['OCS']['readServer'])
+ && defined("SERVER_READ") && defined("DB_NAME") && defined("SERVER_WRITE") && defined("COMPTE_BASE") && defined("PSWD_BASE")
+ ) {
+ $value_theme = look_config_default_values('CUSTOM_THEME');
}
if (is_null($value_theme)) {
$value_theme['tvalue']['CUSTOM_THEME'] = DEFAULT_THEME;
@@ -413,8 +423,7 @@ function strip_tags_array($value = '') {
if (is_object($value)) {
$value = get_class($value);
$value = strip_tags($value, "
");
- $value = "Objet de la classe " . $value;
- return $value;
+ return "Objet de la classe " . $value;
}
$value = is_array($value) ? array_map('strip_tags_array', $value) : strip_tags($value, "
");
@@ -480,9 +489,11 @@ function formGroup($inputType, $inputName, $name, $size, $maxlength, $inputValue
if($inputType == "select"){
echo "";
} else {
if($inputType == "checkbox") {
@@ -504,7 +515,7 @@ function calendars($NameInputField,$DateFormat)
{
$lang = $_SESSION['OCS']['LANGUAGE'];
$calendar = "";
- $calendar .= "";
- return $calendar;
+ ");
}
@@ -606,41 +616,41 @@ function modif_values($field_labels, $fields, $hidden_fields, $options = array()
}else{
echo "";
}
- echo "";
- if($field['COMMENT_AFTER'] == ""){
+ echo "";
+ if(empty($field['COMMENT_AFTER'])){
echo " ";
}
}else if($inputType == 'number'){
echo "";
- echo "";
- if($field['COMMENT_AFTER'] == ""){
+ echo "";
+ if(empty($field['COMMENT_AFTER'])){
echo " ";
}
}else if($inputType == 'disabled'){
echo "";
- echo "";
- if($field['COMMENT_AFTER'] == ""){
+ echo "";
+ if(empty($field['COMMENT_AFTER'])){
echo " ";
}
}else if($inputType == 'select'){
echo "";
- echo " ";
}
} else if($inputType == 'checkbox'){
if($field["CONFIG"]["SELECTED_VALUE"] != ''){
$field_check = explode("&&&", $field["CONFIG"]["SELECTED_VALUE"]);
- foreach($field_check as $keys => $values){
+ foreach($field_check as $values){
if($values != ''){
$field_checkbox[$values] = $values;
}
@@ -658,9 +668,9 @@ function modif_values($field_labels, $fields, $hidden_fields, $options = array()
echo " ";
}
} else if($inputType == 'radio'){
- if($field["CONFIG"]["SELECTED_VALUE"] != ''){
+ if(!empty($field["CONFIG"]["SELECTED_VALUE"])){
$field_radio = explode("&&&", $field["CONFIG"]["SELECTED_VALUE"]);
- foreach($field_radio as $keys => $values){
+ foreach($field_radio as $values){
if($values != ''){
$field_radio[$values] = $values;
}
@@ -682,10 +692,10 @@ function modif_values($field_labels, $fields, $hidden_fields, $options = array()
} else if($inputType == 'qrcode'){
echo "";
} else{
- echo "";
+ echo "";
}
- if($field['COMMENT_AFTER'] != ""){
+ if(!empty($field['COMMENT_AFTER'])){
echo "".$field['COMMENT_AFTER']."";
echo " ";
}
@@ -839,19 +849,21 @@ function check_requirements(){
/**
* From a byte value return an int
*
- * @param type $val
+ * @param $val
* @return int
*/
function return_bytes($val) {
$val = trim($val);
+ $nb = preg_match("/([0-9]+)/", $val, $matches);
+ $nb = $matches[1];
$last = strtolower($val[strlen($val) - 1]);
switch ($last) {
case 'g':
- $val *= 1024;
+ $nb *= 1024;
case 'm':
- $val *= 1024;
+ $nb *= 1024;
case 'k':
- $val *= 1024;
+ $nb *= 1024;
}
return $val;
diff --git a/require/function_computers.php b/require/function_computers.php
index 7832bde60..26aaf1625 100755
--- a/require/function_computers.php
+++ b/require/function_computers.php
@@ -1,4 +1,5 @@
g(376));
}
-
function computer_list_by_tag($tag = "", $format = 'LIST') {
$arg_sql = array();
if ($tag == "") {
@@ -68,7 +65,7 @@ function computer_list_by_tag($tag = "", $format = 'LIST') {
$sql_mycomputers = "select hardware_id from accountinfo a where a.tag in ";
$sql_mycomputers = mysql2_prepare($sql_mycomputers, $arg_sql, $tag);
}
- $res_mycomputers = mysql2_query_secure($sql_mycomputers['SQL'], $_SESSION['OCS']["readServer"], $sql_mycomputers['ARG']);
+ $res_mycomputers = mysql2_query_secure($sql_mycomputers['SQL'], $_SESSION['OCS']["readServer"], $sql_mycomputers['ARG'] ?? []);
$mycomputers = "(";
while ($item_mycomputers = mysqli_fetch_object($res_mycomputers)) {
$mycomputers .= $item_mycomputers->hardware_id . ",";
@@ -84,7 +81,6 @@ function computer_list_by_tag($tag = "", $format = 'LIST') {
return $array_mycomputers;
}
}
-
/**
* Deleting function
* @param id Hardware identifier to be deleted
@@ -104,10 +100,10 @@ function deleteDid($id, $checkLock = true, $traceDel = true, $silent = false
$resId = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $id);
$valId = mysqli_fetch_array($resId);
$idHard = $id;
- $did = $valId["deviceid"];
+ $did = $valId["deviceid"] ?? '';
if ($did) {
//Deleting a network device
- if (strpos($did, "NETWORK_DEVICE-") === false) {
+ if (!strpos($did, "NETWORK_DEVICE-")) {
$sql = "SELECT macaddr FROM networks WHERE hardware_id='%s'";
$resNetm = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $idHard);
while ($valNetm = mysqli_fetch_array($resNetm)) {
@@ -156,12 +152,11 @@ function deleteDid($id, $checkLock = true, $traceDel = true, $silent = false
if ($checkLock) {
unlock($id);
}
- return $valId["name"];
+ return $valId["name"] ?? '';
} else {
errlock();
}
}
-
function fusionne($afus) {
global $l;
$i = 0;
@@ -220,7 +215,7 @@ function fusionne($afus) {
$accountTable = [];
// Check if accountinfo data exist and get ID of the more recent
- foreach($afus as $key => $values) {
+ foreach($afus as $values) {
$sqlverif = "SELECT * FROM accountinfo WHERE hardware_id = '%s' ORDER BY hardware_id ASC";
$verif_req = mysql2_query_secure($sqlverif, $_SESSION['OCS']["readServer"], $values["id"]);
while($row = mysqli_fetch_array($verif_req)){
@@ -230,7 +225,7 @@ function fusionne($afus) {
}
}
- foreach($accountTable as $id => $table) {
+ foreach($accountTable as $table) {
foreach($table as $key => $value) {
if(strpos($key,"fields_") !== false) {
if($value != null && $value != "") {
@@ -258,7 +253,7 @@ function fusionne($afus) {
}
// Delete all old accountinfo
- foreach($afus as $key => $values) {
+ foreach($afus as $values) {
if($values["id"] != $afus[$maxInd]["id"]) {
$reqDelAccount = "DELETE FROM accountinfo WHERE hardware_id='%s'";
mysql2_query_secure($reqDelAccount, $_SESSION['OCS']["writeServer"], $values["id"]);
@@ -267,6 +262,7 @@ function fusionne($afus) {
msg_success($l->g(190) . " " . $afus[$minInd]["deviceid"] . " " . $l->g(206) . " " . $afus[$maxInd]["deviceid"]);
$i = 0;
+ $lesDel = '';
foreach ($afus as $a) {
if ($i != $maxInd) {
deleteDid($a["id"], false, false, true);
@@ -291,7 +287,6 @@ function fusionne($afus) {
$lesDel .= " => " . $afus[$maxInd]["deviceid"];
AddLog("FUSION", $lesDel);
}
-
function insert_manual_computer($values, $nb = 1) {
global $i;
if ($nb == 1) {
@@ -319,12 +314,10 @@ function insert_manual_computer($values, $nb = 1) {
return $id_computer;
}
-
/*
* function to verify if user can access
* on computer
*/
-
function is_mine_computer($id) {
if (isset($_SESSION['OCS']['TAGS']) && is_array($_SESSION['OCS']['TAGS'])) {
$sql = "select hardware_id from accountinfo where hardware_id = %s and tag in ";
@@ -338,11 +331,11 @@ function is_mine_computer($id) {
}
return true;
}
-
function RandomMAC() {
$word = "A,B,C,D,E,F,0,1,2,3,4,5,6,7,8,9";
$mac = '';
$array = explode(",", $word);
+ $j = 0;
while ($j < 8) {
$i = 0;
while ($i < 2) {
@@ -356,5 +349,3 @@ function RandomMAC() {
return substr($mac, 0, -1);
}
-
-?>
\ No newline at end of file
diff --git a/require/function_config_generale.php b/require/function_config_generale.php
index 02b4efd71..882f630d0 100644
--- a/require/function_config_generale.php
+++ b/require/function_config_generale.php
@@ -143,7 +143,7 @@ function active(id, sens) {
} elseif (isset($data['JAVASCRIPT'])) {
echo $data['JAVASCRIPT'];
}
- if ($data['VALUE'] == $key || isset($data['CHECK'][$key])) {
+ if ((isset($data['VALUE']) && $data['VALUE'] == $key) || isset($data['CHECK'][$key])) {
echo "checked";
}
echo ">" . $value;
@@ -158,12 +158,12 @@ function active(id, sens) {
echo "";
echo " ";
- if ($data_hidden['BEGIN'] != '' || isset($data_hidden['BEGIN'])) {
+ if (isset($data_hidden['BEGIN']) && $data_hidden['BEGIN'] != '') {
echo " " . $data_hidden['BEGIN'] . "";
}
- echo " ";
+ echo " ";
- if ($data_hidden['END'] != '' || isset($data_hidden['END'])) {
+ if (isset($data_hidden['END']) && $data_hidden['END'] != '') {
echo " " . $data_hidden['END'] . "";
}
@@ -182,12 +182,12 @@ function active(id, sens) {
$ajout_readonly = " disabled=\"disabled\" style='color:black; background-color:#e1e1e2;'";
}
echo " ";
- if ($data['BEGIN'] != '' || isset($data['BEGIN'])) {
+ if (isset($data['BEGIN']) || !empty($data['BEGIN'])) {
echo "" . $data['BEGIN'] . "";
}
- echo "";
+ echo "";
- if ($data['END'] != '' || isset($data['END'])) {
+ if (!empty($data['END']) || isset($data['END'])) {
echo "" . $data['END'] . "";
}
echo " ";
@@ -233,9 +233,9 @@ function active(id, sens) {
}
echo "";
}elseif ($type == 'long_text') {
- echo " " . $data['END'];
+ echo " " . ($data['END'] ?? '');
}elseif($type == 'password'){
- echo " ";
+ echo " ";
echo " " . $helpInput . " ";
} else {
echo $data['LINKS'];
@@ -271,14 +271,14 @@ function verif_champ() {
'CUSTOM_THEME' => array('FIELD_READ' => 'CUSTOME_THEME_edit', 'END' => "", 'FILE' => "", 'TYPE' =>'r'));
foreach ($file_exist as $key => $value) {
- if ($protectedPost[$key] == 'CUSTOM' || preg_match('/^(\/+\w{0,}){0,}/', $protectedPost[$key]) == true) {
+ if ((isset($protectedPost[$key])) && (($protectedPost[$key] == 'CUSTOM') || preg_match('/^(\/+\w{0,}){0,}/', $protectedPost[$key]) == true)) {
//Try to find a file
if ($value['FILE'] != '' ) {
if ($protectedPost[$value['FIELD_READ']] != '' and ! @fopen($protectedPost[$value['FIELD_READ']] . $value['END'] . $value['FILE'], $value['TYPE'])) {
$tab_error[$key] = array('FILE_NOT_EXIST' => $protectedPost[$value['FIELD_READ']] . $value['END'] . $value['FILE']);
}
//Try to find a directory
- } elseif (!is_dir($protectedPost[$value['FIELD_READ']] . $value['END'])) {
+ } elseif (isset($protectedPost[$value['FIELD_READ']]) && !is_dir($protectedPost[$value['FIELD_READ']] . $value['END'])) {
if ($protectedPost[$value['FIELD_READ']] != '') {
$tab_error[$key] = array('FILE_NOT_EXIST' => $protectedPost[$value['FIELD_READ']] . $value['END']);
}
@@ -287,20 +287,25 @@ function verif_champ() {
}
$i = 0;
- while ($supp1[$i]) {
- if ($protectedPost[$supp1[$i]] < 1 && isset($protectedPost[$supp1[$i]])) {
- $tab_error[$supp1[$i]] = '1';
- }
+ if(is_array($supp1[$i])) {
+ while ($supp1[$i]) {
+ if (isset($protectedPost[$supp1[$i]]) && $protectedPost[$supp1[$i]] < 1) {
+ $tab_error[$supp1[$i]] = '1';
+ }
$i++;
+ }
}
+
$i = 0;
- while ($supp10[$i]) {
- if ($protectedPost[$supp10[$i]] < 10 && isset($protectedPost[$supp10[$i]])) {
- $tab_error[$supp10[$i]] = '10';
+ if(is_array($supp1[$i])) {
+ while ($supp10[$i]) {
+ if (isset($protectedPost[$supp10[$i]]) && $protectedPost[$supp10[$i]] < 10) {
+ $tab_error[$supp10[$i]] = '10';
+ }
+ $i++;
}
- $i++;
}
- return $tab_error;
+ return $tab_error ?? '';
}
function fin_tab($disable = '') {
@@ -401,8 +406,7 @@ function update_default_value($POST) {
//tableau des champs ou il faut interpréter la valeur retourner et mettre à jour tvalue
$array_interprete_tvalue = array('DOWNLOAD_REP_CREAT' => 'DOWNLOAD_REP_CREAT_edit', 'DOWNLOAD_PACK_DIR' => 'DOWNLOAD_PACK_DIR_edit',
- 'IPDISCOVER_IPD_DIR' => 'IPDISCOVER_IPD_DIR_edit', 'LOG_DIR' => 'LOG_DIR_edit', 'TMP_DIR' => 'TMP_DIR_edit',
- 'LOG_SCRIPT' => 'LOG_SCRIPT_edit', 'DOWNLOAD_URI_FRAG' => 'DOWNLOAD_URI_FRAG_edit',
+ 'IPDISCOVER_IPD_DIR' => 'IPDISCOVER_IPD_DIR_edit', 'LOG_DIR' => 'LOG_DIR_edit', 'TMP_DIR' => 'TMP_DIR_edit', 'DOWNLOAD_URI_FRAG' => 'DOWNLOAD_URI_FRAG_edit',
'DOWNLOAD_URI_INFO' => 'DOWNLOAD_URI_INFO_edit',
'LOG_SCRIPT' => 'LOG_SCRIPT_edit', 'CONF_PROFILS_DIR' => 'CONF_PROFILS_DIR_edit',
'OLD_CONF_DIR' => 'OLD_CONF_DIR_edit', 'LOCAL_URI_SERVER' => 'LOCAL_URI_SERVER_edit', 'WOL_BIOS_PASSWD' => 'WOL_BIOS_PASSWD_edit');
@@ -457,12 +461,12 @@ function update_default_value($POST) {
$value_field_modif = '';
//check AUTO_DUPLICATE_LVL. Particular field
if (strstr($key, 'AUTO_DUPLICATE_LVL_')) {
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_1'] = $POST['AUTO_DUPLICATE_LVL_1'];
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_2'] = $POST['AUTO_DUPLICATE_LVL_2'];
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_3'] = $POST['AUTO_DUPLICATE_LVL_3'];
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_4'] = $POST['AUTO_DUPLICATE_LVL_4'];
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_5'] = $POST['AUTO_DUPLICATE_LVL_5'];
- $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_6'] = $POST['AUTO_DUPLICATE_LVL_6'];
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_1'] = $POST['AUTO_DUPLICATE_LVL_1'] ?? '';
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_2'] = $POST['AUTO_DUPLICATE_LVL_2'] ?? '';
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_3'] = $POST['AUTO_DUPLICATE_LVL_3'] ?? '';
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_4'] = $POST['AUTO_DUPLICATE_LVL_4'] ?? '';
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_5'] = $POST['AUTO_DUPLICATE_LVL_5'] ?? '';
+ $AUTO_DUPLICATE['AUTO_DUPLICATE_LVL_6'] = $POST['AUTO_DUPLICATE_LVL_6'] ?? '';
$value = auto_duplicate_lvl_poids($AUTO_DUPLICATE, 2);
$key = 'AUTO_DUPLICATE_LVL';
}
@@ -531,10 +535,6 @@ function auto_duplicate_lvl_poids($value, $entree_sortie) {
* if $default is set to true, ldap filters will be left untouched but returned
*/
function nb_ldap_filters($nb, $default = false) {
- $mini_nb = 1;
- // at least one filter at all times
- $nb = $nb_old - $nb == 0 ? $mini_nb : $nb;
-
if ($default == false) {
// old values = from config table
@@ -542,8 +542,12 @@ function nb_ldap_filters($nb, $default = false) {
$old_filters = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
$nb_old = $old_filters->num_rows;
$old_filters = end(mysqli_fetch_all($old_filters, MYSQLI_ASSOC));
- $last_filter = (int) preg_replace('/[^0-9]/', '', $old_filters['NAME']);
-
+ if(isset($old_filters['NAME'])) {
+ $last_filter = (int) preg_replace('/[^0-9]/', '', $old_filters['NAME']);
+ } else {
+ $last_filter = 2;
+ }
+
if ($nb > $nb_old) { // new filters added
$i = $last_filter;
@@ -601,7 +605,7 @@ function trait_post($name) {
}
function pageGUI($advance) {
- global $l, $values;
+ global $l, $values, $numeric, $sup1;
//what ligne we need?
if($advance){
$champs = array('LOCAL_URI_SERVER' => 'LOCAL_URI_SERVER',
@@ -643,46 +647,46 @@ function pageGUI($advance) {
$themes = get_available_themes();
if($advance){
- ligne('EXCLUDE_ARCHIVE_COMPUTER', $l->g(9800), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']));
+ ligne('EXCLUDE_ARCHIVE_COMPUTER', $l->g(9800), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] ?? 0));
- ligne('ACTIVE_NEWS', $l->g(8026), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ACTIVE_NEWS']));
+ ligne('ACTIVE_NEWS', $l->g(8026), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ACTIVE_NEWS'] ?? 0));
- ligne('CUSTOM_THEME', $l->g(1420), 'select', array('VALUE' => $values['tvalue']['CUSTOM_THEME'], 'SELECT_VALUE' => $themes));
+ ligne('CUSTOM_THEME', $l->g(1420), 'select', array('VALUE' => $values['tvalue']['CUSTOM_THEME'] ?? "OCS", 'SELECT_VALUE' => $themes));
- ligne('INTERFACE_LAST_CONTACT', $l->g(484), 'input', array('END' => $l->g(496), 'VALUE' => $values['ivalue']['INTERFACE_LAST_CONTACT'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
+ ligne('INTERFACE_LAST_CONTACT', $l->g(484), 'input', array('END' => $l->g(496), 'VALUE' => $values['ivalue']['INTERFACE_LAST_CONTACT'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric, '', '', $sup1));
- ligne('LOCAL_URI_SERVER', $l->g(565), 'radio', array('DEFAULT' => $l->g(823) . " (http://localhost:80/ocsinventory)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_local_uri), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['LOCAL_URI_SERVER'], 'SIZE' => "30%", 'MAXLENGTH' => 254));
+ ligne('LOCAL_URI_SERVER', $l->g(565), 'radio', array('DEFAULT' => $l->g(823) . " (http://localhost:80/ocsinventory)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_local_uri), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['LOCAL_URI_SERVER'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 254));
$def = VARLIB_DIR . '/download';
ligne('DOWNLOAD_PACK_DIR', $l->g(775), 'radio', array('DEFAULT' => $l->g(823) . " ($def)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_pack), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['DOWNLOAD_PACK_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/download"));
$def = VARLIB_DIR . '/ipd';
ligne('IPDISCOVER_IPD_DIR', $l->g(776), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_ipd), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['IPDISCOVER_IPD_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/ipd"));
- ligne('LOG_GUI', $l->g(824), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['LOG_GUI']));
+ ligne('LOG_GUI', $l->g(824), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['LOG_GUI'] ?? 0));
$def = VARLOG_DIR . '/logs';
ligne('LOG_DIR', $l->g(825), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_log), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['LOG_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/logs"));
$def = VARLIB_DIR . '/tmp_dir';
- ligne('TMP_DIR', $l->g(9611), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_tmp), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['TMP_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/tmp_dir"));
+ ligne('TMP_DIR', $l->g(9611), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_tmp), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['TMP_DIR'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/tmp_dir"));
$def = VARLOG_DIR . '/scripts';
ligne('LOG_SCRIPT', $l->g(1254), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_scripts), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['LOG_SCRIPT'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/scripts"));
$def = ETC_DIR . '/' . MAIN_SECTIONS_DIR . 'conf/';
- ligne('CONF_PROFILS_DIR', $l->g(1252), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_profils), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['CONF_PROFILS_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/conf"));
+ ligne('CONF_PROFILS_DIR', $l->g(1252), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_profils), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['CONF_PROFILS_DIR'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/conf"));
$def = ETC_DIR . '/' . MAIN_SECTIONS_DIR . 'old_conf/';
- ligne('OLD_CONF_DIR', $l->g(1253), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_old_profils), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['OLD_CONF_DIR'], 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/old_conf"));
- ligne('EXPORT_SEP', $l->g(1213), 'input', array('VALUE' => $values['tvalue']['EXPORT_SEP'], 'SIZE' => "30%", 'MAXLENGTH' => 4));
- ligne('TAB_CACHE', $l->g(1249), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['TAB_CACHE']));
+ ligne('OLD_CONF_DIR', $l->g(1253), 'radio', array('DEFAULT' => $l->g(823) . " (" . $def . ")", 'CUSTOM' => $l->g(822), 'VALUE' => $select_old_profils), array('HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['OLD_CONF_DIR'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 254, 'END' => "/old_conf"));
+ ligne('EXPORT_SEP', $l->g(1213), 'input', array('VALUE' => $values['tvalue']['EXPORT_SEP'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 4));
+ ligne('TAB_CACHE', $l->g(1249), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['TAB_CACHE'] ?? 0));
ligne('WARN_UPDATE', $l->g(2117), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['WARN_UPDATE']));
}else{
- ligne('EXCLUDE_ARCHIVE_COMPUTER', $l->g(9800), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']));
- ligne('ACTIVE_NEWS', $l->g(8026), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ACTIVE_NEWS']));
+ ligne('EXCLUDE_ARCHIVE_COMPUTER', $l->g(9800), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] ?? 0));
+ ligne('ACTIVE_NEWS', $l->g(8026), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ACTIVE_NEWS'] ?? 0));
ligne('CUSTOM_THEME', $l->g(1420), 'select', array('VALUE' => $values['tvalue']['CUSTOM_THEME'], 'SELECT_VALUE' => $themes));
ligne('INTERFACE_LAST_CONTACT', $l->g(484), 'input', array('END' => $l->g(496), 'VALUE' => $values['ivalue']['INTERFACE_LAST_CONTACT'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
- ligne('LOG_GUI', $l->g(824), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['LOG_GUI']));
+ ligne('LOG_GUI', $l->g(824), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['LOG_GUI'] ?? 0));
}
}
@@ -752,12 +756,12 @@ function pageteledeploy($advance) {
ligne('DOWNLOAD_PERIOD_LENGTH', $l->g(723), 'input', array('VALUE' => $values['ivalue']['DOWNLOAD_PERIOD_LENGTH'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric));
}
ligne('DEPLOY', $l->g(414), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['DEPLOY']));
- ligne('DOWNLOAD_URI_FRAG', $l->g(826), 'radio', array('DEFAULT' => $l->g(823) . " (HTTP://localhost/download)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_frag), array('BEGIN' => "http://", 'HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['DOWNLOAD_URI_FRAG'], 'SIZE' => 70, 'MAXLENGTH' => 254));
- ligne('DOWNLOAD_URI_INFO', $l->g(827), 'radio', array('DEFAULT' => $l->g(823) . " (HTTPS://localhost/download)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_info), array('BEGIN' => "https://", 'HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['DOWNLOAD_URI_INFO'], 'SIZE' => 70, 'MAXLENGTH' => 254));
- ligne('DOWNLOAD_ACTIVATE_FRAG', $l->g(9203), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['DOWNLOAD_ACTIVATE_FRAG']));
- ligne('DOWNLOAD_RATIO_FRAG', $l->g(9204), 'input', array('VALUE' => $values['ivalue']['DOWNLOAD_RATIO_FRAG'], 'END' => 'MB', 'SIZE' => 2, 'MAXLENGTH' => 4, 'JAVASCRIPT' => $numeric), '', '', $sup1);
- ligne('DOWNLOAD_AUTO_ACTIVATE', $l->g(9205), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['DOWNLOAD_AUTO_ACTIVATE']));
- ligne('DOWNLOAD_PROTOCOL', $l->g(9106), 'select', array('VALUE' => $values['tvalue']['DOWNLOAD_PROTOCOL'], 'SELECT_VALUE' => $protocol));
+ ligne('DOWNLOAD_URI_FRAG', $l->g(826), 'radio', array('DEFAULT' => $l->g(823) . " (HTTP://localhost/download)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_frag), array('BEGIN' => "http://", 'HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['DOWNLOAD_URI_FRAG'] ?? '', 'SIZE' => 70, 'MAXLENGTH' => 254));
+ ligne('DOWNLOAD_URI_INFO', $l->g(827), 'radio', array('DEFAULT' => $l->g(823) . " (HTTPS://localhost/download)", 'CUSTOM' => $l->g(822), 'VALUE' => $select_info), array('BEGIN' => "https://", 'HIDDEN' => 'CUSTOM', 'HIDDEN_VALUE' => $values['tvalue']['DOWNLOAD_URI_INFO'] ?? '', 'SIZE' => 70, 'MAXLENGTH' => 254));
+ ligne('DOWNLOAD_ACTIVATE_FRAG', $l->g(9203), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['DOWNLOAD_ACTIVATE_FRAG'] ?? 0));
+ ligne('DOWNLOAD_RATIO_FRAG', $l->g(9204), 'input', array('VALUE' => $values['ivalue']['DOWNLOAD_RATIO_FRAG'] ?? '', 'END' => 'MB', 'SIZE' => 2, 'MAXLENGTH' => 4, 'JAVASCRIPT' => $numeric), '', '', $sup1);
+ ligne('DOWNLOAD_AUTO_ACTIVATE', $l->g(9205), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['DOWNLOAD_AUTO_ACTIVATE'] ?? 0));
+ ligne('DOWNLOAD_PROTOCOL', $l->g(9106), 'select', array('VALUE' => $values['tvalue']['DOWNLOAD_PROTOCOL'] ?? '', 'SELECT_VALUE' => $protocol));
}
function pagegroups() {
@@ -817,13 +821,13 @@ function pageserveur($advance) {
'CHECK' => $check,
));
if($advance){
- ligne('SECURITY_LEVEL', $l->g(739), 'input', array('VALUE' => $values['ivalue']['SECURITY_LEVEL'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', "readonly");
+ ligne('SECURITY_LEVEL', $l->g(739), 'input', array('VALUE' => $values['ivalue']['SECURITY_LEVEL'] ?? '', 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', "readonly");
ligne('LOCK_REUSE_TIME', $l->g(740), 'input', array('END' => $l->g(511), 'VALUE' => $values['ivalue']['LOCK_REUSE_TIME'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
ligne('SESSION_VALIDITY_TIME', $l->g(777), 'input', array('END' => $l->g(511), 'VALUE' => $values['ivalue']['SESSION_VALIDITY_TIME'], 'SIZE' => 1, 'MAXLENGTH' => 4, 'JAVASCRIPT' => $numeric), '', '', $sup1);
}
ligne('TRACE_DELETED', $l->g(415), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['TRACE_DELETED']));
ligne('INVENTORY_ON_STARTUP', $l->g(2121), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_ON_STARTUP']));
- ligne('ADVANCE_CONFIGURATION', $l->g(1700), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ADVANCE_CONFIGURATION']));
+ ligne('ADVANCE_CONFIGURATION', $l->g(1700), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['ADVANCE_CONFIGURATION'] ?? 0));
}
function pageinventory($advance) {
@@ -862,7 +866,7 @@ function pageinventory($advance) {
ligne('INVENTORY_DIFF', $l->g(741), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_DIFF']));
ligne('INVENTORY_TRANSACTION', $l->g(742), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_TRANSACTION']));
ligne('INVENTORY_WRITE_DIFF', $l->g(743), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_WRITE_DIFF']));
- ligne('INVENTORY_SESSION_ONLY', $l->g(744), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_SESSION_ONLY']));
+ ligne('INVENTORY_SESSION_ONLY', $l->g(744), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_SESSION_ONLY'] ?? 0));
ligne('INVENTORY_CACHE_REVALIDATE', $l->g(745), 'input', array('END' => $l->g(496), 'VALUE' => $values['ivalue']['INVENTORY_CACHE_REVALIDATE'], 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
ligne('INVENTORY_CACHE_ENABLED', $l->g(1265), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_CACHE_ENABLED']));
}else{
@@ -876,7 +880,7 @@ function pageinventory($advance) {
$category = new SoftwareCategory();
$list_cat = $category->search_all_cat();
- ligne('INVENTORY_SAAS_ENABLED', $l->g(8108), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_SAAS_ENABLED']));
+ ligne('INVENTORY_SAAS_ENABLED', $l->g(8108), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['INVENTORY_SAAS_ENABLED'] ?? 0));
ligne('DEFAULT_CATEGORY', $l->g(1505), 'select', array('VALUE' => $values['ivalue']['DEFAULT_CATEGORY'], 'SELECT_VALUE' => $list_cat));
}
@@ -926,7 +930,7 @@ function pageipdiscover($advance) {
ligne('IPDISCOVER_MAX_ALIVE', $l->g(419), 'input', array('VALUE' => $values['ivalue']['IPDISCOVER_MAX_ALIVE'], 'END' => $l->g(496), 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
ligne('IPDISCOVER_NO_POSTPONE', $l->g(747), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['IPDISCOVER_NO_POSTPONE']));
ligne('IPDISCOVER_USE_GROUPS', $l->g(748), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['IPDISCOVER_USE_GROUPS']));
- ligne('IPDISCOVER_LINK_TAG_NETWORK', $l->g(1457), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['IPDISCOVER_LINK_TAG_NETWORK']));
+ ligne('IPDISCOVER_LINK_TAG_NETWORK', $l->g(1457), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['IPDISCOVER_LINK_TAG_NETWORK'] ?? 0));
ligne('IPDISCOVER_PURGE_OLD', $l->g(1560), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['IPDISCOVER_PURGE_OLD']));
ligne('IPDISCOVER_PURGE_VALIDITY_TIME', $l->g(1561), 'input', array('VALUE' => $values['ivalue']['IPDISCOVER_PURGE_VALIDITY_TIME'], 'END' => $l->g(496), 'SIZE' => 1, 'MAXLENGTH' => 3, 'JAVASCRIPT' => $numeric), '', '', $sup1);
} else {
@@ -985,12 +989,12 @@ function pageVulnerability() {
$list_cat = $category->search_all_cat();
// Display configuration items
- ligne('VULN_CVESEARCH_ENABLE', $l->g(1461), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_ENABLE']));
- ligne('VULN_CVESEARCH_HOST', $l->g(1462), 'input', array('VALUE' => $values['tvalue']['VULN_CVESEARCH_HOST'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('VULN_BAN_LIST[]', $l->g(1469), 'select2', array('VALUE' => $values['tvalue']['VULN_BAN_LIST'], 'SELECT_VALUE' => $list_cat));
- ligne('VULN_CVESEARCH_VERBOSE', $l->g(1461), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_VERBOSE']));
- ligne('VULN_CVESEARCH_ALL', $l->g(1471), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_ALL']));
- ligne('VULN_CVE_EXPIRE_TIME', $l->g(1484), 'input', array('VALUE' => $values['ivalue']['VULN_CVE_EXPIRE_TIME'], 'SIZE' => "30%", 'MAXLENGTH' => 3, 'END' => $l->g(730)));
+ ligne('VULN_CVESEARCH_ENABLE', $l->g(1461), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_ENABLE'] ?? 0));
+ ligne('VULN_CVESEARCH_HOST', $l->g(1462), 'input', array('VALUE' => $values['tvalue']['VULN_CVESEARCH_HOST'] ?? 0, 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('VULN_BAN_LIST[]', $l->g(1469), 'select2', array('VALUE' => $values['tvalue']['VULN_BAN_LIST'] ?? 0, 'SELECT_VALUE' => $list_cat));
+ ligne('VULN_CVESEARCH_VERBOSE', $l->g(1461), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_VERBOSE'] ?? 0));
+ ligne('VULN_CVESEARCH_ALL', $l->g(1471), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['VULN_CVESEARCH_ALL'] ?? 0));
+ ligne('VULN_CVE_EXPIRE_TIME', $l->g(1484), 'input', array('VALUE' => $values['ivalue']['VULN_CVE_EXPIRE_TIME'] ?? null, 'SIZE' => "30%", 'MAXLENGTH' => 3, 'END' => $l->g(730)));
ligne('VULN_CVE_DELAY_TIME', $l->g(1459), 'input', array('VALUE' => $values['ivalue']['VULN_CVE_DELAY_TIME'], 'SIZE' => "30%", 'MAXLENGTH' => 3, 'END' => $l->g(511)));
}
@@ -1010,10 +1014,10 @@ function pageCas() {
$default_role[''] = '';
$default_role = array_merge($default_role, $role1);
- ligne('CAS_PORT', $l->g(9700). ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_PORT'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CAS_URI', $l->g(9701) . ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_URI'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CAS_HOST', $l->g(9702) . ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_HOST'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CAS_DEFAULT_ROLE', $l->g(9703), 'select', array('VALUE' => $values['tvalue']['CAS_DEFAULT_ROLE'], 'SELECT_VALUE' => $default_role));
+ ligne('CAS_PORT', $l->g(9700). ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_PORT'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CAS_URI', $l->g(9701) . ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_URI'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CAS_HOST', $l->g(9702) . ' ' . '', 'input', array('VALUE' => $values['tvalue']['CAS_HOST'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CAS_DEFAULT_ROLE', $l->g(9703), 'select', array('VALUE' => $values['tvalue']['CAS_DEFAULT_ROLE'] ?? '', 'SELECT_VALUE' => $default_role));
}
@@ -1043,15 +1047,15 @@ function pageConnexion() {
$nb_filters[0] = '';
$ldap_filters = nb_ldap_filters($nb = $values['tvalue']['CONEX_LDAP_NB_FILTERS']);
- ligne('CONEX_LDAP_SERVEUR', $l->g(830), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_SERVEUR'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CONEX_ROOT_DN', $l->g(1016) . ' ' . $l->g(1018), 'input', array('VALUE' => $values['tvalue']['CONEX_ROOT_DN'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CONEX_ROOT_PW', $l->g(1017) . ' ' . $l->g(1018), 'password', array('VALUE' => $values['tvalue']['CONEX_ROOT_PW'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CONEX_LDAP_PORT', $l->g(831), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_PORT'], 'SIZE' => "30%", 'MAXLENGTH' => 20));
- ligne('CONEX_DN_BASE_LDAP', $l->g(832), 'input', array('VALUE' => $values['tvalue']['CONEX_DN_BASE_LDAP'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CONEX_LOGIN_FIELD', $l->g(833), 'input', array('VALUE' => $values['tvalue']['CONEX_LOGIN_FIELD'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
- ligne('CONEX_LDAP_PROTOCOL_VERSION', $l->g(834), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_PROTOCOL_VERSION'], 'SIZE' => "30%", 'MAXLENGTH' => 5));
- ligne('CONEX_LDAP_CHECK_DEFAULT_ROLE', $l->g(1277), 'select', array('VALUE' => $values['tvalue']['CONEX_LDAP_CHECK_DEFAULT_ROLE'], 'SELECT_VALUE' => $default_role));
- ligne('CONEX_LDAP_NB_FILTERS', $l->g(9650), 'select', array('VALUE' => $values['tvalue']['CONEX_LDAP_NB_FILTERS'], 'SELECT_VALUE' => $nb_filters));
+ ligne('CONEX_LDAP_SERVEUR', $l->g(830), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_SERVEUR'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CONEX_ROOT_DN', $l->g(1016) . ' ' . $l->g(1018), 'input', array('VALUE' => $values['tvalue']['CONEX_ROOT_DN'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CONEX_ROOT_PW', $l->g(1017) . ' ' . $l->g(1018), 'password', array('VALUE' => $values['tvalue']['CONEX_ROOT_PW'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CONEX_LDAP_PORT', $l->g(831), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_PORT'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 20));
+ ligne('CONEX_DN_BASE_LDAP', $l->g(832), 'input', array('VALUE' => $values['tvalue']['CONEX_DN_BASE_LDAP'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CONEX_LOGIN_FIELD', $l->g(833), 'input', array('VALUE' => $values['tvalue']['CONEX_LOGIN_FIELD'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('CONEX_LDAP_PROTOCOL_VERSION', $l->g(834), 'input', array('VALUE' => $values['tvalue']['CONEX_LDAP_PROTOCOL_VERSION'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 5));
+ ligne('CONEX_LDAP_CHECK_DEFAULT_ROLE', $l->g(1277), 'select', array('VALUE' => $values['tvalue']['CONEX_LDAP_CHECK_DEFAULT_ROLE'] ?? '', 'SELECT_VALUE' => $default_role));
+ ligne('CONEX_LDAP_NB_FILTERS', $l->g(9650), 'select', array('VALUE' => $values['tvalue']['CONEX_LDAP_NB_FILTERS'] ?? '', 'SELECT_VALUE' => $nb_filters));
foreach ($ldap_filters as $filter) {
ligne($filter[0]['NAME'], $l->g(1111), 'input', array('VALUE' => $filter[0]['TVALUE'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
ligne($filter[1]['NAME'], $l->g(1116), 'select', array('VALUE' => $filter[1]['TVALUE'], 'SELECT_VALUE' => $role1));
@@ -1069,8 +1073,8 @@ function pagesnmp() {
} else {
$select_rep_creat = 'DEFAULT';
}
- ligne('SNMP', $l->g(1137), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['SNMP']));
- ligne('SNMP_MIB_DIRECTORY', $l->g(9010), 'input', array('VALUE' => $values['tvalue']['SNMP_MIB_DIRECTORY'], 'SIZE' => "30%", 'MAXLENGTH' => 200));
+ ligne('SNMP', $l->g(1137), 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['SNMP'] ?? 0));
+ ligne('SNMP_MIB_DIRECTORY', $l->g(9010), 'input', array('VALUE' => $values['tvalue']['SNMP_MIB_DIRECTORY'] ?? '', 'SIZE' => "30%", 'MAXLENGTH' => 200));
}
function pageswol() {
@@ -1092,7 +1096,7 @@ function pageswol() {
}
ligne('WOL_PORT', $l->g(272) . " (" . $l->g(1320) . ")", 'input', array('VALUE' => $values['tvalue']['WOL_PORT'], 'SIZE' => "30%", 'MAXLENGTH' => "30%", 'JAVASCRIPT' => $numeric_semicolon));
- ligne('WOL_BIOS_PASSWD', 'Bios password', 'radio', array('ON' => 'ON', 'OFF' => 'OFF', 'VALUE' => $wol_passwd), array('HIDDEN' => 'ON', 'HIDDEN_VALUE' => $values['tvalue']['WOL_BIOS_PASSWD'], 'SIZE' => 40, 'MAXLENGTH' => 254), "readonly");
+ ligne('WOL_BIOS_PASSWD', 'Bios password', 'radio', array('ON' => 'ON', 'OFF' => 'OFF', 'VALUE' => $wol_passwd), array('HIDDEN' => 'ON', 'HIDDEN_VALUE' => $values['tvalue']['WOL_BIOS_PASSWD'] ?? '', 'SIZE' => 40, 'MAXLENGTH' => 254), "readonly");
}
function pagesSecurity(){
diff --git a/require/function_console.php b/require/function_console.php
index 653b5d2d7..67ebe203b 100644
--- a/require/function_console.php
+++ b/require/function_console.php
@@ -23,7 +23,7 @@
$data_limit = find_limit_values();
require_once('require/function_ipdiscover.php');
-if ($_SESSION['OCS']["TAGS"]) {
+if (isset($_SESSION['OCS']["TAGS"])) {
$sql_tag = mysql2_prepare('select id from hardware h, accountinfo a where a.hardware_id=h.id and a.tag in ', array(), $_SESSION['OCS']["TAGS"]);
$result = mysql2_query_secure($sql_tag['SQL'], $_SESSION['OCS']["readServer"], $sql_tag['ARG']);
while ($val = mysqli_fetch_object($result)) {
@@ -44,9 +44,7 @@
$_SESSION['DATE']['HARDWARE-LASTDATE-TALL'] = date($l->g(1242));
$_SESSION['DATE']['HARDWARE-LASTCOME-SMALL'] = date($l->g(1242), mktime(0, 0, 0, date("m"), date("d") - $data_limit['GUI_REPORT_AGIN_MACH'], date("Y")));
-$multi_search = array("OCS_REPORT_NB_NOTIFIED" => array("FIELD" => '', "COMP" => '', "VALUE" => ''),
- "OCS_REPORT_NB_ERR" => array("FIELD" => '', "COMP" => '', "VALUE" => ''),
- "OCS_REPORT_NB_CONTACT" => array("FIELD" => 'HARDWARE-LASTCOME', "COMP" => 'tall', "VALUE" => $_SESSION['DATE']['HARDWARE-LASTCOME-TALL']),
+$multi_search = array("OCS_REPORT_NB_CONTACT" => array("FIELD" => 'HARDWARE-LASTCOME', "COMP" => 'tall', "VALUE" => $_SESSION['DATE']['HARDWARE-LASTCOME-TALL']),
"OCS_REPORT_NB_INV" => array("FIELD" => 'HARDWARE-LASTDATE', "COMP" => 'tall', "VALUE" => $_SESSION['DATE']['HARDWARE-LASTDATE-TALL']),
"OCS_REPORT_NB_4_MOMENT" => array("FIELD" => 'HARDWARE-LASTCOME', "COMP" => 'small', "VALUE" => $_SESSION['DATE']['HARDWARE-LASTCOME-SMALL']),
"OCS_REPORT_NB_HARD_DISK_H" => array("FIELD" => '', "COMP" => '', "VALUE" => ''),
@@ -262,7 +260,7 @@ function show_active_tab($data_on) {
}
}
}
- foreach ($repart as $key => $value) {
+ foreach ($repart as $value) {
$data[$value] = $value;
}
diff --git a/require/function_dico.php b/require/function_dico.php
index c6971c1a5..d93f7f644 100644
--- a/require/function_dico.php
+++ b/require/function_dico.php
@@ -26,7 +26,7 @@ function search_all_item() {
while ($item_search_soft = mysqli_fetch_object($result_search_soft)) {
$list[] = $item_search_soft->ID;
}
- return $list;
+ return $list ?? '';
}
function del_soft($onglet, $list_soft) {
diff --git a/require/function_files.php b/require/function_files.php
index ff162d865..833596c77 100755
--- a/require/function_files.php
+++ b/require/function_files.php
@@ -54,7 +54,7 @@ function scanDirectory($directory, $filetype = '.') {
}
}
closedir($myDirectory);
- return $data;
+ return $data ?? '';
}
/**
@@ -101,7 +101,7 @@ function read_configuration($ms_cfg_file, $search, $id_field = '') {
}
}
}
- if ($line[0] == "<") { //Getting tag type for the next launch of the loop
+ if (substr($line, 0, 1) == "<") { //Getting tag type for the next launch of the loop
$capture = 'OK_' . substr(substr($line, 1), 0, -1);
}
}
diff --git a/require/function_groups.php b/require/function_groups.php
index 97019885c..68b053f2a 100644
--- a/require/function_groups.php
+++ b/require/function_groups.php
@@ -1,4 +1,5 @@
'OK', 'LBL' => $l->g(607) . " " . $l->g(608));
}
-
//function to add computer in groups_cache
function add_computers_cache($list_id, $groupid, $static) {
require_once('function_computers.php');
@@ -147,7 +141,6 @@ function add_computers_cache($list_id, $groupid, $static) {
return $cached;
}
}
-
//generation du xml en fonction des requetes
function generate_xml($req) {
//si il exite une requete
@@ -167,13 +160,11 @@ function generate_xml($req) {
return $xml;
}
-
function clean($txt) {
$cherche = array("&", "<", ">", "\"", "'");
$replace = array("&", "<", ">", """, "'");
return str_replace($cherche, $replace, $txt);
}
-
function delete_group($id_supp) {
global $l;
if ($id_supp == "") {
@@ -194,7 +185,6 @@ function delete_group($id_supp) {
return array('RESULT' => 'ERROR', 'LBL' => $l->g(623));
}
}
-
function group_4_all($id_group) {
if ($id_group == "") {
return array('RESULT' => 'ERROR', 'LBL' => "ID IS NULL");
@@ -219,7 +209,6 @@ function group_4_all($id_group) {
addLog("ACTION VISIBILITY OF GROUPE", $id_group);
return $return_result;
}
-
function show_redistrib_groups_packages($systemid){
global $l;
@@ -278,5 +267,3 @@ function show_redistrib_groups_packages($systemid){
\ No newline at end of file
diff --git a/require/function_ipdiscover.php b/require/function_ipdiscover.php
index 5633ef58f..c8cecbeb2 100644
--- a/require/function_ipdiscover.php
+++ b/require/function_ipdiscover.php
@@ -25,8 +25,7 @@ function find_info_subnet($netid) {
$sql = "select NETID,NAME,ID,MASK from subnet where netid='%s'";
$arg = $netid;
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
function find_info_type($name = '', $id = '', $update = '') {
@@ -42,8 +41,7 @@ function find_info_type($name = '', $id = '', $update = '') {
$arg[] = $update;
}
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
function form_add_subnet($title = '', $default_value, $form) {
@@ -246,8 +244,7 @@ function find_community_info($id) {
$sql = "select * from snmp_communities where id=%s";
$arg = $id;
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
function runCommand($command = "", $fname) {
diff --git a/require/function_machine.php b/require/function_machine.php
index b1f27a292..9e5d3b761 100644
--- a/require/function_machine.php
+++ b/require/function_machine.php
@@ -64,7 +64,7 @@ function info($GET, $post_systemid) {
$systemid = $GET['systemid'];
}
//problème sur l'id
- if ($systemid == "" || !is_numeric($systemid)) {
+ if (empty($systemid) || !is_numeric($systemid)) {
return $l->g(837);
}
//recherche des infos de la machine
@@ -95,7 +95,7 @@ function subnet_name($systemid) {
$returnVal[] = $valSub->NAME . " (" . $valSub->NETID . ")";
}
- return $returnVal;
+ return $returnVal ?? '';
}
function print_item_header($text) {
@@ -251,7 +251,7 @@ function checkForComputerPackagesAction(){
}
//affect again a packet
- if ($protectedPost['Valid_modif']) {
+ if (isset($protectedPost['Valid_modif'])) {
if (trim($protectedPost['MOTIF'])) {
if ($protectedPost["ACTION"] == "again") {
//delete all info of specific teledeploy
@@ -274,11 +274,11 @@ function checkForComputerPackagesAction(){
}
}
- if ($protectedPost['Reset_modif']) {
+ if (isset($protectedPost['Reset_modif'])) {
unset($protectedGet['affect_again'], $protectedGet['affect_reset']);
}
- if ($protectedGet['affect_again'] || $protectedGet['affect_reset']) {
+ if (isset($protectedGet['affect_again']) && ($protectedGet['affect_again']) || (isset($protectedGet['affect_reset']) && $protectedGet['affect_reset'])) {
if ($protectedGet['affect_again']) {
$id_pack_affect = $protectedGet['affect_again'];
$hidden_action = 'again';
@@ -312,11 +312,11 @@ function checkForComputerPackagesAction(){
if (isset($protectedGet["suppack"]) & $_SESSION['OCS']['profile']->getConfigValue('TELEDIFF') == "YES") {
if ($_SESSION['OCS']["justAdded"] == false) {
- desactive_packet($systemid, $protectedGet["suppack"]);
+ desactive_packet($systemid ?? '', $protectedGet["suppack"]);
} else {
$_SESSION['OCS']["justAdded"] = false;
}
- addLog($l->g(512), $l->g(886) . " " . $protectedGet["suppack"] . " => " . $systemid);
+ addLog($l->g(512), $l->g(886) . " " . $protectedGet["suppack"] . " => " . $_GET["systemid"]);
} else {
$_SESSION['OCS']["justAdded"] = false;
}
diff --git a/require/function_opt_param.php b/require/function_opt_param.php
index a6d13d6db..fc5d5521a 100755
--- a/require/function_opt_param.php
+++ b/require/function_opt_param.php
@@ -64,7 +64,7 @@ function insert($NAME, $IVALUE, $TVALUE = "") {
mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg);
} else {//else : request
$i = 0;
- while ($tab_hadware_id[$i]) {
+ while (isset($tab_hadware_id[$i]) && $tab_hadware_id[$i]) {
$arg = array($tab_hadware_id[$i], $NAME, $IVALUE);
if ($TVALUE != "") {
$sql = "INSERT INTO devices(HARDWARE_ID,NAME,IVALUE,TVALUE) VALUES ('%s', '%s', '%s', '%s')";
@@ -114,7 +114,7 @@ function optperso($lbl, $lblPerso, $helpText, $optPerso, $default_value = '', $e
- $field_value, 'field_value_complement' => $field_value_complement);
- return $monRetour;
+ return array('field_value' => $field_value, 'field_value_complement' => $field_value_complement);
}
//fonction qui permet de passer en SESSION
@@ -230,7 +229,7 @@ function sql_group_cache($cache_sql) {
//requête de recherche "normale" (ressemble, exactement)
if ($cache_sql['NORMAL']) {
- foreach ($cache_sql['NORMAL'] as $poids => $list) {
+ foreach ($cache_sql['NORMAL'] as $list) {
$i = 0;
while ($list[$i]) {
$fin_sql = "";
@@ -246,7 +245,7 @@ function sql_group_cache($cache_sql) {
}
//requête de recherche "différent", "n'appartient pas"
if ($cache_sql['DIFF']) {
- foreach ($cache_sql['DIFF'] as $poids => $list) {
+ foreach ($cache_sql['DIFF'] as $list) {
$i = 0;
while ($list[$i]) {
$fin_sql = "";
@@ -534,6 +533,7 @@ function garde_check(image,id,computer)
$value) {
+ $list_id = is_array($list_id) ? implode(',', $list_id) : $list_id;
echo '';
}
?>
@@ -558,17 +558,17 @@ function multi_lot($form_name, $lbl_choise) {
} else {
$choise_req_selection['SEL'] = $l->g(585);
}
- formGroup('select', 'CHOISE', $lbl_choise, '', '', $protectedPost['CHOISE'], '', $choise_req_selection, $choise_req_selection, "onchange='$(\"#".$form_name."\").submit();'");
+ formGroup('select', 'CHOISE', $lbl_choise, '', '', $protectedPost['CHOISE'] ?? '', '', $choise_req_selection, $choise_req_selection, "onchange='$(\"#".$form_name."\").submit();'");
}
- if ($protectedPost['CHOISE'] == 'REQ' || $protectedGet['idchecked'] == '') {
+ if ((isset($protectedPost['CHOISE']) && $protectedPost['CHOISE'] == 'REQ') || $protectedGet['idchecked'] == '') {
msg_info($l->g(901));
if ($protectedGet['idchecked'] == '') {
- echo "";
+ echo "";
$protectedPost['CHOISE'] = 'REQ';
}
$list_id = $_SESSION['OCS']['ID_REQ'];
}
- if ($protectedPost['CHOISE'] == 'SEL') {
+ if (isset($protectedPost['CHOISE']) && $protectedPost['CHOISE'] == 'SEL') {
msg_info($l->g(902));
$list_id = $protectedGet['idchecked'];
}
@@ -617,6 +617,7 @@ function id_without_idgroups($list_id) {
if($result) while ($item = mysqli_fetch_object($result)) {
$res[$item->id] = $item->id;
}
- return $res;
+
+ return $res ?? null;
}
?>
diff --git a/require/function_server.php b/require/function_server.php
index a37e9fd8e..a2d13c730 100755
--- a/require/function_server.php
+++ b/require/function_server.php
@@ -280,7 +280,7 @@ function insert_with_rules($list_id, $rule_detail, $fileid) {
$not_found = array();
if (is_array($not_match) && count($not_match) > 0) {
- foreach ($not_match as $key => $value) {
+ foreach ($not_match as $value) {
$not_found[] = $value;
}
}
diff --git a/require/function_table_html.php b/require/function_table_html.php
index 7c76d689d..8f3bf18f6 100644
--- a/require/function_table_html.php
+++ b/require/function_table_html.php
@@ -70,15 +70,14 @@ function datePick($input, $checkOnClick = false) {
$cOn = ",'$checkOnClick'";
}
$ret = "";
- $ret .= "";
- return $ret;
+ ");
}
function replace_entity_xml($txt) {
@@ -258,10 +257,10 @@ function ajaxtab_entete_fixe($columns, $default_fields, $option = array(), $list
displayLayoutButtons($_SESSION['OCS']['loggeduser'], $protectedPost['layout'], $option['table_name']);
- $visible_col = json_decode($cols['VISIBLE_COL'], true) ?? $visible_col;
+ // layouts
+ $layout = new Layout($option['table_name']);
+ $cols = $layout->displayLayoutButtons($_SESSION['OCS']['loggeduser'], $protectedPost['layout'] ?? '----', $option['table_name']);
+ $visible_col = json_decode($cols['VISIBLE_COL'] ?? null, true) ?? $visible_col ?? null;
}
?>
@@ -279,8 +278,8 @@ function ajaxtab_entete_fixe($columns, $default_fields, $option = array(), $list
//Display of the result count
if (!isset($option['no_download_result'])) {
- echo "";
- echo "";
+ echo "";
+ echo "";
}
?>
@@ -542,10 +541,11 @@ function checkall()
";
@@ -575,7 +575,7 @@ function checkall()
echo "";
echo "";
- if ($_SESSION['OCS']['DEBUG'] == 'ON') {
+ if (isset($_SESSION['OCS']['DEBUG']) && $_SESSION['OCS']['DEBUG'] == 'ON') {
?>
[DEBUG]TABLE REQUEST[DEBUG]
@@ -623,7 +623,7 @@ function changerCouleur(obj, state) {
//titre du tableau
$i = 1;
- foreach ($entete_colonne as $k => $v) {
+ foreach ($entete_colonne as $v) {
if (in_array($v, $lien)) {
echo " " . $v . " | ";
} else {
@@ -640,7 +640,7 @@ function changerCouleur(obj, state) {
foreach ($data as $v2) {
($j % 2 == 0 ? $color = "#f2f2f2" : $color = "#ffffff");
echo " ";
- foreach ($v2 as $k => $v) {
+ foreach ($v2 as $v) {
if (isset($option['B'][$i])) {
$begin = "";
$end = "";
@@ -707,14 +707,13 @@ function show_modif($name, $input_name, $input_type, $input_reload = "", $config
natcasesort($name);
foreach ($name as $key => $value) {
$champs .= "";
$countHl++;
}
}
- $champs .= "";
- return $champs;
+ return $champs . "";
} elseif ($input_type == 3) {
$hid = "";
// echo $name." ";
@@ -805,8 +804,7 @@ function show_modif($name, $input_name, $input_type, $input_reload = "", $config
if ($configinput['JAVASCRIPT'] != '')
$champs .= $configinput['JAVASCRIPT'] . " ";
- $champs .= ">";
- return $champs;
+ return $champs . ">";
//"";
} elseif ($input_type == 13) {
@@ -912,9 +910,9 @@ function tab_modif_values($field_labels, $fields, $hidden_fields, $options = arr
function show_field($name_field,$type_field,$value_field,$config=array()){
global $protectedPost;
foreach($name_field as $key=>$value){
- $tab_typ_champ[$key]['DEFAULT_VALUE']=$value_field[$key];
- $tab_typ_champ[$key]['INPUT_NAME']=$name_field[$key];
- $tab_typ_champ[$key]['INPUT_TYPE']=$type_field[$key];
+ $tab_typ_champ[$key]['DEFAULT_VALUE']=$value_field[$key] ?? "";
+ $tab_typ_champ[$key]['INPUT_NAME']=$name_field[$key] ?? "";
+ $tab_typ_champ[$key]['INPUT_TYPE']=$type_field[$key] ?? "";
if (!isset($config['ROWS'][$key]) or $config['ROWS'][$key] == '')
@@ -1147,7 +1145,7 @@ function onglet($def_onglets,$form_name,$post_name,$ligne)
global $protectedPost;
/* $protectedPost['onglet_soft']=stripslashes($protectedPost['onglet_soft']);
$protectedPost['old_onglet_soft']=stripslashes($protectedPost['old_onglet_soft']);*/
- if ($protectedPost["old_".$post_name] != $protectedPost[$post_name]){
+ if (!isset($protectedPost["old_".$post_name]) || $protectedPost["old_".$post_name] != $protectedPost[$post_name]){
$protectedPost['page']=0;
}
if (!isset($protectedPost[$post_name]) and is_array($def_onglets)){
@@ -1191,7 +1189,7 @@ function show_tabs($def_onglets,$form_name,$post_name, $onclick = false)
{
global $protectedPost;
- if ($protectedPost["old_".$post_name] != $protectedPost[$post_name]){
+ if (isset($protectedPost["old_".$post_name]) && $protectedPost["old_".$post_name] != $protectedPost[$post_name]){
$protectedPost['page']=0;
}
if (!isset($protectedPost[$post_name]) and is_array($def_onglets)){
@@ -1242,7 +1240,7 @@ function gestion_col($entete,$data,$list_col_cant_del,$form_name,$tab_name,$list
//search in cookies columns values
if (isset($_COOKIE[$tab_name]) and $_COOKIE[$tab_name] != '' and !isset($_SESSION['OCS']['col_tab'][$tab_name])){
$col_tab=explode("///", $_COOKIE[$tab_name]);
- foreach ($col_tab as $key=>$value){
+ foreach ($col_tab as $value){
$_SESSION['OCS']['col_tab'][$tab_name][$value]=$value;
}
}
@@ -1317,14 +1315,14 @@ function lbl_column($list_fields){
require_once('maps.php');
$return_fields=array();
$return_default=array();
- foreach($list_fields as $poub=>$table){
+ foreach($list_fields as $table){
if (isset($lbl_column[$table])){
foreach($lbl_column[$table] as $field=>$lbl){
//echo $field;
if (isset($alias_table[$table])){
$return_fields[$lbl]=$alias_table[$table].'.'.$field;
if (isset($default_column[$table])){
- foreach($default_column[$table] as $poub2=>$default_field)
+ foreach($default_column[$table] as $default_field)
$return_default[$lbl_column[$table][$default_field]]=$lbl_column[$table][$default_field];
}else{
msg_error($table.' DEFAULT VALUES NOT DEFINE IN MAPS.PHP');
@@ -1373,7 +1371,7 @@ function ajaxfiltre($queryDetails,$tab_options){
if ($key == 3){
$rang =0;
- foreach($tab_options['visible_col'] as $index=>$column){
+ foreach($tab_options['visible_col'] as $column){
if($tab_options['columns'][$column]['name'] == $tab_options['NO_SEARCH'][$tab_options['columns'][$column]['name']]){
$tab_options['columns'][$column]['searchable'] = false;
}
@@ -1428,7 +1426,7 @@ function ajaxfiltre($queryDetails,$tab_options){
// Check if at least one of the column used in the query if full-text indexed
foreach ($tab_options['visible_col'] as $column) {
- if ($tab_options['columns'][$column]['ft_index'] == 'true') {
+ if (isset($tab_options['columns'][$column]['ft_index']) && $tab_options['columns'][$column]['ft_index'] == 'true') {
// Find the correct place where to do the full-text search in the query
if (count($sqlword['WHERE'])>1) {
$ft_queryDetails1 = $sqlword['WHERE'][0];
@@ -1526,13 +1524,13 @@ function ajaxfiltre($queryDetails,$tab_options){
}
// (Cyrille: The following 2 tests are used at least 3 times in this file. Wouldn't it be a good time to create a function?)
- if($tab_options['columns'][$column]['name'] == $tab_options['NO_SEARCH'][$tab_options['columns'][$column]['name']]){
+ if(isset($tab_options['NO_SEARCH']) && ((isset($tab_options['columns'][$column]['name']) && isset($tab_options['NO_SEARCH'][$tab_options['columns'][$column]['name']])) && $tab_options['columns'][$column]['name'] == $tab_options['NO_SEARCH'][$tab_options['columns'][$column]['name']])){
$tab_options['columns'][$column]['searchable'] = false;
}
$searchable = ($tab_options['columns'][$column]['searchable'] == "true") ? true : false;
// (Cyrille: What the hell is the purpose of this "HAVING" array?)
- if(is_array($tab_options['HAVING'])&&isset($tab_options['HAVING'][$column])){
+ if(isset($tab_options['HAVING'][$column]) && is_array($tab_options['HAVING'])){
$searchable =true;
}
@@ -1545,7 +1543,7 @@ function ajaxfiltre($queryDetails,$tab_options){
// If column is searchable and doesn't have a full-text index
if ($searchable && (empty($tab_options['columns'][$column]['ft_index']) || $tab_options['columns'][$column]['ft_index'] == 'false')) {
- if ($cname != 'c' && $tab_options['COL_SEARCH'] == 'default') {
+ if ($cname != 'c' && isset($tab_options['COL_SEARCH']) && $tab_options['COL_SEARCH'] == 'default') {
if ($index == 0){
$filter = " (( ".$cname." ".$search_arg." ) ";
} else {
@@ -1595,7 +1593,7 @@ function ajaxsort(&$tab_options) {
// field name is IP format alike
if (in_array(mb_strtoupper($cleanname),$tab_iplike)) {
$tri .= " INET_ATON(".$cleanname.") ".$v['dir'].", ";
- } else if($tab_options['TRI']['DATE'][$cleanname]) {
+ } else if(isset($tab_options['TRI']['DATE'][$cleanname])) {
if(isset($tab_options['ARG_SQL'])) {
$tri .= " STR_TO_DATE(%s,'%s') %s";
$tab_options['ARG_SQL'][] = $cleanname;
@@ -1665,7 +1663,7 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
$form_name=$tab_options['form_name'];
$_SESSION['OCS']['list_fields'][$tab_options['table_name']]=$list_fields;
$_SESSION['OCS']['col_tab'][$tab_options['table_name']]= array_flip($list_fields);
- if($resultDetails){
+ if(!empty($resultDetails->num_rows)){
while($row = mysqli_fetch_assoc($resultDetails))
{
if (isset($tab_options['AS'])){
@@ -1684,7 +1682,7 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
foreach($list_fields as $key=>$column){
$name = explode('.',$column);
$column = end($name);
- $value_of_field = $row[$column];
+ $value_of_field = $row[$column] ?? '';
switch($key){
case "CHECK":
// condition below added to fix static grp visbility checkbox
@@ -1722,12 +1720,12 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
case "NAME":
if ( !isset($tab_options['NO_NAME']['NAME'])){
$link_computer="index.php?".PAG_INDEX."=".$pages_refs['ms_computer']."&head=1";
- if ($row['ID'])
+ if (isset($row['ID']))
$link_computer.="&systemid=".$row['ID'];
- elseif($row['hardwareID'])
+ elseif(isset($row['hardwareID']))
$link_computer.="&systemid=".$row['hardwareID'];
- if ($row['MD5_DEVICEID'])
+ if (isset($row['MD5_DEVICEID']))
$link_computer.= "&crypt=".$row['MD5_DEVICEID'];
$row[$column]="".$value_of_field."";
}
@@ -1796,7 +1794,7 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
$row[$column]="".percent_bar($value_of_field)."";
}
- if (!empty($tab_options['REPLACE_VALUE'][$key])){
+ if (isset($tab_options['REPLACE_VALUE'][$key])){
$temp_val=explode('&&&',$value_of_field);
if (count($temp_val)==1) {
$temp_val=explode('&&&',$value_of_field);
@@ -1813,17 +1811,19 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
$row[$column]=$value_of_field;
}
else {
- $row[$column]=$tab_options['REPLACE_VALUE'][$key][$value_of_field];
+ $row[$column]=$tab_options['REPLACE_VALUE'][$key][$value_of_field] ?? null;
}
}
if(!empty($tab_options['VALUE'][$key])){
if(!empty($tab_options['LIEN_CHAMP'][$key])){
- $value_of_field=$tab_options['VALUE'][$key][$row[$tab_options['LIEN_CHAMP'][$key]]];
+ $value_of_field=$tab_options['VALUE'][$key][$row[$tab_options['LIEN_CHAMP'][$key]]] ?? '';
}else{
+ if(isset($tab_options['VALUE'][$key][$row['ID']])) {
$row[$column] = $tab_options['VALUE'][$key][$row['ID']];
}
}
- if(!empty($tab_options['REPLACE_VALUE_ALL_TIME'][$key][$row[$tab_options['FIELD_REPLACE_VALUE_ALL_TIME']]])){
+ }
+ if(isset($tab_options['REPLACE_VALUE_ALL_TIME']) && !empty($tab_options['REPLACE_VALUE_ALL_TIME'][$key][$row[$tab_options['FIELD_REPLACE_VALUE_ALL_TIME']]])){
$row[$column]=$tab_options['REPLACE_VALUE_ALL_TIME'][$key][$row[$tab_options['FIELD_REPLACE_VALUE_ALL_TIME']]];
}
if (!empty($tab_options['LIEN_LBL'][$key])){
@@ -1839,11 +1839,11 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
}
if(!empty($tab_options['COLOR'][$key])){
- $row[$column]= "".$row[$column]."";
+ $row[$column]= "".($row[$column] ?? '')."";
}
if(!empty($tab_options['SHOW_ONLY'][$key])){
if(empty($tab_options['SHOW_ONLY'][$key][$value_of_field])&& empty($tab_options['EXIST'][$key])
- ||(reset($tab_options['SHOW_ONLY'][$key]) == $row[$tab_options['EXIST'][$key]])){
+ ||(isset($tab_options['EXIST']) && reset($tab_options['SHOW_ONLY'][$key]) == $row[$tab_options['EXIST'][$key]])){
$row[$key]="";
}
}
@@ -1860,10 +1860,15 @@ function ajaxgestionresults($resultDetails,$list_fields,$tab_options){
"ARCHIVER",
"RESTORE",
);
- foreach($actions as $action){
- $row['ACTIONS'].= " ".$row[$action];
+
+ $row['ACTIONS'] = '';
+ foreach($actions as $action){
+ if(isset($row[$action])) {
+ $row['ACTIONS'].= " ".$row[$action];
+ }
}
$rows[] = $row;
+
}
}else{
$rows = 0;
@@ -1948,7 +1953,7 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
$visible++;
}
}
- $data = json_encode($tab_options['visible_col']);
+ $data = json_encode($tab_options['visible_col'] ?? null);
$customized=false;
if (isset($tab_options['visible_col']) && count($tab_options['visible_col'])!=$visible){
$customized=true;
@@ -1966,7 +1971,7 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
}
if (isset($tab_options['REQUEST'])){
foreach ($tab_options['REQUEST'] as $field_name => $value){
- $resultDetails = mysql2_query_secure($value, $_SESSION['OCS']["readServer"],$tab_options['ARG'][$field_name]);
+ $resultDetails = mysql2_query_secure($value, $_SESSION['OCS']["readServer"],$tab_options['ARG'][$field_name] ?? '');
while($item = mysqli_fetch_object($resultDetails)){
if ($item -> FIRST != "")
$tab_options['SHOW_ONLY'][$field_name][$item -> FIRST]=$item -> FIRST;
@@ -1988,16 +1993,15 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
}else{
//add sort on column if need it
- if ($protectedPost['tri_fixe']!='' and strstr($sql,$protectedPost['tri_fixe'])){
+ if (!empty($protectedPost['tri_fixe']) && strstr($sql,$protectedPost['tri_fixe'])){
$sql.=" order by '%s' %s";
array_push($protectedPost['tri_fixe'],$arg);
array_push($protectedPost['sens_'.$table_name],$arg);
}
- $sql.= $limit;
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"],$arg);
}
while($item = mysqli_fetch_object($result)){
- if ($item->HARDWARE_ID != "")
+ if (!empty($item->HARDWARE_ID))
$champs_index=$item->HARDWARE_ID;
elseif($item->FILEID != "")
$champs_index=$item->FILEID;
@@ -2038,7 +2042,9 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
$_SESSION['OCS']['csv']['SQLNOLIMIT'][$tab_options['table_name']]=$queryDetails;
$queryDetails .= ajaxlimit($tab_options);
$_SESSION['OCS']['csv']['SQL'][$tab_options['table_name']]=$queryDetails;
+ if(isset($tab_options['REPLACE_VALUE'])) {
$_SESSION['OCS']['csv']['REPLACE_VALUE'][$tab_options['table_name']]=$tab_options['REPLACE_VALUE'];
+ }
if (isset($tab_options['ARG_SQL']))
$_SESSION['OCS']['csv']['ARG'][$tab_options['table_name']]=$tab_options['ARG_SQL'];
@@ -2056,7 +2062,7 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
$rows=0;
}
- if(is_array($_SESSION['OCS']['SQL_DEBUG']) && ($_SESSION['OCS']['DEBUG'] == 'ON')){
+ if(isset($_SESSION['OCS']['SQL_DEBUG']) && is_array($_SESSION['OCS']['SQL_DEBUG']) && ($_SESSION['OCS']['DEBUG'] == 'ON')){
$debug = end($_SESSION['OCS']['SQL_DEBUG']);
}
// Data set length after filtering
@@ -2075,7 +2081,7 @@ function tab_req($list_fields,$default_fields,$list_col_cant_del,$queryDetails,$
}else{
$recordsTotal=$recordsFiltered;
}
- if(is_array($_SESSION['OCS']['SQL_DEBUG']) && ($_SESSION['OCS']['DEBUG'] == 'ON')){
+ if(isset($_SESSION['OCS']['SQL_DEBUG']) && is_array($_SESSION['OCS']['SQL_DEBUG']) && ($_SESSION['OCS']['DEBUG'] == 'ON')){
$res = array("draw"=> $tab_options['draw'],"recordsTotal"=> $recordsTotal,
"recordsFiltered"=> $recordsFiltered, "data"=>$rows, "customized"=>$customized,
"debug"=>$debug);
diff --git a/require/function_telediff.php b/require/function_telediff.php
index 27b09fa3e..dc7ccca90 100644
--- a/require/function_telediff.php
+++ b/require/function_telediff.php
@@ -109,7 +109,7 @@ function desactive_option($name, $list_id, $packid) {
$res_desactive = mysql2_query_secure($sql['SQL'], $_SESSION['OCS']["writeServer"], $sql['ARG'], $l->g(512));
} else {
$sql_desactive .= " and hardware_id=%s";
- $arg_desactive[] = $_GET['systemid'];
+ $arg_desactive[] = $_GET['systemid'] ?? '';
$res_desactive = mysql2_query_secure($sql_desactive, $_SESSION['OCS']["writeServer"], $arg_desactive, $l->g(512));
}
return( mysqli_affected_rows($_SESSION['OCS']["writeServer"]) );
@@ -120,7 +120,7 @@ function active_option($name, $list_id, $packid, $tvalue = '') {
if(strpos($packid, ',')) {
$pack_id = explode(',',$packid);
- foreach($pack_id as $key => $value){
+ foreach($pack_id as $value){
desactive_option($name, $list_id, $value);
$sql_active = "insert into devices (HARDWARE_ID, NAME, IVALUE,TVALUE) select ID,'%s','%s',";
if ($tvalue == '') {
@@ -158,8 +158,7 @@ function desactive_download_option($list_id, $packid) {
function desactive_packet($list_id, $packid) {
desactive_download_option($list_id, $packid);
- $nb_line = desactive_option('DOWNLOAD', $list_id, $packid);
- return $nb_line;
+ return desactive_option('DOWNLOAD', $list_id, $packid);
}
function active_serv($list_id, $packid, $id_rule) {
@@ -306,7 +305,7 @@ function del_pack($fileid) {
$list_id[] = $valEnable["id"];
}
//delete packet in DEVICES table
- if ($list_id != "") {
+ if (!empty($list_id)) {
foreach ($list_id as $v) {
desactive_packet('', $v);
}
@@ -609,14 +608,12 @@ function found_info_pack($id) {
$sql = "select NAME,PRIORITY,FRAGMENTS,SIZE,OSNAME,COMMENT from download_available where fileid=%s";
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $id);
- $val = mysqli_fetch_array($res);
- return $val;
+ return mysqli_fetch_array($res);
}
function multiexplode ($delimiters, $date)
{
$ready = str_replace($delimiters, $delimiters[0], $date);
- $launch = explode($delimiters[0], $ready);
- return $launch;
+ return explode($delimiters[0], $ready);
}
?>
diff --git a/require/function_users.php b/require/function_users.php
index 16e7eb341..389627e8c 100644
--- a/require/function_users.php
+++ b/require/function_users.php
@@ -97,7 +97,7 @@ function add_user($data_user, $list_profil = '') {
$ERROR = $l->g(1391) . ' : ' . $l->g(1366);
}
// Password ok ?
- if (trim($data_user['PASSWORD']) == "" && trim($data_user['MODIF']) == "") {
+ if (trim($data_user['PASSWORD']) == "" && (isset($data_user['MODIF']) && trim($data_user['MODIF']) == "")) {
$ERROR = $l->g(1391) . ' : ' . $l->g(217);
}
// Login ok ?
@@ -110,7 +110,7 @@ function add_user($data_user, $list_profil = '') {
$ERROR = $l->g(998);
}
}
- if($ERROR == ""){
+ if(isset($ERROR) && $ERROR == ""){
unset($ERROR);
}
if (!isset($ERROR)) {
@@ -134,7 +134,7 @@ function add_user($data_user, $list_profil = '') {
$data_user['ACCESSLVL'],
$data_user['EMAIL'],
$data_user['COMMENTS'],
- $data_user['USER_GROUP']);
+ $data_user['USER_GROUP'] ?? '');
if (is_defined($data_user['PASSWORD'])) {
$sql_update .= ", passwd ='%s' , password_version ='%s' ";
$arg_update[] = hash(PASSWORD_CRYPT, $password);
@@ -158,7 +158,7 @@ function add_user($data_user, $list_profil = '') {
$data_user['ACCESSLVL'],
$data_user['EMAIL'],
$data_user['COMMENTS'],
- $data_user['USER_GROUP']);
+ $data_user['USER_GROUP'] ?? '');
if (isset($password)) {
$sql .= ",'%s','%s'";
$arg[] = hash(PASSWORD_CRYPT, $password);
@@ -189,7 +189,7 @@ function admin_user($id_user = null, $is_my_account = false) {
//search all profil type
$list_profil = get_profile_labels();
$list_groups_result = look_config_default_values("USER_GROUP_%", 'LIKE');
- if (is_array($list_groups_result['name'])) {
+ if (!empty($list_groups_result['name']) && is_array($list_groups_result['name'])) {
foreach ($list_groups_result['name'] as $key => $value) {
$list_groups[$list_groups_result['ivalue'][$key]] = $list_groups_result['tvalue'][$key];
}
@@ -228,25 +228,25 @@ function admin_user($id_user = null, $is_my_account = false) {
$res=mysql2_query_secure($sql, $_SESSION['OCS']["readServer"],$arg);
$row=mysqli_fetch_object($res);
if ($_SESSION['OCS']['profile']->getConfigValue('CHANGE_USER_GROUP') == 'YES'){
- $protectedPost['ACCESSLVL']=$row->NEW_ACCESSLVL;
- $protectedPost['USER_GROUP']=$row->USER_GROUP;
- $value_field=array($row->ID,$list_profil,$list_groups);
+ $protectedPost['ACCESSLVL'] = $row->NEW_ACCESSLVL ?? null;
+ $protectedPost['USER_GROUP'] = $row->USER_GROUP ?? null;
+ $value_field = array($row->ID ?? null, $list_profil, $list_groups);
}else{
- $protectedPost['ACCESSLVL']=$row->NEW_ACCESSLVL;
- $value_field= array($row->ID, $protectedPost['ACCESSLVL']);
+ $protectedPost['ACCESSLVL'] = $row->NEW_ACCESSLVL ?? null;
+ $value_field = array($row->ID ?? null, $protectedPost['ACCESSLVL']);
}
- $value_field[]=$row->FIRSTNAME;
- $value_field[]=$row->LASTNAME;
- $value_field[]=$row->EMAIL;
- $value_field[]=$row->COMMENTS;
+ $value_field[] = $row->FIRSTNAME ?? "";
+ $value_field[] = $row->LASTNAME ?? "";
+ $value_field[] = $row->EMAIL ?? "";
+ $value_field[] = $row->COMMENTS ?? "";
- $name_field[]="PASSWORD";
- $type_field[]=4;
- $tab_name[]=$l->g(217)." :";
- $value_field[]=$protectedPost['PASSWORD'];
+ $name_field[] = "PASSWORD";
+ $type_field[] = 4;
+ $tab_name[] = $l->g(217)." :";
+ $value_field[] = $protectedPost['PASSWORD'] ?? "";
- $tab_typ_champ=show_field($name_field,$type_field,$value_field);
+ $tab_typ_champ = show_field($name_field,$type_field,$value_field);
foreach ($tab_typ_champ as $id=>$values){
$tab_typ_champ[$id]['CONFIG']['SIZE']=40;
}
@@ -265,7 +265,7 @@ function admin_user($id_user = null, $is_my_account = false) {
$selectValues = '';
$inputName = $tab_typ_champ[$index]['INPUT_NAME'];
- $inputValue = $protectedPost[$inputName];
+ $inputValue = $protectedPost[$inputName] ?? null;
if($indexType == 0 ||
$indexType == 1 ||
@@ -302,7 +302,7 @@ function admin_user($id_user = null, $is_my_account = false) {
if($inputName == "ID" && $id_user != null && ($_SESSION['OCS']['profile']->getConfigValue('CHANGE_USER_GROUP') == 'YES')){
formGroup('text', $inputName, $fields, '', '', $id_user, '', $selectValues, $selectValues, 'readonly', '');
}else{
- if($tab_typ_champ[$index]['COMMENT_AFTER'] === null){
+ if(empty($tab_typ_champ[$index]['COMMENT_AFTER'])){
$tab_typ_champ[$index]['COMMENT_AFTER'] = "";
}
if($inputType != 'select'){
diff --git a/require/header.php b/require/header.php
index 05a37297d..224c53eb4 100644
--- a/require/header.php
+++ b/require/header.php
@@ -36,11 +36,14 @@
@session_start();
error_reporting(E_ALL & ~E_NOTICE);
/* * ******************************************FIND SERVER URL*************************************** */
-$addr_server = explode('/', $_SERVER['HTTP_REFERER']);
-array_pop($addr_server);
-define("OCSREPORT_URL", implode('/', $addr_server));
+if (isset($_SERVER['HTTP_REFERER'])) {
+ $addr_server = explode('/', $_SERVER['HTTP_REFERER']);
+ array_pop($addr_server);
+ define("OCSREPORT_URL", implode('/', $addr_server));
+}
+
-if ($_SESSION['OCS']['LOG_GUI'] == 1) {
+if (isset($_SESSION['OCS']['LOG_GUI']) && $_SESSION['OCS']['LOG_GUI'] == 1) {
define("LOG_FILE", $_SESSION['OCS']['LOG_DIR'] . "log.csv");
}
@@ -62,7 +65,7 @@
}
//If you have to reload conf
-if ($_POST['RELOAD_CONF'] == 'RELOAD') {
+if (isset($_POST['RELOAD_CONF']) && $_POST['RELOAD_CONF'] == 'RELOAD') {
$_SESSION['OCS']['CONF_RESET'] = true;
}
@@ -117,16 +120,16 @@
/* * *********************************************************LOGS ADMIN************************************************************************ */
-if (!isset($_SESSION['OCS']['LOG_GUI'])) {
+ if (!isset($_SESSION['OCS']['LOG_GUI'])) {
$values = look_config_default_values(array('LOG_GUI', 'LOG_DIR', 'LOG_SCRIPT'));
- $_SESSION['OCS']['LOG_DIR'] = $values['tvalue']['LOG_DIR'];
+ $_SESSION['OCS']['LOG_DIR'] = $values['tvalue']['LOG_DIR'] ?? "";
if ($_SESSION['OCS']['LOG_DIR']) {
$_SESSION['OCS']['LOG_DIR'] .= '/logs/';
} else {
$_SESSION['OCS']['OLD_CONF_DIR'] = VARLOG_DIR . '/logs/';
}
- $_SESSION['OCS']['LOG_GUI'] = $values['ivalue']['LOG_GUI'];
- if ($_SESSION['OCS']['LOG_SCRIPT']) {
+ $_SESSION['OCS']['LOG_GUI'] = $values['ivalue']['LOG_GUI'] ?? "";
+ if (isset($_SESSION['OCS']['LOG_SCRIPT'])) {
$_SESSION['OCS']['LOG_SCRIPT'] .= "/scripts/";
} else {
$_SESSION['OCS']['OLD_CONF_DIR'] = VARLOG_DIR . '/scripts/';
@@ -137,14 +140,14 @@
/* * *********************************************************CONF DIRECTORY************************************************************************ */
if (!isset($_SESSION['OCS']['CONF_PROFILS_DIR'])) {
$values = look_config_default_values(array('CONF_PROFILS_DIR', 'OLD_CONF_DIR'));
- $_SESSION['OCS']['OLD_CONF_DIR'] = $values['tvalue']['OLD_CONF_DIR'];
+ $_SESSION['OCS']['OLD_CONF_DIR'] = $values['tvalue']['OLD_CONF_DIR'] ?? null;
if ($_SESSION['OCS']['OLD_CONF_DIR']) {
$_SESSION['OCS']['OLD_CONF_DIR'] .= '/old_conf/';
} else {
$_SESSION['OCS']['CONF_PROFILS_DIR'] = ETC_DIR . '/' . MAIN_SECTIONS_DIR . 'old_conf/';
}
- $_SESSION['OCS']['CONF_PROFILS_DIR'] = $values['tvalue']['CONF_PROFILS_DIR'];
+ $_SESSION['OCS']['CONF_PROFILS_DIR'] = $values['tvalue']['CONF_PROFILS_DIR'] ?? null;
if ($_SESSION['OCS']['CONF_PROFILS_DIR']) {
$_SESSION['OCS']['CONF_PROFILS_DIR'] .= '/conf/';
} else {
@@ -157,7 +160,7 @@
/* * ****************************************Checking sql update******************************************** */
if (!isset($_SESSION['OCS']['SQL_BASE_VERS'])) {
$values = look_config_default_values('GUI_VERSION');
- $_SESSION['OCS']['SQL_BASE_VERS'] = $values['tvalue']['GUI_VERSION'];
+ $_SESSION['OCS']['SQL_BASE_VERS'] = $values['tvalue']['GUI_VERSION'] ?? "";
}
if (GUI_VER != $_SESSION['OCS']['SQL_BASE_VERS']) {
$fromAuto = true;
@@ -178,7 +181,9 @@
//SECURITY
$protectedPost = strip_tags_array($_POST);
-$protectedGet = strip_tags_array($_GET);
+if(isset($_GET)) {
+ $protectedGet = strip_tags_array($_GET);
+}
@set_time_limit(0);
@@ -374,10 +379,12 @@
require_once (HEADER_HTML);
}
-$url_name = $urls->getUrlName($protectedGet[PAG_INDEX]);
+if (isset($protectedGet[PAG_INDEX])) {
+ $url_name = $urls->getUrlName($protectedGet[PAG_INDEX]);
+}
//VERIF ACCESS TO THIS PAGE
-if (isset($protectedGet[PAG_INDEX]) && !$profile->hasPage($url_name) && (!$_SESSION['OCS']['TRUE_PAGES'] || !array_search($url_name, $_SESSION['OCS']['TRUE_PAGES']))
+if (isset($protectedGet[PAG_INDEX]) && !$profile->hasPage($url_name) && (!isset($_SESSION['OCS']['TRUE_PAGES']) || !array_search($url_name, $_SESSION['OCS']['TRUE_PAGES']))
//force access to profils witch have CONFIGURATION TELEDIFF == 'YES' for ms_admin_ipdiscover page
&& !($profile->getConfigValue('TELEDIFF') == 'YES' && $url_name == 'ms_admin_ipdiscover')) {
msg_error("ACCESS DENIED");
@@ -391,13 +398,13 @@
die();
}
-if ($url_name) {
+if (isset($url_name)) {
//CSRF security
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$csrf = true;
if (isset($_SESSION['OCS']['CSRF'])) {
foreach ($_SESSION['OCS']['CSRF'] as $k => $v) {
- if ($v == $protectedPost['CSRF_' . $k]) {
+ if (isset($protectedPost['CSRF_' . $k]) && $v == $protectedPost['CSRF_' . $k]) {
$csrf = false;
}
}
diff --git a/require/html_header.php b/require/html_header.php
index 9f4724f35..ec67377af 100644
--- a/require/html_header.php
+++ b/require/html_header.php
@@ -60,7 +60,7 @@
wait...";
}
} else if (!isset($_SESSION['OCS']['DEBUG'])) {
- if (($_SESSION['OCS']['profile'] && $_SESSION['OCS']['profile']->hasPage('ms_debug')) || (is_array($_SESSION['OCS']['TRUE_PAGES']) && array_search('ms_debug', $_SESSION['OCS']['TRUE_PAGES']))) {
+ if (($_SESSION['OCS']['profile'] && $_SESSION['OCS']['profile']->hasPage('ms_debug')) || (isset($_SESSION['OCS']['TRUE_PAGES']) && is_array($_SESSION['OCS']['TRUE_PAGES']) && array_search('ms_debug', $_SESSION['OCS']['TRUE_PAGES']))) {
echo " " . $l->g(1011) . "";
}
}
echo "";
}
- if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['HTTP_AUTH_USER']) && $_SESSION['OCS']['cnx_origine'] != 'CAS') {
+ if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['HTTP_AUTH_USER']) && (isset($_SESSION['OCS']['cnx_origine']) && $_SESSION['OCS']['cnx_origine'] != 'CAS')) {
echo " " . $l->g(251) . "";
}
echo open_form('log_out', 'index.php');
@@ -124,7 +124,7 @@
$need_display = look_config_default_values("WARN_UPDATE");
if ($need_display['ivalue']['WARN_UPDATE'] == '1') {
$data = get_update_json();
- if (GUI_VER_SHOW < $data->version) {
+ if (!empty($data) && GUI_VER_SHOW < $data->version) {
$txt = $l->g(2118) . " " . $data->version . " " . $l->g(2119);
$txt .= " " . $l->g(2120) . "";
@@ -133,7 +133,7 @@
}
//defaut user already exist on databases?
- if($_SESSION['OCS']['defaultsql_checked'] == null){
+ if(isset($_SESSION['OCS']['defaultsql_checked']) && $_SESSION['OCS']['defaultsql_checked'] == null || !array_key_exists('defaultsql_checked', $_SESSION['OCS'])){
try {
// First sql check has been done
$_SESSION['OCS']['defaultsql_checked'] = true;
@@ -171,7 +171,7 @@
}
}
- if($_SESSION['OCS']['defaultsql_error'] != null){
+ if(!empty($_SESSION['OCS']['defaultsql_error'])){
$msg_header_error[] = $l->g(2024) . ' ' . DB_NAME;
$msg_header_error_sol[] = $l->g(2025);
}
@@ -224,7 +224,7 @@
}
}
-if (isset($_SESSION['OCS']['TRUE_USER']) && !$protectedPost['MODE'] == 5 ) {
+if (isset($_SESSION['OCS']['TRUE_USER']) && (isset($protectedPost['MODE']) && !$protectedPost['MODE'] == 5) ) {
msg_info($_SESSION['OCS']['TRUE_USER'] . " " . $l->g(889) . " " . $_SESSION['OCS']["loggeduser"]);
}
@@ -234,7 +234,7 @@
echo " ";
-if ($_SESSION['OCS']["mesmachines"] == "NOTAG" && !(array_search('ms_debug', $_SESSION['OCS']['TRUE_PAGES']['ms_debug']) && $protectedGet[PAG_INDEX] == $pages_refs['ms_debug'])) {
+if (isset($_SESSION['OCS']["mesmachines"]) && $_SESSION['OCS']["mesmachines"] == "NOTAG" && !(array_search('ms_debug', $_SESSION['OCS']['TRUE_PAGES']['ms_debug']) && $protectedGet[PAG_INDEX] == $pages_refs['ms_debug'])) {
if (isset($LIST_ERROR)) {
$msg_error = $LIST_ERROR;
} else {
diff --git a/require/ipdiscover/Ipdiscover.php b/require/ipdiscover/Ipdiscover.php
index 897a53c50..46752e460 100644
--- a/require/ipdiscover/Ipdiscover.php
+++ b/require/ipdiscover/Ipdiscover.php
@@ -28,7 +28,7 @@
class Ipdiscover
{
- public $IPDISCOVER_TAG = null;
+ public $IPDISCOVER_TAG;
function __construct() {
$champs = array('IPDISCOVER_LINK_TAG_NETWORK' => 'IPDISCOVER_LINK_TAG_NETWORK');
@@ -36,7 +36,7 @@ function __construct() {
// Get configuration values from DB
$values = look_config_default_values($champs);
- $this->IPDISCOVER_TAG = $values['ivalue']["IPDISCOVER_LINK_TAG_NETWORK"];
+ $this->IPDISCOVER_TAG = $values['ivalue']["IPDISCOVER_LINK_TAG_NETWORK"] ?? 0;
}
public function verif_base_methode($base) {
@@ -59,8 +59,7 @@ public function find_info_subnet($netid, $tag = null) {
$sql = "SELECT NETID, NAME, ID, MASK, TAG FROM subnet WHERE CONCAT(NETID,IFNULL(TAG, '')) = '%s'";
$arg = array($netid.$tag);
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
public function form_add_subnet($title = '', $default_value, $form, $is_tag_linked, $post) {
@@ -111,7 +110,7 @@ public function form_add_subnet($title = '', $default_value, $form, $is_tag_link
foreach ($tab_typ_champ as $id => $values) {
$tab_typ_champ[$id]['CONFIG']['SIZE'] = 30;
if($tab_typ_champ[$id]["INPUT_TYPE"] == 2) {
- $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $post[$tab_typ_champ[$id]['INPUT_NAME']];
+ $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $post[$tab_typ_champ[$id]['INPUT_NAME']] ?? '';
}
}
@@ -191,8 +190,7 @@ public function find_info_type($name = '', $id = '', $update = '') {
$arg[] = $update;
}
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
public function add_type($name, $update = '') {
@@ -240,35 +238,35 @@ public function loadMac() {
}
}
- public function form_add_community($title = '', $default_value, $form) {
+ public function form_add_community($default_value, $form, $title = '') {
global $l, $protectedPost;
$name_field = array("NAME", "VERSION");
$tab_name = array($l->g(49) . ": ", $l->g(1199) . ": ");
$type_field = array(0, 2);
$value_field = array($default_value['NAME'], $default_value['VERSION']);
- if ($protectedPost['VERSION'] == '3') {
+ if (isset($protectedPost['VERSION']) && $protectedPost['VERSION'] == '3') {
array_push($name_field, "USERNAME", "LEVEL", "AUTHPASSWD", "AUTHPROTO", "PRIVPASSWD", "PRIVPROTO");
array_push($tab_name, "USERNAME : ", "LEVEL : ", "AUTHPASSWD :", "AUTHPROTO :", "PRIVPASSWD :", "PRIVPROTO :");
array_push($type_field, 0, 2, 0, 2, 0, 2);
array_push($value_field, $default_value['USERNAME'], $default_value['LEVEL'], $default_value['AUTHPASSWD'], $default_value['AUTHPROTO'], $default_value['PRIVPASSWD'], $default_value['PRIVPROTO']);
}
- $tab_typ_champ = show_field($name_field, $type_field, $value_field, $config);
+ $tab_typ_champ = show_field($name_field, $type_field, $value_field);
foreach ($tab_typ_champ as $id => $values) {
$tab_typ_champ[$id]['CONFIG']['SIZE'] = 30;
if($tab_typ_champ[$id]["INPUT_TYPE"] == 2) {
- $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $protectedPost[$tab_typ_champ[$id]['INPUT_NAME']];
+ $tab_typ_champ[$id]['CONFIG']['SELECTED_VALUE'] = $protectedPost[$tab_typ_champ[$id]['INPUT_NAME']] ?? '';
}
}
$tab_typ_champ[1]['RELOAD'] = $form;
- if (is_numeric($protectedPost['MODIF'])) {
+ if (isset($protectedPost['MODIF']) && is_numeric($protectedPost['MODIF'])) {
$tab_hidden['MODIF'] = $protectedPost['MODIF'];
}
- $tab_hidden['ADD_COMM'] = $protectedPost['ADD_COMM'];
- $tab_hidden['ID'] = $protectedPost['ID'];
+ $tab_hidden['ADD_COMM'] = $protectedPost['ADD_COMM'] ?? '';
+ $tab_hidden['ID'] = $protectedPost['ID'] ?? 0;
modif_values($tab_name, $tab_typ_champ, $tab_hidden, array(
'title' => $title,
'show_frame' => false
@@ -319,11 +317,10 @@ public function find_community_info($id) {
$sql = "select * from snmp_communities where id=%s";
$arg = $id;
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- $row = mysqli_fetch_object($res);
- return $row;
+ return mysqli_fetch_object($res);
}
- public function runCommand($command = "", $fname) {
+ public function runCommand($fname, $command = "") {
$command = "perl ipdiscover-util.pl $command -xml -h=" . SERVER_READ . " -P=" . SERVER_PORT . " -u=" . COMPTE_BASE . " -p=" . PSWD_BASE . " -d=" . DB_NAME . " -path=" . $fname;
exec($command);
}
diff --git a/require/layouts/Layout.php b/require/layouts/Layout.php
index 63896b9a4..33d6adcd3 100644
--- a/require/layouts/Layout.php
+++ b/require/layouts/Layout.php
@@ -121,12 +121,11 @@ public function displayLayoutButtons($user, $current_tab, $table) {
foreach ($layout_tabs as $key => $value) {
echo " ";
}
diff --git a/require/mail/NotificationMail.php b/require/mail/NotificationMail.php
index 1c011b0bb..ce16a509a 100644
--- a/require/mail/NotificationMail.php
+++ b/require/mail/NotificationMail.php
@@ -88,6 +88,7 @@ public function insert_info_smtp($infos){
$infos['NOTIF_PROG_DAY'] = $this->number_day($infos);
$sql="SELECT * FROM notification_config";
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
+ $verif = [];
while($row = mysqli_fetch_array($result)){
$verif[$row['NAME']]= $row['NAME'];
}
@@ -110,6 +111,7 @@ public function insert_info_smtp($infos){
* @return string [description]
*/
private function number_day($infos){
+ $day = "";
foreach($infos as $key => $value){
if(array_key_exists($key, $this->week)){
$day .= $this->week[$key] . ",";
@@ -128,8 +130,8 @@ public function get_info_smtp(){
while($row = mysqli_fetch_array($result)){
if($row['NAME'] == 'NOTIF_PROG_DAY'){
$day[] = explode(",", $row['TVALUE']);
- foreach($day as $key => $value){
- foreach($value as $keys => $values){
+ foreach($day as $value){
+ foreach($value as $values){
if($values != ''){
$this->info[$values] = $values;
}
@@ -183,7 +185,7 @@ public function config_mailer(){
* send notification with phpMailer
* @return void
*/
- public function send_notification($subject, $body, $altBody = '', $selected, $isHtml = false ){
+ public function send_notification($subject, $body, $selected, $altBody = '', $isHtml = false ){
$body = $this->replace_value($body, $selected);
@@ -234,25 +236,27 @@ public function replace_value($file, $selected){
if(strpos($template, "{{") !== false){
$explode1 = explode("{{", $template);
- foreach($explode1 as $key => $value){
+ foreach($explode1 as $value){
if(strpos($value, "}}") !== false){
$explode2[] = explode("}}", $value);
}
}
- foreach ($explode2 as $key => $values){
- foreach ($values as $nb => $trad){
- if(strpos($trad, "<") === false){
+ foreach ($explode2 as $values){
+ foreach ($values as $trad){
+ if(!strpos($trad, "<")){
$explode3[] = $trad;
}
}
}
- foreach ($explode3 as $keys => $replace){
+ foreach ($explode3 as $replace){
if(strpos($replace, "g") !== false){
$traduction = explode(".", $replace);
$pattern[] = $replace;
- $replacement[] = $l->g($traduction[1]);
+ if(isset($traduction[1])) {
+ $replacement[] = $l->g($traduction[1]);
+ }
}elseif($replace == 'Report.Asset'){
$pattern[] = $replace;
$asset->get_assets();
@@ -262,9 +266,8 @@ public function replace_value($file, $selected){
$replacement[] = $soft->get_table_html_soft();
}
}
- $output = str_replace($pattern, $replacement, $template);
- return $output;
+ return str_replace($pattern, $replacement, $template);
}else{
return $template;
}
diff --git a/require/menu/ComputerMenuRenderer.php b/require/menu/ComputerMenuRenderer.php
index 94a6a14b4..50e47f170 100755
--- a/require/menu/ComputerMenuRenderer.php
+++ b/require/menu/ComputerMenuRenderer.php
@@ -25,13 +25,14 @@
* Renders the computer menu
*/
class ComputerMenuRenderer extends MenuRenderer {
- private $computer_id;
- private $urls;
+
+ private $computer_id;
+ private $urls;
public function __construct($computer_id, $urls) {
parent::__construct();
- $this->computer_id = $computer_id;
+ $this->computer_id = $computer_id;
$this->urls = $urls;
}
diff --git a/require/menu/Menu.php b/require/menu/Menu.php
index ccb63feee..21143b6eb 100755
--- a/require/menu/Menu.php
+++ b/require/menu/Menu.php
@@ -37,7 +37,7 @@ class Menu {
* @param array $_children An array of MenuElem
* @param number $_priority The priority of this element to sort
*/
- public function __construct(array $_children = array(), $_priority = 0) {
+ public function __construct($_children = array(), $_priority = 0) {
$this->_children = $_children;
$this->_priority = $_priority;
}
diff --git a/require/menu/MenuElem.php b/require/menu/MenuElem.php
index bfb2949ad..668ed8fd8 100755
--- a/require/menu/MenuElem.php
+++ b/require/menu/MenuElem.php
@@ -32,15 +32,15 @@ class MenuElem extends Menu {
/**
* The constructor
- *
- * @param string $label Label
- * @param string $url Url
+ *
+ * @param string $_label Label
+ * @param string $_url Url
* @param array $_children Children
* @param number $_priority The priority of the MenuElem
*/
- public function __construct($label, $url, array $_children = array(), $_priority = 0) {
- $this->_label = $label;
- $this->_url = $url;
+ public function __construct($_label, $_url, array $_children = array(), $_priority = 0) {
+ $this->_label = $_label;
+ $this->_url = $_url;
parent::__construct($_children, $_priority);
}
diff --git a/require/menu/MenuRenderer.php b/require/menu/MenuRenderer.php
index 2b60ad532..688200bff 100644
--- a/require/menu/MenuRenderer.php
+++ b/require/menu/MenuRenderer.php
@@ -62,7 +62,7 @@ public function render(Menu $menu) {
// If extension generate new menu / sub menus
if($this->extension_hooks->needHookTrigger(ExtensionHook::MENU_HOOK)){
- foreach ($this->extension_hooks->menuExtensionsHooks as $ext_key => $menus_array) {
+ foreach ($this->extension_hooks->menuExtensionsHooks as $menus_array) {
for ($index = 0; $index < count($menus_array); $index++) {
$extension_menus_elem = $this->extension_hooks->generateMenuRenderer($menus_array[$index], false);
$html .= $this->renderElem($extension_menus_elem, 0, true);
@@ -70,9 +70,7 @@ public function render(Menu $menu) {
}
}
- $html .= '';
-
- return $html;
+ return $html . '';
}
/**
@@ -128,9 +126,7 @@ public function renderElem(MenuElem $menu_elem, $level = 0, $extFrom = false) {
$html .= '';
}
- $html .= '';
-
- return $html;
+ return $html . '';
}
public function getActiveLink() {
@@ -166,7 +162,7 @@ protected function getUrl(MenuElem $menu_elem) {
protected function getLabel(MenuElem $menu_elem) {
$label = $this->translateLabel($menu_elem->getLabel());
- if ($menu_elem->hasChildren() && $level == 0) {
+ if ($menu_elem->hasChildren() && isset($level) && $level == 0) {
$label .= ' ';
}
@@ -178,7 +174,7 @@ protected function buildAttrs(MenuElem $menu_elem) {
if ($menu_elem->hasChildren()) {
//@TODO : buggy code
- if ($level > 0) {
+ if (isset($level) && $level > 0) {
$attr_li['class'][] = 'dropdown-submenu';
if (!$this->isParentElemClickable()) {
diff --git a/require/news/News.php b/require/news/News.php
index 03e9ce7f4..35a377555 100644
--- a/require/news/News.php
+++ b/require/news/News.php
@@ -37,9 +37,9 @@ public function get_json_news(){
$json = file_get_contents(URL_NEWS);
$obj = json_decode($json);
- foreach($obj->NEWS as $key => $value){
+ foreach($obj->NEWS as $value){
if(strlen($value->CONTENT) > 150){
- $value->CONTENTMODIF = (string)substr($value->CONTENT, 0, 150) . " ...";
+ $value->CONTENTMODIF = substr($value->CONTENT, 0, 150) . " ...";
}
$value->CONTENT = nl2br($value->CONTENT);
diff --git a/require/plugin/ComputerPlugin.php b/require/plugin/ComputerPlugin.php
index bdb32236c..ec599e84f 100755
--- a/require/plugin/ComputerPlugin.php
+++ b/require/plugin/ComputerPlugin.php
@@ -25,13 +25,14 @@
* Holds the config for a computer plugin
*/
class ComputerPlugin {
- private $id;
- private $system;
- private $label;
private $category;
private $available;
private $hideFrame;
+ private $id;
+ private $system;
+ private $label;
+
public function __construct($id, $system, $label) {
$this->id = $id;
$this->system = $system;
diff --git a/require/saveQuery/SaveQuery.php b/require/saveQuery/SaveQuery.php
index 94eb82cdc..3a96fd7af 100644
--- a/require/saveQuery/SaveQuery.php
+++ b/require/saveQuery/SaveQuery.php
@@ -100,7 +100,6 @@ public function update_search($arg, $who_can_see, $id_search) {
* @return array
*/
public function get_search_name() {
- var_dump($_SESSION['OCS']['user_group']);
$sql = "SELECT ID, QUERY_NAME FROM save_query WHERE WHO_CAN_SEE = 'ALL' OR USER_ID = '%s'";
$arg = array($_SESSION['OCS']['loggeduser']);
diff --git a/require/search/AccountinfoSearch.php b/require/search/AccountinfoSearch.php
index 6d136b6f4..62601f999 100644
--- a/require/search/AccountinfoSearch.php
+++ b/require/search/AccountinfoSearch.php
@@ -55,9 +55,8 @@ class AccountinfoSearch
/**
* Objects
*/
- private $dbObject = null;
- private $dbName = null;
- private $accountInfosStruct = null;
+ private $dbObject;
+ private $accountInfosStruct;
/**
@@ -65,7 +64,6 @@ class AccountinfoSearch
*/
function __construct() {
$this->dbObject = $_SESSION['OCS']["readServer"];
- $this->dbName = DB_NAME;
$this->createAccountInfoStruct();
$this->retrieveAccountInfosConfig();
}
@@ -151,9 +149,7 @@ public function find_accountinfo_values($field, $typeInfo = null){
$info = 'ACCOUNT_VALUE_'.$type['NAME'];
}
- $values = find_value_field($info, $typeInfo);
-
- return $values;
+ return find_value_field($info, $typeInfo);
}
}
diff --git a/require/search/DatabaseSearch.php b/require/search/DatabaseSearch.php
index 318157d24..2c7644a5c 100644
--- a/require/search/DatabaseSearch.php
+++ b/require/search/DatabaseSearch.php
@@ -34,7 +34,7 @@ class DatabaseSearch
*/
const FIELD = 'Field';
const TYPE = 'Type';
- const NULLABLE = 'Nullable';
+ const NULLABLE = 'Null';
const KEY = 'Key';
const DEFAULT_VAL = 'Default';
const EXTRA = 'Extra';
@@ -79,9 +79,8 @@ class DatabaseSearch
/**
* Objects
*/
- private $dbObject = null;
- private $dbName = null;
- private $softwareSearch = null;
+ private $dbObject;
+ private $dbName;
/**
* Constructor
@@ -102,7 +101,10 @@ function __construct($softwareSearch)
*/
public function getColumnsList($tableName)
{
- return $this->columnsList[$tableName];
+ if(isset($this->columnsList[$tableName])) {
+ return $this->columnsList[$tableName];
+ }
+
}
/**
@@ -176,7 +178,6 @@ private function retireveColumnsList($tableName)
/**
* Get an list of id of the current multi search (needed for buttons at the bottom of the page)
*
- * @param Search $searchObj
* @return Array list of computers ID
*/
public function getIdList(Search $searchObj){
@@ -184,7 +185,7 @@ public function getIdList(Search $searchObj){
$idList = mysql2_query_secure($query, $this->dbObject, $searchObj->queryArgs);
$idArray = [];
- if($idList) foreach ($idList as $index => $fields) {
+ if($idList) foreach ($idList as $fields) {
$idArray[] = $fields['hardwareID'];
}
return $idArray;
@@ -200,8 +201,7 @@ public function getIdList(Search $searchObj){
*/
private function normalizeFieldType($type)
{
- $splittedType = preg_replace('/\(.*?\)|\s*/', '', $type);
- return $splittedType;
+ return preg_replace('/\(.*?\)|\s*/', '', $type);
}
/**
@@ -221,7 +221,7 @@ public function get_package_id($fileid){
$sql= "SELECT id FROM download_enable d_e LEFT JOIN download_available d_a ON d_a.fileid=d_e.fileid
WHERE 1=1 AND d_a.comment NOT LIKE '%[VISIBLE=0]%' AND d_e.fileid='".$fileid."'";
$idPackage = mysql2_query_secure($sql, $this->dbObject);
- foreach ($idPackage as $index => $fields) {
+ foreach ($idPackage as $fields) {
$idArray[] = $fields['id'];
}
return $idArray;
diff --git a/require/search/SQLCache.php b/require/search/SQLCache.php
index 25cf3a69a..21507800e 100644
--- a/require/search/SQLCache.php
+++ b/require/search/SQLCache.php
@@ -29,11 +29,10 @@ class SQLCache
{
const GROUP_TABLE = "groups_cache";
-
- private $search;
- private $software;
private $searchQuery;
private $columnsQueryConditions;
+ private $search;
+ private $software;
/**
* @param Search $search
@@ -69,14 +68,14 @@ public function generateCacheSql($sessData){
$this->searchQuery .= "LEFT JOIN software_version on software_version.id = $tableName.version_id ";
}
- foreach ($searchInfos as $index => $value) {
+ foreach ($searchInfos as $value) {
if($tableName == "download_history" && $value['fields'] == "PKG_NAME") {
// Generate union
$this->searchQuery .= "INNER JOIN download_available on download_available.FILEID = $tableName.PKG_ID ";
}
- if($value['comparator'] != null){
+ if(isset($value['comparator'])){
$operator[] = $value['comparator'];
- }elseif($i != 0 && $value['comparator'] == null){
+ }elseif($i != 0 && empty($value['comparator'])){
$operator[] = "AND";
}else{
$operator[] = "";
@@ -94,7 +93,7 @@ public function generateCacheSql($sessData){
$containvalue[$index] = $value['operator'];
}
- foreach ($searchInfos as $index => $value) {
+ foreach ($searchInfos as $value) {
$nameTable = $tableName;
$open="";
$close="";
@@ -117,11 +116,11 @@ public function generateCacheSql($sessData){
}
}
- if($p == 0 && $operator[$p+1] == 'OR'){
+ if($p == 0 && isset($operator[$p+1]) && $operator[$p+1] == 'OR'){
$open = "(";
- }if($operator[$p] =='OR' && $operator[$p+1] !='OR'){
+ }if($operator[$p] =='OR' && (!isset($operator[$p+1]) || $operator[$p+1] !='OR')){
$close=")";
- }if($p != 0 && $operator[$p] !='OR' && $operator[$p+1] =='OR'){
+ }if($p != 0 && $operator[$p] !='OR' && isset($operator[$p+1]) && $operator[$p+1] =='OR'){
$open = "(";
}
@@ -153,7 +152,7 @@ public function generateCacheSql($sessData){
$argFields = $value[Search::SESS_FIELDS];
$argOperators = $value[Search::SESS_OPERATOR];
- $argValues = $value[Search::SESS_VALUES];
+ $argValues = $value[Search::SESS_VALUES] ?? '';
if(!empty($isSameColumn) && $isSameColumn[$nameTable] == $value[Search::SESS_FIELDS]
&& !array_key_exists("ignore", $value) && !array_key_exists('devices', $isSameColumn)){
diff --git a/require/search/Search.php b/require/search/Search.php
index cc9eb14d6..a6428e241 100644
--- a/require/search/Search.php
+++ b/require/search/Search.php
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-
/**
* This class implement the base behavior for search :
* - Query generation
@@ -141,18 +140,6 @@ class Search
"OR"
];
- /**
- * Multiples fields search
- */
- private $multipleFieldsSearch = [];
- private $multipleFieldsSearchCache = [];
-
- /**
- * Final query and args used for multicrits
- */
- private $finalQuery;
- private $finalArgs;
-
/**
* Constructor
@@ -216,7 +203,7 @@ public function updateSessionsInfos($postData)
{
foreach ($postData as $key => $value) {
$keyExploded = explode("_", $key);
- if(count($keyExploded) > 1 && !is_null($_SESSION['OCS']['multi_search'][$keyExploded[1]])){
+ if(count($keyExploded) > 1 && isset($_SESSION['OCS']['multi_search'][$keyExploded[1]]) && !is_null($_SESSION['OCS']['multi_search'][$keyExploded[1]])){
if ($keyExploded[2] == self::SESS_OPERATOR) {
$_SESSION['OCS']['multi_search'][$keyExploded[1]][$keyExploded[0]][self::SESS_OPERATOR] = $value;
} elseif($keyExploded[2] == self::SESS_FIELDS && $_SESSION['OCS']['multi_search'][$keyExploded[1]][$keyExploded[0]][self::SESS_OPERATOR] != 'ISNULL') {
@@ -226,7 +213,7 @@ public function updateSessionsInfos($postData)
}
}elseif(count($keyExploded) == 4){
$keyExplodedBis = $keyExploded[1]."_".$keyExploded[2];
- if(!is_null($_SESSION['OCS']['multi_search'][$keyExplodedBis])){
+ if(isset ($_SESSION['OCS']['multi_search'][$keyExplodedBis]) && !is_null($_SESSION['OCS']['multi_search'][$keyExplodedBis])){
if ($keyExploded[3] == self::SESS_OPERATOR) {
$_SESSION['OCS']['multi_search'][$keyExplodedBis][$keyExploded[0]][self::SESS_OPERATOR] = $value;
} elseif($keyExploded[3] == self::SESS_COMPARATOR){
@@ -271,7 +258,7 @@ public function removeSessionsInfos($rowReference){
public function getSearchedFieldType($tablename, $fieldsname)
{
$tableFields = $this->databaseSearch->getColumnsList($tablename);
- return $tableFields[$fieldsname][DatabaseSearch::TYPE];
+ return $tableFields[$fieldsname][DatabaseSearch::TYPE] ?? '';
}
/**
@@ -318,7 +305,7 @@ public function getFieldUniqId($uniqid, $tableName)
*/
public function generateSearchQuery($sessData){
- $accountInfos = new AccountinfoSearch();
+ new AccountinfoSearch();
$this->pushBaseQueryForTable("hardware", null);
if(!isset($sessData['accountinfo'])) $sessData['accountinfo'] = array();
foreach ($sessData as $tableName => $searchInfos) {
@@ -346,15 +333,15 @@ public function generateSearchQuery($sessData){
$this->searchQuery .= "LEFT JOIN software_version on software_version.id = $tableName.version_id ";
}
- foreach ($searchInfos as $index => $value) {
+ foreach ($searchInfos as $value) {
if($tableName == "download_history" && $value['fields'] == "PKG_NAME") {
// Generate union
$this->searchQuery .= "INNER JOIN download_available on download_available.FILEID = $tableName.PKG_ID ";
}
- if($value['comparator'] != null){
+ if(isset($value['comparator'])){
$operator[] = $value['comparator'];
- }elseif($i != 0 && $value['comparator'] == null){
+ }elseif($i != 0 && !isset($value['comparator'])){
$operator[] = "AND";
}else{
$operator[] = "";
@@ -373,7 +360,7 @@ public function generateSearchQuery($sessData){
$containvalue[$index] = $value['operator'];
}
- foreach ($searchInfos as $index => $value) {
+ foreach ($searchInfos as $value) {
$nameTable = $tableName;
$open="";
$close="";
@@ -382,7 +369,6 @@ public function generateSearchQuery($sessData){
if($nameTable == SoftwareSearch::SOFTWARE_TABLE) {
$nameTable = $this->softwareSearch->getTableName($value['fields']);
$value[self::SESS_FIELDS] = $this->softwareSearch->getColumnName($value['fields']);
- //var_dump()
}
foreach(array_count_values($columnName) as $name => $nb){
@@ -397,11 +383,11 @@ public function generateSearchQuery($sessData){
}
}
- if($p == 0 && $operator[$p+1] == 'OR'){
+ if($p == 0 && isset($operator[$p+1]) && $operator[$p+1] == 'OR'){
$open = "(";
- }if($operator[$p] =='OR' && $operator[$p+1] !='OR'){
+ }if($operator[$p] =='OR' && (!isset($operator[$p+1]) || $operator[$p+1] !='OR')){
$close=")";
- }if($p != 0 && $operator[$p] !='OR' && $operator[$p+1] =='OR'){
+ }if($p != 0 && $operator[$p] !='OR' && isset($operator[$p+1]) && $operator[$p+1] =='OR'){
$open = "(";
}
@@ -581,7 +567,7 @@ public function generateSearchQuery($sessData){
}
// has lock machine ?
- if (isset($_SESSION['OCS']["mesmachines"]) && strpos($_SESSION['OCS']["mesmachines"], 'a.TAG') === false) {
+ if (isset($_SESSION['OCS']["mesmachines"]) && !strpos($_SESSION['OCS']["mesmachines"], 'a.TAG')) {
$lockResult = str_replace('a.hardware_id', 'accountinfo.hardware_id', $_SESSION['OCS']["mesmachines"]);
$this->columnsQueryConditions .= " AND " . $lockResult;
}
@@ -594,17 +580,15 @@ public function generateSearchQuery($sessData){
* Generate select query for table using session variables generated from the search
*
* @param String $tableName
- * @param Array $sessData
* @return void
*/
- private function pushBaseQueryForTable($tableName, $sessData = null){
- foreach($this->databaseSearch->getColumnsList($tableName) as $index => $fieldsInfos){
- $name = "";
+ private function pushBaseQueryForTable($tableName){
+ foreach($this->databaseSearch->getColumnsList($tableName) as $fieldsInfos){
+ $name = "";
if($tableName == "download_history" && $fieldsInfos['Field'] == "PKG_NAME"){
$tableName = "download_available";
$fieldsInfos['Field'] = "NAME";
}
-
if($tableName == "software" && array_key_exists($fieldsInfos['Field'], $this->correspondance)) {
if($fieldsInfos['Field'] == "CATEGORY") {
$table = $tableName."_name";
@@ -722,14 +706,13 @@ public function getSelectOptionForOperators($defaultValue, $table = null, $field
}
$html = "";
- $operatorList = array();
if($table == self::GROUP_TABLE || $field == "CATEGORY_ID" || $field == "CATEGORY") {
$operatorList = $this->operatorGroup;
} elseif($accounttype == '2' || $accounttype == '11') {
$operatorList = $this->operatorAccount;
} elseif($accounttype == '5') {
$operatorList = $this->operatorAccountCheckbox;
- } elseif($this->getSearchedFieldType($table, $field) == 'datetime') {
+ } elseif(isset($field) && $this->getSearchedFieldType($table, $field) == 'datetime') {
$operatorList = array_merge($this->operatorList, $this->operatorDelay);
} else {
$operatorList = $this->operatorList;
@@ -758,7 +741,7 @@ public function getSelectOptionForTables($defautValue = null)
$html = " ";
foreach ($this->databaseSearch->getTablesList() as $tableName) {
$translation = $this->translationSearch->getTranslationFor($tableName);
- $sortTable[$tableName] .= $translation;
+ $sortTable[$tableName] = $translation;
}
asort($sortTable);
foreach ($sortTable as $key => $value){
@@ -787,28 +770,28 @@ public function getSelectOptionForColumns($tableName = null)
$accountFields = $accountinfoList->getAccountInfosList();
if(isset($accountFields['COMPUTERS']) && is_array($accountFields['COMPUTERS']))
foreach ($accountFields['COMPUTERS'] as $index => $fieldsInfos) {
- if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
+ // if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
$trField = $fieldsInfos;
- $sortColumn[$index] .= $trField;
- }
+ $sortColumn[$index] = $trField;
+ // }
}
}elseif($tableName == self::GROUP_TABLE){
$trField = $this->translationSearch->getTranslationFor('NAME');
$sortColumn['name'] = $trField;
}else{
$fields = $this->databaseSearch->getColumnsList($tableName);
- if(is_array($fields)) foreach ($fields as $index => $fieldsInfos) {
- if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
+ if(is_array($fields)) foreach ($fields as $fieldsInfos) {
+ //if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
$trField = $this->translationSearch->getTranslationFor($fieldsInfos[DatabaseSearch::FIELD]);
- $sortColumn[$fieldsInfos[DatabaseSearch::FIELD]] .= $trField;
- }
+ $sortColumn[$fieldsInfos[DatabaseSearch::FIELD]] = $trField;
+ //}
}
}
asort($sortColumn);
foreach ($sortColumn as $key => $value){
- if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
+ //if(!in_array($fieldsIndefaultTablefos[DatabaseSearch::FIELD], $this->excludedVisuColumns)){
$html .= " ";
- }
+ //}
}
return $html;
}
@@ -838,7 +821,7 @@ public function returnFieldHtml($uniqid, $fieldsInfos, $tableName, $field = null
$this->type = self::HTML_SELECT;
} elseif(array_key_exists($field, $this->correspondance)) {
$this->type = $this->correspondance[$field];
- }elseif($accounttype == '2' || $accounttype == '11' || $accounttype =='5') {
+ }elseif(isset($accounttype) && ($accounttype == '2' || $accounttype == '11' || $accounttype =='5')) {
$this->type = self::HTML_SELECT;
} else {
$this->type = $this->getSearchedFieldType($tableName, $fieldsInfos[self::SESS_FIELDS]);
@@ -857,15 +840,13 @@ public function returnFieldHtml($uniqid, $fieldsInfos, $tableName, $field = null
switch ($this->type) {
case self::DB_VARCHAR:
- $html = ' ';
- break;
case self::DB_TEXT:
$html = ' ';
break;
case self::DB_INT:
- $html = ' ';
+ $html = ' ';
break;
case self::DB_DATETIME:
@@ -879,7 +860,7 @@ public function returnFieldHtml($uniqid, $fieldsInfos, $tableName, $field = null
case self::HTML_SELECT:
$html = ' ';
- if($accounttype != null) {
+ if(isset($accounttype) && $accounttype != null) {
$fieldSelect = $accountInfos->find_accountinfo_values($field, $accounttype);
} elseif($field == 'CATEGORY_ID') {
$fieldSelect = $this->asset_categories();
@@ -915,13 +896,13 @@ public function returnFieldHtmlAndOr($uniqid, $fieldsInfos, $infos, $tableName,
global $l;
$i = 0;
- foreach ($infos as $id => $value){
+ foreach ($infos as $value){
if($value['fields'] == $fieldsInfos['fields']){
$i++;
}
}
- $fieldId = $this->getFieldUniqId($uniqid, $tableName);
+ $this->getFieldUniqId($uniqid, $tableName);
$html = "";
if($i > 1){
@@ -1029,7 +1010,7 @@ public function link_multi($fields, $value, $option = ""){
'value' => $value,
'operator' => 'EQUAL',
];
- if($tag != null && $tag != "") {
+ if(isset($tag) && !empty($tag)) {
$_SESSION['OCS']['multi_search']['accountinfo']['ipdiscover5'] = [
'fields' => 'TAG',
'value' => $tag,
@@ -1102,7 +1083,7 @@ public function link_multi($fields, $value, $option = ""){
break;
case 'saas':
- if(!array_key_exists('saas',$_SESSION['OCS']['multi_search']['saas'])){
+ if(!isset($_SESSION['OCS']['multi_search']['saas']) || !array_key_exists('saas',$_SESSION['OCS']['multi_search']['saas'])){
$_SESSION['OCS']['multi_search'] = array();
$_SESSION['OCS']['multi_search']['saas']['saas'] = [
'fields' => 'ENTRY',
@@ -1145,10 +1126,10 @@ public function query_save($id) {
* @param string $value [description]
* @return [type] [description]
*/
- public function link_index($fields, $comp = "", $value, $value2 = null){
+ public function link_index($fields, $value, $comp = "", $value2 = null){
$field = explode("-", $fields) ;
- if($comp== 'small') { $operator = 'LESS'; }
+ if($comp == 'small') { $operator = 'LESS'; }
elseif($comp == 'tall') { $operator = 'MORE'; }
elseif($comp == 'exact') { $operator = 'EQUAL'; }
@@ -1160,7 +1141,7 @@ public function link_index($fields, $comp = "", $value, $value2 = null){
'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'] ?? '';
if(empty($field[2])){
if(strpos($field[0], 'HARDWARE') !== false){
@@ -1300,7 +1281,7 @@ public function containmulti($name, $value){
$fieldname = "ID";
}
- foreach ($value as $uniqID => $values){
+ foreach ($value as $values){
if ($values['fields'] == $field && $values['operator'] == "DOESNTCONTAIN"){
$search[] = $values['value'];
if($values['comparator'] != null){
@@ -1324,7 +1305,7 @@ public function containmulti($name, $value){
for($i = 0; $i != count($comparator)+1; $i++){
foreach($excluID as $key => $values){
- foreach($allID as $searching => $compare){
+ foreach($allID as $compare){
if(!array_key_exists($values, $compare) && $comparator[$i] == "AND"){
unset($excluID[$key]);
}
diff --git a/require/search/SoftwareSearch.php b/require/search/SoftwareSearch.php
index 379869ff1..76e326a75 100644
--- a/require/search/SoftwareSearch.php
+++ b/require/search/SoftwareSearch.php
@@ -36,8 +36,7 @@ class SoftwareSearch
self::NAME_TABLE,
];
- private $dbObject = null;
- private $dbName = null;
+ private $dbObject;
private $columnsList = [];
/**
@@ -46,7 +45,6 @@ class SoftwareSearch
function __construct()
{
$this->dbObject = $_SESSION['OCS']["readServer"];
- $this->dbName = DB_NAME;
}
/**
@@ -82,8 +80,7 @@ public function retrieveSoftwareColumns() {
*/
private function normalizeFieldType($type)
{
- $splittedType = preg_replace('/\(.*?\)|\s*/', '', $type);
- return $splittedType;
+ return preg_replace('/\(.*?\)|\s*/', '', $type);
}
/**
diff --git a/require/search/TranslationSearch.php b/require/search/TranslationSearch.php
index da3205733..dcdb6f619 100644
--- a/require/search/TranslationSearch.php
+++ b/require/search/TranslationSearch.php
@@ -69,7 +69,6 @@ class TranslationSearch
"virtualmachines" => 1266,
"id" => 1402,
"hardware_id" => 1433,
- "userid" => 1434,
"logdate" => 232,
"processes" => 1436,
"location" => 1435,
@@ -107,7 +106,6 @@ class TranslationSearch
"voltage" => 1319,
"current_speed" => 1315,
"socket" => 1316,
- "comments" => 51,
"pkg_id" => 512,
"pkg_name" => 1037,
"comments" => 51,
@@ -246,7 +244,7 @@ class TranslationSearch
public function getTranslationFor($name){
global $l;
$name = strtolower($name);
- if(empty($l->g($this->translationArray[$name]))){
+ if(empty($this->translationArray[$name])){
return $name;
}
return $l->g($this->translationArray[$name]);
@@ -266,8 +264,8 @@ public function getTranslationForListField($string){
global $l;
$values = explode(".", $string);
-
- if(!empty($l->g($this->translationArray[$values[0]]))){
+
+ if(isset($this->translationArray[$values[0]]) && !empty($l->g($this->translationArray[$values[0]]))){
$table = $l->g($this->translationArray[$values[0]]);
}else{
$table = $values[0];
@@ -275,7 +273,7 @@ public function getTranslationForListField($string){
$name = strtolower($values[1]);
- if(!empty($l->g($this->translationArray[$name]))){
+ if(!empty($this->translationArray[$name])){
$name = $l->g($this->translationArray[$name]);
}elseif(strpos($name, 'fields_') !== false){
$accountInfoSearch = new AccountinfoSearch();
diff --git a/require/snmp/Snmp.php b/require/snmp/Snmp.php
index 7a8f223cc..961618660 100644
--- a/require/snmp/Snmp.php
+++ b/require/snmp/Snmp.php
@@ -332,19 +332,25 @@ public function delete_label($id){
private function drop_column($id){
$type = $this->get_config($id);
$label = $this->get_label_drop($id);
+ $tableName = [];
- foreach($type as $key => $value){
- $tableName[] = $this->get_table_type_drop($value);
+ if(!empty($type)) {
+ foreach($type as $key => $value){
+ $tableName[] = $this->get_table_type_drop($value);
+ }
}
- foreach($tableName as $id => $name){
- $sql_alter_table = "ALTER TABLE `%s` DROP `%s`";
- $arg_alter_table = array($name, $label);
- $result_alter = mysql2_query_secure($sql_alter_table, $_SESSION['OCS']["writeServer"], $arg_alter_table);
- if(!$result_alter){
- return false;
+ if(!empty($tableName)) {
+ foreach($tableName as $id => $name){
+ $sql_alter_table = "ALTER TABLE `%s` DROP `%s`";
+ $arg_alter_table = array($name, $label);
+ $result_alter = mysql2_query_secure($sql_alter_table, $_SESSION['OCS']["writeServer"], $arg_alter_table);
+ if(!$result_alter){
+ return false;
+ }
}
}
+
return true;
}
@@ -393,10 +399,14 @@ private function get_table_type_drop($id){
private function get_config($labelID){
$sql = "SELECT DISTINCT `TYPE_ID` FROM `snmp_configs` WHERE `LABEL_ID` = %s";
$arg = array($labelID);
+ $type = [];
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
- while ($item = mysqli_fetch_array($result)) {
- $type[] = $item['TYPE_ID'];
+
+ if($result) {
+ while ($item = mysqli_fetch_array($result)) {
+ $type[] = $item['TYPE_ID'];
+ }
}
return $type;
@@ -446,12 +456,15 @@ public function delete_config($id){
public function get_mib() {
$champs = array('SNMP_MIB_DIRECTORY' => 'SNMP_MIB_DIRECTORY');
$values = look_config_default_values($champs);
+ $mib_name = [];
- $mib_files = glob($values['tvalue']['SNMP_MIB_DIRECTORY'].'/*', GLOB_BRACE);
- $mib_files = str_replace($values['tvalue']['SNMP_MIB_DIRECTORY']."/", "", $mib_files);
-
- foreach($mib_files as $mib) {
- $mib_name[$mib] = $mib;
+ if(!empty($values['tvalue']['SNMP_MIB_DIRECTORY'])) {
+ $mib_files = glob($values['tvalue']['SNMP_MIB_DIRECTORY'].'/*', GLOB_BRACE);
+ $mib_files = str_replace($values['tvalue']['SNMP_MIB_DIRECTORY']."/", "", $mib_files);
+
+ foreach($mib_files as $mib) {
+ $mib_name[$mib] = $mib;
+ }
}
return $mib_name;
@@ -465,22 +478,23 @@ public function sort_mib($post) {
if(strpos($key, "checkbox_") !== false) {
$mib_check = explode("_", $key);
}
-
- if($key == "label_".$mib_check[1]) {
- $config[$mib_check[1]]['label'] = $value;
- }
- if($key == "oid_".$mib_check[1]) {
- $config[$mib_check[1]]['oid'] = $value;
- }
- if($key == "reconciliation_".$mib_check[1]) {
- $config[$mib_check[1]]['reconciliation'] = $value;
+ if(!empty($mib_check)) {
+ if($key == "label_".$mib_check[1]) {
+ $config[$mib_check[1]]['label'] = $value;
+ }
+ if($key == "oid_".$mib_check[1]) {
+ $config[$mib_check[1]]['oid'] = $value;
+ }
+ if($key == "reconciliation_".$mib_check[1]) {
+ $config[$mib_check[1]]['reconciliation'] = $value;
+ }
}
}
if(!empty($config)) {
foreach($config as $key => $value) {
if($config[$key]['label'] != null && $config[$key]['oid'] != null) {
- $result = $this->snmp_config($post['type_id'], $config[$key]['label'], $config[$key]['oid'], $config[$key]['reconciliation']);
+ $result = $this->snmp_config($post['type_id'], $config[$key]['label'], $config[$key]['oid'], $config[$key]['reconciliation'] ?? null);
if($result != 0) {
return false;
diff --git a/require/softwares/AllSoftware.php b/require/softwares/AllSoftware.php
index da5d99e73..e99c98080 100644
--- a/require/softwares/AllSoftware.php
+++ b/require/softwares/AllSoftware.php
@@ -29,7 +29,7 @@ class AllSoftware
public function software_link_treatment() {
// First clean software_link
- $delSoftLink = $this->delete_software_link();
+ $this->delete_software_link();
// Get all softwares
$allSoft = $this->get_software_informations();
// Get categories
@@ -59,7 +59,7 @@ public function software_link_treatment() {
if(!empty($softwareCategory)) {
foreach($software as $identifier => $values) {
- foreach($softwareCategory as $key => $infos) {
+ foreach($softwareCategory as $infos) {
if($values['NAME_ID'] == $infos['NAME_ID'] && $values['PUBLISHER_ID'] == $infos['PUBLISHER_ID'] && $values['VERSION_ID'] == $infos['VERSION_ID']) {
$software[$identifier]['CATEGORY_ID'] = $infos['CATEGORY_ID'];
}
@@ -96,7 +96,7 @@ private function get_software_informations() {
'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 CONCAT(n.NAME,';',p.PUBLISHER,';',v.VERSION) as identifier,
s.VERSION_ID, s.NAME_ID, s.PUBLISHER_ID,
@@ -112,16 +112,13 @@ private function get_software_informations() {
$sql .= " GROUP BY s.NAME_ID, s.PUBLISHER_ID, s.VERSION_ID";
- $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
-
- return $result;
+ return mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
}
private function get_software_categories_link_informations() {
$sql = "SELECT * FROM `software_categories_link`";
- $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
- return $result;
+ return mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
}
/**
@@ -140,7 +137,7 @@ public function software_cleanup() {
$i++;
}
- if ($unlinked_hids >= 1) {
+ if (isset($unlinked_hids) && $unlinked_hids >= 1) {
$sql_del = "DELETE FROM software WHERE HARDWARE_ID IN (%s)";
$arg_del = implode(",", $unlinked_hids);
$result = mysql2_query_secure($sql_del, $_SESSION['OCS']["writeServer"], $arg_del);
@@ -161,7 +158,7 @@ public function software_cleanup() {
$i++;
}
- if ($unlinked_ids >= 1) {
+ if (isset($unlinked_hids) && $unlinked_ids >= 1) {
$sql_del = "DELETE FROM $table WHERE ID IN (%s)";
$arg_del = implode(",", $unlinked_ids);
$result = mysql2_query_secure($sql_del, $_SESSION['OCS']["writeServer"], $arg_del);
@@ -182,7 +179,7 @@ public function software_cleanup() {
$i++;
}
- if ($unlinked_ids >= 1) {
+ if (isset($unlinked_hids) && $unlinked_ids >= 1) {
$sql_del = "DELETE FROM `software_categories_link` WHERE ID IN (%s)";
$arg_del = implode(",", $unlinked_ids);
$result = mysql2_query_secure($sql_del, $_SESSION['OCS']["writeServer"], $arg_del);
diff --git a/require/softwares/SoftwareCategory.php b/require/softwares/SoftwareCategory.php
index c22c7b333..a4d9c99bd 100644
--- a/require/softwares/SoftwareCategory.php
+++ b/require/softwares/SoftwareCategory.php
@@ -67,9 +67,7 @@ public function add_category($catName, $osVersion){
}else{
$sql = "INSERT INTO `software_categories` (`CATEGORY_NAME`, `OS`) values('%s', '%s');";
$arg_sql = array($catName, $osVersion);
-
- $result = mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg_sql);
- return ($result);
+ return (mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg_sql));
}
}
@@ -106,9 +104,7 @@ public function insert_exp($id_cat, $regExp, $sign = null, $version = null, $ven
$sql_reg = "INSERT INTO `software_category_exp` (`CATEGORY_ID`, `SOFTWARE_EXP`, `SIGN_VERSION`, `VERSION`, `PUBLISHER`) values(%s, '%s', '%s', '%s', '%s')";
$arg_reg = array($id_cat, $regExp, $sign, $version, $vendor);
-
- $result = mysql2_query_secure($sql_reg, $_SESSION['OCS']["writeServer"], $arg_reg);
- return ($result);
+ return (mysql2_query_secure($sql_reg, $_SESSION['OCS']["writeServer"], $arg_reg));
}
/**
@@ -120,6 +116,7 @@ public function display_reg($onglet_active){
$sql = "SELECT * FROM `software_category_exp` WHERE `CATEGORY_ID`= '%s'";
$arg_sql = array($onglet_active);
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg_sql);
+ $list = [];
while ($item = mysqli_fetch_array($result)) {
$list[] = ['ID' => $item['ID'],
@@ -150,11 +147,11 @@ public function get_table_html_soft(){
while ($computer = mysqli_fetch_array($result)) {
$nb[$value][] = $computer['NAME'];
}
- if($nb[$value] != null){
+ if(isset($nb[$value])){
$nb_computer[$value] = count($nb[$value]);
}
}
- if($nb_computer != null){
+ if(isset($nb_computer)){
foreach($nb_computer as $name => $nb){
$this->html .= '
'.$name.' |
@@ -162,7 +159,7 @@ public function get_table_html_soft(){
';
}
}else{
- foreach($cat as $key => $value){
+ foreach($cat as $value){
$this->html .= "
".$value." |
0 |
diff --git a/require/stats/Stats.php b/require/stats/Stats.php
index 032c95950..9b3a5adaa 100644
--- a/require/stats/Stats.php
+++ b/require/stats/Stats.php
@@ -73,7 +73,7 @@ public function showForm($form){
if (is_defined($_SESSION['OCS']["mesmachines"])) {
$sql .= " AND " . $_SESSION['OCS']["mesmachines"];
}
- if ($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
+ if (isset($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
$sql .= " AND h.archive IS NULL";
}
$sql .= " group by h.osname order by count(h.osname) DESC ";
@@ -83,7 +83,7 @@ public function showForm($form){
if (is_defined($_SESSION['OCS']["mesmachines"])) {
$sql .= " AND " . $_SESSION['OCS']["mesmachines"];
}
- if ($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
+ if (isset($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
$sql .= " AND h.archive IS NULL";
}
$sql .= " group by h.useragent order by count(h.useragent) DESC ";
@@ -113,7 +113,7 @@ public function showForm($form){
if (is_defined($_SESSION['OCS']["mesmachines"])) {
$sql_seen .= " AND " . $_SESSION['OCS']["mesmachines"];
}
- if ($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
+ if (isset($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
$sql_seen .= " AND h.archive IS NULL";
}
$sql_seen .= " GROUP BY contact ORDER BY contact ASC";
@@ -133,7 +133,7 @@ public function showForm($form){
if($key == 'MANUFAC'){
$sql_man = "SELECT b.SMANUFACTURER AS man, count(b.SMANUFACTURER) AS c_man FROM `bios` b LEFT JOIN accountinfo a ON a.HARDWARE_ID = b.HARDWARE_ID";
- if ($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
+ if (isset($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
$sql_man .= " LEFT JOIN hardware h ON h.ID = b.HARDWARE_ID WHERE h.ARCHIVE IS NULL";
}
if (is_defined($_SESSION['OCS']["mesmachines"]) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] != 1) {
@@ -157,7 +157,7 @@ public function showForm($form){
if($key == 'TYPE'){
$sql_type = "SELECT CASE WHEN TRIM(b.type) ='' THEN 'Unknow' ELSE b.type END as type, count(b.type) AS conta FROM `bios` b LEFT JOIN accountinfo a ON a.HARDWARE_ID = b.HARDWARE_ID";
- if ($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
+ if (isset($configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER']) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] == 1) {
$sql_type .= " LEFT JOIN hardware h ON h.ID = b.HARDWARE_ID WHERE h.ARCHIVE IS NULL";
}
if (is_defined($_SESSION['OCS']["mesmachines"]) && $configValues['ivalue']['EXCLUDE_ARCHIVE_COMPUTER'] != 1) {
@@ -203,7 +203,6 @@ public function showForm2($form){
group by contact
ORDER BY `contact` ASC";
$result_seen = mysql2_query_secure($sql_seen, $_SESSION['OCS']["readServer"]);
- $seen = array();
$seen_name = array();
$seen_quant = array();
while($item = mysqli_fetch_array($result_seen)){
diff --git a/require/table/Column.php b/require/table/Column.php
index 3d26f9222..56ef44701 100755
--- a/require/table/Column.php
+++ b/require/table/Column.php
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-
/**
* Handle properties of every column of the table
*/
@@ -31,7 +30,7 @@ abstract class Column {
private $deletable;
private $sortable;
- public function __construct($key, $label, $visible, $deletable, $sortable) {
+ public function __construct($label, $visible, $deletable, $sortable) {
$this->key = $key;
$this->label = $label;
$this->visible = $visible;
diff --git a/require/table/Columns.php b/require/table/Columns.php
index a53d71e6f..4ba0fb7d5 100755
--- a/require/table/Columns.php
+++ b/require/table/Columns.php
@@ -20,32 +20,16 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-
/**
* Handle Column Objects arrays for the table
*/
class Columns {
private $allcolumns;
- private $columnscantdel;
- private $columnscandel;
private $columnsvisible;
- private $columnsspecial;
- private $defaultcolumns;
public function __construct() {
$this->allcolumns = array();
- $this->columnscantdel = array();
- $this->columnscandel = array();
$this->columnsvisible = array();
- $this->columnsspecial = array(
- "CHECK", "SUP",
- "GROUP_NAME",
- "NULL", "MODIF",
- "SELECT", "ZIP",
- "OTHER", "STAT",
- "ACTIVE", "MAC",
- "MD5_DEVICEID",
- );
}
/*
@@ -99,9 +83,6 @@ public function addColumn($key, $label, $visible, $deletable, $sortable) {
if ($visible) {
$this->columnsvisible[] = $key;
}
- if ($cantdel) {
- $this->columnscantdel[] = $key;
- }
return $this->allcolumns[$key];
} else {
return $column;
diff --git a/require/table/Table.php b/require/table/Table.php
index f4ce0a1b0..dd4c2ce4b 100755
--- a/require/table/Table.php
+++ b/require/table/Table.php
@@ -25,17 +25,14 @@
* Handle tables display
*/
class Table {
- private $columns;
private $params;
public function __construct() {
include("Columns.php");
- $this->columns = new Columns();
}
public function getColumns() {
- $allcolumns = $this->getColumns();
- $columnsreturn;
+ $this->getColumns();
}
/*
diff --git a/require/tables/Column.php b/require/tables/Column.php
index 2e1c08385..913f362db 100755
--- a/require/tables/Column.php
+++ b/require/tables/Column.php
@@ -22,21 +22,21 @@
*/
class Column {
- private $name;
- private $label;
private $required;
private $sortable;
private $searchable;
private $formatter;
+ private $name;
+ private $label;
+
public function __construct($name, $label, $options = array()) {
$options = array_merge(array(
'required' => false,
'sortable' => true,
'searchable' => true,
'formatter' => null
- ), $options);
-
+ ), $options);
$this->name = $name;
$this->label = $label;
$this->required = $options['required'];
diff --git a/require/tables/LinkColumn.php b/require/tables/LinkColumn.php
index 6746b08d1..5f4814abb 100755
--- a/require/tables/LinkColumn.php
+++ b/require/tables/LinkColumn.php
@@ -1,4 +1,5 @@
url = $url;
$this->idProperty = $options['idProperty'] ?: 'id';
+ $this->url = $url;
parent::__construct($name, $label, $options);
}
@@ -69,4 +68,3 @@ public function formatLink($record) {
}
}
-?>
\ No newline at end of file
diff --git a/require/tables/Table.php b/require/tables/Table.php
index 5b6266854..01f138da2 100755
--- a/require/tables/Table.php
+++ b/require/tables/Table.php
@@ -1,4 +1,5 @@
name = $name;
@@ -53,4 +53,3 @@ public function getColumn($name) {
}
}
-?>
\ No newline at end of file
diff --git a/require/tables/table.html.php b/require/tables/table.html.php
index 48960bb7a..373db1336 100755
--- a/require/tables/table.html.php
+++ b/require/tables/table.html.php
@@ -1,13 +1,28 @@
+
-
+
- getColumns() as $name => $col) {
- echo "" . $col->getLabel() . " | ";
- }
- ?>
+
+
+ getColumns() as $col) {
+ echo "" . $col->getLabel() . " | ";
+ }
+ ?>
+
+
@@ -21,7 +36,7 @@
-
+
[DEBUG]TABLE REQUEST[DEBUG]
@@ -30,5 +45,4 @@
-
\ No newline at end of file
+
diff --git a/require/teledeploy/PackageBuilder.php b/require/teledeploy/PackageBuilder.php
index 39449a690..0ed2517f4 100644
--- a/require/teledeploy/PackageBuilder.php
+++ b/require/teledeploy/PackageBuilder.php
@@ -26,9 +26,9 @@
*/
class PackageBuilder
{
+ private $downloadConfig = [];
private $packageBuilderForm;
private $packageBuilderParseXml;
- private $downloadConfig = [];
/**
* Method __construct
@@ -39,9 +39,6 @@ class PackageBuilder
* @return void
*/
function __construct($packageBuilderForm, $packageBuilderParseXml) {
- $this->packageBuilderForm = $packageBuilderForm;
- $this->packageBuilderParseXml = $packageBuilderParseXml;
-
$this->downloadConfig = look_config_default_values([
'DOWNLOAD_PACK_DIR' => 'DOWNLOAD_PACK_DIR',
'DOWNLOAD_ACTIVATE_FRAG' => 'DOWNLOAD_ACTIVATE_FRAG',
@@ -52,15 +49,18 @@ function __construct($packageBuilderForm, $packageBuilderParseXml) {
'DOWNLOAD_PROTOCOL' => 'DOWNLOAD_PROTOCOL'
]);
- if ($this->downloadConfig['tvalue']['DOWNLOAD_URI_FRAG'] == "") {
+ if (empty($this->downloadConfig['tvalue']['DOWNLOAD_URI_FRAG'])) {
$this->downloadConfig['tvalue']['DOWNLOAD_URI_FRAG'] = $_SERVER["SERVER_ADDR"]."/download";
}
- if ($this->downloadConfig['tvalue']['DOWNLOAD_URI_INFO'] == "") {
+ if (empty($this->downloadConfig['tvalue']['DOWNLOAD_URI_INFO'])) {
$this->downloadConfig['tvalue']['DOWNLOAD_URI_INFO'] = $_SERVER["SERVER_ADDR"]."/download";
}
- if ($this->downloadConfig['tvalue']['DOWNLOAD_PROTOCOL'] == "") {
+ if (empty($this->downloadConfig['tvalue']['DOWNLOAD_PROTOCOL'])) {
$this->downloadConfig['tvalue']['DOWNLOAD_PROTOCOL'] = "HTTP";
}
+
+ $this->packageBuilderForm = $packageBuilderForm;
+ $this->packageBuilderParseXml = $packageBuilderParseXml;
}
/**
@@ -103,7 +103,7 @@ public function buildPackage($post, $file = null) {
fclose($handscript);
}
- if($file["additionalfiles"]['size'] != 0 && file_exists($file["additionalfiles"]["tmp_name"])) {
+ if(!empty($file["additionalfiles"]['size']) && file_exists($file["additionalfiles"]["tmp_name"])) {
//verif if is an archive file
$name_file_extention = explode('.', $file["additionalfiles"]["name"]);
$extention = array_pop($name_file_extention);
@@ -167,7 +167,7 @@ public function buildPackage($post, $file = null) {
}
// Generate info xml
- $info = $this->writePackageInfo($xmlDetails, $timestamp, $details['frag'], $digest, $post['pathfile']);
+ $info = $this->writePackageInfo($xmlDetails, $timestamp, $details['frag'], $digest);
// Create info file
$handinfo = fopen($downloadPath."/info", "w+");
fwrite($handinfo, $info);
@@ -330,7 +330,7 @@ private function fragmentPackage($fname, $downloadPath, $timestamp) {
$size = @filesize($fname);
// If package fragmentation disabled, frag = 1
- if($this->downloadConfig['ivalue']['DOWNLOAD_ACTIVATE_FRAG'] == 1 && $this->downloadConfig['ivalue']['DOWNLOAD_RATIO_FRAG'] != null) {
+ if((isset($this->downloadConfig['ivalue']['DOWNLOAD_ACTIVATE_FRAG']) && $this->downloadConfig['ivalue']['DOWNLOAD_ACTIVATE_FRAG'] == 1) && $this->downloadConfig['ivalue']['DOWNLOAD_RATIO_FRAG'] != null) {
$frag = 0;
$sizeBis = $size / pow(1024, 2);
@@ -397,17 +397,15 @@ private function writePackageInfo($xmlDetails, $timestamp, $nbFrag, $digest) {
if ($xmlDetails->packagedefinition->ACT == 'EXECUTE') {
$info .= "COMMAND=\"" . $xmlDetails->packagedefinition->COMMAND . "\" ";
}
-
- $info .= "NOTIFY_USER=\"" . $xmlDetails->packagedefinition->NOTIFY_USER . "\" " .
+
+ return $info . ("NOTIFY_USER=\"" . $xmlDetails->packagedefinition->NOTIFY_USER . "\" " .
"NOTIFY_TEXT=\"" . $xmlDetails->packagedefinition->NOTIFY_TEXT . "\" " .
"NOTIFY_COUNTDOWN=\"" . $xmlDetails->packagedefinition->NOTIFY_COUNTDOWN . "\" " .
"NOTIFY_CAN_ABORT=\"" . $xmlDetails->packagedefinition->NOTIFY_CAN_ABORT . "\" " .
"NOTIFY_CAN_DELAY=\"" . $xmlDetails->packagedefinition->NOTIFY_CAN_DELAY . "\" " .
"NEED_DONE_ACTION=\"" . $xmlDetails->packagedefinition->NEED_DONE_ACTION . "\" " .
"NEED_DONE_ACTION_TEXT=\"" . $xmlDetails->packagedefinition->NEED_DONE_ACTION_TEXT . "\" " .
- "GARDEFOU=\"rien\" />\n";
-
- return $info;
+ "GARDEFOU=\"rien\" />\n");
}
diff --git a/require/teledeploy/PackageBuilderForm.php b/require/teledeploy/PackageBuilderForm.php
index 887d2e3a1..43531a5e0 100644
--- a/require/teledeploy/PackageBuilderForm.php
+++ b/require/teledeploy/PackageBuilderForm.php
@@ -30,7 +30,7 @@ class PackageBuilderForm
private $packageBuilderFormOperatingSystem;
private $packageBuilderParseXml;
private $packageBuilderFormOptions;
-
+
/**
* Method __construct
*
@@ -41,7 +41,8 @@ class PackageBuilderForm
*
* @return void
*/
- function __construct($packageBuildeFormInteractions, $packageBuilderFormOperatingSystem, $packageBuilderParseXml, $packageBuilderFormOptions) {
+ function __construct($packageBuildeFormInteractions, $packageBuilderFormOperatingSystem, $packageBuilderParseXml, $packageBuilderFormOptions)
+ {
$this->packageBuilderFormOperatingSystem = $packageBuilderFormOperatingSystem;
$this->packageBuildeFormInteractions = $packageBuildeFormInteractions;
$this->packageBuilderParseXml = $packageBuilderParseXml;
@@ -60,9 +61,8 @@ public function generateOperatingSystem() {
foreach($operating->osdefinition as $system) {
$html .= $this->packageBuilderFormOperatingSystem->generateTile($system);
}
- $html .= '';
- return $html;
+ return $html . '';
}
/**
@@ -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
*/
|