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