getWmsByWmsOwner($_SESSION["mb_user_id"]);
#need admin functions: getWmsLogTag, getWmsPrice, setWmsLogTag, setWmsPrice
#can set log only when proxy on, can set price only when log on
#read out the request
function array2str($array, $pre = '', $pad = '', $sep = ', ')
{
$str = '';
if(is_array($array)) {
if(count($array)) {
foreach($array as $v) {
$str .= $pre.$v.$pad.$sep;
}
$str = substr($str, 0, -strlen($sep));
}
} else {
$str .= $pre.$array.$pad;
}
return $str;
}
function validateint($inData) {
$intRetVal = 0;
$IntValue = intval($inData);
$StrValue = strval($IntValue);
if($StrValue == $inData) {
$intRetVal = $IntValue;
}
return $intRetVal;
}
if(isset($_REQUEST["save"])){
#if(isset($_REQUEST["wms_id"]) && isset($_REQUEST["status"])){
#$admin->setWMSOWSstring(intval($_REQUEST["wms_id"]),$_REQUEST["status"]);
#print_r($_POST);
#TODO deactivate proxy, logs and prices for all owned wms
#TODO
#$wms_list=array2str($ownwms);
#print $wms_list;
//$admin->unsetWmsProxy($wms_list);#TODO not delete owsproxy urls but update each entry! -> this would not delete log or usage of proxy!!!
#serialize ownwms - to list and do sql
#for the definitions in the form set the params
#sequentialy read out the post variables
if(isset($_POST["save"])) {
}
foreach ($_POST as $var => $value) {
//select those which are relevant (hidden fields for proxy and log)
//identify them
$parts=explode("_",$var);
//echo "All vars:
";
//echo $var." = ".$value."
";
$value=validateint($value);
//test exchanging urls conf
if ($parts[0] == 'status' && $parts[2] == 'exchange') {
$admin->setWmsExchangeUrlTag(intval($parts[1]), $value);
}
//changing price information
if ($parts[0] != 'status' && $parts[2]=='price'){ //for the pricing in the textfield
if($parts[0] == "wms") {
$admin->setWmsPrice(intval($value),intval($parts[1]));
} else if($parts[0] == "wmsfi") {
$admin->setWmsfiPrice(intval($value),intval($parts[1]));
}
}
//check the hidden fields if some log should be set
if (($parts[2]=='log' || $parts[2]=='logfi') && $parts[0]=='status'){
//set the log value to 1 or 0
if($parts[2]=='log') {
$admin->setWmsLogTag(intval($parts[1]),$value);
} else if($parts[2]=='logfi'){
$admin->setWmsfiLogTag(intval($parts[1]),$value);
}
//if value is 0 then set the price to 0 to. there would be is no sense to have a price set - maybe change this behavior
if ($value==0) {
if($parts[2]=='log'){
$admin->setWmsPrice(intval($value),intval($parts[1]));
} else if($parts[2]=='logfi'){
$admin->setWmsfiPrice(intval($value),intval($parts[1]));
}
}
//echo "log: $var = $value
";
}
//check proxy fields
if ($parts[0]=='status' && $parts[2]=='proxy'){
//echo ("proxy settings identified: WMS_ID: ".intval($parts[1])." Value: ".$value."
");
//echo ("Is active?: ");
//if ($admin->getWMSOWSstring(intval($parts[1]))=="") {echo " no";} else {echo " yes";}
//echo ("
");
//check if proxy should be activated and is not set
if ($value==1 && $admin->getWMSOWSstring(intval($parts[1])) == "") {
//activate it!
$admin->setWMSOWSstring(intval($parts[1]),$value);
//echo "Activate Proxy for ".intval($parts[1])."
";
}
//check if active proxy should be deactivated
if ($value==0 && $admin->getWMSOWSstring(intval($parts[1])) !== "") {
//deactivate it
$admin->setWMSOWSstring(intval($parts[1]),$value);
//echo "Deactivate Proxy for ".intval($parts[1])."
";
}
}
}
}
?>
';
?>
OWS Security Proxy