diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-12-13 01:05:38 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-12-13 01:05:38 +0000 |
commit | 74e5d80e899562b6505ce7c4865041448b22470d (patch) | |
tree | e47fae00cc013e4626081cc66f38ce43e1d40dd4 | |
parent | 5046b3c2105bdfae23d6835c110606ea9e7ff055 (diff) |
- 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
Diffstat (limited to '')
-rw-r--r-- | admin/configuration.php | 3 | ||||
-rw-r--r-- | identification.php | 9 | ||||
-rw-r--r-- | include/functions_html.inc.php | 17 | ||||
-rwxr-xr-x | include/menubar.inc.php | 6 | ||||
-rw-r--r-- | install/config.sql | 1 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 2 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/admin.lang.php | 2 | ||||
-rw-r--r-- | register.php | 6 | ||||
-rw-r--r-- | template/yoga/admin/configuration.tpl | 7 | ||||
-rw-r--r-- | template/yoga/admin/picture_modify.tpl | 4 | ||||
-rw-r--r-- | template/yoga/default-layout.css | 1 | ||||
-rw-r--r-- | template/yoga/identification.tpl | 8 | ||||
-rw-r--r-- | template/yoga/menubar.tpl | 4 |
13 files changed, 58 insertions, 12 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 50c001820..1f15b7a1d 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -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( diff --git a/identification.php b/identification.php index 7a444dd51..86a5ba5a6 100644 --- a/identification.php +++ b/identification.php @@ -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 ) { diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index f3ad7f700..39f738f3f 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -614,6 +614,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 * @param string alternate_url redirect to this url diff --git a/include/menubar.inc.php b/include/menubar.inc.php index c360b2600..c149b3553 100755 --- a/include/menubar.inc.php +++ b/include/menubar.inc.php @@ -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 { diff --git a/install/config.sql b/install/config.sql index e68887ac9..150acb124 100644 --- a/install/config.sql +++ b/install/config.sql @@ -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'); diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index d439cbe51..55c99117b 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -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'; diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index 98dd8d3d6..30a02c841 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -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'; diff --git a/register.php b/register.php index ceca0150c..55d0b226c 100644 --- a/register.php +++ b/register.php @@ -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'])) { diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl index 7f86f6e1b..387bb5b47 100644 --- a/template/yoga/admin/configuration.tpl +++ b/template/yoga/admin/configuration.tpl @@ -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> diff --git a/template/yoga/admin/picture_modify.tpl b/template/yoga/admin/picture_modify.tpl index c10e7744e..28981589f 100644 --- a/template/yoga/admin/picture_modify.tpl +++ b/template/yoga/admin/picture_modify.tpl @@ -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> diff --git a/template/yoga/default-layout.css b/template/yoga/default-layout.css index afe4cf525..d246e32b8 100644 --- a/template/yoga/default-layout.css +++ b/template/yoga/default-layout.css @@ -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 { diff --git a/template/yoga/identification.tpl b/template/yoga/identification.tpl index 7c8f6e0c3..6f364da23 100644 --- a/template/yoga/identification.tpl +++ b/template/yoga/identification.tpl @@ -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 --> diff --git a/template/yoga/menubar.tpl b/template/yoga/menubar.tpl index dd3b72390..eafec20a6 100644 --- a/template/yoga/menubar.tpl +++ b/template/yoga/menubar.tpl @@ -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> |