Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Contact Form
Contact Form
0
This discussion has been closed.
Comments
This extension is great, what do you mean by "The upload directory should be writeable (chmod 777)" in the read-me?
Are you planning to allow attachments?
Posted: Friday, 16 March 2007 at 8:09AM (AEDT)
Speaking of ContactForm & PageManager: If you install this add-on and do not see the contact tab, be sure to Re-Sync the PageManager tabs.
Small note to Jazz, in admin change
...who will receive the emails which are send by the contact form. to
...who will receive the emails which are sent by the contact form.
I tweaked the code a bit so that users who are signed in don't have to enter their name or email address. It seems to work fine, but I'm not sure if I've missed anything.
Take a look and add it into the next release if you think it'll work:
function ContactForm(&$Context) { $this->Name = 'ContactForm'; $this->ValidActions = array('ContactForm', 'ProcessContactForm'); $this->Constructor($Context); $this->ContactName = $this->Context->Configuration['CONTACTFORM_CONTACT_NAME']; $this->ContactEmail = $this->Context->Configuration['CONTACTFORM_CONTACT_EMAIL']; if ($this->IsPostBack) { $this->Context->PageTitle = $Context->GetDefinition('ContactForm'); $this->Email = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Email'); if ($this->Context->Session->UserID == 0) { $this->Email->FromName = ForceIncomingString('FromName', ''); $this->Email->FromEmail = ForceIncomingString('FromEmail', ''); } if ($this->Context->Session->UserID > 0) { $UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager'); $User = $UserManager->GetUserById($this->Context->Session->UserID); $this->Email->FromName = $User->Name; $this->Email->FromEmail = $User->Email; } $this->Email->Subject = ForceIncomingString('Subject', ''); $this->Email->Body = ForceIncomingString('Body', ''); $this->Email->AddRecipient($this->ContactEmail, $this->ContactName); if ($this->PostBackAction == 'ProcessContactForm') { $this->Email->Send(); if ($this->Context->WarningCollector->Count() == 0) header("Location: " . GetUrl($this->Context->Configuration, 'extension.php', '', '', '', '', 'PostBackAction=ContactForm&Success=1')); } } $this->CallDelegate('Constructor'); } function Render() { if ($this->IsPostBack) { $this->CallDelegate('PreRender'); $this->PostBackParams->Set('PostBackAction', 'ProcessContactForm'); $Required = $this->Context->GetDefinition('Required'); echo ' <div id="Form" class="Account ContactForm"> <fieldset> <legend>'.$this->Context->GetDefinition('ContactForm').'</legend> '.(ForceIncomingBool('Success', 0) ? '<div id="Success">'.$this->Context->GetDefinition('MessageSent').'</div>' : '').' '.$this->Get_Warnings().' '.$this->Get_PostBackForm('frmContactForm').' <p class="Description">'.str_replace("//1", $this->ContactName, $this->Context->GetDefinition('ContactFormNotes')).'</p> <ul>'; if ($this->Context->Session->UserID == 0) { echo'<li> <label for="txtFromName">'.$this->Context->GetDefinition('YourName').' <small>'.$Required.'</small></label> <input type="text" name="FromName" id="txtFromName" value="'.$this->Email->FromName.'" class="SmallInput" /> </li> <li> <label for="txtFromEmail">'.$this->Context->GetDefinition('YourEmail').' <small>'.$Required.'</small></label> <input type="text" name="FromEmail" id="txtFromEmail" value="'.$this->Email->FromEmail.'" class="SmallInput" /> </li>'; } echo'<li> <label for="txtSubject">'.$this->Context->GetDefinition('Subject').' <small>'.$Required.'</small></label> <input type="text" name="Subject" id="txtSubject" value="'.$this->Email->Subject.'" class="SmallInput" /> </li> <li> <label for="txtBody">'.$this->Context->GetDefinition('Message').' <small>'.$Required.'</small></label> <textarea name="Body" id="txtBody">'.$this->Email->Body.'</textarea> </li> </ul> <div class="Submit"> <input type="submit" name="btnSave" value="'.$this->Context->GetDefinition('SendMessage').'" class="Button SubmitButton StartDiscussionButton" onclick="'."Wait(this, '".$this->Context->GetDefinition('Wait')."');".'"/> <a href="'.(!$this->IsPostBack?'javascript:history.back();':'./').'" class="CancelButton">'.$this->Context->GetDefinition('Cancel').'</a> </div> </form> </fieldset> </div>'; $this->CallDelegate('PostRender'); } }
Just add this:
RewriteRule ^([^/]*)\.html$ /extension.php?PostBackAction=$1 [L]
to your .htaccess
Well, it's friendly enough!