Просмотр файла admin/module_guestbook.php

Размер файла: 3.89Kb
<?php

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
	$file = basename(__FILE__);
	$module['Modules']['Гостевая книга'] = "$file";
	return;
}

$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_gb.'.$phpEx);

$guest_config = array();
$guest_book = new guestbook();
$guest_config=$guest_book->guest_config();

	while (list($config_name, $config_value) = each ($guest_config))
	{
		$default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;

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

		if( isset($HTTP_POST_VARS['submit']) )
		{
            $guest_book->update_guestbook($config_name, $guest_config[$config_name]);
		}
	}

	if( isset($HTTP_POST_VARS['submit']) )
	{
		$message = $lang['Guestbook_updated'] . "<br /><br />" . sprintf($lang['Click_return_Guestconfig'], "<a href=\"" . append_sid("module_guestbook.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=module") . "\">", "</a>");

		message_die(GENERAL_MESSAGE, $message);
	}
	
$smile_yes = ( $guest_config['no_only_smilies'] ) ? "checked=\"checked\"" : "";
$smile_no = ( !$guest_config['no_only_smilies'] ) ? "checked=\"checked\"" : "";

$quote_yes = ( $guest_config['no_only_quote'] ) ? "checked=\"checked\"" : "";
$quote_no = ( !$guest_config['no_only_quote'] ) ? "checked=\"checked\"" : "";

$hide_yes = ( $guest_config['hide_posts'] ) ? "checked=\"checked\"" : "";
$hide_no = ( !$guest_config['hide_posts'] ) ? "checked=\"checked\"" : "";

$word_wrap_yes = ($guest_config['word_wrap']) ? 'checked="checked"' : '';
$word_wrap_no = (!$guest_config['word_wrap']) ? 'checked="checked"' : '';

$permit_mod_yes = ( $guest_config['permit_mod'] ) ? "checked=\"checked\"" : "";
$permit_mod_no = ( !$guest_config['permit_mod'] ) ? "checked=\"checked\"" : "";

	
$template->set_filenames(array(
	"body" => "admin/guestbook_config_body.tpl")
);

$template->assign_vars(array(
	"S_CONFIG_ACTION" => append_sid("module_guestbook.$phpEx"),

	"L_YES" => $lang['Yes'],
	"L_NO" => $lang['No'],
	"L_CONFIGURATION_TITLE" => $lang['General_Guest_Config'],
	"L_CONFIGURATION_EXPLAIN" => $lang['Guest_Config_explain'],
	"L_GENERAL_SETTINGS" => $lang['Guestbook_settings'],
	
	"L_ENABLED" => $lang['Enabled'],
	"L_DISABLED" => $lang['Disabled'],
	"L_PASSWORD" => $lang['G_Password'],
	"L_NO_SMILIES" => $lang['No_only_smilies'],
	"L_NO_QUOTE" => $lang['No_only_quote'],
	"L_POSTS_PER_PAGE" => $lang['Posts_per_page'],
	"L_MAXLENGHT" => $lang['Maxlenght_posts'],
	"L_SESSION_POSTING" => $lang['Session_posting'],
	"L_WORD_WRAP" => $lang['Word_wrap'],
	"L_WORD_WRAP_LENGTH" => $lang['Word_wrap_length'],
	"L_PERMIT_MOD" => $lang['Permit_mod'],
	"N_VIEW_SMILE" => $lang['N_view_smile'],
        "L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
	"L_SUBMIT" => $lang['Submit'],
	"L_RESET" => $lang['Reset'],
	
        "PASSWORD" => $guest_config['password'],
	"WORD_WRAP_YES" => $word_wrap_yes,
        "WORD_WRAP_NO"=> $word_wrap_no,
        "WORD_WRAP_LENGTH" => $guest_config['word_wrap_length'],
        "SESSION_POSTING" => $guest_config['session_posting'],
	"NO_SMILIES_YES" => $smile_yes,
        "NO_SMILIES_NO" => $smile_no,
	"NO_QUOTE_YES" => $quote_yes,
        "NO_QUOTE_NO" => $quote_no,
        "HIDE_POSTS_YES" => $hide_yes,
	"HIDE_POSTS_NO" => $hide_no,
	"PERMIT_MOD_YES" => $permit_mod_yes,
	"PERMIT_MOD_NO" => $permit_mod_no,
	"SMILIES_COLUMN" => $guest_config['smilies_column'],
	"SMILIES_ROW" => $guest_config['smilies_row'],
        "FLOOD_INTERVAL" => $guest_config['flood_interval'],
	"POSTS_PER_PAGE" => $guest_config['posts_per_page'],
	"MAXLENGHT" => $guest_config['maxlenght_posts'])
);

$template->pparse("body");

include('./page_footer_admin.'.$phpEx);

?>