From: garvinhicking <garvinhicking>
Date: Sat, 30 Apr 2005 10:41:02 +0000 (+0000)
Subject: Allow to view and fetch multiple categories. Categories plugin
X-Git-Tag: 0.9~486
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4765e24cfdfedddacd2434e0cf79c33ec988139a;p=s9y.git

Allow to view and fetch multiple categories. Categories plugin
can allow viewers to select multiple categories to view.

Multiple categories are separated by ";" inside the URL. Values are still
turned to (int)s later on.
---

diff --git a/docs/NEWS b/docs/NEWS
index 46d7298..b28667e 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Allow to view and fetch multiple categories. Categories plugin
+      can allow viewers to select multiple categories to view.
+      (garvinhicking)
+
     * Added hooks into the image selector admin popup for plugins to
       support additional options. serendipity_event_imageselectorplus
       accesses those hooks already. (garvinhicking)
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 254f041..5bf13d7 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -664,7 +664,7 @@ function serendipity_getUriArguments($uri, $wildcard = false) {
 global $serendipity;
 
     /* Explode the path into sections, to later be able to check for arguments and add our own */
-    preg_match('/^'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?\/)?(' . ($wildcard ? '.+' : '[a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
+    preg_match('/^'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?\/)?(' . ($wildcard ? '.+' : '[;a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
     if (strlen($_res[2]) != 0) {
         $args = explode('/', $_res[2]);
         if ($args[0] == 'index') {
diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php
index 9e75576..ecd9e63 100644
--- a/include/functions_entries.inc.php
+++ b/include/functions_entries.inc.php
@@ -13,6 +13,22 @@ function serendipity_fetchCategoryRange($categoryid) {
     return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
 }
 
+function serendipity_getMultiCategoriesSQL($cats) {
+    global $serendipity;
+
+    $mcategories   = explode(';', $cats);
+    $cat_sql_array = array();
+    foreach($mcategories AS $categoryid) {
+        $categoryid  = (int)$categoryid;
+
+        if ($categoryid != 0) {
+            $cat_sql_array[] = " c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
+        }
+    }
+
+    return implode(' OR ', $cat_sql_array);
+}
+
 function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
     global $serendipity;
 
@@ -29,7 +45,7 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
 
         $ret = serendipity_db_query($query);
         return $ret[0];
-    } else if (is_numeric($categoryid)) {
+    } else {
         $query = "SELECT
                          c.authorid,
                          c.categoryid,
@@ -38,7 +54,7 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
                          c.category_icon,
                          c.parentid
                     FROM {$serendipity['dbPrefix']}category AS c
-                   WHERE categoryid = {$categoryid}";
+                   WHERE categoryid = " . (int)$categoryid;
 
         $ret = serendipity_db_query($query);
         return $ret[0];
@@ -154,14 +170,11 @@ function serendipity_fetchEntries($range = null, $full = true, $limit = '', $fet
 
 
     if (isset($serendipity['GET']['category'])) {
-        $categoryid  = (int)$serendipity['GET']['category'];
-
-        if ($categoryid != 0) {
-            if (!empty($cond['and'])) {
-                $cond['and'] .= " AND c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
-            } else {
-                $cond['and'] = "WHERE c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
-            }
+        $cat_sql = serendipity_getMultiCategoriesSQL($serendipity['GET']['category']);
+        if (!empty($cond['and'])) {
+            $cond['and'] .= " AND ($cat_sql)";
+        } else {
+            $cond['and'] = "WHERE ($cat_sql)";
         }
     }
 
diff --git a/include/plugin_internal.inc.php b/include/plugin_internal.inc.php
index 738dee3..95dd6b4 100644
--- a/include/plugin_internal.inc.php
+++ b/include/plugin_internal.inc.php
@@ -130,21 +130,17 @@ class serendipity_calendar_plugin extends serendipity_plugin {
         serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('noCache' => false, 'noSticky' => false));
 
         if (isset($serendipity['GET']['category'])) {
-            $categoryid  = serendipity_db_escape_string($serendipity['GET']['category']);
-
-            if (is_numeric($categoryid)) {
-                $base_query   = 'C' . $categoryid;
-                $add_query    = '/' . $base_query;
-                $querystring = "SELECT timestamp
-                                  FROM {$serendipity['dbPrefix']}category c,
-                                       {$serendipity['dbPrefix']}entrycat ec,
-                                       {$serendipity['dbPrefix']}entries e
-                                       {$cond['joins']}
-                                       {$cond['and']}
-                                   AND e.id          = ec.entryid
-                                   AND c.categoryid  = ec.categoryid
-                                   AND c.category_left BETWEEN " . implode(' AND ', serendipity_fetchCategoryRange($categoryid));
-            }
+            $base_query   = 'C' . $categoryid;
+            $add_query    = '/' . $base_query;
+            $querystring = "SELECT timestamp
+                              FROM {$serendipity['dbPrefix']}category c,
+                                   {$serendipity['dbPrefix']}entrycat ec,
+                                   {$serendipity['dbPrefix']}entries e
+                                   {$cond['joins']}
+                                   {$cond['and']}
+                               AND e.id          = ec.entryid
+                               AND c.categoryid  = ec.categoryid
+                               AND (" . serendipity_getMultiCategoriesSQL($serendipity['GET']['category']) . ")";
         }
 
         if (!isset($querystring)) {
@@ -954,7 +950,7 @@ class serendipity_categories_plugin extends serendipity_plugin {
         $propbag->add('stackable',     true);
         $propbag->add('author',        'Serendipity Team');
         $propbag->add('version',       '1.0');
-        $propbag->add('configuration', array('authorid', 'image', 'sort_order', 'sort_method'));
+        $propbag->add('configuration', array('authorid', 'image', 'sort_order', 'sort_method', 'allow_select'));
     }
 
     function introspect_config_item($name, &$propbag)
@@ -977,6 +973,13 @@ class serendipity_categories_plugin extends serendipity_plugin {
                 $propbag->add('default',     'all');
                 break;
 
+            case 'allow_select':
+                $propbag->add('type',         'boolean');
+                $propbag->add('name',         CATEGORIES_ALLOW_SELECT);
+                $propbag->add('description',  CATEGORIES_ALLOW_SELECT_DESC);
+                $propbag->add('default',      true);
+                break;
+            
             case 'sort_order':
                 $select = array();
                 $select['category_name']        = CATEGORY;
@@ -1023,15 +1026,27 @@ class serendipity_categories_plugin extends serendipity_plugin {
         } else {
             $sort .= ' ' . $this->get_config('sort_method');
         }
+        $is_form = serendipity_db_bool($this->get_config('allow_select'));
         $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort);
         $title = $this->title;
+
         $html       = '';
+
+        if ($is_form) {
+            $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '" method="POST"><div>';
+        }
+
         $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
         $image = (($image == "'none'" || $image == 'none') ? '' : $image);
         if (is_array($categories) && count($categories)) {
             $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
             foreach ( $categories as $cat ) {
                 $html .= '<div style="padding-bottom: 2px;">';
+                
+                if ($is_form) {
+                    $html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="' . $cat['categoryid'] . '" />';
+                }
+
                 if ( !empty($image) ) {
                     $html .= '<a href="'. serendipity_rewriteURL(PATH_FEEDS .'/'. PATH_CATEGORIES .'/'. serendipity_makePermalink(PERM_FEEDS_CATEGORIES, array('id' => $cat['categoryid'], 'title' => $cat['category_name']))) .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
                 }
@@ -1040,6 +1055,10 @@ class serendipity_categories_plugin extends serendipity_plugin {
             }
         }
 
+        if ($is_form) {
+            $html .= '<br /><input type="submit" name="serendipity[isMultiCat]" value="' . GO . '" /><br />';
+        }
+
         $html .= sprintf(
             '<br /><a href="%s" title="%s">%s</a>',
 
@@ -1048,6 +1067,9 @@ class serendipity_categories_plugin extends serendipity_plugin {
             ALL_CATEGORIES
         );
 
+        if ($is_form) {
+            $html .= '</div></form>';
+        }
         print $html;
     }
 }
diff --git a/index.php b/index.php
index 7aba637..a38b276 100644
--- a/index.php
+++ b/index.php
@@ -57,6 +57,11 @@ if (preg_match(PAT_APPROVE, $uri, $res) && $serendipity['serendipityAuthedUser']
     }
 }
 
+if (isset($serendipity['POST']['isMultiCat']) && is_array($serendipity['POST']['multiCat'])) {
+    $is_multicat = true;
+} else {
+    $is_multicat = false;
+}
 
 if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range']) && is_numeric($serendipity['GET']['range'])) {
     $_args = $serendipity['uriArguments'];
@@ -214,7 +219,17 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
 } else if (preg_match(PAT_PLUGIN, $uri, $matches)) {
     serendipity_plugin_api::hook_event('external_plugin', $matches[1]);
     exit;
-} else if (preg_match(PAT_CATEGORIES, $uri, $matches)) {
+} else if ($is_multicat || preg_match(PAT_CATEGORIES, $uri, $matches)) {
+
+    if ($is_multicat) {
+        $serendipity['GET']['category'] = implode(';', $serendipity['POST']['multiCat']);
+        $serendipity['uriArguments'][]  = PATH_CATEGORIES;
+        $serendipity['uriArguments'][]  = serendipity_db_escape_string($serendipity['GET']['category']) . '-multi';
+    } else {
+        $serendipity['GET']['category'] = $matches[1];
+    }
+    $serendipity['GET']['action'] = 'read';
+
     $_args = $serendipity['uriArguments'];
 
     /* Attempt to locate hidden variables within the URI */
@@ -229,8 +244,6 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
         }
     }
 
-    $serendipity['GET']['category'] = $matches[1];
-    $serendipity['GET']['action'] = 'read';
     $cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
     $serendipity['head_title']    = $cInfo['category_name'];
     $serendipity['head_subtitle'] = $serendipity['blogTitle'];
diff --git a/lang/serendipity_lang_bg.inc.php b/lang/serendipity_lang_bg.inc.php
index 01cb697..020dd66 100644
--- a/lang/serendipity_lang_bg.inc.php
+++ b/lang/serendipity_lang_bg.inc.php
@@ -653,7 +653,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
-
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_cn.inc.php b/lang/serendipity_lang_cn.inc.php
index 188f115..a873f63 100644
--- a/lang/serendipity_lang_cn.inc.php
+++ b/lang/serendipity_lang_cn.inc.php
@@ -667,6 +667,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_cs.inc.php b/lang/serendipity_lang_cs.inc.php
index b652589..169f84e 100644
--- a/lang/serendipity_lang_cs.inc.php
+++ b/lang/serendipity_lang_cs.inc.php
@@ -669,6 +669,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_cz.inc.php b/lang/serendipity_lang_cz.inc.php
index 20537a4..a6cc8e7 100644
--- a/lang/serendipity_lang_cz.inc.php
+++ b/lang/serendipity_lang_cz.inc.php
@@ -669,6 +669,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_da.inc.php b/lang/serendipity_lang_da.inc.php
index 7472e6d..ce08f4b 100644
--- a/lang/serendipity_lang_da.inc.php
+++ b/lang/serendipity_lang_da.inc.php
@@ -669,6 +669,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
diff --git a/lang/serendipity_lang_de.inc.php b/lang/serendipity_lang_de.inc.php
index 1338a02..c21cefb 100644
--- a/lang/serendipity_lang_de.inc.php
+++ b/lang/serendipity_lang_de.inc.php
@@ -668,6 +668,8 @@
 
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_en.inc.php b/lang/serendipity_lang_en.inc.php
index fa03cd5..96c43f4 100644
--- a/lang/serendipity_lang_en.inc.php
+++ b/lang/serendipity_lang_en.inc.php
@@ -666,6 +666,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images');
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_es.inc.php b/lang/serendipity_lang_es.inc.php
index 960c7c0..faa4155 100644
--- a/lang/serendipity_lang_es.inc.php
+++ b/lang/serendipity_lang_es.inc.php
@@ -671,6 +671,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_fa.inc.php b/lang/serendipity_lang_fa.inc.php
index e46eaf2..207c215 100644
--- a/lang/serendipity_lang_fa.inc.php
+++ b/lang/serendipity_lang_fa.inc.php
@@ -668,6 +668,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_fi.inc.php b/lang/serendipity_lang_fi.inc.php
index 43b27e1..fe83884 100644
--- a/lang/serendipity_lang_fi.inc.php
+++ b/lang/serendipity_lang_fi.inc.php
@@ -666,6 +666,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_fr.inc.php b/lang/serendipity_lang_fr.inc.php
index 436c1d0..d7f419d 100644
--- a/lang/serendipity_lang_fr.inc.php
+++ b/lang/serendipity_lang_fr.inc.php
@@ -672,6 +672,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_is.inc.php b/lang/serendipity_lang_is.inc.php
index 3364d61..0e656b6 100644
--- a/lang/serendipity_lang_is.inc.php
+++ b/lang/serendipity_lang_is.inc.php
@@ -666,6 +666,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_it.inc.php b/lang/serendipity_lang_it.inc.php
index 47c8663..51f6e53 100644
--- a/lang/serendipity_lang_it.inc.php
+++ b/lang/serendipity_lang_it.inc.php
@@ -668,6 +668,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_ja.inc.php b/lang/serendipity_lang_ja.inc.php
index 526ee47..c394727 100644
--- a/lang/serendipity_lang_ja.inc.php
+++ b/lang/serendipity_lang_ja.inc.php
@@ -668,6 +668,8 @@ Serendipity のアップグレードステージを無視しました。正し
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
diff --git a/lang/serendipity_lang_ko.inc.php b/lang/serendipity_lang_ko.inc.php
index 5291960..a762f87 100644
--- a/lang/serendipity_lang_ko.inc.php
+++ b/lang/serendipity_lang_ko.inc.php
@@ -671,6 +671,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_nl.inc.php b/lang/serendipity_lang_nl.inc.php
index cd3a66d..8e28c18 100644
--- a/lang/serendipity_lang_nl.inc.php
+++ b/lang/serendipity_lang_nl.inc.php
@@ -670,6 +670,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_no.inc.php b/lang/serendipity_lang_no.inc.php
index c14f42e..aae73a8 100644
--- a/lang/serendipity_lang_no.inc.php
+++ b/lang/serendipity_lang_no.inc.php
@@ -669,5 +669,7 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_pt.inc.php b/lang/serendipity_lang_pt.inc.php
index e99b637..9accc36 100644
--- a/lang/serendipity_lang_pt.inc.php
+++ b/lang/serendipity_lang_pt.inc.php
@@ -669,6 +669,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_ro.inc.php b/lang/serendipity_lang_ro.inc.php
index 30a72bf..be1a2c3 100644
--- a/lang/serendipity_lang_ro.inc.php
+++ b/lang/serendipity_lang_ro.inc.php
@@ -666,6 +666,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_ru.inc.php b/lang/serendipity_lang_ru.inc.php
index d60ec50..eea05db 100644
--- a/lang/serendipity_lang_ru.inc.php
+++ b/lang/serendipity_lang_ru.inc.php
@@ -669,6 +669,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_tn.inc.php b/lang/serendipity_lang_tn.inc.php
index 18b354b..9633242 100644
--- a/lang/serendipity_lang_tn.inc.php
+++ b/lang/serendipity_lang_tn.inc.php
@@ -667,6 +667,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_tw.inc.php b/lang/serendipity_lang_tw.inc.php
index 6cfb806..e02772c 100644
--- a/lang/serendipity_lang_tw.inc.php
+++ b/lang/serendipity_lang_tw.inc.php
@@ -667,6 +667,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/lang/serendipity_lang_zh.inc.php b/lang/serendipity_lang_zh.inc.php
index ad1394d..19ec59e 100644
--- a/lang/serendipity_lang_zh.inc.php
+++ b/lang/serendipity_lang_zh.inc.php
@@ -667,6 +667,8 @@
 @define('IMAGE_MORE_INPUT', 'Add more images'); // Translate
 @define('BACKEND_TITLE', 'Additional information in Plugin Configuration screen'); // Translate
 @define('BACKEND_TITLE_FOR_NUGGET', 'Here you can define a custom string which is displayed in the Plugin Configuration screen together with the description of the HTML Nugget plugin. If you have multiple HTML nuggets with an empty title, this helps to distinct the plugins from another.'); // Translate
+@define('CATEGORIES_ALLOW_SELECT', 'Allow visitors to display multiple categories at once?'); // Translate
+@define('CATEGORIES_ALLOW_SELECT_DESC', 'If this option is enabled, a checkbox will be put next to each category in this sidebar plugin. Users can check those boxes and then see entries belonging to their selection.'); // Translate
 
 /* vim: set sts=4 ts=4 expandtab : */
 ?>
\ No newline at end of file
diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php
index 4eb38e8..9403951 100644
--- a/serendipity_config.inc.php
+++ b/serendipity_config.inc.php
@@ -138,11 +138,11 @@ include($serendipity['serendipityPath'] . 'include/lang.inc.php');
 @define('PAT_AUTHORS', '@/'.PATH_AUTHORS.'/([0-9]+)@');
 @define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
 @define('PAT_FEEDS', '@/'.PATH_FEEDS.'/@');
-@define('PAT_FEEDS_CATEGORIES', '@/'.PATH_FEEDS.'\/'. PATH_CATEGORIES .'/([0-9]+)@');
+@define('PAT_FEEDS_CATEGORIES', '@/'.PATH_FEEDS.'\/'. PATH_CATEGORIES .'/([0-9;]+)@');
 @define('PAT_FEED', '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
 @define('PAT_ADMIN', '@/(' . PATH_ADMIN . '|'. PATH_ENTRIES .')(/.+)?@');
 @define('PAT_ARCHIVE', '@/'.PATH_ARCHIVE.'$@');
-@define('PAT_CATEGORIES', '@/'.PATH_CATEGORIES.'/([0-9]+)@');
+@define('PAT_CATEGORIES', '@/'.PATH_CATEGORIES.'/([0-9;]+)@');
 @define('PAT_PLUGIN', '@/' . PATH_PLUGIN . '/(.*)@');
 @define('PAT_SEARCH', '@/' . PATH_SEARCH . '/(.*)@');
 @define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');