forked from buckaroo-labs/Hydrogen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibState.php
More file actions
36 lines (28 loc) · 986 Bytes
/
Copy pathlibState.php
File metadata and controls
36 lines (28 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include_once ('Hydrogen/libFilter.php');
//This library is used to maintain state between page clicks.
//See e.g. libPagination.php
//declare a list of GET variables to be maintained and sanitized
if (!isset($stateVarList)) $stateVarList=array('sortorder','userid','productid');
$arrlength = count($stateVarList);
$stateVar=array();
//Use libFilter.php to sanitize the GET variables enumerated above
for($x = 0; $x < $arrlength; $x++) {
$stateVar[$stateVarList[$x]] = sanitizeGetVar($stateVarList[$x]);
}
if (isset($_GET["pagenum"])) {
$page_num=sanitizeGetVar("pagenum");
} else $page_num=1;
//The output of this function is meant to be appended to links within the application.
function newVars($pg,$oldvar=array()) {
global $stateVar;
if (count($oldvar)==0) $oldvar=$stateVar;
$retval="?pagenum=" . $pg;
foreach ($oldvar as $key => $value) {
if (isset($value)) {
if ($value!="") $retval=$retval . "&" . $key . "=" . $value ;
}
}
return $retval;
}
?>