[ Index ]
 

Code source de PHP NUKE 7.9

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

title

Body

[fermer]

/includes/ -> usercp_email.php (source)

   1  <?php
   2  /***************************************************************************

   3   *                             usercp_email.php

   4   *                            -------------------

   5   *   begin                : Saturday, Feb 13, 2001

   6   *   copyright            : (C) 2001 The phpBB Group

   7   *   email                : support@phpbb.com

   8   *

   9   *   Id: usercp_email.php,v 1.7.2.13 2003/06/06 18:02:15 acydburn Exp

  10   *

  11   *

  12   ***************************************************************************/
  13  /***************************************************************************

  14  * phpbb2 forums port version 2.0.5 (c) 2003 - Nuke Cops (http://nukecops.com)

  15  *

  16  * Ported by Nuke Cops to phpbb2 standalone 2.0.5 Test

  17  * and debugging completed by the Elite Nukers and site members.

  18  *

  19  * You run this package at your sole risk. Nuke Cops and affiliates cannot

  20  * be held liable if anything goes wrong. You are advised to test this

  21  * package on a development system. Backup everything before implementing

  22  * in a production environment. If something goes wrong, you can always

  23  * backout and restore your backups.

  24  *

  25  * Installing and running this also means you agree to the terms of the AUP

  26  * found at Nuke Cops.

  27  *

  28  * This is version 2.0.5 of the phpbb2 forum port for PHP-Nuke. Work is based

  29  * on Tom Nitzschner's forum port version 2.0.6. Tom's 2.0.6 port was based

  30  * on the phpbb2 standalone version 2.0.3. Our version 2.0.5 from Nuke Cops is

  31  * now reflecting phpbb2 standalone 2.0.5 that fixes some bugs and the

  32  * invalid_session error message.

  33  ***************************************************************************/
  34  /***************************************************************************

  35   *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002

  36   *   by Tom Nitzschner (tom@toms-home.com)

  37   *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com)

  38   *

  39   *   As always, make a backup before messing with anything. All code

  40   *   release by me is considered sample code only. It may be fully

  41   *   functual, but you use it at your own risk, if you break it,

  42   *   you get to fix it too. No waranty is given or implied.

  43   *

  44   *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,

  45   *   then on my site. All original header code and copyright messages will be maintained

  46   *   to give credit where credit is due. If you modify this, the only requirement is

  47   *   that you also maintain all original copyright messages. All my work is released

  48   *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.

  49   *

  50   ***************************************************************************/
  51  
  52  /***************************************************************************

  53   *

  54   *   This program is free software; you can redistribute it and/or modify

  55   *   it under the terms of the GNU General Public License as published by

  56   *   the Free Software Foundation; either version 2 of the License, or

  57   *   (at your option) any later version.

  58   *

  59   *

  60   ***************************************************************************/
  61  
  62  if ( !defined('IN_PHPBB') )
  63  {
  64          die("Hacking attempt");
  65          exit;
  66  }
  67  
  68  // Is send through board enabled? No, return to index

  69  if (!$board_config['board_email_form'])
  70  {
  71          $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", $_SERVER["SERVER_SOFTWARE"]) ) ? "Refresh: 0; URL=" : "Location: ";
  72          header($header_location . append_sid("index.$phpEx", true));
  73          exit;
  74  }
  75  
  76  if ( !empty($HTTP_GET_VARS[POST_USERS_URL]) || !empty($HTTP_POST_VARS[POST_USERS_URL]) )
  77  {
  78          $user_id = ( !empty($HTTP_GET_VARS[POST_USERS_URL]) ) ? intval($HTTP_GET_VARS[POST_USERS_URL]) : intval($HTTP_POST_VARS[POST_USERS_URL]);
  79  }
  80  else
  81  {
  82          message_die(GENERAL_MESSAGE, $lang['No_user_specified']);
  83  }
  84  
  85  if ( !$userdata['session_logged_in'] )
  86  {
  87          header('Location: ' . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true));
  88          exit;
  89  }
  90  
  91  $sql = "SELECT username, user_email, user_viewemail, user_lang
  92          FROM " . USERS_TABLE . "
  93          WHERE user_id = '$user_id'";
  94  if ( $result = $db->sql_query($sql) )
  95  {
  96          $row = $db->sql_fetchrow($result);
  97  
  98          $username = $row['username'];
  99          $user_email = $row['user_email'];
 100          $user_lang = $row['user_lang'];
 101  
 102          if ( $row['user_viewemail'] || $userdata['user_level'] == ADMIN )
 103          {
 104                  if ( time() - $userdata['user_emailtime'] < $board_config['flood_interval'] )
 105                  {
 106                          message_die(GENERAL_MESSAGE, $lang['Flood_email_limit']);
 107                  }
 108  
 109                  if ( isset($HTTP_POST_VARS['submit']) )
 110                  {
 111                          $error = FALSE;
 112  
 113                          if ( !empty($HTTP_POST_VARS['subject']) )
 114                          {
 115                                  $subject = trim(stripslashes($HTTP_POST_VARS['subject']));
 116                          }
 117                          else
 118                          {
 119                                  $error = TRUE;
 120                                  $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
 121                          }
 122  
 123                          if ( !empty($HTTP_POST_VARS['message']) )
 124                          {
 125                                  $message = trim(stripslashes($HTTP_POST_VARS['message']));
 126                          }
 127                          else
 128                          {
 129                                  $error = TRUE;
 130                                  $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
 131                          }
 132  
 133                          if ( !$error )
 134                          {
 135                                  $sql = "UPDATE " . USERS_TABLE . "
 136                                          SET user_emailtime = " . time() . "
 137                                          WHERE user_id = " . $userdata['user_id'];
 138                                  if ( $result = $db->sql_query($sql) )
 139                                  {
 140                                          include ("includes/emailer.php");
 141                                          $emailer = new emailer($board_config['smtp_delivery']);
 142  
 143                                          $emailer->from($userdata['user_email']);
 144                                          $emailer->replyto($userdata['user_email']);
 145  
 146                                          $email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
 147                                          $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
 148                                          $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
 149                                          $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
 150  
 151                                          $emailer->use_template('profile_send_email', $user_lang);
 152                                          $emailer->email_address($user_email);
 153                                          $emailer->set_subject($subject);
 154                                          $emailer->extra_headers($email_headers);
 155  
 156                                          $emailer->assign_vars(array(
 157                                                  'SITENAME' => $board_config['sitename'],
 158                                                  'BOARD_EMAIL' => $board_config['board_email'],
 159                                                  'FROM_USERNAME' => $userdata['username'],
 160                                                  'TO_USERNAME' => $username,
 161                                                  'MESSAGE' => $message)
 162                                          );
 163                                          $emailer->send();
 164                                          $emailer->reset();
 165  
 166                                          if ( !empty($HTTP_POST_VARS['cc_email']) )
 167                                          {
 168                                                  $emailer->from($userdata['user_email']);
 169                                                  $emailer->replyto($userdata['user_email']);
 170                                                  $emailer->use_template('profile_send_email');
 171                                                  $emailer->email_address($userdata['user_email']);
 172                                                  $emailer->set_subject($subject);
 173  
 174                                                  $emailer->assign_vars(array(
 175                                                          'SITENAME' => $board_config['sitename'],
 176                                                          'BOARD_EMAIL' => $board_config['board_email'],
 177                                                          'FROM_USERNAME' => $userdata['username'],
 178                                                          'TO_USERNAME' => $username,
 179                                                          'MESSAGE' => $message)
 180                                                  );
 181                                                  $emailer->send();
 182                                                  $emailer->reset();
 183                                          }
 184  
 185                                          $template->assign_vars(array(
 186                                                  'META' => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
 187                                          );
 188  
 189                                          $message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
 190  
 191                                          message_die(GENERAL_MESSAGE, $message);
 192                                  }
 193                                  else
 194                                  {
 195                                          message_die(GENERAL_ERROR, 'Could not update last email time', '', __LINE__, __FILE__, $sql);
 196                                  }
 197                          }
 198                  }
 199  
 200                  include ("includes/page_header.php");
 201  
 202                  $template->set_filenames(array(
 203                          'body' => 'profile_send_email.tpl')
 204                  );
 205                  make_jumpbox('viewforum.'.$phpEx);
 206  
 207                  if ( $error )
 208                  {
 209                          $template->set_filenames(array(
 210                                  'reg_header' => 'error_body.tpl')
 211                          );
 212                          $template->assign_vars(array(
 213                                  'ERROR_MESSAGE' => $error_msg)
 214                          );
 215                          $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
 216                  }
 217  
 218                  $template->assign_vars(array(
 219                          'USERNAME' => $username,
 220  
 221                          'S_HIDDEN_FIELDS' => '',
 222                          'S_POST_ACTION' => append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL . "=$user_id"),
 223  
 224                          'L_SEND_EMAIL_MSG' => $lang['Send_email_msg'],
 225                          'L_RECIPIENT' => $lang['Recipient'],
 226                          'L_SUBJECT' => $lang['Subject'],
 227                          'L_MESSAGE_BODY' => $lang['Message_body'],
 228                          'L_MESSAGE_BODY_DESC' => $lang['Email_message_desc'],
 229                          'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'],
 230                          'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'],
 231                          'L_OPTIONS' => $lang['Options'],
 232                          'L_CC_EMAIL' => $lang['CC_email'],
 233                          'L_SPELLCHECK' => $lang['Spellcheck'],
 234                          'L_SEND_EMAIL' => $lang['Send_email'])
 235                  );
 236  
 237                  $template->pparse('body');
 238  
 239                  include ("includes/page_tail.php");
 240          }
 241          else
 242          {
 243                  message_die(GENERAL_MESSAGE, $lang['User_prevent_email']);
 244          }
 245  }
 246  else
 247  {
 248          message_die(GENERAL_MESSAGE, $lang['User_not_exist']);
 249  }
 250  
 251  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7