topics.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,929 行 · 第 1/5 页
PHP
1,929 行
if ( $this->topic_view_mode == 'linearplus' ) { $this->topic['to_button_standard'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linear".$linear_pid, $this->ipsclass->lang['tom_standard'] ); $this->topic['to_button_linearpl'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_on( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linearplus".$linear_pid, $this->ipsclass->lang['tom_linear'] ); } else { $this->topic['to_button_standard'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_on( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linear".$linear_pid, $this->ipsclass->lang['tom_standard'] ); $this->topic['to_button_linearpl'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linearplus".$linear_pid, $this->ipsclass->lang['tom_linear'] ); } } //----------------------------------------- // Remove potential [attachmentid= tag in title //----------------------------------------- $this->topic['title'] = str_replace( '[attachmentid=', '[attachmentid=', $this->topic['title'] ); //----------------------------------------- // Load and run lib //----------------------------------------- $this->func = $this->ipsclass->load_class( ROOT_PATH . 'sources/lib/func_'.$require, 'topic_display' ); $this->func->register_class( $this ); $this->func->display_topic(); $this->output .= $this->func->output; //----------------------------------------- // Do we have a poll? //----------------------------------------- if ( $this->topic['poll_state'] ) { $this->output = str_replace( "<!--{IBF.POLL}-->", $this->parse_poll(), $this->output ); } else { // Can we start a poll? Is this our topic and is it still open? if ( $this->topic['state'] != "closed" AND $this->ipsclass->member['id'] AND $this->ipsclass->member['g_post_polls'] AND $this->forum['allow_poll'] ) { if ( ( ($this->topic['starter_id'] == $this->ipsclass->member['id']) AND ($this->ipsclass->vars['startpoll_cutoff'] > 0) AND ( $this->topic['start_date'] + ($this->ipsclass->vars['startpoll_cutoff'] * 3600) > time() ) ) OR ( $this->ipsclass->member['g_is_supmod'] == 1 ) ) { $this->output = str_replace( "<!--{IBF.START_NEW_POLL}-->", $this->ipsclass->compiled_templates['skin_topic']->start_poll_link($this->forum['id'], $this->topic['tid']), $this->output ); } } } //----------------------------------------- // ATTACHMENTS!!! //----------------------------------------- /*if ( $this->topic['topic_hasattach'] ) { $this->output = $this->parse_attachments( $this->output, $this->attach_pids ); }*/ //Hide the Attachments for Guest if ( $this->topic['topic_hasattach'] and $this->ipsclass->member['id'] > 0 ) { $this->output = $this->parse_attachments( $this->output, $this->attach_pids ); } else { $this->output = preg_replace( "#\[attachmentid=(\d+)\]#is", $this->ipsclass->lang['guest_cant'], $this->output ); } // Still seeing attachment tags? if ( stristr( $this->output, "[attachmentid=" ) ) { $this->output = preg_replace( "#\[attachmentid=(\d+)\]#is", "", $this->output ); } //----------------------------------------- // Process users active in this forum //----------------------------------------- if ($this->ipsclass->vars['no_au_topic'] != 1) { //----------------------------------------- // Get the users //----------------------------------------- $cut_off = ($this->ipsclass->vars['au_cutoff'] != "") ? $this->ipsclass->vars['au_cutoff'] * 60 : 900; $this->ipsclass->DB->cache_add_query( 'topics_get_active_users', array( 'tid' => $this->topic['tid'], 'time' => time() - $cut_off, ) ); $this->ipsclass->DB->simple_exec(); //----------------------------------------- // ACTIVE USERS //----------------------------------------- $ar_time = time(); $cached = array(); $active = array( 'guests' => 0, 'anon' => 0, 'members' => 0, 'names' => ""); $rows = array( $ar_time => array( 'login_type' => substr($this->ipsclass->member['login_anonymous'],0, 1), 'running_time' => $ar_time, 'member_id' => $this->ipsclass->member['id'], 'member_name' => $this->ipsclass->member['members_display_name'], 'member_group' => $this->ipsclass->member['mgroup'] ) ); //----------------------------------------- // FETCH... //----------------------------------------- while ($r = $this->ipsclass->DB->fetch_row() ) { $rows[ $r['running_time'].'.'.$r['id'] ] = $r; } krsort( $rows ); //----------------------------------------- // PRINT... //----------------------------------------- foreach( $rows as $i => $result ) { $result['suffix'] = $this->ipsclass->cache['group_cache'][ $result['member_group'] ]['suffix']; $result['prefix'] = $this->ipsclass->cache['group_cache'][ $result['member_group'] ]['prefix']; $last_date = $this->ipsclass->get_time( $result['running_time'] ); if ($result['member_id'] == 0) { $active['guests']++; } else { if (empty( $cached[ $result['member_id'] ] ) ) { $cached[ $result['member_id'] ] = 1; $p_start = ""; $p_end = ""; $p_title = " title='".sprintf( $this->ipsclass->lang['au_reading'], $last_date )."' "; if ( strstr( $result['location'], 'post' ) and $result['member_id'] != $this->ipsclass->member['id'] ) { $p_start = "<span class='activeuserposting'>"; $p_end = "</span>"; $p_title = " title='".sprintf( $this->ipsclass->lang['au_posting'], $last_date )."' "; } if ($result['login_type'] == 1) { if ( ($this->ipsclass->member['mgroup'] == $this->ipsclass->vars['admin_group']) and ($this->ipsclass->vars['disable_admin_anon'] != 1) ) { $active['names'] .= "$p_start<a href='{$this->ipsclass->base_url}showuser={$result['member_id']}'$p_title>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*$p_end, "; $active['anon']++; } else { $active['anon']++; } } else { $active['members']++; $active['names'] .= "$p_start<a href='{$this->ipsclass->base_url}showuser={$result['member_id']}'$p_title>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>$p_end, "; } } } } $active['names'] = preg_replace( "/,\s+$/", "" , $active['names'] ); $this->ipsclass->lang['active_users_title'] = sprintf( $this->ipsclass->lang['active_users_title'] , ($active['members'] + $active['guests'] + $active['anon'] ) ); $this->ipsclass->lang['active_users_detail'] = sprintf( $this->ipsclass->lang['active_users_detail'] , $active['guests'],$active['anon'] ); $this->ipsclass->lang['active_users_members'] = sprintf( $this->ipsclass->lang['active_users_members'], $active['members'] ); $this->output = str_replace( "<!--IBF.TOPIC_ACTIVE-->", $this->ipsclass->compiled_templates['skin_topic']->topic_active_users($active), $this->output ); } //----------------------------------------- // Print it //----------------------------------------- if ( $this->ipsclass->member['is_mod'] ) { $this->output = str_replace( "<!--IBF.MOD_PANEL-->", $this->moderation_panel(), $this->output ); } else { $this->output = str_replace( "<!--IBF.MOD_PANEL_NO_MOD-->", $this->moderation_panel(), $this->output ); } //----------------------------------------- // Enable quick reply box? //----------------------------------------- if ( ( $this->forum['quick_reply'] == 1 ) and ( $this->ipsclass->check_perms( $this->forum['reply_perms']) == TRUE ) and ( $this->topic['state'] != 'closed' ) ) { $show = "none"; $sqr = $this->ipsclass->my_getcookie("open_qr"); if ( $sqr == 1 ) { $show = "show"; } $this->output = str_replace( "<!--IBF.QUICK_REPLY_CLOSED-->", $this->ipsclass->compiled_templates['skin_topic']->quick_reply_box_closed(), $this->output ); $this->output = str_replace( "<!--IBF.QUICK_REPLY_OPEN-->" , $this->ipsclass->compiled_templates['skin_topic']->quick_reply_box_open($this->topic['forum_id'], $this->topic['tid'], $show, $this->md5_check), $this->output ); } $this->topic['id'] = $this->topic['forum_id']; $this->output = str_replace( "<!--IBF.FORUM_RULES-->", $this->ipsclass->print_forum_rules($this->forum), $this->output ); //----------------------------------------- // Topic multi-moderation - yay! //----------------------------------------- $this->output = str_replace( "<!--IBF.MULTIMOD-->", $this->multi_moderation(), $this->output ); // Pass it to our print routine $this->ipsclass->print->add_output("$this->output"); $this->ipsclass->print->do_output( array( 'TITLE' => $this->topic['title'] . ' - ' . $this->ipsclass->vars['board_name'], 'JS' => 1, 'NAV' => $this->nav, ) ); } /*-------------------------------------------------------------------------*/ // ATTACHMENTS /*-------------------------------------------------------------------------*/ function parse_attachments( $html, $attach_pids, $type='attach_pid', $from='pid', $method='post' ) { $final_attachments = array(); if ( count( $attach_pids ) ) { $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "$type IN (".implode(",", $attach_pids).")" ) ); $this->ipsclass->DB->simple_exec(); while ( $a = $this->ipsclass->DB->fetch_row() ) { $final_attachments[ $a[ $type ] ][ $a['attach_id'] ] = $a; } foreach ( $final_attachments as $pid => $data ) { $temp_out = ""; $temp_hold = array(); foreach( $final_attachments[$pid] as $aid => $row ) { //----------------------------------------- // Is it an image, and are we viewing the image in the post? //----------------------------------------- if ( $this->ipsclass->vars['show_img_upload'] and $row['attach_is_image'] ) { if ( $this->ipsclass->vars['siu_thumb'] AND $row['attach_thumb_location'] AND $row['attach_thumb_width'] ) { $tmp = $this->ipsclass->compiled_templates['skin_topic']->Show_attachments_img_thumb( $row['attach_thumb_location'], $row['attach_thumb_width'], $row['attach_thumb_height'], $row['attach_id'], $this->ipsclass->size_format( $row['attach_filesize'] ), $row['attach_hits'], $row['attach_file'], $method ); if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) ) { $html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html ); } else { $temp_hold['thumb'] .= $tmp . ' '; } } else { //----------------------------------------- // Standard size.. //----------------------------------------- $tmp = $this->ipsclass->compiled_templates['skin_topic']->Show_attachments_img( $row['attach_location'] ); if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) ) { $html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html ); } else { $temp_hold['image'] .= $tmp . ' '; } } } else { //----------------------------------------- // Full attachment thingy //----------------------------------------- /*$tmp = $this->ipsclass->compiled_templates['skin_topic']->Show_attachments( array ( 'hits' => $row['attach_hits'], 'image' => $this->ipsclass->cache['attachtypes'][ $row['attach_ext'] ]['atype_img'], 'name' => $row['attach_file'], $from => $row[$type], 'id' => $row['attach_id'], 'method'=> $method, 'size' => $this->ipsclass->size_format( $row['attach_filesize'] ), ) );*/ // BT switch( $row['attach_ext'] ) { case 'torrent' : $row = $this->get_torrent_info( $row ); $row['image'] = $this->ipsclass->cache['attachtypes'][ $row['attach_ext'] ]['atype_img']; $row['hits'] = $row['attach_hits']; $row['name'] = $row['attach_file']; $row[ $from ] = $row[ $type ]; $row['id'] = $row['attach_id']; $row['method'] = $method; $row['size'] = $this->ipsclass->size_format( $row['attach_filesize'] ); $tmp = $this->ipsclass->compiled_templates['skin_topic']->show_torrent_info($row); break; default : $tmp = $this->ipsclass->compiled_templates['skin_topic']->Show_attachments( array ( 'hits' => $row['attach_hits'], 'image' => $this->ipsclass->cache['attachtypes'][ $row['attach_ext'] ]['atype_img'], 'name' => $row['attach_file'], $from => $row[$type], 'id' => $row['attach_id'], 'method'=> $method, 'size' => $this->ipsclass->size_format( $row['attach_filesize'] ), ) ); break; } // BT Over if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) ) { $html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html ); } else { $temp_hold['attach'] .= $tmp; } } } //----------------------------------------- // Anyfink to show? //----------------------------------------- if ( $temp_hold['thumb'] ) { $temp_out = $this->ipsclass->compiled_templates['skin_topic']->show_attachment_title($this->ipsclass->lang['attach_thumbs']) . $temp_hold['thumb']; } if ( $temp_hold['image'] ) { $temp_out .= $this->ipsclass->compiled_templates['skin_topic']->show_attachment_title($this->ipsclass->lang['attach_images']) . $temp_hold['image']; } if ( $temp_hold['attach'] ) { $temp_out .= $this->ipsclass->compiled_templates['skin_topic']->show_attachment_title($this->ipsclass->lang['attach_normal']) . $temp_hold['attach'];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?