Hits :
2158
Original Page:
http://wackowiki.org/Dev/PatchesHacks/SendThisPage
This is a handler i wrote to send a wacko wiki page
to someone via email in html format
eg.
http://localhost/wiki/PageIndex
if you want to send this page to a friend:
http://localhost/wiki/PageIndex/send
<div class="pageBefore"> </div>
<div class="page">
<?php
if ( $this->HasAccess("write") && $this->HasAccess("read") ) {
if (!$this->page)
print(str_replace("%1",$this->href("edit"),$this->GetResourceValue("DoesNotExists")));
else {
if ( !empty($_POST["email"] ) ) {
$pattern = '/[a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-]+\.[a-zA-Z]+/';
preg_match($pattern, $_POST["email"], $matches, PREG_OFFSET_CAPTURE);
if ( count($matches) ) {
$url = $this->GetConfigValue("base_url").$this->tag;
$email = $_POST["email"];
$subject = $url;
$message = $this->GetResourceValue("EmailSubject") . $_SESSION[wacko_user][name] ." – ".$_SESSION[wacko_user][email]."\r\n<br>";
$message .= $data = $this->Format($this->page["body"], "wakka");
$this->SendMail($email,$subject, $message);
echo "<p>".$this->GetResourceValue("SendPage")."</p>";
} else {
echo "<p>".$this->GetResourceValue("BadEmail")."</p>";
}
echo "<a href=\"".$url."\">".$this->GetResourceValue("ReturnToPage")."</a>";
} else {
?>
<p><?php echo $this->GetResourceValue("EmailPage"); ?></p>
<FORM method="POST">
<p><?php echo $this->GetResourceValue("WriteEmail"); ?></p>
<INPUT type="text" name="email" size="25" maxlength="50"><INPUT type="submit" value="Send">
</FORM>
<p> </p>
<?php
echo $data = $this->Format($this->page["body"], "wakka");
}
}
}
else
print($this->GetResourceValue("ReadAccessDenied"));
?>
</div>