mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-11 03:03:01 +02:00
feature:2549 Allow to disable comments for everybody
git-svn-id: http://piwigo.org/svn/trunk@12887 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+10
-2
@@ -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'])
|
||||
|
||||
@@ -142,7 +142,10 @@ $tabsheet = new tabsheet();
|
||||
$opt_link = $link_start.'cat_options&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');
|
||||
|
||||
@@ -66,6 +66,7 @@ $history_checkboxes = array(
|
||||
);
|
||||
|
||||
$comments_checkboxes = array(
|
||||
'activate_comments',
|
||||
'comments_forall',
|
||||
'comments_validation',
|
||||
'email_admin_on_comment',
|
||||
|
||||
+29
-26
@@ -185,12 +185,6 @@ SELECT COUNT(*)
|
||||
;';
|
||||
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.'
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -181,6 +181,15 @@ jQuery(document).ready(function () {
|
||||
<fieldset id="commentsConf">
|
||||
<legend></legend>
|
||||
<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>
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
|
||||
+16
-9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user