📄 announce.php
字号:
<?php
class announcements
{
var $output = "";
var $base_url = "";
var $html = "";
var $forum = array( );
var $category = array( );
var $announcement = array( );
var $mem_titles = array( );
var $mod_action = array( );
var $poll_html = "";
var $colspan = 0;
var $parser = "";
var $mimetypes = "";
var $nav_extra = "";
var $read_array = array( );
var $sigs_shown = ",";
function announcements( )
{
global $ibforums;
global $DB;
global $std;
global $print;
global $skin_universal;
require( "./Skin/".$ibforums->skin_id."/skin_announce.php" );
$ibforums->lang = $std->load_words( $ibforums->lang, "lang_announce", $ibforums->lang_id );
$this->html = new skin_announce( );
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$ibforums->input['a'] = $std->is_number( $ibforums->input['a'] );
if ( $ibforums->input['a'] < 0 )
{
$std->error( array( 1, "missing_files" ) );
}
$DB->query( "SELECT id, title, pips, posts from ibf_titles ORDER BY posts DESC" );
while ( $i = $DB->fetch_row( ) )
{
$this->mem_titles[$i['id']] = array(
"TITLE" => $i['title'],
"PIPS" => $i['pips'],
"POSTS" => $i['posts']
);
}
$time_now = time( );
$DB->query( "SELECT a.*,m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts,m.aim_name,m.icq_number,m.signature, m.website,m.yahoo,m.title,m.hide_email,m.msnname, g.g_id, g.g_title, g.g_icon FROM ibf_announcements a, ibf_members m, ibf_groups g where a.a_id='".$ibforums->input[a]."' and a.a_mid=m.id AND g.g_id=m.mgroup AND ((a.a_start < '".$time_now."' AND a.a_end > '".$time_now."') OR a.a_expire = '0') " );
if ( !$DB->get_num_rows( ) )
{
$std->error( array( 1, "missing_files" ) );
}
$this->announcement = $DB->fetch_row( );
if ( $this->announcement[a_forum] )
{
$DB->query( "SELECT f.name as forum_name, f.id as forum_id, f.read_perms, f.reply_perms, f.parent_id, f.password, c.name as cat_name, c.id as cat_id FROM ibf_forums f , ibf_categories c WHERE f.id = '".$this->announcement[a_forum]."' and f.category=c.id" );
if ( !$DB->get_num_rows( ) )
{
$std->error( array( 1, "missing_files" ) );
}
$stuff = $DB->fetch_row( );
$this->forum = array(
"id" => $stuff[forum_id],
"name" => $stuff[forum_name],
"read_perms" => $stuff[read_perms],
"parent_id" => $stuff[parent_id],
"password" => $stuff[password]
);
$this->forum['where'] = "&act=SF&f=".$stuff['forum_id'];
$this->category = array(
"name" => $stuff[cat_name],
"id" => $stuff[cat_id]
);
$nav_array = array(
"<a href='".$this->base_url."&act=SC&c={$this->category['id']}'>{$this->category['name']}</a>",
$this->nav_extra,
"<a href='".$this->base_url."&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
$this->nav_extra,
"<a href='".$this->base_url."&act=SA&a={$this->announcement['a_id']}'>{$ibforums->lang['announce_bar']}</a>"
);
}
else
{
$this->forum = array( "id" => "0", "name" => "论坛首页", "read_perms" => "*", "parent_id" => "-1", "password" => "" );
$this->forum['where'] = "";
$nav_array = array(
$this->nav_extra,
"<a href='".$this->base_url."&act=SA&a={$this->announcement['a_id']}'>{$ibforums->lang['announce_bar']}</a>"
);
$this->category = array( "name" => "", "id" => "0" );
}
if ( $this->forum['id'] < "0" )
{
$std->error( array( 1, "missing_files" ) );
}
if ( !$this->announcement['a_id'] )
{
$std->error( array( 1, "missing_files" ) );
}
if ( $read = $std->my_getcookie( "topicsread" ) )
{
$this->read_array = unserialize( stripslashes( $read ) );
if ( !is_array( $this->read_array ) )
{
$this->read_array = array( );
}
}
$this->forum['JUMP'] = $std->build_forum_jump( );
$this->forum['JUMP'] = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $this->forum['JUMP'] );
$bad_entry = $this->check_access( );
if ( $bad_entry == 1 )
{
$std->error( array( 1, "no_view_announcement" ) );
}
$DB->query( "UPDATE ibf_announcements SET a_views=a_views+1 WHERE a_id='".$this->announcement['a_id']."'" );
if ( $ibforums->member['id'] )
{
$this->read_array["ann_".$this->announcement['a_id']] = time( );
$std->my_setcookie( "topicsread", serialize( $this->read_array ), -1 );
}
if ( 0 < $this->forum['parent_id'] )
{
$DB->query( "SELECT f.id as forum_id, f.name as forum_name, c.id, c.name FROM ibf_forums f, ibf_categories c WHERE f.id='".$this->forum['parent_id']."' AND c.id=f.category" );
$row = $DB->fetch_row( );
$this->category['id'] = $row['id'];
$this->category['name'] = $row['name'];
$this->nav_extra = "<a href='".$this->base_url."&act=SF&f={$row['forum_id']}'>{$row['forum_name']}</a>";
}
$this->announcement['START_DATE'] = $std->get_date( $this->announcement['a_start'], "LONG" );
$this->announcement['END_DATE'] = $this->announcement['a_expire'] ? $std->get_date( $this->announcement['a_end'], "LONG" ) : $ibforums->lang['no_expire'];
$ibforums->lang['announcement_start'] = preg_replace( "/<#START#>/", $this->announcement['START_DATE'], $ibforums->lang['announcement_start'] );
$ibforums->lang['announcement_end'] = preg_replace( "/<#END#>/", $this->announcement['END_DATE'], $ibforums->lang['announcement_end'] );
$ibforums->lang['announcement_views'] = preg_replace( "/<#VIEWS#>/", $this->announcement['a_views'], $ibforums->lang['announcement_views'] );
if ( $this->announcement['a_desc'] )
{
$this->announcement['a_desc'] = ", ".$this->announcement['a_desc'];
}
$this->output .= $this->html->pagetop( array(
"ANNOUNCEMENT" => $this->announcement,
"FORUM" => $this->forum
) );
$row = $this->announcement;
$poster = array( );
$row['name_css'] = "normalname";
$poster = $this->parse_member( &$row );
$row['post_css'] = "post1";
if ( !$ibforums->member['view_img'] )
{
$row['a_text'] = preg_replace( "/<img src=[\"'](.+?)[\"'].+?>/", "(IMG:<a href='\\1' target='_blank'>\\1</a>)", $row['a_text'] );
}
$row['post_start'] = $ibforums->lang['announcement_start'];
$row['post_end'] = $$ibforums->lang['announcement_end'];
$row['post_icon'] = $row['a_icon'] ? "<img src='".$ibforums->vars['img_url']."/icon{$row['a_icon']}.gif' alt=''> " : "";
if ( !$ibforums->vars[SIG_SEP] )
{
$ibforums->vars[SIG_SEP] = "<br><br>--------------------<br>";
}
if ( $poster['signature'] && $ibforums->member['view_sigs'] )
{
if ( $row['a_use_sig'] == 1 )
{
$row['signature'] = "<!--Signature-->{$ibforums->vars[SIG_SEP]}<span id='signature'>{$poster['signature']}</span><!--E-Signature-->";
}
else
{
$row['signature'] = "";
}
}
else
{
$row['signature'] = "";
}
if ( $poster['id'] )
{
$poster['name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$poster['id']}'>{$poster['name']}</a>";
}
$this->output .= $this->html->renderrow( array(
"ANNOUNCEMENT" => $row,
"POSTER" => $poster
) );
$this->output .= $this->html->tablefooter( array(
"ANNOUNCEMENT" => $this->announcement,
"FORUM" => $this->forum
) );
if ( $ibforums->vars['no_au_topic'] != 1 )
{
if ( $this->forum['read_perms'] != "*" )
{
$q_extra = " AND s.member_group IN (0,".$this->forum['read_perms'].") ";
}
$cut_off = $ibforums->vars['au_cutoff'] != "" ? $ibforums->vars['au_cutoff'] * 60 : 900;
$time = time( ) - $cut_off;
$DB->query( "SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix\r\n\t\t\t\t\t FROM ibf_sessions s\r\n\t\t\t\t\t LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)\r\n\t\t\t\t\t WHERE s.in_topic='{$this->topic['tid']}'\r\n\t\t\t\t\t AND s.running_time > '{$time}'".$q_extra."ORDER BY s.running_time DESC" );
$cached = array( );
$active = array( "guests" => 0, "anon" => 0, "members" => 0, "names" => "" );
while ( $result = $DB->fetch_row( ) )
{
if ( $result['member_id'] == 0 )
{
++$active['guests'];
}
else if ( empty( $cached[$result['member_id']] ) )
{
$cached[$result['member_id']] = 1;
if ( $result['login_type'] == 1 )
{
if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] && $ibforums->vars['disable_admin_anon'] != 1 )
{
$active['names'] .= "</span><a href='{$ibforums->base_url}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*, ";
++$active['anon'];
}
else
{
++$active['anon'];
}
}
else
{
++$active['members'];
$active['names'] .= "</span><a href='{$ibforums->base_url}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>, ";
}
}
}
$active['names'] = preg_replace( "/,\\s+\$/", "", $active['names'] );
$ibforums->lang['active_users_title'] = sprintf( $ibforums->lang['active_users_title'], $active['members'] + $active['guests'] + $active['anon'] );
$ibforums->lang['active_users_detail'] = sprintf( $ibforums->lang['active_users_detail'], $active['guests'], $active['anon'] );
$ibforums->lang['active_users_members'] = sprintf( $ibforums->lang['active_users_members'], $active['members'] );
$this->output = str_replace( "<!--IBF.TOPIC_ACTIVE-->", $this->html->topic_active_users( $active ), $this->output );
}
$print->add_output( "{$this->output}" );
$print->do_output( array(
"TITLE" => $ibforums->vars['board_name']." -> {$this->announcement['a_title']}",
"JS" => 1,
"NAV" => $nav_array
) );
}
function parse_member( $member = array( ) )
{
global $ibforums;
global $std;
global $DB;
$member['avatar'] = $std->get_avatar( $member['avatar'], $ibforums->member['view_avs'], $member['avatar_size'] );
$pips = 0;
foreach ( $this->mem_titles as $k => $v )
{
if ( $v['POSTS'] <= $member['posts'] )
{
if ( !$member['title'] )
{
$member['title'] = $this->mem_titles[$k]['TITLE'];
}
$pips = $v['PIPS'];
break;
}
}
if ( $member['g_icon'] )
{
$member['member_rank_img'] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/{$member['g_icon']}' border='0'>";
}
else if ( $pips )
{
if ( preg_match( "/^\\d+\$/", $pips ) )
{
$i = 1;
for ( ; $i <= $pips; ++$i )
{
$member['member_rank_img'] .= "<{A_STAR}>";
}
}
else
{
$member['member_rank_img'] = "<img src='{$ibforums->vars['TEAM_ICON_URL']}/{$pips}' border='0'>";
}
}
$member['member_joined'] = $ibforums->lang['m_joined']." ".$std->get_date( $member['joined'], "JOINED" );
$member['member_group'] = $ibforums->lang['m_group']." ".$member['g_title'];
$member['member_posts'] = $ibforums->lang['m_posts']." ".$member['posts'];
$member['member_number'] = $ibforums->lang['member_no']." ".$member['id'];
$member['profile_icon'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$member['id']}'><{P_PROFILE}></a> ";
$member['message_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$member['id']}'><{P_MSG}></a> ";
if ( !$member['hide_email'] )
{
$member['email_icon'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'><{P_EMAIL}></a> ";
}
if ( $member['website'] && preg_match( "/^http:\\/\\/\\S+\$/", $member['website'] ) )
{
$member['website_icon'] = "<a href='{$member['website']}' target='_blank'><{P_WEBSITE}></a> ";
}
if ( $member['icq_number'] )
{
$member['icq_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_ICQ}></a> ";
}
if ( $member['aim_name'] )
{
$member['aol_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_AOL}></a> ";
}
if ( $member['yahoo'] )
{
$member['yahoo_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=YAHOO&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_YIM}></a> ";
}
if ( $member['msnname'] )
{
$member['msn_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=MSN&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_MSN}></a> ";
}
return $member;
}
function check_access( )
{
global $ibforums;
global $std;
global $HTTP_COOKIE_VARS;
$return = 1;
$this->m_group = $ibforums->member['mgroup'];
if ( $this->forum['read_perms'] == "*" )
{
$return = 0;
}
else if ( preg_match( "/(^|,){$this->m_group}(,|\$)/", $this->forum['read_perms'] ) )
{
$return = 0;
}
if ( $this->forum['password'] != "" )
{
if ( !( $c_pass = $std->my_getcookie( "iBForum".$this->forum['id'] ) ) )
{
return 1;
}
if ( $c_pass == $this->forum['password'] )
{
return 0;
}
else
{
return 1;
}
}
return $return;
}
}
$idx = new announcements( );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -