[pmwiki-devel] UpdatePage problem

The Editor editor at fast.st
Fri Jan 5 09:06:12 CST 2007


I'm trying to update the zapnews module to work with ZAP 2007 and I'm
getting a strange problem.  The UpdatePage command is giving me the
php white screen of death.  When I comment out these two lines, the
page loads fine.

I had this working fine before, and only had to update a few unrelated
lines (plus add a bit of new functionality--prescheduling
newsletters!), but didn't change these lines.  But for the life of me
I can't figure out what is wrong.

//    UpdatePage("$g.$pp", $oldqueue, $newqueue);
//    UpdatePage("$g.LOG-$id", $oldlog, $newlog);

Below is the full code if anyone cares to wade through the problem.
The lines are near the bottom, commented out. Probably something
obvious I botched in trying to fix the module...  but it fails now
using the old module as well.  Could it be a problem in a PmWiki beta
upgrade? TIA!

Cheers,
Dan



_____________________

Markup('zapnews', '>{$var}', '/\(:zapnews(.*?):\)/ei', "ZAPsendnews('$1')");
function ZAPsendnews($x) {
  global $WorkDir, $WikiDir, $ZAPlistgroup;
  if(is_dir("lock")) return;
  @ignore_user_abort(true);
  mkdir("lock");
  $g = "Temp-$ZAPlistgroup";
  $t = time();
  $lp = ListPages("/^$g\\.\\d/");
  if (count($lp) == 0) {
    rmdir("lock");
    return "$g";
    }
  foreach($lp as $p) {
    $pn = substr($p, strpos($p, ".") + 1);
    if($pn < $t) {
      $oldqueue = ReadPage($p);
      $newqueue = $oldqueue;
      $n = explode("^", $oldqueue[text]);
      $list = substr($n[0], 3, -5);
      $to = explode("\n", $list);
      $batch = $n[1];
      $throttle = $n[2];
      $id = $n[3];
      $from = $n[4];
      $subject = $n[5];
      $body = substr(str_replace("%0a", "\n", $n[6]), 2);
      $count = 0;
      $oldlog = ReadPage("$g.LOG-$id");
      $newlog = $oldlog;
      if ($newlog['text'] == "") $newlog['text'] = "Subject:
$subject\n\nSent: " . strftime("%c", $id) . "\n\n";
      while($count < $batch) {
        if (! isset($to[$count])) break;
        $mergedbody = str_replace("{email}", "$to[$count]", $body);
        if ($ZAPconfig['mail'] == true) mail($to[$count], $subject,
$mergedbody, "From: $from");
        $newlog[text] .= "SENT " . substr($to[$count], 0,
strpos($to[$count], "@")) . "@***** at " . strftime("%c", time()) . "
\\\\\n";
        $count = $count + 1;
        }
      if (count($to) > $batch) {
        $to = array_slice($to, $batch);
        $n[0] = "[@\n" . implode("\n", $to) . "\n@]\n\n";
        $newqueue[text] = implode("^", $n);
        $pp = bcadd($pn, $throttle);
//      UpdatePage("$g.$pp", $oldqueue, $newqueue);
        }
      else $newlog['text'] .= "\n\nSending Complete!";
//    UpdatePage("$g.LOG-$id", $oldlog, $newlog);
      $WikiDir->delete("$p");
      }
      }
  rmdir("lock");
  return $m;
  }



More information about the pmwiki-devel mailing list