| [ Index ] |
PHP Cross Reference of E107 v0.7.22 code documentation |
[Summary view] [Print] [Text view]
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: /cvs_backup/e107_0.7/contact.php,v $ 14 | $Revision: 11346 $ 15 | $Date: 2010-02-17 13:56:14 -0500 (Wed, 17 Feb 2010) $ 16 | $Author: secretr $ 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,"rawtext"); 41 $sender = check_email($_POST['email_send']); 42 $subject = $tp->toEmail($_POST['subject'],TRUE,"rawtext"); 43 $body = $tp->toEmail($_POST['body'],TRUE,"rawtext"); 44 45 46 // Check Image-Code 47 if (isset($_POST['rand_num']) && !$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) 48 { 49 $error .= LANCONTACT_15."\\n"; 50 } 51 52 // Check message body. 53 if(strlen(trim($_POST['body'])) < 15) 54 { 55 $error .= LANCONTACT_12."\\n"; 56 } 57 58 // Check subject line. 59 if(strlen(trim($_POST['subject'])) < 2) 60 { 61 $error .= LANCONTACT_13."\\n"; 62 } 63 64 if(!strpos(trim($_POST['email_send']),"@")) 65 { 66 $error .= LANCONTACT_11."\\n"; 67 } 68 69 70 71 // Check email address on remote server (if enabled). 72 if ($pref['signup_remote_emailcheck'] && $error == "") 73 { 74 require_once(e_HANDLER."mail_validation_class.php"); 75 list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL); 76 $validator = new email_validation_class; 77 $validator->localuser= $adminuser; 78 $validator->localhost= $adminhost; 79 $validator->timeout=3; 80 // $validator->debug=1; 81 // $validator->html_debug=1; 82 if($validator->ValidateEmailBox($sender) != 1) 83 { 84 $error .= LANCONTACT_11."\\n"; 85 } 86 87 } 88 89 // No errors - so proceed to email the admin and the user (if selected). 90 if(!$error) 91 { 92 $body .= "\n\nIP:\t".USERIP."\n"; 93 if(USER) 94 { 95 $body .= "User:\t#".USERID." ".USERNAME."\n"; 96 } 97 98 if(!$_POST['contact_person'] && isset($pref['sitecontacts'])) // only 1 person, so contact_person not posted. 99 { 100 if($pref['sitecontacts'] == e_UC_MAINADMIN) 101 { 102 $query = "user_perms = '0' OR user_perms = '0.' "; 103 } 104 elseif($pref['sitecontacts'] == e_UC_ADMIN) 105 { 106 $query = "user_admin = 1 "; 107 } 108 else 109 { 110 $query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) "; 111 } 112 } 113 else 114 { 115 $query = "user_id = ".intval($_POST['contact_person']); 116 } 117 118 if($sql -> db_Select("user", "user_name,user_email",$query." LIMIT 1")) 119 { 120 $row = $sql -> db_Fetch(); 121 $send_to = $row['user_email']; 122 $send_to_name = $row['user_name']; 123 } 124 else 125 { 126 $send_to = SITEADMINEMAIL; 127 $send_to_name = ADMIN; 128 } 129 130 require_once(e_HANDLER."mail.php"); 131 $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10; 132 if(isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $_POST['email_copy'] == 1){ 133 sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name); 134 } 135 $ns -> tablerender('', $message); 136 require_once(FOOTERF); 137 exit; 138 } 139 else 140 { 141 require_once(e_HANDLER."message_handler.php"); 142 message_handler("P_ALERT", $error); 143 } 144 145 } 146 147 if(SITECONTACTINFO && $CONTACT_INFO) 148 { 149 $text = $tp->parseTemplate($CONTACT_INFO, TRUE, $contact_shortcodes); 150 $ns -> tablerender(LANCONTACT_01, $text,"contact"); 151 } 152 153 if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255) 154 { 155 require_once(e_FILE."shortcode/batch/contact_shortcodes.php"); 156 $text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes); 157 158 if(trim($text) != "") 159 { 160 $ns -> tablerender(LANCONTACT_02, $text, "contact"); 161 } 162 } 163 require_once(FOOTERF); 164 exit; 165 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Aug 3 00:19:13 2010 |