Skip to content

Commit

Permalink
Additional Features
Browse files Browse the repository at this point in the history
Additional Features Added
  • Loading branch information
texxasrulez committed Oct 26, 2016
1 parent 48c0cc3 commit 6de55ce
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 20 deletions.
50 changes: 41 additions & 9 deletions account_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Sample plugin that adds a new tab to the settings section
* to display some information about the current user
*/

// error_log(print_r($variable, TRUE)); // I only have this here for development

class account_details extends rcube_plugin
{
public $task = 'mail|addressbook|calendar|settings|dummy';
Expand Down Expand Up @@ -49,12 +52,12 @@ private function _load_config()
'message' => "Failed to load Account Details plugin config"), true, true);
}
}

function infostep()
{

$this->register_handler('plugin.body', array($this, 'infohtml'));
$this->register_handler('plugin.body', array($this, 'infohtml'));
//$this->register_action('plugin.account_details', array($this, 'infostep'));
$rcmail = rcmail::get_instance();
$rcmail->output->set_pagetitle($this->gettext('account_details'));
$rcmail->output->send('plugin');
Expand All @@ -75,10 +78,20 @@ function infohtml()
$pn_newline = false;
$pn_parentheses = true;
}


// Grabs Browser Info
$browser = new Browser();

// Grabs Screen Resolution Info
$width = " <script>document.write(screen.width); </script>";
$height = " <script>document.write(screen.height); </script>";

// Server Uptime Info
$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$days = floor($uptime/60/60/24);
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;


$table = new html_table(array('cols' => 2, 'cellpadding' => 0, 'cellspacing' => 0, 'class' => 'account-details'));
Expand Down Expand Up @@ -202,6 +215,30 @@ function infohtml()
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('location') . ':'));
$table->add('value', $this->config['location']);
}

if (!empty($this->config['enable_server_os'])) {
if (!empty($this->config['enable_server_name'])) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('serveros') . ':'));
$table->add('value', php_uname ("s"));
}
if (!empty($this->config['enable_server_rel'])) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('serveros') . ':'));
$table->add('value', php_uname ("s") . " - " . php_uname ("r"));
}
if (!empty($this->config['enable_server_ver'])) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('serveros') . ':'));
$table->add('value', php_uname ("s") . " - " . php_uname ("r") . " - " . php_uname ("v"));
}
if (!empty($this->config['enable_server_uptime'])) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('serveruptime') . ':'));
$table->add('value', rcube_utils::rep_specialchars_output($days) . " days, " . rcube_utils::rep_specialchars_output($hours) . " hours, " . rcube_utils::rep_specialchars_output($mins) . " minutes, and " . rcube_utils::rep_specialchars_output($secs) . " seconds");
}

if ($this->config['display_php_version']) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('php_version') . ':'));
$table->add('value', PHP_VERSION);
}
}

$webmail_url = $this->_host_replace($this->config['webmail_url']);
if (!empty($this->config['hostname'])) {
Expand All @@ -213,11 +250,6 @@ function infohtml()
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('rc_version') . ':'));
$table->add('value', RCMAIL_VERSION);
}

if ($this->config['display_php_version']) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('php_version') . ':'));
$table->add('value', PHP_VERSION);
}

if (!empty($this->config['hostname_smtp'])) {
$table->add('title', '&nbsp;&#9679;&nbsp;' . rcube_utils::rep_specialchars_output($this->gettext('smtp') . ':'));
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Sample plugin that adds a new tab to the settings section to display additional information about the current user.",
"homepage": "https://github.com/texxasrulez/More-User-Info-for-Roundcube",
"license": "GPLv3+",
"version": "1.0",
"version": "1.0.0",
"authors": [
{
"name": "Gene Hawkins",
Expand Down
21 changes: 17 additions & 4 deletions config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

$account_details_config = array();

// Debugging
$config['account_details_debug'] = false;

// DONATION - Just trying to get paid. You can turn off Paypal Button here
$account_details_config['enable_paypal'] = true;

Expand All @@ -38,7 +35,7 @@
$account_details_config['enable_support'] = true;

// Server location (Example: 'City, Country')
$account_details_config['location'] = 'Somewhere in the World'; //Cannot be blank. Messes with tables
$account_details_config['location'] = 'Somewhere on the Earth'; //Cannot be blank. Messes with tables

// Display Mailbox Details - Unread Count - Total Count - Size of Folder
$account_details_config['enable_mailbox'] = true;
Expand All @@ -48,10 +45,26 @@
$account_details_config['enable_junk'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_trash'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_archive'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
///////////////////////////////////////////////////////////////////////////////////////////

// Display User System Details
$account_details_config['enable_osystem'] = true;

// Displays Information for YOUR Server ... USE AT YOUR OWN RISK
// Display your Server OS
$account_details_config['enable_server_os'] = true; // Only one of the 3 options below should be true otherwise multiple tables will show OS.
// Display only Server name
$account_details_config['enable_server_name'] = false;
// Display Server name and Release
$account_details_config['enable_server_rel'] = false;
// Display Server name Release and version
$account_details_config['enable_server_ver'] = true;

// Display Server Uptime
$account_details_config['enable_server_uptime'] = true;
///////////////////////////////////////////////////////////////////////////////////////////


// Display Browser Information
$account_details_config['enable_browser'] = true;

Expand Down
21 changes: 17 additions & 4 deletions config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

$account_details_config = array();

// Debugging
$config['account_details_debug'] = false;

// DONATION - Just trying to get paid. You can turn off Paypal Button here
$account_details_config['enable_paypal'] = true;

Expand All @@ -38,7 +35,7 @@ $account_details_config['enable_ip'] = true;
$account_details_config['enable_support'] = true;

// Server location (Example: 'City, Country')
$account_details_config['location'] = 'Somewhere in the World'; //Cannot be blank. Messes with tables
$account_details_config['location'] = 'Somewhere on the Earth'; //Cannot be blank. Messes with tables

// Display Mailbox Details - Unread Count - Total Count - Size of Folder
$account_details_config['enable_mailbox'] = true;
Expand All @@ -48,10 +45,26 @@ $account_details_config['enable_sent'] = false; // Have not figured this out yet
$account_details_config['enable_junk'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_trash'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_archive'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
///////////////////////////////////////////////////////////////////////////////////////////

// Display User System Details
$account_details_config['enable_osystem'] = true;

// Displays Information for YOUR Server ... USE AT YOUR OWN RISK
// Display your Server OS
$account_details_config['enable_server_os'] = true; // Only one of the 3 options below should be true otherwise multiple tables will show OS.
// Display only Server name
$account_details_config['enable_server_name'] = false;
// Display Server name and Release
$account_details_config['enable_server_rel'] = false;
// Display Server name Release and version
$account_details_config['enable_server_ver'] = true;

// Display Server Uptime
$account_details_config['enable_server_uptime'] = true;
///////////////////////////////////////////////////////////////////////////////////////////


// Display Browser Information
$account_details_config['enable_browser'] = true;

Expand Down
2 changes: 1 addition & 1 deletion custom_includes/intro.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Got Money?
4 changes: 3 additions & 1 deletion localization/en_US.inc
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ $labels['portnumbersencrypted'] = 'encrypted connection to mail server';
$labels['portnumbersregular'] = 'regular connection to mail server';
$labels['rc_version'] = 'Roundcube Version';
$labels['recommended'] = 'SSL Recommended';
$labels['resolution'] = 'Video Resolution';
$labels['resolution'] = 'Screen Resolution';
$labels['sent'] = 'Sent Folder';
$labels['serverinfo'] = 'Server Details';
$labels['serverinformation'] = 'Server Information';
$labels['server'] = 'Server';
$labels['serveros'] = 'Server OS';
$labels['serveruptime'] = 'Server Uptime';
$labels['size'] = 'KB';
$labels['smtp'] = 'Outgoing SMTP';
$labels['smtp-ssl'] = 'Outgoing SMTP-SSL';
Expand Down

0 comments on commit 6de55ce

Please sign in to comment.