sql_query($sql) )
{
message_die(CRITICAL_ERROR, "Could not query config information in cash_config", "", __LINE__, __FILE__, $sql);
}
$allowed_array = array( 'cash_disable' => true,
'cash_adminbig' => true,
'cash_adminnavbar' => true,
'cash_display_after_posts' => true,
'cash_post_message' => true,
'cash_disable_spam_num' => true,
'cash_disable_spam_time' => true,
'cash_disable_spam_message' => true);
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] = $default_config[$config_name];
if ( $allowed_array[$config_name] &&
isset($HTTP_POST_VARS['submit']) &&
isset($HTTP_POST_VARS['set']) &&
($HTTP_POST_VARS['set'] == "general") &&
isset($HTTP_POST_VARS[$config_name]) )
{
if ( ($config_name == "cash_adminbig") && ($new[$config_name] != stripslashes($HTTP_POST_VARS[$config_name])) )
{
$reset_navbar = "\n";
}
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . str_replace("\'", "''", $HTTP_POST_VARS[$config_name]) . "'
WHERE config_name = '$config_name'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update Cash Mod configuration for $config_name", "", __LINE__, __FILE__, $sql);
}
}
}
if ( isset($HTTP_POST_VARS['submit']) )
{
$message = $lang['Cash_config_updated'] . $reset_navbar . "
" . sprintf($lang['Click_return_cash_config'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
message_die(GENERAL_MESSAGE, $message);
}
$admin_big = ( $new['cash_adminbig'] ) ? "checked=\"checked\"" : "";
$admin_small = ( !$new['cash_adminbig'] ) ? "checked=\"checked\"" : "";
$adminnavbar_yes = ( $new['cash_adminnavbar'] ) ? "checked=\"checked\"" : "";
$adminnavbar_no = ( !$new['cash_adminnavbar'] ) ? "checked=\"checked\"" : "";
$disable_cash_yes = ( $new['cash_disable'] ) ? "checked=\"checked\"" : "";
$disable_cash_no = ( !$new['cash_disable'] ) ? "checked=\"checked\"" : "";
$display_after_posts_yes = ( $new['cash_display_after_posts'] ) ? "checked=\"checked\"" : "";
$display_after_posts_no = ( !$new['cash_display_after_posts'] ) ? "checked=\"checked\"" : "";
$template->set_filenames(array(
"body" => "admin/cash_config.tpl")
);
$template->assign_vars(array(
"S_CASH_CONFIG_ACTION" => append_sid("admin_cash_bbconf.$phpEx"),
"L_CASH_SETTINGS" => $lang['Cash_settings'],
"L_MESSAGES" => $lang['Messages'],
"L_SPAM" => $lang['Spam'],
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
"L_CASH_CONFIGURATION_TITLE" => $lang['Cash_config'],
"L_CASH_CONFIGURATION_EXPLAIN" => $lang['Cash_config_explain'],
"L_CASH_DISABLED" => $lang['Cash_disabled'],
"L_CASH_MESSAGE" => $lang['Cash_message'],
"L_CASH_DISPLAY_MESSAGE" => $lang['Cash_display_message'],
"L_CASH_DISPLAY_MESSAGE_EXPLAIN" => $lang['Cash_display_message_explain'],
"L_CASH_SPAM_DISABLE_NUM" => $lang['Cash_spam_disable_num'],
"L_CASH_SPAM_DISABLE_TIME" => $lang['Cash_spam_disable_time'],
"L_CASH_SPAM_DISABLE_MESSAGE" => $lang['Cash_spam_disable_message'],
"L_CASH_ADMINCP" => $lang['Cash_admincp'],
"L_CASH_ADMINNAVBAR" => $lang['Cash_adminnavbar'],
"L_SIDEBAR" => $lang['Sidebar'],
"L_MENU" => $lang['Menu'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],
"DISABLE_CASH_YES" => $disable_cash_yes,
"DISABLE_CASH_NO" => $disable_cash_no,
"DISPLAY_AFTER_POSTS_YES" => $display_after_posts_yes,
"DISPLAY_AFTER_POSTS_NO" => $display_after_posts_no,
"POST_MESSAGE" => $new['cash_post_message'],
"DISABLE_SPAM_NUM" => $new['cash_disable_spam_num'],
"DISABLE_SPAM_TIME" => $new['cash_disable_spam_time'],
"DISABLE_SPAM_MESSAGE" => $new['cash_disable_spam_message'],
"ADMIN_BIG" => $admin_big,
"ADMIN_SMALL" => $admin_small,
"ADMINNAVBAR_YES" => $adminnavbar_yes,
"ADMINNAVBAR_NO" => $adminnavbar_no)
);
$template->pparse("body");
include('./page_footer_admin.' . $phpEx);
?>