admin_points.php

来自「这是php编的论坛的原代码」· PHP 代码 · 共 118 行

PHP
118
字号
<?php
/***************************************************************************
 *                              admin_points.php
 *                            -------------------
 *   begin                : Sunday, April 14, 2002
 *   copyright            : (C) 2002 Bulletin Board Mods
 *   email                : ssjslim@yahoo.com
 *
 *   $Id: admin_points.php,v 1.1.1.1 2003/02/11 22:27:31 wei.gao Exp $
 *
 *
 ***************************************************************************/

define('IN_PHPBB', 1);

if(	!empty($setmodules) )
{
	$file = basename(__FILE__);
	$module['Users']['Points_Configuration'] = $file;
	return;
}

//
// Let's set the root dir for phpBB
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);


$sql = "SELECT *
		FROM " . CONFIG_TABLE . "
		WHERE config_name IN('points_reply', 'points_topic', 'points_post', 'points_donate', 'points_name')";
if(	!$result = $db->sql_query($sql) )
{
	message_die(CRITICAL_ERROR, 'Could not query points config information in admin_points', '', __LINE__, __FILE__, $sql);
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$config_name = $row['config_name'];
		$config_value = $row['config_value'];
		$default_config[$config_name] = $config_value;

		$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];

		if( isset($HTTP_POST_VARS['submit']) )
		{
			$sql = "UPDATE " . CONFIG_TABLE . "
					SET config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
					WHERE config_name = '$config_name'";
			if( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Failed to update points configuration for $config_name", '', __LINE__, __FILE__, $sql);
			}
		}
	}

	if( isset($HTTP_POST_VARS['submit']) )
	{
		$message = $lang['Points_updated'] . '<br /><br />' . sprintf($lang['Click_return_points'], '<a href="' . append_sid("admin_points.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
		message_die(GENERAL_MESSAGE, $message);
	}
}

$points_post_yes = ( $new['points_post'] ) ? 'checked="checked"' : '';
$points_post_no	 = ( !$new['points_post'] ) ? 'checked="checked"' : '';

$points_donate_yes = ( $new['points_donate'] ) ? 'checked="checked"' : '';
$points_donate_no  = ( !$new['points_donate'] ) ? 'checked="checked"' : '';

$points_reply = $new['points_reply'];
$points_topic = $new['points_topic'];
$points_name = $new['points_name'];

$template->set_filenames(array(
	'body' => 'admin/points_config_body.tpl')
);
$template->assign_vars(array(
	'S_CONFIG_ACTION' => append_sid("admin_points.$phpEx"),
 
	'L_YES' => $lang['Yes'],
	'L_NO' => $lang['No'],
	'L_SUBMIT' => $lang['Submit'],
	'L_RESET' => $lang['Reset'],
	'L_CONFIGURATION_TITLE' => $lang['Points_cp'],
	'L_CONFIGURATION_EXPLAIN' => $lang['Points_config_explian'],
	'L_SYS_SETTINGS' => $lang['Points_sys_settings'],
	'L_ENABLE_POST' => sprintf($lang['Points_enable_post'], $board_config['points_name']),
	'L_ENABLE_DONATION' => $lang['Points_enable_donation'],
	'L_POINTS_NAME' => $lang['Points_name'],
	'L_PER_REPLY' => $lang['Points_per_reply'],
	'L_PER_TOPIC' => $lang['Points_per_topic'],
	'L_ENABLE_POST_EXPLAIN' => sprintf($lang['Points_enable_post_explain'], $board_config['points_name']),
	'L_ENABLE_DONATION_EXPLAIN' => sprintf($lang['Points_enable_donation_explain'], $board_config['points_name']),
	'L_POINTS_NAME_EXPLAIN' => $lang['Points_name_explain'],
	'L_PER_REPLY_EXPLAIN' => sprintf($lang['Points_per_reply_explain'], $board_config['points_name']),
	'L_PER_TOPIC_EXPLAIN' => sprintf($lang['Points_per_topic_explain'], $board_config['points_name']),

	'S_POINTS_POST_YES' => $points_post_yes,
	'S_POINTS_POST_NO' => $points_post_no,
	'S_POINTS_DONATE_YES' => $points_donate_yes,
	'S_POINTS_DONATE_NO' => $points_donate_no,
	'S_POINTS_REPLY' => $points_reply,
	'S_POINTS_TOPIC' => $points_topic,
	'S_POINTS_NAME' => $points_name,
	'S_HIDDEN_FIELDS' => '')
);

//
// Generate the page
//
$template->pparse('body');

include('page_footer_admin.' . $phpEx);

?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?