@@ -58,7 +58,12 @@ function contact_menu($may_cache) {
* Implementation of hook_settings().
*/
functioncontact_settings(){
returnform_textarea(t('Additional information'),'contact_form_information',variable_get('contact_form_information',t('You can leave us a message using the contact form below.')),60,5,t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.',array('%form'=>url('contact'))));
default_value=>variable_get('contact_form_information',t('You can leave us a message using the contact form below.')),
description=>t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.',array('%form'=>url('contact')))
returnarray(array('title'=>t('Contact settings'),'data'=>form_checkbox(t('Personal contact form'),'contact',1,$edit['contact'],t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.',array('%url'=>url("user/$user->uid/contact")))),'weight'=>2));
$form['contact']['contact']=array(type=>'checkbox',title=>t('Personal contact form'),return_value=>1,default_value=>$edit['contact'],description=>t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.',array('%url'=>url("user/$user->uid/contact"))));
@@ -92,75 +100,18 @@ function contact_mail_user() {
$output=t("You can't contact more than %number users per hour. Please try again later.",array('%number'=>CONTACT_HOURLY_THRESHOLD));
}
else{
$edit=$_POST['edit'];
if($edit){
// Validate the message:
if(!$edit['message']){
form_set_error('message',t('You must enter a message.'));
}
if(!$edit['subject']){
form_set_error('subject',t('You must enter a subject.'));
}
form_validate($edit,$user->name.$user->mail);
if(!form_get_errors()){
// Compose the body:
$message[]="$account->name,";
$message[]=t("%name (%name-url) has sent you a message via your contact form (%form-url) at %site.",array('%name'=>$user->name,'%name-url'=>url("user/$user->uid",NULL,NULL,TRUE),'%form-url'=>url($_GET['q'],NULL,NULL,TRUE),'%site'=>variable_get('site_name','drupal')));
$message[]=t("If you don't want to receive such e-mails, you can change your settings at %url.",array('%url'=>url("user/$account->uid",NULL,NULL,TRUE)));
watchdog('mail',t('%name-from sent %name-to an e-mail.',array('%name-from'=>theme('placeholder',$user->name),'%name-to'=>theme('placeholder',$account->name))));
// Set a status message:
drupal_set_message(t('The message has been sent.'));
$message[]=t("%name (%name-url) has sent you a message via your contact form (%form-url) at %site.",array('%name'=>$user->name,'%name-url'=>url("user/$user->uid",NULL,NULL,TRUE),'%form-url'=>url($_GET['q'],NULL,NULL,TRUE),'%site'=>variable_get('site_name','drupal')));
$message[]=t("If you don't want to receive such e-mails, you can change your settings at %url.",array('%url'=>url("user/$account->uid",NULL,NULL,TRUE)));
watchdog('mail',t('%name-from sent %name-to an e-mail.',array('%name-from'=>theme('placeholder',$user->name),'%name-to'=>theme('placeholder',$account->name))));
// Set a status message:
drupal_set_message(t('The message has been sent.'));
// Jump to the user's profile page:
drupal_goto("user/$account->uid");
}
functioncontact_admin_edit($category=NULL){
if(isset($_POST['edit'])){
$edit=$_POST['edit'];
...
...
@@ -192,22 +188,22 @@ function contact_admin_edit($category = NULL) {
$edit['reply']=$category->reply;
}
$form=form_textfield(t('Category'),'category',$edit['category'],60,255,t("Example: 'website feedback' or 'product information'."),NULL,TRUE);
$form.=form_textarea(t('Recipients'),'recipients',$edit['recipients'],60,5,t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."),NULL,TRUE);
$form.=form_textarea(t('Auto-reply'),'reply',$edit['reply'],60,5,t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
$form.=form_submit(t('Submit'));
$form['category']=array(type=>'textfield',title=>t('Category'),size=>60,maxlength=>255,default_value=>$edit['category'],description=>t("Example: 'website feedback' or 'product information'."),required=>TRUE);
$form['recipients']=array(type=>'textarea',title=>t('Recipients'),cols=>60,rows=>5,default_value=>$edit['recipients'],description=>t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."),required=>TRUE);
$form['reply']=array(type=>'textarea',title=>t('Auto-reply'),cols=>60,rows=>5,default_value=>$edit['reply'],description=>t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
watchdog('mail',t('%name-from sent an e-mail regarding %category.',array('%name-from'=>theme('placeholder',$edit['name']." <$from>"),'%category'=>theme('placeholder',$contact->category))));
// Set a status message:subject
drupal_set_message(t('Your message has been sent.'));
// Jump to contact page:
drupal_goto('contact');
}
}
elseif($user->uid){
if($user->uid){
$edit['name']=$user->name;
$edit['mail']=$user->mail;
}
...
...
@@ -322,18 +241,18 @@ function contact_mail_page() {
}
if(count($categories)>1){
$output=variable_get('contact_form_information',t('You can leave us a message using the contact form below.'));
$form['contact_information']=array(type=>'markup',value=>variable_get('contact_form_information',t('You can leave us a message using the contact form below.')));
watchdog('mail',t('%name-from sent an e-mail regarding %category.',array('%name-from'=>theme('placeholder',$edit['name']." <$from>"),'%category'=>theme('placeholder',$contact->category))));
// Set a status message:subject
drupal_set_message(t('Your message has been sent.'));
@@ -58,7 +58,12 @@ function contact_menu($may_cache) {
* Implementation of hook_settings().
*/
functioncontact_settings(){
returnform_textarea(t('Additional information'),'contact_form_information',variable_get('contact_form_information',t('You can leave us a message using the contact form below.')),60,5,t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.',array('%form'=>url('contact'))));
default_value=>variable_get('contact_form_information',t('You can leave us a message using the contact form below.')),
description=>t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.',array('%form'=>url('contact')))
returnarray(array('title'=>t('Contact settings'),'data'=>form_checkbox(t('Personal contact form'),'contact',1,$edit['contact'],t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.',array('%url'=>url("user/$user->uid/contact")))),'weight'=>2));
$form['contact']['contact']=array(type=>'checkbox',title=>t('Personal contact form'),return_value=>1,default_value=>$edit['contact'],description=>t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.',array('%url'=>url("user/$user->uid/contact"))));
@@ -92,75 +100,18 @@ function contact_mail_user() {
$output=t("You can't contact more than %number users per hour. Please try again later.",array('%number'=>CONTACT_HOURLY_THRESHOLD));
}
else{
$edit=$_POST['edit'];
if($edit){
// Validate the message:
if(!$edit['message']){
form_set_error('message',t('You must enter a message.'));
}
if(!$edit['subject']){
form_set_error('subject',t('You must enter a subject.'));
}
form_validate($edit,$user->name.$user->mail);
if(!form_get_errors()){
// Compose the body:
$message[]="$account->name,";
$message[]=t("%name (%name-url) has sent you a message via your contact form (%form-url) at %site.",array('%name'=>$user->name,'%name-url'=>url("user/$user->uid",NULL,NULL,TRUE),'%form-url'=>url($_GET['q'],NULL,NULL,TRUE),'%site'=>variable_get('site_name','drupal')));
$message[]=t("If you don't want to receive such e-mails, you can change your settings at %url.",array('%url'=>url("user/$account->uid",NULL,NULL,TRUE)));
watchdog('mail',t('%name-from sent %name-to an e-mail.',array('%name-from'=>theme('placeholder',$user->name),'%name-to'=>theme('placeholder',$account->name))));
// Set a status message:
drupal_set_message(t('The message has been sent.'));
$message[]=t("%name (%name-url) has sent you a message via your contact form (%form-url) at %site.",array('%name'=>$user->name,'%name-url'=>url("user/$user->uid",NULL,NULL,TRUE),'%form-url'=>url($_GET['q'],NULL,NULL,TRUE),'%site'=>variable_get('site_name','drupal')));
$message[]=t("If you don't want to receive such e-mails, you can change your settings at %url.",array('%url'=>url("user/$account->uid",NULL,NULL,TRUE)));
watchdog('mail',t('%name-from sent %name-to an e-mail.',array('%name-from'=>theme('placeholder',$user->name),'%name-to'=>theme('placeholder',$account->name))));
// Set a status message:
drupal_set_message(t('The message has been sent.'));
// Jump to the user's profile page:
drupal_goto("user/$account->uid");
}
functioncontact_admin_edit($category=NULL){
if(isset($_POST['edit'])){
$edit=$_POST['edit'];
...
...
@@ -192,22 +188,22 @@ function contact_admin_edit($category = NULL) {
$edit['reply']=$category->reply;
}
$form=form_textfield(t('Category'),'category',$edit['category'],60,255,t("Example: 'website feedback' or 'product information'."),NULL,TRUE);
$form.=form_textarea(t('Recipients'),'recipients',$edit['recipients'],60,5,t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."),NULL,TRUE);
$form.=form_textarea(t('Auto-reply'),'reply',$edit['reply'],60,5,t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
$form.=form_submit(t('Submit'));
$form['category']=array(type=>'textfield',title=>t('Category'),size=>60,maxlength=>255,default_value=>$edit['category'],description=>t("Example: 'website feedback' or 'product information'."),required=>TRUE);
$form['recipients']=array(type=>'textarea',title=>t('Recipients'),cols=>60,rows=>5,default_value=>$edit['recipients'],description=>t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."),required=>TRUE);
$form['reply']=array(type=>'textarea',title=>t('Auto-reply'),cols=>60,rows=>5,default_value=>$edit['reply'],description=>t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));