function displayNode(&$tpl, $node) { if ($node == 'RootNode') { // hack to display a default Root node $contents = Wiki::getNodeContents($node); if ($contents === null) { $contents = '(Empty Root Node)'; } } $nodename = Wiki::formatWord($node); if (empty($contents)) { $contents = Wiki::getNodeContents($node); } if ($contents === null) { $tpl->loadTemplatefile('404.tpl'); } else { $tpl->loadTemplatefile('node.tpl'); $tpl->setVariable('Contents', Wiki::process($contents)); } $tpl->setVariable('User', $GLOBALS['a']->getUsername()); $tpl->setVariable('Self', $_SERVER['SCRIPT_NAME']); $tpl->setVariable('Version', PEAR_WIKI_VERSION); $tpl->setVariable('Node', $node); $tpl->setVariable('NodeName', $nodename); $tpl->setVariable('PageTitle', "PEAR Wiki: {$nodename}"); $tpl->show(); }
$form->addRule('email', 'Please enter email address', 'required', null, 'client'); $form->addElement('submit'); $form->addElement('hidden', 'mode', $mode); $form_html = $form->toHtml(); $tpl =& new HTML_Template_IT($template_dir); $tpl->loadTemplatefile("mail.tpl"); $tpl->setVariable("Node", $node); $tpl->setVariable("MailForm", $form_html); $tpl->show(); exit; } else { include_once "Mail.php"; include_once "Mail/mime.php"; $html = Wiki::process(Wiki::getNodeContents($node)); $text = unhtmlentities(strip_tags($html)); $hdrs = array('From' => $a->getUsername() . '@php.net', 'Subject' => 'PEAR Wiki: ' . Wiki::formatWord($node)); $mime = new Mail_mime(); $mime->setTXTBody($text); $mime->setHTMLBody($html); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mail =& Mail::factory('mail'); $mail->send($_REQUEST['email'], $hdrs, $body); } } $tpl =& new HTML_Template_IT($template_dir); if ($mode == 'edit') { Wiki::displayEditor($tpl, $node); } elseif ($mode == 'new') { Wiki::displayEditor($tpl, '__new__'); } else {