\n"; $out.= "\n"; $sql=conDB(); $strSQL="SELECT * FROM " . $strDatabase . "." . $stTable . " WHERE " . $strIDField . "='" . $strID . "'"; //echo $strSQL; $records = $sql->query($strSQL); $record=$records[0]; $intFieldCount=0; $row=""; foreach ($record as $key => $value) { $strThisBgClass=Alternate($strClassFirst, $strClassSecond, $strThisBgClass); if(beginswith($value, "a:") && contains($value, ":{") && contains($value, ";}")) { //echo $value; $value=SerializeForm($value, qpre . "serialized|" . $key , $strThisBgClass); } $out.=htmlrow($strThisBgClass, "" . $key . "" , $value); } $out.=HiddenInputs(array("needtoencryptonsave"=>$needtoencrypt,"dropdowntextvalue"=>"", "rec"=>$intRecord, "column"=>$strSort, "direction"=>$strDirection, "backfield"=>$strBackfield)); $out.=HiddenInputs(array("table"=>$strTable,"table"=>$strTable,"db"=>$strDatabase,"mode"=>$strMode,"idfield"=>$strIDField,"extrajs"=>$strExtrajs ),qpre, $strFieldNamePrefix); $out.="\n"; $out.=htmlrow($strThisBgClass, " ", "
" . GenericInput(qpre . "submit", "Save")) . "
"; $out.= "
\n"; $out.= "\n"; return $out; } function SerializeForm($value, $passinname, $class) { //display a form for editing serialized data ($value) //Judas Gutenberg 11-16-2007 $out=""; $thisarr=unserialize($value); $strLineClass="bgclassline"; $strClassFirst="bgclassfirst"; $strClassSecond="bgclasssecond"; $strOtherBgClass="bgclassother"; $strOtherLineClass="bgclassline"; $out.= "\n"; foreach ($thisarr as $key => $v) { $strThisBgClass=Alternate($strClassFirst, $strClassSecond, $strThisBgClass); //echo gettype($v) . "
"; if(gettype($v)=="array") { if(count($v)<1) { $v=TextInput($passinname . "|" . $key, "", 30, "" ); $out.=htmlrow($strThisBgClass, "" . $key . "" , $v); } else { //echo "$$$
"; $out.=htmlrow($strThisBgClass, "" . $key . "" , ArrayForm($v, $key, $passinname . "|" . $key, $strThisBgClass)); } } else { $v=TextInput($passinname . "|" . $key, $v, 20, "" ); $out.=htmlrow($strThisBgClass, "" . $key . "" , $v); } } $out.= "
\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"; foreach ($arrIn as $key => $v) { $strThisBgClass=Alternate($strClassFirst, $strClassSecond, $strThisBgClass); if(gettype($v)=="array") { if(count($v)<1) { $v=TextInput($passinname . "|" . $key, $v, 30, "" ); $out.=htmlrow($strThisBgClass, "" . $key . "" , $v); } else { $out.=htmlrow($strThisBgClass, "" . $key . "" , ArrayForm($v, $key, $passinname . "|" . $key, $strThisBgClass)); } } else { $v=TextInput($passinname . "|" . $key, $v, 20, "" ); $out.=htmlrow($strThisBgClass, "" . $key . "" , $v); } } $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) . "

"; } else { $v=$defaultvalue; } return $v; } ?>