class_post.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 2,030 行 · 第 1/5 页
PHP
2,030 行
} else if ( count($this->ipsclass->cache['moderators']) ) { foreach( $this->ipsclass->cache['moderators'] as $i => $moderators ) { if ( $moderators['member_id'] == $r['id'] or $moderators['group_id'] == $r['mgroup'] ) { $mod = 1; } } } if( $mod == 0 ) { continue; } } $count++; $r['language'] = $r['language'] ? $r['language'] : 'en'; if ($r['email_full'] == 1) { $this->email->get_template("subs_with_post", $r['language']); $this->email->build_message( array( 'TOPIC_ID' => $r['topic_id'], 'FORUM_ID' => $r['forum_id'], 'TITLE' => $r['title'], 'NAME' => $r['name'], 'POSTER' => $poster, 'POST' => $post, ) ); } else { $this->email->get_template("subs_no_post", $r['language']); $this->email->build_message( array( 'TOPIC_ID' => $r['topic_id'], 'FORUM_ID' => $r['forum_id'], 'TITLE' => $r['title'], 'NAME' => $r['name'], 'POSTER' => $poster, ) ); } $trids[] = $r['trid']; //----------------------------------------- // Add to mail queue //----------------------------------------- $this->ipsclass->DB->do_insert( 'mail_queue', array( 'mail_to' => $r['email'], 'mail_date' => time(), 'mail_subject' => $this->ipsclass->lang['tt_subject'], 'mail_content' => $this->email->message ) ); } $this->ipsclass->cache['systemvars']['mail_queue'] += $count; //----------------------------------------- // Update cache with remaning email count //----------------------------------------- $this->ipsclass->DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($this->ipsclass->cache['systemvars'])) ), "cs_key='systemvars'" ); } return TRUE; } /*-------------------------------------------------------------------------*/ // Forum tracker /*-------------------------------------------------------------------------*/ function forum_tracker($fid="", $this_tid="", $title="", $forum_name="", $post="") { if ($this_tid == "") { return TRUE; } if ($fid == "") { return TRUE; } //----------------------------------------- // Work out the time stamp needed to "guess" // if the user is still active on the board // We will base this guess on a period of // non activity of time_now - 30 minutes. //----------------------------------------- $time_limit = time() - (30*60); $count = 0; $gotem = array(); $this->ipsclass->DB->build_query( array( 'select' => 'tr.frid', 'from' => array( 'forum_tracker' => 'tr' ), 'where' => 'tr.forum_id='.$fid." AND ( ( tr.forum_track_type='delayed' AND m.last_activity < {$time_limit} ) OR tr.forum_track_type='immediate' )", 'add_join' => array( 0 => array( 'select' => 'm.name, m.email, m.id, m.language, m.last_activity, m.org_perm_id, m.mgroup_others', 'from' => array( 'members' => 'm' ), 'where' => "tr.member_id=m.id AND m.id <> {$this->ipsclass->member['id']}", 'type' => 'inner' ), 1 => array( 'select' => 'g.g_perm_id', 'from' => array( 'groups' => 'g' ), 'where' => "m.mgroup=g.g_id", 'type' => 'inner' ) ) ) ); $this->ipsclass->DB->exec_query(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $gotem[ $r['id'] ] = $r; } //----------------------------------------- // Get "all" groups? //----------------------------------------- if ( $this->ipsclass->vars['autoforum_sub_groups'] ) { $this->ipsclass->DB->build_query( array( 'select' => 'm.name, m.email, m.id, m.language, m.last_activity, m.org_perm_id, m.mgroup_others', 'from' => array( 'members' => 'm' ), 'where' => "m.mgroup IN ({$this->ipsclass->vars['autoforum_sub_groups']}) AND m.id <> {$this->ipsclass->member['id']} AND m.allow_admin_mails=1 AND m.last_activity < {$time_limit}", 'add_join' => array( 0 => array( 'select' => 'g.g_perm_id', 'from' => array( 'groups' => 'g' ), 'where' => "m.mgroup=g.g_id", 'type' => 'inner' ) ) ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $gotem[ $r['id'] ] = $r; } } //----------------------------------------- // Row, row and parse, parse //----------------------------------------- if ( count( $gotem ) ) { foreach( $gotem as $mid => $r ) { $count++; $mgroup_others = ""; $temp_mgroups = array(); $mgroup_perms = array(); if( $r['mgroup_others'] ) { $r['mgroup_others'] = $this->ipsclass->clean_perm_string( $r['mgroup_others'] ); $temp_mgroups = explode( ",", $r['mgroup_others'] ); if( count($temp_mgroups) ) { foreach( $temp_mgroups as $other_mgroup ) { $mgroup_perms[] = $this->ipsclass->cache['group_cache'][ $other_mgroup ]['g_perm_id']; } } if( count($mgroup_perms) ) { $mgroup_others = ",".implode( ",", $mgroup_perms ).","; } } $perm_id = ( $r['org_perm_id'] ) ? $r['org_perm_id'] : $r['g_perm_id'].$mgroup_others; //$perm_id = ( $r['org_perm_id'] ) ? $r['org_perm_id'] : $r['g_perm_id']; // INIT $permissions = array(); $tmp_perms = array(); $forum_perms = array(); $tmp_perms = explode( ",", $perm_id ); if( is_array($tmp_perms) ) { foreach( $tmp_perms as $k => $v ) { if( $v != "" ) { $permissions[] = $v; } } unset($tmp_perms); } else { $permissions[] = $perm_id; } if ($this->forum['read_perms'] != '*') { $pass = 0; if( strpos( $this->forum['read_perms'], "," ) ) { $forum_perms = explode( ",", $this->forum['read_perms'] ); } else { $forum_perms = array( $this->forum['read_perms'] ); } foreach( $permissions as $k => $v ) { if( in_array( $v, $forum_perms ) ) { $pass = 1; } } if ( $pass == 0 ) { continue; } } unset($permissions); unset($forum_perms); $r['language'] = $r['language'] ? $r['language'] : 'en'; $this->email->get_template("subs_new_topic", $r['language']); $this->email->build_message( array( 'TOPIC_ID' => $this_tid, 'FORUM_ID' => $fid, 'TITLE' => $title, 'NAME' => $r['name'], 'POSTER' => $this->ipsclass->member['members_display_name'], 'FORUM' => $forum_name, 'POST' => $post, ) ); $this->ipsclass->DB->do_insert( 'mail_queue', array( 'mail_to' => $r['email'], 'mail_date' => time(), 'mail_subject' => $this->ipsclass->lang['ft_subject'], 'mail_content' => $this->email->message ) ); } } $this->ipsclass->cache['systemvars']['mail_queue'] += $count; //----------------------------------------- // Update cache with remaning email count //----------------------------------------- $this->ipsclass->DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($this->ipsclass->cache['systemvars'])) ), "cs_key='systemvars'" ); return TRUE; } /*-------------------------------------------------------------------------*/ // Compile poll /*-------------------------------------------------------------------------*/ function compile_poll() { //----------------------------------------- // Check poll //----------------------------------------- $questions = array(); $choices_count = 0; $is_mod = $this->ipsclass->member['g_is_supmod'] ? $this->ipsclass->member['g_is_supmod'] : intval($this->moderator['edit_topic']); if ( $this->can_add_poll ) { if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) ) { $has_poll = 1; foreach( $_POST['question'] as $id => $q ) { if ( ! $q OR ! $id ) { continue; } $questions[ $id ]['question'] = $this->ipsclass->parse_clean_value( $q ); } } //----------------------------------------- // Choices... //----------------------------------------- if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) ) { foreach( $_POST['choice'] as $mainid => $choice ) { list( $question_id, $choice_id ) = explode( "_", $mainid ); $question_id = intval( $question_id ); $choice_id = intval( $choice_id ); if ( ! $question_id OR ! isset($choice_id) ) { continue; } if ( ! $questions[ $question_id ]['question'] ) { continue; } $questions[ $question_id ]['choice'][ $choice_id ] = $this->ipsclass->parse_clean_value( $choice ); if ( ! $is_mod ) { $questions[ $question_id ]['votes'][ $choice_id ] = 0; } else { $questions[ $question_id ]['votes'][ $choice_id ] = intval( $_POST['votes'][ $question_id.'_'.$choice_id ] ); } $this->poll_total_votes += $questions[ $question_id ]['votes'][ $choice_id ]; } } //----------------------------------------- // Make sure we have choices for each //----------------------------------------- foreach( $questions as $id => $data ) { if ( ! is_array( $data['choice'] ) OR ! count( $data['choice'] ) ) { unset( $questions[ $id ] ); } else { $choices_count += intval( count( $data['choice'] ) ); } } //----------------------------------------- // Error check... //----------------------------------------- if ( count( $questions ) > $this->max_poll_questions ) { $this->obj['post_errors'] = 'poll_to_many'; } if ( count( $choices_count ) > ( $this->max_poll_questions * $this->max_poll_choices_per_question ) ) { $this->obj['post_errors'] = 'poll_to_many'; } } return $questions; } /*-------------------------------------------------------------------------*/ // compile post // ------------------ // Compiles all the incoming information into an array // which is returned to the accessor /*-------------------------------------------------------------------------*/ function compile_post() { $this->ipsclass->vars['max_post_length'] = $this->ipsclass->vars['max_post_length'] ? $this->ipsclass->vars['max_post_length'] : 2140000; //----------------------------------------- // Sort out some of the form data, check for posting length, etc. // THIS MUST BE CALLED BEFORE CHECKING ATTACHMENTS //----------------------------------------- $this->ipsclass->input['enablesig'] = $this->ipsclass->input['enablesig'] == 'yes' ? 1 : 0; $this->ipsclass->input['enableemo'] = $this->ipsclass->input['enableemo'] == 'yes' ? 1 : 0; $this->ipsclass->input['enabletrack'] = intval($this->ipsclass->input['enabletrack']) != 0 ? 1 : 0; //----------------------------------------- // Do we have a valid post? //----------------------------------------- if (strlen( trim($_POST['Post']) ) < 1) { if ( ! $_POST['preview'] ) { $this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_post') ); } } if (strlen( $_POST['Post'] ) > ($this->ipsclass->vars['max_post_length']*1024))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?