Project

General

Profile

Download (20 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	pkg.php
4
/*
5
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *
8
 *	Redistribution and use in source and binary forms, with or without modification,
9
 *	are permitted provided that the following conditions are met:
10
 *
11
 *	1. Redistributions of source code must retain the above copyright notice,
12
 *		this list of conditions and the following disclaimer.
13
 *
14
 *	2. Redistributions in binary form must reproduce the above copyright
15
 *		notice, this list of conditions and the following disclaimer in
16
 *		the documentation and/or other materials provided with the
17
 *		distribution.
18
 *
19
 *	3. All advertising materials mentioning features or use of this software
20
 *		must display the following acknowledgment:
21
 *		"This product includes software developed by the pfSense Project
22
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
23
 *
24
 *	4. The names "pfSense" and "pfSense Project" must not be used to
25
 *		 endorse or promote products derived from this software without
26
 *		 prior written permission. For written permission, please contact
27
 *		 coreteam@pfsense.org.
28
 *
29
 *	5. Products derived from this software may not be called "pfSense"
30
 *		nor may "pfSense" appear in their names without prior written
31
 *		permission of the Electric Sheep Fencing, LLC.
32
 *
33
 *	6. Redistributions of any form whatsoever must retain the following
34
 *		acknowledgment:
35
 *
36
 *	"This product includes software developed by the pfSense Project
37
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
38
 *
39
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
40
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
43
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
51
 *
52
 *	====================================================================
53
 *
54
 */
55

    
56
##|+PRIV
57
##|*IDENT=page-package-settings
58
##|*NAME=Package: Settings
59
##|*DESCR=Allow access to the 'Package: Settings' page.
60
##|*MATCH=pkg.php*
61
##|-PRIV
62

    
63
require_once("guiconfig.inc");
64
require_once("pkg-utils.inc");
65

    
66
function domTT_title($title_msg) {
67
	print "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '".gettext($title_msg)."', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\"";
68
}
69

    
70
$xml = $_REQUEST['xml'];
71

    
72
if ($xml == "") {
73
	include("head.inc");
74
	print_info_box(gettext("ERROR: No valid package defined."));
75
	include("foot.inc");
76
	exit;
77
} else {
78
	$pkg_xml_prefix = "/usr/local/pkg/";
79
	$pkg_full_path = "{$pkg_xml_prefix}/{$xml}";
80
	$pkg_realpath = realpath($pkg_full_path);
81
	if (empty($pkg_realpath)) {
82
		$path_error = sprintf(gettext("ERROR: Package path %s not found."), htmlspecialchars($pkg_full_path));
83
	} else if (substr_compare($pkg_realpath, $pkg_xml_prefix, 0, strlen($pkg_xml_prefix))) {
84
		$path_error = sprintf(gettext("ERROR: Invalid path %s specified."), htmlspecialchars($pkg_full_path));
85
	}
86

    
87
	if (!empty($path_error)) {
88
		include("head.inc");
89
		print_info_box($path_error . "<br />" . gettext("Try reinstalling the package."));
90
		include("foot.inc");
91
		die;
92
	}
93

    
94
	if (file_exists($pkg_full_path)) {
95
		$pkg = parse_xml_config_pkg($pkg_full_path, "packagegui");
96
	} else {
97
		include("head.inc");
98
		print_info_box(sprintf(gettext("File not found %s"), htmlspecialchars($xml)));
99
		include("foot.inc");
100
		exit;
101
	}
102
}
103

    
104
if ($pkg['donotsave'] != "") {
105
	header("Location: pkg_edit.php?xml=" . $xml);
106
	exit;
107
}
108

    
109
if ($pkg['include_file'] != "") {
110
	require_once($pkg['include_file']);
111
}
112

    
113
if ($_REQUEST['startdisplayingat']) {
114
	$startdisplayingat = $_REQUEST['startdisplayingat'];
115
}
116

    
117
if ($_REQUEST['display_maximum_rows']) {
118
	if ($_REQUEST['display_maximum_rows']) {
119
		$display_maximum_rows = $_REQUEST['display_maximum_rows'];
120
	}
121
}
122

    
123
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
124

    
125
if ($_GET['act'] == "update") {
126

    
127
	if (is_array($config['installedpackages'][$pkg['name']]) && $pkg['name'] != "" && $_REQUEST['ids'] !="") {
128
		#get current values
129
		$current_values=$config['installedpackages'][$pkg['name']]['config'];
130
		#get updated ids
131
		parse_str($_REQUEST['ids'], $update_list);
132
		#sort ids to know what to change
133
		#useful to do not lose data when using sorting and paging
134
		$sort_list=$update_list['ids'];
135
		sort($sort_list);
136
		#apply updates
137
		foreach ($update_list['ids'] as $key=> $value) {
138
			$config['installedpackages'][$pkg['name']]['config'][$sort_list[$key]]=$current_values[$update_list['ids'][$key]];
139
		}
140
		#save current config
141
		write_config();
142
		#sync package
143
		eval ("{$pkg['custom_php_resync_config_command']}");
144
	}
145
	#function called via jquery, no need to continue after save changes.
146
	exit;
147
}
148
if ($_GET['act'] == "del") {
149
	// loop through our fieldnames and automatically setup the fieldnames
150
	// in the environment.	ie: a fieldname of username with a value of
151
	// testuser would automatically eval $username = "testuser";
152
	foreach ($evaledvar as $ip) {
153
		if ($pkg['adddeleteeditpagefields']['columnitem']) {
154
			foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
155
				${xml_safe_fieldname($column['fielddescr'])} = $ip[xml_safe_fieldname($column['fieldname'])];
156
			}
157
		}
158
	}
159

    
160
	$a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
161

    
162
	if ($a_pkg[$_GET['id']]) {
163
		unset($a_pkg[$_GET['id']]);
164
		write_config();
165
		if ($pkg['custom_delete_php_command'] != "") {
166
			if ($pkg['custom_php_command_before_form'] != "") {
167
				eval($pkg['custom_php_command_before_form']);
168
			}
169
			eval($pkg['custom_delete_php_command']);
170
		}
171
		header("Location:  pkg.php?xml=" . $xml);
172
		exit;
173
	}
174
}
175

    
176
ob_start();
177

    
178
$iflist = get_configured_interface_with_descr(false, true);
179
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
180

    
181
if ($pkg['custom_php_global_functions'] != "") {
182
	eval($pkg['custom_php_global_functions']);
183
}
184

    
185
if ($pkg['custom_php_command_before_form'] != "") {
186
	eval($pkg['custom_php_command_before_form']);
187
}
188

    
189
// Breadcrumb
190
if ($pkg['title'] != "") {
191
	/*if (!$only_edit) {						// Is any package still making use of this?? Is this something that is still wanted, considering the breadcrumb policy https://redmine.pfsense.org/issues/5527
192
 		$pkg['title'] = $pkg['title'] . '/Edit';		// If this needs to live on, then it has to be moved to run AFTER "foreach ($pkg['tabs']['tab'] as $tab)"-loop. This due to $pgtitle[] = $tab['text']; 
193
	}*/
194
	if (strpos($pkg['title'], '/')) {
195
		$title = explode('/', $pkg['title']);
196

    
197
		foreach ($title as $subtitle) {
198
			$pgtitle[] = gettext($subtitle);
199
		}
200
	} else {
201
		$pgtitle = array(gettext("Package"), gettext($pkg['title']));
202
	}
203
} else {
204
	$pgtitle = array(gettext("Package"), gettext("Editor"));
205
}
206

    
207
if ($pkg['tabs'] != "") {
208
	$tab_array = array();
209
	foreach ($pkg['tabs']['tab'] as $tab) {
210
		if ($tab['tab_level']) {
211
			$tab_level = $tab['tab_level'];
212
		} else {
213
			$tab_level = 1;
214
		}
215
		if (isset($tab['active'])) {
216
			$active = true;
217
			$pgtitle[] = $tab['text'];
218
		} else {
219
			$active = false;
220
		}
221
		if (isset($tab['no_drop_down'])) {
222
			$no_drop_down = true;
223
		}
224
		$urltmp = "";
225
		if ($tab['url'] != "") {
226
			$urltmp = $tab['url'];
227
		}
228
		if ($tab['xml'] != "") {
229
			$urltmp = "pkg_edit.php?xml=" . $tab['xml'];
230
		}
231

    
232
		$addresswithport = getenv("HTTP_HOST");
233
		$colonpos = strpos($addresswithport, ":");
234
		if ($colonpos !== False) {
235
			//my url is actually just the IP address of the pfsense box
236
			$myurl = substr($addresswithport, 0, $colonpos);
237
		} else {
238
			$myurl = $addresswithport;
239
		}
240
		// eval url so that above $myurl item can be processed if need be.
241
		$url = str_replace('$myurl', $myurl, $urltmp);
242

    
243
		$tab_array[$tab_level][] = array(
244
			$tab['text'],
245
			$active,
246
			$url
247
		);
248
	}
249

    
250
	ksort($tab_array);
251
}
252

    
253
include("head.inc");
254
if (isset($tab_array)) {
255
	foreach ($tab_array as $tabid => $tab) {
256
		display_top_tabs($tab); //, $no_drop_down, $tabid);
257
	}
258
}
259

    
260
?>
261

    
262
<script type="text/javascript">
263
//<![CDATA[
264
events.push(function() {
265

    
266
	function setFilter(filtertext) {
267
		$('#pkg_filter').val(filtertext);
268
		document.pkgform.submit();
269
	}
270

    
271
<?php
272
	if ($pkg['adddeleteeditpagefields']['movable']) {
273
?>
274
		$('#mainarea table tbody').sortable({
275
		items: 'tr.sortable',
276
			cursor: 'move',
277
			distance: 10,
278
			opacity: 0.8,
279
			helper: function(e, ui) {
280
				ui.children().each(function() {
281
					$(this).width($(this).width());
282
				});
283
			return ui;
284
			},
285
		});
286
<?php
287
	}
288
?>
289
});
290

    
291
function save_changes_to_xml(xml) {
292
	var ids = $('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
293
	var strloading="<?=gettext('Saving changes...')?>";
294
	if (confirm("<?=gettext("Do you really want to save changes?")?>")) {
295
		$.ajax({
296
			type: 'get',
297
			cache: false,
298
			url: "<?=$_SERVER['SCRIPT_NAME']?>",
299
			data: {xml:'<?=$xml?>', act:'update', ids: ids},
300
			beforeSend: function() {
301
				$('#savemsg').empty().html(strloading);
302
			},
303
			error: function(data) {
304
				$('#savemsg').empty().html('Error:' + data);
305
			},
306
			success: function(data) {
307
				$('#savemsg').empty().html(data);
308
			}
309
		});
310
	}
311
}
312

    
313
//]]>
314
</script>
315

    
316
<?php
317
if ($_GET['savemsg'] != "") {
318
	$savemsg = htmlspecialchars($_GET['savemsg']);
319
}
320

    
321
if ($savemsg) {
322
	print_info_box($savemsg, 'success');
323
}
324
?>
325

    
326
<form action="pkg.php" name="pkgform" method="get">
327
	<input type='hidden' name='xml' value='<?=$_REQUEST['xml']?>' />
328
		<div id="mainarea" class="panel panel-default">
329
			<table id="mainarea" class="table table-striped table-hover table-condensed">
330
				<thead>
331
<?php
332
	/* Handle filtering bar A-Z */
333
	$include_filtering_inputbox = false;
334
	$colspan = 0;
335
	if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
336
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
337
			$colspan++;
338
		}
339
	}
340
	if ($pkg['fields']['field']) {
341
		// First find the sorting type field if it exists
342
		foreach ($pkg['fields']['field'] as $field) {
343
			if ($field['type'] == "sorting") {
344
				if (isset($field['include_filtering_inputbox'])) {
345
					$include_filtering_inputbox = true;
346
				}
347
				if ($display_maximum_rows < 1) {
348
					if ($field['display_maximum_rows']) {
349
						$display_maximum_rows = $field['display_maximum_rows'];
350
					}
351
				}
352
				echo "<tr><td colspan='$colspan' class='text-center'>";
353
				echo gettext("Filter by: ");
354
				$isfirst = true;
355
				for ($char = 65; $char < 91; $char++) {
356
					if (!$isfirst) {
357
						echo " | ";
358
					}
359
					echo "<a href=\"#\" onclick=\"setFilter('" . chr($char) . "');\">" . chr($char) . "</a>";
360
					$isfirst = false;
361
				}
362
				echo "</td></tr>";
363
				echo "<tr><td colspan='$colspan' class='text-center'>";
364
				if ($field['sortablefields']) {
365
					echo gettext("Filter field: ") . "<select name='pkg_filter_type'>";
366
					foreach ($field['sortablefields']['item'] as $si) {
367
						if ($si['name'] == $_REQUEST['pkg_filter_type']) {
368
							$SELECTED = "selected";
369
						} else {
370
							$SELECTED = "";
371
						}
372
						echo "<option value='{$si['name']}' {$SELECTED}>{$si['name']}</option>";
373
					}
374
					echo "</select>";
375
				}
376
				if ($include_filtering_inputbox) {
377
					echo "&nbsp;&nbsp;" . gettext("Filter text: ") . "<input id='pkg_filter' name='pkg_filter' value='" . $_REQUEST['pkg_filter'] . "' /><input type='submit' value='Filter' />";
378
				}
379
				echo "</td></tr><tr><td><font size='-3'>&nbsp;</font></td></tr>";
380
			}
381
		}
382
	}
383
?>
384
				<tr>
385

    
386
<?php
387
	if ($display_maximum_rows) {
388
		$totalpages = ceil(round((count($evaledvar) / $display_maximum_rows), 9));
389
		$page = 1;
390
		$tmpcount = 0;
391
		$tmppp = 0;
392
		if (is_array($evaledvar)) {
393
			foreach ($evaledvar as $ipa) {
394
				if ($tmpcount == $display_maximum_rows) {
395
					$page++;
396
					$tmpcount = 0;
397
				}
398
				if ($tmppp == $startdisplayingat) {
399
					break;
400
				}
401
				$tmpcount++;
402
				$tmppp++;
403
			}
404
		}
405
		echo "<tr><th colspan='" . count($pkg['adddeleteeditpagefields']['columnitem']) . "'>";
406
		echo "<table width='100%' summary=''>";
407
		echo "<tr>";
408
		echo "<td class='text-left'>" . sprintf(gettext('Displaying page %1$s of %2$s'), $page, $totalpages) . "</b></td>";
409
		echo "<td class='text-right'>" . gettext("Rows per page: ") . "<select onchange='document.pkgform.submit();' name='display_maximum_rows'>";
410
		for ($x = 0; $x < 250; $x++) {
411
			if ($x == $display_maximum_rows) {
412
				$SELECTED = "selected";
413
			} else {
414
				$SELECTED = "";
415
			}
416
			echo "<option value='$x' $SELECTED>$x</option>\n";
417
			$x = $x + 4;
418
		}
419
		echo "</select></td></tr>";
420
		echo "</table>";
421
		echo "</th></tr>";
422
	}
423

    
424
	$cols = 0;
425
	if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
426
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
427
			echo "<th class=\"listhdrr\">" . $column['fielddescr'] . "</th>";
428
			$cols++;
429
		}
430
	}
431
?>
432
				</tr>
433
				</thead>
434
				<tbody>
435
<?php
436
	$i = 0;
437
	$pagination_counter = 0;
438
	if ($evaledvar) {
439
		foreach ($evaledvar as $ip) {
440
			if ($startdisplayingat) {
441
				if ($i < $startdisplayingat) {
442
					$i++;
443
					continue;
444
				}
445
			}
446
			if ($_REQUEST['pkg_filter']) {
447
				// Handle filtered items
448
				if ($pkg['fields']['field'] && !$filter_regex) {
449
					// First find the sorting type field if it exists
450
					foreach ($pkg['fields']['field'] as $field) {
451
						if ($field['type'] == "sorting") {
452
							if ($field['sortablefields']['item']) {
453
								foreach ($field['sortablefields']['item'] as $sf) {
454
									if ($sf['name'] == $_REQUEST['pkg_filter_type']) {
455
										$filter_fieldname = $sf['fieldname'];
456
										#Use a default regex on sortable fields when none is declared
457
										if ($sf['regex']) {
458
											$filter_regex = str_replace("%FILTERTEXT%", $_REQUEST['pkg_filter'], trim($sf['regex']));
459
										} else {
460
											$filter_regex = "/{$_REQUEST['pkg_filter']}/i";
461
										}
462
									}
463
								}
464
							}
465
						}
466
					}
467
				}
468
				// Do we have something to filter on?
469
				unset($filter_matches);
470
				if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
471
					foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
472
						$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
473
						if ($column['fieldname'] == $filter_fieldname) {
474
							if ($filter_regex) {
475
								//echo "$filter_regex - $fieldname<p/>";
476
								preg_match($filter_regex, $fieldname, $filter_matches);
477
								break;
478
							}
479
						}
480
					}
481
				}
482
				if (!$filter_matches) {
483
					$i++;
484
					continue;
485
				}
486
			}
487
			if ($pkg['adddeleteeditpagefields']['movable']) {
488
				echo "<tr valign=\"top\" class=\"sortable\" id=\"id_{$i}\">\n";
489
			} else {
490
				echo "<tr valign=\"top\">\n";
491
			}
492
			if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
493
				foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
494
					if ($column['fieldname'] == "description") {
495
						$class = "listbg";
496
					} else {
497
						$class = "listlr";
498
					}
499
?>
500
					<td class="<?=$class?>" ondblclick="document.location='pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i?>';">
501
<?php
502
					$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
503
					#Check if columnitem has a type field declared
504
					if ($column['type'] == "checkbox") {
505
						if ($fieldname == "") {
506
							echo gettext("No");
507
						} else {
508
							echo gettext("Yes");
509
						}
510
					} else if ($column['type'] == "interface") {
511
						echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
512
					} else {
513
						#Check if columnitem has an encoding field declared
514
						if ($column['encoding'] == "base64") {
515
							echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
516
						#Check if there is a custom info to show when $fieldname is not empty
517
						} else if ($column['listmodeon'] && $fieldname != "") {
518
							echo $column['prefix'] . gettext($column['listmodeon']). $column['suffix'];
519
						#Check if there is a custom info to show when $fieldname is empty
520
						} else if ($column['listmodeoff'] && $fieldname == "") {
521
							echo $column['prefix'] .gettext($column['listmodeoff']). $column['suffix'];
522
						} else {
523
							echo $column['prefix'] . $fieldname ." ". $column['suffix'];
524
						}
525
					}
526
?>
527
					</td>
528
<?php
529
				} // foreach columnitem
530
			} // if columnitem
531
?>
532
					<td valign="middle" class="list text-nowrap">
533
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
534
							<tr>
535
<?php
536
			#Show custom description to edit button if defined
537
			$edit_msg=($pkg['adddeleteeditpagefields']['edittext']?$pkg['adddeleteeditpagefields']['edittext']:gettext("Edit this item"));
538
?>
539
								<td><a class="fa fa-pencil" href="pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i?>" title="<?=$edit_msg?>"></a></td>
540
<?php
541
			#Show custom description to delete button if defined
542
			$delete_msg=($pkg['adddeleteeditpagefields']['deletetext']?$pkg['adddeleteeditpagefields']['deletetext']:gettext("Delete this item"));
543
?>
544
								<td>&nbsp;<a class="fa fa-trash" href="pkg.php?xml=<?=$xml?>&amp;act=del&amp;id=<?=$i?>" title="<?=$delete_msg?>"></a></td>
545
							</tr>
546
						</tbody>
547
					</table>
548
				</td>
549
<?php
550
			echo "</tr>\n"; // Pairs with an echo tr some way above
551
			// Handle pagination and display_maximum_rows
552
			if ($display_maximum_rows) {
553
				if ($pagination_counter == ($display_maximum_rows-1) or
554
					$i == (count($evaledvar)-1)) {
555
					$colcount = count($pkg['adddeleteeditpagefields']['columnitem']);
556
					$final_footer = "";
557
					$final_footer .= "<tr><td colspan='$colcount'>";
558
					$final_footer .= "<table width='100%' summary=''><tr>";
559
					$final_footer .= "<td class='text-left'>";
560
					$startingat = $startdisplayingat - $display_maximum_rows;
561
					if ($startingat > -1) {
562
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat={$startingat}&amp;display_maximum_rows={$display_maximum_rows}'>";
563
					} else if ($startdisplayingat > 1) {
564
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=0&amp;display_maximum_rows={$display_maximum_rows}'>";
565
					}
566
					$final_footer .= "<font size='2'><< " . gettext("Previous page") . "</font></a>";
567
					if ($tmppp + $display_maximum_rows > count($evaledvar)) {
568
						$endingrecord = count($evaledvar);
569
					} else {
570
						$endingrecord = $tmppp + $display_maximum_rows;
571
					}
572
					$final_footer .= "</td><td class='text-center'>";
573
					$tmppp++;
574
					$final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
575
					$final_footer .= "</font></td><td class='text-right'>&nbsp;";
576
					if (($i+1) < count($evaledvar)) {
577
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&amp;display_maximum_rows={$display_maximum_rows}'>";
578
					}
579
					$final_footer .= "<font size='2'>" . gettext("Next page") . " >></font></a>";
580
					$final_footer .= "</td></tr></table></td></tr>";
581
					$i = count($evaledvar);
582
					break;
583
				}
584
			}
585
			$i++;
586
			$pagination_counter++;
587
		} // foreach evaledvar
588
	} // if evaledvar
589
?>
590
				<tr>
591
					<td colspan="<?=$cols?>"></td>
592
					<td>
593
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
594
							<tr>
595
<?php
596
	#Show custom description to add button if defined
597
	$add_msg=($pkg['adddeleteeditpagefields']['addtext']?$pkg['adddeleteeditpagefields']['addtext']:gettext("Add a new item"));
598
?>
599
								<td><a href="pkg_edit.php?xml=<?=$xml?>&amp;id=<?=$i?>" class="btn btn-sm btn-success" title="<?=$add_msg?>"><?=gettext('Add')?></a></td>
600
<?php
601
	#Show description button and info if defined
602
	if ($pkg['adddeleteeditpagefields']['description']) {
603
?>
604
								<td>
605
									<i class="fa fa-info-circle"><?=$pkg['adddeleteeditpagefields']['description']?></i>
606
								</td>
607
<?php
608
	}
609
?>
610
							</tr>
611
						</table>
612
					</td>
613
				</tr>
614
				<?=$final_footer?>
615
			</table>
616
			</div>
617
		<input class="btn btn-primary" type="button" value="Save" name="Submit" onclick="save_changes_to_xml('<?=$xml?>')" />
618

    
619
</form>
620
<?php
621
echo "<!-- filter_fieldname: {$filter_fieldname} -->";
622
echo "<!-- filter_regex: {$filter_regex} -->";
623

    
624
include("foot.inc"); ?>
(100-100/229)