]> git.mjollnir.org Git - s9y.git/commitdiff
Fix a bug that might prevent {serendipity_fetchPrintEntries} from
authorgarvinhicking <garvinhicking>
Fri, 31 Mar 2006 18:35:24 +0000 (18:35 +0000)
committergarvinhicking <garvinhicking>
Fri, 31 Mar 2006 18:35:24 +0000 (18:35 +0000)
correctly showing output, and maybe duplicating entry list.

include/functions_smarty.inc.php

index da5761fd829105dfe38edb1c27ec3663782ae108..81826498d831e2a3193b40effe7a320c9bc73d4c 100644 (file)
@@ -117,6 +117,7 @@ function serendipity_emptyPrefix($string, $prefix = ': ') {
  *                          groupmode          (string   Indicates whether the input $entries array is already grouped in preparation for the smarty $entries output array [TRUE], or if it shall be grouped by date [FALSE]
  *                          skip_smarty_hooks  (boolean) If TRUE, no plugins will be executed at all
  *                          skip_smarty_hook   (mixed)   Can be set to an array of plugin hooks to NOT execute
+ *                          prevent_reset      (boolean) If set to TRUE, the smarty $entries array will NOT be cleared. (to prevent possible duplicate output of entries)
  * @param   object      Smarty object
  * @return  string      The Smarty HTML response
  */
@@ -189,6 +190,10 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) {
         $params['skip_smarty_hook'] = array();
     }
 
+    if (empty($params['prevent_reset'])) {
+        $params['prevent_reset'] = false;
+    }
+
     // Some functions deal with the $serendipity array. To modify them, we need to store
     // their original contents.
     $old_var = array();
@@ -257,10 +262,11 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) {
         $entry,                                 // Entry data
         (!empty($params['id']) ? true : false), // Extended data?
         $params['preview'],                     // Entry preview?
+        'ENTRIES',
         false,                                  // Prevent Smarty parsing
         $params['use_hooks'],
         $params['use_footer'],
-        ($params['groupmode'] == 'date' ? true : false) // Grouping of $entry
+        ($params['groupmode'] == 'date' ? false : true) // Grouping of $entry
     );
 
     // Restore the $serendipity array after our modifications.
@@ -275,7 +281,10 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) {
     }
 
     $out = serendipity_smarty_fetch($params['block'], $params['template']);
-
+    // Reset array list, because we might be in a nested code call.
+    if ($params['prevent_reset'] == false) {
+        $serendipity['smarty']->assign('entries', array());
+    }
     $serendipity['skip_smarty_hook']  = $old_var['skip_smarty_hook'];
     $serendipity['skip_smarty_hooks'] = $old_var['skip_smarty_hooks'];