[pmwiki-users] Old bug still around, FAST Data 2.02 up

The Editor editor at fast.st
Thu Sep 21 15:18:00 CDT 2006


I just released FAST Data 2.02 with quite a few bug fixes and minor
improvements--though I have one outstanding issue I can't fix. I
didn't bother to list all the changes/fixes but did update the
documentation so it's current.

I do have one big fix I still REALLY need help with before I will
upload my live site or the new FAST Data demo site.  I'd settle for
even a tip on how to go about solving it.  Line breaks!

When I enter text into a textarea with line breaks and save that
variable using WritePage it results in linebreaks in the actual
pagecode (so text=... is not all on one line).  Very bad.

I already have string replacements to change " into " and back,
and ' into ' (then back to ` --not the ideal solution, but it
solves another problem).  Anyway, adding another item to my
replacement array is easy.  I just can't seem to trap the line
returns.  \n doesn't seem to do it.  Below are snippets of the
critical code that might help jog an idea:

Thanks in advance for any help anyone can give...

Cheers,
Caveman



// Here's the function called when the form is submitted

function Data() {

	$nocode = array('"', "'", '\n');
        $encode = array('"', ''', '%0a');

	foreach ($_POST as $field => $value) {

// various functions based on fields go here...  The one below saves
specified fields as
// field="value" pairs.  If one of those fields is a textarea, with
line returns it messes up.
// Note the string replacement

		if (substr($field, 0, 8) == "savedata") {
			$data = "";
			$d = explode(",", $value);
			foreach ($d as $f => $v) {
				$vv = str_replace($nocode, $encode, $_POST[$v]);
				$data .= "$v=\"$vv\" \n\n";
				}
			SetPage($datapage);
			}

// Here is the SetPage function which writes the page.  All saved
fields are compressed
// into one long string called $data.  Note: I'm using WritePage which
should fix linebreaks.

function SetPage($d) {
	global $WorkDir, $data, $log;
	$contents = "(:comment data:) \n\n$data(:comment data:) \n\n[[#Log]]
\n\n$log(:comment data:) \n\n";
	$page['text'] = $contents;
	Lock(2);
	WritePage($d, $page);
	Lock(0);
	return;
}

The solution has to be somewhere in these lines because they are all
that take the input values from the textarea to the wiki page.  Help?




More information about the pmwiki-users mailing list