function valorCampo($p_query, $p_campo) { $retorno = ""; $result = preparaQuery($p_query); while ($row = DBfetch($result)) { $retorno = $row[$p_campo]; } return $retorno; }
function arraySelect($p_query) { $result = preparaQuery($p_query); $retorno = array(); $cont = 0; while ($row = @mysql_fetch_assoc($result)) { $retorno[$cont] = $row; $cont++; } return $retorno; }
preparaQuery("INSERT INTO zbxe_preferences (userid, tx_option, tx_value, st_ativo) VALUES('0', 'menu_09_geo', 'zbxe-geolocation|Geolocation', '1')"); } else { // Modo de upgrade somente ----------------------------------------------------- echo "<br>Banco ja inicializado! Serao inseridas apenas linhas complementares...<br>"; } // Verificando se e uma estrutura com NODES $node = intval(valorCampo('select count(*) as total from nodes', 'total')); //var_dump($node); if ($node > 0) { echo "Sem suporte a node para a importação de imagens em node ainda..."; } else { $query = "select nextid+1 as nextid from ids " . "where table_name = 'images' and field_name = 'imageid' and nodeid = {$node}"; $idAtual = intval(valorCampo($query, 'nextid')); if ($idAtual == 0) { $query = "select max(imageid)+1 as nextid from images "; $idAtual = intval(valorCampo($query, 'nextid')); } if (valorCampo("select imageid from images where name = 'zbxe_logo'", 'imageid') == 0) { echo "Inserindo logotipo personalizado [{$idAtual}]...<br>"; // Logotipo personalizado do ZE + Zabbix Brasil $query = "INSERT INTO images (imageid, imagetype, name, image) " . "VALUES ({$idAtual}, 1, 'zbxe_logo', " . ($DB['TYPE'] == ZBX_DB_POSTGRESQL ? $logo_zbxe_post : "0x" . $logo_zbxe) . ");"; preparaQuery($query); $query = "update ids set nextid = {$idAtual} where table_name = 'images' " . "and field_name = 'imageid' and nodeid = {$node};"; preparaQuery($query); } else { echo "Atualizando logotipo personalizado...<br>"; $query = "update images set image = " . ($DB['TYPE'] == ZBX_DB_POSTGRESQL ? $logo_zbxe_post : "0x" . $logo_zbxe) . " where name = 'zbxe_logo';"; preparaQuery($query); } } echo "Pronto !!!";
function zbxeControler() { global $fields, $ZBXE_VAR, $CAMPOS; global $_SERVER; if (strpos($_SERVER["REQUEST_URI"], "users.php") > 0 && get_request('userid', -1) > -1) { $userid = get_request('userid', 0); // var_dump("id de usuario". $userid); } else { $userid = CWebUser::$data['userid']; } // Salvando tradução ------------==================--------------=========== $translation = get_request('translate', array()); foreach ($translation as $number => $curString) { // var_dump($curString); $query = "update zbxe_translation set tx_new = " . quotestr($curString['new']) . " where tx_original = " . quotestr($curString['original']) . " and lang = " . quotestr(CWebUser::$data['lang']); preparaQuery($query); } // Garante que todas os registros alterados estão no local correto --------- $update = ""; // Salvando preferencias =================================================== if (isset($_REQUEST['save'])) { //var_dump($_REQUEST); if (isset($_REQUEST['xbxe_clean']) && $_REQUEST['xbxe_clean'] == "yes") { $query = "delete from zbxe_preferences where userid = " . $userid; //var_dump($query); preparaQuery($query); } else { $_REQUEST['xbxe_clean'] = get_request('xbxe_clean'); } foreach ($ZBXE_VAR as $key => $value) { //var_dump ("<br>--".$key); if (strpos($key, '_show') == 0 && $_REQUEST['xbxe_clean'] != "yes") { $tmp = get_request($key); // Atualizando dados de usuario ------------------------------------ // var_dump("$key - $tmp - " . zbxeConfigValue($key,$userid ) . "<br>"); if (zbxeConfigValue($key, $userid) != $tmp && strlen($tmp) > 0) { // var_dump("oi<br>"); // Verifica se ja existe registro para o usuario, se nao existir insere if (zbxeConfigValue($key, $userid) == "") { $query = "insert into zbxe_preferences (userid, tx_option, tx_value, st_ativo) VALUES (" . $userid . ", " . quotestr($key) . ", " . quotestr($tmp) . " ,1 ) "; } else { $query = "update zbxe_preferences set tx_value = " . quotestr($tmp) . " where userid = " . $userid . " and tx_option = " . quotestr($key) . " "; } // var_dump($query); preparaQuery($query); } } // Atualizando dados default --------------------------------------- if (uint_in_array(CWebUser::$data['type'], array(USER_TYPE_SUPER_ADMIN))) { $tmp = get_request($key . "_adm"); if (strpos($key, '_show') > 0 && $tmp == "") { $tmp = '0'; } // var_dump("<br>--> Config Admin: $key ". zbxeConfigValue($key,0) . " - novo valor [$tmp]"); if (zbxeConfigValue($key, 0) != $tmp && strlen($tmp) > 0) { $query = "update zbxe_preferences set tx_value = " . quotestr($tmp) . " where userid = 0 and tx_option = " . quotestr($key) . " "; // var_dump($query); preparaQuery($query); } } } } }