📄 ad_plugins.php
字号:
<?php
class ad_plugins
{
var $base_url;
function ad_plugins( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
}
if ( $MEMBER['mgroup'] != $INFO['admin_group'] )
{
$ADMIN->error( "对不起,只有管理员团队用户才能使用此功能!" );
}
switch ( $IN['code'] )
{
case "ipchat" :
$this->chat_splash( );
break;
case "chatframe" :
$this->chat_frame( );
break;
case "chatsave" :
$this->chat_save( );
break;
case "dochat" :
$this->chat_config_save( );
break;
default :
exit( );
}
}
function chat_splash( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
if ( $INFO['chat_account_no'] )
{
$this->chat_config( );
}
else
{
$frames = "<html>\n\t\t \t\t\t <head><title>华酷论坛:在线聊天设置</title></head>\n\t\t\t\t\t <frameset rows='*,50' frameborder='yes' border='1' framespacing='0'>\n\t\t\t\t\t \t<frame name='chat_top' scrolling='auto' src='http://www.invisionchat.com/?acp++acp'>\n\t\t\t\t\t \t<frame name='chat_bottom' scrolling='auto' src='{$SKIN->base_url}&act=pin&code=chatframe'>\n\t\t\t\t\t </frameset>\n\t\t\t\t </html>";
print $frames;
exit( );
}
}
function chat_frame( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$css = $SKIN->get_css( );
$html = "<html>\n\t\t\t\t <head>\n\t\t\t\t <title>华酷论坛订购表单</title>\n\t\t\t\t {$css}\n\t\t\t\t </head>\n\t\t\t\t <body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#4C77B6'>\n\t\t\t\t <table cellpadding=4 cellspacing=0 border=0 align='center'>\n\t\t\t\t <form action='{$SKIN->base_url}&act=pin&code=chatsave' method='POST' target='body'>\n\t\t\t\t <tr>\n\t\t\t\t <td valign='middle' align='left'><b style='color:white'>是否订购聊天功能?</b></td>\n\t\t\t\t <td valign='middle' align='left'><input type='text' size=35 name='account_no' value='请在此输入你的账号信息...' onClick=\"this.value='';\"></td>\n\t\t\t\t <td valign='middle' align='left'><input type='submit' value='继续...'></td>\n\t\t\t\t </tr>\n\t\t\t\t </table>\n\t\t\t\t </form>\n\t\t\t\t </body>\n\t\t\t\t </html>";
echo $html;
exit( );
}
function chat_save( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$acc_number = intval( $IN['account_no'] );
if ( $acc_number == "" )
{
$ADMIN->error( "对不起,这不是一个有效的聊天账号" );
}
$ADMIN->rebuild_config( array(
"chat_account_no" => $acc_number
) );
$this->chat_config( );
}
function chat_config_save( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$acc_number = intval( $IN['chat_account_no'] );
$new = array(
"chat_account_no" => $acc_number,
"chat_allow_guest" => $IN['chat_allow_guest'],
"chat_width" => $IN['chat_width'],
"chat_height" => $IN['chat_height'],
"chat_language" => $IN['chat_language'],
"chat_display" => $IN['chat_display']
);
$ids = array( );
foreach ( $IN as $key => $value )
{
if ( !preg_match( "/^sg_(\\d+)\$/", $key, $match ) && !$IN[$match[0]] )
{
$ids[] = $match[1];
}
}
$new['chat_admin_groups'] = implode( ",", $ids );
$ADMIN->rebuild_config( $new );
$ADMIN->done_screen( "在线聊天设置已经更新", "在线聊天设置", "act=pin&code=ipchat" );
}
function chat_config( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "你可以在下面编辑和设置相关参数";
$ADMIN->page_title = "在线聊天设置";
$language = $INFO['chat_language'] == "" ? "en" : $INFO['chat_language'];
$larray = array(
0 => array( "en", "English" ),
1 => array( "ar", "Arabic" ),
2 => array( "de", "German" ),
3 => array( "es", "Spanish" ),
4 => array( "fr", "French" ),
5 => array( "hr", "Croation" ),
6 => array( "it", "Italian" ),
7 => array( "iw", "Hebrew" ),
8 => array( "nl", "Dutch" ),
9 => array( "pl", "Polish" ),
10 => array( "pt", "Portuguese" )
);
$display = array(
0 => array( "self", "在原页面中加载" ),
1 => array( "new", "打开新窗口加载" )
);
$ADMIN->html .= $SKIN->start_form( array(
1 => array( "code", "dochat" ),
2 => array( "act", "pin" )
) );
$SKIN->td_header[] = array( " ", "60%" );
$SKIN->td_header[] = array( " ", "40%" );
$ADMIN->html .= $SKIN->start_table( "变量参数设置" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>在线聊天账号?</b><br>此选项不正确,所有聊天功能将无法使用。",
$SKIN->form_input( "chat_account_no", $INFO['chat_account_no'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>允许游客访问在线聊天栏目?</b><br>如果选择 '否',所有用户必须输入账号信息才能登录聊天室。",
$SKIN->form_yes_no( "chat_allow_guest", $INFO['chat_allow_guest'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>聊天室显示宽度?(像素)</b>", $SKIN->form_input( "chat_width", $INFO['chat_width'] ? $INFO['chat_width'] : 600 ) ) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>聊天室显示高度?(像素)</b>", $SKIN->form_input( "chat_height", $INFO['chat_height'] ? $INFO['chat_height'] : 350 ) ) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>默认聊天室界面语言?</b>",
$SKIN->form_dropdown( "chat_language", $larray, $language )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>加载聊天室的方式...?</b>",
$SKIN->form_dropdown( "chat_display", $display, $INFO['chat_display'] )
) );
$ADMIN->html .= $SKIN->end_table( );
$SKIN->td_header[] = array( " ", "60%" );
$SKIN->td_header[] = array( " ", "40%" );
$ADMIN->html .= $SKIN->start_table( "聊天室访问权限设置" );
$allowed = array( );
foreach ( explode( ",", $INFO['chat_admin_groups'] ) as $i )
{
$allowed[$i] = 1;
}
$DB->query( "SELECT g_id, g_title FROM ibf_groups WHERE g_id <> ".$INFO['guest_group']." ORDER BY g_title" );
while ( $r = $DB->fetch_row( ) )
{
$mode = $r['g_id'] == $INFO['admin_group'] ? "green" : "red";
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>允许用户团队:'<span style='color:{$mode}'>{$r['g_title']}</span>' 访问聊天室?</b>",
$SKIN->form_yes_no( "sg_{$r['g_id']}", $allowed[$r['g_id']] ? 1 : 0 )
) );
}
$ADMIN->html .= $SKIN->end_form( "保存设置" );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
function save_config( $new )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
global $HTTP_POST_VARS;
$master = array( );
if ( is_array( $new ) && 0 < count( $new ) )
{
foreach ( $new as $field )
{
if ( $field == "img_ext" || $field == "avatar_ext" )
{
$HTTP_POST_VARS[$field] = preg_replace( "/[\\.\\s]/", "", $HTTP_POST_VARS[$field] );
$HTTP_POST_VARS[$field] = preg_replace( "/,/", "|", $HTTP_POST_VARS[$field] );
}
else if ( $field == "coppa_address" )
{
$HTTP_POST_VARS[$field] = nl2br( $HTTP_POST_VARS[$field] );
}
$HTTP_POST_VARS[$field] = preg_replace( "/'/", "'", stripslashes( $HTTP_POST_VARS[$field] ) );
$master[$field] = stripslashes( $HTTP_POST_VARS[$field] );
}
$ADMIN->rebuild_config( $master );
}
}
function common_header( $formcode = "", $section = "", $extra = "" )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$extra = $extra ? $extra."<br>" : $extra;
$ADMIN->page_detail = $extra."请在提交表单数据前仔细检查你填写的数据";
$ADMIN->page_title = "论坛插件设置 [ {$section} ]";
$ADMIN->html .= $SKIN->start_form( array(
1 => array(
"code",
$formcode
),
2 => array( "act", "pin" )
) );
$SKIN->td_header[] = array( " ", "40%" );
$SKIN->td_header[] = array( " ", "60%" );
$ADMIN->html .= $SKIN->start_table( "设置" );
}
function common_footer( $button = "提交修改" )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->html .= $SKIN->end_form( $button );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
}
ad_plugins( );
$idx = new ad_plugins( );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -