include_once "_inc_global.php";
$action=rqst("action");
$fil=rqst("fil");
switch($action){
case "savfile":
saveFile($dir,$fil);
break;
case "applyshadow":
applyShadow($fil);
break;
}
exit(0);
//------------------------------------------------------------------------------
function saveFile($dir,$fil){
global $dirlink,$gID,$gLoggedIn;
if(!$gID)exit("not logged in");
$v=rqst("iHtm");
$font=rqst("iFontHtm");
$postaction=rqst("postaction");
$font=_rep($font,'"','')."|";
$v=_rep($v,"<","<");
$v=_rep($v,""","'");
$v=_rep($v,"&!!!!#","<");
$v=_rep($v,"&!!!!$",">");
$txt="".$v;
if($gLoggedIn){
myWriteFile($dirlink.$fil,$txt);
}else{
myWriteFile($gID."/".$fil,$txt);
}
?>
}
//------------------------------------------------------------------------------
function applyShadow($fil){
global $dirlink,$gID,$gLoggedIn;
if(!$gID || !$gLoggedIn)exit("not logged in");
$shadows=rqst("shadows");
$txt=myReadFile($dirlink.$fil);
$ary=$txt.split(";");
$newtxt="";
//remove old shadows if any
For($i=0; $i<$ary.length; $i++){
$tmp=$ary[$i];
if(!_in($tmp,"shadow"))$newtxt.=$ary[$i];
if($i<$ary.length-1)$newtxt.=";";
}
//apply new shadows
$shadowTxt="";
if($shadows==""){
$shadowTxt=$newtxt;
}else{
$ary=$newtxt.split('style="');
$shadowTxt=$ary[0].'style="box-shadow:'.$shadows.';'.$ary[1];
}
myWriteFile($dirlink.$fil,$shadowTxt);
}
?>