]> git.mjollnir.org Git - s9y.git/commitdiff
Require category joins in some cases, add smarty params for new fetchentry features
authorgarvinhicking <garvinhicking>
Tue, 17 Jul 2007 08:43:06 +0000 (08:43 +0000)
committergarvinhicking <garvinhicking>
Tue, 17 Jul 2007 08:43:06 +0000 (08:43 +0000)
include/functions_entries.inc.php
include/functions_smarty.inc.php

index 9459209e4304e2ca645254bac8493b0a6636b6dc..44e3188dcdb09c212273c099d796e23accf7342b 100644 (file)
@@ -384,13 +384,16 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
                     LEFT JOIN {$serendipity['dbPrefix']}authors a
                         ON e.authorid = a.authorid";
     }
-    if ($joincategories) {
+
+    if ($joincategories || !isset($serendipity['enableACL']) || $serendipity['enableACL'] == true) {
+        // Category joins are REQUIRED when the ACLs are enabled.
         $serendipity['fullCountQuery'] .= "
                     LEFT JOIN {$serendipity['dbPrefix']}entrycat ec
                         ON e.id = ec.entryid
                     LEFT JOIN {$serendipity['dbPrefix']}category c
                         ON ec.categoryid = c.categoryid";
     }
+
     $serendipity['fullCountQuery'] .="
                     {$cond['joins']}
                     {$cond['and']}";
index a625b165283141bb3d39952623e554678f32ffb5..dc7873b28ad9d9a1108bbfdfcfcf686e5663d1a0 100644 (file)
@@ -141,6 +141,11 @@ function serendipity_ifRemember($name, $value, $isDefault = false, $att = 'check
  *                          filter_sql       (string)  Can contain any SQL code to inject into the central SQL statement for fetching the entry
  *                          noCache          (boolean) If set to TRUE, all entries will be fetched from scratch and any caching is ignored
  *                          noSticky         (boolean) If set to TRUE, all sticky entries will NOT be fetched.
+ *                          select_key       (string)  Can contain a SQL statement on which keys to select. Plugins can also set this, pay attention!
+ *                          group_by         (string)  Can contain a SQL statement on how to group the query. Plugins can also set this, pay attention!
+ *                          returncode       (string)  If set to "array", the array of entries will be returned. "flat-array" will only return the articles without their entryproperties. "single" will only return a 1-dimensional array. "query" will only return the used SQL.
+ *                          joinauthors      (bool)    Should an SQL-join be made to the AUTHORS DB table?
+ *                          joincategories   (bool)    Should an SQL-join be made to the CATEGORIES DB table?
  *
  *                      [PRINTING]
  *                          template:          (string)  Name of the template file to print entries with
@@ -228,6 +233,26 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) {
         $params['prevent_reset'] = false;
     }
 
+    if (empty($params['select_key'])) {
+        $params['select_key'] = null;
+    }
+
+    if (empty($params['group_by'])) {
+        $params['group_by'] = null;
+    }
+
+    if (empty($params['returncode'])) {
+        $params['returncode'] = 'array';
+    }
+
+    if (empty($params['joinauthors'])) {
+        $params['joinauthors'] = true;
+    }
+
+    if (empty($params['joincategories'])) {
+        $params['joincategories'] = true;
+    }
+
     // Some functions deal with the $serendipity array. To modify them, we need to store
     // their original contents.
     $old_var = array();
@@ -265,7 +290,12 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) {
             $params['orderby'],
             $params['filter_sql'],
             $params['noCache'],
-            $params['noSticky']
+            $params['noSticky'],
+            $params['select_key'],
+            $params['group_by'],
+            $params['returncode'],
+            $params['joinauthors'],
+            $params['joincategories']
         );
 
         // Check whether the returned entries shall be grouped specifically