Changeset 597170f in github
- Timestamp:
- Oct 4, 2005 4:28:01 PM (8 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 42b1135
- Parents:
- 6dc0269
- Files:
-
- 8 added
- 10 edited
-
CHANGELOG (modified) (2 diffs)
-
index.php (modified) (6 diffs)
-
program/include/main.inc (modified) (3 diffs)
-
program/include/rcube_db.inc (modified) (6 diffs)
-
program/include/rcube_imap.inc (modified) (2 diffs)
-
program/js/app.js (modified) (1 diff)
-
program/localization/da/labels.inc (added)
-
program/localization/da/messages.inc (added)
-
program/localization/es/labels.inc (added)
-
program/localization/es/messages.inc (added)
-
program/localization/fr/labels.inc (added)
-
program/localization/fr/messages.inc (added)
-
program/localization/it/labels.inc (added)
-
program/localization/it/messages.inc (added)
-
program/steps/mail/compose.inc (modified) (9 diffs)
-
program/steps/mail/func.inc (modified) (6 diffs)
-
program/steps/mail/upload.inc (modified) (1 diff)
-
skins/default/mail.css (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r30233b8 r597170f 27 27 28 28 29 2005/ 09/2829 2005/10/04 30 30 ---------- 31 31 - Added French, Italian, Spanish, Danish translation … … 34 34 - Fixed bug #1290833: Last character of email not seen 35 35 - Added setting for showing pretty dates 36 36 - Added support for SQLite database 37 - Make use of message caching configurable 38 - Also add attachments when forwarding a message 39 - Show nested mailboxes hieracically -
index.php
r1676e1e r597170f 69 69 70 70 // catch some url/post parameters 71 $_auth = strlen($_POST['_auth']) ? $_POST['_auth'] : $_GET['_auth'];72 $_task = strlen($_POST['_task']) ? $_POST['_task'] : ($_GET['_task']? $_GET['_task'] : 'mail');73 $_action = strlen($_POST['_action']) ? $_POST['_action'] : $_GET['_action'];74 $_framed = ( $_GET['_framed'] || $_POST['_framed']);71 $_auth = !empty($_POST['_auth']) ? $_POST['_auth'] : $_GET['_auth']; 72 $_task = !empty($_POST['_task']) ? $_POST['_task'] : (!empty($_GET['_task']) ? $_GET['_task'] : 'mail'); 73 $_action = !empty($_POST['_action']) ? $_POST['_action'] : (!empty($_GET['_action']) ? $_GET['_action'] : ''); 74 $_framed = (!empty($_GET['_framed']) || !empty($_POST['_framed'])); 75 75 76 76 // start session with requested task … … 84 84 85 85 // add framed parameter 86 if ($_ GET['_framed'] || $_POST['_framed'])86 if ($_framed) 87 87 { 88 88 $COMM_PATH .= '&_framed=1'; … … 96 96 97 97 // error steps 98 if ($_action=='error' && strlen($_GET['_code']))98 if ($_action=='error' && !empty($_GET['_code'])) 99 99 { 100 100 raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE); … … 108 108 109 109 // check if client supports cookies 110 if ( !$_COOKIE[session_name()])110 if (empty($_COOKIE)) 111 111 { 112 112 show_message("cookiesdisabled", 'warning'); 113 113 } 114 else if ( $_POST['_user'] && $_POST['_pass']&& rcmail_login($_POST['_user'], $_POST['_pass'], $host))114 else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host)) 115 115 { 116 116 // send redirect … … 144 144 145 145 // log in to imap server 146 if ( $_SESSION['user_id']&& $_task=='mail')146 if (!empty($_SESSION['user_id']) && $_task=='mail') 147 147 { 148 148 $conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password'])); … … 156 156 157 157 // not logged in -> set task to 'login 158 if ( !$_SESSION['user_id'])158 if (empty($_SESSION['user_id'])) 159 159 $_task = 'login'; 160 160 161 161 162 162 163 // set ta ask and action to client163 // set task and action to client 164 164 $script = sprintf("%s.set_env('task', '%s');", $JS_OBJECT_NAME, $_task); 165 165 if (!empty($_action)) -
program/include/main.inc
r6dc0269 r597170f 220 220 $javascript .= "$JS_OBJECT_NAME.set_env('comm_path', '$COMM_PATH');\n"; 221 221 222 if ( $_GET['_framed'] || $_POST['_framed'])222 if (!empty($GLOBALS['_framed'])) 223 223 $javascript .= "$JS_OBJECT_NAME.set_env('framed', true);\n"; 224 224 … … 340 340 global $OUTPUT, $JS_OBJECT_NAME, $REMOTE_REQUEST; 341 341 342 $framed = ($_GET['framed'] || $_POST['_framed']);342 $framed = $GLOBALS['_framed']; 343 343 $command = sprintf("display_message('%s', '%s');", 344 344 addslashes(rep_specialchars_output(rcube_label($message))), … … 838 838 839 839 // use value from post 840 if ( $_POST[$fname])840 if (!empty($_POST[$fname])) 841 841 $value = $_POST[$fname]; 842 842 -
program/include/rcube_db.inc
radf95dd r597170f 52 52 function dsn_connect($dsn) 53 53 { 54 $dsn_array = DB::parseDSN($dsn); 55 $this->db_provider = $dsn_array['phptype']; 56 54 57 // Use persistent connections if available 55 56 58 $dbh = DB::connect($dsn, array('persistent' => $true)); 57 59 … … 62 64 'file' => __FILE__, 63 65 'message' => $dbh->getMessage()), TRUE, FALSE); 66 else if ($this->db_provider=='sqlite') 67 { 68 if (!is_file($dsn_array['database']) || !filesize($dsn_array['database'])) 69 $this->_sqlite_create_database($dbh, 'SQL/sqlite.initial.sql'); 70 } 71 64 72 return $dbh; 65 73 } … … 97 105 { 98 106 // Read or write ? 99 100 107 if (strtolower(trim(substr($query,0,6)))=='select') 101 108 $mode='r'; 102 109 else 103 {104 110 $mode='w'; 105 } 106 107 $this->db_connect($mode); 108 111 112 $this->db_connect($mode); 113 114 if ($this->db_provider == 'sqlite') 115 $query = $this->_sqlite_prepare_query($query); 116 109 117 $result = $this->db_handle->query($query); 110 118 111 119 if (DB::isError($result)) 112 raise_error( array('code' => 500, 'type' => 'db', 'line' => __LINE__, 113 'file' => __FILE__, 114 'message' => $result->getMessage()), TRUE, FALSE); 120 raise_error(array('code' => 500, 'type' => 'db', 121 'line' => __LINE__, 122 'file' => __FILE__, 123 'message' => $result->getMessage()), TRUE, FALSE); 115 124 116 125 return $this->_add_result($result, $query); … … 120 129 { 121 130 db_connect('w'); 131 132 if ($this->db_provider == 'sqlite') 133 $query = $this->_sqlite_prepare_query($query); 122 134 123 135 $result = $this->db_handle->query($query); … … 163 175 case 'mysql': // This is unfortuneate 164 176 return mysql_insert_id($this->db_handle); 165 177 178 case 'sqlite': 179 return sqlite_last_insert_rowid($this->db_handle->connection); 180 166 181 default: 167 182 die("portability issue with this database, please have the developer fix"); … … 210 225 } 211 226 227 228 // create a sqlite database from a file 229 function _sqlite_create_database($dbh, $fileName) 230 { 231 if (empty($fileName) || !is_string($fileName)) 232 return ; 233 234 $fd = fopen($fileName, 'r'); 235 if (!$fd) 236 return ; 237 238 $data = ''; 239 while ($line = fgets($fd, 4096)) 240 $data .= $line; 241 242 fclose($fd); 243 sqlite_exec($dbh->connection, $data); 244 } 245 246 // transform a query so that it is sqlite2 compliant 247 function _sqlite_prepare_query($query) 248 { 249 if (!is_string($query)) 250 return ($query); 251 252 $search = array('/NOW\(\)/', 253 '/`/'); 254 $replace = array("datetime('now')", 255 '"'); 256 $query = preg_replace($search, $replace, $query); 257 258 return ($query); 259 } 260 212 261 } 213 262 -
program/include/rcube_imap.inc
r6dc0269 r597170f 36 36 var $list_page = 1; 37 37 var $page_size = 10; 38 var $delimiter = NULL; 38 39 var $caching_enabled = FALSE; 39 40 var $default_folders = array('inbox', 'drafts', 'sent', 'junk', 'trash'); … … 153 154 } 154 155 156 157 function get_hierarchy_delimiter() 158 { 159 if ($this->conn && empty($this->delimiter)) 160 $this->delimiter = iil_C_GetHierarchyDelimiter($this->conn); 161 162 return $this->delimiter; 163 } 155 164 156 165 // public method for mailbox listing -
program/js/app.js
r30233b8 r597170f 1986 1986 var s_mbox = String(mbox).toLowerCase().replace(this.mbox_expression, ''); 1987 1987 var s_current = this.env.mailbox.toLowerCase().replace(this.mbox_expression, ''); 1988 for (var n=0; n<this.gui_objects.mailboxlist.childNodes.length; n++) 1989 { 1990 item = this.gui_objects.mailboxlist.childNodes[n]; 1988 var nodes = this.gui_objects.mailboxlist.getElementsByTagName('LI'); 1989 1990 for (var n=0; n<nodes.length; n++) 1991 { 1992 item = nodes[n]; 1991 1993 if (item.className && item.className.indexOf('mailbox '+s_mbox+' ')>=0) 1992 1994 this.set_classname(item, 'selected', true); -
program/steps/mail/compose.inc
r30233b8 r597170f 121 121 122 122 // we have contact id's as get parameters 123 if ( strlen($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to']))123 if (!empty($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to'])) 124 124 { 125 125 $a_recipients = array(); … … 139 139 $fvalue = join(', ', $a_recipients); 140 140 } 141 else if ( strlen($_GET['_to']))141 else if (!empty($_GET['_to'])) 142 142 $fvalue = $_GET['_to']; 143 143 … … 166 166 167 167 168 if ($fname && $_POST[$fname])168 if ($fname && !empty($_POST[$fname])) 169 169 $fvalue = $_POST[$fname]; 170 170 else if ($header && is_object($REPLY_MESSAGE['headers'])) … … 283 283 284 284 // use posted message body 285 if ( $_POST['_message'])285 if (!empty($_POST['_message'])) 286 286 $body = stripslashes($_POST['_message']); 287 287 … … 353 353 $IMAP->decode_header($FORWARD_MESSAGE['headers']->to)); 354 354 355 // add attachments 356 if (!isset($_SESSION['compose']['forward_attachments']) && is_array($FORWARD_MESSAGE['parts']) && sizeof($FORWARD_MESSAGE['parts'])>1) 357 { 358 $temp_dir = rcmail_create_compose_tempdir(); 359 360 if (!is_array($_SESSION['compose']['attachments'])) 361 $_SESSION['compose']['attachments'] = array(); 362 363 foreach ($FORWARD_MESSAGE['parts'] as $part) 364 { 365 if ($part->disposition != 'attachment') 366 continue; 367 368 $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 369 if ($fp = fopen($tmp_path, 'w')) 370 { 371 fwrite($fp, $IMAP->mime_decode($part->body, $part->headers['content-transfer-encoding'])); 372 fclose($fp); 373 374 $_SESSION['compose']['attachments'][] = array('name' => $part->d_parameters['filename'], 375 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 376 'path' => $tmp_path); 377 } 378 } 379 380 $_SESSION['compose']['forward_attachments'] = TRUE; 381 } 382 355 383 return $prefix.$body; 356 384 } … … 371 399 372 400 // use subject from post 373 if ( $_POST['_subject'])401 if (isset($_POST['_subject'])) 374 402 $subject = stripslashes($_POST['_subject']); 375 403 … … 474 502 array(1, 2, 0, 4, 5)); 475 503 476 $sel = $_POST['_priority']? $_POST['_priority'] : 0;504 $sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0; 477 505 478 506 $out = $form_start ? "$form_start\n" : ''; … … 494 522 $hiddenfields->add(array('name' => '_action', 'value' => 'send')); 495 523 496 $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : '';524 $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 497 525 $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 498 526 $form_start .= $hiddenfields->show(); … … 500 528 501 529 $form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 502 $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';530 $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; 503 531 504 532 if (!strlen($MESSAGE_FORM)) -
program/steps/mail/func.inc
r30233b8 r597170f 59 59 global $IMAP, $CONFIG, $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH; 60 60 static $s_added_script = FALSE; 61 static $a_mailboxes; 61 62 62 63 $type = $attrib['type'] ? $attrib['type'] : 'ul'; … … 78 79 79 80 // get mailbox list 80 $a_folders = $IMAP->list_mailboxes();81 81 $mbox = $IMAP->get_mailbox_name(); 82 82 … … 84 84 $special_mailboxes = array('inbox', 'sent', 'drafts', 'trash', 'junk'); 85 85 86 87 // build the folders tree 88 if (empty($a_mailboxes)) 89 { 90 // get mailbox list 91 $a_folders = $IMAP->list_mailboxes(); 92 $delimiter = $IMAP->get_hierarchy_delimiter(); 93 $a_mailboxes = array(); 94 95 foreach ($a_folders as $folder) 96 rcmail_build_folder_tree($a_mailboxes, $folder, $delimiter); 97 } 98 99 // var_dump($a_mailboxes); 100 101 if ($type=='select') 102 $out .= rcmail_render_folder_tree_select($a_mailboxes, $special_mailboxes, $mbox); 103 else 104 $out .= rcmail_render_folder_tree_html($a_mailboxes, $special_mailboxes, $mbox); 105 106 107 /* 86 108 foreach ($a_folders as $i => $folder) 87 109 { 88 110 $zebra_class = $i%2 ? 'even' : 'odd'; 89 90 $folder_lc = strtolower($folder); 111 $folder_prop = $a_subfolders[$folder]; 112 $foldername = isset($folder_prop) ? $folder_prop['name'] : $folder; 113 114 $folder_lc = strtolower($foldername); 91 115 if (in_array($folder_lc, $special_mailboxes)) 92 116 $foldername = rcube_label($folder_lc); 93 else94 $foldername = $folder;95 117 96 118 if ($unread_count = $IMAP->messagecount($folder, 'UNSEEN')) 97 119 $foldername .= sprintf(' (%d)', $unread_count); 98 120 121 $indent = isset($folder_prop) ? sprintf(' indent%d', $folder_prop['level']) : ''; 122 $indent_str = isset($folder_prop) ? str_repeat(' ', (int)$folder_prop['level']) : ''; 123 99 124 // compose mailbox line 100 125 if ($type=='select') 101 $out .= sprintf('<option value="%s">%s </option>'."\n",126 $out .= sprintf('<option value="%s">%s%s</option>'."\n", 102 127 $folder, 128 $indent_str, 103 129 rep_specialchars_output($foldername)); 104 130 105 131 else 106 $out .= sprintf('<li class="mailbox %s %s%s%s "><a href="#%s" onclick="return %s.command(\'list\',\'%s\')" onmouseup="return %s.mbox_mouse_up(\'%s\')">%s</a></li>'."\n",107 preg_replace('/[^a-z0-9\-_]/', '', $folder_lc),132 $out .= sprintf('<li class="mailbox %s %s%s%s%s"><a href="#%s" onclick="return %s.command(\'list\',\'%s\')" onmouseup="return %s.mbox_mouse_up(\'%s\')">%s</a></li>'."\n", 133 preg_replace('/[^a-z0-9\-_]/', '', strtolower($folder)), 108 134 $zebra_class, 109 135 $unread_count ? ' unread' : '', 110 136 $folder==$mbox ? ' selected' : '', 137 $indent, 111 138 $folder, 112 139 $JS_OBJECT_NAME, … … 116 143 rep_specialchars_output($foldername)); 117 144 } 145 */ 118 146 119 147 if ($type=='ul') … … 130 158 */ 131 159 return $out . "</$type>"; 160 } 161 162 163 164 165 // create a hierarchical array of the mailbox list 166 function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') 167 { 168 $pos = strpos($folder, $delm); 169 if ($pos !== false) 170 { 171 $subFolders = substr($folder, $pos+1); 172 $currentFolder = substr($folder, 0, $pos); 173 } 174 else 175 { 176 $subFolders = false; 177 $currentFolder = $folder; 178 } 179 180 $path .= $currentFolder; 181 182 if (!isset($arrFolders[$currentFolder])) 183 { 184 $arrFolders[$currentFolder] = array('id' => $path, 185 'name' => $currentFolder, 186 'folders' => array()); 187 } 188 189 if (!empty($subFolders)) 190 rcmail_build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm); 191 } 192 193 194 // return html for a structured list <ul> for the mailbox tree 195 function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $nestLevel = 0) 196 { 197 global $JS_OBJECT_NAME, $IMAP; 198 199 $idx = 0; 200 $out = ''; 201 foreach ($arrFolders as $key => $folder) 202 { 203 $zebra_class = ($nestLevel*$idx)%2 ? 'even' : 'odd'; 204 205 $folder_lc = strtolower($folder['id']); 206 if (in_array($folder_lc, $special)) 207 $foldername = rcube_label($folder_lc); 208 else 209 $foldername = $folder['name']; 210 211 if ($unread_count = $IMAP->messagecount($folder['id'], 'UNSEEN')) 212 $foldername .= sprintf(' (%d)', $unread_count); 213 214 $out .= sprintf('<li class="mailbox %s %s%s%s"><a href="#%s" onclick="return %s.command(\'list\',\'%s\')" onmouseup="return %s.mbox_mouse_up(\'%s\')">%s</a>'."\n", 215 preg_replace('/[^a-z0-9\-_]/', '', $folder_lc), 216 $zebra_class, 217 $unread_count ? ' unread' : '', 218 $folder['id']==$mbox ? ' selected' : '', 219 $folder['id'], 220 $JS_OBJECT_NAME, 221 $folder['id'], 222 $JS_OBJECT_NAME, 223 $folder['id'], 224 rep_specialchars_output($foldername)); 225 226 if (!empty($folder['folders'])) 227 $out .= '<ul>' . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox, $nestLevel+1) . "</ul>\n"; 228 229 $out .= "</li>\n"; 230 $idx++; 231 } 232 233 return $out; 234 } 235 236 237 // return html for a flat list <select> for the mailbox tree 238 function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox, $nestLevel=0) 239 { 240 global $IMAP; 241 242 $idx = 0; 243 $out = ''; 244 foreach ($arrFolders as $key=>$folder) 245 { 246 $out .= sprintf('<option value="%s">%s%s</option>'."\n", 247 $folder['id'], 248 str_repeat(' ', $nestLevel*4), 249 rep_specialchars_output($folder['name'])); 250 251 if (!empty($folder['folders'])) 252 $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox, $nestLevel+1); 253 254 $idx++; 255 } 256 257 return $out; 132 258 } 133 259 … … 1079 1205 1080 1206 1207 // create temp dir for attachments 1208 function rcmail_create_compose_tempdir() 1209 { 1210 global $CONFIG; 1211 1212 if ($_SESSION['compose']['temp_dir']) 1213 return $_SESSION['compose']['temp_dir']; 1214 1215 if (!empty($CONFIG['temp_dir'])) 1216 $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '').$_SESSION['compose']['id']; 1217 1218 // create temp-dir for uploaded attachments 1219 if (!empty($CONFIG['temp_dir']) && is_writeable($CONFIG['temp_dir'])) 1220 { 1221 mkdir($temp_dir); 1222 $_SESSION['compose']['temp_dir'] = $temp_dir; 1223 } 1224 1225 return $_SESSION['compose']['temp_dir']; 1226 } 1227 1081 1228 1082 1229 // clear message composing settings -
program/steps/mail/upload.inc
r30233b8 r597170f 27 27 28 28 29 if (strlen($CONFIG['temp_dir'])) 30 $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '').$_SESSION['compose']['id']; 29 // create temp dir for file uploads 30 $temp_dir = rcmail_create_compose_tempdir(); 31 31 32 32 33 if (!is_array($_SESSION['compose']['attachments'])) 33 {34 34 $_SESSION['compose']['attachments'] = array(); 35 36 // create temp-dir for uploaded attachments37 if ($CONFIG['temp_dir'] && is_writeable($CONFIG['temp_dir']))38 {39 mkdir($temp_dir);40 $_SESSION['compose']['temp_dir'] = $temp_dir;41 }42 }43 35 44 36 -
skins/default/mail.css
r20a1b3a r597170f 194 194 #mailboxlist li 195 195 { 196 height: 18px;196 /* height: 18px; */ 197 197 font-size: 11px; 198 198 background: url(images/icons/folder-closed.png) no-repeat; … … 244 244 { 245 245 background-color: #929292; 246 border-bottom: 1px solid #898989; 246 border-bottom: 1px solid #898989; 247 247 } 248 248 … … 251 251 color: #FFF; 252 252 font-weight: bold; 253 } 254 255 256 /* styles for nested folders */ 257 #mailboxlist ul { 258 list-style: none; 259 padding: 0; 260 margin:0; 261 border-top: 1px solid #EBEBEB; 262 } 263 264 #mailboxlist ul li { 265 padding-left: 15px; 266 background-position: 25px 1px; 267 } 268 269 #mailboxlist li.selected li { 270 background-color: #F9F9F9; 271 } 272 273 #mailboxlist li.unread li { 274 font-weight: normal; 275 } 276 277 #mailboxlist li.unread li.unread { 278 font-weight: bold; 279 } 280 281 #mailboxlist li.selected li a{ 282 color: black; 283 font-weight: normal; 253 284 } 254 285
Note: See TracChangeset
for help on using the changeset viewer.
