Skip to content

Commit

Permalink
Update to Ver 1.1.0
Browse files Browse the repository at this point in the history
Finalized some non working code and a few new features
  • Loading branch information
texxasrulez committed Oct 28, 2016
1 parent 6de55ce commit 3945e62
Show file tree
Hide file tree
Showing 39 changed files with 342 additions and 627 deletions.
52 changes: 52 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Oct 28, 2016
*Fixed: All mailboxes gets checked for Unread and Total Count.


Oct 26, 2016 Ver 1.0.0

Initial Release

Features:
* User Details
** System User ID: 1
** Edentity Name
** Email Address
** Account Create Date
** Last Login
** Total Storage
** Used Storage
** Current IP Address
** Support URL

* User System Details
** Operating System
** Screen Resolution
** Web Browser:
** Version
** User Agent

* Mailbox Details:
** Inbox
** Drafts Folder
** Sent Folder
** Trash Folder
** Junk Folder
** Archive Folder

* Server Details
** Server Location
** Server OS
** Server Memory
** Server CPU Load
** Server Uptime
** PHP Version
** Webmail URL
** Roundcube Version
** Outgoing SMTP
** Incoming IMAP


* Calendar URL's

* Address Books

25 changes: 1 addition & 24 deletions account_details.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ table.account-details {
table.account-details td {
padding: 0 0 0 0;
overflow: auto;
background: #eee;
}


Expand Down Expand Up @@ -72,30 +73,6 @@ span.fieldnote-newline {
overflow: auto;
}

/* unvisited link */
a:link {
color: red;
text-decoration: none;
}

/* visited link */
a:visited {
color: blue;
text-decoration: none;
}

/* mouse over link */
a:hover {
color: green;
text-decoration: underline;
}

/* selected link */
a:active {
color: blue;
text-decoration: none;
}

td.top_bold {
font-weight: bold;
vertical-align: top;
Expand Down
31 changes: 23 additions & 8 deletions account_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ function init()
$this->register_action('plugin.account_details', array($this, 'infostep'));
$this->include_script('account_details.js');
$this->include_stylesheet('account_details.css');
require($this->home . '/lib/mail_count.php');
require($this->home . '/lib/Browser.php');
require($this->home . '/lib/OS.php');
require($this->home . '/lib/Memory.php');
require($this->home . '/lib/CPU.php');
}
private function _load_config()
{
Expand Down Expand Up @@ -57,7 +60,7 @@ function infostep()
{

$this->register_handler('plugin.body', array($this, 'infohtml'));
//$this->register_action('plugin.account_details', array($this, 'infostep'));
$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 Down Expand Up @@ -92,6 +95,8 @@ function infohtml()
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;

// $details = json_decode(file_get_contents("http://ipinfo.io/"));


$table = new html_table(array('cols' => 2, 'cellpadding' => 0, 'cellspacing' => 0, 'class' => 'account-details'));
Expand Down Expand Up @@ -154,6 +159,7 @@ function infohtml()

if (!empty($this->config['enable_ip'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('ipaddress') . ':'));
// $table->add('value', $_SERVER["REMOTE_ADDR"] . ' - ' . $details->city . ', ' . $details->region);
$table->add('value', $_SERVER["REMOTE_ADDR"]);
}

Expand Down Expand Up @@ -186,27 +192,27 @@ function infohtml()
$table->add('title', html::tag('h4', null, ' ' . rcube_utils::rep_specialchars_output($this->gettext('mailbox') . ':')));
$table->add('', '');
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('inbox') . ':'));
$table->add('value', $imap->count(INBOX, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(INBOX)/ 1024) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size'))));
$table->add('value', $imap->count('INBOX', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));

if (!empty($this->config['enable_drafts'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('drafts') . ':'));
$table->add('value', $imap->count(INBOX.Drafts, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX.drafts, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(Drafts) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size')))));
$table->add('value', $imap->count('INBOX.Drafts', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count('INBOX.Drafts', 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));
}
if (!empty($this->config['enable_sent'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('sent') . ':'));
$table->add('value', $imap->count(INBOX.Sent, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX.Sent, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(Sent) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size')))));
$table->add('value', $imap->count('INBOX.Sent', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count('INBOX.Sent', 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));
}
if (!empty($this->config['enable_trash'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('trash') . ':'));
$table->add('value', $imap->count(INBOX.Trash, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX.Trash, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(Trash) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size')))));
$table->add('value', $imap->count('INBOX.Trash', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count('INBOX.Trash', 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));
}
if (!empty($this->config['enable_junk'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('junk') . ':'));
$table->add('value', $imap->count(INBOX.Junk, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX.Junk, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(Junk) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size')))));
$table->add('value', $imap->count('INBOX.Junk', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count('INBOX.Junk', 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));
}
if (!empty($this->config['enable_archive'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('archive') . ':'));
$table->add('value', $imap->count(INBOX.Archive, 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count(INBOX.Archive, 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total') . ' - ' . $imap->folder_size(Archive) . ' ' . rcube_utils::rep_specialchars_output($this->gettext('size')))));
$table->add('value', $imap->count('INBOX.Archive', 'UNSEEN') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('unread') . ' - ' . $imap->count('INBOX.Archive', 'ALL') . ' ' . rcube_utils::rep_specialchars_output($this->gettext('total'))));
}
}
if (!empty($this->config['location'])) {
Expand All @@ -229,6 +235,14 @@ function infohtml()
$table->add('title', ' ● ' . 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_memory'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('servermemory') . ':'));
$table->add('value', round(get_server_memory_usage(),2) . ' MB Used');
}
if (!empty($this->config['enable_server_cpu'])) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('servercpu') . ':'));
$table->add('value', get_server_cpu_usage() . ' % Used');
}
if (!empty($this->config['enable_server_uptime'])) {
$table->add('title', ' ● ' . 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");
Expand All @@ -246,8 +260,9 @@ function infohtml()
$table->add('value', html::tag('a', array('href' => $webmail_url, 'title' => 'Main URL to access your email', 'target' => '_top'), $webmail_url));
}

$rc_url = $this->gettext('rc_version');
if ($this->config['display_rc_version']) {
$table->add('title', ' ● ' . rcube_utils::rep_specialchars_output($this->gettext('rc_version') . ':'));
$table->add('title', ' ● ' . html::tag('a', array('href' => 'http://roundcube.net', 'title' => 'Roundcube Webmail', 'target' => '_blank'), $rc_url) . ':');
$table->add('value', RCMAIL_VERSION);
}

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.0",
"version": "1.1.0",
"authors": [
{
"name": "Gene Hawkins",
Expand Down
22 changes: 14 additions & 8 deletions config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
$account_details_config['enable_support'] = true;

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

// Display Mailbox Details - Unread Count - Total Count - Size of Folder
$account_details_config['enable_mailbox'] = true;
// Enable or Disable Individual Folders - 'enable_mailbox' Must be true
$account_details_config['enable_drafts'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_sent'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$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
$account_details_config['enable_drafts'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_sent'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_junk'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_trash'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_archive'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
///////////////////////////////////////////////////////////////////////////////////////////

// Display User System Details
Expand All @@ -56,9 +56,15 @@
// Display only Server name
$account_details_config['enable_server_name'] = false;
// Display Server name and Release
$account_details_config['enable_server_rel'] = false;
$account_details_config['enable_server_rel'] = true;
// Display Server name Release and version
$account_details_config['enable_server_ver'] = true;
$account_details_config['enable_server_ver'] = false;

// Display Server CPU Load
$account_details_config['enable_server_cpu'] = true;

// Display Server Memory
$account_details_config['enable_server_memory'] = true;

// Display Server Uptime
$account_details_config['enable_server_uptime'] = true;
Expand Down
22 changes: 14 additions & 8 deletions config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ $account_details_config['enable_ip'] = true;
$account_details_config['enable_support'] = true;

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

// Display Mailbox Details - Unread Count - Total Count - Size of Folder
$account_details_config['enable_mailbox'] = true;
// Enable or Disable Individual Folders - 'enable_mailbox' Must be true
$account_details_config['enable_drafts'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_sent'] = false; // Have not figured this out yet. Only can get INBOX Working. I need help
$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
$account_details_config['enable_drafts'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_sent'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_junk'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_trash'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
$account_details_config['enable_archive'] = true; // Have not figured this out yet. Only can get INBOX Working. I need help
///////////////////////////////////////////////////////////////////////////////////////////

// Display User System Details
Expand All @@ -56,9 +56,15 @@ $account_details_config['enable_server_os'] = true; // Only one of the 3 options
// Display only Server name
$account_details_config['enable_server_name'] = false;
// Display Server name and Release
$account_details_config['enable_server_rel'] = false;
$account_details_config['enable_server_rel'] = true;
// Display Server name Release and version
$account_details_config['enable_server_ver'] = true;
$account_details_config['enable_server_ver'] = false;

// Display Server CPU Load
$account_details_config['enable_server_cpu'] = true;

// Display Server Memory
$account_details_config['enable_server_memory'] = true;

// Display Server Uptime
$account_details_config['enable_server_uptime'] = 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?
8 changes: 8 additions & 0 deletions lib/CPU.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
function get_server_cpu_usage(){

$load = sys_getloadavg();
return $load[0];

}
?>
16 changes: 16 additions & 0 deletions lib/Memory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

function get_server_memory_usage(){

$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem);
$mem = array_merge($mem);
$memory_usage = $mem[2]/$mem[1]*100;

return $memory_usage;
}

?>
Loading

0 comments on commit 3945e62

Please sign in to comment.