contact_member.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 807 行 · 第 1/2 页
PHP
807 行
$this->email->build_message( array( 'MOD_NAME' => $data['name'], 'USERNAME' => $this->ipsclass->member['members_display_name'], 'TOPIC' => $topic['title'], 'LINK_TO_POST' => "{$this->ipsclass->vars['board_url']}/index.{$this->ipsclass->vars['php_ext']}"."?act=ST&f=$fid&t=$tid&st=$st&#entry$pid", 'REPORT' => $report, ) ); //----------------------------------------- // Email? //----------------------------------------- if ( $this->ipsclass->vars['reportpost_method'] == 'email' OR $data['members_disable_pm'] ) { $this->email->subject = $this->ipsclass->lang['report_subject'].' '.$this->ipsclass->vars['board_name']; $this->email->to = $data['email']; $this->email->send_mail(); } //----------------------------------------- // PM? //----------------------------------------- else { $this->lib->to_by_id = $data['id']; $this->lib->from_member = $this->ipsclass->member; $this->lib->msg_title = $this->ipsclass->lang['report_subject'].' '.$topic['title']; $this->lib->msg_post = $this->email->message; $this->lib->force_pm = 1; $this->lib->send_pm(); if ( $this->lib->error ) { print $this->error; exit(); } } } $this->ipsclass->print->redirect_screen( $this->ipsclass->lang['report_redirect'], "act=ST&f=$fid&t=$tid&st=$st&#entry$pid"); } //----------------------------------------- function check_access($tid) { if ( ! $this->ipsclass->member['id'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') ); } //----------------------------------------- // Needs silly a. alias to keep oracle // happy //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => 'a.*,a.title as topic_title', 'from' => 'topics a', 'where' => "a.tid=".$tid ) ); $this->ipsclass->DB->simple_exec(); $this->topic = $this->ipsclass->DB->fetch_row(); $this->forum = $this->ipsclass->forums->forum_by_id[ $this->topic['forum_id'] ]; $return = 1; if ( $this->ipsclass->check_perms($this->forum['read_perms']) == TRUE ) { $return = 0; } if ($this->forum['password']) { if ($_COOKIE[ $this->ipsclass->vars['cookie_id'].'iBForum'.$this->forum['id'] ] == $this->forum['password']) { $return = 0; } } if ($return == 1) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') ); } } /*-------------------------------------------------------------------------*/ // MAIL MEMBER: // // Handles the routines called by clicking on the "email" button when // reading topics /*-------------------------------------------------------------------------*/ function mail_member() { require "./sources/classes/class_email.php"; $this->email = new emailer(); $this->email->ipsclass =& $this->ipsclass; $this->email->email_init(); //----------------------------------------- $this->ipsclass->load_language('lang_emails'); $this->ipsclass->load_template('skin_emails'); //----------------------------------------- if (empty($this->ipsclass->member['id'])) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_guests' ) ); } if ( ! $this->ipsclass->member['g_email_friend'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_member_mail' ) ); } //----------------------------------------- if ($this->ipsclass->input['CODE'] == '01') { $this->mail_member_send(); } else { // Show the form, booo... $this->mail_member_form(); } } function mail_member_form($errors="", $extra = "") { $this->ipsclass->input['MID'] = intval($this->ipsclass->input['MID']); if ( $this->ipsclass->input['MID'] < 1 ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) ); } //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => 'name, members_display_name, id, email, hide_email', 'from' => 'members', 'where' => "id=".$this->ipsclass->input['MID'] ) ); $this->ipsclass->DB->simple_exec(); $member = $this->ipsclass->DB->fetch_row(); //----------------------------------------- if (! $member['id'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) ); } if ($member['hide_email'] == 1) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) ); } //----------------------------------------- if ( $errors != "" ) { $msg = $this->ipsclass->lang[$errors]; if ( $extra != "" ) { $msg = str_replace( "<#EXTRA#>", $extra, $msg ); } $this->output .= $this->ipsclass->compiled_templates['skin_emails']->errors( $msg ); } //----------------------------------------- $this->output .= $this->ipsclass->vars['use_mail_form'] ? $this->ipsclass->compiled_templates['skin_emails']->send_form( array( 'NAME' => $member['members_display_name'], 'TO' => $member['id'], 'subject'=> $this->ipsclass->input['subject'], 'content'=> stripslashes(htmlspecialchars($_POST['message'])), ) ) : $this->ipsclass->compiled_templates['skin_emails']->show_address( array( 'NAME' => $member['members_display_name'], 'ADDRESS' => $member['email'], ) ); $this->page_title = $this->ipsclass->lang['member_address_title']; $this->nav = array( $this->ipsclass->lang['member_address_title'] ); } //----------------------------------------- function mail_member_send() { $this->ipsclass->input['to'] = intval($this->ipsclass->input['to']); if ( $this->ipsclass->input['to'] == 0 ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) ); } //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => 'name, members_display_name, id, email, hide_email', 'from' => 'members', 'where' => "id=".$this->ipsclass->input['to'] ) ); $this->ipsclass->DB->simple_exec(); $member = $this->ipsclass->DB->fetch_row(); //----------------------------------------- // Check for schtuff //----------------------------------------- if (! $member['id'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) ); } //----------------------------------------- if ($member['hide_email'] == 1) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) ); } //----------------------------------------- // Check for blanks //----------------------------------------- $check_array = array ( 'message' => 'no_message', 'subject' => 'no_subject' ); foreach ($check_array as $input => $msg) { if (empty($this->ipsclass->input[$input])) { $this->ipsclass->input['MID'] = $this->ipsclass->input['to']; $this->mail_member_form($msg); return; } } //----------------------------------------- // Check for spam / delays //----------------------------------------- $email_check = $this->_allow_to_email( $this->ipsclass->member['id'], $this->ipsclass->member['g_email_limit'] ); if ( $email_check != TRUE ) { $this->ipsclass->input['MID'] = $this->ipsclass->input['to']; $this->mail_member_form( $this->int_error, $this->int_extra); return; } //----------------------------------------- // Send the email //----------------------------------------- $this->email->get_template("email_member"); $this->email->build_message( array( 'MESSAGE' => str_replace( "<br>", "\n", str_replace( "\r", "", $this->ipsclass->input['message'] ) ), 'MEMBER_NAME' => $member['members_display_name'], 'FROM_NAME' => $this->ipsclass->member['members_display_name'] ) ); $this->email->subject = $this->ipsclass->input['subject']; $this->email->to = $member['email']; $this->email->from = $this->ipsclass->member['email']; $this->email->send_mail(); //----------------------------------------- // Store email in the database //----------------------------------------- $this->ipsclass->DB->do_insert( 'email_logs', array( 'email_subject' => $this->ipsclass->input['subject'], 'email_content' => $this->ipsclass->input['message'], 'email_date' => time(), 'from_member_id' => $this->ipsclass->member['id'], 'from_email_address' => $this->ipsclass->member['email'], 'from_ip_address' => $this->ipsclass->input['IP_ADDRESS'], 'to_member_id' => $member['id'], 'to_email_address' => $member['email'], ) ); //----------------------------------------- // Print the success page //----------------------------------------- $forum_jump = $this->ipsclass->build_forum_jump(); $this->output = $this->ipsclass->compiled_templates['skin_emails']->sent_screen($member['members_display_name']); $this->output .= $this->ipsclass->compiled_templates['skin_emails']->forum_jump($forum_jump); $this->page_title = $this->ipsclass->lang['email_sent']; $this->nav = array( $this->ipsclass->lang['email_sent'] ); } //----------------------------------------- // CHECK FLOOD LIMIT // Returns TRUE if able to email // FALSE if not //----------------------------------------- function _allow_to_email($member_id, $email_limit) { $member_id = intval($member_id); if ( ! $member_id ) { $this->int_error = 'gen_error'; return FALSE; } list( $limit, $flood ) = explode( ':', $email_limit ); if ( ! $limit and ! $flood ) { return TRUE; } //----------------------------------------- // Get some stuff from the DB! // 1) FLOOD? //----------------------------------------- if ( $flood ) { $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'email_logs', 'where' => "from_member_id=$member_id", 'order' => 'email_date DESC', 'limit' => array(0,1) ) ); $this->ipsclass->DB->simple_exec(); $last_email = $this->ipsclass->DB->fetch_row(); if ( $last_email['email_date'] + ($flood * 60) > time() ) { $this->int_error = 'exceeded_flood'; $this->int_extra = $flood; return FALSE; } } if ( $limit ) { $time_range = time() - 86400; $this->ipsclass->DB->simple_construct( array( 'select' => 'count(email_id) as cnt', 'from' => 'email_logs', 'where' => "from_member_id=$member_id AND email_date > $time_range", ) ); $this->ipsclass->DB->simple_exec(); $quota_sent = $this->ipsclass->DB->fetch_row(); if ( $quota_sent['cnt'] + 1 > $limit ) { $this->int_error = 'exceeded_quota'; $this->int_extra = limit; return FALSE; } } return TRUE; // If we get here... } function regex_bash_hex($hex_entity) { return html_entity_decode( "&#".hexdec( $hex_entity ).";" ); } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?