aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-07-26 12:55:14 +0000
committerz0rglub <z0rglub@piwigo.org>2003-07-26 12:55:14 +0000
commitc0d1ed215cdd610b16ed806db81ff07f6e65a43f (patch)
tree3c51dcc48a681200258d95eb32252b2cb2855dd1
parenta7eb0781cf7d5e6d3ba5673b2105656c5bca6712 (diff)
Possiblity to forbid simple guests to add their comments
git-svn-id: http://piwigo.org/svn/trunk@42 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/configuration.php34
-rw-r--r--include/config.inc.php3
-rw-r--r--language/francais.php2
-rw-r--r--picture.php33
-rw-r--r--template/default/picture.vtp2
5 files changed, 59 insertions, 15 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 3292ffbc2..529a3541b 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -41,7 +41,7 @@ array( 'prefix_thumbnail','webmaster','mail_webmaster','access',
'show_comments','nb_comment_page','upload_available',
'upload_maxfilesize', 'upload_maxwidth','upload_maxheight',
'upload_maxwidth_thumbnail','upload_maxheight_thumbnail','log',
- 'comments_validation' );
+ 'comments_validation','comments_forall' );
$default_user_infos =
array( 'nb_image_line','nb_line_page','language','maxwidth',
'maxheight','expand','show_nb_comments','short_period','long_period',
@@ -449,6 +449,38 @@ $vtp->setVar( $sub, 'param_line.def',
$lang['conf_comments_show_comments_info'] );
$vtp->closeSession( $sub, 'param_line' );
$vtp->closeSession( $sub, 'line' );
+// coments for all ? true -> guests can post messages
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_forall'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $comments_forall == 'true' )
+{
+ $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $comments_forall == 'false' )
+{
+ $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+ $lang['conf_comments_forall_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
// number of comments per page
$vtp->addSession( $sub, 'line' );
$vtp->addSession( $sub, 'param_line' );
diff --git a/include/config.inc.php b/include/config.inc.php
index da0fbf0b8..07b3bfb14 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -61,7 +61,8 @@ $infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
'max_user_listbox', 'show_comments', 'nb_comment_page',
'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
'upload_maxheight', 'upload_maxwidth_thumbnail',
- 'upload_maxheight_thumbnail','log','comments_validation' );
+ 'upload_maxheight_thumbnail','log','comments_validation',
+ 'comments_forall' );
$query = 'SELECT ';
foreach ( $infos as $i => $info ) {
diff --git a/language/francais.php b/language/francais.php
index 863525b9c..8e0f294e9 100644
--- a/language/francais.php
+++ b/language/francais.php
@@ -344,6 +344,8 @@ if ( $isadmin )
// start version 1.3
$lang['conf_comments_validation'] = 'validation';
$lang['conf_comments_validation_info'] = 'L\'administrateur valide les commentaires avant qu\'ils apparaissent sur le site';
+ $lang['conf_comments_forall'] = 'pour tous ?';
+ $lang['conf_comments_forall_info'] = 'Même les invités non enregistrés peuvent déposer les messages';
// $lang['conf_remote_site_title'] = 'Site distant';
// end version 1.3
$lang['conf_remote_site_delete_info'] = 'Supprimer un site revient à supprimer toutes les images et les catégories en relation avec ce site.';
diff --git a/picture.php b/picture.php
index ae8282e1b..01ff49db1 100644
--- a/picture.php
+++ b/picture.php
@@ -624,20 +624,27 @@ if ( $conf['show_comments'] )
}
$vtp->closeSession( $handle, 'comment' );
}
- // form action
- $action = str_replace( '&', '&amp;', $_SERVER['REQUEST_URI'] );
- $vtp->setGlobalVar( $handle, 'form_action', $action );
- // display author field if the user is not logged in
- if ( !$user['is_the_guest'] )
- {
- $vtp->addSession( $handle, 'author_known' );
- $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] );
- $vtp->closeSession( $handle, 'author_known' );
- }
- else
+
+ if ( !$user['is_the_guest']
+ or ( $user['is_the_guest'] and $conf['comments_forall'] ) )
{
- $vtp->addSession( $handle, 'author_field' );
- $vtp->closeSession( $handle, 'author_field' );
+ $vtp->addSession( $handle, 'add_comment' );
+ // form action
+ $action = str_replace( '&', '&amp;', $_SERVER['REQUEST_URI'] );
+ $vtp->setGlobalVar( $handle, 'form_action', $action );
+ // display author field if the user is not logged in
+ if ( !$user['is_the_guest'] )
+ {
+ $vtp->addSession( $handle, 'author_known' );
+ $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] );
+ $vtp->closeSession( $handle, 'author_known' );
+ }
+ else
+ {
+ $vtp->addSession( $handle, 'author_field' );
+ $vtp->closeSession( $handle, 'author_field' );
+ }
+ $vtp->closeSession( $handle, 'add_comment' );
}
$vtp->closeSession( $handle, 'comments' );
}
diff --git a/template/default/picture.vtp b/template/default/picture.vtp
index b0bc2c959..817a3ad58 100644
--- a/template/default/picture.vtp
+++ b/template/default/picture.vtp
@@ -162,6 +162,7 @@
</td>
</tr>
</table>
+ <!--VTP_add_comment-->
<form method="post" action="{#form_action}">
<table style="width:100%;">
<tr align="center">
@@ -179,6 +180,7 @@
</tr>
</table>
</form>
+ <!--/VTP_add_comment-->
{#frame_end}
</td>
</tr>