<?php
/************************************************** *************************
* admin_album_cp.php
* -------------------
* begin : Thursday, July 11, 2002
* copyright : (C) 2002 Smartor
* email :
[email protected]
*
* $Id: admin_album_cp.php,v 1.6 2002/7/30, 14:59:38 hnt Exp $
*
************************************************** *************************/
/************************************************** *************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
************************************************** *************************/
define('IN_PHPBB', true);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Album']['Configuration'] = $filename;
return;
}
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
require($phpbb_root_path . 'album_mod/album_common.' . $phpEx);
//
// Pull all config data
//
$sql = "SELECT * FROM " . TABLE_ALBUM_CONFIG;
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in admin_album_cp", "", __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 " . TABLE_ALBUM_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['Album_config_updated'] . "<br /><br />" . sprintf($lang['Click_return_album_config'], "<a href=\"" . append_sid("admin_album_cp.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
$template->set_filenames(array(
"body" => "admin/album_cp_body.tpl")
);
$guest_view = $user_view = $admin_view = '';
switch ($new['view_level'])
{
case -1:
$guest_view = 'selected';
break;
case 0:
$user_view = 'selected';
break;
case 1:
$admin_view = 'selected';
break;
}
$guest_upload = $user_upload = $admin_upload = '';
switch ($new['upload_level'])
{
case -1:
$guest_upload = 'selected';
break;
case 0:
$user_upload = 'selected';
break;
case 1:
$admin_upload = 'selected';
break;
}
$default_scale = $proportion_scale = '';
switch ($new['thumbnail_scaling'])
{
case 0:
$default_scale = 'selected';
break;
case 1:
$proportion_scale = 'selected';
break;
}
$force_gif_no = $force_gif_yes = '';
switch ($new['thumbnail_force_GIF'])
{
case 0:
$force_gif_no = 'selected';
break;
case 1:
$force_gif_yes = 'selected';
break;
}
$template->assign_vars(array(
'S_CONFIG_ACTION' => append_sid("admin_album_cp.$phpEx"),
'L_ALBUM_CP_TITLE' => $lang['Album_Configuration'],
'L_ALBUM_CP_EXPLAIN' => $lang['Album_Config_Explain'],
'L_ALBUM_SETTINGS' => $lang['Album_Settings'],
'L_MAX_PICS' => $lang['Max_Pics'],
'MAX_PICS' => $new['max_pics'],
'L_MAX_PIC_SIZE' => $lang['Max_pic_size'],
'L_MAX_PIC_SIZE_EXPLAIN' => $lang['Max_pic_size_explain'],
'MAX_WIDTH' => $new['max_width'],
'MAX_HEIGHT' => $new['max_height'],
'L_MAX_FILE_SIZE' => $lang['Max_File_Size'],
'MAX_FILE_SIZE' => $new['max_file_size'],
'L_VIEW_LEVEL' => $lang['Who_can_view_the_album'],
'GUEST_VIEW' => $guest_view,
'USER_VIEW' => $user_view,
'ADMIN_VIEW' => $admin_view,
'L_UPLOAD_LEVEL' => $lang['Who_can_upload_to_the_album'],
'GUEST_UPLOAD' => $guest_upload,
'USER_UPLOAD' => $user_upload,
'ADMIN_UPLOAD' => $admin_upload,
'L_ROWS_PER_PAGE' => $lang['Rows_per_page'],
'ROWS_PER_PAGE' => $new['rows_per_page'],
'L_THUMBNAIL_QUALITY' => $lang['Thumbnail_quality'],
'THUMBNAIL_QUALITY' => $new['thumbnail_quality'],
'L_THUMBNAIL_SCALING_STYLE' => $lang['Thumbnail_scaling_style'],
'DEFAULT_SCALE' => $default_scale,
'PROPORTION_SCALE' => $proportion_scale,
'L_FORCE_GIF_THUMBNAIL' => $lang['Force_GIF_thumbnail'],
'FORCE_GIF_NO' => $force_gif_no,
'FORCE_GIF_YES' => $force_gif_yes,
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'])
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>