From c8c1e0ef3b229a82e74c70aeacc29f2ba021afbe Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Tue, 27 Jun 2006 17:56:44 -0400
Subject: [PATCH] Renameable folders, mail-checking changes, other fixes (richs)

---
 program/include/main.inc |   69 +++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index f1102d7..cc019af 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -42,6 +42,10 @@
   // load config file
   include_once('config/main.inc.php');
   $CONFIG = is_array($rcmail_config) ? $rcmail_config : array();
+  
+  // load host-specific configuration
+  rcmail_load_host_config($CONFIG);
+  
   $CONFIG['skin_path'] = $CONFIG['skin_path'] ? preg_replace('/\/$/', '', $CONFIG['skin_path']) : 'skins/default';
 
   // load db conf
@@ -78,7 +82,7 @@
     
   // we can use the database for storing session data
   // session queries do not work with MDB2
-  if ($CONFIG['db_backend']!='mdb2' && !$DB->is_error())
+  if (!$DB->is_error())
     include_once('include/session.inc');
 
   // init session
@@ -125,6 +129,24 @@
 
 
   register_shutdown_function('rcmail_shutdown');
+  }
+
+
+// load a host-specific config file if configured
+function rcmail_load_host_config(&$config)
+  {
+  $fname = NULL;
+  
+  if (is_array($config['include_host_config']))
+    $fname = $config['include_host_config'][$_SERVER['HTTP_HOST']];
+  else if (!empty($config['include_host_config']))
+    $fname = preg_replace('/[^a-z0-9\.\-_]/i', '', $_SERVER['HTTP_HOST']) . '.inc.php';
+
+   if ($fname && is_file('config/'.$fname))
+     {
+     include('config/'.$fname);
+     $config = array_merge($config, $rcmail_config);
+     }
   }
   
 
@@ -267,11 +289,11 @@
 // check the given string and returns language properties
 function rcube_language_prop($lang, $prop='lang')
   {
-  global $INSTLL_PATH;
+  global $INSTALL_PATH;
   static $rcube_languages, $rcube_language_aliases, $rcube_charsets;
 
   if (empty($rcube_languages))
-    @include($INSTLL_PATH.'program/localization/index.inc');
+    @include($INSTALL_PATH.'program/localization/index.inc');
     
   // check if we have an alias for that language
   if (!isset($rcube_languages[$lang]) && isset($rcube_language_aliases[$lang]))
@@ -313,16 +335,19 @@
   $javascript = "var $JS_OBJECT_NAME = new rcube_webmail();\n";
   $javascript .= "$JS_OBJECT_NAME.set_env('comm_path', '$COMM_PATH');\n";
 
-  foreach ($CONFIG['javascript_config'] as $js_config_var){
-    $javascript .= "$JS_OBJECT_NAME.set_env('$js_config_var', '" . $CONFIG[$js_config_var] . "');\n";
+  if (isset($CONFIG['javascript_config'] )){
+    foreach ($CONFIG['javascript_config'] as $js_config_var){
+      $javascript .= "$JS_OBJECT_NAME.set_env('$js_config_var', '" . $CONFIG[$js_config_var] . "');\n";
+    }
   }
   
   if (!empty($GLOBALS['_framed']))
     $javascript .= "$JS_OBJECT_NAME.set_env('framed', true);\n";
     
   $OUTPUT->add_script($javascript);
-  $OUTPUT->include_script('program/js/common.js');
-  $OUTPUT->include_script('program/js/app.js');
+  $OUTPUT->include_script('common.js');
+  $OUTPUT->include_script('app.js');
+  $OUTPUT->scripts_path = 'program/js/';
 
   // set locale setting
   rcmail_set_locale($sess_user_lang);
@@ -332,7 +357,7 @@
     $OUTPUT->set_charset($CONFIG['charset']);
 
   // add some basic label to client
-  rcube_add_label('loading');
+  rcube_add_label('loading','checkingmail');
   }
 
 
@@ -717,7 +742,7 @@
     {
     $s_header_sent = TRUE;
     send_nocacheing_headers();
-    header('Content-Type: application/x-javascript');
+    header('Content-Type: application/x-javascript; charset='.$CHARSET);
     print '/** remote response ['.date('d/M/Y h:i:s O')."] **/\n";
     }
 
@@ -739,13 +764,13 @@
 
   if (!sizeof($sa_languages))
     {
-    @include($INSTLL_PATH.'program/localization/index.inc');
+    @include($INSTALL_PATH.'program/localization/index.inc');
 
-    if ($dh = @opendir($INSTLL_PATH.'program/localization'))
+    if ($dh = @opendir($INSTALL_PATH.'program/localization'))
       {
       while (($name = readdir($dh)) !== false)
         {
-        if ($name{0}=='.' || !is_dir($INSTLL_PATH.'program/localization/'.$name))
+        if ($name{0}=='.' || !is_dir($INSTALL_PATH.'program/localization/'.$name))
           continue;
 
         if ($label = $rcube_languages[$name])
@@ -1167,6 +1192,7 @@
         'identityform' => 'rcube_identity_form',
         'foldersubscription' => 'rcube_subscription_form',
         'createfolder' => 'rcube_create_folder_form',
+	'renamefolder' => 'rcube_rename_folder_form',
         'composebody' => 'rcmail_compose_body'
       );
 
@@ -1189,14 +1215,16 @@
         $task = $GLOBALS['_task'];
         $title = !empty($CONFIG['product_name']) ? $CONFIG['product_name'].' :: ' : '';
         
-        if ($task=='mail' && isset($GLOBALS['MESSAGE']['subject']))
+        if ($task=='login')
+          $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $CONFIG['product_name'])));
+        else if ($task=='mail' && isset($GLOBALS['MESSAGE']['subject']))
           $title .= $GLOBALS['MESSAGE']['subject'];
         else if (isset($GLOBALS['PAGE_TITLE']))
           $title .= $GLOBALS['PAGE_TITLE'];
         else if ($task=='mail' && ($mbox_name = $IMAP->get_mailbox_name()))
           $title .= rcube_charset_convert($mbox_name, 'UTF-7', 'UTF-8');
         else
-          $title .= $task;
+          $title .= ucfirst($task);
           
         return rep_specialchars_output($title, 'html', 'all');
         }
@@ -1224,7 +1252,7 @@
   if ($attrib['type'])
     $attrib['type'] = strtolower($attrib['type']);
   else
-    $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $arg['imagect']) ? 'image' : 'link';
+    $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $arg['imageact']) ? 'image' : 'link';
   
   
   $command = $attrib['command'];
@@ -1234,7 +1262,7 @@
     $attrib = $sa_buttons[$attrib['name']];
 
   // add button to button stack
-  else if($attrib['image'] || $arg['imagect'] || $attrib['imagepas'] || $attrib['class'])
+  else if($attrib['image'] || $arg['imageact'] || $attrib['imagepas'] || $attrib['class'])
     {
     if(!$attrib['name'])
       $attrib['name'] = $command;
@@ -1290,7 +1318,7 @@
                                 $attrib['id'],
                                 $attrib['type'],
                                 $attrib['imageact'] ? $skin_path.$attrib['imageact'] : $attrib['classact'],
-                                $attirb['imagesel'] ? $skin_path.$attirb['imagesel'] : $attrib['classsel'],
+                                $attrib['imagesel'] ? $skin_path.$attrib['imagesel'] : $attrib['classsel'],
                                 $attrib['imageover'] ? $skin_path.$attrib['imageover'] : ''));
 
     // make valid href to task buttons
@@ -1311,6 +1339,11 @@
     $attrib['onmouseout'] = sprintf("return %s.button_out('%s','%s')", $JS_OBJECT_NAME, $command, $attrib['id']);
     }
 
+  if ($command && $attrib['imagesel'])
+    {
+    $attrib['onmousedown'] = sprintf("return %s.button_sel('%s','%s')", $JS_OBJECT_NAME, $command, $attrib['id']);
+    $attrib['onmouseup'] = sprintf("return %s.button_out('%s','%s')", $JS_OBJECT_NAME, $command, $attrib['id']);
+    }
 
   $out = '';
 
@@ -1323,7 +1356,7 @@
     if ($attrib['label'])
       $btn_content .= ' '.$attrib['label'];
     
-    $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'title');
+    $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'title');
     }
   else if ($attrib['type']=='link')
     {

--
Gitblit v1.9.1