This is the whole section. I get the same type of error from “if ( $extra[‘from_email’] )” at line 107. So the two problems are line 57 and 107.
[php] #=======================================
# @ Send Email
# Sends an email.
#=======================================
function send_email($recipient, $message, $replacements='', $extra='', $reply_line=0)
{
if ( ! is_array( $recipient ) )
{
$old_recp = $recipient;
unset( $recipient );
$recipient[] = $old_recp;
}
$this->core->load_module('email');
if ( $this->core->cache['config']['email_method'] == 'native' )
{
$email_int = array( 'method' => 'native' );
}
elseif ( $this->core->cache['config']['email_method'] == 'smtp' )
{
$email_int = array( 'method' => 'smtp', 'smtp_host' => $this->core->cache['config']['smtp_host'], 'smtp_port' => $this->core->cache['config']['smtp_port'], 'smtp_user' => $this->core->cache['config']['smtp_user'], 'smtp_pass' => $this->convert_html( $this->core->cache['config']['smtp_pass'] ), 'smtp_encrypt' => $this->core->cache['config']['smtp_encryption'] );
}
$this->core->email->initialize( $email_int );
$langid = $this->member['lang'];
if ( ! $langid ) $langid = $this->core->cache['lang']['default'];
require HD_PATH. "language/". $langid ."/lang_email_content.php";
while ( list( , $member_id ) = each( $recipient ) )
{
$this->core->db->construct( array(
'select' => array( 'id', 'name', 'email', 'email_html' ),
'from' => 'members',
'where' => array( 'id', '=', $member_id ),
'limit' => array( 0, 1 ),
) );
$this->core->db->execute();
if ( $this->core->db->get_num_rows() == 1 )
{
$mem = $this->core->db->fetch_row();
if ( $extra['over_email'] )
{
$this->core->email->add_recipient( $extra['over_email'] );
$replacements['MEM_EMAIL'] = $extra['over_email'];
}
else
{
$this->core->email->add_recipient( $mem['email'] );
$replacements['MEM_EMAIL'] = $mem['email'];
}
$subject = $lang[ $message ."_sub" ];
$replacements['MEM_NAME'] = $mem['name'];
$replacements['MEM_ID'] = $mem['id'];
$replacements['HD_NAME'] = $this->core->cache['config']['hd_name'];
$replacements['HD_URL'] = $this->core->cache['config']['hd_url'];
$email_msg = $lang['header'] ."\n\n" . $lang[ $message ] ."\n\n" . $lang['footer'];
if ( $reply_line && $this->core->cache['config']['email_use_rline'] )
{
$email_msg = $this->core->cache['config']['email_reply_line'] ."\n\n". $email_msg;
}
foreach( $replacements as $search => $replace )
{
if ( $mem['email_html'] )
{
$replaceb = $replace;
}
else
{
$replaceb = preg_replace( "/<p>(.+?)<\/p>/", "$1\n\n", $this->convert_html( $replace ) );
$replaceb = str_replace( '<br />', "\n", $replaceb );
}
$email_msg = str_replace( "<#". $search ."#>", $replaceb, $email_msg );
$subject = str_replace( "<#". $search ."#>", $replace, $subject );
}
foreach ( $this->lang as $langkey => $langvalue )
{
$email_msg = str_replace("{lang.". $langkey ."}", $langvalue, $email_msg);
}
$config = array(
'from_email' => $this->core->cache['config']['out_email'],
'from_name' => $this->convert_html( $this->core->cache['config']['hd_name'] ),
);
if ( $extra['from_email'] )
{
$config['from_email'] = $extra['from_email'];
}
$this->core->email->update_config( $config );
$this->core->email->set_subject( html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ) );
if ( $mem['email_html'] )
{
$this->core->email->add_message( html_entity_decode( $this->convert_html( str_replace( ' ', " ", $email_msg ) ), ENT_QUOTES, 'UTF-8' ) );
$this->core->email->add_message( html_entity_decode( $this->convert_html( nl2br( str_replace( ' ', " ", $email_msg ) ) ), ENT_QUOTES, 'UTF-8' ), 'text/html' );
}
else
{
$this->core->email->add_message( html_entity_decode( $this->convert_html( str_replace( ' ', " ", $email_msg ) ), ENT_QUOTES, 'UTF-8' ) );
}
$this->core->email->send_email();
$this->core->email->flush();
}
}
}
[/php]