get_acl_admin('general') )
{
return;
}
$file = basename(__FILE__);
$module['General']['Avatar_settings'] = "$file$SID&mode=avatar";
$module['General']['Cookie_settings'] = "$file$SID&mode=cookie";
$module['General']['Board_defaults'] = "$file$SID&mode=default";
$module['General']['Board_settings'] = "$file$SID&mode=setting";
$module['General']['Email_settings'] = "$file$SID&mode=email";
$module['General']['Server_settings'] = "$file$SID&mode=server";
$module['Users']['Defaults'] = "$file$SID&mode=userdefs";
return;
}
//
// Let's set the root dir for phpBB
//
define('IN_PHPBB', 1);
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
if ( !$acl->get_acl_admin('general') )
{
message_die(MESSAGE, $lang['No_admin']);
}
if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
}
else
{
$mode = '';
}
//
// Pull all config data
//
switch ( $mode )
{
case 'userdefs':
$sql = "SELECT *
FROM " . CONFIG_USER_TABLE;
$result = $db->sql_query($sql);
break;
default:
$sql = "SELECT *
FROM " . CONFIG_TABLE;
$result = $db->sql_query($sql);
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'";
$db->sql_query($sql);
}
}
break;
}
if ( isset($HTTP_POST_VARS['submit']) )
{
add_admin_log('log_' . $mode . '_config');
$message = $lang['Config_updated'] . "
" . sprintf($lang['Click_return_config'], '', '') . '
' . sprintf($lang['Click_return_admin_index'], '', '');
message_die(MESSAGE, $message);
}
//
// Which title?
//
switch ( $mode )
{
case 'cookie':
$l_title = 'Cookie_settings';
break;
case 'avatar':
$l_title = 'Avatar_settings';
break;
case 'default':
$l_title = 'Board_defaults';
break;
case 'setting':
$l_title = 'Board_settings';
break;
case 'email':
$l_title = 'Email_settings';
break;
case 'server':
$l_title = 'Server_settings';
break;
default:
return;
}
page_header($lang[$l_title]);
?>