thomascube
2005-10-23 f3b659935f3386c077746cd7a84770532ed0ec50
Added patches for default language and sorting function


10 files modified
2 files added
124 ■■■■ changed files
CHANGELOG 6 ●●●●● patch | view | raw | blame | history
config/main.inc.php.dist 2 ●●● patch | view | raw | blame | history
index.php 4 ●●●● patch | view | raw | blame | history
program/include/main.inc 15 ●●●●● patch | view | raw | blame | history
program/js/app.js 13 ●●●● patch | view | raw | blame | history
program/lib/imap.inc 8 ●●●● patch | view | raw | blame | history
program/localization/index.inc 2 ●●● patch | view | raw | blame | history
program/steps/mail/func.inc 37 ●●●●● patch | view | raw | blame | history
program/steps/mail/list.inc 33 ●●●●● patch | view | raw | blame | history
program/steps/mail/sendmail.inc 4 ●●●● patch | view | raw | blame | history
skins/default/images/buttons/down_arrow.png patch | view | raw | blame | history
skins/default/images/buttons/up_arrow.png patch | view | raw | blame | history
CHANGELOG
@@ -60,3 +60,9 @@
- Display folder names with special chars correctly (Bug #1330157)
2005/10/22
----------
- Get IMAP server capabilities in array
- Check for NAMESPACE capability before sending command
- Set default user language from config 'locale_string'
- Added sorting patch (not finished yet)
config/main.inc.php.dist
@@ -75,7 +75,7 @@
$rcmail_config['ip_check'] = TRUE;
// not shure what this was good for :-) 
$rcmail_config['locale_string'] = 'de_DE';
$rcmail_config['locale_string'] = 'en';
// use this format for short date display
$rcmail_config['date_short'] = 'D H:i';
index.php
@@ -45,13 +45,13 @@
$INSTALL_PATH = './';
$OUTPUT_TYPE = 'html';
$JS_OBJECT_NAME = 'rcmail';
$CURRENT_PATH=dirname($_SERVER['SCRIPT_FILENAME']);
$CURRENT_PATH = dirname($_SERVER['SCRIPT_FILENAME']);
if ($CURRENT_PATH!='')
    $CURRENT_PATH.='/';
    
// set environment first
ini_set('include_path', $INSTALL_PATH.PATH_SEPARATOR.$CURRENT_PATH.'program'.PATH_SEPARATOR.$CURRENT_PATH.'program/lib'.PATH_SEPARATOR.ini_get('include_path'));
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$INSTALL_PATH.PATH_SEPARATOR.$CURRENT_PATH.'program'.PATH_SEPARATOR.$CURRENT_PATH.'program/lib');
ini_set('session.name', 'sessid');
ini_set('session.use_cookies', 1);
ini_set('error_reporting', E_ALL&~E_NOTICE);
program/include/main.inc
@@ -76,7 +76,7 @@
  if (!$_SESSION['client_id'])
    {
    $_SESSION['client_id'] = $sess_id;
    $_SESSION['user_lang'] = 'en';
    $_SESSION['user_lang'] = substr($CONFIG['locale_string'], 0, 2);
    $_SESSION['auth_time'] = mktime();
    $_SESSION['auth'] = rcmail_auth_hash($sess_id, $_SESSION['auth_time']);
    unset($GLOBALS['_auth']);
@@ -293,10 +293,11 @@
      array_merge($CONFIG, $user_prefs);
      }
    // set user specific language
    if (strlen($sql_arr['language']))
      $sess_user_lang = $_SESSION['user_lang'] = $sql_arr['language'];
    // update user's record
    $DB->query(sprintf("UPDATE %s
                        SET    last_login=NOW()
@@ -317,6 +318,7 @@
    $_SESSION['imap_port'] = $imap_port;
    $_SESSION['imap_ssl']  = $imap_ssl;
    $_SESSION['username']  = $user;
    $_SESSION['user_lang'] = $sess_user_lang;
    $_SESSION['password']  = encrypt_passwd($pass);
    // force reloading complete list of subscribed mailboxes    
@@ -333,13 +335,14 @@
function rcmail_create_user($user, $host)
  {
  global $DB, $CONFIG, $IMAP;
  $DB->query(sprintf("INSERT INTO %s
                      (created, last_login, username, mail_host)
                      VALUES (NOW(), NOW(), '%s', '%s')",
                      (created, last_login, username, mail_host, language)
                      VALUES (NOW(), NOW(), '%s', '%s', '%s')",
                     get_table_name('users'),
                     addslashes($user),
                     addslashes($host)));
                     addslashes($host),
                     $_SESSION['user_lang']));
  if ($user_id = $DB->insert_id())
    {
program/js/app.js
@@ -127,7 +127,7 @@
          this.enable_command('add-attachment', 'send-attachment', 'send', true);
          
        if (this.env.messagecount)
          this.enable_command('select-all', 'select-none', true);
          this.enable_command('select-all', 'select-none', 'sort', true);
        this.set_page_buttons();
@@ -441,6 +441,11 @@
          this.list_mailbox(props);
        else if (this.task=='addressbook')
          this.list_contacts();
        break;
      case 'sort':
        // get the type of sorting
        this.list_mailbox('', '', props);
        break;
      case 'nextpage':
@@ -1011,7 +1016,7 @@
  // list messages of a specific mailbox
  this.list_mailbox = function(mbox, page)
  this.list_mailbox = function(mbox, page, sort)
    {
    var add_url = '';
    var target = window;
@@ -1019,6 +1024,10 @@
    if (!mbox)
      mbox = this.env.mailbox;
    // add sort to url if set
    if (sort)
      add_url += '&_sort=' + sort;
    // set page=1 if changeing to another mailbox
    if (!page && mbox != this.env.mailbox)
      {
program/lib/imap.inc
@@ -52,6 +52,7 @@
    var $recent;
    var $rootdir;
    var $delimiter;
    var $capability = array();
}
class iilBasicHeader{
@@ -246,6 +247,9 @@
function iil_C_NameSpace(&$conn){
    global $my_prefs;
    
    if (!in_array('NAMESPACE', $conn->capability))
      return false;
    if ($my_prefs["rootdir"]) return true;
    
    fputs($conn->fp, "ns1 NAMESPACE\r\n");
@@ -334,7 +338,7 @@
    $iil_error.="Socket connection established\r\n";
    $line=iil_ReadLine($conn->fp, 300);
    if (strcasecmp($auth_method, "check")==0){
        //check for supported auth methods
        
@@ -349,6 +353,8 @@
            $a = explode(" ", $line);
            if ($line[0]=="*"){
                while ( list($k, $w) = each($a) ){
                    if ($w!='*' && $w!='CAPABILITY')
                        $conn->capability[] = $w;
                    if ((strcasecmp($w, "AUTH=CRAM_MD5")==0)||
                        (strcasecmp($w, "AUTH=CRAM-MD5")==0)){
                            $auth_method = "auth";
program/localization/index.inc
@@ -1,4 +1,4 @@
<?php
<?php
/*
 +-----------------------------------------------------------------------+
program/steps/mail/func.inc
@@ -238,8 +238,12 @@
  $skin_path = $CONFIG['skin_path'];
  $image_tag = '<img src="%s%s" alt="%s" border="0" />';
  
  // check to see if we have some settings for sorting
  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : 'date';
  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : 'DESC';
  // get message headers
  $a_headers = $IMAP->list_headers();
  $a_headers = $IMAP->list_headers('', '', $sort_col, $sort_order);
  // add id to message list table if not specified
  if (!strlen($attrib['id']))
@@ -261,8 +265,35 @@
  // add table title
  $out .= "<thead><tr>\n<td class=\"icon\">&nbsp;</td>\n";
 
  $javascript = '';
  foreach ($a_show_cols as $col)
    $out .= '<td class="'.$col.'">' . rep_specialchars_output(rcube_label($col)) . "</td>\n";
    {
    // get column name
    $col_name = rep_specialchars_output(rcube_label($col));
    // make sort links
    $sort = '';
    if ($col != 'size')
      {
      // asc link
      $asc  = '_ASC';
      $sort .= '<a href="#" id="sort_' . $col_name . $asc . '" onclick="return rcmail.command(\'sort\',\''
             . $col_name . $asc . '\',this)" title="Sort by ' . $col_name . ' ascending">'
             . '<img src="skins/default/images/buttons/up_arrow.png" width="11" height="11" border="0" alt="" /></a>';
      // desc link
      $desc = '_DESC';
      $sort .= '&nbsp;<a href="#" id="sort_' . $col_name . $desc . '" onclick="return rcmail.command(\'sort\',\''
             . $col_name . $desc . '\',this)" title="Sort by ' . $col_name . ' descending">'
             . '<img src="skins/default/images/buttons/down_arrow.png" width="11" height="11" border="0" alt="" /></a>';
      }
    // put it all together
    $out .= '<td class="'.$col.'">' . "$col_name&nbsp;&nbsp;$sort</td>\n";
    // register sort buttons
    $javascript .= "rcmail.register_button('sort', 'sort_{$col_name}_desc', 'link', 'active', '', '');\n";
    $javascript .= "rcmail.register_button('sort', 'sort_{$col_name}_asc', 'link', 'active', '', '');\n";
    }
  $out .= '<td class="icon">'.($attrib['attachmenticon'] ? sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '') : '')."</td>\n";
  $out .= "</tr></thead>\n<tbody>\n";
@@ -339,7 +370,7 @@
  $message_count = $IMAP->messagecount();
  
  // set client env
  $javascript = sprintf("%s.gui_object('messagelist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']);
  $javascript .= sprintf("%s.gui_object('messagelist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']);
  $javascript .= sprintf("%s.set_env('messagecount', %d);\n", $JS_OBJECT_NAME, $message_count);
  $javascript .= sprintf("%s.set_env('current_page', %d);\n", $JS_OBJECT_NAME, $IMAP->list_page);
  $javascript .= sprintf("%s.set_env('pagecount', %d);\n", $JS_OBJECT_NAME, ceil($message_count/$IMAP->page_size));
program/steps/mail/list.inc
@@ -25,6 +25,37 @@
$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
$count = $IMAP->messagecount();
// is there a sort type for this request?
if ($sort = isset($_GET['_sort']) ? $_GET['_sort'] : false)
  {
  // yes, so set the sort vars
  list($sort_col, $sort_order) = explode('_', $sort);
  // iloha mail sort func doesn't know about a 'Sender' col
  $sort_col = $sort_col == 'Sender' ? 'From' : $sort_col;
  // set session vars for sort (so next page and task switch know how to sort)
  $_SESSION['sort_col'] = $sort_col;
  $_SESSION['sort_order'] = $sort_order;
  }
else
  {
  // if switching folder, use default sorting
  if ($_GET['_refresh'] == '1')
    {
    $sort_col   = 'date';
    $sort_order = 'desc';
    unset($_SESSION['sort_col'], $_SESSION['sort_order']);
    }
  else
    {
    // use session settings if set, defaults if not
    $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : 'date';
    $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : 'desc';
    }
  }
// update message count display
$pages = ceil($count/$IMAP->page_size);
$commands = sprintf("this.set_env('messagecount', %d);\n", $count);
@@ -39,7 +70,7 @@
// add message rows
if ($count)
  {
  $a_headers = $IMAP->list_headers($mbox);
  $a_headers = $IMAP->list_headers($mbox, null, $sort_col, $sort_order);
  $commands .= rcmail_js_message_list($a_headers);
  }
program/steps/mail/sendmail.inc
@@ -152,8 +152,8 @@
                       'html_encoding' => 'quoted-printable',
                       'head_encoding' => 'quoted-printable',
                       'head_charset'  => 'ISO-8859-1',
                       'html_charset'  => 'UTF-8',
                       'text_charset'  => 'UTF-8');
                       'html_charset'  => 'ISO-8859-1',
                       'text_charset'  => 'ISO-8859-1');
// compose message body and get headers
$msg_body = $MAIL_MIME->get($message_param);
skins/default/images/buttons/down_arrow.png
skins/default/images/buttons/up_arrow.png