admin_forum_functions.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 415 行
PHP
415 行
<?php/*+--------------------------------------------------------------------------| Invision Power Board v2.1.5| =============================================| by Matthew Mecham| (c) 2001 - 2005 Invision Power Services, Inc.| | =============================================| Web: | Time: Wed, 01 Mar 2006 19:11:29 GMT| Release: | Licence Info: +---------------------------------------------------------------------------| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $| > $Revision: 23 $| > $Author: matt $+---------------------------------------------------------------------------|| > Admin forum functions library| > Script written by Matt Mecham| > Date started: 19th November 2003|| > DBA Checked: Tue 25th May 2004+--------------------------------------------------------------------------*/class admin_forum_functions{ # Global var $ipsclass; # HTML var $html; var $type = ""; var $printed = 0; var $show_all = 0; var $skins = array(); var $need_desc = array(); /*-------------------------------------------------------------------------*/ // Forum - Build Children (of the CORN!!!) /*-------------------------------------------------------------------------*/ function forum_build_children($root_id, $temp_html="", $depth_guide="") { if ( is_array( $this->ipsclass->forums->forum_cache[ $root_id ] ) ) { foreach( $this->ipsclass->forums->forum_cache[ $root_id ] as $id => $forum_data ) { if ( $this->ipsclass->vars['forum_cache_minimum'] ) { $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->"; $this->need_desc[] = $forum_data['id']; } $temp_html .= $this->render_forum($forum_data, $depth_guide); $temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, $depth_guide . $this->ipsclass->forums->depth_guide ); } } return $temp_html; } /*-------------------------------------------------------------------------*/ // Forum - Render forum entry (NOT of the CORN!!!) /*-------------------------------------------------------------------------*/ function render_forum($r, $depth_guide="") { //----------------------------------------- // INIT //----------------------------------------- $desc = ""; $mod_string = ""; //----------------------------------------- // Skin //----------------------------------------- if ( ! $this->html ) { $this->html = $this->ipsclass->acp_load_template('cp_skin_forums'); } //----------------------------------------- // Manage forums? //----------------------------------------- if ( $this->type == 'manage' ) { //----------------------------------------- // Show main forums... //----------------------------------------- if ( ! $this->show_all ) { $children = $this->ipsclass->forums->forums_get_children( $r['id'] ); $sub = array(); $subforums = ""; $count = 0; //----------------------------------------- // Build sub-forums link //----------------------------------------- if ( count($children) ) { $r['name'] = "<a href='{$this->ipsclass->base_url}§ion=content&act=forum&f={$r['id']}'>".$r['name']."</a>"; foreach ( $children as $cid ) { $count++; $cfid = $cid; if ( $count == count($children) ) { //----------------------------------------- // Last subforum, link to parent // forum... //----------------------------------------- if ( ! $cfid = $children[ $count - 2 ] ) { $cfid = $r['id']; } } $sub[] = "<a href='{$this->ipsclass->base_url}§ion=content&act=forum&f={$this->ipsclass->forums->forum_by_id[$cid]['parent_id']}'>".$this->ipsclass->forums->forum_by_id[$cid]['name']."</a>"; } } if ( count( $sub ) ) { $subforums = '<fieldset style="margin-top:4px"><legend>Subforums</legend>'.implode( ", ", $sub ).'</fieldset>'; } $desc = "{$r['description']}{$subforums}"; } //----------------------------------------- // Moderators //----------------------------------------- foreach( $this->moderators as $phpid => $data ) { if ( $data['forum_id'] == $r['id'] ) { if ($data['is_group'] == 1) { $data['_fullname'] = 'Group: '.$data['group_name']; } else { $data['_fullname'] = $data['member_name']; } $r['_modstring'] .= $this->html->render_moderator_entry( $data ); } } //----------------------------------------- // Print //----------------------------------------- $this->skins[$r['skin_id']] = $this->skins[$r['skin_id']] ? $this->skins[$r['skin_id']] : ''; return $this->html->render_forum_row( $desc, $r, $depth_guide, $this->skins[$r['skin_id']] ); } //----------------------------------------- // REORDER //----------------------------------------- else if ( $this->type == 'reorder' ) { $this->printed++; $no_root = count( $this->ipsclass->forums->forums_get_children($this->ipsclass->input['f']) ); $reorder = "<select id='realbutton' name='f_{$r['id']}'>"; for( $i = 1 ; $i <= $no_root ; $i++ ) { $sel = ""; if ( $this->printed == $i ) { $sel = 'selected="selected" '; } $reorder .= "\n<option value='$i'{$sel}>$i</option>"; } $reorder .= "</select>\n"; return $this->html->render_reorder_row( $r, $reorder, $depth_guide ); } } /*-------------------------------------------------------------------------*/ // Forum - SHOW CAT(MEOW) (MEOW _ WOOF :&) /*-------------------------------------------------------------------------*/ function forum_show_cat($content, $r, $show_buttons=1, $show_reorder=0) { $this->printed++; $no_root = count( $this->ipsclass->forums->forum_cache['root'] ); $reorder = ""; //----------------------------------------- // Build reorder list //----------------------------------------- if ( $this->type != 'reorder' ) { $reorder = "<select id='editbutton' name='f_{$r['id']}'>"; for( $i = 1 ; $i <= $no_root ; $i++ ) { $sel = ""; if ( $this->printed == $i ) { $sel = 'selected="selected" '; } $reorder .= "\n<option value='$i'{$sel}>$i</option>"; } $reorder .= "</select>\n"; } $this->ipsclass->html .= $this->html->forum_wrapper( $content, $r, $reorder, $show_buttons, $show_reorder ); } /*-------------------------------------------------------------------------*/ // Forum - END CAT(MEOW) (MEOW _ WOOF MOO :&) /*-------------------------------------------------------------------------*/ function forum_end_cat($r=array()) { // NO LONGER USED? if ( $this->type == 'manage' ) { $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); } else if ( $this->type == 'reorder' ) { $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); } } /*-------------------------------------------------------------------------*/ // List all forums /*-------------------------------------------------------------------------*/ function forums_list_forums() { //----------------------------------------- // INIT //----------------------------------------- $this->show_all = intval($this->ipsclass->input['showall']); if ( ! $this->html ) { $this->html = $this->ipsclass->acp_load_template('cp_skin_forums'); } //----------------------------------------- // Manage forums //----------------------------------------- if ( $this->type == 'manage' ) { foreach( $this->ipsclass->cache['skin_id_cache'] as $id => $data ) { $this->skins[ $id ] = $data['set_name']; } } $temp_html = ""; $fid = intval( $this->ipsclass->input['f'] ); //----------------------------------------- // Show all forums //----------------------------------------- if ( $this->show_all ) { foreach( $this->ipsclass->forums->forum_cache['root'] as $id => $forum_data ) { $cat_data = $forum_data; $depth_guide = ""; if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) ) { foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data ) { if ( $this->ipsclass->vars['forum_cache_minimum'] ) { $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->"; $this->need_desc[] = $forum_data['id']; } $temp_html .= $this->render_forum($forum_data, $depth_guide); $temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, '<span style="color:gray">|</span>'.$depth_guide . $this->ipsclass->forums->depth_guide ); } } $this->ipsclass->html .= $this->forum_show_cat($temp_html, $cat_data); unset($temp_html); } } //----------------------------------------- // Show root forums //----------------------------------------- else if ( ! $fid ) { $seen_count = 0; $total_items = 0; foreach( $this->ipsclass->forums->forum_cache[ 'root' ] as $id => $forum_data ) { $cat_data = $forum_data; $depth_guide = ""; if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) ) { foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data ) { if ( $this->ipsclass->vars['forum_cache_minimum'] ) { $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->"; $this->need_desc[] = $forum_data['id']; } $temp_html .= $this->render_forum($forum_data, $depth_guide); } } $this->ipsclass->html .= $this->forum_show_cat($temp_html, $cat_data); unset($temp_html); } } //----------------------------------------- // Show per ID forums //----------------------------------------- else { $cat_data = $forum_data; $depth_guide = ""; if ( is_array( $this->ipsclass->forums->forum_cache[ $fid ] ) ) { $cat_data = $this->ipsclass->forums->forum_by_id[ $fid ]; $depth_guide = ""; foreach( $this->ipsclass->forums->forum_cache[ $fid ] as $id => $forum_data ) { if ( $this->ipsclass->vars['forum_cache_minimum'] ) { $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->"; $this->need_desc[] = $forum_data['id']; } $temp_html .= $this->render_forum($forum_data, $depth_guide); } } $this->ipsclass->html .= $this->forum_show_cat( $temp_html, $this->ipsclass->forums->forum_by_id[ $fid ], 0, 1 ); unset($temp_html); } //----------------------------------------- // Get descriptions? //----------------------------------------- if ( $this->ipsclass->vars['forum_cache_minimum'] and count($this->need_desc) ) { $this->ipsclass->DB->simple_construct( array( 'select' => 'id,description', 'from' => 'forums', 'where' => 'id IN('.implode( ',', $this->need_desc ) .')' ) ); $this->ipsclass->DB->simple_exec(); while( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->html = str_replace( "<!--DESCRIPTION:{$r['id']}-->", $r['description'], $this->ipsclass->html ); } } } /*-------------------------------------------------------------------------*/ // forum jumpee /*-------------------------------------------------------------------------*/ function ad_forums_forum_list($restrict=0) { if ( $restrict != 1 ) { $jump_array[] = array( '-1', '鏍圭増鍧
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?