<?php
class WebAction {
function WebAction() {
}
function action($action, $params) {
return $this->state($params);
}
function makeScriptLink($params) {
$path = './';
if (substr($path, 0, 7) == 'http://') {
header("Location: $path");
exit;
} else if (substr($path, 0, 1) == '/') {
//$path = './index.php?action=' . $path;
} else {
//$path = './index.php?action=' . $path;
}
$path = './';
reset($params);
$i = 1;
while (list($key, $val) = each($params))
{
if ($i === 1) {
$path .= '?';
} else {
$path .= '&';
}
$path .= urlencode($key) . '=' . urlencode($val);
$i++;
}
return $path;
}
function state($params) {
$req = new WebRequest();
$arr = $req->getRequest();
foreach ($params as $k=>$v) {
$arr[$k] = $v;
}
return $this->makeScriptLink($arr);
}
}
?>