Index: /extensions/theme_switch/tags/2.0/flags.tpl
===================================================================
--- /extensions/theme_switch/tags/2.0/flags.tpl	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/flags.tpl	(revision 7073)
@@ -0,0 +1,48 @@
+</ul>
+<ul class="categoryActions">
+<li class="menuf">
+	<div>
+		<ul>
+			<li>
+				<a rel="nofollow" href="#">
+					<img class="flags" src="{$theme_switch.Active.img}" alt="{$theme_switch.Active.alt}" title="{$theme_switch.Active.alt}"/>
+				</a>
+				<!--[if lte IE 6]>
+					<a rel="nofollow" href="#">
+						<img class="flags" src="{$theme_switch.Active.img}" alt="{$theme_switch.Active.alt}" title="{$theme_switch.Active.alt}"/>
+						<table>
+							<tr>
+								<td>
+				<![endif]-->
+									<ul class="flag-pan">
+									{foreach from=$theme_switch.flags key=code item=flag name=f}
+										<li>
+											<a rel="nofollow" href="{$SCRIPT_NAME}{$flag.url}">
+												<img class="flags" src="{$flag.img}" alt="{$flag.alt}" title="{$flag.alt}"/>
+											</a>
+										</li>
+									{/foreach}
+									</ul>
+				<!--[if lte IE 6]>
+								</td>
+							</tr>
+						</table>
+					</a>
+				<![endif]-->
+			</li>
+		</ul>
+	</div>
+</li>
+{html_head}
+{if $themeconf.template=='yoga' and $themeconf.theme=='Sylvia'}
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}{$THEME_SWITCH_PATH|@cat:'theme_switch.css'}"> 
+{else}
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}{$THEME_SWITCH_PATH|@cat:'theme_switch-default.css'}"> 
+{/if}
+{if Componant_exists($theme_SWITCH_PATH, 'theme_switch-local.css')}
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}{$THEME_SWITCH_PATH|@cat:'theme_switch-local.css'}"> 
+{/if}
+<!--[if lte IE 6]>
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}{$THEME_SWITCH_PATH|@cat:'theme_switch-ie6.css'}"> 
+<![endif]-->
+{/html_head}
Index: /extensions/theme_switch/tags/2.0/icons/floPure/index.php
===================================================================
--- /extensions/theme_switch/tags/2.0/icons/floPure/index.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/icons/floPure/index.php	(revision 7073)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/theme_switch/tags/2.0/icons/index.php
===================================================================
--- /extensions/theme_switch/tags/2.0/icons/index.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/icons/index.php	(revision 7073)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/theme_switch/tags/2.0/icons/yoga/index.php
===================================================================
--- /extensions/theme_switch/tags/2.0/icons/yoga/index.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/icons/yoga/index.php	(revision 7073)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/theme_switch/tags/2.0/index.php
===================================================================
--- /extensions/theme_switch/tags/2.0/index.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/index.php	(revision 7073)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/theme_switch/tags/2.0/main.inc.php
===================================================================
--- /extensions/theme_switch/tags/2.0/main.inc.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/main.inc.php	(revision 7073)
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// | Theme switch plugin                                                   |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Pavel Budka                http://pbudka.co.cc |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+/*
+Plugin Name: Theme Switch
+Version: 2.0.a
+Description: Switch to another template/theme from flags on your gallery home page. Edit file main.inc.php for configuration. Based on Language switch
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=257
+Author: Pavel Budka
+Author URI: http://pbudka.co.cc
+*/
+
+include_once(PHPWG_PLUGINS_PATH.'theme_switch/theme_switch.inc.php');
+$theme_controler = new theme_controler();
+add_event_handler('loading_lang', array(&$theme_controler, '_switch'), 5 );
+
+// If you want user to choose from icons then use following handler. 
+// Only themes which have gif icon provided in icons plugin directory will be provided to users.
+// Gif file name must be the same as theme's name and must be stored in sub directory named according to template's name.  
+
+add_event_handler('loc_end_index', array(&$theme_controler, '_flags'), 95 );
+
+// If you want user to choose using select control then use following handler.
+// All available themes will be provided to users. 
+
+// add_event_handler('loc_end_index', array(&$theme_controler, '_select'), 95 );
+
+?>
Index: /extensions/theme_switch/tags/2.0/theme_switch-default.css
===================================================================
--- /extensions/theme_switch/tags/2.0/theme_switch-default.css	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/theme_switch-default.css	(revision 7073)
@@ -0,0 +1,15 @@
+.flag-pan { width:132px; z-index:100; border-width:1px; border-style: solid; background-color: #999; padding: 2px 5px 10px 5px; }
+.content ul.categoryActions .flag-pan a img.flags { margin: 5px 2px 10px; }
+.content ul.categoryActions .flag-pan a { margin: 0; }
+.menuf { width:30px; height:24px; display: inline; } 
+.menuf ul li a, .menuf ul li a:visited {display:block; text-decoration:none; width:44px; height:27px; text-align:center; line-height:27px; overflow:hidden;}
+.menuf ul {padding:0; margin:0; list-style: none;}
+.menuf ul li {float:left; position:relative; right: 0; top: 0;}
+.menuf ul li ul {display: none;}/* specific to non IE browsers */
+.menuf li a:hover { border:0 !important;}
+.menuf .flags {border-width:1px !important; ; border-style: solid !important; }
+.menuf ul li:hover ul {display:block; position:absolute; top:0px; left:-96px; }
+.menuf ul li:hover ul li ul {display: none;}
+.menuf ul li:hover ul li {display: block;}
+.menuf ul li:hover ul li a {display:block;}
+.menuf ul li:hover ul li:hover ul {display:block; position:absolute; left:0px; top:0;}
Index: /extensions/theme_switch/tags/2.0/theme_switch-ie6.css
===================================================================
--- /extensions/theme_switch/tags/2.0/theme_switch-ie6.css	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/theme_switch-ie6.css	(revision 7073)
@@ -0,0 +1,6 @@
+.menuf ul li a.hide, .menuf ul li a:visited.hide {display:none;}
+.menuf ul li a:hover ul li a.hide {display:none;}
+.menuf ul li a:hover ul { display:block; position:absolute; top:-15%; left:-85%; }
+.menuf ul li a:hover ul li a {display:block; }
+.menuf ul li a:hover ul li a ul {visibility:hidden;}
+.menuf ul li a:hover ul li a:hover ul {visibility:visible; position:absolute; left:105px; top:0;}
Index: /extensions/theme_switch/tags/2.0/theme_switch.css
===================================================================
--- /extensions/theme_switch/tags/2.0/theme_switch.css	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/theme_switch.css	(revision 7073)
@@ -0,0 +1,8 @@
+@import "theme_switch-default.css";
+
+.flag-pan { border:1px solid; background-color: #111; }
+.menuf .flags {border-color: #000 !important; }
+
+.flag-pan { 	border-radius: 8px; } /* round corners with CSS3 compliant browsers */
+.flag-pan { -moz-border-radius:8px; } 
+.flag-pan { -webkit-border-radius: 8px; }
Index: /extensions/theme_switch/tags/2.0/theme_switch.inc.php
===================================================================
--- /extensions/theme_switch/tags/2.0/theme_switch.inc.php	(revision 7073)
+++ /extensions/theme_switch/tags/2.0/theme_switch.inc.php	(revision 7073)
@@ -0,0 +1,147 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// | Theme switch plugin                                                   |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008      Pavel Budka                http://pbudka.co.cc |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+if (!defined('THEME_SWITCH_PATH'))
+define('THEME_SWITCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+class theme_controler {
+static public function _switch()
+{
+  global $user, $template, $conf, $lang;
+  if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+  $same = $user['template'].'/'.$user['theme'];
+  if ( isset( $_GET['theme']) and isset( $_GET['template']) )
+  {
+    if ( !empty($_GET['theme']) and !empty($_GET['template']) and
+      file_exists( PHPWG_ROOT_PATH.'template/'.$_GET['template'].'/theme/'.$_GET['theme']) )
+    {
+      if (is_a_guest() or is_generic())
+      {
+        setcookie( 'pwg_theme_switch', $_GET['theme'],
+          time()+60*60*24*30, cookie_path() );
+        setcookie( 'pwg_template_switch', $_GET['template'],
+          time()+60*60*24*30, cookie_path() );
+      }
+      else
+      {
+        $query = 'UPDATE '.USER_INFOS_TABLE.'
+        SET template = \''.$_GET['template'].'/'.$_GET['theme'].'\'
+        WHERE user_id = '.$user['id'].'
+        ;';
+        pwg_query($query);
+      }
+      $user['theme'] = $_GET['theme'];
+      $user['template'] = $_GET['template'];
+    }
+  }
+  else
+  // Users have $user['template']/$user['theme'] 
+  // Guest or generic members will use their cookied $user['template']/$user['theme'] !
+  if ((is_a_guest() or is_generic())
+    and isset( $_COOKIE['pwg_theme_switch'] )
+    and isset( $_COOKIE['pwg_template_switch'] ) )
+  {
+    $user['template'] = $_COOKIE['pwg_template_switch'];
+    $user['theme'] = $_COOKIE['pwg_theme_switch'];
+  }
+}
+
+static public function _flags()
+// Lets user choose from icons 
+// Only themes which have gif icon provided in icons plugin directory will be provided to users.
+// Gif file name must be the same as theme's name and must be stored in sub directory named according to template's name.  
+{
+  global $user, $template, $lang;
+  
+  $available_theme = get_pwg_themes();
+
+  $url_starting = get_query_string_diff(array('template', 'theme'));
+
+  foreach ( $available_theme as $code ) {
+    $qlc_img =  'plugins/theme_switch/icons/' . $code . '.gif';
+         
+    if (file_exists(PHPWG_ROOT_PATH.$qlc_img)) {
+      list($temp, $theme) = split('/',$code);
+      $qlc_url = str_replace(array('=&amp;','?&amp;'),array('&amp;','?'),
+                 add_url_params( $url_starting, array( 'template' => $temp, 'theme' => $theme  ) ));
+      if (isset($lang['theme']))
+        $qlc_alt = $lang['theme'].': '.ucwords( $code );
+      else
+        $qlc_alt = ucwords( $code );
+      $qlc_title =  $qlc_alt;
+      $qlc = array ( 
+        'url' => $qlc_url,
+        'alt' => $qlc_alt,
+        'img' => $qlc_img,
+        );
+      if ( $code !== $user['template'].'/'.$user['theme'])
+        $lsw['flags'][$code] = $qlc ;
+      else $lsw['Active'] = $qlc;
+      }
+  }
+    
+  $template->set_filename('theme_flags', dirname(__FILE__) . '/flags.tpl');
+  $lsw['side'] = ceil(sqrt(count($available_theme)));
+  $template->assign(array(
+    'theme_switch'=> $lsw,
+    'THEME_SWITCH_PATH' => THEME_SWITCH_PATH,
+  ));
+  $flags = $template->parse('theme_flags',true);
+  $template->clear_assign('theme_switch');
+  $template->concat( 'PLUGIN_INDEX_ACTIONS', $flags);
+}
+
+static public function _select()
+// Lets user choose using select control 
+// All available themes will be provided to users. 
+{
+  global $user, $template, $lang;
+  
+  $available_theme = get_pwg_themes();
+  $url_starting = get_query_string_diff(array('lang'));
+  $options='<li><span class="property">
+   <label for="template">'.$lang['theme'].'</label>
+  </span>
+  <select name="template" onchange="javasript:window.location=this.value">';
+  foreach ( $available_theme as $code )
+  {
+    list($temp, $theme) = split('/',$code);
+    $qlc_url = str_replace(array('=&amp;','?&amp;'),array('&amp;','?'),
+      add_url_params( $url_starting, array( 'template' => $temp, 'theme' => $theme  ) ));
+    
+    if ( $code == $user['template'].'/'.$user['theme'] )
+      $tmp='" selected="selected">';
+    else
+      $tmp='">';
+    $options=$options.'
+    <option label="'.$code.'" value="'.$qlc_url.$tmp.$code.'</option>';
+  }
+  $options=$options.'
+  </select></li>';
+  $template->concat( 'PLUGIN_INDEX_ACTIONS',$options);
+}
+}
+  /* {html_head} usage function */
+  /* See flags.tpl for example (due no catenation available) */
+if (!function_exists('Componant_exists')) {
+  function Componant_exists($path, $file)
+    { return file_exists( $path . $file); }
+}
+?>
