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

« back to all changes in this revision

Viewing changes to frontends/php/popup.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:
125
125
 
126
126
        $allowed_item_types = array(ITEM_TYPE_ZABBIX,ITEM_TYPE_SIMPLE,ITEM_TYPE_INTERNAL,ITEM_TYPE_AGGREGATE);
127
127
 
128
 
        if(isset($_REQUEST['itemtype']) && !in_array($_REQUEST['itemtype'], $allowed_item_types))
 
128
        if(isset($_REQUEST['itemtype']) && !str_in_array($_REQUEST['itemtype'], $allowed_item_types))
129
129
                        unset($_REQUEST['itemtype']);
130
130
 
131
131
        check_fields($fields);
185
185
        if($real_hosts)
186
186
                array_push($validation_param, "real_hosts");
187
187
                
188
 
        if(in_array($srctbl,array("triggers","logitems","items")))
 
188
        if(str_in_array($srctbl,array("triggers","logitems","items")))
189
189
        {
190
190
                array_push($validation_param, "always_select_first_host");
191
191
                validate_group_with_host(PERM_READ_LIST,$validation_param);
192
192
        }
193
 
        elseif(in_array($srctbl,array('hosts','templates','host_templates')))
 
193
        elseif(str_in_array($srctbl,array('hosts','templates','host_templates')))
194
194
        {
195
195
                validate_group(PERM_READ_LIST,$validation_param);
196
196
        }
202
202
 
203
203
        if(isset($only_hostid))
204
204
        {
205
 
                if(!isset($_REQUEST["hostid"]) || $_REQUEST["hostid"]!=$only_hostid) access_deny();
 
205
                if(!isset($_REQUEST["hostid"]) || (bccomp($_REQUEST["hostid"], $only_hostid) != 0)) access_deny();
206
206
                $hostid = $only_hostid;
207
207
        }
208
208
        else
209
209
        {
210
 
                if(in_array($srctbl,array("hosts","host_group","triggers","logitems","items",'applications','screens')))
 
210
                if(str_in_array($srctbl,array("hosts","host_group","triggers","logitems","items",'applications','screens')))
211
211
                {
212
212
                        if(ZBX_DISTRIBUTED)
213
213
                        {
217
217
                                while($node_data = DBfetch($db_nodes))
218
218
                                {
219
219
                                        $cmbNode->AddItem($node_data['nodeid'], $node_data['name']);
220
 
                                        if($nodeid == $node_data['nodeid']) $ok = true;
 
220
                                        if((bccomp($nodeid , $node_data['nodeid']) == 0)) $ok = true;
221
221
                                }
222
222
                                $frmTitle->AddItem(array(SPACE,S_NODE,SPACE,$cmbNode));
223
223
                        }
225
225
                if(!isset($ok)) $nodeid = get_current_nodeid();
226
226
                unset($ok);
227
227
                
228
 
                if(in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates')))
 
228
                if(str_in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates')))
229
229
                {
230
230
                        $groupid = get_request("groupid",get_profile("web.popup.groupid",0));
231
231
                        
241
241
                        while($group = DBfetch($db_groups))
242
242
                        {
243
243
                                $cmbGroups->AddItem($group["groupid"],$group["name"]);
244
 
                                if($groupid == $group["groupid"]) $ok = true;
 
244
                                if((bccomp($groupid , $group["groupid"]) == 0)) $ok = true;
245
245
                        }
246
246
                        $frmTitle->AddItem(array(S_GROUP,SPACE,$cmbGroups));
247
247
                        update_profile("web.popup.groupid",$groupid);
248
248
                        if(!isset($ok) || $groupid == 0) unset($groupid);
249
249
                        unset($ok);
250
250
                }
251
 
                if(in_array($srctbl,array("help_items")))
 
251
                if(str_in_array($srctbl,array("help_items")))
252
252
                {
253
253
                        $itemtype = get_request("itemtype",get_profile("web.popup.itemtype",0));
254
254
                        $cmbTypes = new CComboBox("itemtype",$itemtype,"submit()");
256
256
                                $cmbTypes->AddItem($type, item_type2str($type));
257
257
                        $frmTitle->AddItem(array(S_TYPE,SPACE,$cmbTypes));
258
258
                }
259
 
                if(in_array($srctbl,array("triggers","logitems","items",'applications')))
 
259
                if(str_in_array($srctbl,array("triggers","logitems","items",'applications')))
260
260
                {
261
261
                        $hostid = get_request("hostid",get_profile("web.popup.hostid",0));
262
262
                        $cmbHosts = new CComboBox("hostid",$hostid,"submit()");
283
283
                        while($host = DBfetch($db_hosts))
284
284
                        {
285
285
                                $cmbHosts->AddItem($host["hostid"],$host["host"]);
286
 
                                if($hostid == $host["hostid"]) $ok = true;
 
286
                                if(bccomp($hostid , $host["hostid"]) == 0) $ok = true;
287
287
                        }
288
288
                        $frmTitle->AddItem(array(SPACE,S_HOST,SPACE,$cmbHosts));
289
289
                        update_profile("web.popup.hostid",$hostid);
291
291
                        unset($ok);
292
292
                }
293
293
 
294
 
                if(in_array($srctbl,array("triggers","hosts")))
 
294
                if(str_in_array($srctbl,array("triggers","hosts")))
295
295
                {
296
296
                        $btnEmpty = new CButton("empty",S_EMPTY,
297
297
                                get_window_opener($dstfrm, $dstfld1, 0).
471
471
                $form->AddItem($table);
472
472
                $form->Show();
473
473
        }
474
 
        elseif(in_array($srctbl,array("host_group")))
 
474
        elseif(str_in_array($srctbl,array("host_group")))
475
475
        {
476
476
                $accessible_groups      = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY);
477
477
 
494
494
                }
495
495
                $table->Show();
496
496
        }
497
 
        elseif(in_array($srctbl,array('host_templates')))
 
497
        elseif(str_in_array($srctbl,array('host_templates')))
498
498
        {
499
499
                $table = new CTableInfo(S_NO_TEMPLATES_DEFINED);
500
500
                $table->SetHeader(array(S_NAME));
596
596
                        S_STATUS));
597
597
 
598
598
 
599
 
                $sql = "select h.host,t.triggerid,t.description,t.priority,t.status,count(d.triggerid_up) as dep_count ".
 
599
                $sql = "select h.host,t.triggerid,t.description,t.expression,t.priority,t.status,count(d.triggerid_up) as dep_count ".
600
600
                        " from hosts h,items i,functions f, triggers t left join trigger_depends d on d.triggerid_down=t.triggerid ".
601
601
                        " where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid".
602
602
                        ' and '.DBin_node('t.triggerid', $nodeid).
607
607
                if(isset($hostid)) 
608
608
                        $sql .= " and h.hostid=$hostid";
609
609
 
610
 
                $sql .= " group by h.host, t.triggerid, t.description, t.priority, t.status".
 
610
                $sql .= " group by h.host, t.triggerid, t.description, t.expression, t.priority, t.status".
611
611
                        " order by h.host,t.description";
612
612
 
613
613
                $result=DBselect($sql);