Changeset 304 for minimanager/mail.php
- Timestamp:
- Mar 13, 2008, 7:39:11 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/mail.php
r142 r304 8 8 * License: GNU General Public License v2(GPL) 9 9 */ 10 10 11 11 require_once("header.php"); 12 12 valid_login(1); … … 34 34 else $output .= " 35 35 <option value=\"ingame_mail\">{$lang_mail['ingame_mail']}</option> 36 <option value=\"email\">{$lang_mail['email']}</option>"; 36 <option value=\"email\">{$lang_mail['email']}</option>"; 37 37 $output .= "</select></td><td>"; 38 38 makebutton($lang_mail['send'], "javascript:do_submit()",80); … … 69 69 <tr><td colspan=\"4\"><hr /></td></tr> 70 70 <tr> 71 <td colspan=\"2\">{$lang_mail['attachments']}:</td> 71 <td colspan=\"2\">{$lang_mail['attachments']}:</td> 72 72 <td colspan=\"2\">{$lang_mail['money']} : <input type=\"text\" name=\"money\" value=\"0\" size=\"10\" maxlength=\"10\" /> 73 73 {$lang_mail['item']} : <input type=\"text\" name=\"att_item\" value=\"0\" size=\"10\" maxlength=\"10\" /> … … 89 89 function send_mail(){ 90 90 global $lang_global, $output, $realm_db, $characters_db, $realm_id, $user_name, $from_mail, $mailer_type, $smtp_cfg; 91 91 92 92 if ( empty($_POST['body']) || empty($_POST['subject']) || empty($_POST['type']) || empty($_POST['group_sign']) || empty($_POST['group_send']) ) { 93 93 redirect("mail.php?error=1"); 94 94 } 95 95 96 96 $sql = new SQL; 97 97 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 98 98 99 99 $body = $sql->quote_smart($_POST['body']); 100 100 $subject = $sql->quote_smart($_POST['subject']); 101 101 102 102 if(isset($_POST['to'])&&($_POST['to'] != '')) $to = $sql->quote_smart($_POST['to']); 103 103 else { … … 116 116 $att_item = $sql->quote_smart($_POST['att_item']); 117 117 $att_stack = $sql->quote_smart($_POST['att_stack']); 118 118 119 119 switch ($type) { 120 120 case "email": … … 142 142 $body = preg_replace( "/([^\/=\"\]])((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $body); 143 143 $body = preg_replace('/([^\/=\"\]])(www\.)(\S+)/', '\\1<a href="http://\\2\\3" target="_blank">\\2\\3</a>', $body); 144 144 145 145 $mail->Body = $body; 146 146 $mail->WordWrap = 50; 147 147 148 148 if($to){ //single Recipient 149 149 $mail->AddAddress($to); 150 150 if(!$mail->Send()) { 151 $mail->ClearAddresses(); 151 $mail->ClearAddresses(); 152 152 redirect("mail.php?error=3&mail_err=".$mail->ErrorInfo); 153 153 } else { 154 $mail->ClearAddresses(); 154 $mail->ClearAddresses(); 155 155 redirect("mail.php?error=2"); 156 156 } 157 157 158 158 } elseif (isset($group_value)){ //group send 159 159 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 160 160 161 161 $email_array = array(); 162 162 switch ($group_send) { … … 167 167 } 168 168 break; 169 169 170 170 case "locked": 171 171 $result = $sql->query("SELECT email FROM account WHERE locked $group_sign '$group_value'"); … … 179 179 while ($banned = $sql->fetch_row($que)){ 180 180 $result = $sql->query("SELECT email FROM account WHERE id = '$banned[0]'"); 181 if($sql->result($result, 0, 'email')) array_push($email_array, $sql->result($result, 0, 'email')); 182 } 183 break; 184 181 if($sql->result($result, 0, 'email')) array_push($email_array, $sql->result($result, 0, 'email')); 182 } 183 break; 184 185 185 default: 186 186 $sql->close(); … … 192 192 $mail->AddAddress($mail_addr); 193 193 if(!$mail->Send()) { 194 $mail->ClearAddresses(); 194 $mail->ClearAddresses(); 195 195 redirect("mail.php?error=3&mail_err=".$mail->ErrorInfo); 196 196 } else { … … 207 207 case "ingame_mail": 208 208 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 209 209 210 210 require_once("scripts/gen_lib.php"); 211 211 212 212 if($to){ //single Recipient 213 213 $result = $sql->query("SELECT guid FROM `character` WHERE name ='$to'"); 214 215 214 if ($sql->num_rows($result) == 1) { 216 215 $receiver = $sql->result($result, 0, 'guid'); 217 216 218 send_ingame_mail($receiver, 0, $subject, $body, $att_gold, $att_item, $att_stack); 219 217 $result = $sql->query("SELECT guid FROM `character` WHERE name ='$user_name'"); 218 219 $sender = 0; 220 //if ($sql->num_rows($result) == 1) { 221 // $sender = $sql->result($result, 0, 'guid'); 222 //}; 223 // we need the id of a character, account username is provided atm 224 225 send_ingame_mail($receiver, $sender, $subject, $body, $att_gold, $att_item, $att_stack); 226 220 227 } else { 221 228 $sql->close(); … … 237 244 } 238 245 break; 239 246 240 247 case "online": 241 248 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); … … 249 256 while($user = $sql->fetch_row($result)) array_push($char_array, $user[0]); 250 257 break; 251 258 259 $sender = 0; 260 //if ($sql->num_rows($result) == 1) { 261 // $sender = $sql->result($result, 0, 'guid'); 262 //}; 263 // we need the id of a character, account username is provided atm 264 252 265 default: 253 266 $sql->close(); 254 267 redirect("mail.php?error=5"); 255 268 } 256 269 257 270 foreach ($char_array as $receiver){ 258 259 send_ingame_mail($receiver, 0, $subject, $body, $att_gold, $att_item, $att_stack);271 272 send_ingame_mail($receiver, $sender, $subject, $body, $att_gold, $att_item, $att_stack); 260 273 } 261 274 $sql->close(); … … 268 281 269 282 } 270 283 271 284 272 285 //########################################################################################################################
Note:
See TracChangeset
for help on using the changeset viewer.