lots of phpdoc; fix Customers::update()

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-22 11:16:55 +01:00
parent c93e2678f7
commit 332e29be24
10 changed files with 211 additions and 11 deletions

View File

@@ -11,7 +11,8 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class Admins extends ApiCommand implements ResourceEntity

View File

@@ -11,7 +11,8 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class Customers extends ApiCommand implements ResourceEntity
@@ -724,7 +725,32 @@ class Customers extends ApiCommand implements ResourceEntity
if (Settings::Get('ticket.enabled') != '1') {
$tickets = - 1;
}
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
if (((($this->getUserDetail('diskspace_used') + $diskspace - $result['diskspace']) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1')
|| ((($this->getUserDetail('mysqls_used') + $mysqls - $result['mysqls']) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1')
|| ((($this->getUserDetail('emails_used') + $emails - $result['emails']) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1')
|| ((($this->getUserDetail('email_accounts_used') + $email_accounts - $result['email_accounts']) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1')
|| ((($this->getUserDetail('email_forwarders_used') + $email_forwarders - $result['email_forwarders']) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1')
|| ((($this->getUserDetail('email_quota_used') + $email_quota - $result['email_quota']) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1')
|| ((($this->getUserDetail('ftps_used') + $ftps - $result['ftps']) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1')
|| ((($this->getUserDetail('tickets_used') + $tickets - $result['tickets']) > $this->getUserDetail('tickets')) && $this->getUserDetail('tickets') != '-1')
|| ((($this->getUserDetail('subdomains_used') + $subdomains - $result['subdomains']) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1')
|| (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1')
|| ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1')
|| ($emails == '-1' && $this->getUserDetail('emails') != '-1')
|| ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1')
|| ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1')
|| ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1')
|| ($ftps == '-1' && $this->getUserDetail('ftps') != '-1')
|| ($tickets == '-1' && $this->getUserDetail('tickets') != '-1')
|| ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')
) {
standard_error('youcantallocatemorethanyouhave', '', true);
}
// Either $name and $firstname or the $company must be inserted
if ($name == '' && $company == '') {
standard_error(array(

View File

@@ -11,7 +11,8 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class Domains extends ApiCommand implements ResourceEntity
@@ -759,14 +760,22 @@ class Domains extends ApiCommand implements ResourceEntity
if ($this->isAdmin() && $this->getUserDetail('change_serversettings')) {
// parameters
$id = $this->getParam('id');
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$domainname = $this->getParam('domainname', $dn_optional, '');
if ($id <= 0 && empty($domainname)) {
throw new Exception("Either 'id' or 'domainname' parameter must be given", 406);
}
// get requested domain
$json_result = Domains::getLocal($this->getUserData(), array(
'id' => $id,
'domainname' => $domainname,
'no_std_subdomain' => true
))->get();
$result = json_decode($json_result, true)['data'];
$id = $result['id'];
// optional parameters
$p_domain = $this->getParam('domain', true, $result['domain']);

View File

@@ -11,14 +11,15 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class FpmDaemons extends ApiCommand implements ResourceEntity
{
/**
* lists all php-config entries
* lists all fpm-daemon entries
*
* @return array count|list
*/
@@ -66,6 +67,13 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
throw new Exception("Not allowed to execute given command.", 403);
}
/**
* return a fpm-daemon entry by id
*
* @param int $id fpm-daemon-id
*
* @return array
*/
public function get()
{
if ($this->isAdmin()) {
@@ -238,6 +246,14 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
throw new Exception("Not allowed to execute given command.", 403);
}
/**
* delete a fpm-daemon entry by id
*
* @param int $id fpm-daemon-id
*
* @throws Exception
* @return array
*/
public function delete()
{
if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) {

View File

@@ -11,12 +11,19 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class Froxlor extends ApiCommand
{
/**
* checks whether there is a newer version of froxlor available
*
* @throws Exception
* @return string
*/
public function checkUpdate()
{
global $version, $branding;

View File

@@ -11,7 +11,8 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class IpsAndPorts extends ApiCommand implements ResourceEntity

View File

@@ -11,7 +11,8 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @package API
* @since 0.10.0
*
*/
class PhpSettings extends ApiCommand implements ResourceEntity
@@ -100,6 +101,13 @@ class PhpSettings extends ApiCommand implements ResourceEntity
throw new Exception("Not allowed to execute given command.", 403);
}
/**
* return a php-config entry by id
*
* @param int $id php-settings-id
*
* @return array
*/
public function get()
{
if ($this->isAdmin()) {
@@ -320,6 +328,14 @@ class PhpSettings extends ApiCommand implements ResourceEntity
throw new Exception("Not allowed to execute given command.", 403);
}
/**
* delete a php-config entry by id
*
* @param int $id php-config-id
*
* @throws Exception
* @return array
*/
public function delete()
{
if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) {