summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-11-06 19:26:45 +0000
committerthomascube <thomas@roundcube.net>2005-11-06 19:26:45 +0000
commit10a699759d4f106f29c077a6d65d3b8d212825e5 (patch)
treed7a50bb94731e131a8a03c546ad3dbcaf0c4f1e1 /program/include
parente0ddd4e6c03d533cc3f8427624e026cc20c88fa6 (diff)
Added localized messages to client and check form input
Diffstat (limited to 'program/include')
-rw-r--r--program/include/main.inc27
-rwxr-xr-xprogram/include/rcube_db.inc18
-rwxr-xr-xprogram/include/rcube_mdb2.inc52
3 files changed, 65 insertions, 32 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 9248caa99..5895807a9 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -248,6 +248,9 @@ function load_gui()
$OUTPUT->set_charset($CONFIG['charset']);
else
rcmail_set_locale($sess_user_lang);
+
+ // add some basic label to client
+ rcube_add_label('loading');
}
@@ -401,6 +404,16 @@ function rcmail_create_user($user, $host)
}
+// overwrite action variable
+function rcmail_overwrite_action($action)
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+ $GLOBALS['_action'] = $action;
+
+ $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $action));
+ }
+
+
function show_message($message, $type='notice')
{
global $OUTPUT, $JS_OBJECT_NAME, $REMOTE_REQUEST;
@@ -490,6 +503,20 @@ function rcube_list_languages()
}
+// add a localized label to the client environment
+function rcube_add_label()
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+
+ $arg_list = func_get_args();
+ foreach ($arg_list as $i => $name)
+ $OUTPUT->add_script(sprintf("%s.add_label('%s', '%s');",
+ $JS_OBJECT_NAME,
+ $name,
+ rep_specialchars_output(rcube_label($name), 'js')));
+ }
+
+
// ************** template parsing and gui functions **************
diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc
index 684ed49b9..f13ab55c0 100755
--- a/program/include/rcube_db.inc
+++ b/program/include/rcube_db.inc
@@ -220,7 +220,17 @@ class rcube_db
return $result->fetchRow(DB_FETCHMODE_ASSOC);
}
- function quoteIdentifier ( $str )
+
+ function quote($input, $type=null)
+ {
+ if (!$this->db_handle)
+ $this->db_connect('r');
+
+ return $this->db_handle->quote($input);
+ }
+
+
+ function quoteIdentifier($str)
{
if (!$this->db_handle)
$this->db_connect('r');
@@ -228,6 +238,12 @@ class rcube_db
return $this->db_handle->quoteIdentifier($str);
}
+ function quote_identifier($str)
+ {
+ return $this->quoteIdentifier($str);
+ }
+
+
function unixtimestamp($field)
{
switch($this->db_provider)
diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc
index f6fde8dd5..35973ad5d 100755
--- a/program/include/rcube_mdb2.inc
+++ b/program/include/rcube_mdb2.inc
@@ -102,39 +102,24 @@ class rcube_db
}
// Query database
-
function query()
-
{
-
$params = func_get_args();
-
$query = array_shift($params);
-
-
return $this->_query($query, 0, 0, $params);
-
}
-
function limitquery()
-
{
$params = func_get_args();
-
$query = array_shift($params);
-
$offset = array_shift($params);
-
$numrows = array_shift($params);
-
-
return $this->_query($query, $offset, $numrows, $params);
-
}
function _query($query, $offset, $numrows, $params)
@@ -168,6 +153,7 @@ class rcube_db
return $this->_add_result($result, $query);
}
+
function num_rows($res_id=NULL)
{
if (!$this->db_handle)
@@ -181,6 +167,7 @@ class rcube_db
return FALSE;
}
+
function affected_rows($res_id=NULL)
{
if (!$this->db_handle)
@@ -189,6 +176,7 @@ class rcube_db
return $this->db_handle->affectedRows();
}
+
function insert_id($sequence = '')
{
if (!$this->db_handle || $this->db_mode=='r')
@@ -212,42 +200,44 @@ class rcube_db
return $result->fetchRow(MDB2_FETCHMODE_ASSOC);
}
- function quoteIdentifier ( $str )
-
- {
+ function quote($input, $type=null)
+ {
if (!$this->db_handle)
-
$this->db_connect('r');
-
+ return $this->db_handle->quote($input, $type);
+ }
+
- return $this->db_handle->quoteIdentifier($str);
+ function quoteIdentifier($str)
+ {
+ if (!$this->db_handle)
+ $this->db_connect('r');
+ return $this->db_handle->quoteIdentifier($str);
}
-
- function unixtimestamp($field)
+ function quote_identifier($str)
{
+ return $this->quoteIdentifier($str);
+ }
- switch($this->db_provider)
+ function unixtimestamp($field)
+ {
+ switch($this->db_provider)
{
-
case 'pgsql':
-
return "EXTRACT (EPOCH FROM $field)";
-
break;
default:
-
return "UNIX_TIMESTAMP($field)";
-
}
-
}
-
+
+
function _add_result($res, $query)
{
// sql error occured