Version 2.1.7

This commit is contained in:
Neo committed 2025-12-19 00:21:15 -08:00
1 parent 0eecc172d9
commit f73f8bff6d
941 files changed
+215301 -103093

No files matched your search

+101 -77
View File
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-12-08 16:32:40 +0000 (Thu, 08 Dec 2005) $
| > $Revision: 96 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Sending email module
@@ -36,6 +48,9 @@
class emailer {
# global
var $ipsclass;
var $from = "";
var $to = "";
var $subject = "";
@@ -49,9 +64,10 @@ class emailer {
var $mail_headers = "";
var $multipart = "";
var $boundry = "";
var $extra_opts = "";
var $html_email = 0;
var $char_set = 'iso-8859-1';
var $char_set = 'windows-1251';
var $smtp_fp = FALSE;
var $smtp_msg = "";
@@ -74,23 +90,6 @@ class emailer {
function emailer($ROOT_PATH="")
{
global $ibforums, $DB, $std;
$this->email_init();
//-----------------------------------------
// Set up SMTP if we're using it
//-----------------------------------------
if ( $ibforums->vars['mail_method'] == 'smtp' )
{
$this->mail_method = 'smtp';
$this->smtp_port = ( intval($ibforums->vars['smtp_port']) != "" ) ? intval($ibforums->vars['smtp_port']) : 25;
$this->smtp_host = ( $ibforums->vars['smtp_host'] != "" ) ? $ibforums->vars['smtp_host'] : 'localhost';
$this->smtp_user = $ibforums->vars['smtp_user'];
$this->smtp_pass = $ibforums->vars['smtp_pass'];
}
if ( $ROOT_PATH )
{
$this->root_path = $ROOT_PATH;
@@ -100,17 +99,6 @@ class emailer {
{
define( 'ROOT_PATH', $this->root_path );
}
//-----------------------------------------
// Temporarily assign $header and $footer, this can be over-riden
// also
//-----------------------------------------
$this->header = $ibforums->vars['email_header'];
$this->footer = $ibforums->vars['email_footer'];
$this->boundry = "----=_NextPart_000_0022_01C1BD6C.D0C0F9F0"; //"b".md5(uniqid(time()));
$ibforums->vars['board_name'] = $this->clean_message($ibforums->vars['board_name']);
}
/*-------------------------------------------------------------------------*/
@@ -119,16 +107,41 @@ class emailer {
function email_init()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Set up SMTP if we're using it
//-----------------------------------------
if ( $this->ipsclass->vars['mail_method'] == 'smtp' )
{
$this->mail_method = 'smtp';
$this->smtp_port = ( intval($this->ipsclass->vars['smtp_port']) != "" ) ? intval($this->ipsclass->vars['smtp_port']) : 25;
$this->smtp_host = ( $this->ipsclass->vars['smtp_host'] != "" ) ? $this->ipsclass->vars['smtp_host'] : 'localhost';
$this->smtp_user = $this->ipsclass->vars['smtp_user'];
$this->smtp_pass = $this->ipsclass->vars['smtp_pass'];
}
//-----------------------------------------
// Assign $from as the admin out email address, this can be
// over-riden at any time.
//-----------------------------------------
$this->from = $ibforums->vars['email_out'];
$this->temp_dump = $ibforums->vars['fake_mail'];
$this->wrap_brackets = $ibforums->vars['mail_wrap_brackets'];
$this->from = $this->ipsclass->vars['email_out'];
$this->temp_dump = $this->ipsclass->vars['fake_mail'];
$this->wrap_brackets = $this->ipsclass->vars['mail_wrap_brackets'];
$this->extra_opts = $this->ipsclass->vars['php_mail_extra'];
//-----------------------------------------
// Temporarily assign $header and $footer, this can be over-riden
// also
//-----------------------------------------
$this->header = $this->ipsclass->vars['email_header'];
$this->footer = $this->ipsclass->vars['email_footer'];
$this->boundry = "----=_NextPart_000_0022_01C1BD6C.D0C0F9F0"; //"b".md5(uniqid(time()));
$this->char_set = $this->ipsclass->vars['gb_char_set'];
$this->ipsclass->vars['board_name'] = $this->clean_message($this->ipsclass->vars['board_name']);
}
/*-------------------------------------------------------------------------*/
@@ -151,8 +164,6 @@ class emailer {
function build_headers()
{
global $ibforums;
//-----------------------------------------
// HTML (hitmuhl)
//-----------------------------------------
@@ -162,12 +173,17 @@ class emailer {
$this->mail_headers .= "MIME-Version: 1.0\n";
$this->mail_headers .= "Content-type: text/html; charset=\"".$this->char_set."\"\n";
}
else
{
$this->mail_headers .= "MIME-Version: 1.0\n";
$this->mail_headers .= "Content-type: text/plain; charset=\"".$this->char_set."\"\n";
}
//-----------------------------------------
// Start mail headers
//-----------------------------------------
$this->mail_headers .= "From: \"".$ibforums->vars['board_name']."\" <".$this->from.">\n";
$this->mail_headers .= "From: \"".$this->ipsclass->vars['board_name']."\" <".$this->from.">\n";
if ( $this->mail_method != 'smtp' )
{
@@ -192,6 +208,7 @@ class emailer {
$this->mail_headers .= "Return-Path: ".$this->from."\n";
$this->mail_headers .= "X-Priority: 3\n";
$this->mail_headers .= "X-Mailer: IPB PHP Mailer\n";
$this->mail_headers .= "X-Unique-ID: 52f408a2_988b02f4_b5e6f4ba_af0ae\n";
//-----------------------------------------
// Count.. oh you get the idea
@@ -259,8 +276,6 @@ class emailer {
function send_mail()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Wipe ya face
//-----------------------------------------
@@ -278,6 +293,11 @@ class emailer {
$this->subject = $this->clean_message($this->subject);
if ( $this->subject )
{
$this->subject .= " ( ".$this->ipsclass->vars['board_name']." )";
}
//-----------------------------------------
// Build headers
//-----------------------------------------
@@ -290,8 +310,6 @@ class emailer {
if ( ($this->from) and ($this->subject) )
{
$this->subject .= " ( From ".$ibforums->vars['board_name']." )";
//-----------------------------------------
// Tmp dump? (Testing)
//-----------------------------------------
@@ -310,11 +328,16 @@ class emailer {
//-----------------------------------------
// PHP MAIL()
//-----------------------------------------
if ($this->mail_method != 'smtp')
{
if ( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers ) )
if ( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers, $this->extra_opts ) )
{
$this->fatal_error("Could not send the email", "Failed at 'mail' command");
# Try without args for safe mode peeps
if ( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers ) )
{
$this->fatal_error("Could not send the email", "Failed at 'mail' command");
}
}
}
//-----------------------------------------
@@ -349,7 +372,7 @@ class emailer {
function get_template($name="", $language="")
{
global $ibforums, $IB, $DB, $lang;
global $lang;
//-----------------------------------------
// Check..
@@ -365,28 +388,28 @@ class emailer {
// Default?
//-----------------------------------------
if ( $ibforums->vars['default_language'] == "")
if ( $this->ipsclass->vars['default_language'] == "")
{
$ibforums->vars['default_language'] = 'en';
$this->ipsclass->vars['default_language'] = 'ru';
}
if ($language == "")
{
$language = $ibforums->vars['default_language'];
$language = $this->ipsclass->vars['default_language'];
}
//-----------------------------------------
// Check and get
//-----------------------------------------
if ( ! file_exists($this->root_path."lang/$language/lang_email_content.php") )
if ( ! file_exists($this->root_path."cache/lang_cache/$language/lang_email_content.php") )
{
if ( ! is_array( $lang ) )
{
$lang = array();
}
require_once( $this->root_path."lang/".$ibforums->vars['default_language']."/lang_email_content.php" );
require_once( $this->root_path."cache/lang_cache/".$this->ipsclass->vars['default_language']."/lang_email_content.php" );
}
else
{
@@ -395,7 +418,7 @@ class emailer {
$lang = array();
}
require_once( $this->root_path."lang/$language/lang_email_content.php" );
require_once( $this->root_path."cache/lang_cache/$language/lang_email_content.php" );
}
//-----------------------------------------
@@ -404,13 +427,13 @@ class emailer {
if ( ! isset($lang[ $name ]) )
{
if ( $language == $ibforums->vars['default_language'] )
if ( $language == $this->ipsclass->vars['default_language'] )
{
$this->fatal_error("Could not find an email template with an ID of '$name'", "");
}
else
{
require_once( $this->root_path."lang/".$ibforums->vars['default_language']."/lang_email_content.php" );
require_once( $this->root_path."cache/lang_cache/".$this->ipsclass->vars['default_language']."/lang_email_content.php" );
if ( ! isset($lang[ $name ]) )
{
@@ -443,8 +466,6 @@ class emailer {
function build_message($words)
{
global $ibforums;
if ($this->template == "")
{
$this->error++;
@@ -455,10 +476,10 @@ class emailer {
// Add some default words
$words['BOARD_ADDRESS'] = $ibforums->vars['board_url'] . '/index.' . $ibforums->vars['php_ext'];
$words['WEB_ADDRESS'] = $ibforums->vars['home_url'];
$words['BOARD_NAME'] = $ibforums->vars['board_name'];
$words['SIGNATURE'] = $ibforums->vars['signature'];
$words['BOARD_ADDRESS'] = $this->ipsclass->vars['board_url'] . '/index.' . $this->ipsclass->vars['php_ext'];
$words['WEB_ADDRESS'] = $this->ipsclass->vars['home_url'];
$words['BOARD_NAME'] = $this->ipsclass->vars['board_name'];
$words['SIGNATURE'] = $this->ipsclass->vars['signature'];
// Swop the words
@@ -485,7 +506,8 @@ class emailer {
$message = preg_replace( "#<u>(.+?)</u>#" , "-\\1-" , $message );
$message = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $message );
$message = preg_replace( "#<img.+?emoid=\"(.+?)\".+?".">#is", "\\1" , $message );
$message = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", "\n\n------------ CODE SAMPLE ----------\n" , $message );
$message = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", "\n-----------------------------------\n\n" , $message );
@@ -493,7 +515,7 @@ class emailer {
$message = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
$message = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , "\n-----------------------------\n\n" , $message );
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#" , "(FLASH MOVIE)" , $message );
$message = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "(IMAGE: \\1)" , $message );
$message = preg_replace( "#<a href=[\"'](http|https|ftp|news)://(\S+?)['\"].+?".">(.+?)</a>#" , "\\1://\\2" , $message );
$message = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "(EMAIL: \\2)" , $message );
@@ -518,7 +540,10 @@ class emailer {
$message = str_replace( "&#092;", "\\", $message );
$message = str_replace( "&#036;", "\$", $message );
$message = str_replace( "&#33;" , "!" , $message );
$message = str_replace( "&#34;" , '"' , $message );
$message = str_replace( "&#39;" , "'" , $message );
$message = str_replace( "&#40;" , "(" , $message );
$message = str_replace( "&#41;" , ")" , $message );
$message = str_replace( "&lt;" , "<" , $message );
$message = str_replace( "&gt;" , ">" , $message );
$message = str_replace( "&#124;", '|' , $message );
@@ -529,6 +554,7 @@ class emailer {
$message = str_replace( "&#064;", '@' , $message );
$message = str_replace( "&#60;" , '<' , $message );
$message = str_replace( "&#62;" , '>' , $message );
$message = str_replace( "&nbsp;" , ' ' , $message );
return $message;
}
@@ -539,20 +565,18 @@ class emailer {
function fatal_error($msg, $help="")
{
global $DB, $std, $ibforums;
$DB->do_insert( 'mail_error_logs',
array(
'mlog_date' => time(),
'mlog_to' => $this->to,
'mlog_from' => $this->from,
'mlog_subject' => $this->subject,
'mlog_content' => substr( $this->message, 0, 200 ),
'mlog_msg' => $msg,
'mlog_code' => $this->smtp_code,
'mlog_smtp_msg' => $this->smtp_msg
)
);
$this->ipsclass->DB->do_insert( 'mail_error_logs',
array(
'mlog_date' => time(),
'mlog_to' => $this->to,
'mlog_from' => $this->from,
'mlog_subject' => $this->subject,
'mlog_content' => substr( $this->message, 0, 200 ),
'mlog_msg' => $msg,
'mlog_code' => $this->smtp_code,
'mlog_smtp_msg' => $this->smtp_msg
)
);
return;
}