* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
- Adding SM2 panel [SME: 13004] - Upgrade to phpsysinfo 3.4.4 - Add code to delete inline styles and add css to make it look better. - version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
@@ -1,18 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Quotas Plugin
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PSI_Plugin_Quotas
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @version SVN: $Id: class.quotas.inc.php 661 2012-08-27 11:26:39Z namiltd $
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
/**
|
||||
* Quotas Plugin, which displays all quotas on the machine
|
||||
* display all quotas in a sortable table with the current values which are determined by
|
||||
* calling the "repquota" command line utility, another way is to provide
|
||||
@@ -24,7 +11,7 @@
|
||||
* @package PSI_Plugin_Quotas
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
|
||||
* @version Release: 3.0
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
@@ -50,16 +37,18 @@ class Quotas extends PSI_Plugin
|
||||
public function __construct($enc)
|
||||
{
|
||||
parent::__construct(__CLASS__, $enc);
|
||||
switch (strtolower(PSI_PLUGIN_QUOTAS_ACCESS)) {
|
||||
$buffer = "";
|
||||
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) switch (strtolower(PSI_PLUGIN_QUOTAS_ACCESS)) {
|
||||
case 'command':
|
||||
CommonFunctions::executeProgram("repquota", "-au", $buffer, PSI_DEBUG);
|
||||
break;
|
||||
case 'data':
|
||||
CommonFunctions::rfts(APP_ROOT."/data/quotas.txt", $buffer);
|
||||
if (!defined('PSI_EMU_HOSTNAME')) {
|
||||
CommonFunctions::rftsdata("quotas.tmp", $buffer);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_QUOTAS_ACCESS");
|
||||
break;
|
||||
$this->global_error->addConfigError("__construct()", "[quotas] ACCESS");
|
||||
}
|
||||
if (trim($buffer) != "") {
|
||||
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
|
||||
@@ -81,22 +70,26 @@ class Quotas extends PSI_Plugin
|
||||
$i = 0;
|
||||
$quotas = array();
|
||||
foreach ($this->_filecontent as $thisline) {
|
||||
$thisline = preg_replace("/([\s]--)/", "", $thisline);
|
||||
$thisline = preg_split("/(\s)/e", $thisline, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if (count($thisline) == 7) {
|
||||
$quotas[$i]['user'] = str_replace("--", "", $thisline[0]);
|
||||
$quotas[$i]['byte_used'] = $thisline[1] * 1024;
|
||||
$quotas[$i]['byte_soft'] = $thisline[2] * 1024;
|
||||
$quotas[$i]['byte_hard'] = $thisline[3] * 1024;
|
||||
if ($thisline[3] != 0) {
|
||||
$thisline = preg_replace("/([\s][-+][-+])/", "", $thisline);
|
||||
$thisline = preg_split("/(\s)/", $thisline, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$params = array();
|
||||
foreach ($thisline as $param) if (is_numeric($param)) {
|
||||
$params[] = $param;
|
||||
}
|
||||
if (($paramscount = count($params)) == 6) {
|
||||
$quotas[$i]['user'] = trim($thisline[0], " \t+-");
|
||||
$quotas[$i]['byte_used'] = $params[0] * 1024;
|
||||
$quotas[$i]['byte_soft'] = $params[1] * 1024;
|
||||
$quotas[$i]['byte_hard'] = $params[2] * 1024;
|
||||
if ($quotas[$i]['byte_hard'] != 0) {
|
||||
$quotas[$i]['byte_percent_used'] = round((($quotas[$i]['byte_used'] / $quotas[$i]['byte_hard']) * 100), 1);
|
||||
} else {
|
||||
$quotas[$i]['byte_percent_used'] = 0;
|
||||
}
|
||||
$quotas[$i]['file_used'] = $thisline[4];
|
||||
$quotas[$i]['file_soft'] = $thisline[5];
|
||||
$quotas[$i]['file_hard'] = $thisline[6];
|
||||
if ($thisline[6] != 0) {
|
||||
$quotas[$i]['file_used'] = $params[3];
|
||||
$quotas[$i]['file_soft'] = $params[4];
|
||||
$quotas[$i]['file_hard'] = $params[5];
|
||||
if ($quotas[$i]['file_hard'] != 0) {
|
||||
$quotas[$i]['file_percent_used'] = round((($quotas[$i]['file_used'] / $quotas[$i]['file_hard']) * 100), 1);
|
||||
} else {
|
||||
$quotas[$i]['file_percent_used'] = 0;
|
||||
|
Reference in New Issue
Block a user