Index: branches/2.1/include/config_default.inc.php
===================================================================
--- branches/2.1/include/config_default.inc.php	(revision 6384)
+++ branches/2.1/include/config_default.inc.php	(revision 6410)
@@ -329,5 +329,5 @@
 // If set true, the login "user" will equal "User" or "USER" or "user",
 // etc. ... And it will be impossible to use such login variation to create a
-// new user account. 
+// new user account.
 $conf['insensitive_case_logon'] = false;
 
@@ -335,10 +335,4 @@
 // 'filename'
 $conf['uniqueness_mode'] = 'md5sum';
-
-// home_page : relative url of the homepage. Empty by default.
-// It points to the index of the gallery.
-// This parameter is used if home page is not index.php of the gallery.
-// We suggest avoid the names "index.htm" or "index.html" if you set $conf['php_extension_in_urls'] to false.
-$conf['home_page'] = '';
 
 // +-----------------------------------------------------------------------+
@@ -464,4 +458,7 @@
 // activate template debugging - a new window will appear
 $conf['debug_template'] = false;
+
+// save copies of sent mails into local data dir
+$conf['debug_mail'] = false;
 
 // die_on_sql_error: if an SQL query fails, should everything stop?
Index: branches/2.1/include/functions_mail.inc.php
===================================================================
--- branches/2.1/include/functions_mail.inc.php	(revision 6384)
+++ branches/2.1/include/functions_mail.inc.php	(revision 6410)
@@ -151,36 +151,4 @@
 }
 
-/**
- * Returns an completed array template/theme
- * completed with get_default_theme()
- *
- * @params:
- *   - args: incompleted array of template/theme
- *       o template: template to use [default get_default_theme()]
- *       o theme: template to use [default get_default_theme()]
- */
-function get_array_template_theme($args = array())
-{
-  global $conf;
-
-  $res = array();
-
-  if (empty($args['template']) or empty($args['theme']))
-  {
-    list($res['template'], $res['theme']) = explode('/', get_default_theme());
-  }
-
-  if (!empty($args['template']))
-  {
-    $res['template'] = $args['template'];
-  }
-
-  if (!empty($args['theme']))
-  {
-    $res['theme'] = $args['theme'];
-  }
-
-  return $res;
-}
 
 /**
@@ -642,7 +610,5 @@
 
           // Footer
-          'GALLERY_URL' =>
-            isset($page['gallery_url']) ?
-                  $page['gallery_url'] : $conf['gallery_url'],
+          'GALLERY_URL' => get_gallery_home_url(),
           'GALLERY_TITLE' =>
             isset($page['gallery_title']) ?
@@ -829,5 +795,5 @@
 
 /*Testing block*/
-/*function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
+function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
 {
     global $conf, $user, $lang_info;
@@ -835,5 +801,5 @@
     if ( mkgetdir( $dir,  MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
     {
-      $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
+      $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['theme'].'-'.date('YmdHis');
       if ($args['content_format'] == 'text/plain')
       {
@@ -853,5 +819,6 @@
     return $result;
 }
-add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);*/
+if ($conf['debug_mail'])
+  add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);
 
 
Index: branches/2.1/include/functions_url.inc.php
===================================================================
--- branches/2.1/include/functions_url.inc.php	(revision 6384)
+++ branches/2.1/include/functions_url.inc.php	(revision 6410)
@@ -59,5 +59,5 @@
   if ($with_scheme)
   {
-    if (isset($_SERVER['HTTPS']) && 
+    if (isset($_SERVER['HTTPS']) &&
 	((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))
     {
@@ -728,3 +728,22 @@
 }
 
+/**
+ * Returns the 'home page' of this gallery
+ */
+function get_gallery_home_url()
+{
+  global $conf;
+  if (!empty($conf['gallery_url']))
+  {
+    if (url_is_remote($conf['gallery_url']) or strncmp($conf['gallery_url'], '/', 1)==0)
+    {
+      return $conf['gallery_url'];
+    }
+    return get_root_url().$conf['gallery_url'];
+  }
+  else
+  {
+    return make_index_url();
+  }
+}
 ?>
Index: branches/2.1/include/section_init.inc.php
===================================================================
--- branches/2.1/include/section_init.inc.php	(revision 6384)
+++ branches/2.1/include/section_init.inc.php	(revision 6410)
@@ -220,6 +220,4 @@
 if ('categories' == $page['section'])
 {
-  $page['title'] = '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>';
-
   if (isset($page['category']))
   {
@@ -233,9 +231,10 @@
               'main_page_category_description'
             ),
-        'title'             =>
-          $page['title'].$conf['level_separator'].get_cat_display_name($page['category']['upper_names'], '', false),
-        )
-      );
-  }
+        'title'             => get_cat_display_name($page['category']['upper_names'], '', false),
+        )
+      );
+  }
+  else
+    $page['title'] = ''; // will be set later
 
   if
@@ -337,5 +336,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].get_tags_content_title(),
+        'title' => get_tags_content_title(),
         'items' => $items,
         )
@@ -359,5 +358,5 @@
       array(
         'items' => $search_result['items'],
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">'
+        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
                   .l10n('Search results').'</a>',
         )
@@ -374,6 +373,6 @@
       $page,
       array(
-	'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('Favorites')
-	    )
+        'title' => l10n('Favorites')
+      )
     );
 
@@ -454,5 +453,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">'
+        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
                   .l10n('Recent pictures').'</a>',
         'items' => array_from_query($query, 'id'),
@@ -468,5 +467,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('Recent categories'),
+        'title' => l10n('Recent categories'),
         )
       );
@@ -492,5 +491,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">'
+        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
                   .$conf['top_number'].' '.l10n('Most visited').'</a>',
         'items' => array_from_query($query, 'id'),
@@ -518,5 +517,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">'
+        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
                   .$conf['top_number'].' '.l10n('Best rated').'</a>',
         'items' => array_from_query($query, 'id'),
@@ -541,5 +540,5 @@
       $page,
       array(
-        'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">'
+        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
                     .l10n('Random pictures').'</a>',
         'items' => array_from_query($query, 'id'),
@@ -557,4 +556,14 @@
   include_once( PHPWG_ROOT_PATH.'include/functions_calendar.inc.php' );
   initialize_calendar();
+}
+
+// title update
+if (isset($page['title']))
+{
+  if (!empty($page['title']))
+	{
+	  $page['title'] = $conf['level_separator'].$page['title'];
+	}
+  $page['title'] = '<a href="'.get_gallery_home_url().'">'.l10n('Home').'</a>'.$page['title'];
 }
 
