Index: /trunk/admin/configuration.php
===================================================================
--- /trunk/admin/configuration.php	(revision 6410)
+++ /trunk/admin/configuration.php	(revision 6411)
@@ -115,8 +115,4 @@
     case 'main' :
     {
-      if ( !url_is_remote($_POST['gallery_url']) )
-      {
-        array_push($page['errors'], l10n('The gallery URL is not valid.'));
-      }
       foreach( $main_checkboxes as $checkbox)
       {
Index: /trunk/admin/include/functions_notification_by_mail.inc.php
===================================================================
--- /trunk/admin/include/functions_notification_by_mail.inc.php	(revision 6410)
+++ /trunk/admin/include/functions_notification_by_mail.inc.php	(revision 6411)
@@ -94,5 +94,5 @@
 
 /*
- * Execute all main queries to get list of user 
+ * Execute all main queries to get list of user
  *
  * Type are the type of list 'subscribe', 'send'
@@ -111,5 +111,5 @@
     if (count($quoted_check_key_list) != 0 )
     {
-      $query_and_check_key = ' and 
+      $query_and_check_key = ' and
     check_key in ('.implode(",", $quoted_check_key_list).') ';
     }
@@ -132,5 +132,5 @@
 where
   N.user_id =  U.'.$conf['user_fields']['id'];
-  
+
     if ($action == 'send')
     {
@@ -419,5 +419,5 @@
             $section_action_by => true,
             'GOTO_GALLERY_TITLE' => $conf['gallery_title'],
-            'GOTO_GALLERY_URL' => $conf['gallery_url'],
+            'GOTO_GALLERY_URL' => get_gallery_home_url(),
           )
         );
Index: /trunk/admin/notification_by_mail.php
===================================================================
--- /trunk/admin/notification_by_mail.php	(revision 6410)
+++ /trunk/admin/notification_by_mail.php	(revision 6411)
@@ -382,5 +382,5 @@
                 (
                   'GOTO_GALLERY_TITLE' => $conf['gallery_title'],
-                  'GOTO_GALLERY_URL' => $conf['gallery_url'],
+                  'GOTO_GALLERY_URL' => get_gallery_home_url(),
                   'SEND_AS_NAME'      => $env_nbm['send_as_name'],
                 )
Index: /trunk/feed.php
===================================================================
--- /trunk/feed.php	(revision 6410)
+++ /trunk/feed.php	(revision 6411)
@@ -111,5 +111,5 @@
 $rss->title.= ' (as '.stripslashes($user['username']).')';
 
-$rss->link = $conf['gallery_url'];
+$rss->link = get_gallery_home_url();
 
 // +-----------------------------------------------------------------------+
@@ -126,5 +126,5 @@
     $item = new FeedItem();
     $item->title = sprintf(l10n('New on %s'), format_date($dbnow) );
-    $item->link = $conf['gallery_url'];
+    $item->link = get_gallery_home_url();
 
     // content creation
Index: /trunk/include/config_default.inc.php
===================================================================
--- /trunk/include/config_default.inc.php	(revision 6410)
+++ /trunk/include/config_default.inc.php	(revision 6411)
@@ -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: /trunk/include/functions_mail.inc.php
===================================================================
--- /trunk/include/functions_mail.inc.php	(revision 6410)
+++ /trunk/include/functions_mail.inc.php	(revision 6411)
@@ -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: /trunk/include/functions_url.inc.php
===================================================================
--- /trunk/include/functions_url.inc.php	(revision 6410)
+++ /trunk/include/functions_url.inc.php	(revision 6411)
@@ -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: /trunk/include/section_init.inc.php
===================================================================
--- /trunk/include/section_init.inc.php	(revision 6410)
+++ /trunk/include/section_init.inc.php	(revision 6411)
@@ -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
@@ -374,6 +373,6 @@
       $page,
       array(
-	'title' => l10n('Favorites')
-	    )
+        'title' => l10n('Favorites')
+      )
     );
 
@@ -559,4 +558,14 @@
 }
 
+// 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'];
+}
+
 // add meta robots noindex, nofollow to avoid unnecesary robot crawls
 $page['meta_robots']=array();
Index: /trunk/install/config.sql
===================================================================
--- /trunk/install/config.sql	(revision 6410)
+++ /trunk/install/config.sql	(revision 6411)
@@ -11,5 +11,5 @@
 INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_locked','false','Lock your gallery temporary for non admin users');
 INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_title','Piwigo demonstration site','Title at top of each page and for RSS feed');
-INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_url','http://piwigo.org/demo','URL given in RSS feed');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_url','','Optional alternate homepage for the gallery');
 INSERT INTO piwigo_config (param,value,comment) VALUES ('rate','true','Rating pictures feature is enabled');
 INSERT INTO piwigo_config (param,value,comment) VALUES ('rate_anonymous','true','Rating pictures feature is also enabled for visitors');
Index: /trunk/install/upgrade_1.5.0.php
===================================================================
--- /trunk/install/upgrade_1.5.0.php	(revision 6410)
+++ /trunk/install/upgrade_1.5.0.php	(revision 6411)
@@ -319,6 +319,6 @@
 $params = array(
   'gallery_url' => array(
-    'http://piwigo.org/demo',
-    'URL given in RSS feed'
+    '',
+    'Optional alternate homepage for the gallery'
     ),
   'rate' => array(
