Index: /extensions/Extra_special_functions/tags/2.1.a/main.inc.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/main.inc.php	(revision 7599)
+++ /extensions/Extra_special_functions/tags/2.1.a/main.inc.php	(revision 7599)
@@ -0,0 +1,113 @@
+<?php
+/*
+Plugin Name: Extra special functions
+Version: 2.1.a
+Description: Adds functions 'Flat all elements', 'Calendar by posted date', 'Calendar by creation date' and toggle function 'Display recently posted / all' into special functions.
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=460
+Author: Pavel Budka
+Author URI: http://budkovi.ic.cz
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function add_extra_functions($menu_ref_arr)
+{
+  $menu = & $menu_ref_arr[0];
+  global $filter, $user;
+  
+  if (($block = $menu->get_block('mbSpecials')) != null )
+  {
+    load_language('plugin.lang', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+
+    $str = $_SERVER['QUERY_STRING'];
+    $args = explode('&',$str);
+    $filter_rec = ($filter['enabled'] && $filter['recent_period']!=-1);
+    // remove previously added extra functions from url
+    $url_rest='';
+    foreach($args as $arg) {
+    if (strncmp($arg,'filter',6) == 0)
+      ; // ommit this parameter 
+    elseif (!empty($arg) && $arg[0] != '/')
+        $url_rest.='&'.$arg;
+    else
+      $cat_arg=$arg;
+      } // foreach
+    if (isset($cat_arg))
+      $cat_els = explode('/',$cat_arg);
+    else
+      $cat_els = array();
+          
+    // set of modificatiors
+    $items = array('flat' => 'display all elements in all sub-albums', 
+                'posted-monthly-calendar' => 'display a calendar by posted date',
+                'created-monthly-calendar' => 'display a calendar by creation date');
+                
+    // remove previously added extra functions from url
+    foreach($items as $item => $label)
+      if(($id=array_search($item,$cat_els)) != false)
+        unset($cat_els[$id]);
+    $cat_els=array_values($cat_els);
+                
+    // TODO: &filter=start-recent-20, &filter=stop
+    
+    // remove other functions
+//    $block->data=array();
+    
+    // add extra functions to url and to menu
+    foreach($items as $item => $label) {
+    // prepare url
+    array_push ($cat_els,$item);
+   
+    $url='';
+    foreach($cat_els as $cat_el)
+      if (empty($url)) 
+        $url.='?'.$cat_el;
+      else 
+        $url.='/'.$cat_el;
+    $url.=$url_rest;
+    array_pop($cat_els);
+    
+    // extend menu
+    array_push($block->data, 
+      array(
+        'URL' => $url,
+        'TITLE' => l10n($label),
+        'NAME' => l10n($item)
+        )
+      
+    );
+  } // for
+  
+  // add filter extra function to url and to menu
+  $url='';
+  foreach($cat_els as $cat_el)
+    if (empty($url)) 
+      $url.='?'.$cat_el;
+    else 
+      $url.='/'.$cat_el;
+  $url.=$url_rest;
+  if ($url[0] == '&') $url[0]='?';  
+
+  // extend menu
+  if(!$filter_rec)
+    array_push($block->data, 
+      array(
+        'URL' => $url.'&'.'filter=start-recent-'.$user['recent_period'],
+        'TITLE' => l10n('display only recently posted images'),
+        'NAME' => l10n('filter-start-recent')
+        ));
+  else 
+    array_push($block->data, 
+      array(
+        'URL' => $url.'&'.'filter=stop',
+        'TITLE' => l10n('return to the display of all images'),
+        'NAME' => l10n('filter-stop')
+        ));
+  
+  } // if
+  
+} // add_link_mostcommented
+
+add_event_handler('blockmanager_apply' , 'add_extra_functions');
+
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/description.txt
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/description.txt	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/description.txt	(revision 7598)
@@ -0,0 +1,1 @@
+Do menu Zobrazit přidá funkce 'Všechny objekty pod-kategorií', 'Kalendář podle data vložení', 'Kalendář podle data vytvoření' a funkci 'Zobrazit nově vložené / všechny'.
Index: /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/plugin.lang.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/plugin.lang.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/plugin.lang.php	(revision 7598)
@@ -0,0 +1,9 @@
+<?php
+
+$lang['posted-monthly-calendar'] = 'Kalendář podle data vložení';
+$lang['created-monthly-calendar'] = 'Kalendář podle data vytvoření';
+$lang['flat'] = 'Všechny objekty pod-kategorií';
+$lang['filter-start-recent'] = 'Zobrazit nově vložené';
+$lang['filter-stop'] = 'Zobrazit všechny';
+
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/index.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/index.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/cs_CZ/index.php	(revision 7598)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/description.txt
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/description.txt	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/description.txt	(revision 7598)
@@ -0,0 +1,1 @@
+Adds functions 'Flat all elements', 'Calendar by posted date', 'Calendar by creation date' and toggle function 'Display recently posted / all' into special functions.
Index: /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/plugin.lang.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/plugin.lang.php	(revision 7598)
@@ -0,0 +1,9 @@
+<?php
+
+$lang['posted-monthly-calendar'] = 'Calendar by post date';
+$lang['created-monthly-calendar'] = 'Calendar by creation date';
+$lang['flat'] = 'Flat all elements';
+$lang['filter-start-recent'] = 'Display recently posted';
+$lang['filter-stop'] = 'Display all';
+
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/index.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/index.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/en_UK/index.php	(revision 7598)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/language/index.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/language/index.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/language/index.php	(revision 7598)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Extra_special_functions/tags/2.1.a/index.php
===================================================================
--- /extensions/Extra_special_functions/tags/2.1.a/index.php	(revision 7598)
+++ /extensions/Extra_special_functions/tags/2.1.a/index.php	(revision 7598)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
