- new feature : lock temporary your gallery for maintenance

- $user keys for guest user are initialized with default values of $conf


git-svn-id: http://piwigo.org/svn/trunk@653 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall 2004-12-20 23:54:59 +00:00
commit 6409647e1c
8 changed files with 50 additions and 13 deletions

View file

@ -166,6 +166,8 @@ switch ($page['section'])
$history_no = ($conf['log']=='false')?'checked="checked"':'';
$notif_yes = ($conf['mail_notification']=='true')?'checked="checked"':'';
$notif_no = ($conf['mail_notification']=='false')?'checked="checked"':'';
$lock_yes = ($conf['gallery_locked']=='true')?'checked="checked"':'';
$lock_no = ($conf['gallery_locked']=='false')?'checked="checked"':'';
$template->assign_block_vars(
'general',
@ -179,13 +181,17 @@ switch ($page['section'])
'L_CONF_HISTORY_INFO'=>$lang['conf_log_info'],
'L_CONF_NOTIFICATION'=>$lang['conf_notification'],
'L_CONF_NOTIFICATION_INFO'=>$lang['conf_notification_info'],
'L_CONF_GALLERY_LOCKED'=>$lang['conf_gallery_locked'],
'L_CONF_GALLERY_LOCKED_INFO'=>$lang['conf_gallery_locked_info'],
'ADMIN_MAIL'=>$conf['mail_webmaster'],
'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'],
'HISTORY_YES'=>$history_yes,
'HISTORY_NO'=>$history_no,
'NOTIFICATION_YES'=>$notif_yes,
'NOTIFICATION_NO'=>$notif_no
'NOTIFICATION_NO'=>$notif_no,
'GALLERY_LOCKED_YES'=>$lock_yes,
'GALLERY_LOCKED_NO'=>$lock_no,
));
break;
}

View file

@ -163,11 +163,4 @@ while ( $row =mysql_fetch_array( $result ) )
}
include(PHPWG_ROOT_PATH.'include/user.inc.php');
// displaying the username in the language of the connected user, instead of
// "guest" as you can find in the database
if ($user['is_the_guest'])
{
$user['username'] = $lang['guest'];
}
?>

View file

@ -158,7 +158,7 @@ function update_user( $user_id, $mail_address, $status,
function check_login_authorization($guest_allowed = true)
{
global $user,$lang;
global $user,$lang,$conf,$template;
if ($user['is_the_guest'] and !$guest_allowed)
{
@ -166,6 +166,17 @@ function check_login_authorization($guest_allowed = true)
echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
exit();
}
if ($conf['gallery_locked'])
{
echo '<div style="text-align:center;">';
echo $lang['gallery_locked_message'];
echo '</div>';
if ($user['status'] != 'admin')
{
exit();
}
}
}
function setup_style($style)

View file

@ -105,6 +105,20 @@ foreach ($row as $key => $value)
}
}
// properties of user guest are found in the configuration
if ($user['is_the_guest'])
{
$user['template'] = $conf['default_template'];
$user['nb_image_line'] = $conf['nb_image_line'];
$user['nb_line_page'] = $conf['nb_line_page'];
$user['language'] = $conf['default_language'];
$user['maxwidth'] = $conf['default_maxwidth'];
$user['maxheight'] = $conf['default_maxheight'];
$user['recent_period'] = $conf['recent_period'];
$user['expand'] = $conf['auto_expand'];
$user['show_nb_comments'] = $conf['show_nb_comments'];
}
// if no information were found about user in user_forbidden table OR the
// forbidden categories must be updated
if (!isset($user['need_update'])
@ -138,6 +152,13 @@ if (empty($user['language'])
}
include_once(PHPWG_ROOT_PATH.'language/'.$user['language'].'/common.lang.php');
// displaying the username in the language of the connected user, instead of
// "guest" as you can find in the database
if ($user['is_the_guest'])
{
$user['username'] = $lang['guest'];
}
// only if we are in the administration section
if (defined('IN_ADMIN') and IN_ADMIN)
{

View file

@ -26,3 +26,4 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('use_exif','true'
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_iptc','false','Show IPTC metadata on picture.php if asked by user');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_exif','true','Show EXIF metadata on picture.php if asked by user');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('authorize_remembering','true','Authorize users to be remembered, see $conf{remember_me_length}');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_locked','false','Lock your gallery temporary for non admin users');

View file

@ -153,6 +153,8 @@ $lang['conf_access'] = 'Access type';
$lang['conf_log_info'] = 'Keep an history of visits on your website ? Visits will be shown in the history section of the administration panel';
$lang['conf_notification'] = 'Mail notification';
$lang['conf_notification_info'] = 'Automated mail notification for adminsitrators (and only for them) when a user add a comment or upload a picture.';
$lang['conf_gallery_locked'] = 'Lock gallery';
$lang['conf_gallery_locked_info'] = 'Lock the entire gallery for maintenance. Only administrator users will be able to reach the gallery';
// Configuration -> comments
$lang['conf_comments_title'] = 'Users comments';
@ -344,8 +346,4 @@ $lang['permuser_only_private'] = 'Only private categories are shown';
$lang['waiting_update'] = 'Validated pictures will be displayed only once pictures database updated';
$lang['cat_unknown_id'] = 'This category is unknown in the database';
$lang['install_warning'] = 'The file "install.php" is still present. Please remove it from your server. It is not secure to keep it.';
?>

View file

@ -315,4 +315,6 @@ $lang['standard_deviation'] = 'STD';
$lang['random_cat'] = 'random pictures';
$lang['random_cat_hint'] = 'Displays a set of random pictures';
$lang['picture_high'] = 'Click on the picture to see it in high definition';
$lang['gallery_locked_message'] = 'The gallery is locked for maintenance. Please, come back later or loggin as an administrator to enter the gallery : <a href="'.PHPWG_ROOT_PATH.'identification.php">Identification</a>';
?>

View file

@ -37,6 +37,11 @@
<td class="row1"><input type="radio" class="radio" name="mail_notification" value="true" {general.NOTIFICATION_YES} />{L_YES}&nbsp;&nbsp;
<input type="radio" class="radio" name="mail_notification" value="false" {general.NOTIFICATION_NO} />{L_NO}</td>
</tr>
<tr>
<td><strong>{general.L_CONF_GALLERY_LOCKED}&nbsp;:</strong><br /><span class="small">{general.L_CONF_GALLERY_LOCKED_INFO}</span></td>
<td class="row1"><input type="radio" class="radio" name="gallery_locked" value="true" {general.GALLERY_LOCKED_YES} />{L_YES}&nbsp;&nbsp;
<input type="radio" class="radio" name="gallery_locked" value="false" {general.GALLERY_LOCKED_NO} />{L_NO}</td>
</tr>
<!-- END general -->
<!-- BEGIN comments -->
<tr class="admin">