aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-12-20 23:54:59 +0000
committerplegall <plg@piwigo.org>2004-12-20 23:54:59 +0000
commit6409647e1c9e9d13913c9d4b3d882511dc51f52d (patch)
tree9dbc8276db16c6ed8f0415a380f4ddafa20a8e6a
parent82cb16095cd271ba780345cd3a17af7f91e9f45d (diff)
- 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
-rw-r--r--admin/configuration.php8
-rw-r--r--include/common.inc.php7
-rw-r--r--include/functions_user.inc.php13
-rw-r--r--include/user.inc.php21
-rw-r--r--install/config.sql1
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php6
-rw-r--r--language/en_UK.iso-8859-1/common.lang.php2
-rw-r--r--template/default/admin/configuration.tpl5
8 files changed, 50 insertions, 13 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 5893099f8..37335f8ed 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -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;
}
diff --git a/include/common.inc.php b/include/common.inc.php
index 7e843488b..626d5e91a 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -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'];
-}
?>
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 97087827f..f8b47083b 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -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)
diff --git a/include/user.inc.php b/include/user.inc.php
index c4dc68987..468eca3f0 100644
--- a/include/user.inc.php
+++ b/include/user.inc.php
@@ -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)
{
diff --git a/install/config.sql b/install/config.sql
index 512a35c1a..0a356516a 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -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');
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 971f155e6..2eeaec176 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -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.';
-
-
-
-
?> \ No newline at end of file
diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php
index a6711832d..9d4c3e3e1 100644
--- a/language/en_UK.iso-8859-1/common.lang.php
+++ b/language/en_UK.iso-8859-1/common.lang.php
@@ -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>';
?> \ No newline at end of file
diff --git a/template/default/admin/configuration.tpl b/template/default/admin/configuration.tpl
index 0585d70a9..a0b1a436a 100644
--- a/template/default/admin/configuration.tpl
+++ b/template/default/admin/configuration.tpl
@@ -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">