~ubuntu-branches/ubuntu/lucid/zabbix/lucid

« back to all changes in this revision

Viewing changes to frontends/php/exp_imp.php

  • Committer: Bazaar Package Importer
  • Author(s): Emanuele Gentili
  • Date: 2008-08-10 18:37:11 UTC
  • mfrom: (1.1.7 upstream) (8.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080810183711-h4n52nkqqf3iuqhn
Tags: 1:1.4.6-1ubuntu1
* Merge from debian unstable, remaining changes:
 + fixing missing pid directory in /var/run
 + Added the same patch to debian/zabbix-server-{mysql,pgsql}.zabbix-server.init

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
                $page["type"] = PAGE_TYPE_XML;
29
29
                $page["file"] = "zabbix_export.xml";
30
30
        }
31
 
        else
32
 
        {
 
31
        else{
33
32
                $page["title"] = "S_EXPORT_IMPORT";
34
33
                $page["file"] = "exp_imp.php";
35
34
        }
250
249
                        
251
250
                        $table->ShowEnd();
252
251
                }
253
 
                else
254
 
                {
 
252
                else{
255
253
        /* table HOSTS */
256
254
                        $form = new CForm(null,'post');
257
255
                        $form->SetName('hosts');
260
258
                        
261
259
                        $cmbGroups = new CComboBox("groupid",get_request("groupid",0),"submit()");
262
260
                        $cmbGroups->AddItem(0,S_ALL_SMALL);
263
 
                        $result=DBselect("select distinct g.groupid,g.name from groups g,hosts_groups hg,hosts h".
264
 
                                        " where h.hostid in (".$available_hosts.") ".
265
 
                                        " and g.groupid=hg.groupid and h.hostid=hg.hostid".
266
 
                                        " order by g.name");
267
 
                        while($row=DBfetch($result))
268
 
                        {
 
261
                        $result=DBselect('select distinct g.groupid,g.name '.
 
262
                                        ' from groups g,hosts_groups hg,hosts h'.
 
263
                                        ' where h.hostid in ('.$available_hosts.') '.
 
264
                                                ' and g.groupid=hg.groupid '.
 
265
                                                ' and h.hostid=hg.hostid '.
 
266
                                        ' order by g.name');
 
267
                        while($row=DBfetch($result)){
269
268
                                $cmbGroups->AddItem($row["groupid"],$row["name"]);
270
269
                                if((bccomp($row["groupid"] , $_REQUEST["groupid"])==0)) $correct_host = 1;
271
270
                        }
272
 
                        if(!isset($correct_host))
273
 
                        {
 
271
                        
 
272
                        if(!isset($correct_host)){
274
273
                                unset($_REQUEST["groupid"]);
275
274
                                $cmbGroups->SetValue(0);
276
275
                        }
299
298
                                */
300
299
                                ));
301
300
                
302
 
                        $sql = "select h.* from";
303
 
                        if(isset($_REQUEST["groupid"]))
304
 
                        {
305
 
                                $sql .= " hosts h,hosts_groups hg where";
306
 
                                $sql .= " hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid and";
307
 
                        } else  $sql .= " hosts h where";
308
 
                        $sql .= " h.hostid in (".$available_hosts.") ".
309
 
                                " order by h.host";
 
301
                        $sql = 'select h.* from';
 
302
                        if(isset($_REQUEST['groupid'])){
 
303
                                $sql .= ' hosts h,hosts_groups hg ';
 
304
                                $sql .= ' where hg.groupid='.$_REQUEST['groupid'].' and hg.hostid=h.hostid and';
 
305
                        } 
 
306
                        else{  
 
307
                                $sql .= ' hosts h where';
 
308
                        }
 
309
                        
 
310
                        $sql .= ' h.hostid in ('.$available_hosts.') '.
 
311
                                ' order by h.host';
310
312
 
311
313
                        $result=DBselect($sql);
312
314
                
313
 
                        while($row=DBfetch($result))
314
 
                        {
 
315
                        while($row=DBfetch($result)){
 
316
                        
315
317
                                $host=new CCol(array(
316
318
                                        new CCheckBox('hosts['.$row['hostid'].']',
317
319
                                                isset($hosts[$row['hostid']]) || !isset($update),
322
324
                                
323
325
                                if($row["status"] == HOST_STATUS_MONITORED){
324
326
                                        $status=new CSpan(S_MONITORED, "off");
325
 
                                } else if($row["status"] == HOST_STATUS_NOT_MONITORED) {
 
327
                                } 
 
328
                                else if($row["status"] == HOST_STATUS_NOT_MONITORED) {
326
329
                                        $status=new CSpan(S_NOT_MONITORED, "on");
327
 
                                } else if($row["status"] == HOST_STATUS_TEMPLATE)
 
330
                                } 
 
331
                                else if($row["status"] == HOST_STATUS_TEMPLATE)
328
332
                                        $status=new CCol(S_TEMPLATE,"unknown");
329
333
                                else if($row["status"] == HOST_STATUS_DELETED)
330
334
                                        $status=new CCol(S_DELETED,"unknown");
333
337
                                
334
338
                                /* calculate items */
335
339
                                $item_cnt = DBfetch(DBselect('select count(itemid) as cnt from items where hostid='.$row['hostid']));
336
 
                                if($item_cnt['cnt'] > 0)
337
 
                                {
 
340
                                if($item_cnt['cnt'] > 0){
338
341
                                        $item_cnt = array(new CCheckBox('items['.$row['hostid'].']',
339
342
                                                        isset($items[$row['hostid']]) || !isset($update),
340
343
                                                        NULL,true),
341
344
                                                $item_cnt['cnt']);
342
345
                                }
343
 
                                else
344
 
                                {
 
346
                                else{
345
347
                                        $item_cnt = '-';
346
348
                                }
347
349
                                
382
384
                                
383
385
                                /* $screens = 0; */
384
386
 
385
 
                                if($row["status"] == HOST_STATUS_TEMPLATE)
386
 
                                {
 
387
                                if($row["status"] == HOST_STATUS_TEMPLATE){
387
388
                                        $ip = $dns = $port = '-';
388
389
                                }
389
 
                                else
390
 
                                {
391
 
                                        $ip = $row["ip"];
392
 
                                        $dns = $row["dns"];
 
390
                                else{
 
391
                                        $ip = (empty($row["ip"]))?'-':$row["ip"];
 
392
                                        $dns = (empty($row["dns"]))?'-':$row["dns"];
393
393
 
394
394
                                        if($row["useip"]==1)
395
395
                                                $ip = bold($ip);
396
396
                                        else
397
397
                                                $dns = bold($dns);
398
398
 
399
 
                                        $port = $row["port"];
 
399
                                        $port = (empty($row["port"]))?'-':$row["port"];
400
400
                                }
401
401
 
402
402
                                $table->AddRow(array(