mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
- feature 599: option to forbid user registration
- 1 language cleanup - added page_forbidden function (sends 403) git-svn-id: http://piwigo.org/svn/trunk@1652 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -52,7 +52,8 @@ $general_checkboxes = array(
|
||||
'history_admin',
|
||||
'history_guest',
|
||||
'login_history',
|
||||
'email_admin_on_new_user'
|
||||
'email_admin_on_new_user',
|
||||
'allow_user_registration',
|
||||
);
|
||||
|
||||
$comments_checkboxes = array(
|
||||
|
||||
@@ -57,8 +57,7 @@ SELECT '.$conf['user_fields']['id'].' AS id,
|
||||
if ($row['password'] == $conf['pass_convert']($_POST['password']))
|
||||
{
|
||||
$remember_me = false;
|
||||
if ($conf['authorize_remembering']
|
||||
and isset($_POST['remember_me'])
|
||||
if (isset($_POST['remember_me'])
|
||||
and $_POST['remember_me'] == 1)
|
||||
{
|
||||
$remember_me = true;
|
||||
@@ -85,7 +84,6 @@ $template->set_filenames( array('identification'=>'identification.tpl') );
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
|
||||
'U_REGISTER' => PHPWG_ROOT_PATH.'register.php',
|
||||
'U_LOST_PASSWORD' => PHPWG_ROOT_PATH.'password.php',
|
||||
'U_HOME' => make_index_url(),
|
||||
@@ -98,6 +96,11 @@ if ($conf['authorize_remembering'])
|
||||
{
|
||||
$template->assign_block_vars('remember_me',array());
|
||||
}
|
||||
if ($conf['allow_user_registration'])
|
||||
{
|
||||
$template->assign_block_vars('register',array());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- errors display
|
||||
if ( sizeof( $errors ) != 0 )
|
||||
{
|
||||
|
||||
@@ -613,6 +613,23 @@ function access_denied()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* exits the current script with 403 code
|
||||
* @param string msg a message to display
|
||||
* @param string alternate_url redirect to this url
|
||||
*/
|
||||
function page_forbidden($msg, $alternate_url=null)
|
||||
{
|
||||
set_status_header(403);
|
||||
if ($alternate_url==null)
|
||||
$alternate_url = make_index_url();
|
||||
redirect_html( $alternate_url,
|
||||
'<div style="text-align:left; margin-left:5em;margin-bottom:5em;">
|
||||
<h1 style="text-align:left; font-size:36px;">Forbidden</h1><br/>'
|
||||
.$msg.'</div>',
|
||||
5 );
|
||||
}
|
||||
|
||||
/**
|
||||
* exits the current script with 404 code when a page cannot be found
|
||||
* @param string msg a message to display
|
||||
|
||||
@@ -206,7 +206,6 @@ $template->assign_block_vars(
|
||||
|
||||
if ($user['is_the_guest'])
|
||||
{
|
||||
$template->assign_block_vars('register', array());
|
||||
$template->assign_block_vars('login', array());
|
||||
|
||||
$template->assign_block_vars('quickconnect', array());
|
||||
@@ -214,6 +213,11 @@ if ($user['is_the_guest'])
|
||||
{
|
||||
$template->assign_block_vars('quickconnect.remember_me', array());
|
||||
}
|
||||
if ($conf['allow_user_registration'])
|
||||
{
|
||||
$template->assign_block_vars('register', array());
|
||||
$template->assign_block_vars('quickconnect.register', array());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('page_banner','<h
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('history_admin','false','keep a history of administrator visits on your website');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('history_guest','true','keep a history of guest visits on your website');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('login_history','true','keep a history of user logins on your website');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('allow_user_registration','true','allow visitors to register?');
|
||||
-- Notification by mail
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail');
|
||||
|
||||
@@ -48,6 +48,7 @@ $lang['Add a user'] = 'Add a user';
|
||||
$lang['Add group'] = 'Add group';
|
||||
$lang['Add selected elements to caddie'] = 'Add selected elements to caddie';
|
||||
$lang['Add'] = 'Add';
|
||||
$lang['Allow user registration'] = 'Allow user registration';
|
||||
$lang['Apply to subcategories'] = 'Apply to subcategories';
|
||||
$lang['Are you sure?'] = 'Are you sure?';
|
||||
$lang['Associated'] = 'Associated';
|
||||
@@ -152,7 +153,6 @@ $lang['Rate date'] = 'Rate date';
|
||||
$lang['Rating by guests'] = 'Rating by guests';
|
||||
$lang['Rating'] = 'Rating';
|
||||
$lang['Recent period'] = 'Recent period';
|
||||
$lang['Registration date'] = 'Registration date';
|
||||
$lang['Reject All'] = 'Reject All';
|
||||
$lang['Reject'] = 'Reject';
|
||||
$lang['Representant'] = 'Representant';
|
||||
|
||||
@@ -48,6 +48,7 @@ $lang['Add a user'] = 'Ajouter un utilisateur';
|
||||
$lang['Add group'] = 'Ajouter un groupe';
|
||||
$lang['Add selected elements to caddie'] = 'Ajouter les éléments sélectionnés au panier';
|
||||
$lang['Add'] = 'Ajouter';
|
||||
$lang['Allow user registration'] = 'Permettre l\'enregistrement des utilisateurs';
|
||||
$lang['Apply to subcategories'] = 'Appliquer au sous-catégories';
|
||||
$lang['Are you sure?'] = 'Etes-vous sur?';
|
||||
$lang['Associated'] = 'Associée à';
|
||||
@@ -152,7 +153,6 @@ $lang['Rate date'] = 'Date de notation';
|
||||
$lang['Rating by guests'] = 'Notation par les visiteurs';
|
||||
$lang['Rating'] = 'Notation';
|
||||
$lang['Recent period'] = 'Période récente';
|
||||
$lang['Registration date'] = 'Date d\'enregistrement';
|
||||
$lang['Reject All'] = 'Tout rejeter';
|
||||
$lang['Reject'] = 'Rejeter';
|
||||
$lang['Representant'] = 'Représentant';
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
define('PHPWG_ROOT_PATH','./');
|
||||
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
||||
//----------------------------------------------------------- user registration
|
||||
|
||||
if (!$conf['allow_user_registration'])
|
||||
{
|
||||
page_forbidden('User registration closed');
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
</label>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label for="allow_user_registration">
|
||||
<span class="property">{lang:Allow user registration}</span>
|
||||
<input type="checkbox" name="allow_user_registration" id="allow_user_registration" {general.ALLOW_USER_REGISTRATION} />
|
||||
</label>
|
||||
</li>
|
||||
|
||||
<br/>
|
||||
<li>
|
||||
<fieldset>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong>{lang:Registration date}</strong></td>
|
||||
<td><strong>{lang:Post date}</strong></td>
|
||||
<td>{REGISTRATION_DATE}</td>
|
||||
</tr>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<td>{TAG_SELECTION}</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><strong>{lang:Description}</strong></td>
|
||||
<td><textarea name="description" class="description">{DESCRIPTION}</textarea></td>
|
||||
|
||||
@@ -181,6 +181,7 @@ FORM.properties LI, FORM#update UL {
|
||||
margin-bottom: 0.5em;
|
||||
padding: 0;
|
||||
line-height: 1.8em;
|
||||
clear: left;
|
||||
}
|
||||
|
||||
FORM.properties SPAN.property {
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<div class="titrePage">
|
||||
<ul class="categoryActions">
|
||||
<li><a href="{U_LOST_PASSWORD}" title="{lang:Forgot your password?}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt="{lang:Forgot your password?}"></a></li>
|
||||
<!-- BEGIN register -->
|
||||
<li><a href="{U_REGISTER}" title="{lang:Create a new account}"><img src="{themeconf:icon_dir}/register.png" class="button" alt="{lang:register}"/></a></li>
|
||||
<!-- END register -->
|
||||
<li><a href="{U_HOME}" title="{lang:Go through the gallery as a visitor}"><img src="{themeconf:icon_dir}/home.png" class="button" alt="{lang:home}"/></a></li>
|
||||
</ul>
|
||||
<h2>{lang:Identification}</h2>
|
||||
@@ -60,8 +62,10 @@ document.login_form.username.focus();
|
||||
//--></script>
|
||||
|
||||
<p>
|
||||
<a href="{U_REGISTER}"><img src="{themeconf:icon_dir}/register.png" class="button" alt=""> {lang:Register}</a>
|
||||
<a href="{U_LOST_PASSWORD}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt=""> {lang:Forgot your password?}</a>
|
||||
<!-- BEGIN register -->
|
||||
<a href="{U_REGISTER}" title="{lang:Create a new account}"><img src="{themeconf:icon_dir}/register.png" class="button" alt=""> {lang:Register}</a>
|
||||
<!-- END register -->
|
||||
<a href="{U_LOST_PASSWORD}" title="{lang:Forgot your password?}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt=""> {lang:Forgot your password?}</a>
|
||||
</p>
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<!-- END hello -->
|
||||
<ul>
|
||||
<!-- BEGIN register -->
|
||||
<li><a href="{U_REGISTER}" rel="nofollow">{lang:Register}</a></li>
|
||||
<li><a href="{U_REGISTER}" title="{lang:Create a new account}" rel="nofollow">{lang:Register}</a></li>
|
||||
<!-- END register -->
|
||||
<!-- BEGIN login -->
|
||||
<li><a href="{F_IDENTIFY}" rel="nofollow">{lang:Connection}</a></li>
|
||||
@@ -121,7 +121,9 @@
|
||||
</p>
|
||||
<ul class="actions">
|
||||
<li><a href="{U_LOST_PASSWORD}" title="{lang:Forgot your password?}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/lost_password.png" class="button" alt="{lang:Forgot your password?}"></a></li>
|
||||
<!-- BEGIN register -->
|
||||
<li><a href="{U_REGISTER}" title="{lang:Create a new account}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/register.png" class="button" alt="{lang:register}"/></a></li>
|
||||
<!-- END register -->
|
||||
</ul>
|
||||
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user