Send feedback to Wyrdsmiths

 
<?php
/****** incoming params *********
From Feedback:
$Category: Info/Services/Web site/Maillist/Other
$Name: (text)
$Company: (text)
$Address: (text)
$Telephone: (text)
$FAX: (text)
$Email: (text)
$Comments: (textarea)

From index/caller:
$cid: (text) page from which feedback was called - 'fid' for return-link

# $Id $
# Copyright (under LGPL) (c) 2001 Xio Consulting (info@xio.com.au)
********************************/

$fConfirm=isset($btnFeedback);

$XE->page->spoofinfo(); //spoof caller's base-site and tree-info

$sCallHead=$XE->page->headline(); //pick up caller's header from spoofer
$sSelf=($fConfirm ? 'Confirm feedback' : 'Feedback');
$XE->page->menuitem($XE->page->cid(),$XE->page->shortname());
$XE->page->shortname($sSelf); //NOT forced to root-level
$XE->page->headline("$sSelf to '//" . $XE->page->get('site_name') . "//'");

$XE->page->set('title',$XE->page->get('site_short') . ': Feedback');

$XE->page->show();

//process any user-defined note
if ($fConfirm) {
//
$t=$XE->page->get('site_mailinfo');
//message body
$c="Category: $Category [from page '".$XE->page->cid()."']\n" .
'Name: ' . ($Name!= ? $Name : '(not specified)') . "\n" .
'Email: ' . ($Email!= ? $Email : '(not specified)') . "\n" .
'Company: ' . ($Company!=
? $Company : '(not specified)') . "\n" .
'Address: ' . ($Address!= ? $Address : '(not specified)') . "\n" .
'Telephone: ' . ($Telephone!=
? $Telephone : '(not specified)') . "\n" .
'FAX: ' . ($FAX!= ? $FAX : '(not specified)') . "\n" .
'Comments: ' . ($Comments!=
? "\n\t$Comments" : '(not specified)') . "\n";

from (return-address)
$sFrom=($Email!= ? $Email : $XE->page->get('site_mailweb'));
$r="From: $sFrom";
$r="From: $sFrom\n";
$r.="Reply-To: $sFrom";

subject
$s='From ' . ($Name!= ? "$Name via " : ) . $XE->page->get('site_name') . " feedback ['$Category' request]";

print("

Message contents

\n"); print("<dl >\n");
print(" <dt>To:</dt>\n");
print("<dd>$t</dd>\n");
print(" <dt>From:</dt>\n");
print("<dd>$r</dd>\n");
print(" <dt>Subject:</dt>\n");
print("<dd>$s</dd>\n");
print(" <dt>Content:</dt>\n");
print("<dd>" . ereg_replace("\n", "
", $c) . "</dd>\n");
print("</dl >\n");

//
print("This message was " . $t,$s,$c,$r ? : "**//not//**" ) . " sent successfully.
\n");
/***********/

if ($Category=='Maillist') {
if ($Email=='') {
$sStatus="We cannot add you to the online mail-list automatically, as you have not provided an address in the 'Email' field";
} else {
$site=$XE->page->site();
$f=$db->set($XE->table('mailinfo'),'','',
'MailSite:s:site, MailName:h:Name, MailShort:x:none, '.
'MailAddrEmail:h, MailDesc:h:sDesc',
true);
$sStatus="Addressee '".htmlentities($Name)."' was " . ($f ? '' : '**//not//**') . 'added to the ' . $XE->page->get('site_name') . ' online mail-list';
}
print("$sStatus.
\n");
}

print("----\n");
print('<p align="center">Click '.$XE->utils->getlink($XE->page->cid(),'here').
" to return to '//" . $sCallHead . "//'.
\n");

} else {
print("Please use the form below to ask us directly for further information, or tell us what you think about our web site, information or services.
\n");
print("<p align=\"center\">(To return to '//" . $sCallHead . "//' without sending feedback, click ".$XE->utils->getlink($XE->page->cid(),'here').".)
\n");

print("----\n");
print($FORM->start('z_feedback&cid='.$XE->page->cid(), 'post'));
print("===Enquiry/feedback is about===\n");
print("@@\n");
print("<select name=\"Category\" size=\"1\">\n");
print("<option selected value=\"Info\">I'd like more information</option>\n");
print('<option value="Services">' . $XE->page->get('site_short') .
" services</option>\n");
print('<option value="Web site">' . $XE->page->get('site_short') .
" web site</option>\n");
print("<option value=\"Maillist\">Add me to the email list</option>\n");
print("<option value=\"Other\">Other comments</option>\n");
print("</select>
\n");
print("@@\n");
print("===Your contact details //(all fields are optional)//===\n");
print("<table>\n");
print("<tr>\n");
print("<td align=\"right\">//Name//</td>\n");
print("<td>".$FORM->text("Name",,35,50)."</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td align=\"right\">E-mail</td>\n");
print("<td>".$FORM->text("Email",,35,50)."</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td align=\"right\">//Company//</td>\n");
print("<td>".$FORM->text("Company",,35,50)."</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td align=\"right\">Address</td>\n");
print("<td>".$FORM->text("Address",,35,150)."</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td align=\"right\">//Telephone//</td>\n");
print("<td>".$FORM->text("Telephone",,35,50)."</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td align=\"right\">FAX</td>\n");
print("<td>".$FORM->text("FAX",,35,50)."</td>\n");
print("</tr>\n");
print("</table>\n");
print("===Your comments===\n");
print("@@\n");
print(.$FORM->textarea("Comments",,58,10)."
\n");
print("@@\n");
print( . $FORM->finish(array("btnFeedback"=>"Post Feedback", "Reset"=>"Reset Form")) . "
\n");
print(" </td></tr></table>\n");
}
?>
""