From 69f18a09aec6e352ff021cd9c5db806f341b7e48 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 1 May 2009 19:04:26 +0000 Subject: Add plugin hooks for creating/saving/deleting identities and contacts --- program/include/rcube_json_output.php | 17 +++++++++++------ program/include/rcube_template.php | 15 ++++++++++----- program/include/rcube_user.php | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_json_output.php b/program/include/rcube_json_output.php index 7c79157fd..2fbf9c0c5 100644 --- a/program/include/rcube_json_output.php +++ b/program/include/rcube_json_output.php @@ -33,6 +33,7 @@ class rcube_json_output private $env = array(); private $texts = array(); private $commands = array(); + private $message = null; public $type = 'js'; public $ajax_call = true; @@ -146,15 +147,19 @@ class rcube_json_output * @param string Message to display * @param string Message type [notice|confirm|error] * @param array Key-value pairs to be replaced in localized text + * @param boolean Override last set message * @uses self::command() */ - public function show_message($message, $type='notice', $vars=null) + public function show_message($message, $type='notice', $vars=null, $override=true) { - $this->command( - 'display_message', - rcube_label(array('name' => $message, 'vars' => $vars)), - $type - ); + if ($override || !$this->message) { + $this->message = $message; + $this->command( + 'display_message', + rcube_label(array('name' => $message, 'vars' => $vars)), + $type + ); + } } /** diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 307bd84d7..6ceb9ce2d 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -34,6 +34,7 @@ class rcube_template extends rcube_html_page var $config; var $framed = false; var $pagetitle = ''; + var $message = null; var $env = array(); var $js_env = array(); var $js_commands = array(); @@ -225,14 +226,18 @@ class rcube_template extends rcube_html_page * @param string Message to display * @param string Message type [notice|confirm|error] * @param array Key-value pairs to be replaced in localized text + * @param boolean Override last set message * @uses self::command() */ - public function show_message($message, $type='notice', $vars=NULL) + public function show_message($message, $type='notice', $vars=null, $override=true) { - $this->command( - 'display_message', - rcube_label(array('name' => $message, 'vars' => $vars)), - $type); + if ($override || !$this->message) { + $this->message = $message; + $this->command( + 'display_message', + rcube_label(array('name' => $message, 'vars' => $vars)), + $type); + } } diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php index 9d4d67589..9d5cc5fc0 100644 --- a/program/include/rcube_user.php +++ b/program/include/rcube_user.php @@ -368,7 +368,7 @@ class rcube_user VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?, ?)", strip_newlines($user), strip_newlines($host), - strip_newlines($user_email), + strip_newlines($data['alias'] ? $data['alias'] : $user_email), $_SESSION['language']); if ($user_id = $dbh->insert_id(get_sequence_name('users'))) -- cgit v1.2.3