本文整理汇总了PHP中ctrl_users::GetQuotaUsages方法的典型用法代码示例。如果您正苦于以下问题:PHP ctrl_users::GetQuotaUsages方法的具体用法?PHP ctrl_users::GetQuotaUsages怎么用?PHP ctrl_users::GetQuotaUsages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ctrl_users
的用法示例。
在下文中一共展示了ctrl_users::GetQuotaUsages方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Template
public static function Template()
{
$currentuser = ctrl_users::GetUserDetail();
$bandwidthquota = $currentuser['bandwidthquota'];
$bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']);
if ($bandwidthquota == 0) {
return '<div class="progress progress-striped"><div class="progress-bar progress-bar-success" style="width: 0%"></div></div>';
} else {
if (fs_director::CheckForEmptyValue($bandwidth)) {
$bandwidth = 0;
}
$percent = round($bandwidth / $bandwidthquota * 100, 0);
if ($percent >= 75) {
$bar = 'danger';
} else {
$bar = 'success';
}
if ($percent >= 10) {
$showpercent = $percent . '%';
} else {
$showpercent = '';
}
return '<div class="progress progress-striped"><div class="progress-bar progress-bar-' . $bar . '" style="width: ' . $percent . '%">' . $showpercent . '</div></div>';
}
}
示例2: getShadowAccounts
static function getShadowAccounts()
{
global $zdbh;
global $controller;
$currentuser = ctrl_users::GetUserDetail();
if ($currentuser['username'] == 'zadmin') {
$sql = "SELECT * FROM x_accounts WHERE ac_deleted_ts IS NULL ORDER BY ac_user_vc";
$numrows = $zdbh->prepare($sql);
$numrows->execute();
} else {
$sql = "SELECT * FROM x_accounts WHERE ac_reseller_fk = :userid AND ac_deleted_ts IS NULL ORDER BY ac_user_vc";
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':userid', $currentuser['userid']);
$numrows->execute();
}
//$numrows = $zdbh->query($sql);
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
if ($currentuser['username'] == 'zadmin') {
//noi bind needed
} else {
//bind the username
$sql->bindParam(':userid', $currentuser['userid']);
}
$res = array();
$sql->execute();
while ($rowclients = $sql->fetch()) {
if ($rowclients['ac_id_pk'] != $currentuser['userid']) {
$clientdetail = ctrl_users::GetUserDetail($rowclients['ac_id_pk']);
array_push($res, array('clientusername' => $clientdetail['username'], 'clientid' => $rowclients['ac_id_pk'], 'packagename' => $clientdetail['packagename'], 'usergroup' => $clientdetail['usergroup'], 'currentdisk' => fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('diskspace', $rowclients['ac_id_pk'])), 'currentbandwidth' => fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('bandwidth', $rowclients['ac_id_pk']))));
}
}
return $res;
} else {
return false;
}
}
示例3: WriteVhostConfigFile
function WriteVhostConfigFile()
{
global $zdbh;
//Get email for server admin of MADmin
$getserveremail = $zdbh->query("SELECT ac_email_vc FROM x_accounts where ac_id_pk=1")->fetch();
$serveremail = $getserveremail['ac_email_vc'] != "" ? $getserveremail['ac_email_vc'] : "postmaster@" . ctrl_options::GetSystemOption('MADmin_domain');
$VHostDefaultPort = ctrl_options::GetSystemOption('apache_port');
$customPorts = array(ctrl_options::GetSystemOption('MADmin_port'));
$portQuery = $zdbh->prepare("SELECT vh_custom_port_in FROM x_vhosts WHERE vh_deleted_ts IS NULL");
$portQuery->execute();
while ($rowport = $portQuery->fetch()) {
$customPorts[] = empty($rowport['vh_custom_port_in']) ? $VHostDefaultPort : $rowport['vh_custom_port_in'];
}
$customPortList = array_unique($customPorts);
/*
* ##############################################################################################################
* #
* # Default Virtual Host Container
* #
* ##############################################################################################################
*/
$line = "################################################################" . fs_filehandler::NewLine();
$line .= "# Apache VHOST configuration file" . fs_filehandler::NewLine();
$line .= "# Automatically generated by MADmin " . sys_versions::ShowMADminVersion() . fs_filehandler::NewLine();
$line .= "# Generated on: " . date(ctrl_options::GetSystemOption('MADmin_df'), time()) . fs_filehandler::NewLine();
$line .= "#==== YOU MUST NOT EDIT THIS FILE : IT WILL BE OVERWRITTEN ====" . fs_filehandler::NewLine();
$line .= "# Use MADmin Menu -> Admin -> Module Admin -> Apache config" . fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= fs_filehandler::NewLine();
# NameVirtualHost is still needed for Apache 2.2 but must be removed for apache 2.3
if ((double) sys_versions::ShowApacheVersion() < 2.3) {
foreach ($customPortList as $port) {
$line .= "NameVirtualHost *:" . $port . fs_filehandler::NewLine();
}
}
# Listen is mandatory for each port <> 80 (80 is defined in system config)
foreach ($customPortList as $port) {
$line .= "Listen " . $port . fs_filehandler::NewLine();
}
$line .= fs_filehandler::NewLine();
$line .= "# Configuration for MADmin control panel." . fs_filehandler::NewLine();
$line .= "<VirtualHost *:" . ctrl_options::GetSystemOption('MADmin_port') . ">" . fs_filehandler::NewLine();
$line .= "ServerAdmin " . $serveremail . fs_filehandler::NewLine();
$line .= 'DocumentRoot "' . ctrl_options::GetSystemOption('MADmin_root') . '"' . fs_filehandler::NewLine();
$line .= "ServerName " . ctrl_options::GetSystemOption('MADmin_domain') . fs_filehandler::NewLine();
$line .= 'ErrorLog "' . ctrl_options::GetSystemOption('log_dir') . 'MADmin-error.log" ' . fs_filehandler::NewLine();
$line .= 'CustomLog "' . ctrl_options::GetSystemOption('log_dir') . 'MADmin-access.log" ' . ctrl_options::GetSystemOption('access_log_format') . fs_filehandler::NewLine();
$line .= 'CustomLog "' . ctrl_options::GetSystemOption('log_dir') . 'MADmin-bandwidth.log" ' . ctrl_options::GetSystemOption('bandwidth_log_format') . fs_filehandler::NewLine();
$line .= "AddType application/x-httpd-php .php" . fs_filehandler::NewLine();
$line .= '<Directory "' . ctrl_options::GetSystemOption('MADmin_root') . '">' . fs_filehandler::NewLine();
$line .= "Options +FollowSymLinks -Indexes" . fs_filehandler::NewLine();
$line .= " AllowOverride All" . fs_filehandler::NewLine();
if ((double) sys_versions::ShowApacheVersion() < 2.4) {
$line .= " Order allow,deny" . fs_filehandler::NewLine();
$line .= " Allow from all" . fs_filehandler::NewLine();
} else {
$line .= " Require all granted" . fs_filehandler::NewLine();
}
$line .= "</Directory>" . fs_filehandler::NewLine();
$line .= fs_filehandler::NewLine();
$line .= "# Custom settings are loaded below this line (if any exist)" . fs_filehandler::NewLine();
// Global custom MADmin entry
$line .= ctrl_options::GetSystemOption('global_zpcustom') . fs_filehandler::NewLine();
$line .= "</VirtualHost>" . fs_filehandler::NewLine();
$line .= fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= "# MADmin generated VHOST configurations below....." . fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= fs_filehandler::NewLine();
/*
* ##############################################################################################################
* #
* # All Virtual Host Containers
* #
* ##############################################################################################################
*/
// MADmin virtual host container configuration
$sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_deleted_ts IS NULL");
$sql->execute();
while ($rowvhost = $sql->fetch()) {
// Grab some variables we will use for later...
$vhostuser = ctrl_users::GetUserDetail($rowvhost['vh_acc_fk']);
$bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $vhostuser['userid']);
$diskspace = ctrl_users::GetQuotaUsages('diskspace', $vhostuser['userid']);
// Set the vhosts to "LIVE"
$vsql = $zdbh->prepare("UPDATE x_vhosts SET vh_active_in=1 WHERE vh_id_pk=:id");
$vsql->bindParam(':id', $rowvhost['vh_id_pk']);
$vsql->execute();
// Add a default email if no email found for client.
$useremail = fs_director::CheckForEmptyValue($vhostuser['email']) ? "postmaster@" . $rowvhost['vh_name_vc'] : $vhostuser['email'];
// Check if domain or subdomain to see if we add an alias with 'www'
$serveralias = $rowvhost['vh_type_in'] == 2 ? '' : " www." . $rowvhost['vh_name_vc'];
$vhostPort = fs_director::CheckForEmptyValue($rowvhost['vh_custom_port_in']) ? $VHostDefaultPort : $rowvhost['vh_custom_port_in'];
$vhostIp = fs_director::CheckForEmptyValue($rowvhost['vh_custom_ip_vc']) ? "*" : $rowvhost['vh_custom_ip_vc'];
//Domain is enabled
//Line1: Domain enabled & Client also is enabled.
//Line2: Domain enabled & Client may be disabled, but 'Allow Disabled' = 'true' in apache settings.
if ($rowvhost['vh_enabled_in'] == 1 && ctrl_users::CheckUserEnabled($rowvhost['vh_acc_fk']) || $rowvhost['vh_enabled_in'] == 1 && ctrl_options::GetSystemOption('apache_allow_disabled') == strtolower("true")) {
/*
* ##################################################
//.........这里部分代码省略.........
示例4: Template
public static function Template()
{
$currentuser = ctrl_users::GetUserDetail();
return ctrl_users::GetQuotaUsages('mailboxes', $currentuser['userid']);
}
示例5: DisplaypBar
static function DisplaypBar($total, $quota)
{
$currentuser = ctrl_users::GetUserDetail();
$typequota = $currentuser[$quota];
$type = ctrl_users::GetQuotaUsages($total, $currentuser['userid']);
if ($typequota == 0) {
return '';
}
//Quota are disabled
if (fs_director::CheckForEmptyValue($type)) {
return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=0"/>';
}
if ($type == $typequota) {
return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=100"/>';
}
return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=' . round($type / $typequota * 100, 0) . '"/>';
}
示例6: ListDisabledClients
static function ListDisabledClients($uid)
{
global $zdbh;
$sql = "SELECT * FROM x_accounts WHERE ac_reseller_fk=:uid AND ac_enabled_in=0 AND ac_deleted_ts IS NULL";
//$numrows = $zdbh->query($sql);
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':uid', $uid);
$numrows->execute();
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
$sql->bindParam(':uid', $uid);
$res = array();
$sql->execute();
while ($rowclients = $sql->fetch()) {
if ($rowclients['ac_user_vc'] != "zadmin") {
$currentuser = ctrl_users::GetUserDetail($rowclients['ac_id_pk']);
$currentuser['diskspacereadable'] = fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('diskspace', $currentuser['userid']));
$currentuser['diskspacequotareadable'] = fs_director::ShowHumanFileSize($currentuser['diskquota']);
$currentuser['bandwidthreadable'] = fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']));
$currentuser['bandwidthquotareadable'] = fs_director::ShowHumanFileSize($currentuser['bandwidthquota']);
array_push($res, $currentuser);
}
}
return $res;
} else {
return false;
}
}
示例7: Template
public static function Template()
{
$currentuser = ctrl_users::GetUserDetail();
return fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('diskspace', $currentuser['userid']));
}
示例8: getFTPUsagepChart
static function getFTPUsagepChart()
{
global $controller;
$currentuser = ctrl_users::GetUserDetail();
$maximum = $currentuser['ftpaccountsquota'];
if ($maximum < 0) {
//-1 = unlimited
if (file_exists(ui_tpl_assetfolderpath::Template() . 'img/misc/unlimited.png')) {
return '<img src="' . ui_tpl_assetfolderpath::Template() . 'img/misc/unlimited.png" alt="' . ui_language::translate('Unlimited') . '"/>';
} else {
return '<img src="modules/' . $controller->GetControllerRequest('URL', 'module') . '/assets/unlimited.png" alt="' . ui_language::translate('Unlimited') . '"/>';
}
} else {
$used = ctrl_users::GetQuotaUsages('ftpaccounts', $currentuser['userid']);
$free = max($maximum - $used, 0);
return '<img src="etc/lib/pChart2/MADmin/z3DPie.php?score=' . $free . '::' . $used . '&labels=Free: ' . $free . '::Used: ' . $used . '&legendfont=verdana&legendfontsize=8&imagesize=240::190&chartsize=120::90&radius=100&legendsize=150::160"' . ' alt="' . ui_language::translate('Pie chart') . '"/>';
}
}
示例9: getForwardUsagepChart
static function getForwardUsagepChart()
{
$currentuser = ctrl_users::GetUserDetail();
$maximum = $currentuser['forwardersquota'];
if ($maximum < 0) {
//-1 = unlimited
return '<img src="' . ui_tpl_assetfolderpath::Template() . 'images/unlimited.png" alt="' . ui_language::translate('Unlimited') . '"/>';
} else {
$used = ctrl_users::GetQuotaUsages('forwarders', $currentuser['userid']);
$free = max($maximum - $used, 0);
return '<img src="etc/lib/pChart2/sentora/z3DPie.php?score=' . $free . '::' . $used . '&labels=Free: ' . $free . '::Used: ' . $used . '&legendfont=verdana&legendfontsize=8&imagesize=240::190&chartsize=120::90&radius=100&legendsize=150::160"' . ' alt="' . ui_language::translate('Pie chart') . '"/>';
}
}
示例10: WriteVhostConfigFile
function WriteVhostConfigFile()
{
global $zdbh;
//Get email for server admin of zpanel
$getserveremail = $zdbh->query("SELECT ac_email_vc FROM x_accounts where ac_id_pk=1")->fetch();
if ($getserveremail['ac_email_vc'] != "") {
$serveremail = $getserveremail['ac_email_vc'];
} else {
$serveremail = "postmaster@" . ctrl_options::GetSystemOption('zpanel_domain');
}
$customPorts = array();
$portQuery = $zdbh->prepare("SELECT vh_custom_port_in, vh_deleted_ts FROM zpanel_core.x_vhosts WHERE vh_custom_port_in IS NOT NULL AND vh_deleted_ts IS NULL");
$portQuery->execute();
while ($rowport = $portQuery->fetch()) {
$customPorts[] = $rowport['vh_custom_port_in'];
}
$customPortList = array_unique($customPorts);
/*
* ##############################################################################################################
* #
* # Default Virtual Host Container
* #
* ##############################################################################################################
*/
$line = "################################################################" . fs_filehandler::NewLine();
$line .= "# Apache VHOST configuration file" . fs_filehandler::NewLine();
$line .= "# Automatically generated by ZPanel " . sys_versions::ShowZpanelVersion() . fs_filehandler::NewLine();
$line .= "# Generated on: " . date(ctrl_options::GetSystemOption('zpanel_df'), time()) . fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= "" . fs_filehandler::NewLine();
/**
* NameVirtualHost is still needed for Apache 2.2
* @todo conditionally run this for apache version > 2.2
* warning apache verion not available in php functions when running over cli
*/
$line .= "NameVirtualHost *:" . ctrl_options::GetSystemOption('apache_port') . "" . fs_filehandler::NewLine();
foreach ($customPortList as $port) {
$line .= "NameVirtualHost *:" . $port . "" . fs_filehandler::NewLine();
}
$line .= "" . fs_filehandler::NewLine();
$line .= "# Configuration for ZPanel control panel." . fs_filehandler::NewLine();
$line .= "<VirtualHost *:" . ctrl_options::GetSystemOption('sentora_port') . ">" . fs_filehandler::NewLine();
$line .= "ServerAdmin " . $serveremail . fs_filehandler::NewLine();
$line .= "DocumentRoot \"" . ctrl_options::GetSystemOption('zpanel_root') . "\"" . fs_filehandler::NewLine();
$line .= "ServerName " . ctrl_options::GetSystemOption('zpanel_domain') . "" . fs_filehandler::NewLine();
$line .= "AddType application/x-httpd-php .php" . fs_filehandler::NewLine();
$line .= "<Directory \"" . ctrl_options::GetSystemOption('zpanel_root') . "\">" . fs_filehandler::NewLine();
$line .= "Options +FollowSymLinks -Indexes" . fs_filehandler::NewLine();
$line .= " AllowOverride All" . fs_filehandler::NewLine();
$line .= " Order allow,deny" . fs_filehandler::NewLine();
$line .= " Allow from all" . fs_filehandler::NewLine();
$line .= "</Directory>" . fs_filehandler::NewLine();
$line .= "" . fs_filehandler::NewLine();
$line .= "# Custom settings are loaded below this line (if any exist)" . fs_filehandler::NewLine();
// Global custom zpanel entry
$line .= ctrl_options::GetSystemOption('global_zpcustom') . fs_filehandler::NewLine();
$line .= "</VirtualHost>" . fs_filehandler::NewLine();
$line .= "" . fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= "# ZPanel generated VHOST configurations below....." . fs_filehandler::NewLine();
$line .= "################################################################" . fs_filehandler::NewLine();
$line .= "" . fs_filehandler::NewLine();
/*
* ##############################################################################################################
* #
* # All Virtual Host Containers
* #
* ##############################################################################################################
*/
// Zpanel virtual host container configuration
$sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_deleted_ts IS NULL");
$sql->execute();
while ($rowvhost = $sql->fetch()) {
// Grab some variables we will use for later...
$vhostuser = ctrl_users::GetUserDetail($rowvhost['vh_acc_fk']);
$bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $vhostuser['userid']);
$diskspace = ctrl_users::GetQuotaUsages('diskspace', $vhostuser['userid']);
// Set the vhosts to "LIVE"
$vsql = $zdbh->prepare("UPDATE x_vhosts SET vh_active_in=1 WHERE vh_id_pk=:id");
$vsql->bindParam(':id', $rowvhost['vh_id_pk']);
$vsql->execute();
// Add a default email if no email found for client.
if (fs_director::CheckForEmptyValue($vhostuser['email'])) {
$useremail = "postmaster@" . $rowvhost['vh_name_vc'];
} else {
$useremail = $vhostuser['email'];
}
// Check if domain or subdomain to see if we add an alias with 'www'
if ($rowvhost['vh_type_in'] == 2) {
$serveralias = $rowvhost['vh_name_vc'];
} else {
$serveralias = $rowvhost['vh_name_vc'] . " www." . $rowvhost['vh_name_vc'];
}
if (fs_director::CheckForEmptyValue($rowvhost['vh_custom_port_in'])) {
$vhostPort = ctrl_options::GetSystemOption('apache_port');
} else {
$vhostPort = $rowvhost['vh_custom_port_in'];
}
if (fs_director::CheckForEmptyValue($rowvhost['vh_custom_ip_vc'])) {
$vhostIp = "*";
//.........这里部分代码省略.........
示例11: getQuotaLimit
static function getQuotaLimit()
{
$currentuser = ctrl_users::GetUserDetail();
return $currentuser['forwardersquota'] < 0 or $currentuser['forwardersquota'] > ctrl_users::GetQuotaUsages('forwarders', $currentuser['userid']);
}
示例12: getMysqlUsagepChart
static function getMysqlUsagepChart()
{
global $controller;
$currentuser = ctrl_users::GetUserDetail();
$line = "";
$mysqlquota = $currentuser['mysqlquota'];
$mysql = ctrl_users::GetQuotaUsages('mysql', $currentuser['userid']);
$total = $mysqlquota;
$used = $mysql;
$free = $total - $used;
$line .= "<img src=\"etc/lib/pChart2/sentora/z3DPie.php?score=" . $free . "::" . $used . "&labels=Free: " . $free . "::Used: " . $used . "&legendfont=verdana&legendfontsize=8&imagesize=240::190&chartsize=120::90&radius=100&legendsize=150::160\"/>";
return $line;
}
示例13: getQuotaLimit
static function getQuotaLimit()
{
$currentuser = ctrl_users::GetUserDetail();
return ($currentuser['forwardersquota'] < 0 ) or //-1 = unlimited
($currentuser['forwardersquota'] > ctrl_users::GetQuotaUsages('forwarders', $currentuser['userid']));
}
示例14: ListClients
static function ListClients($uid = 0)
{
global $zdbh;
$sql = "SELECT * FROM x_accounts WHERE ac_deleted_ts IS NOT NULL";
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':uid', $uid);
$numrows->execute();
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
if ($uid == 0) {
//do not bind as there is no need
} else {
//else we bind the pram to the sql statment
$sql->bindParam(':uid', $uid);
}
$res = array();
$sql->execute();
while ($rowclients = $sql->fetch()) {
if ($rowclients['ac_user_vc'] != "zadmin") {
$numrows = $zdbh->prepare("SELECT COUNT(*) FROM x_accounts WHERE ac_reseller_fk=:ac_id_pk AND ac_deleted_ts IS NULL");
$numrows->bindParam(':ac_id_pk', $rowclients['ac_id_pk']);
$numrows->execute();
$numrowclients = $numrows->fetch();
$currentuser = ctrl_users::GetUserDetail($rowclients['ac_id_pk']);
$currentuser['diskspacereadable'] = fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('diskspace', $currentuser['userid']));
$currentuser['diskspacequotareadable'] = fs_director::ShowHumanFileSize($currentuser['diskquota']);
$currentuser['bandwidthreadable'] = fs_director::ShowHumanFileSize(ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']));
$currentuser['bandwidthquotareadable'] = fs_director::ShowHumanFileSize($currentuser['bandwidthquota']);
$currentuser['numclients'] = $numrowclients[0];
array_push($res, $currentuser);
}
}
return $res;
} else {
return false;
}
}