From 63a3dc5fde5a3ceed4f03c19c5015aab19050bee Mon Sep 17 00:00:00 2001 From: till Date: Sat, 20 Mar 2010 14:20:01 +0000 Subject: moved plugins --- plugins/new_user_dialog/new_user_dialog.php | 109 ---------------------------- 1 file changed, 109 deletions(-) delete mode 100644 plugins/new_user_dialog/new_user_dialog.php (limited to 'plugins/new_user_dialog/new_user_dialog.php') diff --git a/plugins/new_user_dialog/new_user_dialog.php b/plugins/new_user_dialog/new_user_dialog.php deleted file mode 100644 index 006cb2711..000000000 --- a/plugins/new_user_dialog/new_user_dialog.php +++ /dev/null @@ -1,109 +0,0 @@ -add_hook('create_identity', array($this, 'create_identity')); - - // register additional hooks if session flag is set - if ($_SESSION['plugin.newuserdialog']) { - $this->add_hook('render_page', array($this, 'render_page')); - $this->register_action('plugin.newusersave', array($this, 'save_data')); - } - } - - /** - * Check newly created identity at first login - */ - function create_identity($p) - { - // set session flag when a new user was created and the default identity seems to be incomplete - if ($p['login'] && !$p['complete']) - $_SESSION['plugin.newuserdialog'] = true; - } - - /** - * Callback function when HTML page is rendered - * We'll add an overlay box here. - */ - function render_page($p) - { - if ($_SESSION['plugin.newuserdialog']) { - $this->add_texts('localization'); - - $rcmail = rcmail::get_instance(); - $identity = $rcmail->user->get_identity(); - $identities_level = intval($rcmail->config->get('identities_level', 0)); - - // compose user-identity dialog - $table = new html_table(array('cols' => 2)); - - $table->add('title', $this->gettext('name')); - $table->add(null, html::tag('input', array('type' => "text", 'name' => "_name", 'value' => $identity['name']))); - - $table->add('title', $this->gettext('email')); - $table->add(null, html::tag('input', array('type' => "text", 'name' => "_email", 'value' => $identity['email'], 'disabled' => ($identities_level == 1 || $identities_level == 3)))); - - // add overlay input box to html page - $rcmail->output->add_footer(html::div(array('id' => "newuseroverlay"), - html::tag('form', array( - 'action' => $rcmail->url('plugin.newusersave'), - 'method' => "post"), - html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . - html::p('hint', Q($this->gettext('identitydialoghint'))) . - $table->show() . - html::p(array('class' => "formbuttons"), - html::tag('input', array('type' => "submit", 'class' => "button mainaction", 'value' => $this->gettext('save')))) - ) - )); - - $this->include_stylesheet('newuserdialog.css'); - } - } - - /** - * Handler for submitted form - * - * Check fields and save to default identity if valid. - * Afterwards the session flag is removed and we're done. - */ - function save_data() - { - $rcmail = rcmail::get_instance(); - $identity = $rcmail->user->get_identity(); - $identities_level = intval($rcmail->config->get('identities_level', 0)); - - $save_data = array( - 'name' => get_input_value('_name', RCUBE_INPUT_POST), - 'email' => get_input_value('_email', RCUBE_INPUT_POST), - ); - - // don't let the user alter the e-mail address if disabled by config - if ($identities_level == 1 || $identities_level == 3) - $save_data['email'] = $identity['email']; - - // save data if not empty - if (!empty($save_data['name']) && !empty($save_data['email'])) { - $rcmail->user->update_identity($identity['identity_id'], $save_data); - $rcmail->session->remove('plugin.newuserdialog'); - } - - $rcmail->output->redirect(''); - } - -} - -?> \ No newline at end of file -- cgit v1.2.3