aboutsummaryrefslogtreecommitdiffstats
path: root/comments.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-12-06 14:19:12 +0000
committerplegall <plg@piwigo.org>2012-12-06 14:19:12 +0000
commit36d1ab0e3eb3663752dac926e2eb616af1f4a6f5 (patch)
tree15d3172d0c674efd2923dea48fe83094c2904290 /comments.php
parentb70a6d7709a9b4a222764b8b14145e5f657b5666 (diff)
feature 2798: let the webmaster decide how many comments to display on
comments.php by default git-svn-id: http://piwigo.org/svn/trunk@19303 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--comments.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/comments.php b/comments.php
index 5eff03e90..514aab4d7 100644
--- a/comments.php
+++ b/comments.php
@@ -52,6 +52,27 @@ $sort_by = array(
// items_number : list of number of items to display per page
$items_number = array(5,10,20,50,'all');
+// if the default value is not in the expected values, we add it in the $items_number array
+if (!in_array($conf['comments_page_nb_comments'], $items_number))
+{
+ $items_number_new = array();
+
+ $is_inserted = false;
+
+ foreach ($items_number as $number)
+ {
+ if ($number > $conf['comments_page_nb_comments'] or ($number == 'all' and !$is_inserted))
+ {
+ $items_number_new[] = $conf['comments_page_nb_comments'];
+ $is_inserted = true;
+ }
+
+ $items_number_new[] = $number;
+ }
+
+ $items_number = $items_number_new;
+}
+
// since when display comments ?
//
$since_options = array(
@@ -96,7 +117,7 @@ if (isset($_GET['sort_order']) and isset($sort_order[$_GET['sort_order']]))
// number of items to display
//
-$page['items_number'] = 10;
+$page['items_number'] = $conf['comments_page_nb_comments'];
if (isset($_GET['items_number']))
{
$page['items_number'] = $_GET['items_number'];