Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php (revision 12886)
+++ /trunk/admin.php (revision 12887)
@@ -190,8 +190,12 @@
'U_ADD_PHOTOS' => $link_start.'photos_add',
'U_CHANGE_THEME' => $change_theme_url,
- 'U_PENDING_COMMENTS' => $link_start.'comments',
'U_UPDATES' => $link_start.'updates',
)
);
+
+if ($conf['activate_comments'])
+{
+ $template->assign('U_PENDING_COMMENTS', $link_start.'comments');
+}
// +-----------------------------------------------------------------------+
Index: /trunk/admin/cat_modify.php
===================================================================
--- /trunk/admin/cat_modify.php (revision 12886)
+++ /trunk/admin/cat_modify.php (revision 12887)
@@ -49,9 +49,13 @@
'id' => $_GET['cat_id'],
'name' => @$_POST['name'],
- 'commentable' => isset($_POST['commentable'])?$_POST['commentable']:'false',
'comment' =>
$conf['allow_html_descriptions'] ?
@$_POST['comment'] : strip_tags(@$_POST['comment']),
);
+
+ if ($conf['activate_comments'])
+ {
+ $data['commentable'] = isset($_POST['commentable'])?$_POST['commentable']:'false';
+ }
mass_updates(
@@ -223,5 +227,4 @@
'CAT_STATUS' => $category['status'],
'CAT_VISIBLE' => boolean_to_string($category['visible']),
- 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']),
'U_JUMPTO' => make_index_url(
@@ -239,4 +242,9 @@
)
);
+
+if ($conf['activate_comments'])
+{
+ $template->assign('CAT_COMMENTABLE', boolean_to_string($category['commentable']));
+}
Index: /trunk/admin/cat_options.php
===================================================================
--- /trunk/admin/cat_options.php (revision 12886)
+++ /trunk/admin/cat_options.php (revision 12887)
@@ -143,5 +143,8 @@
$tabsheet->add('status', l10n('Public / Private'), $opt_link.'status');
$tabsheet->add('visible', l10n('Lock'), $opt_link.'visible');
-$tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
+if ($conf['activate_comments'])
+{
+ $tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
+}
if ($conf['allow_random_representative'])
{
Index: /trunk/admin/configuration.php
===================================================================
--- /trunk/admin/configuration.php (revision 12886)
+++ /trunk/admin/configuration.php (revision 12887)
@@ -67,4 +67,5 @@
$comments_checkboxes = array(
+ 'activate_comments',
'comments_forall',
'comments_validation',
Index: /trunk/admin/intro.php
===================================================================
--- /trunk/admin/intro.php (revision 12886)
+++ /trunk/admin/intro.php (revision 12887)
@@ -185,10 +185,4 @@
;';
list($nb_groups) = pwg_db_fetch_row(pwg_query($query));
-
-$query = '
-SELECT COUNT(*)
- FROM '.COMMENTS_TABLE.'
-;';
-list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
$query = '
@@ -219,5 +213,4 @@
'DB_USERS' => l10n_dec('%d user', '%d users', $nb_users),
'DB_GROUPS' => l10n_dec('%d group', '%d groups', $nb_groups),
- 'DB_COMMENTS' => l10n_dec('%d comment', '%d comments', $nb_comments),
'DB_RATES' => sprintf('%d rates', $nb_rates),
'U_CHECK_UPGRADE' => PHPWG_ROOT_PATH.'admin.php?action=check_upgrade',
@@ -227,4 +220,33 @@
)
);
+
+if ($conf['activate_comments'])
+{
+ $query = '
+SELECT COUNT(*)
+ FROM '.COMMENTS_TABLE.'
+;';
+ list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
+ $template->assign('DB_COMMENTS', l10n_dec('%d comment', '%d comments', $nb_comments));
+
+ // unvalidated comments
+ $query = '
+SELECT COUNT(*)
+ FROM '.COMMENTS_TABLE.'
+ WHERE validated=\'false\'
+;';
+ list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
+
+ if ($nb_comments > 0)
+ {
+ $template->assign(
+ 'unvalidated',
+ array(
+ 'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
+ 'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
+ )
+ );
+ }
+}
if ($nb_elements > 0)
@@ -248,23 +270,4 @@
}
-// unvalidated comments
-$query = '
-SELECT COUNT(*)
- FROM '.COMMENTS_TABLE.'
- WHERE validated=\'false\'
-;';
-list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
-
-if ($nb_comments > 0)
-{
- $template->assign(
- 'unvalidated',
- array(
- 'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
- 'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
- )
- );
-}
-
// graphics library
switch (pwg_image::get_library())
Index: /trunk/admin/themes/default/template/admin.tpl
===================================================================
--- /trunk/admin/themes/default/template/admin.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/admin.tpl (revision 12887)
@@ -75,5 +75,7 @@
{/if}
{'Maintenance'|@translate}
+{if isset($U_PENDING_COMMENTS)}
{'Pending Comments'|@translate}
+{/if}
{'Updates'|@translate}
Index: /trunk/admin/themes/default/template/cat_modify.tpl
===================================================================
--- /trunk/admin/themes/default/template/cat_modify.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/cat_modify.tpl (revision 12887)
@@ -83,4 +83,5 @@
+ {if isset($CAT_COMMENTABLE)}
{'Comments'|@translate}
@@ -89,4 +90,5 @@
|
+ {/if}
Index: /trunk/admin/themes/default/template/configuration.tpl
===================================================================
--- /trunk/admin/themes/default/template/configuration.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/configuration.tpl (revision 12887)
@@ -184,4 +184,13 @@
+
+
+
+
+{footer_script}{literal}
+$(document).ready(function(){
+ $("#activate_comments").change(function(){
+ if ($(this).attr('checked')) {
+ $("#comments_param_warp").css('display', '');
+ } else {
+ $("#comments_param_warp").css('display', 'none');
+ }
+ });
+});
+{/literal}{/footer_script}
{/if}
Index: /trunk/admin/themes/default/template/intro.tpl
===================================================================
--- /trunk/admin/themes/default/template/intro.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/intro.tpl (revision 12887)
@@ -73,4 +73,5 @@
{$DB_USERS}
{$DB_GROUPS}
+ {if isset($DB_COMMENTS)}
{$DB_COMMENTS}
@@ -79,4 +80,5 @@
{/if}
+ {/if}
{$DB_RATES}
Index: /trunk/admin/themes/default/template/profile_content.tpl
===================================================================
--- /trunk/admin/themes/default/template/profile_content.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/profile_content.tpl (revision 12887)
@@ -48,5 +48,5 @@
-{if not $SPECIAL_USER}
+ {if not $SPECIAL_USER}
@@ -61,5 +61,5 @@
{html_options id=language name=language options=$language_options selected=$language_selection}
-{/if}
+ {/if}
@@ -72,8 +72,10 @@
{html_radios name='expand' options=$radio_options selected=$EXPAND}
+ {if $ACTIVATE_COMMENTS}
{'Show number of comments'|@translate}
{html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
+ {/if}
{'Show number of hits'|@translate}
Index: /trunk/admin/themes/default/template/user_list.tpl
===================================================================
--- /trunk/admin/themes/default/template/user_list.tpl (revision 12886)
+++ /trunk/admin/themes/default/template/user_list.tpl (revision 12887)
@@ -236,4 +236,5 @@
+{if $ACTIVATE_COMMENTS}
{'Show number of comments'|@translate} |
@@ -245,4 +246,5 @@
+{/if}
Index: /trunk/admin/user_list.php
===================================================================
--- /trunk/admin/user_list.php (revision 12886)
+++ /trunk/admin/user_list.php (revision 12887)
@@ -416,12 +416,17 @@
$dbfields = array('primary' => array('user_id'), 'update' => array());
- $formfields =
- array('nb_image_page', 'theme', 'language',
- 'recent_period', 'expand', 'show_nb_comments',
- 'show_nb_hits', 'status', 'enabled_high',
- 'level');
-
- $true_false_fields = array('expand', 'show_nb_comments',
- 'show_nb_hits', 'enabled_high');
+ $formfields = array(
+ 'nb_image_page', 'theme', 'language',
+ 'recent_period', 'expand', 'show_nb_hits',
+ 'status', 'enabled_high', 'level'
+ );
+
+ $true_false_fields = array('expand', 'show_nb_hits', 'enabled_high');
+
+ if ($conf['activate_comments'])
+ {
+ array_push($formfields, 'show_nb_comments');
+ array_push($true_false_fields, 'show_nb_comments');
+ }
foreach ($formfields as $formfield)
@@ -556,5 +561,7 @@
'F_ADD_ACTION' => $base_url,
'F_USERNAME' => @htmlentities($_GET['username'], ENT_COMPAT, 'UTF-8'),
- 'F_FILTER_ACTION' => get_root_url().'admin.php'
+ 'F_FILTER_ACTION' => get_root_url().'admin.php',
+
+ 'ACTIVATE_COMMENTS' => $conf['activate_comments'],
));
Index: /trunk/comments.php
===================================================================
--- /trunk/comments.php (revision 12886)
+++ /trunk/comments.php (revision 12887)
@@ -28,4 +28,9 @@
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
+
+if (!$conf['activate_comments'])
+{
+ page_not_found(null);
+}
// +-----------------------------------------------------------------------+
Index: /trunk/include/category_default.inc.php
===================================================================
--- /trunk/include/category_default.inc.php (revision 12886)
+++ /trunk/include/category_default.inc.php (revision 12887)
@@ -75,5 +75,5 @@
);
- if ($user['show_nb_comments'])
+ if ($conf['activate_comments'] and $user['show_nb_comments'])
{
$query = '
Index: /trunk/include/menubar.inc.php
===================================================================
--- /trunk/include/menubar.inc.php (revision 12886)
+++ /trunk/include/menubar.inc.php (revision 12887)
@@ -258,11 +258,14 @@
);
- // comments link
- $block->data['comments'] =
- array(
- 'TITLE'=>l10n('display last user comments'),
- 'NAME'=>l10n('Comments'),
- 'URL'=> get_root_url().'comments.php',
- );
+ if ($conf['activate_comments'])
+ {
+ // comments link
+ $block->data['comments'] =
+ array(
+ 'TITLE'=>l10n('display last user comments'),
+ 'NAME'=>l10n('Comments'),
+ 'URL'=> get_root_url().'comments.php',
+ );
+ }
// about link
Index: /trunk/install/config.sql
===================================================================
--- /trunk/install/config.sql (revision 12886)
+++ /trunk/install/config.sql (revision 12887)
@@ -1,4 +1,5 @@
-- initial configuration for Piwigo
+INSERT INTO piwigo_config (param,value,comment) VALUES ('activate_comments','true','Global parameter for usage of comments system');
INSERT INTO piwigo_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page');
INSERT INTO piwigo_config (param,value,comment) VALUES ('log','true','keep an history of visits on your website');
Index: /trunk/install/db/114-database.php
===================================================================
--- /trunk/install/db/114-database.php (revision 12887)
+++ /trunk/install/db/114-database.php (revision 12887)
@@ -0,0 +1,42 @@
+
Index: /trunk/language/en_UK/admin.lang.php
===================================================================
--- /trunk/language/en_UK/admin.lang.php (revision 12886)
+++ /trunk/language/en_UK/admin.lang.php (revision 12887)
@@ -102,4 +102,5 @@
$lang['Activate Navigation Bar'] = 'Activate navigation bar';
$lang['Activate Navigation Thumbnails'] = 'Activate navigation thumbnails';
+$lang['Activate comments'] = 'Activate comments';
$lang['Activate'] = "Activate";
$lang['Active Languages'] = 'Active Languages';
Index: /trunk/language/fr_CA/admin.lang.php
===================================================================
--- /trunk/language/fr_CA/admin.lang.php (revision 12886)
+++ /trunk/language/fr_CA/admin.lang.php (revision 12887)
@@ -846,4 +846,5 @@
$lang['Piwigo cannot retrieve upgrade file from server'] = 'Piwigo ne peut pas récupérer le fichier de mise à jour depuis le serveur';
$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
+$lang['Activate comments'] = 'Activate comments';
?>
Index: /trunk/language/fr_FR/admin.lang.php
===================================================================
--- /trunk/language/fr_FR/admin.lang.php (revision 12886)
+++ /trunk/language/fr_FR/admin.lang.php (revision 12887)
@@ -845,4 +845,5 @@
$lang['Original Size'] = 'Taille originale';
$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
+$lang['Activate comments'] = 'Activate comments';
?>
Index: /trunk/picture.php
===================================================================
--- /trunk/picture.php (revision 12886)
+++ /trunk/picture.php (revision 12887)
@@ -966,5 +966,8 @@
include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
-include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
+if ($conf['activate_comments'])
+{
+ include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
+}
if ($metadata_showable and pwg_get_session_var('show_metadata') <> null )
{
Index: /trunk/profile.php
===================================================================
--- /trunk/profile.php (revision 12886)
+++ /trunk/profile.php (revision 12887)
@@ -257,6 +257,11 @@
$fields = array(
'nb_image_page', 'language',
- 'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'theme'
+ 'expand', 'show_nb_hits', 'recent_period', 'theme'
);
+
+ if ($conf['activate_comments'])
+ {
+ array_push($fields, 'show_nb_comments');
+ }
$data = array();
@@ -301,4 +306,5 @@
'EMAIL'=>get_email_address_as_display_text(@$userdata['email']),
'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
+ 'ACTIVATE_COMMENTS'=>$conf['activate_comments'],
'NB_IMAGE_PAGE'=>$userdata['nb_image_page'],
'RECENT_PERIOD'=>$userdata['recent_period'],
Index: /trunk/themes/default/template/profile_content.tpl
===================================================================
--- /trunk/themes/default/template/profile_content.tpl (revision 12886)
+++ /trunk/themes/default/template/profile_content.tpl (revision 12887)
@@ -71,8 +71,10 @@
{html_radios name='expand' options=$radio_options selected=$EXPAND}
+ {if $ACTIVATE_COMMENTS}
{'Show number of comments'|@translate}
{html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
+ {/if}
{'Show number of hits'|@translate}