Project

General

Profile

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

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

    
61
require_once("guiconfig.inc");
62
require_once("pkg-utils.inc");
63

    
64
function domTT_title($title_msg) {
65
	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');\"";
66
}
67

    
68
$xml = $_REQUEST['xml'];
69

    
70
if ($xml == "") {
71
	$pgtitle = array(gettext("Package"), gettext("Editor"));
72
	$pglinks = array("", "@self");
73
	include("head.inc");
74
	print_info_box(gettext("No valid package defined."), 'danger', false);
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("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("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."), 'danger', false);
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)), 'danger', false);
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
			$pglinks[] = "@self";
200
		}
201
	} else {
202
		$pgtitle = array(gettext("Package"), gettext($pkg['title']));
203
		$pglinks = array("", "@self");
204
	}
205
} else {
206
	$pgtitle = array(gettext("Package"), gettext("Editor"));
207
	$pglinks = array("", "@self");
208
}
209

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

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

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

    
251
	ksort($tab_array);
252
}
253

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

    
261
?>
262

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

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

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

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

    
314
//]]>
315
</script>
316

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

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

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

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

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

    
629
</form>
630
<?php
631
echo "<!-- filter_fieldname: {$filter_fieldname} -->";
632
echo "<!-- filter_regex: {$filter_regex} -->";
633

    
634
include("foot.inc"); ?>
(101-101/230)