diff --git a/install/tpl/debian6_dovecot.conf.master b/install/tpl/debian6_dovecot.conf.master index b94e4470e81968a289b42dd99617d3b2b2876a98..3cd2444e01a50081fcbf972173af91bd286f3373 100644 --- a/install/tpl/debian6_dovecot.conf.master +++ b/install/tpl/debian6_dovecot.conf.master @@ -1,3 +1,7 @@ +## ISPConfig3 Template file. +## This file was installed by ISPConfig3 +## It will be replaced if ISPConfig3 is updated. + ## Dovecot configuration file base_dir = /var/run/dovecot/ @@ -45,6 +49,13 @@ protocol lda { ## Plugin settings plugin { quota = maildir + + # Disabled user quota reporting for the first upload + # quota = dict:user::file:/var/vmail/%n_%d_quota + # Because the mail quota is called in the user query + # the maildir quota does not need to be set. + # You do not need: quota = maildir + sieve=/var/vmail/%d/%n/.sieve } diff --git a/interface/web/mail/lib/lang/ar_user_quota_stats_list.lng b/interface/web/mail/lib/lang/ar_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/ar_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/bg_user_quota_stats_list.lng b/interface/web/mail/lib/lang/bg_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/bg_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/br_user_quota_stats_list.lng b/interface/web/mail/lib/lang/br_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/br_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/cz_user_quota_stats_list.lng b/interface/web/mail/lib/lang/cz_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/cz_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/de_user_quota_stats_list.lng b/interface/web/mail/lib/lang/de_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/de_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/el_user_quota_stats_list.lng b/interface/web/mail/lib/lang/el_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/el_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/en_user_quota_stats_list.lng b/interface/web/mail/lib/lang/en_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/en_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/es_user_quota_stats_list.lng b/interface/web/mail/lib/lang/es_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..a6cf89ec7a0c102ff5e029e2891f70924472716f --- /dev/null +++ b/interface/web/mail/lib/lang/es_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Cuota de Correo'; +$wb["quota_txt"] = 'Cuota'; +$wb["name_txt"] = 'Nombre'; +$wb["email_txt"] = 'Correo'; +$wb["used_txt"] = 'Usado'; +?> diff --git a/interface/web/mail/lib/lang/fi_user_quota_stats_list.lng b/interface/web/mail/lib/lang/fi_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/fi_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/fr_user_quota_stats_list.lng b/interface/web/mail/lib/lang/fr_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/fr_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/hu_user_quota_stats_list.lng b/interface/web/mail/lib/lang/hu_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/hu_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/id_user_quota_stats_list.lng b/interface/web/mail/lib/lang/id_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/id_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/it_user_quota_stats_list.lng b/interface/web/mail/lib/lang/it_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/it_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/ja_user_quota_stats_list.lng b/interface/web/mail/lib/lang/ja_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/ja_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/nl_user_quota_stats_list.lng b/interface/web/mail/lib/lang/nl_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/nl_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/pl_user_quota_stats_list.lng b/interface/web/mail/lib/lang/pl_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/pl_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/pt_user_quota_stats_list.lng b/interface/web/mail/lib/lang/pt_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/pt_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/ro_user_quota_stats_list.lng b/interface/web/mail/lib/lang/ro_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/ro_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/ru_user_quota_stats_list.lng b/interface/web/mail/lib/lang/ru_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/ru_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/se_user_quota_stats_list.lng b/interface/web/mail/lib/lang/se_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/se_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/sk_user_quota_stats_list.lng b/interface/web/mail/lib/lang/sk_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/sk_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/lang/tr_user_quota_stats_list.lng b/interface/web/mail/lib/lang/tr_user_quota_stats_list.lng new file mode 100755 index 0000000000000000000000000000000000000000..2a493ce98bfe0b184546b37df0d06e8250eab6c5 --- /dev/null +++ b/interface/web/mail/lib/lang/tr_user_quota_stats_list.lng @@ -0,0 +1,7 @@ +<?php +$wb["list_head_txt"] = 'Mailbox quota'; +$wb["quota_txt"] = 'Quota'; +$wb["name_txt"] = 'Name'; +$wb["email_txt"] = 'Email Address'; +$wb["used_txt"] = 'Used space'; +?> diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php index 11fad78c5f05f3f46127a00516627a6acd224b15..6e71f6ea0e6ebed5678f4ad07e2a0b56da494670 100644 --- a/interface/web/mail/lib/module.conf.php +++ b/interface/web/mail/lib/module.conf.php @@ -153,6 +153,14 @@ if($app->auth->get_client_limit($userid,'fetchmail') != 0) //**** Statistics menu $items = array(); +/* +//** Email Quotas +$items[] = array( 'title' => 'Mailbox quota', + 'target' => 'content', + 'link' => 'mail/user_quota_stats.php', + 'html_id' => 'user_quota_stats'); +*/ + $items[] = array( 'title' => 'Mailbox traffic', 'target' => 'content', 'link' => 'mail/mail_user_stats.php', diff --git a/interface/web/mail/list/user_quota_stats.list.php b/interface/web/mail/list/user_quota_stats.list.php new file mode 100644 index 0000000000000000000000000000000000000000..efff8a999d292bf1a7a1f0b59b01a4c7e175687a --- /dev/null +++ b/interface/web/mail/list/user_quota_stats.list.php @@ -0,0 +1,76 @@ +<?php + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + +// Name of the list +$liste["name"] = "user_quota_stats"; + +// Database table +$liste["table"] = "mail_user"; + +// Index index field of the database table +$liste["table_idx"] = "mailuser_id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = 15; + +// Script File of the list +$liste["file"] = "user_quota_stats.php"; + +// Script file of the edit form +$liste["edit_file"] = "mail_user_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "mail_user_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "yes"; + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste["item"][] = array( 'field' => "email", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "name", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "quota", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + +?> \ No newline at end of file diff --git a/interface/web/mail/templates/user_quota_stats_list.htm b/interface/web/mail/templates/user_quota_stats_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..3c4d9ec7544d871a72106aa99231015084769c2a --- /dev/null +++ b/interface/web/mail/templates/user_quota_stats_list.htm @@ -0,0 +1,48 @@ +<h2><tmpl_var name="list_head_txt"></h2> + +<div class="panel panel_list_user_quota_stats"> + + <div class="pnl_listarea"> + <fieldset><legend><tmpl_var name="list_head_txt"></legend> + <table class="list"> + <thead> + <tr> + <th class="tbl_col_email" scope="col"><tmpl_var name="email_txt"></th> + <th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th> + <th class="tbl_col_system_user" scope="col" style="text-align:right;"><tmpl_var name="used_txt"></th> + <th class="tbl_col_system_user" scope="col" style="text-align:right;"><tmpl_var name="quota_txt"></th> + <th class="tbl_col_buttons" scope="col"> </th> + </tr> + <tr> + <td class="tbl_col_domain"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td> + <td class="tbl_col_system_user"><input type="text" name="search_system_user" value="{tmpl_var name='search_name'}" /></td> + <td class="tbl_col_system_user"> </td> + <td class="tbl_col_system_user"> </td> + <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','mail/user_quota_stats.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td> + </tr> + </thead> + <tbody> + <tmpl_loop name="records"> + <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + <td class="tbl_col_email"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a></td> + <td class="tbl_col_name"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td> + <td class="tbl_col_used" style="text-align:right;"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="used"}</a></td> + <td class="tbl_col_limit" style="text-align:right;"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="quota"}</a></td> + <td class="tbl_col_buttons"> + <div class="buttons icons16"> + + </div> + </td> + </tr> + </tmpl_loop> + </tbody> + <tfoot> + <tr> + <td class="tbl_footer tbl_paging" colspan="5"><tmpl_var name="paging"></td> + </tr> + </tfoot> + </table> + </fieldset> + </div> + +</div> diff --git a/interface/web/mail/user_quota_stats.php b/interface/web/mail/user_quota_stats.php new file mode 100644 index 0000000000000000000000000000000000000000..18d962f339800ce2d86e3b67150d60ca87e84c68 --- /dev/null +++ b/interface/web/mail/user_quota_stats.php @@ -0,0 +1,70 @@ +<?php +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/user_quota_stats.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +//* Check permissions for module +$app->auth->check_module_permissions('mail'); + +$app->load('listform_actions'); + +// $tmp_rec = $app->db->queryOneRecord("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC"); +// $monitor_data = unserialize($app->db->unquote($tmp_rec['data'])); +$tmp_rec = $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC"); +$monitor_data = array(); +if(is_array($tmp_rec)) { + foreach ($tmp_rec as $tmp_mon) { + $monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data']))); + } +} + + +class list_action extends listform_actions { + + function prepareDataRow($rec) + { + global $app,$monitor_data; + + $rec = $app->listform->decode($rec); + + //* Alternating datarow colors + $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; + $rec['bgcolor'] = $this->DataRowColor; + $email = $rec['email']; + + $rec['used'] = $monitor_data[$email]['used']; + + if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1]; + + $rec['quota'] = round($rec['quota'] / 1048576,2).' MB'; + if($rec['quota'] == "0 MB") $rec['quota'] = $app->lng('unlimited'); + + + if($rec['used'] < 1544000) { + $rec['used'] = round($rec['used'] / 1024,2).' KB'; + } else { + $rec['used'] = round($rec['used'] / 1048576,2).' MB'; + } + + //* The variable "id" contains always the index variable + $rec['id'] = $rec[$this->idx_key]; + return $rec; + } +} + +$list = new list_action; +$list->SQLExtWhere = ""; + +$list->onLoad(); + + +?> \ No newline at end of file diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php index 3d08bc838ad5c0ee245e1a1c903cf8a5f31e3de0..6baa1bb1084e505e71d111842b36f4fdeb7ab61e 100644 --- a/server/lib/classes/monitor_tools.inc.php +++ b/server/lib/classes/monitor_tools.inc.php @@ -149,35 +149,69 @@ class monitor_tools { return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid); } +/* + //** Email Quota + public function monitorEmailQuota() { + global $conf; + + //* Initialize data array + $data = array(); + + //* the id of the server as int + $server_id = intval($conf['server_id']); + + //* The type of the data + $type = 'email_quota'; + + //* The state of the email_quota. + $state = 'ok'; + + //* Dovecot quota check Courier in progress lathama@gmail.com + if($dir = opendir("/var/vmail")){ + while (($quotafiles = readdir($dir)) !== false){ + if(preg_match('/.\_quota$/', $quotafiles)){ + $quotafile = (file("/var/vmail/" . $quotafiles)); + $emailaddress = preg_replace('/_quota/',"", $quotafiles); + $emailaddress = preg_replace('/_/',"@", $emailaddress); + $data[$emailaddress]['used'] = trim($quotafile['1']); + } + } + closedir($dir); + } + $res['server_id'] = $server_id; + $res['type'] = $type; + $res['data'] = $data; + $res['state'] = $state; + return $res; + } +*/ + + //** Filesystem Quota public function monitorHDQuota() { global $conf; - /* Initialize data array */ + //* Initialize data array $data = array(); - /* the id of the server as int */ + //* the id of the server as int $server_id = intval($conf['server_id']); - /** The type of the data */ + //* The type of the data $type = 'harddisk_quota'; - /** The state of the harddisk_quota. */ + //* The state of the harddisk_quota. $state = 'ok'; - /** Fetch the data for all users */ + //* Fetch the data for all users $dfData = shell_exec('repquota -au'); - // split into array + //* Split into array $df = explode("\n", $dfData); - /* - * ignore the first 5 lines, process the rest - */ + //* ignore the first 5 lines, process the rest for ($i = 5; $i <= sizeof($df); $i++) { if ($df[$i] != '') { - /* - * Make a array of the data - */ + //* Make a array of the data $s = preg_split('/[\s]+/', $df[$i]); $username = $s[0]; if (substr($username, 0, 3) == 'web') { @@ -194,20 +228,16 @@ class monitor_tools { } } - /** Fetch the data for all users */ + //** Fetch the data for all users $dfData = shell_exec('repquota -ag'); - // split into array + //* split into array $df = explode("\n", $dfData); - /* - * ignore the first 5 lines, process the rest - */ + //* ignore the first 5 lines, process the rest for ($i = 5; $i <= sizeof($df); $i++) { if ($df[$i] != '') { - /* - * Make a array of the data - */ + //* Make a array of the data $s = preg_split('/[\s]+/', $df[$i]); $groupname = $s[0]; if (substr($groupname, 0, 6) == 'client') { @@ -224,9 +254,7 @@ class monitor_tools { } } - /* - * Return the Result - */ + //* Return the Result $res['server_id'] = $server_id; $res['type'] = $type; $res['data'] = $data; @@ -1670,4 +1698,4 @@ class monitor_tools { } -?> +?> \ No newline at end of file diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php index 70df7fd1ee4cb8fbb9787c5902e18fca6c746575..185702a1c4b2b219897dc3cffe3f5a997ac5dcfd 100644 --- a/server/mods-available/monitor_core_module.inc.php +++ b/server/mods-available/monitor_core_module.inc.php @@ -86,6 +86,7 @@ class monitor_core_module { /* * Calls the single Monitoring steps */ + //* $this->_monitorEmailQuota(); in process $this->_monitorHDQuota(); $this->_monitorServer(); $this->_monitorOsVer(); @@ -763,4 +764,4 @@ class monitor_core_module { } -?> +?> \ No newline at end of file