file, "w");
fwrite($fp, "\n");
fwrite($fp, "
Looking ok?
"; $form = new Form("send"); $form->addWidget(new Hidden($vars)); $form->addWidget(new Button("yes")); $form->render(); $form = new Form("retry"); $form->addWidget(new Hidden($vars)); $form->addWidget(new Button("no")); $form->render(); break; case "retry": $testaddr = $vars["testaddr"]; $subject = $vars["subject"]; $content = $vars["content"]; default: $form = new Form("preview"); $form->addWidget(new LineEdit("Test address:", "testaddr", $testaddr)); $form->addWidget(new LineEdit("Subject:", "subject", $subject)); $form->addWidget(new TextEdit("Content:", "content", $content)); $form->addWidget(new Button("Send")); $form->render(); break; } } public function admin_config($action, $vars) { switch($action) { case "update": $this->mailinglist->subj_prefix = $vars["subj_prefix"]; $this->mailinglist->sender = $vars["sender"]; $this->mailinglist->replyto = $vars["replyto"]; $this->mailinglist->footer = $vars["footer"]; $this->mailinglist->write(); break; default: $form = new Form("update"); $form->addWidget(new LineEdit("Subject prefix:", "subj_prefix", $this->mailinglist->subj_prefix)); $form->addWidget(new LineEdit("Sender:", "sender", $this->mailinglist->sender)); $form->addWidget(new LineEdit("Reply to:", "replyto", $this->mailinglist->replyto)); $form->addWidget(new TextEdit("Footer:", "footer", $this->mailinglist->footer)); $form->addWidget(new Button("Update")); $form->render(); break; } } public function admin_add($action, $vars) { global $UID, $GLOBALS; switch($action) { case "add": $pemail = new PEmail($vars["email"], time()); $pemail->url = $vars["url"]; $pemail->name = $vars["name"]; $this->mailinglist->add($pemail); $this->mailinglist->write(); break; default: $form = new Form("add"); $form->addWidget(new LineEdit("Email:", "email", "")); $form->addWidget(new LineEdit("URL:", "url", "")); $form->addWidget(new LineEdit("Name:", "name", "")); $form->addWidget(new Button("Add")); $form->render(); break; } } public function admin_edit($action, $vars) { switch($action) { case "write": $email = $this->mailinglist->mailinglist[$vars["editid"]]; $email->email = $vars["email"]; $email->url = $vars["url"]; $email->name = $vars["name"]; $this->mailinglist->write(); break; case "edit": $email = $this->mailinglist->mailinglist[$vars["editid"]]; $form = new Form("write"); $form->addWidget(new Hidden(array("editid" => $email->email))); $form->addWidget(new LineEdit("Email:", "email", $email->email)); $form->addWidget(new LineEdit("URL:", "url", $email->url)); $form->addWidget(new LineEdit("Name:", "name", $email->name)); $form->addWidget(new Button("Edit")); $form->render(); break; default: $rcvlist = array(); foreach($this->mailinglist->mailinglist as $m) { $title = $m->name . " (".$m->email.")"; $rcvlist[$title] = $m->email; } ksort($rcvlist); $form = new Form("edit"); $form->addWidget(new ComboBox("Select receiver to edit:", "editid", "", $rcvlist)); $form->addWidget(new Button("Edit...")); $form->render(); break; } } public function admin_delete($action, $vars) { switch($action) { case "delete": $this->mailinglist->remove($vars["delrcv"]); $this->mailinglist->write(); break; default: $rcvlist = array(); foreach($this->mailinglist->mailinglist as $m) { $title = $m->name . " (".$m->email.")"; $rcvlist[$title] = $m->email; } ksort($rcvlist); $form = new Form("delete"); $form->addWidget(new ComboBox("Select receiver to delete:", "delrcv", "", $rcvlist)); $form->addWidget(new Button("Delete")); $form->render(); break; } } public function admin_view($action, $vars) { switch($action) { default: echo "There are " . sizeof($this->mailinglist->mailinglist) . " receivers:
\n"; echo "