1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
pkg.php
|
5
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
6
|
Copyright (C) 2004-2012 Scott Ullrich <sullrich@gmail.com>
|
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 the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
/*
|
31
|
pfSense_MODULE: pkgs
|
32
|
*/
|
33
|
|
34
|
##|+PRIV
|
35
|
##|*IDENT=page-package-settings
|
36
|
##|*NAME=Package: Settings page
|
37
|
##|*DESCR=Allow access to the 'Package: Settings' page.
|
38
|
##|*MATCH=pkg.php*
|
39
|
##|-PRIV
|
40
|
|
41
|
require_once("guiconfig.inc");
|
42
|
require_once("pkg-utils.inc");
|
43
|
|
44
|
function domTT_title($title_msg){
|
45
|
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');\"";
|
46
|
}
|
47
|
|
48
|
$xml = $_REQUEST['xml'];
|
49
|
|
50
|
if($xml == "") {
|
51
|
print_info_box_np(gettext("ERROR: No package defined."));
|
52
|
exit;
|
53
|
} else {
|
54
|
$pkg_xml_prefix = "/usr/local/pkg/";
|
55
|
$pkg_full_path = "{$pkg_xml_prefix}/{$xml}";
|
56
|
$pkg_realpath = realpath($pkg_full_path);
|
57
|
if (empty($pkg_realpath)) {
|
58
|
$path_error = sprintf(gettext("ERROR: Package path %s not found."), htmlspecialchars($pkg_full_path));
|
59
|
} else if (substr_compare($pkg_realpath, $pkg_xml_prefix, 0, strlen($pkg_xml_prefix))) {
|
60
|
$path_error = sprintf(gettext("ERROR: Invalid path %s specified."), htmlspecialchars($pkg_full_path));
|
61
|
}
|
62
|
|
63
|
if (!empty($path_error)) {
|
64
|
print_info_box_np($path_error . "<br />" . gettext("Try reinstalling the package.") . "<br />" . gettext("Use the back button on your browser to return to the previous page."));
|
65
|
die;
|
66
|
}
|
67
|
|
68
|
if(file_exists($pkg_full_path))
|
69
|
$pkg = parse_xml_config_pkg($pkg_full_path, "packagegui");
|
70
|
else {
|
71
|
echo "File not found " . htmlspecialchars($xml);
|
72
|
exit;
|
73
|
}
|
74
|
}
|
75
|
|
76
|
if($pkg['donotsave'] <> "") {
|
77
|
header("Location: pkg_edit.php?xml=" . $xml);
|
78
|
exit;
|
79
|
}
|
80
|
|
81
|
if ($pkg['include_file'] != "") {
|
82
|
require_once($pkg['include_file']);
|
83
|
}
|
84
|
|
85
|
$package_name = $pkg['menu'][0]['name'];
|
86
|
$section = $pkg['menu'][0]['section'];
|
87
|
$config_path = $pkg['configpath'];
|
88
|
$title = $pkg['title'];
|
89
|
|
90
|
if($_REQUEST['startdisplayingat'])
|
91
|
$startdisplayingat = $_REQUEST['startdisplayingat'];
|
92
|
|
93
|
if($_REQUEST['display_maximum_rows'])
|
94
|
if($_REQUEST['display_maximum_rows'])
|
95
|
$display_maximum_rows = $_REQUEST['display_maximum_rows'];
|
96
|
|
97
|
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
|
98
|
|
99
|
if ($_GET['act'] == "update") {
|
100
|
|
101
|
if(is_array($config['installedpackages'][$pkg['name']]) && $pkg['name'] != "" && $_REQUEST['ids'] !=""){
|
102
|
#get current values
|
103
|
$current_values=$config['installedpackages'][$pkg['name']]['config'];
|
104
|
#get updated ids
|
105
|
parse_str($_REQUEST['ids'], $update_list);
|
106
|
#sort ids to know what to change
|
107
|
#usefull to do not loose data when using sorting and paging
|
108
|
$sort_list=$update_list['ids'];
|
109
|
sort($sort_list);
|
110
|
#apply updates
|
111
|
foreach($update_list['ids'] as $key=> $value){
|
112
|
$config['installedpackages'][$pkg['name']]['config'][$sort_list[$key]]=$current_values[$update_list['ids'][$key]];
|
113
|
}
|
114
|
#save current config
|
115
|
write_config();
|
116
|
#sync package
|
117
|
eval ("{$pkg['custom_php_resync_config_command']}");
|
118
|
}
|
119
|
#function called via jquery, no need to continue after save changes.
|
120
|
exit;
|
121
|
}
|
122
|
if ($_GET['act'] == "del") {
|
123
|
// loop through our fieldnames and automatically setup the fieldnames
|
124
|
// in the environment. ie: a fieldname of username with a value of
|
125
|
// testuser would automatically eval $username = "testuser";
|
126
|
foreach ($evaledvar as $ip) {
|
127
|
if($pkg['adddeleteeditpagefields']['columnitem'])
|
128
|
foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
|
129
|
${xml_safe_fieldname($column['fielddescr'])} = $ip[xml_safe_fieldname($column['fieldname'])];
|
130
|
}
|
131
|
}
|
132
|
|
133
|
$a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
|
134
|
|
135
|
if ($a_pkg[$_GET['id']]) {
|
136
|
unset($a_pkg[$_GET['id']]);
|
137
|
write_config();
|
138
|
if($pkg['custom_delete_php_command'] <> "") {
|
139
|
if($pkg['custom_php_command_before_form'] <> "")
|
140
|
eval($pkg['custom_php_command_before_form']);
|
141
|
eval($pkg['custom_delete_php_command']);
|
142
|
}
|
143
|
header("Location: pkg.php?xml=" . $xml);
|
144
|
exit;
|
145
|
}
|
146
|
}
|
147
|
|
148
|
ob_start();
|
149
|
|
150
|
$iflist = get_configured_interface_with_descr(false, true);
|
151
|
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
|
152
|
|
153
|
if($pkg['custom_php_global_functions'] <> "")
|
154
|
eval($pkg['custom_php_global_functions']);
|
155
|
|
156
|
if($pkg['custom_php_command_before_form'] <> "")
|
157
|
eval($pkg['custom_php_command_before_form']);
|
158
|
|
159
|
$pgtitle = array($title);
|
160
|
include("head.inc");
|
161
|
|
162
|
?>
|
163
|
|
164
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
165
|
<?php include("fbegin.inc"); ?>
|
166
|
<script type="text/javascript" src="javascript/domTT/domLib.js"></script>
|
167
|
<script type="text/javascript" src="javascript/domTT/domTT.js"></script>
|
168
|
<script type="text/javascript" src="javascript/domTT/behaviour.js"></script>
|
169
|
<script type="text/javascript" src="javascript/domTT/fadomatic.js"></script>
|
170
|
<script type="text/javascript">
|
171
|
//<![CDATA[
|
172
|
function setFilter(filtertext) {
|
173
|
jQuery('#pkg_filter').val(filtertext);
|
174
|
document.pkgform.submit();
|
175
|
}
|
176
|
|
177
|
<?php
|
178
|
if($pkg['adddeleteeditpagefields']['movable']){
|
179
|
?>
|
180
|
jQuery(document).ready(function(){
|
181
|
jQuery('#mainarea table tbody').sortable({
|
182
|
items: 'tr.sortable',
|
183
|
cursor: 'move',
|
184
|
distance: 10,
|
185
|
opacity: 0.8,
|
186
|
helper: function(e,ui){
|
187
|
ui.children().each(function(){
|
188
|
jQuery(this).width(jQuery(this).width());
|
189
|
});
|
190
|
return ui;
|
191
|
},
|
192
|
});
|
193
|
});
|
194
|
function save_changes_to_xml(xml) {
|
195
|
var ids=jQuery('#mainarea table tbody').sortable('serialize',{key:"ids[]"});
|
196
|
var strloading="<img src='/themes/<?= $g['theme']; ?>/images/misc/loader.gif' alt='loader' /> " + "<?=gettext('Saving changes...');?>";
|
197
|
if(confirm("<?=gettext("Do you really want to save changes?");?>")){
|
198
|
jQuery.ajax({
|
199
|
type: 'get',
|
200
|
cache: false,
|
201
|
url: "<?=$_SERVER['SCRIPT_NAME'];?>",
|
202
|
data: {xml:'<?=$xml?>', act:'update', ids: ids},
|
203
|
beforeSend: function(){
|
204
|
jQuery('#savemsg').empty().html(strloading);
|
205
|
},
|
206
|
error: function(data){
|
207
|
jQuery('#savemsg').empty().html('Error:' + data);
|
208
|
},
|
209
|
success: function(data){
|
210
|
jQuery('#savemsg').empty().html(data);
|
211
|
}
|
212
|
});
|
213
|
}
|
214
|
}
|
215
|
<?php
|
216
|
}
|
217
|
?>
|
218
|
//]]>
|
219
|
</script>
|
220
|
<form action="pkg.php" name="pkgform" method="get">
|
221
|
<input type='hidden' name='xml' value='<?=$_REQUEST['xml']?>' />
|
222
|
<?php if($_GET['savemsg'] <> "") $savemsg = htmlspecialchars($_GET['savemsg']); ?>
|
223
|
<div id="savemsg"></div>
|
224
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
225
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="package settings">
|
226
|
<?php
|
227
|
if ($pkg['tabs'] <> "") {
|
228
|
$tab_array = array();
|
229
|
foreach($pkg['tabs']['tab'] as $tab) {
|
230
|
if($tab['tab_level'])
|
231
|
$tab_level = $tab['tab_level'];
|
232
|
else
|
233
|
$tab_level = 1;
|
234
|
if(isset($tab['active'])) {
|
235
|
$active = true;
|
236
|
} else {
|
237
|
$active = false;
|
238
|
}
|
239
|
if(isset($tab['no_drop_down']))
|
240
|
$no_drop_down = true;
|
241
|
$urltmp = "";
|
242
|
if($tab['url'] <> "") $urltmp = $tab['url'];
|
243
|
if($tab['xml'] <> "") $urltmp = "pkg_edit.php?xml=" . $tab['xml'];
|
244
|
|
245
|
$addresswithport = getenv("HTTP_HOST");
|
246
|
$colonpos = strpos($addresswithport, ":");
|
247
|
if ($colonpos !== False) {
|
248
|
//my url is actually just the IP address of the pfsense box
|
249
|
$myurl = substr($addresswithport, 0, $colonpos);
|
250
|
} else {
|
251
|
$myurl = $addresswithport;
|
252
|
}
|
253
|
// eval url so that above $myurl item can be processed if need be.
|
254
|
$url = str_replace('$myurl', $myurl, $urltmp);
|
255
|
|
256
|
$tab_array[$tab_level][] = array(
|
257
|
$tab['text'],
|
258
|
$active,
|
259
|
$url
|
260
|
);
|
261
|
}
|
262
|
|
263
|
ksort($tab_array);
|
264
|
foreach($tab_array as $tab) {
|
265
|
echo '<tr><td>';
|
266
|
display_top_tabs($tab, $no_drop_down);
|
267
|
echo '</td></tr>';
|
268
|
}
|
269
|
}
|
270
|
?>
|
271
|
<tr><td><div id="mainarea"><table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
|
272
|
<tr>
|
273
|
<td class="tabcont">
|
274
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabs">
|
275
|
<?php
|
276
|
/* Handle filtering bar A-Z */
|
277
|
$include_filtering_inputbox = false;
|
278
|
$colspan = 0;
|
279
|
if($pkg['adddeleteeditpagefields']['columnitem'] <> "")
|
280
|
foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column)
|
281
|
$colspan++;
|
282
|
if($pkg['fields']['field']) {
|
283
|
// First find the sorting type field if it exists
|
284
|
foreach($pkg['fields']['field'] as $field) {
|
285
|
if($field['type'] == "sorting") {
|
286
|
if(isset($field['include_filtering_inputbox']))
|
287
|
$include_filtering_inputbox = true;
|
288
|
if($display_maximum_rows < 1)
|
289
|
if($field['display_maximum_rows'])
|
290
|
$display_maximum_rows = $field['display_maximum_rows'];
|
291
|
echo "<tr><td class='listhdrr' colspan='$colspan' align='center'>";
|
292
|
echo "Filter by: ";
|
293
|
$isfirst = true;
|
294
|
for($char = 65; $char < 91; $char++) {
|
295
|
if(!$isfirst)
|
296
|
echo " | ";
|
297
|
echo "<a href=\"#\" onclick=\"setFilter('" . chr($char) . "');\">" . chr($char) . "</a>";
|
298
|
$isfirst = false;
|
299
|
}
|
300
|
echo "</td></tr>";
|
301
|
echo "<tr><td class='listhdrr' colspan='$colspan' align='center'>";
|
302
|
if($field['sortablefields']) {
|
303
|
echo "Filter field: <select name='pkg_filter_type'>";
|
304
|
foreach($field['sortablefields']['item'] as $si) {
|
305
|
if($si['name'] == $_REQUEST['pkg_filter_type'])
|
306
|
$SELECTED = "selected=\"selected\"";
|
307
|
else
|
308
|
$SELECTED = "";
|
309
|
echo "<option value='{$si['name']}' {$SELECTED}>{$si['name']}</option>";
|
310
|
}
|
311
|
echo "</select>";
|
312
|
}
|
313
|
if($include_filtering_inputbox)
|
314
|
echo " Filter text: <input id='pkg_filter' name='pkg_filter' value='" . $_REQUEST['pkg_filter'] . "' /> <input type='submit' value='Filter' />";
|
315
|
echo "</td></tr><tr><td><font size='-3'> </font></td></tr>";
|
316
|
}
|
317
|
}
|
318
|
}
|
319
|
?>
|
320
|
<tr>
|
321
|
<?php
|
322
|
if($display_maximum_rows) {
|
323
|
$totalpages = ceil(round((count($evaledvar) / $display_maximum_rows),9));
|
324
|
$page = 1;
|
325
|
$tmpcount = 0;
|
326
|
$tmppp = 0;
|
327
|
if(is_array($evaledvar)) {
|
328
|
foreach ($evaledvar as $ipa) {
|
329
|
if($tmpcount == $display_maximum_rows) {
|
330
|
$page++;
|
331
|
$tmpcount = 0;
|
332
|
}
|
333
|
if($tmppp == $startdisplayingat)
|
334
|
break;
|
335
|
$tmpcount++;
|
336
|
$tmppp++;
|
337
|
}
|
338
|
}
|
339
|
echo "<tr><td colspan='" . count($pkg['adddeleteeditpagefields']['columnitem']) . "'>";
|
340
|
echo "<table width='100%' summary=''>";
|
341
|
echo "<tr>";
|
342
|
echo "<td align='left'>Displaying page $page of $totalpages</b></td>";
|
343
|
echo "<td align='right'>Rows per page: <select onchange='document.pkgform.submit();' name='display_maximum_rows'>";
|
344
|
for($x=0; $x<250; $x++) {
|
345
|
if($x == $display_maximum_rows)
|
346
|
$SELECTED = "selected=\"selected\"";
|
347
|
else
|
348
|
$SELECTED = "";
|
349
|
echo "<option value='$x' $SELECTED>$x</option>\n";
|
350
|
$x=$x+4;
|
351
|
}
|
352
|
echo "</select></td></tr>";
|
353
|
echo "</table>";
|
354
|
echo "</td></tr>";
|
355
|
}
|
356
|
$cols = 0;
|
357
|
if($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
|
358
|
foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
|
359
|
echo "<td class=\"listhdrr\">" . $column['fielddescr'] . "</td>";
|
360
|
$cols++;
|
361
|
}
|
362
|
}
|
363
|
echo "</tr>";
|
364
|
$i=0;
|
365
|
$pagination_startingrow=0;
|
366
|
$pagination_counter=0;
|
367
|
if($evaledvar)
|
368
|
foreach ($evaledvar as $ip) {
|
369
|
if($startdisplayingat) {
|
370
|
if($i < $startdisplayingat) {
|
371
|
$i++;
|
372
|
continue;
|
373
|
}
|
374
|
}
|
375
|
if($_REQUEST['pkg_filter']) {
|
376
|
// Handle filterered items
|
377
|
if($pkg['fields']['field'] && !$filter_regex) {
|
378
|
// First find the sorting type field if it exists
|
379
|
foreach($pkg['fields']['field'] as $field) {
|
380
|
if($field['type'] == "sorting") {
|
381
|
if($field['sortablefields']['item']) {
|
382
|
foreach($field['sortablefields']['item'] as $sf) {
|
383
|
if($sf['name'] == $_REQUEST['pkg_filter_type']) {
|
384
|
$filter_fieldname = $sf['fieldname'];
|
385
|
#Use a default regex on sortable fields when none is declared
|
386
|
if($sf['regex'])
|
387
|
$filter_regex = str_replace("%FILTERTEXT%", $_REQUEST['pkg_filter'], trim($sf['regex']));
|
388
|
else
|
389
|
$filter_regex = "/{$_REQUEST['pkg_filter']}/i";
|
390
|
}
|
391
|
}
|
392
|
}
|
393
|
}
|
394
|
}
|
395
|
}
|
396
|
// Do we have something to filter on?
|
397
|
unset($filter_matches);
|
398
|
if($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
|
399
|
foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
|
400
|
$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
|
401
|
if($column['fieldname'] == $filter_fieldname) {
|
402
|
if($filter_regex) {
|
403
|
//echo "$filter_regex - $fieldname<p/>";
|
404
|
preg_match($filter_regex, $fieldname, $filter_matches);
|
405
|
break;
|
406
|
}
|
407
|
}
|
408
|
}
|
409
|
}
|
410
|
if(!$filter_matches) {
|
411
|
$i++;
|
412
|
continue;
|
413
|
}
|
414
|
}
|
415
|
if($pkg['adddeleteeditpagefields']['movable'])
|
416
|
echo "<tr valign=\"top\" class=\"sortable\" id=\"id_{$i}\">\n";
|
417
|
else
|
418
|
echo "<tr valign=\"top\">\n";
|
419
|
if($pkg['adddeleteeditpagefields']['columnitem'] <> "")
|
420
|
foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
|
421
|
if ($column['fieldname'] == "description")
|
422
|
$class = "listbg";
|
423
|
else
|
424
|
$class = "listlr";
|
425
|
?>
|
426
|
<td class="<?=$class;?>" ondblclick="document.location='pkg_edit.php?xml=<?=$xml?>&act=edit&id=<?=$i;?>';">
|
427
|
<?php
|
428
|
$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
|
429
|
#Check if columnitem has a type field declared
|
430
|
if($column['type'] == "checkbox") {
|
431
|
if($fieldname == "") {
|
432
|
echo gettext("No");
|
433
|
} else {
|
434
|
echo gettext("Yes");
|
435
|
}
|
436
|
} else if ($column['type'] == "interface") {
|
437
|
echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
|
438
|
} else {
|
439
|
#Check if columnitem has an encoding field declared
|
440
|
if ($column['encoding'] == "base64")
|
441
|
echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
|
442
|
#Check if there is a custom info to show when $fieldname is not empty
|
443
|
else if($column['listmodeon'] && $fieldname != "")
|
444
|
echo $column['prefix'] . gettext($column['listmodeon']). $column['suffix'];
|
445
|
#Check if there is a custom info to show when $fieldname is empty
|
446
|
else if($column['listmodeoff'] && $fieldname == "")
|
447
|
echo $column['prefix'] .gettext($column['listmodeoff']). $column['suffix'];
|
448
|
else
|
449
|
echo $column['prefix'] . $fieldname ." ". $column['suffix'];
|
450
|
}
|
451
|
?>
|
452
|
</td>
|
453
|
<?php
|
454
|
}
|
455
|
?>
|
456
|
<td valign="middle" class="list nowrap">
|
457
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
458
|
<tr>
|
459
|
<?php
|
460
|
#Show custom description to edit button if defined
|
461
|
$edit_msg=($pkg['adddeleteeditpagefields']['edittext']?$pkg['adddeleteeditpagefields']['edittext']:"Edit this item");?>
|
462
|
<td valign="middle"><a href="pkg_edit.php?xml=<?=$xml?>&act=edit&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" <?=domTT_title($edit_msg)?> alt="edit" /></a></td>
|
463
|
<?php
|
464
|
#Show custom description to delete button if defined
|
465
|
$delete_msg=($pkg['adddeleteeditpagefields']['deletetext']?$pkg['adddeleteeditpagefields']['deletetext']:"Delete this item");?>
|
466
|
<td valign="middle"><a href="pkg.php?xml=<?=$xml?>&act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this item?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" <?=domTT_title($delete_msg)?> alt="delete" /></a></td>
|
467
|
</tr>
|
468
|
</table>
|
469
|
</td>
|
470
|
<?php
|
471
|
echo "</tr>\n";
|
472
|
// Handle pagination and display_maximum_rows
|
473
|
if($display_maximum_rows) {
|
474
|
if($pagination_counter == ($display_maximum_rows-1) or
|
475
|
$i == (count($evaledvar)-1)) {
|
476
|
$colcount = count($pkg['adddeleteeditpagefields']['columnitem']);
|
477
|
$final_footer = "";
|
478
|
$final_footer .= "<tr><td colspan='$colcount'>";
|
479
|
$final_footer .= "<table width='100%' summary=''><tr>";
|
480
|
$final_footer .= "<td align='left'>";
|
481
|
$startingat = $startdisplayingat - $display_maximum_rows;
|
482
|
if($startingat > -1) {
|
483
|
$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&startdisplayingat={$startingat}&display_maximum_rows={$display_maximum_rows}'>";
|
484
|
} else if ($startdisplayingat > 1) {
|
485
|
$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&startdisplayingat=0&display_maximum_rows={$display_maximum_rows}'>";
|
486
|
}
|
487
|
$final_footer .= "<font size='2'><< Previous page</font></a>";
|
488
|
if($tmppp + $display_maximum_rows > count($evaledvar))
|
489
|
$endingrecord = count($evaledvar);
|
490
|
else
|
491
|
$endingrecord = $tmppp + $display_maximum_rows;
|
492
|
$final_footer .= "</td><td align='center'>";
|
493
|
$tmppp++;
|
494
|
$final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
|
495
|
$final_footer .= "</font></td><td align='right'> ";
|
496
|
if(($i+1) < count($evaledvar))
|
497
|
$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&display_maximum_rows={$display_maximum_rows}'>";
|
498
|
$final_footer .= "<font size='2'>Next page >></font></a>";
|
499
|
$final_footer .= "</td></tr></table></td></tr>";
|
500
|
$i = count($evaledvar);
|
501
|
break;
|
502
|
}
|
503
|
}
|
504
|
$i++;
|
505
|
$pagination_counter++;
|
506
|
}
|
507
|
?>
|
508
|
<tr>
|
509
|
<td colspan="<?=$cols?>"></td>
|
510
|
<td>
|
511
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
512
|
<tr>
|
513
|
<?php
|
514
|
#Show custom description to add button if defined
|
515
|
$add_msg=($pkg['adddeleteeditpagefields']['addtext']?$pkg['adddeleteeditpagefields']['addtext']:"Add a new item");?>
|
516
|
<td valign="middle"><a href="pkg_edit.php?xml=<?=$xml?>&id=<?=$i?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" <?=domTT_title($add_msg)?> alt="add" /></a></td>
|
517
|
<?php
|
518
|
#Show description button and info if defined
|
519
|
if($pkg['adddeleteeditpagefields']['description']){?>
|
520
|
<td valign="middle"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" width="17" height="17" border="0" <?=domTT_title($pkg['adddeleteeditpagefields']['description'])?> alt="info" /></td>
|
521
|
<?php }?>
|
522
|
</tr>
|
523
|
</table>
|
524
|
</td>
|
525
|
</tr>
|
526
|
<?=$final_footer?>
|
527
|
<?php
|
528
|
#Show save button only when movable is defined
|
529
|
if($pkg['adddeleteeditpagefields']['movable']){?>
|
530
|
<tr><td><input class="formbtn" type="button" value="Save" name="Submit" onclick="save_changes_to_xml('<?=$xml?>')" /></td></tr>
|
531
|
<?php }?>
|
532
|
</table>
|
533
|
</td>
|
534
|
</tr>
|
535
|
</table>
|
536
|
</div></td></tr></table>
|
537
|
|
538
|
</form>
|
539
|
<?php include("fend.inc"); ?>
|
540
|
|
541
|
<?php
|
542
|
echo "<!-- filter_fieldname: {$filter_fieldname} -->";
|
543
|
echo "<!-- filter_regex: {$filter_regex} -->";
|
544
|
?>
|
545
|
|
546
|
</body>
|
547
|
</html>
|