[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> contact.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/contact.php,v $
  14  |     $Revision: 1.9 $
  15  |     $Date: 2006/11/09 19:57:47 $
  16  |     $Author: e107coders $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  
  21      // security image may be disabled by removing the appropriate shortcodes from the template.
  22      require_once(e_HANDLER."secure_img_handler.php");
  23      $sec_img = new secure_image;
  24  
  25  
  26  require_once(HEADERF);
  27  
  28  if (!$CONTACT_FORM) {
  29      if (file_exists(THEME."contact_template.php")) {
  30          require_once(THEME."contact_template.php");
  31      } else {
  32          require_once(e_THEME."templates/contact_template.php");
  33      }
  34  }
  35  
  36  if(isset($_POST['send-contactus'])){
  37  
  38      $error = "";
  39  
  40      $sender_name = $tp->toEmail($_POST['author_name'],TRUE);
  41      $sender = check_email($_POST['email_send']);
  42      $subject = $tp->toEmail($_POST['subject'],TRUE);
  43      $body = $tp->toEmail($_POST['body'],TRUE);
  44  
  45  // Check Image-Code
  46      if (isset($_POST['rand_num']) && !$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
  47      {
  48          $error .= LANCONTACT_15."\\n";
  49      }
  50  
  51  // Check message body.
  52      if(strlen(trim($_POST['body'])) < 15)
  53      {
  54          $error .= LANCONTACT_12."\\n";
  55      }
  56  
  57  // Check subject line.
  58      if(strlen(trim($_POST['subject'])) < 2)
  59      {
  60          $error .= LANCONTACT_13."\\n";
  61      }
  62  
  63      if(!strpos(trim($_POST['email_send']),"@"))
  64      {
  65          $error .= LANCONTACT_11."\\n";
  66      }
  67  
  68  
  69  // Check email address on remote server (if enabled).
  70      if ($pref['signup_remote_emailcheck'] && $error == "")
  71      {
  72          require_once(e_HANDLER."mail_validation_class.php");
  73          list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL);
  74          $validator = new email_validation_class;
  75          $validator->localuser= $adminuser;
  76          $validator->localhost= $adminhost;
  77          $validator->timeout=3;
  78          //    $validator->debug=1;
  79          //    $validator->html_debug=1;
  80          if($validator->ValidateEmailBox($sender) != 1)
  81          {
  82              $error .= LANCONTACT_11."\\n";
  83          }
  84  
  85      }
  86  
  87  // No errors - so proceed to email the admin and the user (if selected).
  88      if(!$error)
  89      {
  90          $body .= "\n\nIP:\t".USERIP."\n";
  91          $body .= "User:\t#".USERID." ".USERNAME."\n";
  92  
  93          if(!$_POST['contact_person'] && isset($pref['sitecontacts'])) // only 1 person, so contact_person not posted.
  94          {
  95              if($pref['sitecontacts'] == e_UC_MAINADMIN)
  96              {
  97                  $query = "user_perms = '0' OR user_perms = '0.' ";
  98              }
  99              elseif($pref['sitecontacts'] == e_UC_ADMIN)
 100              {
 101                  $query = "user_admin = 1 ";
 102              }
 103              else
 104              {
 105                  $query = $pref['sitecontacts'] . " IN (user_class) ";
 106              }
 107          }
 108          else
 109          {
 110                $query = "user_id = ".$_POST['contact_person'];
 111          }
 112  
 113          if($sql -> db_Select("user", "user_name,user_email",$query." LIMIT 1"))
 114          {
 115              $row = $sql -> db_Fetch();
 116              $send_to = $row['user_email'];
 117              $send_to_name = $row['user_name'];
 118          }
 119          else
 120          {
 121              $send_to = SITEADMINEMAIL;
 122              $send_to_name = ADMIN;
 123          }
 124  
 125          require_once(e_HANDLER."mail.php");
 126           $message =  (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10;
 127          if(isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $_POST['email_copy'] == 1){
 128              sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name);
 129          }
 130          $ns -> tablerender('', $message);
 131          require_once(FOOTERF);
 132          exit;
 133      }
 134      else
 135      {
 136          require_once(e_HANDLER."message_handler.php");
 137          message_handler("P_ALERT", $error);
 138      }
 139  
 140  }
 141  
 142  if(SITECONTACTINFO && $CONTACT_INFO)
 143  {
 144      $text = $tp->toHTML($CONTACT_INFO,"","parse_sc");
 145      $ns -> tablerender(LANCONTACT_01, $text,"contact");
 146  }
 147  
 148  if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255)
 149  {
 150      require_once(e_FILE."shortcode/batch/contact_shortcodes.php");
 151      $text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes);
 152  
 153      if(trim($text) != "")
 154      {
 155          $ns -> tablerender(LANCONTACT_02, $text, "contact");
 156      }
 157  }
 158  require_once(FOOTERF);
 159  exit;
 160  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7