📄 ad_help.php
字号:
<?php
class ad_settings
{
var $base_url;
function ad_settings( )
{
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 )
{
}
switch ( $IN['code'] )
{
case "edit" :
$this->show_form( "edit" );
break;
case "new" :
$this->show_form( "new" );
break;
case "doedit" :
$this->doedit( );
break;
case "donew" :
$this->doadd( );
break;
case "remove" :
$this->remove( );
break;
default :
$this->list_files( );
break;
}
}
function doedit( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
global $HTTP_POST_VARS;
if ( $IN['id'] == "" )
{
$ADMIN->error( "你必须提供有效的表情符号ID!" );
}
$text = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_update_string( array(
"title" => $title,
"text" => $text,
"description" => $desc
) );
$DB->query( "UPDATE ibf_faq SET {$db_string} WHERE id='".$IN['id']."'" );
$ADMIN->save_log( "编辑帮助文件" );
$std->boink_it( $SKIN->base_url."&act=help" );
exit( );
}
function show_form( $type = "new" )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "你可以在下面 添加/编辑/删除 帮助文件。";
$ADMIN->page_title = "帮助文件管理";
if ( $type != "new" )
{
if ( $IN['id'] == "" )
{
$ADMIN->error( "你必须提供有效的帮助文件!" );
}
$DB->query( "SELECT * FROM ibf_faq WHERE id='".$IN['id']."'" );
if ( !( $r = $DB->fetch_row( ) ) )
{
$ADMIN->error( "法在数据库中找到相关帮助信息文件" );
}
$button = "编辑帮助文件";
$code = "doedit";
}
else
{
$r = array( );
$button = "添加帮助文件";
$code = "donew";
}
$ADMIN->html .= $SKIN->start_form( array(
1 => array(
"code",
$code
),
2 => array( "act", "help" ),
3 => array(
"id",
$IN['id']
)
) );
$SKIN->td_header[] = array( " ", "20%" );
$SKIN->td_header[] = array( " ", "80%" );
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes( $r['text'] ) );
$ADMIN->html .= $SKIN->start_table( $button );
$ADMIN->html .= $SKIN->add_td_row( array(
"帮助文件名称:",
$SKIN->form_input( "title", stripslashes( $r['title'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"帮助文件叙述:",
$SKIN->form_textarea( "description", stripslashes( $r['description'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"帮助文件内容:",
$SKIN->form_textarea( "text", $r['text'], "60", "10" )
) );
$ADMIN->html .= $SKIN->end_form( $button );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
function remove( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
if ( $IN['id'] == "" )
{
$ADMIN->error( "你必须提供有效的帮助文件!" );
}
$DB->query( "DELETE FROM ibf_faq WHERE id='".$IN['id']."'" );
$ADMIN->save_log( "删除帮助文件" );
$std->boink_it( $SKIN->base_url."&act=help" );
exit( );
}
function doadd( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
global $HTTP_POST_VARS;
if ( $IN['title'] == "" )
{
$ADMIN->error( "你必须输入帮助文件名称!" );
}
$text = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes( $HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_insert_string( array(
"title" => $title,
"text" => $text,
"description" => $desc
) );
$DB->query( "INSERT INTO ibf_faq (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")" );
$ADMIN->save_log( "添加帮助文件" );
$std->boink_it( $SKIN->base_url."&act=help" );
exit( );
}
function list_files( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "你可以在下面 添加/编辑/删除 帮助文件。";
$ADMIN->page_title = "帮助文件管理";
$SKIN->td_header[] = array( "帮助文件名称", "50%" );
$SKIN->td_header[] = array( "编辑", "30%" );
$SKIN->td_header[] = array( "删除", "20%" );
$ADMIN->html .= $SKIN->start_table( "当前使用的帮助文件" );
$DB->query( "SELECT * from ibf_faq ORDER BY id ASC" );
while ( $DB->get_num_rows( ) && ( $r = $DB->fetch_row( ) ) )
{
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>".stripslashes( $r['title'] )."</b><br>".stripslashes( $r['description'] ),
"<center><a href='".$SKIN->base_url."&act=help&code=edit&id={$r['id']}'>编辑</a></center>",
"<center><a href='".$SKIN->base_url."&act=help&code=remove&id={$r['id']}'>删除</a></center>"
) );
}
$ADMIN->html .= $SKIN->add_td_basic( "<a href='".$SKIN->base_url."&act=help&code=new'>添加帮助文件</a>", "center", "title" );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
}
ad_settings( );
$idx = new ad_settings( );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -