\n";
//at this point I need a way to manually add data structures
//using freeform serialized data
//ideally I'd have a way to do this graphically using DHTML
$out.="freeform serialized data " . GenericInput(qpre. "serialextra", "", false, "", "", "", "text", "40", "", 12);
return $out;
}
function ArrayForm($arrIn, $name, $passinname, $class)
{
//display a sub-form around an Array inside the serialized data.
//if an array item is in turn another array, go recursive!
//Judas Gutenberg 11-16-2007
$out="";
$strLineClass="bgclassline";
$strClassFirst="bgclassfirst";
$strClassSecond="bgclasssecond";
$strOtherBgClass="bgclassother";
$strOtherLineClass="bgclassline";
$out.= "
\n";
return $out;
}
function ReadSerializedForm(&$key, &$serializeddone, $defaultvalue)
{
//if, when reading form items to save from tableform, we encounter
//a form variable beginning with x_serialized|, we search the $_POST array
//for all the serialized data available and then build and return a string.
//in the process we create a space-delimited list of serialized variables to ignore,
//$serializeddone, returned by reference, and a $key (also by reference). the $key
//is the DB column name of the serialized data
//$defaultvalue contains the output if serialization should fail
//Judas Gutenberg 11-16-2007
$arrPath=explode("|", $key);
//echo $k . "-----" . $serializeddone . " " .$arrPath[1] . " ";
if(!inList($serializeddone,$arrPath[1]))
{
$k=$arrPath[1];
$serializeddone.=" " . $k;
foreach($_POST as $ks=>$vs)
{
//echo $ks . "----- ";
if(beginswith($ks, qpre . "serialized|"))
{
$arrPath=explode("|", $ks);
$strToExec="";
for($pathcount=2; $pathcount";
}
}
$strToExec='$arrThis' . $strToExec . ";";
//error_reporting(6143);
//the easiest way to handle this is to make a PHP string and eval it
eval($strToExec);
}
}
$serialextra=trim($_POST[qpre . "serialextra"]);
//a sample snatch of serialized data in all its brutal ugliness: //s:11:"identifiers";a:2:{s:1:"P";a:2:{s:5:"login";s:4:"root";s:10:"login_type";s:1:"P";}s:1:"A";a:2:{s:5:"login";s:4:"root";s:10:"login_type";s:1:"P";}}
if (!beginswith($serialextra,"a:"))//in case our extra serialized is not sent as an array
{
//echo " ##";
$serialextra="a:1:{" . $serialextra . "};";
}
$arrExtra=unserialize($serialextra);
if(count($arrExtra)>0)
{
//this should only reset the top-level dimensions of the $arrExtra array
foreach($arrExtra as $ke=>$ve)
{
//echo $k . " " . $v . " ";
$arrThis[$ke]=$ve;
}
}
$key=$k;
$v=serialize($arrThis) . "