Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

userinfo.php 1.7KB

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