View | Details | Raw Unified | Return to bug 132944
Collapse All | Expand All

(-)b/net-mgmt/zabbix/Makefile (-2 / +1 lines)
Lines 7-12 Link Here
7
7
8
PORTNAME=	zabbix
8
PORTNAME=	zabbix
9
PORTVERSION=	1.6.2
9
PORTVERSION=	1.6.2
10
PORTREVISION=	1
10
PORTEPOCH=	1
11
PORTEPOCH=	1
11
CATEGORIES=	net-mgmt
12
CATEGORIES=	net-mgmt
12
MASTER_SITES=	SF
13
MASTER_SITES=	SF
Lines 38-45 SUB_FILES= pkg-message Link Here
38
39
39
.include <bsd.port.pre.mk>
40
.include <bsd.port.pre.mk>
40
41
41
FORBIDDEN=	multiple vulnerabilities http://www.vuxml.org/freebsd/03140526-1250-11de-a964-0030843d3802.html
42
43
.ifndef WITHOUT_JABBER
42
.ifndef WITHOUT_JABBER
44
USE_JABBER=	yes
43
USE_JABBER=	yes
45
CONFIGURE_ARGS+=--with-jabber=${LOCALBASE}
44
CONFIGURE_ARGS+=--with-jabber=${LOCALBASE}
(-)b/net-mgmt/zabbix/files/patch-USH-162.1 (+147 lines)
Added Link Here
1
Patch for vulnerabilities 'A' and 'C' from USH-162 advisory,
2
  http://www.ush.it/team/ush/hack-zabbix_162/adv.txt
3
4
Obtained from svn://svn.zabbix.com/branches/1.6/frontends/php/
5
6
Two hunks, both are unmodified.
7
8
-----
9
10
This hunk removes arbitrary code execution by checking key's
11
value to be alphanumeric with possible underscores.
12
13
Index: include/validate.inc.php
14
===================================================================
15
--- frontends/php/include/validate.inc.php	(revision 6592)
16
+++ frontends/php/include/validate.inc.php	(revision 6593)
17
@@ -198,19 +198,21 @@
18
 		return $ret;
19
 	}
20
 
21
-	function	calc_exp($fields,$field,$expression){
22
+	function calc_exp($fields,$field,$expression){
23
 //SDI("$field - expression: ".$expression);
24
 
25
-		if(zbx_strstr($expression,"{}") && !isset($_REQUEST[$field]))
26
+		if(zbx_strstr($expression,'{}') && !isset($_REQUEST[$field]))
27
 			return FALSE;
28
 
29
-		if(zbx_strstr($expression,"{}") && !is_array($_REQUEST[$field]))
30
-			$expression = str_replace("{}",'$_REQUEST["'.$field.'"]',$expression);
31
+		if(zbx_strstr($expression,'{}') && !is_array($_REQUEST[$field]))
32
+			$expression = str_replace('{}','$_REQUEST["'.$field.'"]',$expression);
33
 
34
-		if(zbx_strstr($expression,"{}") && is_array($_REQUEST[$field])){
35
+		if(zbx_strstr($expression,'{}') && is_array($_REQUEST[$field])){
36
 			foreach($_REQUEST[$field] as $key => $val){
37
-				$expression2 = str_replace("{}",'$_REQUEST["'.$field.'"]["'.$key.'"]',$expression);
38
-				if(calc_exp2($fields,$field,$expression2)==FALSE)
39
+				if(!ereg('^[a-zA-Z0-9_]+$',$key)) return FALSE;
40
+
41
+				$expression2 = str_replace('{}','$_REQUEST["'.$field.'"]["'.$key.'"]',$expression);
42
+				if(calc_exp2($fields,$field,$expression2)==FALSE) 
43
 					return FALSE;
44
 			}	
45
 			return TRUE;
46
@@ -219,7 +221,7 @@
47
 		return calc_exp2($fields,$field,$expression);
48
 	}
49
 
50
-	function	unset_not_in_list(&$fields){
51
+	function unset_not_in_list(&$fields){
52
 		foreach($_REQUEST as $key => $val){
53
 			if(!isset($fields[$key])){
54
 				unset_request($key,'unset_not_in_list');
55
@@ -382,7 +384,7 @@
56
 		}
57
 	}
58
 
59
-	function	check_field(&$fields, &$field, $checks){
60
+	function check_field(&$fields, &$field, $checks){
61
 		list($type,$opt,$flags,$validation,$exception)=$checks;
62
 
63
 		if($flags&P_UNSET_EMPTY && isset($_REQUEST[$field]) && $_REQUEST[$field]==''){
64
@@ -473,9 +475,7 @@
65
 		include_once "include/page_footer.php";
66
 	}
67
 	
68
-	function	check_fields(&$fields, $show_messages=true){
69
-
70
-		global	$_REQUEST;
71
+	function check_fields(&$fields, $show_messages=true){
72
 		global	$system_fields;
73
 
74
 		$err = ZBX_VALID_OK;
75
Index: locales.php
76
===================================================================
77
--- frontends/php/locales.php	(revision 6592)
78
+++ frontends/php/locales.php	(revision 6593)
79
@@ -19,11 +19,11 @@
80
 **/
81
 ?>
82
 <?php
83
-include_once "include/config.inc.php";
84
+include_once('include/config.inc.php');
85
 
86
 if(isset($_REQUEST['download'])){
87
-	$page["type"] = PAGE_TYPE_XML;
88
-	$page["file"] = "new_locale.inc.php";
89
+	$page['type'] = PAGE_TYPE_XML;
90
+	$page['file'] = 'new_locale.inc.php';
91
 }
92
 else{
93
 	$page['title'] = "S_LOCALES";
94
@@ -181,26 +181,25 @@
95
 	$frmLcls->AddOption('id','locales');
96
 	$frmLcls->SetHelp($help);
97
 	
98
-	$fileFrom = 'include/locales/'.$_REQUEST['srclang'].".inc.php";
99
-	if(file_exists($fileFrom)){
100
-		include($fileFrom);
101
 	
102
+	$fileFrom = 'include/locales/'.$_REQUEST['srclang'].'.inc.php';
103
+	if(ereg('^[A-Za-z0-9_]+$', $_REQUEST['srclang']) && file_exists($fileFrom)){
104
+		include($fileFrom);	
105
 		if(!isset($TRANSLATION) || !is_array($TRANSLATION)){
106
-			error("Passed SOURCE is NOT valid PHP file.");
107
+			error('Passed SOURCE is NOT valid PHP file.');
108
 		}
109
 		$transFrom = $TRANSLATION;
110
 	}
111
 	unset($TRANSLATION);
112
 	
113
-	$frmLcls->AddVar('extlang',$_REQUEST['extlang']);
114
-	
115
-	if($_REQUEST['extlang'] != 'new'){
116
-		$fileTo = 'include/locales/'.$_REQUEST['extlang'].".inc.php";
117
+	$frmLcls->addVar('extlang',$_REQUEST['extlang']);
118
+	if(ereg('^[A-Za-z0-9_]+$', $_REQUEST['srclang']) && ($_REQUEST['extlang'] != 'new')){
119
+		$fileTo = 'include/locales/'.$_REQUEST['extlang'].'.inc.php';
120
 		if(file_exists($fileTo)){
121
 			include($fileTo);
122
 			
123
 			if(!isset($TRANSLATION) || !is_array($TRANSLATION)){
124
-				error("Passed DEST is NOT valid PHP file.");
125
+				error('Passed DEST is NOT valid PHP file.');
126
 			}
127
 			$transTo = $TRANSLATION;
128
 //			header('Content-Type: text/html; charset='.$TRANSLATION['S_HTML_CHARSET']);
129
130
-----
131
132
This hunk fixes typo in the bugfix for local file inclusion inside
133
locales.php
134
135
Index: branches/1.6/frontends/php/locales.php
136
===================================================================
137
--- frontends/php/locales.php	(revision 6885)
138
+++ frontends/php/locales.php	(revision 6886)
139
@@ -193,7 +193,7 @@
140
 	unset($TRANSLATION);
141
 	
142
 	$frmLcls->addVar('extlang',$_REQUEST['extlang']);
143
-	if(ereg('^[A-Za-z0-9_]+$', $_REQUEST['srclang']) && ($_REQUEST['extlang'] != 'new')){
144
+	if(ereg('^[A-Za-z0-9_]+$', $_REQUEST['extlang']) && ($_REQUEST['extlang'] != 'new')){
145
 		$fileTo = 'include/locales/'.$_REQUEST['extlang'].'.inc.php';
146
 		if(file_exists($fileTo)){
147
 			include($fileTo);
(-)b/net-mgmt/zabbix/files/patch-USH-162.2 (+2633 lines)
Added Link Here
1
Patch for vulnerability 'B' from USH-162 advisory,
2
  http://www.ush.it/team/ush/hack-zabbix_162/adv.txt
3
4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
Obtained from svn://svn.zabbix.com/branches/1.6/frontends/php/
6
7
This hunk adds functionality to check the 'sessionid' variable using
8
cookie named 'zbx_sessionid' and thus preventing easy CSRFs.
9
10
Whitespace-only changes were mostly removed.
11
12
Index: frontends/php/include/perm.inc.php
13
===================================================================
14
--- frontends/php/include/perm.inc.php	(revision 6620)
15
+++ frontends/php/include/perm.inc.php	(revision 6621)
16
@@ -44,7 +44,7 @@
17
 	$USER_DETAILS = NULL;
18
 	$login = FALSE;
19
 	
20
-	$sessionid = get_cookie('zbx_sessionid');
21
+	$sessionid = get_request('sessionid',get_cookie('zbx_sessionid'));
22
 
23
 	if(!is_null($sessionid)){
24
 		$sql = 'SELECT u.*,s.* '.
25
Index: frontends/php/include/validate.inc.php
26
===================================================================
27
--- frontends/php/include/validate.inc.php	(revision 6620)
28
+++ frontends/php/include/validate.inc.php	(revision 6621)
29
@@ -428,8 +429,12 @@
30
 			}
31
 		}
32
 		else if($opt == O_OPT){
33
-			if(!isset($_REQUEST[$field]))
34
+			if(!isset($_REQUEST[$field])){
35
 				return ZBX_VALID_OK;
36
+			}
37
+			else if(($flags&P_ACT) && !isset($_REQUEST['zbx_form'])){
38
+				return ZBX_VALID_ERROR;
39
+			}
40
 		}
41
 
42
 		check_trim($_REQUEST[$field]);
43
@@ -458,17 +463,21 @@
44
 		return ZBX_VALID_OK;
45
 	}
46
 
47
-//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
48
+//		VAR							TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
49
 	$system_fields=array(
50
-		"sessionid"=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(),NULL),
51
-		"switch_node"=>		array(T_ZBX_INT, O_OPT,	 P_SYS,	DB_ID,NULL),
52
-		"triggers_hash"=>	array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY,NULL),
53
-		'print'=>			array(T_ZBX_INT, O_OPT,	 P_SYS,	IN("1"),NULL),
54
+		'sessionid'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(), 'isset({zbx_form})'),
55
+		'zbx_form'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY, NULL),
56
+// 
57
+		'switch_node'=>		array(T_ZBX_INT, O_OPT,	 P_SYS,	DB_ID,NULL),
58
+		'triggers_hash'=>	array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY,NULL),
59
+		'print'=>			array(T_ZBX_INT, O_OPT,	 P_SYS,	IN('1'),NULL),
60
+		
61
+// table sorting
62
 		'sort'=>			array(T_ZBX_STR, O_OPT,	 P_SYS,	NULL,NULL),
63
 		'sortorder'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	NULL,NULL)
64
 	);
65
 
66
-	function	invalid_url(){
67
+	function invalid_url(){
68
 		include_once "include/page_header.php";
69
 		unset_all();
70
 		show_error_message(S_INVALID_URL);
71
Index: frontends/php/include/classes/cform.inc.php
72
===================================================================
73
--- frontends/php/include/classes/cform.inc.php	(revision 6620)
74
+++ frontends/php/include/classes/cform.inc.php	(revision 6621)
75
@@ -22,46 +22,44 @@
76
 	class CForm extends CTag{
77
 /* public */
78
 		function CForm($action=NULL, $method='post', $enctype=NULL){
79
-			parent::CTag("form","yes");
80
-			$this->SetMethod($method);
81
-			$this->SetAction($action);
82
-			$this->SetEnctype($enctype);
83
+			parent::CTag('form','yes');
84
+			$this->setMethod($method);
85
+			$this->setAction($action);
86
+			$this->setEnctype($enctype);
87
+			
88
+			$this->addVar('zbx_form', 'action');
89
+			$this->addVar('sessionid', $_COOKIE['zbx_sessionid']);
90
 		}
91
 		
92
-		function SetMethod($value='post'){
93
+		function setMethod($value='post'){
94
 			return $this->options['method'] = $value;
95
 		}
96
 		
97
-		function SetAction($value){
98
+		function setAction($value){
99
 			global $page;
100
 
101
 			if(is_null($value)){
102
-				if(isset($page['file'])){
103
-					$value = $page['file'];
104
-				}
105
-				else{
106
-					$value = "#";
107
-				}
108
+				$value = isset($page['file'])?$page['file']:'#';
109
 			}
110
 			
111
 		return $this->options['action'] = $value;
112
 		}
113
 		
114
-		function SetEnctype($value=NULL){
115
+		function setEnctype($value=NULL){
116
 			if(is_null($value)){
117
-				return $this->DelOption("enctype");
118
+				return $this->DelOption('enctype');
119
 			}
120
 			else if(!is_string($value)){
121
 				return $this->error("Incorrect value for SetEnctype [$value]");
122
 			}
123
 			
124
-		return $this->AddOption("enctype",$value);
125
+		return $this->addOption('enctype',$value);
126
 		}
127
 
128
-		function AddVar($name, $value){
129
+		function addVar($name, $value){
130
 			if(empty($value) && $value != 0)	return $value;
131
 
132
-		return $this->AddItem(new CVar($name, $value));
133
+		return $this->addItem(new CVar($name, $value));
134
 		}
135
 	}
136
 ?>
137
Index: frontends/php/include/classes/cformtable.inc.php
138
===================================================================
139
--- frontends/php/include/classes/cformtable.inc.php	(revision 6620)
140
+++ frontends/php/include/classes/cformtable.inc.php	(revision 6621)
141
@@ -46,48 +46,48 @@
142
 			}
143
 
144
 			parent::CForm($action,$method,$enctype);
145
-			$this->SetTitle($title);
146
-			$this->SetAlign('center');
147
-			$this->SetHelp();
148
+			$this->setTitle($title);
149
+			$this->setAlign('center');
150
+			$this->setHelp();
151
 
152
 //			$frm_link = new CLink();
153
-//			$frm_link->SetName("formtable");
154
-//			$this->AddItemToTopRow($frm_link);
155
+//			$frm_link->setName("formtable");
156
+//			$this->addItemToTopRow($frm_link);
157
 			
158
-			$this->AddVar($form_variable, get_request($form_variable, 1));
159
-			$this->AddVar('form_refresh',get_request('form_refresh',0)+1);
160
+			$this->addVar($form_variable, get_request($form_variable, 1));
161
+			$this->addVar('form_refresh',get_request('form_refresh',0)+1);
162
 
163
 			$this->bottom_items = new CCol(SPACE,'form_row_last');
164
-		        $this->bottom_items->SetColSpan(2);
165
+		        $this->bottom_items->setColSpan(2);
166
 		}
167
 		
168
-		function SetAction($value){
169
+		function setAction($value){
170
 			
171
 			if(is_string($value))
172
-				return parent::SetAction($value);
173
+				return parent::setAction($value);
174
 			elseif(is_null($value))
175
-				return parent::SetAction($value);
176
+				return parent::setAction($value);
177
 			else
178
 				return $this->error("Incorrect value for SetAction [$value]");
179
 		}
180
 		
181
-		function SetName($value){
182
+		function setName($value){
183
 			if(!is_string($value)){
184
 				return $this->error("Incorrect value for SetAlign [$value]");
185
 			}
186
-			$this->AddOption('name',$value);
187
-			$this->AddOption('id',$value);
188
+			$this->addOption('name',$value);
189
+			$this->addOption('id',$value);
190
 		return true;
191
 		}
192
 		
193
-		function SetAlign($value){
194
+		function setAlign($value){
195
 			if(!is_string($value)){
196
 				return $this->error("Incorrect value for SetAlign [$value]");
197
 			}
198
 			return $this->align = $value;
199
 		}
200
 
201
-		function SetTitle($value=NULL){
202
+		function setTitle($value=NULL){
203
 			if(is_null($value)){
204
 				unset($this->title);
205
 				return 0;
206
@@ -101,7 +101,7 @@
207
 			$this->title = unpack_object($value);
208
 		}
209
 		
210
-		function SetHelp($value=NULL){
211
+		function setHelp($value=NULL){
212
 			if(is_null($value)) {
213
 				$this->help = new CHelp();
214
 			} 
215
@@ -110,8 +110,8 @@
216
 			} 
217
 			else if(is_string($value)) {
218
 				$this->help = new CHelp($value);
219
-				if($this->GetName()==NULL)
220
-					$this->SetName($value);
221
+				if($this->getName()==NULL)
222
+					$this->setName($value);
223
 			} 
224
 			else {
225
 				return $this->error("Incorrect value for SetHelp [$value]");
226
@@ -119,21 +119,21 @@
227
 			return 0;
228
 		}
229
 		
230
-		function AddVar($name, $value){
231
-			$this->AddItemToTopRow(new CVar($name, $value));
232
+		function addVar($name, $value){
233
+			$this->addItemToTopRow(new CVar($name, $value));
234
 		}
235
 		
236
-		function AddItemToTopRow($value){
237
+		function addItemToTopRow($value){
238
 			array_push($this->top_items, $value);
239
 		}
240
 		
241
-		function AddRow($item1, $item2=NULL, $class=NULL){
242
+		function addRow($item1, $item2=NULL, $class=NULL){
243
 			if(strtolower(get_class($item1)) == 'crow'){
244
 			
245
 			} 
246
 			else if(strtolower(get_class($item1)) == 'ctable'){
247
 				$td = new CCol($item1,'form_row_c');
248
-				$td->SetColSpan(2);
249
+				$td->setColSpan(2);
250
 				
251
 				$item1 = new CRow($td);
252
 			} 
253
@@ -157,7 +157,7 @@
254
 			array_push($this->center_items, $item1);
255
 		}
256
 		
257
-		function AddSpanRow($value, $class=NULL){
258
+		function addSpanRow($value, $class=NULL){
259
 			if(is_string($value))
260
 				$item1=nbsp($value);
261
 
262
@@ -165,16 +165,16 @@
263
 			if(is_null($class)) $class = 'form_row_c';
264
 
265
 			$col = new CCol($value,$class);
266
-		        $col->SetColSpan(2);
267
+		        $col->setColSpan(2);
268
 			array_push($this->center_items,new CRow($col));
269
 		}
270
 		
271
 		
272
-		function AddItemToBottomRow($value){
273
-			$this->bottom_items->AddItem($value);
274
+		function addItemToBottomRow($value){
275
+			$this->bottom_items->addItem($value);
276
 		}
277
 
278
-		function SetTableClass($class){
279
+		function setTableClass($class){
280
 			if(is_string($class)){
281
 				$this->tableclass = $class;
282
 			}
283
@@ -186,25 +186,25 @@
284
 
285
 			$tbl = new CTable(NULL,$this->tableclass);
286
 
287
-			$tbl->SetOddRowClass('form_odd_row');
288
-			$tbl->SetEvenRowClass('form_even_row');
289
-			$tbl->SetCellSpacing(0);
290
-			$tbl->SetCellPadding(1);
291
-			$tbl->SetAlign($this->align);
292
+			$tbl->setOddRowClass('form_odd_row');
293
+			$tbl->setEvenRowClass('form_even_row');
294
+			$tbl->setCellSpacing(0);
295
+			$tbl->setCellPadding(1);
296
+			$tbl->setAlign($this->align);
297
 # add first row
298
 			$col = new CCol(NULL,'form_row_first');
299
-			$col->SetColSpan(2);
300
+			$col->setColSpan(2);
301
 			
302
-			if(isset($this->help))			$col->AddItem($this->help);
303
-			if(isset($this->title))		 	$col->AddItem($this->title);
304
-			foreach($this->top_items as $item)	$col->AddItem($item);
305
+			if(isset($this->help))			$col->addItem($this->help);
306
+			if(isset($this->title))		 	$col->addItem($this->title);
307
+			foreach($this->top_items as $item)	$col->addItem($item);
308
 			
309
-			$tbl->SetHeader($col);
310
+			$tbl->setHeader($col);
311
 # add last row
312
-			$tbl->SetFooter($this->bottom_items);
313
+			$tbl->setFooter($this->bottom_items);
314
 # add center rows
315
 			foreach($this->center_items as $item){
316
-				$tbl->AddRow($item);
317
+				$tbl->addRow($item);
318
 			}
319
 		return $tbl->ToString();
320
 		}
321
322
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323
Obtained from svn://svn.zabbix.com/branches/1.6/frontends/php/
324
325
This hunk adds session identifier transmission during Ajax requests.
326
It also reshuffles some JavaScript functions and adds many whitespace
327
changes.
328
329
Index: frontends/php/js/cookies.js
330
===================================================================
331
--- frontends/php/js/cookies.js	(revision 6622)
332
+++ frontends/php/js/cookies.js	(revision 6623)
333
@@ -1,78 +0,0 @@
334
-//Javascript document
335
-/*
336
-** ZABBIX
337
-** Copyright (C) 2000-2005 SIA Zabbix
338
-**
339
-** This program is free software; you can redistribute it and/or modify
340
-** it under the terms of the GNU General Public License as published by
341
-** the Free Software Foundation; either version 2 of the License, or
342
-** (at your option) any later version.
343
-**
344
-** This program is distributed in the hope that it will be useful,
345
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
346
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
347
-** GNU General Public License for more details.
348
-**
349
-** You should have received a copy of the GNU General Public License
350
-** along with this program; if not, write to the Free Software
351
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
352
-**/ 
353
-// Title: cookies class
354
-// Description: to manipulate cookies on client side
355
-// Author: Aly
356
-
357
-var cookie ={
358
-cookies: new Array(),
359
-
360
-init: function () {
361
-	var allCookies = document.cookie.split('; ');
362
-	for (var i=0;i<allCookies.length;i++) {
363
-		var cookiePair = allCookies[i].split('=');
364
-		this.cookies[cookiePair[0]] = cookiePair[1];
365
-	}
366
-},
367
-
368
-create: function (name,value,days) {
369
-	if(days) {
370
-		var date = new Date();
371
-		date.setTime(date.getTime()+(days*24*60*60*1000));
372
-		var expires = "; expires="+date.toGMTString();
373
-	}else{ 
374
-		var expires = "";
375
-	}
376
-	
377
-	document.cookie = name+"="+value+expires+"; path=/";
378
-	this.cookies[name] = value;
379
-},
380
-
381
-read : function(name){
382
-	if(typeof(this.cookies[name]) != 'undefined'){
383
-		return this.cookies[name];
384
-	} else {
385
-		var nameEQ = name + "=";
386
-		var ca = document.cookie.split(';');
387
-		for(var i=0;i < ca.length;i++) {
388
-			var c = ca[i];
389
-			while (c.charAt(0)==' ') c = c.substring(1,c.length);
390
-			if(c.indexOf(nameEQ) == 0)	return this.cookies[name] = c.substring(nameEQ.length,c.length);
391
-		}
392
-	}
393
-	return null;
394
-},
395
-
396
-printall: function() {
397
-	var allCookies = document.cookie.split('; ');
398
-	for (var i=0;i<allCookies.length;i++) {
399
-		var cookiePair = allCookies[i].split('=');
400
-		
401
-		alert("[" + cookiePair[0] + "] is " + cookiePair[1]); // assumes print is already defined
402
-	}
403
-},
404
-
405
-erase: function (name) {
406
-	this.create(name,'',-1);
407
-	this.cookies[name] = undefined;
408
-}
409
-}
410
-
411
-cookie.init();
412
\ No newline at end of file
413
Index: frontends/php/js/url.js
414
===================================================================
415
--- frontends/php/js/url.js	(revision 6622)
416
+++ frontends/php/js/url.js	(revision 6623)
417
@@ -1,256 +0,0 @@
418
-// JavaScript Document
419
-/*
420
-** ZABBIX
421
-** Copyright (C) 2000-2007 SIA Zabbix
422
-**
423
-** This program is free software; you can redistribute it and/or modify
424
-** it under the terms of the GNU General Public License as published by
425
-** the Free Software Foundation; either version 2 of the License, or
426
-** (at your option) any later version.
427
-**
428
-** This program is distributed in the hope that it will be useful,
429
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
430
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
431
-** GNU General Public License for more details.
432
-**
433
-** You should have received a copy of the GNU General Public License
434
-** along with this program; if not, write to the Free Software
435
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
436
-**
437
-*/
438
-
439
-// Title: url manipulation class
440
-// Author: Aly
441
-
442
-
443
-var url = Class.create();
444
-
445
-url.prototype = {
446
-url: 		'',		//	actually, it's depricated/private variable 
447
-port:		 -1,
448
-host: 		'',
449
-protocol: 	'',
450
-username:	'',
451
-password:	'',
452
-filr:		'',
453
-reference:	'',
454
-path:		'',
455
-query:		'',
456
-arguments: new Array(),
457
-
458
-initialize: function(url){
459
-	this.url=unescape(url);
460
-	
461
-	this.query=(this.url.indexOf('?')>=0)?this.url.substring(this.url.indexOf('?')+1):'';
462
-	if(this.query.indexOf('#')>=0) this.query=this.query.substring(0,this.query.indexOf('#'));
463
-	
464
-	var protocolSepIndex=this.url.indexOf('://');
465
-	if(protocolSepIndex>=0){
466
-		this.protocol=this.url.substring(0,protocolSepIndex).toLowerCase();
467
-		this.host=this.url.substring(protocolSepIndex+3);
468
-		if(this.host.indexOf('/')>=0) this.host=this.host.substring(0,this.host.indexOf('/'));
469
-		var atIndex=this.host.indexOf('@');
470
-		if(atIndex>=0){
471
-			var credentials=this.host.substring(0,atIndex);
472
-			var colonIndex=credentials.indexOf(':');
473
-			if(colonIndex>=0){
474
-				this.username=credentials.substring(0,colonIndex);
475
-				this.password=credentials.substring(colonIndex);
476
-			}else{
477
-				this.username=credentials;
478
-			}
479
-			this.host=this.host.substring(atIndex+1);
480
-		}
481
-		
482
-		var host_ipv6 = this.host.indexOf(']');
483
-		if(host_ipv6>=0){
484
-			if(host_ipv6 < (this.host.length-1)){
485
-				host_ipv6++;
486
-				var host_less = this.host.substring(host_ipv6);
487
-
488
-				var portColonIndex=host_less.indexOf(':');
489
-				if(portColonIndex>=0){
490
-					this.port=host_less.substring(portColonIndex+1);
491
-					this.host=this.host.substring(0,host_ipv6);
492
-				}
493
-			}
494
-		}
495
-		else{
496
-			var portColonIndex=this.host.indexOf(':');
497
-			if(portColonIndex>=0){
498
-				this.port=this.host.substring(portColonIndex+1);
499
-				this.host=this.host.substring(0,portColonIndex);
500
-			}
501
-		}
502
-		this.file=this.url.substring(protocolSepIndex+3);
503
-		this.file=this.file.substring(this.file.indexOf('/'));
504
-	}else{
505
-		this.file=this.url;
506
-	}
507
-	if(this.file.indexOf('?')>=0) this.file=this.file.substring(0, this.file.indexOf('?'));
508
-
509
-	var refSepIndex=url.indexOf('#');
510
-	if(refSepIndex>=0){
511
-		this.file=this.file.substring(0,refSepIndex);
512
-		this.reference=this.url.substring(this.url.indexOf('#'));
513
-	}
514
-	this.path=this.file;
515
-	if(this.query.length>0) this.file+='?'+this.query;
516
-	if(this.reference.length>0) this.file+='#'+this.reference;
517
-	if(this.query.length > 0)	this.getArguments();
518
-},
519
-
520
-getArguments: function(){
521
-	var args=this.query.split('&');
522
-	var keyval='';
523
-	
524
-	if(args.length<1) return;
525
-	
526
-	for(i=0;i<args.length;i++){
527
-		keyval=args[i].split('=');
528
-		this.arguments[i] = new Array(keyval[0],(keyval.length==1)?keyval[0]:keyval[1]);
529
-	}
530
-},
531
-
532
-getArgumentValue: function(key){
533
-	if(key.length<1) return '';
534
-	for(i=0; i < this.arguments.length; i++){
535
-		if(this.arguments[i][0] == key) return this.arguments[i][1];
536
-	}
537
-	
538
-return '';
539
-},
540
-
541
-getArgumentValues: function(){
542
-	var a=new Array();
543
-	var b=this.query.split('&');
544
-	var c='';
545
-	if(b.length<1) return a;
546
-	for(i=0;i<b.length;i++){
547
-		c=b[i].split('=');
548
-		a[i]=new Array(c[0],((c.length==1)?c[0]:c[1]));
549
-	}
550
-return a;
551
-},
552
-
553
-getUrl: function(){
554
-	var uri = (this.protocol.length > 0)?(this.protocol+'://'):'';
555
-	uri +=  encodeURI((this.username.length > 0)?(this.username):'');
556
-	uri +=  encodeURI((this.password.length > 0)?(':'+this.password):'');
557
-	uri +=  (this.host.length > 0)?(this.host):'';
558
-	uri +=  (this.port.length > 0)?(':'+this.port):'';
559
-	uri +=  encodeURI((this.path.length > 0)?(this.path):'');
560
-	uri +=  encodeURI((this.query.length > 0)?('?'+this.query):'');
561
-	uri +=  encodeURI((this.reference.length > 0)?('#'+this.reference):'');
562
-//	alert(uri.getProtocol()+' : '+uri.getHost()+' : '+uri.getPort()+' : '+uri.getPath()+' : '+uri.getQuery());
563
-return uri;
564
-},
565
-
566
-setArgument: function(key,value){
567
-
568
-	var valueisset = false;
569
-	if(typeof(key) == 'undefined') throw 'Invalid argument past for setArgument';
570
-	
571
-	value =('undefined' != typeof(value))?value:'';
572
-
573
-	for(i=0; i < this.arguments.length; i++){
574
-		if(this.arguments[i][0] == key){
575
-			valueisset = true;
576
-			this.arguments[i][1] = value;
577
-		}
578
-	}	
579
-	if(!valueisset)	this.arguments[this.arguments.length] = new Array(key,value);
580
-	this.formatQuery();
581
-},
582
-
583
-formatQuery: function(){
584
-	if(this.arguments.lenght < 1) return;
585
-	
586
-	var query = '';
587
-	for(i=0; i < this.arguments.length; i++){		
588
-		query+=this.arguments[i][0]+'='+this.arguments[i][1]+'&';
589
-	}
590
-	this.query = query.substring(0,query.length-1);
591
-},
592
-
593
-getPort: function(){ 
594
-	return this.port;
595
-},
596
-
597
-setPort: function(port){
598
-	this.port = port;
599
-},
600
-
601
-getQuery: function(){ 
602
-	return this.query;
603
-},
604
-
605
-setQuery: function(query){ 
606
-	this.query = query;
607
-	this.getArgumentValues();
608
-	this.formatQuery();
609
-},
610
-
611
-/* Returns the protocol of this URL, i.e. 'http' in the url 'http://server/' */
612
-getProtocol: function(){
613
-	return this.protocol;
614
-},
615
-
616
-setProtocol: function(protocol){
617
-	this.protocol = protocol;
618
-},
619
-/* Returns the host name of this URL, i.e. 'server.com' in the url 'http://server.com/' */
620
-getHost: function(){
621
-	return this.host;
622
-},
623
-
624
-setHost: function(set){
625
-	this.host = host;
626
-},
627
-
628
-/* Returns the user name part of this URL, i.e. 'joe' in the url 'http://joe@server.com/' */
629
-getUserName: function(){
630
-	return this.username;
631
-},
632
-
633
-setUserName: function(username){
634
-	this.username = username;
635
-},
636
-
637
-/* Returns the password part of this url, i.e. 'secret' in the url 'http://joe:secret@server.com/' */
638
-getPassword: function(){
639
-	return this.password;
640
-},
641
-
642
-setPassword: function(password){
643
-	this.password = password;
644
-},
645
-
646
-/* Returns the file part of this url, i.e. everything after the host name. */
647
-getFile: function(){
648
-	return this.file = file;
649
-},
650
-
651
-setFile: function(file){
652
-	this.file = file;
653
-},
654
-
655
-/* Returns the reference of this url, i.e. 'bookmark' in the url 'http://server/file.html#bookmark' */
656
-getReference: function(){
657
-	return this.reference;
658
-},
659
-
660
-setReference: function(reference){
661
-	this.reference = reference;
662
-},
663
-
664
-/* Returns the file path of this url, i.e. '/dir/file.html' in the url 'http://server/dir/file.html' */
665
-getPath: function(){
666
-	return this.path;
667
-},
668
-
669
-setPath: function(path){
670
-	this.path = path;
671
-}
672
-
673
-}
674
\ No newline at end of file
675
Index: frontends/php/js/updater.js
676
===================================================================
677
--- frontends/php/js/updater.js	(revision 6622)
678
+++ frontends/php/js/updater.js	(revision 6623)
679
@@ -27,7 +27,7 @@
680
 
681
 	setObj4Update: function(id,frequency,url,params){
682
 		var obj = document.getElementById(id);
683
-		if((typeof(obj) == 'undefined')) return false; 
684
+		if(typeof(obj) == 'undefined') return false; 
685
 	
686
 		var obj4update = {
687
 			'id': 		id,
688
@@ -65,7 +65,9 @@
689
 		obj4update.ready = false;
690
 		
691
 		var uri = new url(obj4update.url);
692
-		new Ajax.Updater(obj4update.id, obj4update.url,
693
+		uri.setArgument('sessionid', cookie.read('zbx_sessionid'));
694
+
695
+		new Ajax.Updater(obj4update.id, uri.getUrl(),//obj4update.url,
696
 			{
697
 				method: 'post',
698
 				'parameters':	obj4update.params,
699
Index: frontends/php/js/gpc.js
700
===================================================================
701
--- frontends/php/js/gpc.js	(revision 0)
702
+++ frontends/php/js/gpc.js	(revision 6623)
703
@@ -0,0 +1,315 @@
704
+//Javascript document
705
+/*
706
+** ZABBIX
707
+** Copyright (C) 2000-2009 SIA Zabbix
708
+**
709
+** This program is free software; you can redistribute it and/or modify
710
+** it under the terms of the GNU General Public License as published by
711
+** the Free Software Foundation; either version 2 of the License, or
712
+** (at your option) any later version.
713
+**
714
+** This program is distributed in the hope that it will be useful,
715
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
716
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
717
+** GNU General Public License for more details.
718
+**
719
+** You should have received a copy of the GNU General Public License
720
+** along with this program; if not, write to the Free Software
721
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
722
+**/
723
+
724
+// Title: cookies class
725
+// Description: to manipulate cookies on client side
726
+// Author: Aly
727
+var cookie ={
728
+cookies: new Array(),
729
+
730
+init: function () {
731
+	var allCookies = document.cookie.split('; ');
732
+	for (var i=0;i<allCookies.length;i++) {
733
+		var cookiePair = allCookies[i].split('=');
734
+		this.cookies[cookiePair[0]] = cookiePair[1];
735
+	}
736
+},
737
+
738
+create: function (name,value,days) {
739
+	if(days) {
740
+		var date = new Date();
741
+		date.setTime(date.getTime()+(days*24*60*60*1000));
742
+		var expires = "; expires="+date.toGMTString();
743
+	}
744
+	else{ 
745
+		var expires = "";
746
+	}
747
+	
748
+	document.cookie = name+"="+value+expires+"; path=/";
749
+	this.cookies[name] = value;
750
+},
751
+
752
+read : function(name){
753
+	if(typeof(this.cookies[name]) != 'undefined'){
754
+		return this.cookies[name];
755
+	} 
756
+	else {
757
+		var nameEQ = name + "=";
758
+		var ca = document.cookie.split(';');
759
+		for(var i=0;i < ca.length;i++) {
760
+			var c = ca[i];
761
+			while (c.charAt(0)==' ') c = c.substring(1,c.length);
762
+			if(c.indexOf(nameEQ) == 0)	return this.cookies[name] = c.substring(nameEQ.length,c.length);
763
+		}
764
+	}
765
+	return null;
766
+},
767
+
768
+printall: function() {
769
+	var allCookies = document.cookie.split('; ');
770
+	for(var i=0;i<allCookies.length;i++){
771
+		var cookiePair = allCookies[i].split('=');
772
+		
773
+		alert("[" + cookiePair[0] + "] is " + cookiePair[1]); // assumes print is already defined
774
+	}
775
+},
776
+
777
+erase: function (name) {
778
+	this.create(name,'',-1);
779
+	this.cookies[name] = undefined;
780
+}
781
+}
782
+
783
+cookie.init();
784
+
785
+
786
+
787
+// Title: url manipulation class
788
+// Author: Aly
789
+var url = Class.create();
790
+
791
+url.prototype = {
792
+url: 		'',		//	actually, it's depricated/private variable 
793
+port:		 -1,
794
+host: 		'',
795
+protocol: 	'',
796
+username:	'',
797
+password:	'',
798
+filr:		'',
799
+reference:	'',
800
+path:		'',
801
+query:		'',
802
+arguments: new Array(),
803
+
804
+initialize: function(url){
805
+	this.url=unescape(url);
806
+	
807
+	this.query=(this.url.indexOf('?')>=0)?this.url.substring(this.url.indexOf('?')+1):'';
808
+	if(this.query.indexOf('#')>=0) this.query=this.query.substring(0,this.query.indexOf('#'));
809
+	
810
+	var protocolSepIndex=this.url.indexOf('://');
811
+	if(protocolSepIndex>=0){
812
+		this.protocol=this.url.substring(0,protocolSepIndex).toLowerCase();
813
+		this.host=this.url.substring(protocolSepIndex+3);
814
+		if(this.host.indexOf('/')>=0) this.host=this.host.substring(0,this.host.indexOf('/'));
815
+		var atIndex=this.host.indexOf('@');
816
+		if(atIndex>=0){
817
+			var credentials=this.host.substring(0,atIndex);
818
+			var colonIndex=credentials.indexOf(':');
819
+			if(colonIndex>=0){
820
+				this.username=credentials.substring(0,colonIndex);
821
+				this.password=credentials.substring(colonIndex);
822
+			}else{
823
+				this.username=credentials;
824
+			}
825
+			this.host=this.host.substring(atIndex+1);
826
+		}
827
+		
828
+		var host_ipv6 = this.host.indexOf(']');
829
+		if(host_ipv6>=0){
830
+			if(host_ipv6 < (this.host.length-1)){
831
+				host_ipv6++;
832
+				var host_less = this.host.substring(host_ipv6);
833
+
834
+				var portColonIndex=host_less.indexOf(':');
835
+				if(portColonIndex>=0){
836
+					this.port=host_less.substring(portColonIndex+1);
837
+					this.host=this.host.substring(0,host_ipv6);
838
+				}
839
+			}
840
+		}
841
+		else{
842
+			var portColonIndex=this.host.indexOf(':');
843
+			if(portColonIndex>=0){
844
+				this.port=this.host.substring(portColonIndex+1);
845
+				this.host=this.host.substring(0,portColonIndex);
846
+			}
847
+		}
848
+		this.file=this.url.substring(protocolSepIndex+3);
849
+		this.file=this.file.substring(this.file.indexOf('/'));
850
+	}else{
851
+		this.file=this.url;
852
+	}
853
+	if(this.file.indexOf('?')>=0) this.file=this.file.substring(0, this.file.indexOf('?'));
854
+
855
+	var refSepIndex=url.indexOf('#');
856
+	if(refSepIndex>=0){
857
+		this.file=this.file.substring(0,refSepIndex);
858
+		this.reference=this.url.substring(this.url.indexOf('#'));
859
+	}
860
+	this.path=this.file;
861
+	if(this.query.length>0) this.file+='?'+this.query;
862
+	if(this.reference.length>0) this.file+='#'+this.reference;
863
+	if(this.query.length > 0)	this.getArguments();
864
+},
865
+
866
+getArguments: function(){
867
+	var args=this.query.split('&');
868
+	var keyval='';
869
+	
870
+	if(args.length<1) return;
871
+	
872
+	for(i=0;i<args.length;i++){
873
+		keyval=args[i].split('=');
874
+		this.arguments[i] = new Array(keyval[0],(keyval.length==1)?keyval[0]:keyval[1]);
875
+	}
876
+},
877
+
878
+getArgumentValue: function(key){
879
+	if(key.length<1) return '';
880
+	for(i=0; i < this.arguments.length; i++){
881
+		if(this.arguments[i][0] == key) return this.arguments[i][1];
882
+	}
883
+	
884
+return '';
885
+},
886
+
887
+getArgumentValues: function(){
888
+	var a=new Array();
889
+	var b=this.query.split('&');
890
+	var c='';
891
+	if(b.length<1) return a;
892
+	for(i=0;i<b.length;i++){
893
+		c=b[i].split('=');
894
+		a[i]=new Array(c[0],((c.length==1)?c[0]:c[1]));
895
+	}
896
+return a;
897
+},
898
+
899
+getUrl: function(){
900
+	var uri = (this.protocol.length > 0)?(this.protocol+'://'):'';
901
+	uri +=  encodeURI((this.username.length > 0)?(this.username):'');
902
+	uri +=  encodeURI((this.password.length > 0)?(':'+this.password):'');
903
+	uri +=  (this.host.length > 0)?(this.host):'';
904
+	uri +=  (this.port.length > 0)?(':'+this.port):'';
905
+	uri +=  encodeURI((this.path.length > 0)?(this.path):'');
906
+	uri +=  encodeURI((this.query.length > 0)?('?'+this.query):'');
907
+	uri +=  encodeURI((this.reference.length > 0)?('#'+this.reference):'');
908
+//	alert(uri.getProtocol()+' : '+uri.getHost()+' : '+uri.getPort()+' : '+uri.getPath()+' : '+uri.getQuery());
909
+return uri;
910
+},
911
+
912
+setArgument: function(key,value){
913
+
914
+	var valueisset = false;
915
+	if(typeof(key) == 'undefined') throw 'Invalid argument past for setArgument';
916
+	
917
+	value =('undefined' != typeof(value))?value:'';
918
+
919
+	for(i=0; i < this.arguments.length; i++){
920
+		if(this.arguments[i][0] == key){
921
+			valueisset = true;
922
+			this.arguments[i][1] = value;
923
+		}
924
+	}	
925
+	if(!valueisset)	this.arguments[this.arguments.length] = new Array(key,value);
926
+	this.formatQuery();
927
+},
928
+
929
+formatQuery: function(){
930
+	if(this.arguments.lenght < 1) return;
931
+	
932
+	var query = '';
933
+	for(i=0; i < this.arguments.length; i++){		
934
+		query+=this.arguments[i][0]+'='+this.arguments[i][1]+'&';
935
+	}
936
+	this.query = query.substring(0,query.length-1);
937
+},
938
+
939
+getPort: function(){ 
940
+	return this.port;
941
+},
942
+
943
+setPort: function(port){
944
+	this.port = port;
945
+},
946
+
947
+getQuery: function(){ 
948
+	return this.query;
949
+},
950
+
951
+setQuery: function(query){ 
952
+	this.query = query;
953
+	this.getArgumentValues();
954
+	this.formatQuery();
955
+},
956
+
957
+/* Returns the protocol of this URL, i.e. 'http' in the url 'http://server/' */
958
+getProtocol: function(){
959
+	return this.protocol;
960
+},
961
+
962
+setProtocol: function(protocol){
963
+	this.protocol = protocol;
964
+},
965
+/* Returns the host name of this URL, i.e. 'server.com' in the url 'http://server.com/' */
966
+getHost: function(){
967
+	return this.host;
968
+},
969
+
970
+setHost: function(set){
971
+	this.host = host;
972
+},
973
+
974
+/* Returns the user name part of this URL, i.e. 'joe' in the url 'http://joe@server.com/' */
975
+getUserName: function(){
976
+	return this.username;
977
+},
978
+
979
+setUserName: function(username){
980
+	this.username = username;
981
+},
982
+
983
+/* Returns the password part of this url, i.e. 'secret' in the url 'http://joe:secret@server.com/' */
984
+getPassword: function(){
985
+	return this.password;
986
+},
987
+
988
+setPassword: function(password){
989
+	this.password = password;
990
+},
991
+
992
+/* Returns the file part of this url, i.e. everything after the host name. */
993
+getFile: function(){
994
+	return this.file = file;
995
+},
996
+
997
+setFile: function(file){
998
+	this.file = file;
999
+},
1000
+
1001
+/* Returns the reference of this url, i.e. 'bookmark' in the url 'http://server/file.html#bookmark' */
1002
+getReference: function(){
1003
+	return this.reference;
1004
+},
1005
+
1006
+setReference: function(reference){
1007
+	this.reference = reference;
1008
+},
1009
+
1010
+/* Returns the file path of this url, i.e. '/dir/file.html' in the url 'http://server/dir/file.html' */
1011
+getPath: function(){
1012
+	return this.path;
1013
+},
1014
+
1015
+setPath: function(path){
1016
+	this.path = path;
1017
+}
1018
+}
1019
\ No newline at end of file
1020
Index: frontends/php/js/ajax_req.js
1021
===================================================================
1022
--- frontends/php/js/ajax_req.js	(revision 6622)
1023
+++ frontends/php/js/ajax_req.js	(revision 6623)
1024
@@ -19,6 +19,8 @@
1025
 **/
1026
 
1027
 function send_params(params){
1028
+	if(typeof(params) == 'undefined') var params = new Array();
1029
+	params['sessionid'] = cookie.read('zbx_sessionid');
1030
 
1031
 	var uri = new url(location.href);
1032
 	new Ajax.Request(uri.getPath()+"?output=ajax",
1033
Index: frontends/php/dashboard.php
1034
===================================================================
1035
--- frontends/php/dashboard.php	(revision 6622)
1036
+++ frontends/php/dashboard.php	(revision 6623)
1037
@@ -42,8 +42,8 @@
1038
 		'view_style'=>	array(T_ZBX_INT, O_OPT,	P_SYS,	IN('0,1'),		NULL),
1039
 		'type'=>		array(T_ZBX_INT, O_OPT,	P_SYS,	IN('0,1'),		NULL),
1040
 		
1041
-		'output'=>		array(T_ZBX_STR, O_OPT, P_ACT,	NULL,			NULL),
1042
-		'jsscriptid'=>	array(T_ZBX_STR, O_OPT, P_ACT,	NULL,			NULL),
1043
+		'output'=>		array(T_ZBX_STR, O_OPT, P_SYS,	NULL,			NULL),
1044
+		'jsscriptid'=>	array(T_ZBX_STR, O_OPT, P_SYS,	NULL,			NULL),
1045
 		'fullscreen'=>	array(T_ZBX_INT, O_OPT,	P_SYS,	IN('0,1'),		NULL),
1046
 		
1047
 //ajax
1048
@@ -56,7 +56,7 @@
1049
 	);
1050
 
1051
 	check_fields($fields);
1052
-	
1053
+
1054
 	$available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
1055
 // ACTION /////////////////////////////////////////////////////////////////////////////
1056
 	if(isset($_REQUEST['favobj'])){
1057
Index: frontends/php/include/page_header.php
1058
===================================================================
1059
--- frontends/php/include/page_header.php	(revision 6622)
1060
+++ frontends/php/include/page_header.php	(revision 6623)
1061
@@ -428,8 +428,8 @@
1062
 
1063
 <script type="text/javascript" src="js/prototype.js"></script>
1064
 <script type="text/javascript" src="js/common.js"></script>
1065
+<script type="text/javascript" src="js/gpc.js"></script>
1066
 <script type="text/javascript" src="js/ajax_req.js"></script>
1067
-<script type="text/javascript" src="js/url.js"></script>
1068
 <script type="text/javascript" src="js/chkbxrange.js"></script>
1069
 <?php
1070
 	if(isset($page['scripts']) && is_array($page['scripts'])){
1071
Index: frontends/php/include/validate.inc.php
1072
===================================================================
1073
--- frontends/php/include/validate.inc.php	(revision 6622)
1074
+++ frontends/php/include/validate.inc.php	(revision 6623)
1075
@@ -432,7 +432,7 @@
1076
 			if(!isset($_REQUEST[$field])){
1077
 				return ZBX_VALID_OK;
1078
 			}
1079
-			else if(($flags&P_ACT) && !isset($_REQUEST['zbx_form'])){
1080
+			else if(($flags&P_ACT) && !isset($_REQUEST['sessionid'])){
1081
 				return ZBX_VALID_ERROR;
1082
 			}
1083
 		}
1084
@@ -465,8 +465,7 @@
1085
 
1086
 //		VAR							TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
1087
 	$system_fields=array(
1088
-		'sessionid'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(), 'isset({zbx_form})'),
1089
-		'zbx_form'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY, NULL),
1090
+		'sessionid'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(), NULL),
1091
 // 
1092
 		'switch_node'=>		array(T_ZBX_INT, O_OPT,	 P_SYS,	DB_ID,NULL),
1093
 		'triggers_hash'=>	array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY,NULL),
1094
Index: frontends/php/include/classes/ctree.inc.php
1095
===================================================================
1096
--- frontends/php/include/classes/ctree.inc.php	(revision 6622)
1097
+++ frontends/php/include/classes/ctree.inc.php	(revision 6623)
1098
@@ -214,7 +214,6 @@
1099
 	global $page;
1100
 		$js = '
1101
 		<script src="js/tree.js" type="text/javascript"></script>
1102
-		<script src="js/cookies.js" type="text/javascript"></script>	
1103
 		<script type="text/javascript"> 
1104
 				var treenode = new Array(0);
1105
 				var tree_name = "tree_'.$this->getUserAlias().'_'.$page["file"].'";
1106
Index: frontends/php/include/classes/cform.inc.php
1107
===================================================================
1108
--- frontends/php/include/classes/cform.inc.php	(revision 6622)
1109
+++ frontends/php/include/classes/cform.inc.php	(revision 6623)
1110
@@ -27,7 +27,6 @@
1111
 			$this->setAction($action);
1112
 			$this->setEnctype($enctype);
1113
 			
1114
-			$this->addVar('zbx_form', 'action');
1115
 			$this->addVar('sessionid', $_COOKIE['zbx_sessionid']);
1116
 		}
1117
 		
1118
Index: frontends/php/index.php
1119
===================================================================
1120
--- frontends/php/index.php	(revision 6622)
1121
+++ frontends/php/index.php	(revision 6623)
1122
@@ -33,8 +33,8 @@
1123
 		"password"=>		array(T_ZBX_STR, O_OPT,	NULL,	NULL,		'isset({enter})'),
1124
 		"sessionid"=>		array(T_ZBX_STR, O_OPT,	NULL,	NULL,		NULL),
1125
 		"message"=>			array(T_ZBX_STR, O_OPT,	NULL,	NULL,		NULL),
1126
-		"reconnect"=>		array(T_ZBX_INT, O_OPT,	P_ACT, BETWEEN(0,65535),NULL),
1127
-		"enter"=>			array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,    NULL,   NULL),
1128
+		"reconnect"=>		array(T_ZBX_INT, O_OPT,	NULL, BETWEEN(0,65535),NULL),
1129
+		"enter"=>			array(T_ZBX_STR, O_OPT, P_SYS,    NULL,   NULL),
1130
 		"form"=>			array(T_ZBX_STR, O_OPT, P_SYS,  NULL,   	NULL),
1131
 		"form_refresh"=>	array(T_ZBX_INT, O_OPT, NULL,   NULL,   	NULL)
1132
 	);
1133
1134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1135
Obtained from svn://svn.zabbix.com/branches/1.6/frontends/php/
1136
1137
Checks if 'zbx_sessionid' cookie is really here before setting
1138
'sessionid' variable.
1139
1140
Index: frontends/php/include/classes/cform.inc.php
1141
===================================================================
1142
--- frontends/php/include/classes/cform.inc.php	(revision 6624)
1143
+++ frontends/php/include/classes/cform.inc.php	(revision 6625)
1144
@@ -27,7 +27,8 @@
1145
 			$this->setAction($action);
1146
 			$this->setEnctype($enctype);
1147
 			
1148
-			$this->addVar('sessionid', $_COOKIE['zbx_sessionid']);
1149
+			if(isset($_COOKIE['zbx_sessionid']))
1150
+				$this->addVar('sessionid', $_COOKIE['zbx_sessionid']);
1151
 		}
1152
 		
1153
 		function setMethod($value='post'){
1154
1155
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1156
Obtained from svn://svn.zabbix.com/branches/1.6/frontends/php/
1157
1158
This hunk basically trades the name 'sessionid' for 'sid'.  It also
1159
reshuffles many functions, adds many whitespace changes and implants
1160
URL manipulation tools for JavaScript.
1161
1162
Index: frontends/php/users.php
1163
===================================================================
1164
--- frontends/php/users.php	(revision 6643)
1165
+++ frontends/php/users.php	(revision 6644)
1166
@@ -1,7 +1,7 @@
1167
 <?php
1168
 /* 
1169
 ** ZABBIX
1170
-** Copyright (C) 2000-2005 SIA Zabbix
1171
+** Copyright (C) 2000-2009 SIA Zabbix
1172
 **
1173
 ** This program is free software; you can redistribute it and/or modify
1174
 ** it under the terms of the GNU General Public License as published by
1175
@@ -24,6 +24,7 @@
1176
 	require_once('include/media.inc.php');
1177
 	require_once('include/users.inc.php');
1178
 	require_once('include/forms.inc.php');
1179
+	require_once('include/classes/curl.inc.php');
1180
 	require_once('include/js.inc.php');
1181
 
1182
 	$page['title'] = 'S_USERS';
1183
@@ -32,7 +33,6 @@
1184
 	$page['scripts'] = array('menu_scripts.js');
1185
 
1186
 include_once('include/page_header.php');
1187
-
1188
 ?>
1189
 <?php
1190
 	$_REQUEST['config']=get_request('config',get_profile('web.users.config',0));
1191
Index: frontends/php/js/menu.js
1192
===================================================================
1193
--- frontends/php/js/menu.js	(revision 6643)
1194
+++ frontends/php/js/menu.js	(revision 6644)
1195
@@ -386,8 +386,13 @@
1196
 		this.n_y -= this.getprop('height') * (o_parent.a_config.length - item_offset);
1197
 	}
1198
 
1199
+	if(!is_null(this.a_config[1]) && (this.a_config[1].indexOf('javascript') == -1)){
1200
+		var uri = new url(this.a_config[1]);
1201
+		this.a_config[1] = uri.getUrl();
1202
+	}
1203
+	
1204
 	// generate item's HMTL
1205
-	var el = document.createElement("a");
1206
+	var el = document.createElement('a');
1207
 	el.setAttribute('id', 'e' + o_root.n_id + '_' + this.n_id + 'o');
1208
 	el.setAttribute('href', this.a_config[1]);
1209
 
1210
Index: frontends/php/js/updater.js
1211
===================================================================
1212
--- frontends/php/js/updater.js	(revision 6643)
1213
+++ frontends/php/js/updater.js	(revision 6644)
1214
@@ -65,8 +65,6 @@
1215
 		obj4update.ready = false;
1216
 		
1217
 		var uri = new url(obj4update.url);
1218
-		uri.setArgument('sessionid', cookie.read('zbx_sessionid'));
1219
-
1220
 		new Ajax.Updater(obj4update.id, uri.getUrl(),//obj4update.url,
1221
 			{
1222
 				method: 'post',
1223
Index: frontends/php/js/gpc.js
1224
===================================================================
1225
--- frontends/php/js/gpc.js	(revision 6643)
1226
+++ frontends/php/js/gpc.js	(revision 6644)
1227
@@ -96,7 +96,7 @@
1228
 reference:	'',
1229
 path:		'',
1230
 query:		'',
1231
-arguments: new Array(),
1232
+arguments:  {},
1233
 
1234
 initialize: function(url){
1235
 	this.url=unescape(url);
1236
@@ -116,7 +116,8 @@
1237
 			if(colonIndex>=0){
1238
 				this.username=credentials.substring(0,colonIndex);
1239
 				this.password=credentials.substring(colonIndex);
1240
-			}else{
1241
+			}
1242
+			else{
1243
 				this.username=credentials;
1244
 			}
1245
 			this.host=this.host.substring(atIndex+1);
1246
@@ -144,9 +145,11 @@
1247
 		}
1248
 		this.file=this.url.substring(protocolSepIndex+3);
1249
 		this.file=this.file.substring(this.file.indexOf('/'));
1250
-	}else{
1251
+	}
1252
+	else{
1253
 		this.file=this.url;
1254
 	}
1255
+	
1256
 	if(this.file.indexOf('?')>=0) this.file=this.file.substring(0, this.file.indexOf('?'));
1257
 
1258
 	var refSepIndex=url.indexOf('#');
1259
@@ -157,42 +160,51 @@
1260
 	this.path=this.file;
1261
 	if(this.query.length>0) this.file+='?'+this.query;
1262
 	if(this.reference.length>0) this.file+='#'+this.reference;
1263
-	if(this.query.length > 0)	this.getArguments();
1264
+	if(this.query.length > 0)	this.formatArguments();
1265
+	
1266
+	var sid = cookie.read('zbx_sessionid');
1267
+	this.setArgument('sid', sid.substring(16));
1268
 },
1269
 
1270
-getArguments: function(){
1271
+
1272
+formatQuery: function(){
1273
+	if(this.arguments.lenght < 1) return;
1274
+	
1275
+	var query = '';
1276
+	for(var key in this.arguments){
1277
+		if(typeof(this.arguments[key]) != 'undefined'){
1278
+			query+=key+'='+this.arguments[key]+'&';
1279
+		}
1280
+	}
1281
+	this.query = query.substring(0,query.length-1);
1282
+},
1283
+
1284
+formatArguments: function(){
1285
 	var args=this.query.split('&');
1286
 	var keyval='';
1287
-	
1288
+
1289
 	if(args.length<1) return;
1290
 	
1291
-	for(i=0;i<args.length;i++){
1292
-		keyval=args[i].split('=');
1293
-		this.arguments[i] = new Array(keyval[0],(keyval.length==1)?keyval[0]:keyval[1]);
1294
+	for(i=0; i<args.length; i++){
1295
+		keyval = args[i].split('=');
1296
+		this.arguments[keyval[0]] = (keyval.length>1)?keyval[1]:'';
1297
 	}
1298
 },
1299
 
1300
-getArgumentValue: function(key){
1301
-	if(key.length<1) return '';
1302
-	for(i=0; i < this.arguments.length; i++){
1303
-		if(this.arguments[i][0] == key) return this.arguments[i][1];
1304
-	}
1305
-	
1306
-return '';
1307
+setArgument: function(key,value){
1308
+	this.arguments[key] = value;
1309
+	this.formatQuery();
1310
 },
1311
 
1312
-getArgumentValues: function(){
1313
-	var a=new Array();
1314
-	var b=this.query.split('&');
1315
-	var c='';
1316
-	if(b.length<1) return a;
1317
-	for(i=0;i<b.length;i++){
1318
-		c=b[i].split('=');
1319
-		a[i]=new Array(c[0],((c.length==1)?c[0]:c[1]));
1320
-	}
1321
-return a;
1322
+getArgument: function(key){
1323
+	if(typeof(this.arguments[key]) != 'undefined') return this.arguments[key];
1324
+	else return null;
1325
 },
1326
 
1327
+getArguments: function(){
1328
+	return this.arguments;
1329
+},
1330
+
1331
 getUrl: function(){
1332
 	var uri = (this.protocol.length > 0)?(this.protocol+'://'):'';
1333
 	uri +=  encodeURI((this.username.length > 0)?(this.username):'');
1334
@@ -206,51 +218,30 @@
1335
 return uri;
1336
 },
1337
 
1338
-setArgument: function(key,value){
1339
-
1340
-	var valueisset = false;
1341
-	if(typeof(key) == 'undefined') throw 'Invalid argument past for setArgument';
1342
-	
1343
-	value =('undefined' != typeof(value))?value:'';
1344
-
1345
-	for(i=0; i < this.arguments.length; i++){
1346
-		if(this.arguments[i][0] == key){
1347
-			valueisset = true;
1348
-			this.arguments[i][1] = value;
1349
-		}
1350
-	}	
1351
-	if(!valueisset)	this.arguments[this.arguments.length] = new Array(key,value);
1352
-	this.formatQuery();
1353
+setPort: function(port){
1354
+	this.port = port;
1355
 },
1356
 
1357
-formatQuery: function(){
1358
-	if(this.arguments.lenght < 1) return;
1359
-	
1360
-	var query = '';
1361
-	for(i=0; i < this.arguments.length; i++){		
1362
-		query+=this.arguments[i][0]+'='+this.arguments[i][1]+'&';
1363
-	}
1364
-	this.query = query.substring(0,query.length-1);
1365
-},
1366
-
1367
 getPort: function(){ 
1368
 	return this.port;
1369
 },
1370
 
1371
-setPort: function(port){
1372
-	this.port = port;
1373
+setQuery: function(query){ 
1374
+	this.query = query;
1375
+	if(this.query.indexOf('?')>=0){
1376
+		this.query= this.query.substring(this.query.indexOf('?')+1);
1377
+	}
1378
+	
1379
+	this.formatArguments();
1380
+	
1381
+	var sid = cookie.read('zbx_sessionid');
1382
+	this.setArgument('sid', sid.substring(16));
1383
 },
1384
 
1385
 getQuery: function(){ 
1386
 	return this.query;
1387
 },
1388
 
1389
-setQuery: function(query){ 
1390
-	this.query = query;
1391
-	this.getArgumentValues();
1392
-	this.formatQuery();
1393
-},
1394
-
1395
 /* Returns the protocol of this URL, i.e. 'http' in the url 'http://server/' */
1396
 getProtocol: function(){
1397
 	return this.protocol;
1398
@@ -264,7 +255,7 @@
1399
 	return this.host;
1400
 },
1401
 
1402
-setHost: function(set){
1403
+setHost: function(host){
1404
 	this.host = host;
1405
 },
1406
 
1407
@@ -288,7 +279,7 @@
1408
 
1409
 /* Returns the file part of this url, i.e. everything after the host name. */
1410
 getFile: function(){
1411
-	return this.file = file;
1412
+	return this.file;
1413
 },
1414
 
1415
 setFile: function(file){
1416
Index: frontends/php/js/menu_scripts.js
1417
===================================================================
1418
--- frontends/php/js/menu_scripts.js	(revision 6643)
1419
+++ frontends/php/js/menu_scripts.js	(revision 6644)
1420
@@ -64,7 +64,7 @@
1421
 	for(var i=0; i < menu_usrgrp_gui.length; i++){
1422
 		if((typeof(menu_usrgrp_gui[i]) != 'undefined') && !empty(menu_usrgrp_gui[i])){
1423
 			var row = menu_usrgrp_gui[i];
1424
-			var menu_row = new Array(row.name,"users.php?config=0&form=update&grpaction=1&userid="+userid+"&usrgrpid="+row.usrgrpid);
1425
+			var menu_row = new Array(row.name,'users.php?config=0&form=update&grpaction=1&userid='+userid+'&usrgrpid='+row.usrgrpid);
1426
 			grp_gui_add_to.push(menu_row);
1427
 		}
1428
 	}
1429
@@ -73,7 +73,7 @@
1430
 	for(var i=0; i < usr_grp_gui_in.length; i++){
1431
 		if((typeof(usr_grp_all_in[i]) != 'undefined') && !empty(usr_grp_gui_in[i])){
1432
 			var row = usr_grp_gui_in[i];
1433
-			var menu_row = new Array(row.name,"users.php?config=0&form=update&grpaction=0&userid="+userid+"&usrgrpid="+row.usrgrpid);
1434
+			var menu_row = new Array(row.name,'users.php?config=0&form=update&grpaction=0&userid='+userid+'&usrgrpid='+row.usrgrpid);
1435
 			grp_gui_rmv_frm.push(menu_row);
1436
 		}
1437
 	}
1438
@@ -89,7 +89,7 @@
1439
 	for(var i=0; i < menu_usrgrp_status.length; i++){
1440
 		if((typeof(menu_usrgrp_status[i]) != 'undefined') && !empty(menu_usrgrp_status[i])){
1441
 			var row = menu_usrgrp_status[i];
1442
-			var menu_row = new Array(row.name,"users.php?config=0&form=update&grpaction=1&userid="+userid+"&usrgrpid="+row.usrgrpid);
1443
+			var menu_row = new Array(row.name,'users.php?config=0&form=update&grpaction=1&userid='+userid+'&usrgrpid='+row.usrgrpid);
1444
 			grp_status_add_to.push(menu_row);
1445
 		}
1446
 	}
1447
@@ -98,7 +98,7 @@
1448
 	for(var i=0; i < usr_grp_status_in.length; i++){
1449
 		if((typeof(usr_grp_status_in[i]) != 'undefined') && !empty(usr_grp_status_in[i])){
1450
 			var row = usr_grp_status_in[i];
1451
-			var menu_row = new Array(row.name,"users.php?config=0&form=update&grpaction=0&userid="+userid+"&usrgrpid="+row.usrgrpid);
1452
+			var menu_row = new Array(row.name,'users.php?config=0&form=update&grpaction=0&userid='+userid+'&usrgrpid='+row.usrgrpid);
1453
 			grp_status_rmv_frm.push(menu_row);
1454
 		}
1455
 	}
1456
Index: frontends/php/js/common.js
1457
===================================================================
1458
--- frontends/php/js/common.js	(revision 6643)
1459
+++ frontends/php/js/common.js	(revision 6644)
1460
@@ -82,6 +82,16 @@
1461
 	div_help.appendChild(document.createElement("br"));
1462
 }
1463
 
1464
+function SDJ(obj){
1465
+	var debug = '';
1466
+	for(var key in obj) {
1467
+		var value = obj[key];
1468
+		debug+=key+': '+value+'\n';
1469
+	}
1470
+	SDI('\n'+debug);
1471
+}
1472
+
1473
+
1474
 /// Alpha-Betic sorting
1475
 
1476
 function addListener(element, eventname, expression, bubbling){
1477
Index: frontends/php/js/ajax_req.js
1478
===================================================================
1479
--- frontends/php/js/ajax_req.js	(revision 6643)
1480
+++ frontends/php/js/ajax_req.js	(revision 6644)
1481
@@ -20,14 +20,16 @@
1482
 
1483
 function send_params(params){
1484
 	if(typeof(params) == 'undefined') var params = new Array();
1485
-	params['sessionid'] = cookie.read('zbx_sessionid');
1486
 
1487
 	var uri = new url(location.href);
1488
-	new Ajax.Request(uri.getPath()+"?output=ajax",
1489
+	uri.setQuery('?output=ajax');
1490
+
1491
+	new Ajax.Request(uri.getUrl(),
1492
 					{
1493
 						'method': 'post',
1494
 						'parameters':params,
1495
-						'onSuccess': function(resp){ },//alert(resp.responseText);
1496
+						'onSuccess': function(resp){ },
1497
+//						'onSuccess': function(resp){ alert(resp.responseText); },
1498
 						'onFailure': function(){ document.location = uri.getPath()+'?'+Object.toQueryString(params); }
1499
 					}
1500
 	);
1501
Index: frontends/php/dashboard.php
1502
===================================================================
1503
--- frontends/php/dashboard.php	(revision 6643)
1504
+++ frontends/php/dashboard.php	(revision 6644)
1505
@@ -54,7 +54,7 @@
1506
 		'action'=>		array(T_ZBX_STR, O_OPT, P_ACT, 	IN("'add','remove'"),NULL),
1507
 		'state'=>		array(T_ZBX_INT, O_OPT, P_ACT,  NOT_EMPTY,		'isset({favobj}) && ("hat"=={favobj})'),
1508
 	);
1509
-
1510
+	
1511
 	check_fields($fields);
1512
 
1513
 	$available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
1514
@@ -179,11 +179,11 @@
1515
 	$p_elements = array();
1516
 // Header	
1517
 
1518
-	$url = '?fullscreen='.($_REQUEST['fullscreen']?'0':'1');
1519
+	$url = new Curl('?fullscreen='.($_REQUEST['fullscreen']?'0':'1'));
1520
 
1521
 	$fs_icon = new CDiv(SPACE,'fullscreen');
1522
 	$fs_icon->AddOption('title',$_REQUEST['fullscreen']?S_NORMAL.' '.S_VIEW:S_FULLSCREEN);
1523
-	$fs_icon->AddAction('onclick',new CScript("javascript: document.location = '".$url."';"));
1524
+	$fs_icon->AddAction('onclick',new CScript("javascript: document.location = '".$url->getUrl()."';"));
1525
 //-------------
1526
 
1527
 	$left_tab = new CTable();
1528
Index: frontends/php/include/func.inc.php
1529
===================================================================
1530
--- frontends/php/include/func.inc.php	(revision 6643)
1531
+++ frontends/php/include/func.inc.php	(revision 6644)
1532
@@ -344,6 +344,18 @@
1533
 return $pos;
1534
 }
1535
 
1536
+function zbx_substring($haystack, $start, $end=null){
1537
+	if($end < $start) return '';
1538
+	
1539
+	$len = zbx_strlen($haystack);
1540
+	if(is_null($end))
1541
+		$result = substr($haystack, $start);
1542
+	else
1543
+		$result = substr($haystack, $start, ($end - $start));
1544
+
1545
+return $result;
1546
+}
1547
+
1548
 function uint_in_array($needle,$haystack){
1549
 	foreach($haystack as $id => $value)
1550
 		if(bccomp($needle,$value) == 0) return true;
1551
Index: frontends/php/include/screens.inc.php
1552
===================================================================
1553
--- frontends/php/include/screens.inc.php	(revision 6643)
1554
+++ frontends/php/include/screens.inc.php	(revision 6644)
1555
@@ -886,7 +886,7 @@
1556
 					$action = 'screenedit.php?form=update'.url_param('screenid').'&x='.$c.'&y='.$r.'#form';
1557
 				else
1558
 					$action = NULL;
1559
-
1560
+					
1561
 				if($editmode == 1 && isset($_REQUEST["form"]) && 
1562
 					isset($_REQUEST["x"]) && $_REQUEST["x"]==$c &&
1563
 					isset($_REQUEST["y"]) && $_REQUEST["y"]==$r)
1564
Index: frontends/php/include/perm.inc.php
1565
===================================================================
1566
--- frontends/php/include/perm.inc.php	(revision 6643)
1567
+++ frontends/php/include/perm.inc.php	(revision 6644)
1568
@@ -44,7 +44,7 @@
1569
 	$USER_DETAILS = NULL;
1570
 	$login = FALSE;
1571
 	
1572
-	$sessionid = get_request('sessionid',get_cookie('zbx_sessionid'));
1573
+	$sessionid = get_cookie('zbx_sessionid');
1574
 
1575
 	if(!is_null($sessionid)){
1576
 		$sql = 'SELECT u.*,s.* '.
1577
Index: frontends/php/include/config.inc.php
1578
===================================================================
1579
--- frontends/php/include/config.inc.php	(revision 6643)
1580
+++ frontends/php/include/config.inc.php	(revision 6644)
1581
@@ -65,6 +65,7 @@
1582
 	require_once('include/classes/cpumenu.inc.php');
1583
 	require_once('include/classes/graph.inc.php');
1584
 	require_once('include/classes/cscript.inc.php');
1585
+	require_once('include/classes/curl.inc.php');
1586
 
1587
 // Include Tactical Overview modules
1588
 
1589
Index: frontends/php/include/validate.inc.php
1590
===================================================================
1591
--- frontends/php/include/validate.inc.php	(revision 6643)
1592
+++ frontends/php/include/validate.inc.php	(revision 6644)
1593
@@ -432,8 +432,13 @@
1594
 			if(!isset($_REQUEST[$field])){
1595
 				return ZBX_VALID_OK;
1596
 			}
1597
-			else if(($flags&P_ACT) && !isset($_REQUEST['sessionid'])){
1598
-				return ZBX_VALID_ERROR;
1599
+			else if($flags&P_ACT){
1600
+				if(!isset($_REQUEST['sid'])){
1601
+					return ZBX_VALID_ERROR;
1602
+				}
1603
+				else if(isset($_COOKIE['zbx_sessionid']) && ($_REQUEST['sid'] != substr($_COOKIE['zbx_sessionid'],16,16))){
1604
+					return ZBX_VALID_ERROR;
1605
+				}
1606
 			}
1607
 		}
1608
 
1609
@@ -465,7 +470,7 @@
1610
 
1611
 //		VAR							TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
1612
 	$system_fields=array(
1613
-		'sessionid'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(), NULL),
1614
+		'sid'=>		array(T_ZBX_STR, O_OPT,	 P_SYS,	HEX(), NULL),
1615
 // 
1616
 		'switch_node'=>		array(T_ZBX_INT, O_OPT,	 P_SYS,	DB_ID,NULL),
1617
 		'triggers_hash'=>	array(T_ZBX_STR, O_OPT,	 P_SYS,	NOT_EMPTY,NULL),
1618
Index: frontends/php/include/classes/clink.inc.php
1619
===================================================================
1620
--- frontends/php/include/classes/clink.inc.php	(revision 6643)
1621
+++ frontends/php/include/classes/clink.inc.php	(revision 6644)
1622
@@ -19,12 +19,14 @@
1623
 **/
1624
 ?>
1625
 <?php
1626
-	class CLink extends CTag
1627
-	{
1628
+	class CLink extends CTag{
1629
 /* public */
1630
 		function CLink($item=NULL,$url=NULL,$class=NULL,$action=NULL){
1631
 			parent::CTag('a','yes');
1632
-
1633
+			
1634
+			$uri = new Curl($url);
1635
+			$url = $uri->getUrl();
1636
+			
1637
 			$this->tag_start= '';
1638
 			$this->tag_end = '';
1639
 			$this->tag_body_start = '';
1640
@@ -36,14 +38,14 @@
1641
 			if(!is_null($action))	$this->SetAction($action);
1642
 		}
1643
 		
1644
-		function SetAction($value=NULL){
1645
+		function setAction($value=NULL){
1646
 			if(is_null($value))
1647
 				return $this->options['action'] = $page['file'];
1648
 
1649
 			return parent::AddAction('onclick', $value);
1650
 		}
1651
 		
1652
-		function SetUrl($value){
1653
+		function setUrl($value){
1654
 			$this->AddOption('href', $value);
1655
 		}
1656
 		
1657
@@ -54,7 +56,7 @@
1658
 				return null;
1659
 		}
1660
 		
1661
-		function SetTarget($value=NULL){
1662
+		function setTarget($value=NULL){
1663
 			if(is_null($value)){
1664
 				unset($this->options['target']);
1665
 			}
1666
Index: frontends/php/include/classes/curl.inc.php
1667
===================================================================
1668
--- frontends/php/include/classes/curl.inc.php	(revision 0)
1669
+++ frontends/php/include/classes/curl.inc.php	(revision 6644)
1670
@@ -0,0 +1,273 @@
1671
+<?php
1672
+/* 
1673
+** ZABBIX
1674
+** Copyright (C) 2000-2005 SIA Zabbix
1675
+**
1676
+** $this program is free software; you can redistribute it and/or modify
1677
+** it under the terms of the GNU General Public License as published by
1678
+** the Free Software Foundation; either version 2 of the License, or
1679
+** (at your option) any later version.
1680
+**
1681
+** $this program is distributed in the hope that it will be useful,
1682
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
1683
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1684
+** GNU General Public License for more details.
1685
+**
1686
+** You should have received a copy of the GNU General Public License
1687
+** along with $this program; if not, write to the Free Software
1688
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1689
+**/
1690
+?>
1691
+<?php
1692
+// Title: url manipulation class
1693
+// Author: Aly
1694
+
1695
+class Curl{
1696
+/*
1697
+private $url = 			'';		//	actually, it's depricated/private variable 
1698
+private $port =			false;
1699
+private $host = 		'';
1700
+private $protocol = 	'';
1701
+private $username =		'';
1702
+private $password =		'';
1703
+private $filr =			'';
1704
+private $reference =	'';
1705
+private $path =			'';
1706
+private $query =		'';
1707
+private $arguments = 	array();
1708
+//*/
1709
+
1710
+function curl($url=null){
1711
+	global $USER_DETAILS;
1712
+	
1713
+	$this->url = 		'';		//	actually, it's depricated/private variable 
1714
+	$this->port =		false;
1715
+	$this->host = 		'';
1716
+	$this->protocol = 	'';
1717
+	$this->username =	'';
1718
+	$this->password =	'';
1719
+	$this->filr =		'';
1720
+	$this->reference =	'';
1721
+	$this->path =		'';
1722
+	$this->query =		'';
1723
+	$this->arguments = 	array();
1724
+
1725
+	if(empty($url)){
1726
+		$this->formatArguments();
1727
+		$this->url = $url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?'.$this->getQuery();
1728
+	}
1729
+	else{
1730
+		$this->url=urldecode($url);
1731
+
1732
+		$tmp_pos = strpos($this->url,'?');
1733
+		$this->query=($tmp_pos!==false)?(substr($this->url,$tmp_pos+1)):'';
1734
+
1735
+		$tmp_pos = strpos($this->query,'#');
1736
+		if($tmp_pos!==false) $this->query=zbx_substring($this->query,0,$tmp_pos);
1737
+
1738
+		$this->formatArguments($this->query);
1739
+	}
1740
+
1741
+	$protocolSepIndex=strpos($this->url,'://');	
1742
+	if($protocolSepIndex!==false){
1743
+		$this->protocol= strtolower(zbx_substring($this->url,0,$protocolSepIndex));
1744
+		
1745
+		$this->host=substr($this->url, $protocolSepIndex+3);
1746
+		
1747
+		$tmp_pos = strpos($this->host,'/');
1748
+		if($tmp_pos!==false) $this->host=zbx_substring($this->host,0,$tmp_pos);
1749
+		
1750
+		$atIndex=strpos($this->host,'@');
1751
+		if($atIndex!==false){
1752
+			$credentials=zbx_substring($this->host,0,$atIndex);
1753
+			
1754
+			$colonIndex=strpos(credentials,':');
1755
+			if($colonIndex!==false){
1756
+				$this->username=zbx_substring($credentials,0,$colonIndex);
1757
+				$this->password=substr($credentials,$colonIndex);
1758
+			}
1759
+			else{
1760
+				$this->username=$credentials;
1761
+			}
1762
+			$this->host=substr($this->host,$atIndex+1);
1763
+		}
1764
+		
1765
+		$host_ipv6 = strpos($this->host,']');
1766
+		if($host_ipv6!==false){
1767
+			if($host_ipv6 < (zbx_strlen($this->host)-1)){
1768
+				$host_ipv6++;
1769
+				$host_less = substr($this->host,$host_ipv6);
1770
+
1771
+				$portColonIndex=strpos($host_less,':');
1772
+				if($portColonIndex!==false){
1773
+					$this->host=zbx_substring($this->host,0,$host_ipv6);
1774
+					$this->port=substr($host_less,$portColonIndex+1);
1775
+				}
1776
+			}
1777
+		}
1778
+		else{
1779
+			$portColonIndex=strpos($this->host,':');
1780
+			if($portColonIndex!==false){
1781
+				$this->host=zbx_substring($this->host,0,$portColonIndex);
1782
+				$this->port=substr($this->host,$portColonIndex+1);
1783
+			}
1784
+		}
1785
+		
1786
+		$this->file = substr($this->url,$protocolSepIndex+3);
1787
+		$this->file = substr($this->file, strpos($this->file,'/'));
1788
+	}
1789
+	else{
1790
+		$this->file = $this->url;
1791
+	}
1792
+	
1793
+	$tmp_pos = strpos($this->file,'?');
1794
+	if($tmp_pos!==false) $this->file=zbx_substring($this->file, 0, $tmp_pos);
1795
+
1796
+	$refSepIndex=strpos($url,'#');
1797
+	if($refSepIndex!==false){
1798
+		$this->file = zbx_substring($this->file,0,$refSepIndex);
1799
+		$this->reference = substr($url,strpos($url,'#')+1);
1800
+	}
1801
+	
1802
+	$this->path=$this->file;
1803
+	if(zbx_strlen($this->query)>0) 		$this->file.='?'.$this->query;
1804
+	if(zbx_strlen($this->reference)>0)	$this->file.='#'.$this->reference;
1805
+	
1806
+	if(isset($_COOKIE['zbx_sessionid']))
1807
+		$this->setArgument('sid', substr($_COOKIE['zbx_sessionid'],16,16));
1808
+}
1809
+
1810
+function formatQuery(){
1811
+	$query = '';
1812
+	foreach($this->arguments as $key => $value){
1813
+		$query.= $key.'='.$value.'&';
1814
+	}
1815
+	$this->query = rtrim($query,'&');
1816
+}
1817
+
1818
+function formatArguments($query=null){
1819
+	if(is_null($query)){
1820
+		$this->arguments = $_REQUEST;
1821
+	}
1822
+	else{
1823
+		$query=ltrim($query,'?');
1824
+		$args = explode('&',$query);
1825
+		foreach($args as $id => $arg){
1826
+			if(empty($arg)) continue;
1827
+
1828
+			$tmp = explode('=',$arg);
1829
+			$this->arguments[$tmp[0]] = isset($tmp[1])?$tmp[1]:'';
1830
+		}
1831
+	}
1832
+	$this->formatQuery();
1833
+}
1834
+
1835
+function getUrl(){
1836
+	$url = (zbx_strlen($this->protocol) > 0)?($this->protocol.'://'):'';
1837
+	$url .=  (zbx_strlen($this->username) > 0)?$this->username:'';
1838
+	$url .=  (zbx_strlen($this->password) > 0)?':'.$this->password:'';
1839
+	$url .=  (zbx_strlen($this->host) > 0)?$this->host:'';
1840
+	$url .=  $this->port?(':'.$this->port):'';
1841
+	$url .=  (zbx_strlen($this->path) > 0)?$this->path:'';
1842
+	$url .=  (zbx_strlen($this->query) > 0)?('?'.$this->query):'';
1843
+	$url .=  (zbx_strlen($this->reference) > 0)?('#'.urlencode($this->reference)):'';
1844
+	
1845
+//SDI($this->getProtocol().' : '.$this->getHost().' : '.$this->getPort().' : '.$this->getPath().' : '.$this->getQuery());
1846
+return $url;
1847
+}
1848
+
1849
+function setPort($port){
1850
+	$this->port = $port;
1851
+}
1852
+
1853
+function getPort(){ 
1854
+	return $this->port;
1855
+}
1856
+
1857
+function setArgument($key,$value=''){
1858
+	$this->arguments[$key] = $value;
1859
+	$this->formatQuery();
1860
+}
1861
+
1862
+function getArgument($key){
1863
+	if(isset($this->arguments[$key])) return $this->arguments[$key];
1864
+	else return NULL;
1865
+}
1866
+
1867
+function setQuery($query){ 
1868
+	$this->query = $query;
1869
+	$this->formatArguments();
1870
+	$this->formatQuery();
1871
+}
1872
+
1873
+function getQuery(){ 
1874
+	return $this->query;
1875
+}
1876
+
1877
+function setProtocol($protocol){
1878
+	$this->protocol = $protocol;
1879
+}
1880
+
1881
+/* Returns the protocol of $this URL, i.e. 'http' in the url 'http://server/' */
1882
+function getProtocol(){
1883
+	return $this->protocol;
1884
+}
1885
+
1886
+function setHost($host){
1887
+	$this->host = $host;
1888
+}
1889
+
1890
+/* Returns the host name of $this URL, i.e. 'server.com' in the url 'http://server.com/' */
1891
+function getHost(){
1892
+	return $this->host;
1893
+}
1894
+
1895
+function setUserName($username){
1896
+	$this->username = $username;
1897
+}
1898
+
1899
+/* Returns the user name part of $this URL, i.e. 'joe' in the url 'http://joe@server.com/' */
1900
+function getUserName(){
1901
+	return $this->username;
1902
+}
1903
+
1904
+function setPassword($password){
1905
+	$this->password = $password;
1906
+}
1907
+
1908
+/* Returns the password part of $this url, i.e. 'secret' in the url 'http://joe:secret@server.com/' */
1909
+function getPassword(){
1910
+	return $this->password;
1911
+}
1912
+
1913
+function setFile($file){
1914
+	$this->file = $file;
1915
+}
1916
+
1917
+/* Returns the file part of $this url, i.e. everything after the host name. */
1918
+function getFile(){
1919
+	return $this->file;
1920
+}
1921
+
1922
+function setReference($reference){
1923
+	$this->reference = $reference;
1924
+}
1925
+
1926
+/* Returns the reference of $this url, i.e. 'bookmark' in the url 'http://server/file.html#bookmark' */
1927
+function getReference(){
1928
+	return $this->reference;
1929
+}
1930
+
1931
+function setPath($path){
1932
+	$this->path = $path;
1933
+}
1934
+
1935
+/* Returns the file path of $this url, i.e. '/dir/file.html' in the url 'http://server/dir/file.html' */
1936
+function getPath(){
1937
+	return $this->path;
1938
+}
1939
+
1940
+function toString(){
1941
+	return $this->getUrl();
1942
+}
1943
+}
1944
\ No newline at end of file
1945
Index: frontends/php/include/classes/cform.inc.php
1946
===================================================================
1947
--- frontends/php/include/classes/cform.inc.php	(revision 6643)
1948
+++ frontends/php/include/classes/cform.inc.php	(revision 6644)
1949
@@ -28,7 +28,7 @@
1950
 			$this->setEnctype($enctype);
1951
 			
1952
 			if(isset($_COOKIE['zbx_sessionid']))
1953
-				$this->addVar('sessionid', $_COOKIE['zbx_sessionid']);
1954
+				$this->addVar('sid', substr($_COOKIE['zbx_sessionid'],16,16));
1955
 		}
1956
 		
1957
 		function setMethod($value='post'){
1958
Index: frontends/php/include/classes/ctag.inc.php
1959
===================================================================
1960
--- frontends/php/include/classes/ctag.inc.php	(revision 6643)
1961
+++ frontends/php/include/classes/ctag.inc.php	(revision 6644)
1962
@@ -1,7 +1,7 @@
1963
 <?php
1964
 /* 
1965
 ** ZABBIX
1966
-** Copyright (C) 2000-2005 SIA Zabbix
1967
+** Copyright (C) 2000-2009 SIA Zabbix
1968
 **
1969
 ** This program is free software; you can redistribute it and/or modify
1970
 ** it under the terms of the GNU General Public License as published by
1971
@@ -19,272 +19,258 @@
1972
 **/
1973
 ?>
1974
 <?php
1975
-	function destroy_objects()
1976
-	{
1977
-		global $GLOBALS;
1978
-
1979
-		if(isset($GLOBALS)) foreach($GLOBALS as $name => $value)
1980
-		{
1981
-			if(!is_object($GLOBALS[$name])) continue;
1982
-			unset($GLOBALS[$name]);
1983
-		}
1984
+function destroy_objects(){
1985
+	if(isset($GLOBALS)) foreach($GLOBALS as $name => $value){
1986
+		if(!is_object($GLOBALS[$name])) continue;
1987
+		unset($GLOBALS[$name]);
1988
 	}
1989
-	
1990
-	function unpack_object(&$item)
1991
-	{
1992
-		$res = "";
1993
+}
1994
 
1995
-		if(is_object($item))
1996
-		{
1997
-			$res = $item->ToString(false);
1998
-		}
1999
-		elseif(is_array($item))
2000
-		{
2001
-			foreach($item as $id => $dat)	
2002
-				$res .= unpack_object($item[$id]); // Attention, recursion !!!
2003
-		}
2004
-		elseif(!is_null($item))
2005
-		{
2006
-			$res = strval($item);
2007
-			unset($item);
2008
-		}
2009
-		return $res;
2010
+function unpack_object(&$item){
2011
+	$res = '';
2012
+
2013
+	if(is_object($item)){
2014
+		$res = $item->toString(false);
2015
 	}
2016
+	else if(is_array($item)){
2017
+		foreach($item as $id => $dat)	
2018
+			$res .= unpack_object($item[$id]); // Attention, recursion !!!
2019
+	}
2020
+	else if(!is_null($item)){
2021
+		$res = strval($item);
2022
+		unset($item);
2023
+	}
2024
+return $res;
2025
+}
2026
 
2027
-	function implode_objects($glue, &$pieces)
2028
-	{
2029
-		if( !is_array($pieces) )	return unpack_object($pieces);
2030
+function implode_objects($glue, &$pieces){
2031
+	if( !is_array($pieces) )	return unpack_object($pieces);
2032
 
2033
-		foreach($pieces as $id => $piece)
2034
-			$pieces[$id] = unpack_object($piece);
2035
+	foreach($pieces as $id => $piece)
2036
+		$pieces[$id] = unpack_object($piece);
2037
 
2038
-		return implode($glue, $pieces);
2039
-	}
2040
+return implode($glue, $pieces);
2041
+}
2042
 
2043
-	class CObject
2044
-	{
2045
-		function CObject($items=null)
2046
-		{
2047
-			$this->items = array();
2048
-			if(isset($items))
2049
-			{
2050
-				$this->AddItem($items);
2051
-			}
2052
+class CObject{
2053
+	function CObject($items=null){
2054
+		$this->items = array();
2055
+		if(isset($items)){
2056
+			$this->addItem($items);
2057
 		}
2058
-		
2059
-		function ToString($destroy=true)
2060
-		{
2061
-			$res = implode('',$this->items);
2062
-			if($destroy) $this->Destroy();
2063
-			return $res;
2064
-		}
2065
+	}
2066
+	
2067
+	function toString($destroy=true){
2068
+		$res = implode('',$this->items);
2069
+		if($destroy) $this->destroy();
2070
+		return $res;
2071
+	}
2072
 
2073
-		function Show($destroy=true){
2074
-			echo $this->ToString($destroy);			
2075
-		}
2076
+	function show($destroy=true){
2077
+		echo $this->toString($destroy);			
2078
+	}
2079
 
2080
-		function Destroy()
2081
-		{
2082
+	function destroy(){
2083
 // TODO Problem under PHP 5.0  "Fatal error: Cannot re-assign $this in ..."
2084
 //			$this = null;
2085
-			$this->CleanItems();
2086
-		}
2087
+		$this->cleanItems();
2088
+	}
2089
 
2090
-		function CleanItems(){	
2091
-			$this->items = array();	
2092
+	function cleanItems(){	
2093
+		$this->items = array();	
2094
+	}
2095
+	
2096
+	function itemsCount(){	
2097
+		return count($this->items);	
2098
+	}
2099
+	
2100
+	function addItem($value){
2101
+	
2102
+		if(is_object($value)){
2103
+			array_push($this->items,unpack_object($value));
2104
 		}
2105
-		
2106
-		function ItemsCount(){	
2107
-			return count($this->items);	
2108
+		else if(is_string($value)){
2109
+			array_push($this->items,str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'),$value));
2110
+//				array_push($this->items,htmlspecialchars($value));
2111
 		}
2112
-		
2113
-		function AddItem($value){
2114
-		
2115
-			if(is_object($value)){
2116
-				array_push($this->items,unpack_object($value));
2117
+		else if(is_array($value)){
2118
+			foreach($value as $item){
2119
+				$this->addItem($item);			 // Attention, recursion !!!
2120
 			}
2121
-			else if(is_string($value)){
2122
-				array_push($this->items,str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'),$value));
2123
-//				array_push($this->items,htmlspecialchars($value));
2124
-			}
2125
-			else if(is_array($value)){
2126
-				foreach($value as $item){
2127
-					$this->AddItem($item);			 // Attention, recursion !!!
2128
-				}
2129
-			}
2130
-			else if(!is_null($value)){
2131
-				array_push($this->items,unpack_object($value));
2132
-			}
2133
 		}
2134
+		else if(!is_null($value)){
2135
+			array_push($this->items,unpack_object($value));
2136
+		}
2137
 	}
2138
+}
2139
 
2140
-	class CTag extends CObject{
2141
+class CTag extends CObject{
2142
 /* private *//*
2143
-		var $tagname;
2144
-		var $options = array();
2145
-		var $paired;*/
2146
+	var $tagname;
2147
+	var $options = array();
2148
+	var $paired;*/
2149
 /* protected *//*
2150
-		var $items = array();
2151
+	var $items = array();
2152
 
2153
-		var $tag_body_start;
2154
-		var $tag_body_end;
2155
-		var $tag_start;
2156
-		var $tag_end;*/
2157
+	var $tag_body_start;
2158
+	var $tag_body_end;
2159
+	var $tag_start;
2160
+	var $tag_end;*/
2161
 
2162
 /* public */
2163
-		function CTag($tagname=NULL, $paired='no', $body=NULL, $class=null){
2164
-			parent::CObject();
2165
+	function CTag($tagname=NULL, $paired='no', $body=NULL, $class=null){
2166
+		parent::CObject();
2167
 
2168
-			$this->options = array();
2169
+		$this->options = array();
2170
 
2171
-			if(!is_string($tagname)){
2172
-				return $this->error('Incorrect tagname for CTag ['.$tagname.']');
2173
-			}
2174
-			
2175
-			$this->tagname = $tagname;
2176
-			$this->paired = $paired;
2177
-
2178
-			$this->tag_start = $this->tag_end = $this->tag_body_start = $this->tag_body_end = '';
2179
-
2180
-			if(is_null($body)){
2181
-				$this->tag_end = $this->tag_body_start = "\n";
2182
-			}
2183
-			else{
2184
-				CTag::AddItem($body);
2185
-			}
2186
-
2187
-			$this->SetClass($class);
2188
+		if(!is_string($tagname)){
2189
+			return $this->error('Incorrect tagname for CTag ['.$tagname.']');
2190
 		}
2191
 		
2192
-		function ShowStart()	{	echo $this->StartToString();	}
2193
-		function ShowBody()	{	echo $this->BodyToString();	}
2194
-		function ShowEnd()	{	echo $this->EndToString();	}
2195
+		$this->tagname = $tagname;
2196
+		$this->paired = $paired;
2197
 
2198
-		function StartToString(){
2199
-			$res = $this->tag_start.'<'.$this->tagname;
2200
-			foreach($this->options as $key => $value){
2201
-				$res .= ' '.$key.'="'.$value.'"';
2202
-			}
2203
-			$res .= ($this->paired=='yes')?'>':' />';
2204
-		return $res;
2205
-		}
2206
+		$this->tag_start = $this->tag_end = $this->tag_body_start = $this->tag_body_end = '';
2207
 
2208
-		function BodyToString(){
2209
-			$res = $this->tag_body_start;
2210
-		return $res.parent::ToString(false);
2211
-			
2212
-			/*foreach($this->items as $item)
2213
-				$res .= $item;
2214
-			return $res;*/
2215
+		if(is_null($body)){
2216
+			$this->tag_end = $this->tag_body_start = "\n";
2217
 		}
2218
-		
2219
-		function EndToString(){
2220
-			$res = ($this->paired=='yes') ? $this->tag_body_end.'</'.$this->tagname.'>' : '';
2221
-			$res .= $this->tag_end;
2222
-		return $res;
2223
+		else{
2224
+			CTag::addItem($body);
2225
 		}
2226
-		
2227
-		function ToString($destroy=true){
2228
-			$res  = $this->StartToString();
2229
-			$res .= $this->BodyToString();
2230
-			$res .= $this->EndToString();
2231
 
2232
-			if($destroy) $this->Destroy();
2233
+		$this->setClass($class);
2234
+	}
2235
+	
2236
+	function showStart()	{	echo $this->startToString();	}
2237
+	function showBody()	{	echo $this->bodyToString();	}
2238
+	function showEnd()	{	echo $this->endToString();	}
2239
 
2240
-		return $res;
2241
+	function startToString(){
2242
+		$res = $this->tag_start.'<'.$this->tagname;
2243
+		foreach($this->options as $key => $value){
2244
+			$res .= ' '.$key.'="'.$value.'"';
2245
 		}
2246
-		
2247
-		function SetName($value){
2248
-			if(is_null($value)) return $value;
2249
+		$res .= ($this->paired=='yes')?'>':' />';
2250
+	return $res;
2251
+	}
2252
 
2253
-			if(!is_string($value)){
2254
-				return $this->error("Incorrect value for SetName [$value]");
2255
-			}
2256
-		return $this->AddOption("name",$value);
2257
-		}
2258
+	function bodyToString(){
2259
+		$res = $this->tag_body_start;
2260
+	return $res.parent::ToString(false);
2261
 		
2262
-		function GetName(){
2263
-			if(isset($this->options['name']))
2264
-				return $this->options['name'];
2265
-		return NULL;
2266
-		}
2267
-		
2268
-		function SetClass($value){
2269
-			if(isset($value))
2270
-				$this->options['class'] = $value;
2271
-			else
2272
-				unset($this->options['class']);
2273
+		/*foreach($this->items as $item)
2274
+			$res .= $item;
2275
+		return $res;*/
2276
+	}
2277
+	
2278
+	function endToString(){
2279
+		$res = ($this->paired=='yes') ? $this->tag_body_end.'</'.$this->tagname.'>' : '';
2280
+		$res .= $this->tag_end;
2281
+	return $res;
2282
+	}
2283
+	
2284
+	function toString($destroy=true){
2285
+		$res  = $this->startToString();
2286
+		$res .= $this->bodyToString();
2287
+		$res .= $this->endToString();
2288
 
2289
-		return $value;
2290
+		if($destroy) $this->Destroy();
2291
+
2292
+	return $res;
2293
+	}
2294
+	
2295
+	function setName($value){
2296
+		if(is_null($value)) return $value;
2297
+
2298
+		if(!is_string($value)){
2299
+			return $this->error("Incorrect value for setName [$value]");
2300
 		}
2301
-		
2302
-		function DelOption($name){
2303
-			unset($this->options[$name]);
2304
-		}
2305
-		
2306
-		function GetOption($name){
2307
-			$ret = NULL;
2308
-			if(isset($this->options[$name]))
2309
-				$ret =& $this->options[$name];
2310
-		return $ret;
2311
-		}
2312
+	return $this->addOption("name",$value);
2313
+	}
2314
+	
2315
+	function getName(){
2316
+		if(isset($this->options['name']))
2317
+			return $this->options['name'];
2318
+	return NULL;
2319
+	}
2320
+	
2321
+	function setClass($value){
2322
+		if(isset($value))
2323
+			$this->options['class'] = $value;
2324
+		else
2325
+			unset($this->options['class']);
2326
 
2327
-		function SetHint($text, $width='', $class=''){
2328
-			if(empty($text)) return false;
2329
+	return $value;
2330
+	}
2331
+	
2332
+	function DelOption($name){
2333
+		unset($this->options[$name]);
2334
+	}
2335
+	
2336
+	function getOption($name){
2337
+		$ret = NULL;
2338
+		if(isset($this->options[$name]))
2339
+			$ret =& $this->options[$name];
2340
+	return $ret;
2341
+	}
2342
 
2343
-			insert_showhint_javascript();
2344
+	function setHint($text, $width='', $class=''){
2345
+		if(empty($text)) return false;
2346
 
2347
-			$text = unpack_object($text);
2348
-			if($width != '' || $class != ''){
2349
-				$code = "show_hint_ext(this,event,'".$text."','".$width."','".$class."');";
2350
-			}
2351
-			else{
2352
-				$code = "show_hint(this,event,'".$text."');";
2353
-			}
2354
+		insert_showhint_javascript();
2355
 
2356
-			$this->AddAction('onMouseOver',	$code);
2357
-			$this->AddAction('onMouseMove',	'update_hint(this,event);');
2358
+		$text = unpack_object($text);
2359
+		if($width != '' || $class != ''){
2360
+			$code = "show_hint_ext(this,event,'".$text."','".$width."','".$class."');";
2361
 		}
2362
-
2363
-		function OnClick($handle_code){
2364
-			$this->AddAction('onclick', $handle_code);
2365
+		else{
2366
+			$code = "show_hint(this,event,'".$text."');";
2367
 		}
2368
 
2369
-		function AddAction($name, $value){
2370
-			if(is_object($value)){
2371
-				$this->options[$name] = unpack_object($value);
2372
-			}
2373
-			else if(!empty($value)){
2374
-				$this->options[$name] = htmlentities(str_replace(array("\r", "\n"), '', strval($value)),ENT_COMPAT,S_HTML_CHARSET);
2375
-			}
2376
+		$this->addAction('onMouseOver',	$code);
2377
+		$this->addAction('onMouseMove',	'update_hint(this,event);');
2378
+	}
2379
+
2380
+	function onClick($handle_code){
2381
+		$this->addAction('onclick', $handle_code);
2382
+	}
2383
+
2384
+	function addAction($name, $value){
2385
+		if(is_object($value)){
2386
+			$this->options[$name] = unpack_object($value);
2387
 		}
2388
+		else if(!empty($value)){
2389
+			$this->options[$name] = htmlentities(str_replace(array("\r", "\n"), '', strval($value)),ENT_COMPAT,S_HTML_CHARSET);
2390
+		}
2391
+	}
2392
 
2393
-		function AddOption($name, $value){
2394
-			if(is_object($value)){
2395
-				$this->options[$name] = unpack_object($value);
2396
-			}
2397
-			else if(isset($value))
2398
-				$this->options[$name] = htmlspecialchars(strval($value)); 
2399
-			else
2400
-				unset($this->options[$name]);
2401
+	function addOption($name, $value){
2402
+		if(is_object($value)){
2403
+			$this->options[$name] = unpack_object($value);
2404
 		}
2405
+		else if(isset($value))
2406
+			$this->options[$name] = htmlspecialchars(strval($value)); 
2407
+		else
2408
+			unset($this->options[$name]);
2409
+	}
2410
 
2411
-		function SetEnabled($value='yes'){
2412
-			if((is_string($value) && ($value == 'yes' || $value == 'enabled' || $value=='on') || $value=='1')
2413
-				|| (is_int($value) && $value<>0))
2414
-			{
2415
-				unset($this->options['disabled']);
2416
-			}
2417
-			else if((is_string($value) && ($value == 'no' || $value == 'disabled' || $value=='off') || $value=='0')
2418
-				|| (is_int($value) && $value==0))
2419
-			{
2420
-				$this->options['disabled'] = 'disabled';
2421
-			}
2422
+	function setEnabled($value='yes'){
2423
+		if((is_string($value) && ($value == 'yes' || $value == 'enabled' || $value=='on') || $value=='1')
2424
+			|| (is_int($value) && $value<>0))
2425
+		{
2426
+			unset($this->options['disabled']);
2427
 		}
2428
-		
2429
-		function error($value){
2430
-			error('class('.get_class($this).') - '.$value);
2431
-			return 1;
2432
+		else if((is_string($value) && ($value == 'no' || $value == 'disabled' || $value=='off') || $value=='0')
2433
+			|| (is_int($value) && $value==0))
2434
+		{
2435
+			$this->options['disabled'] = 'disabled';
2436
 		}
2437
 	}
2438
-?>
2439
+	
2440
+	function error($value){
2441
+		error('class('.get_class($this).') - '.$value);
2442
+		return 1;
2443
+	}
2444
+}
2445
+?>
2446
\ No newline at end of file
2447
Index: frontends/php/include/classes/cmap.inc.php
2448
===================================================================
2449
--- frontends/php/include/classes/cmap.inc.php	(revision 6643)
2450
+++ frontends/php/include/classes/cmap.inc.php	(revision 6644)
2451
@@ -19,78 +19,75 @@
2452
 **/
2453
 ?>
2454
 <?php
2455
-	class CMap extends CTag
2456
-	{
2457
+class CMap extends CTag{
2458
 /* public */
2459
-		function CMap($name="")
2460
-		{
2461
-			parent::CTag("map","yes");
2462
-			$this->SetName($name);
2463
-		}
2464
-		function AddRectArea($x1,$y1,$x2,$y2,$href,$alt)
2465
-		{ 
2466
-			return $this->AddArea(array($x1,$y1,$x2,$y2),$href,$alt,'rect'); 
2467
-		}
2468
-		function AddArea($coords,$href,$alt,$shape)
2469
-		{
2470
-			return $this->AddItem(new CArea($coords,$href,$alt,$shape));
2471
-		}
2472
-		function AddItem($value)
2473
-		{
2474
-			if(strtolower(get_class($value)) != 'carea')
2475
-				return $this->error("Incorrect value for AddItem [$value]");
2476
+	function CMap($name=''){
2477
+		parent::CTag('map','yes');
2478
+		$this->setName($name);
2479
+	}
2480
+	
2481
+	function addRectArea($x1,$y1,$x2,$y2,$href,$alt){ 
2482
+		return $this->addArea(array($x1,$y1,$x2,$y2),$href,$alt,'rect'); 
2483
+	}
2484
+	
2485
+	function addArea($coords,$href,$alt,$shape){
2486
+		return $this->addItem(new CArea($coords,$href,$alt,$shape));
2487
+	}
2488
+	
2489
+	function addItem($value){
2490
+		if(strtolower(get_class($value)) != 'carea')
2491
+			return $this->error('Incorrect value for addItem ['.$value.']');
2492
 
2493
-			return parent::AddItem($value);
2494
-		}
2495
+		return parent::addItem($value);
2496
 	}
2497
+}
2498
 
2499
-	class CArea extends CTag
2500
-	{
2501
-		function CArea($coords,$href,$alt,$shape)
2502
-		{
2503
-			parent::CTag("area","no");
2504
-			$this->SetCoords($coords);
2505
-			$this->SetShape($shape);
2506
-			$this->SetHref($href);
2507
-			$this->SetAlt($alt);
2508
-		}
2509
-		function SetCoords($value)
2510
-		{
2511
-			if(!is_array($value))
2512
-				return $this->error("Incorrect value for SetCoords [$value]");
2513
-			if(count($value)<3)
2514
-				return $this->error("Incorrect values count for SetCoords [".count($value)."]");
2515
+class CArea extends CTag{
2516
+	function CArea($coords,$href,$alt,$shape){
2517
+		parent::CTag('area','no');
2518
+		$this->setCoords($coords);
2519
+		$this->setShape($shape);
2520
+		$this->setHref($href);
2521
+		$this->setAlt($alt);
2522
+	}
2523
+	
2524
+	function setCoords($value){
2525
+		if(!is_array($value))
2526
+			return $this->error('Incorrect value for setCoords ['.$value.']');
2527
+		if(count($value)<3)
2528
+			return $this->error('Incorrect values count for setCoords ['.count($value).']');
2529
 
2530
-			$str_val = "";
2531
-			foreach($value as $val)
2532
-			{
2533
-				if(!is_numeric($val))
2534
-					return $this->error("Incorrect value for SetCoords [$val]");
2535
+		$str_val = '';
2536
+		foreach($value as $val){
2537
+			if(!is_numeric($val))
2538
+				return $this->error('Incorrect value for setCoords ['.$val.']');
2539
 
2540
-				$str_val .= $val.",";
2541
-			}
2542
-			$this->AddOption("coords",trim($str_val,','));
2543
+			$str_val .= $val.',';
2544
 		}
2545
-		function SetShape($value)
2546
-		{
2547
-			if(!is_string($value))
2548
-				return $this->error("Incorrect value for SetShape [$value]");
2549
+		$this->addOption('coords',trim($str_val,','));
2550
+	}
2551
 
2552
-			$this->AddOption("shape",$value);
2553
-		}
2554
-		function SetHref($value)
2555
-		{
2556
-			if(!is_string($value))
2557
-				return $this->error("Incorrect value for SetHref [$value]");
2558
+	function setShape($value){
2559
+		if(!is_string($value))
2560
+			return $this->error('Incorrect value for setShape ['.$value.']');
2561
 
2562
-			$this->AddOption("href",$value);
2563
-		}
2564
-		function SetAlt($value)
2565
-		{
2566
-			if(!is_string($value))
2567
-				return $this->error("Incorrect value for SetAlt [$value]");
2568
+		$this->addOption('shape',$value);
2569
+	}
2570
 
2571
-			$this->AddOption("alt",$value);
2572
-		}
2573
+	function setHref($value){
2574
+		if(!is_string($value))
2575
+			return $this->error('Incorrect value for setHref ['.$value.']');
2576
+		$url = new Curl($value);
2577
+		$value = $url->getUrl();
2578
+		
2579
+		$this->addOption('href',$value);
2580
 	}
2581
-?>
2582
+	
2583
+	function setAlt($value){
2584
+		if(!is_string($value))
2585
+			return $this->error('Incorrect value for setAlt ['.$value.']');
2586
+
2587
+		$this->addOption('alt',$value);
2588
+	}
2589
+}
2590
+?>
2591
\ No newline at end of file
2592
Index: frontends/php/include/html.inc.php
2593
===================================================================
2594
--- frontends/php/include/html.inc.php	(revision 6643)
2595
+++ frontends/php/include/html.inc.php	(revision 6644)
2596
@@ -58,7 +58,7 @@
2597
 	}
2598
 
2599
 	function prepare_url(&$var, $varname=null){
2600
-		$result = "";
2601
+		$result = '';
2602
 
2603
 		if(is_array($var)){
2604
 			foreach($var as $id => $par)
2605
Index: frontends/php/items.php
2606
===================================================================
2607
--- frontends/php/items.php	(revision 6643)
2608
+++ frontends/php/items.php	(revision 6644)
2609
@@ -944,16 +944,17 @@
2610
 //				url_param('groupid'),
2611
 				'action'));
2612
 
2613
-			$status=new CCol(new CLink(item_status2str($db_item["status"]),
2614
-					"?group_itemid%5B%5D=".$db_item["itemid"].
2615
-					"&group_task=".($db_item["status"] ? "Activate+selected" : "Disable+selected"),
2616
-					item_status2style($db_item["status"])));
2617
+			$status=new CCol(new CLink(item_status2str($db_item['status']),
2618
+//					'?sessionid='.$USER_DETAILS['sessionid'].
2619
+					'?group_itemid%5B%5D='.$db_item['itemid'].
2620
+					'&group_task='.($db_item['status']?'Activate+selected':'Disable+selected'),
2621
+					item_status2style($db_item['status'])));
2622
 	
2623
-			if($db_item["error"] == ''){
2624
-				$error=new CCol('-',"off");
2625
+			if($db_item['error'] == ''){
2626
+				$error=new CCol('-','off');
2627
 			}
2628
 			else{
2629
-				$error=new CCol($db_item["error"],"on");
2630
+				$error=new CCol($db_item['error'],'on');
2631
 			}
2632
 			
2633
 			$applications = $show_applications ? implode(', ', get_applications_by_itemid($db_item["itemid"], 'name')) : null;
(-)b/net-mgmt/zabbix/pkg-plist (-3 / +1 lines)
Lines 34-43 bin/zabbix_server Link Here
34
%%DATADIR%%/php/js/sbinit.js
34
%%DATADIR%%/php/js/sbinit.js
35
%%DATADIR%%/php/js/common.js
35
%%DATADIR%%/php/js/common.js
36
%%DATADIR%%/php/js/ajax_req.js
36
%%DATADIR%%/php/js/ajax_req.js
37
%%DATADIR%%/php/js/cookies.js
38
%%DATADIR%%/php/js/blink.js
37
%%DATADIR%%/php/js/blink.js
38
%%DATADIR%%/php/js/gpc.js
39
%%DATADIR%%/php/js/tree.js
39
%%DATADIR%%/php/js/tree.js
40
%%DATADIR%%/php/js/url.js
41
%%DATADIR%%/php/js/showhint.js
40
%%DATADIR%%/php/js/showhint.js
42
%%DATADIR%%/php/include/locales/cn_zh.inc.php
41
%%DATADIR%%/php/include/locales/cn_zh.inc.php
43
%%DATADIR%%/php/include/locales/lv_lv.inc.php
42
%%DATADIR%%/php/include/locales/lv_lv.inc.php
44
- 

Return to bug 132944