Changeset 12887


Ignore:
Timestamp:
Jan 14, 2012, 11:29:10 PM (13 years ago)
Author:
mistic100
Message:

feature:2549 Allow to disable comments for everybody

Location:
trunk
Files:
1 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r12820 r12887  
    190190    'U_ADD_PHOTOS' => $link_start.'photos_add',
    191191    'U_CHANGE_THEME' => $change_theme_url,
    192     'U_PENDING_COMMENTS' => $link_start.'comments',
    193192    'U_UPDATES' => $link_start.'updates',
    194193    )
    195194  );
     195 
     196if ($conf['activate_comments'])
     197{
     198  $template->assign('U_PENDING_COMMENTS', $link_start.'comments');
     199}
    196200
    197201// +-----------------------------------------------------------------------+
  • trunk/admin/cat_modify.php

    r12796 r12887  
    4949      'id' => $_GET['cat_id'],
    5050      'name' => @$_POST['name'],
    51       'commentable' => isset($_POST['commentable'])?$_POST['commentable']:'false',
    5251      'comment' =>
    5352        $conf['allow_html_descriptions'] ?
    5453          @$_POST['comment'] : strip_tags(@$_POST['comment']),
    5554      );
     55     
     56  if ($conf['activate_comments'])
     57  {
     58    $data['commentable'] = isset($_POST['commentable'])?$_POST['commentable']:'false';
     59  }
    5660
    5761  mass_updates(
     
    223227    'CAT_STATUS'        => $category['status'],
    224228    'CAT_VISIBLE'       => boolean_to_string($category['visible']),
    225     'CAT_COMMENTABLE'   => boolean_to_string($category['commentable']),
    226229
    227230    'U_JUMPTO' => make_index_url(
     
    239242    )
    240243  );
     244 
     245if ($conf['activate_comments'])
     246{
     247  $template->assign('CAT_COMMENTABLE', boolean_to_string($category['commentable']));
     248}
    241249
    242250
  • trunk/admin/cat_options.php

    r8728 r12887  
    143143$tabsheet->add('status', l10n('Public / Private'), $opt_link.'status');
    144144$tabsheet->add('visible', l10n('Lock'), $opt_link.'visible');
    145 $tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
     145if ($conf['activate_comments'])
     146{
     147  $tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
     148}
    146149if ($conf['allow_random_representative'])
    147150{
  • trunk/admin/configuration.php

    r12879 r12887  
    6767
    6868$comments_checkboxes = array(
     69    'activate_comments',
    6970    'comments_forall',
    7071    'comments_validation',
  • trunk/admin/intro.php

    r11839 r12887  
    185185;';
    186186list($nb_groups) = pwg_db_fetch_row(pwg_query($query));
    187 
    188 $query = '
    189 SELECT COUNT(*)
    190   FROM '.COMMENTS_TABLE.'
    191 ;';
    192 list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    193187
    194188$query = '
     
    219213    'DB_USERS' => l10n_dec('%d user', '%d users', $nb_users),
    220214    'DB_GROUPS' => l10n_dec('%d group', '%d groups', $nb_groups),
    221     'DB_COMMENTS' => l10n_dec('%d comment', '%d comments', $nb_comments),
    222215                'DB_RATES' => sprintf('%d rates', $nb_rates),
    223216    'U_CHECK_UPGRADE' => PHPWG_ROOT_PATH.'admin.php?action=check_upgrade',
     
    227220    )
    228221  );
     222 
     223if ($conf['activate_comments'])
     224{
     225  $query = '
     226SELECT COUNT(*)
     227  FROM '.COMMENTS_TABLE.'
     228;';
     229  list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
     230  $template->assign('DB_COMMENTS', l10n_dec('%d comment', '%d comments', $nb_comments));
     231 
     232  // unvalidated comments
     233  $query = '
     234SELECT COUNT(*)
     235  FROM '.COMMENTS_TABLE.'
     236  WHERE validated=\'false\'
     237;';
     238  list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
     239
     240  if ($nb_comments > 0)
     241  {
     242    $template->assign(
     243      'unvalidated',
     244      array(
     245        'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
     246        'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
     247        )
     248      );
     249  }
     250}
    229251
    230252if ($nb_elements > 0)
     
    248270}
    249271
    250 // unvalidated comments
    251 $query = '
    252 SELECT COUNT(*)
    253   FROM '.COMMENTS_TABLE.'
    254   WHERE validated=\'false\'
    255 ;';
    256 list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    257 
    258 if ($nb_comments > 0)
    259 {
    260   $template->assign(
    261     'unvalidated',
    262     array(
    263       'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
    264       'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
    265       )
    266     );
    267 }
    268 
    269272// graphics library
    270273switch (pwg_image::get_library())
  • trunk/admin/themes/default/template/admin.tpl

    r12829 r12887  
    7575{/if}
    7676        <li><a href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li>
     77{if isset($U_PENDING_COMMENTS)}
    7778        <li><a href="{$U_PENDING_COMMENTS}">{'Pending Comments'|@translate}</a></li>
     79{/if}
    7880        <li><a href="{$U_UPDATES}">{'Updates'|@translate}</a></li>
    7981      </ul>
  • trunk/admin/themes/default/template/cat_modify.tpl

    r12681 r12887  
    8383      </td>
    8484    </tr>
     85  {if isset($CAT_COMMENTABLE)}
    8586    <tr>
    8687      <td><strong>{'Comments'|@translate}</strong>
     
    8990      </td>
    9091    </tr>
     92  {/if}
    9193  </table>
    9294</fieldset>
  • trunk/admin/themes/default/template/configuration.tpl

    r12879 r12887  
    184184    <li>
    185185      <label>
     186        <span class="property">{'Activate comments'|@translate}</span>
     187        <input type="checkbox" name="activate_comments" id="activate_comments"{if ($comments.activate_comments)}checked="checked"{/if}>
     188      </label>
     189    </li>
     190  </ul>
     191 
     192  <ul id="comments_param_warp"{if not ($comments.activate_comments)} style="display:none;"{/if}>
     193    <li>
     194      <label>
    186195        <span class="property">{'Comments for all'|@translate}</span>
    187196        <input type="checkbox" name="comments_forall" {if ($comments.comments_forall)}checked="checked"{/if}>
     
    244253  </ul>
    245254</fieldset>
     255{footer_script}{literal}
     256$(document).ready(function(){
     257  $("#activate_comments").change(function(){
     258    if ($(this).attr('checked')) {
     259      $("#comments_param_warp").css('display', '');
     260    } else {
     261      $("#comments_param_warp").css('display', 'none');
     262    }
     263  });
     264});
     265{/literal}{/footer_script}
    246266{/if}
    247267
  • trunk/admin/themes/default/template/intro.tpl

    r12427 r12887  
    7373      <li>{$DB_USERS}</li>
    7474      <li>{$DB_GROUPS}</li>
     75    {if isset($DB_COMMENTS)}
    7576      <li>
    7677        {$DB_COMMENTS}
     
    7980        {/if}
    8081      </li>
     82    {/if}
    8183                        <li>{$DB_RATES}</li>
    8284    </ul>
  • trunk/admin/themes/default/template/profile_content.tpl

    r12882 r12887  
    4848        <input type="text" size="4" maxlength="3" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}">
    4949      </li>
    50 {if not $SPECIAL_USER}
     50    {if not $SPECIAL_USER}
    5151      <li>
    5252        <span class="property">
     
    6161        {html_options id=language name=language options=$language_options selected=$language_selection}
    6262      </li>
    63 {/if}
     63    {/if}
    6464      <li>
    6565        <span class="property">
     
    7272        {html_radios name='expand' options=$radio_options selected=$EXPAND}
    7373      </li>
     74    {if $ACTIVATE_COMMENTS}
    7475      <li>
    7576        <span class="property">{'Show number of comments'|@translate}</span>
    7677        {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
    7778      </li>
     79    {/if}
    7880      <li>
    7981        <span class="property">{'Show number of hits'|@translate}</span>
  • trunk/admin/themes/default/template/user_list.tpl

    r12886 r12887  
    236236  </tr>
    237237
     238{if $ACTIVATE_COMMENTS}
    238239  <tr>
    239240    <td>{'Show number of comments'|@translate}</td>
     
    245246    </td>
    246247  </tr>
     248{/if}
    247249
    248250  <tr>
  • trunk/admin/user_list.php

    r12886 r12887  
    416416  $dbfields = array('primary' => array('user_id'), 'update' => array());
    417417
    418   $formfields =
    419     array('nb_image_page', 'theme', 'language',
    420           'recent_period', 'expand', 'show_nb_comments',
    421           'show_nb_hits', 'status', 'enabled_high',
    422           'level');
    423 
    424   $true_false_fields = array('expand', 'show_nb_comments',
    425                        'show_nb_hits', 'enabled_high');
     418  $formfields = array(
     419          'nb_image_page', 'theme', 'language',
     420          'recent_period', 'expand', 'show_nb_hits',
     421          'status', 'enabled_high', 'level'
     422          );
     423 
     424  $true_false_fields = array('expand', 'show_nb_hits', 'enabled_high');
     425 
     426  if ($conf['activate_comments'])
     427  {
     428    array_push($formfields, 'show_nb_comments');
     429    array_push($true_false_fields, 'show_nb_comments');
     430  }
    426431
    427432  foreach ($formfields as $formfield)
     
    556561    'F_ADD_ACTION' => $base_url,
    557562    'F_USERNAME' => @htmlentities($_GET['username'], ENT_COMPAT, 'UTF-8'),
    558     'F_FILTER_ACTION' => get_root_url().'admin.php'
     563    'F_FILTER_ACTION' => get_root_url().'admin.php',
     564   
     565    'ACTIVATE_COMMENTS' => $conf['activate_comments'],
    559566    ));
    560567
  • trunk/comments.php

    r12796 r12887  
    2828include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
    2929include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
     30
     31if (!$conf['activate_comments'])
     32{
     33  page_not_found(null);
     34}
    3035
    3136// +-----------------------------------------------------------------------+
  • trunk/include/category_default.inc.php

    r12796 r12887  
    7575    );
    7676
    77   if ($user['show_nb_comments'])
     77  if ($conf['activate_comments'] and $user['show_nb_comments'])
    7878  {
    7979    $query = '
  • trunk/include/menubar.inc.php

    r8728 r12887  
    258258      );
    259259
    260     // comments link
    261     $block->data['comments'] =
    262       array(
    263         'TITLE'=>l10n('display last user comments'),
    264         'NAME'=>l10n('Comments'),
    265         'URL'=> get_root_url().'comments.php',
    266       );
     260    if ($conf['activate_comments'])
     261    {
     262      // comments link
     263      $block->data['comments'] =
     264        array(
     265          'TITLE'=>l10n('display last user comments'),
     266          'NAME'=>l10n('Comments'),
     267          'URL'=> get_root_url().'comments.php',
     268        );
     269    }
    267270
    268271    // about link
  • trunk/install/config.sql

    r12879 r12887  
    11-- initial configuration for Piwigo
    22
     3INSERT INTO piwigo_config (param,value,comment) VALUES ('activate_comments','true','Global parameter for usage of comments system');
    34INSERT INTO piwigo_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page');
    45INSERT INTO piwigo_config (param,value,comment) VALUES ('log','true','keep an history of visits on your website');
  • trunk/language/en_UK/admin.lang.php

    r12886 r12887  
    102102$lang['Activate Navigation Bar'] = 'Activate navigation bar';
    103103$lang['Activate Navigation Thumbnails'] = 'Activate navigation thumbnails';
     104$lang['Activate comments'] = 'Activate comments';
    104105$lang['Activate'] = "Activate";
    105106$lang['Active Languages'] = 'Active Languages';
  • trunk/language/fr_CA/admin.lang.php

    r12886 r12887  
    846846$lang['Piwigo cannot retrieve upgrade file from server'] = 'Piwigo ne peut pas récupérer le fichier de mise à jour depuis le serveur';
    847847$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
     848$lang['Activate comments'] = 'Activate comments';
    848849
    849850?>
  • trunk/language/fr_FR/admin.lang.php

    r12886 r12887  
    845845$lang['Original Size'] = 'Taille originale';
    846846$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
     847$lang['Activate comments'] = 'Activate comments';
    847848
    848849?>
  • trunk/picture.php

    r12855 r12887  
    966966
    967967include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
    968 include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
     968if ($conf['activate_comments'])
     969{
     970  include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
     971}
    969972if ($metadata_showable and pwg_get_session_var('show_metadata') <> null )
    970973{
  • trunk/profile.php

    r12884 r12887  
    257257      $fields = array(
    258258        'nb_image_page', 'language',
    259         'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'theme'
     259        'expand', 'show_nb_hits', 'recent_period', 'theme'
    260260        );
     261       
     262      if ($conf['activate_comments'])
     263      {
     264        array_push($fields, 'show_nb_comments');
     265      }
    261266
    262267      $data = array();
     
    301306      'EMAIL'=>get_email_address_as_display_text(@$userdata['email']),
    302307      'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
     308      'ACTIVATE_COMMENTS'=>$conf['activate_comments'],
    303309      'NB_IMAGE_PAGE'=>$userdata['nb_image_page'],
    304310      'RECENT_PERIOD'=>$userdata['recent_period'],
  • trunk/themes/default/template/profile_content.tpl

    r12882 r12887  
    7171        {html_radios name='expand' options=$radio_options selected=$EXPAND}
    7272      </li>
     73    {if $ACTIVATE_COMMENTS}
    7374      <li>
    7475        <span class="property">{'Show number of comments'|@translate}</span>
    7576        {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
    7677      </li>
     78    {/if}
    7779      <li>
    7880        <span class="property">{'Show number of hits'|@translate}</span>
Note: See TracChangeset for help on using the changeset viewer.