~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to frontends/php/triggers.php

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-06-04 09:22:37 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080604092237-zgwq7kmraj1oohoz
Tags: 1:1.4.5-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
  (LP: #172775)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/* 
3
3
** ZABBIX
4
 
** Copyright (C) 2000-2005 SIA Zabbix
 
4
** Copyright (C) 2000-2007 SIA Zabbix
5
5
**
6
6
** This program is free software; you can redistribute it and/or modify
7
7
** it under the terms of the GNU General Public License as published by
39
39
                "groupid"=>     array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID,NULL),
40
40
                "hostid"=>      array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID,'isset({save})'),
41
41
 
42
 
                "triggerid"=>   array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID,'{form}=="update"'),
 
42
                "triggerid"=>   array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID,'(isset({form})&&({form}=="update"))'),
43
43
 
44
44
                "copy_type"     =>array(T_ZBX_INT, O_OPT,        P_SYS, IN("0,1"),'isset({copy})'),
45
45
                "copy_mode"     =>array(T_ZBX_INT, O_OPT,        P_SYS, IN("0"),NULL),
57
57
 
58
58
                "g_triggerid"=> array(T_ZBX_INT, O_OPT,  NULL,  DB_ID, NULL),
59
59
                "copy_targetid"=>       array(T_ZBX_INT, O_OPT, NULL,   DB_ID, NULL),
60
 
                "filter_groupid"=>      array(T_ZBX_INT, O_OPT, P_SYS,  DB_ID, 'isset({copy})&&{copy_type}==0'),
 
60
                "filter_groupid"=>      array(T_ZBX_INT, O_OPT, P_SYS,  DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'),
61
61
 
62
62
                "showdisabled"=>        array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"),       NULL),
63
63
                
88
88
 
89
89
        $showdisabled = get_request("showdisabled", 0);
90
90
 
91
 
        validate_group_with_host(PERM_READ_WRITE,array("allow_all_hosts","always_select_first_host","with_items"),
 
91
        validate_group_with_host(PERM_READ_WRITE,array("allow_all_hosts","always_select_first_host","with_items","only_current_node"),
92
92
                'web.last.conf.groupid', 'web.last.conf.hostid');
93
93
?>
94
94
<?php
155
155
                $result = false;
156
156
                
157
157
                if($trigger_data = DBfetch(
158
 
                        DBselect("select distinct t.description,h.host".
 
158
                        DBselect("select distinct t.triggerid,t.description,t.expression,h.host".
159
159
                                " from triggers t left join functions f on t.triggerid=f.triggerid ".
160
160
                                " left join items i on f.itemid=i.itemid ".
161
161
                                " left join hosts h on i.hostid=h.hostid ".
221
221
                if(!isset($_REQUEST["dependences"]))
222
222
                        $_REQUEST["dependences"] = array();
223
223
 
224
 
                if(!in_array($_REQUEST["new_dependence"], $_REQUEST["dependences"]))
 
224
                if(!uint_in_array($_REQUEST["new_dependence"], $_REQUEST["dependences"]))
225
225
                        array_push($_REQUEST["dependences"], $_REQUEST["new_dependence"]);
226
226
        }
227
227
        elseif(isset($_REQUEST["del_dependence"])&&isset($_REQUEST["rem_dependence"]))
229
229
                if(isset($_REQUEST["dependences"])){
230
230
                        foreach($_REQUEST["dependences"]as $key => $val)
231
231
                        {
232
 
                                if(!in_array($val, $_REQUEST["rem_dependence"]))        continue;
 
232
                                if(!uint_in_array($val, $_REQUEST["rem_dependence"]))   continue;
233
233
                                unset($_REQUEST["dependences"][$key]);
234
234
                        }
235
235
                }
303
303
?>
304
304
<?php
305
305
        $r_form = new CForm();
306
 
 
 
306
        $r_form->SetMethod('get');
307
307
        $r_form->AddItem(array('[', 
308
308
                new CLink($showdisabled ? S_HIDE_DISABLED_TRIGGERS : S_SHOW_DISABLED_TRIGGERS,
309
309
                        'triggers.php?showdisabled='.($showdisabled ? 0 : 1),'action'),
367
367
/* TABLE */
368
368
                $form = new CForm('triggers.php');
369
369
                $form->SetName('triggers');
 
370
                $form->SetMethod('post');
370
371
                $form->AddVar('hostid',$_REQUEST["hostid"]);
371
372
 
372
373
                $table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
425
426
                                $description[] = ':';
426
427
                        }
427
428
 
428
 
                        $description[] = new CLink(addslashes(expand_trigger_description($row["triggerid"])),
 
429
                        $description[] = new CLink(expand_trigger_description($row["triggerid"]),
429
430
                                "triggers.php?form=update&triggerid=".$row["triggerid"].
430
431
                                        "&hostid=".$row["hostid"], 'action');
431
432
 
433
434
                        $deps = get_trigger_dependences_by_triggerid($row["triggerid"]);
434
435
                        if(count($deps) > 0)
435
436
                        {
436
 
                                $description[] = BR.BR."<strong>".S_DEPENDS_ON."</strong>".SPACE.BR;
 
437
                                $description[] = BR.BR."<strong>".S_DEPENDS_ON.":</strong>".SPACE.BR;
437
438
                                foreach($deps as $val)
438
 
                                        $description[] = '['.$val.']'.expand_trigger_description($val).BR;
 
439
                                        $description[] = expand_trigger_description($val).BR;
439
440
 
440
441
                                $description[] = BR;
441
442
                        }