Permalink
Browse files

Added new languages, hierarchical folder tree and attachments in forw…

…arded messages
  • Loading branch information...
thomascube committed Oct 4, 2005
1 parent 6dc0269 commit 597170feb25f5c2e5a90a9c0b1fd62001f169afb
View
@@ -26,11 +26,14 @@ CHANGELOG RoundCube Webmail
- Make list of special mailboxes configurable
-2005/09/28
+2005/10/04
----------
- Added French, Italian, Spanish, Danish translation
- Fixed PHP warnings (Bug #1299403)
- Fixed english translation bug #1295406
- Fixed bug #1290833: Last character of email not seen
- Added setting for showing pretty dates
-
+- Added support for SQLite database
+- Make use of message caching configurable
+- Also add attachments when forwarding a message
+- Show nested mailboxes hieracically
View
@@ -68,10 +68,10 @@
// catch some url/post parameters
-$_auth = strlen($_POST['_auth']) ? $_POST['_auth'] : $_GET['_auth'];
-$_task = strlen($_POST['_task']) ? $_POST['_task'] : ($_GET['_task'] ? $_GET['_task'] : 'mail');
-$_action = strlen($_POST['_action']) ? $_POST['_action'] : $_GET['_action'];
-$_framed = ($_GET['_framed'] || $_POST['_framed']);
+$_auth = !empty($_POST['_auth']) ? $_POST['_auth'] : $_GET['_auth'];
+$_task = !empty($_POST['_task']) ? $_POST['_task'] : (!empty($_GET['_task']) ? $_GET['_task'] : 'mail');
+$_action = !empty($_POST['_action']) ? $_POST['_action'] : (!empty($_GET['_action']) ? $_GET['_action'] : '');
+$_framed = (!empty($_GET['_framed']) || !empty($_POST['_framed']));
// start session with requested task
rcmail_startup($_task);
@@ -83,7 +83,7 @@
// add framed parameter
-if ($_GET['_framed'] || $_POST['_framed'])
+if ($_framed)
{
$COMM_PATH .= '&_framed=1';
$SESS_HIDDEN_FIELD = "\n".'<input type="hidden" name="_framed" value="1" />';
@@ -95,7 +95,7 @@
// error steps
-if ($_action=='error' && strlen($_GET['_code']))
+if ($_action=='error' && !empty($_GET['_code']))
{
raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE);
}
@@ -107,11 +107,11 @@
$host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host'];
// check if client supports cookies
- if (!$_COOKIE[session_name()])
+ if (empty($_COOKIE))
{
show_message("cookiesdisabled", 'warning');
}
- else if ($_POST['_user'] && $_POST['_pass'] && rcmail_login($_POST['_user'], $_POST['_pass'], $host))
+ else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host))
{
// send redirect
header("Location: $COMM_PATH");
@@ -143,7 +143,7 @@
// log in to imap server
-if ($_SESSION['user_id'] && $_task=='mail')
+if (!empty($_SESSION['user_id']) && $_task=='mail')
{
$conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password']));
if (!$conn)
@@ -155,12 +155,12 @@
// not logged in -> set task to 'login
-if (!$_SESSION['user_id'])
+if (empty($_SESSION['user_id']))
$_task = 'login';
-// set taask and action to client
+// set task and action to client
$script = sprintf("%s.set_env('task', '%s');", $JS_OBJECT_NAME, $_task);
if (!empty($_action))
$script .= sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action);
View
@@ -219,7 +219,7 @@ function load_gui()
$javascript = "var $JS_OBJECT_NAME = new rcube_webmail();\n";
$javascript .= "$JS_OBJECT_NAME.set_env('comm_path', '$COMM_PATH');\n";
- if ($_GET['_framed'] || $_POST['_framed'])
+ if (!empty($GLOBALS['_framed']))
$javascript .= "$JS_OBJECT_NAME.set_env('framed', true);\n";
$OUTPUT->add_script($javascript);
@@ -339,7 +339,7 @@ function show_message($message, $type='notice')
{
global $OUTPUT, $JS_OBJECT_NAME, $REMOTE_REQUEST;
- $framed = ($_GET['framed'] || $_POST['_framed']);
+ $framed = $GLOBALS['_framed'];
$command = sprintf("display_message('%s', '%s');",
addslashes(rep_specialchars_output(rcube_label($message))),
$type);
@@ -837,7 +837,7 @@ function rcmail_get_edit_field($col, $value, $attrib, $type='text')
$input = new textfield($attrib);
// use value from post
- if ($_POST[$fname])
+ if (!empty($_POST[$fname]))
$value = $_POST[$fname];
$out = $input->show($value);
@@ -51,8 +51,10 @@ class rcube_db
// Connect to specific database
function dsn_connect($dsn)
{
- // Use persistent connections if available
+ $dsn_array = DB::parseDSN($dsn);
+ $this->db_provider = $dsn_array['phptype'];
+ // Use persistent connections if available
$dbh = DB::connect($dsn, array('persistent' => $true));
if (DB::isError($dbh))
@@ -61,6 +63,12 @@ class rcube_db
'line' => __LINE__,
'file' => __FILE__,
'message' => $dbh->getMessage()), TRUE, FALSE);
+ else if ($this->db_provider=='sqlite')
+ {
+ if (!is_file($dsn_array['database']) || !filesize($dsn_array['database']))
+ $this->_sqlite_create_database($dbh, 'SQL/sqlite.initial.sql');
+ }
+
return $dbh;
}
@@ -96,22 +104,23 @@ class rcube_db
function query($query)
{
// Read or write ?
-
if (strtolower(trim(substr($query,0,6)))=='select')
$mode='r';
else
- {
$mode='w';
- }
- $this->db_connect($mode);
-
+ $this->db_connect($mode);
+
+ if ($this->db_provider == 'sqlite')
+ $query = $this->_sqlite_prepare_query($query);
+
$result = $this->db_handle->query($query);
if (DB::isError($result))
- raise_error( array('code' => 500, 'type' => 'db', 'line' => __LINE__,
- 'file' => __FILE__,
- 'message' => $result->getMessage()), TRUE, FALSE);
+ raise_error(array('code' => 500, 'type' => 'db',
+ 'line' => __LINE__,
+ 'file' => __FILE__,
+ 'message' => $result->getMessage()), TRUE, FALSE);
return $this->_add_result($result, $query);
}
@@ -120,6 +129,9 @@ class rcube_db
{
db_connect('w');
+ if ($this->db_provider == 'sqlite')
+ $query = $this->_sqlite_prepare_query($query);
+
$result = $this->db_handle->query($query);
}
@@ -162,7 +174,10 @@ class rcube_db
case 'mysql': // This is unfortuneate
return mysql_insert_id($this->db_handle);
-
+
+ case 'sqlite':
+ return sqlite_last_insert_rowid($this->db_handle->connection);
+
default:
die("portability issue with this database, please have the developer fix");
}
@@ -209,6 +224,40 @@ class rcube_db
return FALSE;
}
+
+ // create a sqlite database from a file
+ function _sqlite_create_database($dbh, $fileName)
+ {
+ if (empty($fileName) || !is_string($fileName))
+ return ;
+
+ $fd = fopen($fileName, 'r');
+ if (!$fd)
+ return ;
+
+ $data = '';
+ while ($line = fgets($fd, 4096))
+ $data .= $line;
+
+ fclose($fd);
+ sqlite_exec($dbh->connection, $data);
+ }
+
+ // transform a query so that it is sqlite2 compliant
+ function _sqlite_prepare_query($query)
+ {
+ if (!is_string($query))
+ return ($query);
+
+ $search = array('/NOW\(\)/',
+ '/`/');
+ $replace = array("datetime('now')",
+ '"');
+ $query = preg_replace($search, $replace, $query);
+
+ return ($query);
+ }
+
}
?>
@@ -35,6 +35,7 @@ class rcube_imap
var $mailbox = 'INBOX';
var $list_page = 1;
var $page_size = 10;
+ var $delimiter = NULL;
var $caching_enabled = FALSE;
var $default_folders = array('inbox', 'drafts', 'sent', 'junk', 'trash');
var $cache = array();
@@ -153,6 +154,14 @@ class rcube_imap
}
+ function get_hierarchy_delimiter()
+ {
+ if ($this->conn && empty($this->delimiter))
+ $this->delimiter = iil_C_GetHierarchyDelimiter($this->conn);
+
+ return $this->delimiter;
+ }
+
// public method for mailbox listing
// convert mailbox name with root dir first
function list_mailboxes($root='', $filter='*')
View
@@ -1985,9 +1985,11 @@ function rcube_webmail()
var item, reg, text_obj;
var s_mbox = String(mbox).toLowerCase().replace(this.mbox_expression, '');
var s_current = this.env.mailbox.toLowerCase().replace(this.mbox_expression, '');
- for (var n=0; n<this.gui_objects.mailboxlist.childNodes.length; n++)
+ var nodes = this.gui_objects.mailboxlist.getElementsByTagName('LI');
+
+ for (var n=0; n<nodes.length; n++)
{
- item = this.gui_objects.mailboxlist.childNodes[n];
+ item = nodes[n];
if (item.className && item.className.indexOf('mailbox '+s_mbox+' ')>=0)
this.set_classname(item, 'selected', true);
else if (item.className && item.className.indexOf('mailbox '+s_current)>=0)
Oops, something went wrong.

0 comments on commit 597170f

Please sign in to comment.