aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-01-14 22:29:10 +0000
committermistic100 <mistic@piwigo.org>2012-01-14 22:29:10 +0000
commitc501688dbc98428635bdf569dc9c136e24fbd9a9 (patch)
treee60e9507668a8f508ddadf2b5b7fed333598d95d /admin
parenta412558492bf24ee9c39502ac37730ff4bc40177 (diff)
feature:2549 Allow to disable comments for everybody
git-svn-id: http://piwigo.org/svn/trunk@12887 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin.php6
-rw-r--r--admin/cat_modify.php12
-rw-r--r--admin/cat_options.php5
-rw-r--r--admin/configuration.php1
-rw-r--r--admin/intro.php55
-rw-r--r--admin/themes/default/template/admin.tpl2
-rw-r--r--admin/themes/default/template/cat_modify.tpl2
-rw-r--r--admin/themes/default/template/configuration.tpl20
-rw-r--r--admin/themes/default/template/intro.tpl2
-rw-r--r--admin/themes/default/template/profile_content.tpl6
-rw-r--r--admin/themes/default/template/user_list.tpl2
-rw-r--r--admin/user_list.php25
12 files changed, 97 insertions, 41 deletions
diff --git a/admin.php b/admin.php
index 411dcb9e2..1fb7ebc45 100644
--- a/admin.php
+++ b/admin.php
@@ -189,10 +189,14 @@ $template->assign(
'U_PLUGINS'=> $link_start.'plugins',
'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');
+}
// +-----------------------------------------------------------------------+
// | Plugin menu |
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index 8c4d59ae9..5137e73b5 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -48,11 +48,15 @@ if (isset($_POST['submit']))
array(
'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(
CATEGORIES_TABLE,
@@ -222,7 +226,6 @@ $template->assign(
'CAT_STATUS' => $category['status'],
'CAT_VISIBLE' => boolean_to_string($category['visible']),
- 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']),
'U_JUMPTO' => make_index_url(
array(
@@ -238,6 +241,11 @@ $template->assign(
'F_ACTION' => $form_action,
)
);
+
+if ($conf['activate_comments'])
+{
+ $template->assign('CAT_COMMENTABLE', boolean_to_string($category['commentable']));
+}
if ('private' == $category['status'])
diff --git a/admin/cat_options.php b/admin/cat_options.php
index 8ab02272d..ec5842886 100644
--- a/admin/cat_options.php
+++ b/admin/cat_options.php
@@ -142,7 +142,10 @@ $tabsheet = new tabsheet();
$opt_link = $link_start.'cat_options&amp;section=';
$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'])
{
$tabsheet->add('representative', l10n('Representative'), $opt_link.'representative');
diff --git a/admin/configuration.php b/admin/configuration.php
index bc6f3634d..b7a06aa74 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -66,6 +66,7 @@ $history_checkboxes = array(
);
$comments_checkboxes = array(
+ 'activate_comments',
'comments_forall',
'comments_validation',
'email_admin_on_comment',
diff --git a/admin/intro.php b/admin/intro.php
index 63d5b9805..72406dee6 100644
--- a/admin/intro.php
+++ b/admin/intro.php
@@ -187,12 +187,6 @@ 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 = '
-SELECT COUNT(*)
FROM '.RATE_TABLE.'
;';
list($nb_rates) = pwg_db_fetch_row(pwg_query($query));
@@ -218,7 +212,6 @@ $template->assign(
'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag),
'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',
'U_PHPINFO' => PHPWG_ROOT_PATH.'admin.php?action=phpinfo',
@@ -226,6 +219,35 @@ $template->assign(
'DB_DATATIME' => $db_current_date,
)
);
+
+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)
{
@@ -247,25 +269,6 @@ SELECT MIN(date_available)
);
}
-// 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())
{
diff --git a/admin/themes/default/template/admin.tpl b/admin/themes/default/template/admin.tpl
index 5bc11c92a..393cf7157 100644
--- a/admin/themes/default/template/admin.tpl
+++ b/admin/themes/default/template/admin.tpl
@@ -74,7 +74,9 @@ jQuery(document).ready(function(){ldelim}
<li><a href="{$U_THUMBNAILS}">{'Thumbnails'|@translate}</a></li>
{/if}
<li><a href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li>
+{if isset($U_PENDING_COMMENTS)}
<li><a href="{$U_PENDING_COMMENTS}">{'Pending Comments'|@translate}</a></li>
+{/if}
<li><a href="{$U_UPDATES}">{'Updates'|@translate}</a></li>
</ul>
</dd>
diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl
index 23c68fe97..91b580998 100644
--- a/admin/themes/default/template/cat_modify.tpl
+++ b/admin/themes/default/template/cat_modify.tpl
@@ -82,12 +82,14 @@
{html_radios name='visible' values='true,false'|@explode output='No,Yes'|@explode|translate selected=$CAT_VISIBLE}
</td>
</tr>
+ {if isset($CAT_COMMENTABLE)}
<tr>
<td><strong>{'Comments'|@translate}</strong>
<td>
{html_radios name='commentable' values='false,true'|@explode output='No,Yes'|@explode|translate selected=$CAT_COMMENTABLE}
</td>
</tr>
+ {/if}
</table>
</fieldset>
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl
index 008dfe4e0..bc64a14ff 100644
--- a/admin/themes/default/template/configuration.tpl
+++ b/admin/themes/default/template/configuration.tpl
@@ -183,6 +183,15 @@ jQuery(document).ready(function () {
<ul>
<li>
<label>
+ <span class="property">{'Activate comments'|@translate}</span>
+ <input type="checkbox" name="activate_comments" id="activate_comments"{if ($comments.activate_comments)}checked="checked"{/if}>
+ </label>
+ </li>
+ </ul>
+
+ <ul id="comments_param_warp"{if not ($comments.activate_comments)} style="display:none;"{/if}>
+ <li>
+ <label>
<span class="property">{'Comments for all'|@translate}</span>
<input type="checkbox" name="comments_forall" {if ($comments.comments_forall)}checked="checked"{/if}>
</label>
@@ -243,6 +252,17 @@ jQuery(document).ready(function () {
</ul>
</fieldset>
+{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}
</div> <!-- configContent -->
diff --git a/admin/themes/default/template/intro.tpl b/admin/themes/default/template/intro.tpl
index 7afbd6ab4..679a3565f 100644
--- a/admin/themes/default/template/intro.tpl
+++ b/admin/themes/default/template/intro.tpl
@@ -72,12 +72,14 @@ jQuery().ready(function(){
<li>{$DB_TAGS} ({$DB_IMAGE_TAG})</li>
<li>{$DB_USERS}</li>
<li>{$DB_GROUPS}</li>
+ {if isset($DB_COMMENTS)}
<li>
{$DB_COMMENTS}
{if isset($unvalidated)}
(<a href="{$unvalidated.URL}">{$unvalidated.INFO}</a>)
{/if}
</li>
+ {/if}
<li>{$DB_RATES}</li>
</ul>
</dd>
diff --git a/admin/themes/default/template/profile_content.tpl b/admin/themes/default/template/profile_content.tpl
index 24cf53abe..33727f7aa 100644
--- a/admin/themes/default/template/profile_content.tpl
+++ b/admin/themes/default/template/profile_content.tpl
@@ -47,7 +47,7 @@
</span>
<input type="text" size="4" maxlength="3" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}">
</li>
-{if not $SPECIAL_USER}
+ {if not $SPECIAL_USER}
<li>
<span class="property">
<label for="template">{'Interface theme'|@translate}</label>
@@ -60,7 +60,7 @@
</span>
{html_options id=language name=language options=$language_options selected=$language_selection}
</li>
-{/if}
+ {/if}
<li>
<span class="property">
<label for="recent_period">{'Recent period'|@translate}</label>
@@ -71,10 +71,12 @@
<span class="property">{'Expand all albums'|@translate}</span>
{html_radios name='expand' options=$radio_options selected=$EXPAND}
</li>
+ {if $ACTIVATE_COMMENTS}
<li>
<span class="property">{'Show number of comments'|@translate}</span>
{html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
</li>
+ {/if}
<li>
<span class="property">{'Show number of hits'|@translate}</span>
{html_radios name='show_nb_hits' options=$radio_options selected=$NB_HITS}
diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl
index 4458f9792..5bb3f18ed 100644
--- a/admin/themes/default/template/user_list.tpl
+++ b/admin/themes/default/template/user_list.tpl
@@ -235,6 +235,7 @@
</td>
</tr>
+{if $ACTIVATE_COMMENTS}
<tr>
<td>{'Show number of comments'|@translate}</td>
<td>
@@ -244,6 +245,7 @@
<label><input type="radio" name="show_nb_comments" value="false">{'No'|@translate}</label>
</td>
</tr>
+{/if}
<tr>
<td>{'Show number of hits'|@translate}</td>
diff --git a/admin/user_list.php b/admin/user_list.php
index 425c3c698..8a8396792 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -415,14 +415,19 @@ DELETE FROM '.USER_GROUP_TABLE.'
$datas = array();
$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)
{
@@ -555,7 +560,9 @@ $template->assign(
'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'],
));
// Display or Hide double password type