more api-documentation and code-formatting

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-11-25 10:04:09 +01:00
parent 983e1ce6ad
commit f6e0298d25
7 changed files with 247 additions and 148 deletions

View File

@@ -172,7 +172,7 @@ class Domains extends ApiCommand implements ResourceEntity
* @param bool $hsts_preload
* optional whether or not to preload HSTS header value
* @param bool $ocsp_stapling
* optional whether to enable oscp-stapling for this domain. default ß (false), requires SSL
* optional whether to enable oscp-stapling for this domain. default 0 (false), requires SSL
*
* @access admin
* @throws Exception
@@ -745,7 +745,7 @@ class Domains extends ApiCommand implements ResourceEntity
* @param bool $hsts_preload
* optional whether or not to preload HSTS header value
* @param bool $ocsp_stapling
* optional whether to enable oscp-stapling for this domain. default ß (false), requires SSL
* optional whether to enable oscp-stapling for this domain. default 0 (false), requires SSL
*
* @access admin
* @throws Exception

View File

@@ -101,6 +101,26 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
/**
* create a new fpm-daemon entry
*
* @param string $description
* @param string $reload_cmd
* @param string $config_dir
* @param string $pm
* optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'static'
* @param int $max_children
* optional, default 0
* @param int $start_servers
* optional, default 0
* @param int $min_spare_servers
* optional, default 0
* @param int $max_spare_servers
* optional, default 0
* @param int $max_requests
* optional, default 0
* @param int $idle_timeout
* optional, default 0
* @param string $limit_extensions
* optional, limit execution to the following extensions, default '.php'
*
* @access admin
* @throws Exception
* @return array
@@ -188,6 +208,29 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
* update a fpm-daemon entry by given id
*
* @param int $id
* fpm-daemon id
* @param string $description
* optional
* @param string $reload_cmd
* optional
* @param string $config_dir
* optional
* @param string $pm
* optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'static'
* @param int $max_children
* optional, default 0
* @param int $start_servers
* optional, default 0
* @param int $min_spare_servers
* optional, default 0
* @param int $max_spare_servers
* optional, default 0
* @param int $max_requests
* optional, default 0
* @param int $idle_timeout
* optional, default 0
* @param string $limit_extensions
* optional, limit execution to the following extensions, default '.php'
*
* @access admin
* @throws Exception

View File

@@ -93,7 +93,7 @@ class Froxlor extends ApiCommand
/**
*
* @todo export settings to file
* @todo export settings
*
* @access admin
*/
@@ -234,7 +234,7 @@ class Froxlor extends ApiCommand
$reflection = new \ReflectionClass($mod);
$_functions = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
foreach ($_functions as $func) {
if ($func->class == $mod && $func->isPublic() && !$func->isStatic()) {
if ($func->class == $mod && $func->isPublic() && ! $func->isStatic()) {
array_push($functions, array_merge(array(
'module' => $matches[1],
'function' => $func->name

View File

@@ -30,8 +30,8 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
if ($this->isAdmin() && ($this->getUserDetail('change_serversettings') || ! empty($this->getUserDetail('ip')))) {
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list ips and ports");
$ip_where = "";
if (!empty($this->getUserDetail('ip')) && $this->getUserDetail('ip') != -1) {
$ip_where = "WHERE `id` IN (".implode(", ", json_decode($this->getUserDetail('ip'), true)).")";
if (! empty($this->getUserDetail('ip')) && $this->getUserDetail('ip') != - 1) {
$ip_where = "WHERE `id` IN (" . implode(", ", json_decode($this->getUserDetail('ip'), true)) . ")";
}
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $ip_where . " ORDER BY `ip` ASC, `port` ASC
@@ -63,9 +63,9 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
{
if ($this->isAdmin() && ($this->getUserDetail('change_serversettings') || ! empty($this->getUserDetail('ip')))) {
$id = $this->getParam('id');
if (!empty($this->getUserDetail('ip')) && $this->getUserDetail('ip') != -1) {
if (! empty($this->getUserDetail('ip')) && $this->getUserDetail('ip') != - 1) {
$allowed_ips = json_decode($this->getUserDetail('ip'), true);
if (!in_array($id, $allowed_ips)) {
if (! in_array($id, $allowed_ips)) {
throw new Exception("You cannot access this resource", 405);
}
}
@@ -87,6 +87,34 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
/**
* create a new ip/port entry
*
* @param string $ip
* @param int $port
* optional, default 80
* @param bool $listen_statement
* optional, default 0 (false)
* @param bool $namevirtualhost_statement
* optional, default 0 (false)
* @param bool $vhostcontainer
* optional, default 0 (false)
* @param string $specialsettings
* optional, default empty
* @param bool $vhostcontainer_servername_statement
* optional, default 0 (false)
* @param string $default_vhostconf_domain
* optional, defatul empty
* @param string $docroot
* optional, default empty (point to froxlor)
* @param bool $ssl
* optional, default 0 (false)
* @param string $ssl_cert_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_key_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_ca_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_cert_chainfile
* optional, requires $ssl = 1, default empty
*
* @access admin
* @throws Exception
* @return array
@@ -227,6 +255,34 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
* update ip/port entry by given id
*
* @param int $id
* @param string $ip
* optional
* @param int $port
* optional, default 80
* @param bool $listen_statement
* optional, default 0 (false)
* @param bool $namevirtualhost_statement
* optional, default 0 (false)
* @param bool $vhostcontainer
* optional, default 0 (false)
* @param string $specialsettings
* optional, default empty
* @param bool $vhostcontainer_servername_statement
* optional, default 0 (false)
* @param string $default_vhostconf_domain
* optional, defatul empty
* @param string $docroot
* optional, default empty (point to froxlor)
* @param bool $ssl
* optional, default 0 (false)
* @param string $ssl_cert_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_key_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_ca_file
* optional, requires $ssl = 1, default empty
* @param string $ssl_cert_chainfile
* optional, requires $ssl = 1, default empty
*
* @access admin
* @throws ErrorException