diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-11 15:56:27 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-11 15:56:27 +0000 |
| commit | 6d47f4278d61e0efde9cafab7d4dd5477f974891 (patch) | |
| tree | bbc37342f8d1e95aa4fb63a68c738ba41926cb65 /frontends/php/include | |
| parent | 4126039bc0cad4231822bbd07fe9dda5301ab423 (diff) | |
| download | zabbix-6d47f4278d61e0efde9cafab7d4dd5477f974891.tar.gz zabbix-6d47f4278d61e0efde9cafab7d4dd5477f974891.tar.xz zabbix-6d47f4278d61e0efde9cafab7d4dd5477f974891.zip | |
- [ZBX-253] fixes problem in frontend with long int values (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5240 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/classes/ccombobox.inc.php | 8 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctree.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 5 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/export.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/hosts.inc.php | 8 | ||||
| -rw-r--r-- | frontends/php/include/html.inc.php | 91 | ||||
| -rw-r--r-- | frontends/php/include/maps.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/media.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/nodes.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/perm.inc.php | 8 | ||||
| -rw-r--r-- | frontends/php/include/screens.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/services.inc.php | 16 | ||||
| -rw-r--r-- | frontends/php/include/users.inc.php | 10 |
16 files changed, 41 insertions, 133 deletions
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php index 33325141..08f426a3 100644 --- a/frontends/php/include/classes/ccombobox.inc.php +++ b/frontends/php/include/classes/ccombobox.inc.php @@ -85,11 +85,9 @@ function AddItem($value, $caption='', $selected=NULL, $enabled='yes') { // if($enabled=='no') return; /* disable item method 1 */ - - if(is_null($selected)) - { + if(is_null($selected)){ $selected = 'no'; - if($value == $this->value || (is_array($this->value) && in_array($value, $this->value))) + if((strcmp($value,$this->value) == 0) || (is_array($this->value) && in_array($value, $this->value))) $selected = 'yes'; } @@ -185,7 +183,7 @@ { if(is_null($selected)) { - if($value == $this->value || (is_array($this->value) && in_array($value, $this->value))) + if((strcmp($value,$this->value) == 0) || (is_array($this->value) && in_array($value, $this->value))) $this->value_exist = 1; } diff --git a/frontends/php/include/classes/ctree.inc.php b/frontends/php/include/classes/ctree.inc.php index 0592c19d..5ee4e6bd 100644 --- a/frontends/php/include/classes/ctree.inc.php +++ b/frontends/php/include/classes/ctree.inc.php @@ -220,7 +220,7 @@ function GetImg($id,$img){ $childs = $this->tree[$this->tree[$id]['parentid']]['childnodes']; $childs_last = count($this->tree[$this->tree[$id]['parentid']]['childnodes'])-1; - if(isset($childs[$childs_last]) && ($childs[$childs_last] != $id)){ + if(isset($childs[$childs_last]) && (strcmp($childs[$childs_last],$id) != 0)){ $ch='T'; } $img.=$ch; diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index c096046a..3071b048 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -216,11 +216,11 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! { for ( $curr_node = &$node_data; $curr_node['masterid'] != 0 && - $curr_node['masterid'] != $ZBX_CURRENT_NODEID; + (bccomp($curr_node['masterid'] , $ZBX_CURRENT_NODEID) != 0); $curr_node = &$ZBX_NODES[$curr_node['masterid']] ); - if ( $curr_node['masterid'] == $ZBX_CURRENT_NODEID ) + if (bccomp($curr_node['masterid'],$ZBX_CURRENT_NODEID) == 0 ) { $ZBX_CURRENT_SUBNODES[$nodeid] = $nodeid; } @@ -296,7 +296,6 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! include_once "include/page_footer.php"; } - function zbx_stripslashes($value){ if(is_array($value)){ foreach($value as $id => $data) diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index a3f9b19e..86e76167 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -589,7 +589,7 @@ else { else { $ret1 = $row["nextid"]; - if(($ret1 < $min) || ($ret1 >= $max)) { + if((bccomp($ret1,$min) < 0) || !(bccomp($ret1,$max) < 0)) { DBexecute("delete from ids where nodeid=$nodeid and table_name='$table' and field_name='$field'"); continue; } diff --git a/frontends/php/include/export.inc.php b/frontends/php/include/export.inc.php index ee69e083..66663fac 100644 --- a/frontends/php/include/export.inc.php +++ b/frontends/php/include/export.inc.php @@ -353,7 +353,7 @@ ' where f.itemid=i.itemid group by f.triggerid, i.hostid'); while($trigger = DBfetch($db_triggers)) { - if($trigger['hostid'] != $hostid || $trigger['cnt']!=1) continue; + if((bccomp($trigger['hostid'] , $hostid) != 0) || $trigger['cnt']!=1) continue; $this->export_trigger($memory, $trigger['triggerid']); } zbx_xmlwriter_end_element($memory); // XML_TAG_TRIGGERS @@ -366,7 +366,7 @@ ' where gi.itemid=i.itemid group by gi.graphid, i.hostid'); while($graph = DBfetch($db_graphs)) { - if($graph['hostid'] != $hostid || $graph['cnt']!=1) continue; + if((bccomp($graph['hostid'] , $hostid) != 0) || $graph['cnt']!=1) continue; $this->export_graph($memory, $graph['graphid']); } zbx_xmlwriter_end_element($memory); // XML_TAG_GRAPHS diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 8a847e78..35b9d034 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -690,7 +690,7 @@ if(isset($userid)) { global $USER_DETAILS; -/* if($userid == $USER_DETAILS['userid']) $profile = 1;*/ +/* if(bccomp($userid,$USER_DETAILS['userid'])==0) $profile = 1;*/ $user=get_user_by_userid($userid); $frm_title = S_USER." \"".$user["alias"]."\""; @@ -808,7 +808,7 @@ $frmUser->AddVar('user_groups',$user_groups); - if(isset($userid) && ($USER_DETAILS['userid'] == $userid)) + if(isset($userid) && (bccomp($USER_DETAILS['userid'], $userid)==0)) { $frmUser->AddVar('user_type',$user_type); } diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index e1e32692..98255cfb 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -473,7 +473,7 @@ $new_hostid = $db_item['hostid']; } - if ( $host['hostid'] != $new_hostid ) + if ( (bccomp($host['hostid'] ,$new_hostid ) != 0)) { error('You must use items only from host "'.$host['host'].'" for template graph "'.$name.'"'); return $result; diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php index 3379f1c2..fd6c30c9 100644 --- a/frontends/php/include/hosts.inc.php +++ b/frontends/php/include/hosts.inc.php @@ -746,8 +746,8 @@ require_once "include/items.inc.php"; } } - $group_correct = ($groupid == $a_groupid) ? 1 : 0; - $host_correct = ($hostid == $a_hostid) ? 1 : 0; + $group_correct = (bccomp($groupid ,$a_groupid)==0) ? 1 : 0; + $host_correct = (bccomp($hostid ,$a_hostid)==0) ? 1 : 0; return array( "groupid" => $groupid, "group_correct" => $group_correct, @@ -873,7 +873,7 @@ require_once "include/items.inc.php"; $host = get_host_by_hostid($hostid); - if($applicationid==null) + if(is_null($applicationid)) { $applicationid_new = get_dbid("applications","applicationid"); if($result = DBexecute("insert into applications (applicationid,name,hostid,templateid)". @@ -890,7 +890,7 @@ require_once "include/items.inc.php"; if(!$result) return $result; - if($applicationid==null) + if(is_null($applicationid)) {// create application for childs $applicationid = $applicationid_new; diff --git a/frontends/php/include/html.inc.php b/frontends/php/include/html.inc.php index 75893b27..a747b82b 100644 --- a/frontends/php/include/html.inc.php +++ b/frontends/php/include/html.inc.php @@ -46,7 +46,7 @@ function nbsp($str) { - return str_replace(" ",SPACE,$str);; + return str_replace(" ",SPACE,$str); } function utf8_strlen($s) @@ -60,33 +60,8 @@ return (isset($tmp[0])) ? $tmp[0] : false; } - function form_select($var, $value, $label) - { - global $_REQUEST; - - $selected = ""; - if(!is_null($var)) - { - if(isset($_REQUEST[$var])&&$_REQUEST[$var]==$value) - $selected = "selected"; - } - return '<option value="'.$value.'" '.$selected.'>'.$label; - } - - function form_input($name, $value, $size) - { - return '<input class="'.biginput.'" name="'.$name.'" size="'.$size.'" value="'.$value.'">'; - } - - function form_textarea($name, $value, $cols, $rows) - { - return "<textarea name=\"$name\" cols=\"$cols\" ROWS=\"$rows\" wrap=\"soft\">$value</TEXTAREA>"; - } - function url1_param($parameter) { - global $_REQUEST; - if(isset($_REQUEST[$parameter])) { return "$parameter=".$_REQUEST[$parameter]; @@ -138,70 +113,6 @@ } return $result; } - - function table_begin($class="tableinfo") - { - echo "<table class=\"$class\" border=0 width=\"100%\" bgcolor='#AAAAAA' cellspacing=1 cellpadding=3>"; - echo "\n"; - } - - function table_header($elements) - { - echo "<tr bgcolor='#CCCCCC'>"; - while(list($num,$element)=each($elements)) - { - echo "<td><b>".$element."</b></td>"; - } - echo "</tr>"; - echo "\n"; - } - - function table_row($elements, $rownum) - { - if($rownum%2 == 1) { echo "<TR BGCOLOR=\"#DDDDDD\">"; } - else { echo "<TR BGCOLOR=\"#EEEEEE\">"; } - - while(list($num,$element)=each($elements)) - { - if(is_array($element)&&isset($element["hide"])&&($element["hide"]==1)) continue; - if(is_array($element)) - { - if(isset($element["class"])) - echo "<td class=\"".$element["class"]."\">".$element["value"]."</td>"; - else - echo "<td>".$element["value"]."</td>"; - } - else - { - echo "<td>".$element."</td>"; - } - } - echo "</tr>"; - echo "\n"; - } - - - function table_end() - { - echo "</table>"; - echo "\n"; - } - - function table_td($text,$attr) - { - echo "<td $attr>$text</td>"; - } - - function table_nodata($text="...") - { - echo "<TABLE BORDER=0 align=center WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=\"#DDDDDD\">"; - echo "<TD ALIGN=CENTER>"; - echo $text; - echo "</TD>"; - echo "</TR>"; - echo "</TABLE>"; - } function BR(){ return new CTag('br','no'); diff --git a/frontends/php/include/maps.inc.php b/frontends/php/include/maps.inc.php index de482013..a3db20bb 100644 --- a/frontends/php/include/maps.inc.php +++ b/frontends/php/include/maps.inc.php @@ -295,7 +295,7 @@ function check_circle_elements_link($sysmapid,$elementid,$elementtype){ if($elementtype!=SYSMAP_ELEMENT_TYPE_MAP) return FALSE; - if($sysmapid == $elementid) return TRUE; + if(bccomp($sysmapid ,$elementid)==0) return TRUE; $db_elements = DBselect("select elementid, elementtype from sysmaps_elements". " where sysmapid=$elementid"); @@ -678,7 +678,7 @@ $host_nodeid = id2nodeid($db_element["elementid"]); foreach($scripts_by_hosts[$db_element["elementid"]] as $id => $script){ $script_nodeid = id2nodeid($script['scriptid']); - if( $host_nodeid == $script_nodeid ) + if( (bccomp($host_nodeid ,$script_nodeid ) == 0)) $menus.= "['".$script['name']."',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=".$db_element["elementid"]."&scriptid=".$script['scriptid']."','".S_TOOLS."',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],"; } $menus.= "['".S_STATUS_OF_TRIGGERS."',\"javascript: Redirect('".$url."')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],"; diff --git a/frontends/php/include/media.inc.php b/frontends/php/include/media.inc.php index 1ca42205..931d7afa 100644 --- a/frontends/php/include/media.inc.php +++ b/frontends/php/include/media.inc.php @@ -120,7 +120,7 @@ { $ret = 0; - $sql="select * from media_type where description=".zbx_dbstr($description)." and mediatypeid!=$mediatypeid"; + $sql="select * from media_type where description=".zbx_dbstr($description)." and mediatypeid<>$mediatypeid"; $result=DBexecute($sql); if(DBfetch($result)) { diff --git a/frontends/php/include/nodes.inc.php b/frontends/php/include/nodes.inc.php index 758695d1..a822a98c 100644 --- a/frontends/php/include/nodes.inc.php +++ b/frontends/php/include/nodes.inc.php @@ -25,8 +25,8 @@ global $ZBX_CURMASTERID; if($node_data['nodeid'] == get_current_nodeid(false)) $node_type = ZBX_NODE_LOCAL; - else if($node_data['nodeid'] == $ZBX_CURMASTERID) $node_type = ZBX_NODE_MASTER; - else if($node_data['masterid'] == get_current_nodeid(false)) $node_type = ZBX_NODE_REMOTE; + else if(bccomp($node_data['nodeid'] ,$ZBX_CURMASTERID)==0) $node_type = ZBX_NODE_MASTER; + else if(bccomp($node_data['masterid'], get_current_nodeid(false))==0) $node_type = ZBX_NODE_REMOTE; else $node_type = -1; return $node_type; diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php index d8bd5cf8..060739f8 100644 --- a/frontends/php/include/perm.inc.php +++ b/frontends/php/include/perm.inc.php @@ -345,7 +345,7 @@ COpt::counter_up('perm'); $do_break = true; if(is_array($nodeid) && !in_array($node_data['nodeid'],$nodeid)) continue; - else if(isset($nodeid) and $node_data['nodeid'] != $nodeid) continue; + else if(isset($nodeid) and (bccomp($node_data['nodeid'] ,$nodeid) != 0)) continue; } else { @@ -362,7 +362,7 @@ COpt::counter_up('perm'); $node_data['permission'] = PERM_READ_WRITE; else $node_data['permission'] = - ($node_data['nodeid'] == $ZBX_LOCALNODEID) ? PERM_READ_WRITE : PERM_DENY; + (bccomp($node_data['nodeid'] ,$ZBX_LOCALNODEID)==0) ? PERM_READ_WRITE : PERM_DENY; } /* special processing for PERM_READ_LIST*/ @@ -607,7 +607,7 @@ COpt::counter_up('perm'); $do_break = true; if(is_array($nodeid) && !in_array($node_data['nodeid'],$nodeid)) continue; - else if(isset($nodeid) and $node_data['nodeid'] != $nodeid) continue; + else if(isset($nodeid) and (bccomp($node_data['nodeid'] ,$nodeid) != 0)) continue; } else { @@ -617,7 +617,7 @@ COpt::counter_up('perm'); if(isset($node_perm[$node_data['nodeid']])) $node_data['permission'] = $node_perm[$node_data['nodeid']]; - elseif($node_data['nodeid'] == $ZBX_LOCALNODEID || $user_type == USER_TYPE_SUPER_ADMIN) + elseif((bccomp($node_data['nodeid'], $ZBX_LOCALNODEID)==0) || $user_type == USER_TYPE_SUPER_ADMIN) /* for local node or superuser default permission is READ_WRITE */ $node_data['permission'] = PERM_READ_WRITE; diff --git a/frontends/php/include/screens.inc.php b/frontends/php/include/screens.inc.php index 45c03230..d5a65fce 100644 --- a/frontends/php/include/screens.inc.php +++ b/frontends/php/include/screens.inc.php @@ -162,7 +162,7 @@ } function check_screen_recursion($mother_screenid, $child_screenid){ - if($mother_screenid == $child_screenid) return TRUE; + if((bccomp($mother_screenid , $child_screenid)==0)) return TRUE; $db_scr_items = DBselect("select resourceid from screens_items where". " screenid=$child_screenid and resourcetype=".SCREEN_RESOURCE_SCREEN); @@ -321,7 +321,7 @@ $item = get_screen_item_form(); } elseif($editmode == 1 && isset($_REQUEST["form"]) && - isset($_REQUEST["screenitemid"]) && $_REQUEST["screenitemid"]==$screenitemid) + isset($_REQUEST["screenitemid"]) && (bccomp($_REQUEST["screenitemid"], $screenitemid)==0)) { // click on element $item = get_screen_item_form(); } diff --git a/frontends/php/include/services.inc.php b/frontends/php/include/services.inc.php index b1b7f782..6ae9e821 100644 --- a/frontends/php/include/services.inc.php +++ b/frontends/php/include/services.inc.php @@ -22,7 +22,7 @@ function add_service($name,$triggerid,$algorithm,$showsla,$goodsla,$sortorder,$service_times=array(),$parentid,$childs){ foreach($childs as $id => $child){ //add childs - if($parentid == $child['serviceid']){ + if((bccomp($parentid , $child['serviceid'])==0)){ error('Service can\'t be parent and child in onetime.'); return FALSE; } @@ -70,7 +70,7 @@ function update_service($serviceid,$name,$triggerid,$algorithm,$showsla,$goodsla,$sortorder,$service_times=array(),$parentid,$childs){ foreach($childs as $id => $child){ //add childs - if($parentid == $child['serviceid']){ + if((bccomp($parentid , $child['serviceid'])==0)){ error('Service can\'t be parent and child in onetime.'); return FALSE; } @@ -247,7 +247,7 @@ { return FALSE; } - if($serviceid==$serviceid2) + if((bccomp($serviceid, $serviceid2)==0)) { if($service["status"]>0) { @@ -293,7 +293,7 @@ return false; } - if($servicedownid==$serviceupid){ + if((bccomp($servicedownid, $serviceupid)==0)){ error("cannot link service to itself."); return false; } @@ -314,7 +314,7 @@ return false; } - if($servicedownid==$serviceupid){ + if((bccomp($servicedownid, $serviceupid)==0)){ error("cannot link service to itself."); return false; } @@ -740,7 +740,7 @@ $dt = 0; * * * Return value: * * * - * Author: Alexei Vladishev (PHP ver. by Artem Suharev) * + * Author: Alexei Vladishev (PHP ver. by Aly) * * * * Comments: recursive function !!! Don't forget sync code with C !!! * * * @@ -793,7 +793,7 @@ function update_services_rec($serviceid){ * * * Return value: * * * - * Author: Alexei Vladishev (PHP ver. by Artem Suharev) * + * Author: Alexei Vladishev (PHP ver. by Aly) * * * * Comments: !!! Don't forget sync code with C !!! * * * @@ -818,7 +818,7 @@ function update_services($triggerid, $status){ * Cleaning parent nodes from triggers, updating ALL services status. * * Author: - * Artem Suharev + * Aly * * Comments: !!! Don't forget sync code with C !!! * diff --git a/frontends/php/include/users.inc.php b/frontends/php/include/users.inc.php index 96276660..2f34b7bf 100644 --- a/frontends/php/include/users.inc.php +++ b/frontends/php/include/users.inc.php @@ -63,7 +63,7 @@ $result = DBexecute('insert into users_groups (id,usrgrpid,userid)'. 'values('.$users_groups_id.','.$groupid.','.$userid.')'); - if($result == false) break; + if(!$result) break; } if($result) { @@ -76,7 +76,7 @@ zbx_dbstr($media_data['sendto']).','.$media_data['active'].','.$media_data['severity'].','. zbx_dbstr($media_data['period']).')'); - if($result == false) break; + if(!$result) break; } } } @@ -109,7 +109,7 @@ $result = DBexecute('insert into users_groups (id,usrgrpid,userid)'. 'values('.$users_groups_id.','.$groupid.','.$userid.')'); - if($result == false) break; + if(!$result) break; } if($result) { @@ -122,7 +122,7 @@ zbx_dbstr($media_data['sendto']).','.$media_data['active'].','.$media_data['severity'].','. zbx_dbstr($media_data['period']).')'); - if($result == false) break; + if(!$result) break; } } } @@ -137,7 +137,7 @@ { global $USER_DETAILS; - if($userid!=$USER_DETAILS["userid"]) + if((bccomp($userid,$USER_DETAILS["userid"]) != 0)) { access_deny(); } |
