diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-11 09:58:06 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-11 09:58:06 +0000 |
| commit | 5cdc91f40d8fdb6e8c4c525a230565bfa87afb86 (patch) | |
| tree | 88bafeb47426f360e35e54d1b8e844252c898801 /frontends/php/include/db.inc.php | |
| parent | cd58120468d324ee96922fc156f9e6ca651addb1 (diff) | |
| download | zabbix-5cdc91f40d8fdb6e8c4c525a230565bfa87afb86.tar.gz zabbix-5cdc91f40d8fdb6e8c4c525a230565bfa87afb86.tar.xz zabbix-5cdc91f40d8fdb6e8c4c525a230565bfa87afb86.zip | |
- allowed unicode in frontend for testing purposes (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5610 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/db.inc.php')
| -rw-r--r-- | frontends/php/include/db.inc.php | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index c62b030c..76af876c 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -616,53 +616,47 @@ else { return (' '.DBid2nodeid($id_name).' in ('.$nodes.') '); } - function in_node( $id_var, $nodes = null ) - { - if ( is_null($nodes) ) $nodes = get_current_nodeid(); + function in_node( $id_var, $nodes = null ){ + if(is_null($nodes)) + $nodes = get_current_nodeid(); - if ( empty($nodes) ) $nodes = 0; + if(empty($nodes)) + $nodes = 0; - if ( is_numeric($nodes) ) - { + if(is_numeric($nodes)){ $nodes = array($nodes); } - else if ( is_string($nodes) ) - { - if ( !eregi('([0-9\,]+)', $nodes ) ) + else if(is_string($nodes)){ + if(!eregi('([0-9\,]+)',$nodes)) fatal_error('Incorrect "nodes" for "in_node". Passed ['.$nodes.']'); - + $nodes = explode(',', $nodes); } - else if ( !is_array($nodes) ) - { + else if (!is_array($nodes)){ fatal_error('Incorrect type of "nodes" for "in_node". Passed ['.gettype($nodes).']'); } - return uint_in_array(id2nodeid($id_var), $nodes); + return uint_in_array(id2nodeid($id_var), $nodes); } - function get_dbid($table,$field) - { + function get_dbid($table,$field){ $nodeid = get_current_nodeid(false); $found = false; - do - { + do{ global $ZBX_LOCALNODEID; $min=bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000")); $max=bcadd(bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000")),"99999999999"); $row = DBfetch(DBselect("select nextid from ids where nodeid=$nodeid and table_name='$table' and field_name='$field'")); - if(!$row) - { + if(!$row){ $row=DBfetch(DBselect("select max($field) as id from $table where $field>=$min and $field<=$max")); - if(!$row || is_null($row["id"])) - { + if(!$row || is_null($row["id"])){ + DBexecute("insert into ids (nodeid,table_name,field_name,nextid) ". " values ($nodeid,'$table','$field',$min)"); } - else - { + else{ /* $ret1 = $row["id"]; if($ret1 >= $max) { @@ -674,8 +668,7 @@ else { } continue; } - else - { + else{ $ret1 = $row["nextid"]; if((bccomp($ret1,$min) < 0) || !(bccomp($ret1,$max) < 0)) { DBexecute("delete from ids where nodeid=$nodeid and table_name='$table' and field_name='$field'"); |
