0
|
1 <?php
|
|
2
|
|
3 /**
|
|
4 * Sample plugin that adds a new tab to the settings section
|
|
5 * to display some information about the current user
|
|
6 */
|
|
7 class userinfo extends rcube_plugin
|
|
8 {
|
|
9 public $task = 'settings';
|
|
10 public $noajax = true;
|
|
11 public $noframe = true;
|
|
12
|
|
13 function init()
|
|
14 {
|
|
15 $this->add_texts('localization/', array('userinfo'));
|
|
16 $this->register_action('plugin.userinfo', array($this, 'infostep'));
|
|
17 $this->include_script('userinfo.js');
|
|
18 }
|
|
19
|
|
20 function infostep()
|
|
21 {
|
|
22 $this->register_handler('plugin.body', array($this, 'infohtml'));
|
|
23 rcmail::get_instance()->output->send('plugin');
|
|
24 }
|
|
25
|
|
26 function infohtml()
|
|
27 {
|
|
28 $rcmail = rcmail::get_instance();
|
|
29 $user = $rcmail->user;
|
|
30 $identity = $user->get_identity();
|
|
31
|
|
32 $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
|
|
33
|
|
34 $table->add('title', 'ID');
|
|
35 $table->add('', rcube::Q($user->ID));
|
|
36
|
|
37 $table->add('title', rcube::Q($this->gettext('username')));
|
|
38 $table->add('', rcube::Q($user->data['username']));
|
|
39
|
|
40 $table->add('title', rcube::Q($this->gettext('server')));
|
|
41 $table->add('', rcube::Q($user->data['mail_host']));
|
|
42
|
|
43 $table->add('title', rcube::Q($this->gettext('created')));
|
|
44 $table->add('', rcube::Q($user->data['created']));
|
|
45
|
|
46 $table->add('title', rcube::Q($this->gettext('lastlogin')));
|
|
47 $table->add('', rcube::Q($user->data['last_login']));
|
|
48
|
|
49 $table->add('title', rcube::Q($this->gettext('defaultidentity')));
|
|
50 $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
|
|
51
|
|
52 return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show();
|
|
53 }
|
|
54 }
|