Файл: admin/module_portal_config.php
Строк: 147
<?php
/***************************************************************************
* admin_portal_config.php
* -------------------
* Anv@r.all (c) apwa.ru 2011/24/02
***************************************************************************/
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);
$sql = "SELECT * FROM " . $table_prefix . "portal_config";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "'", $config_value) : $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 " . $table_prefix . "portal_config
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 general configuration for $config_name", "", __LINE__, __FILE__, $sql);
}
}
}
if( isset($HTTP_POST_VARS['submit']) )
{
$message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href="" . append_sid("module_portal_config.$phpEx") . "">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href="" . append_sid("index.$phpEx?pane=module") . "">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
$news_yes = ( $new['news'] ) ? "checked="checked"" : "";
$news_no = ( !$new['news'] ) ? "checked="checked"" : "";
$recent_yes = ( $new['recent'] ) ? "checked="checked"" : "";
$recent_no = ( !$new['recent'] ) ? "checked="checked"" : "";
$gallery_yes = ( $new['gallery'] ) ? "checked="checked"" : "";
$gallery_no = ( !$new['gallery'] ) ? "checked="checked"" : "";
$random = ( $new['display'] ) ? "checked="checked"" : "";
$recent = ( !$new['display'] ) ? "checked="checked"" : "";
$last_yes = ( $new['last'] ) ? "checked="checked"" : "";
$last_no = ( !$new['last'] ) ? "checked="checked"" : "";
$birthday_yes = ( $new['birthday'] ) ? "checked="checked"" : "";
$birthday_no = ( !$new['birthday'] ) ? "checked="checked"" : "";
$template->set_filenames(array(
"body" => "admin/portal_config_body.tpl")
);
$new['site_desc'] = str_replace('"', '"', $new['site_desc']);
$new['sitename'] = str_replace('"', '"', strip_tags($new['sitename']));
$template->assign_vars(array(
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
"L_SUBMIT" => $lang['Submit'],
"NEWS_YES" => $news_yes,
"NEWS_NO" => $news_no,
"NEWS_FORUM" => $new['news_forum'],
"NUMBER_OF_NEWS" => $new['number_of_news'],
"NEWS_LENGTH" => $new['news_length'],
"NUMBER_OF_NEWS_RECENT" => $new['number_of_news_recent'],
"RECENT_YES" => $recent_yes,
"RECENT_NO" => $recent_no,
"IGNORE_FORUMS" => $new['ignore_forums'],
"NM_TOPICS" => $new['nm_topics'],
"TOPIC_LENGTH" => $new['topic_length'],
"GALLERY_YES" => $gallery_yes,
"GALLERY_NO" => $gallery_no,
"CAT_ID" => $new['cat_id'],
"RANDOM" => $random,
"RECENT" => $recent,
"NM_PICS" => $new['nm_pics'],
"LAST_YES" => $recent_yes,
"LAST_NO" => $recent_no,
"BIRTHDAY_YES" => $birthday_yes,
"BIRTHDAY_NO" => $birthday_no,
"TOP_TIME" => $new['top_time'],
"S_CONFIG_ACTION" => append_sid("module_portal_config.$phpEx"))
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>