diff --git a/evolibs/Form.php b/evolibs/Form.php index 74aea53..611caf6 100644 --- a/evolibs/Form.php +++ b/evolibs/Form.php @@ -257,11 +257,17 @@ class FormPage { class FormField { protected $value = null; protected $error = null; + /** @var string|null $label */ protected $label = null; + /** @var string|null $name */ protected $name = null; + /** @var string|null $css_class */ protected $css_class = null; + /** @var bool|null $read_only */ protected $read_only = null; + /** @var bool|null $disabled True if the field is supposed to be disabled */ protected $disabled = null; + /** @var array|null $storage */ private $storage = NULL; protected function __construct($label) { diff --git a/inc/accounts.php b/inc/accounts.php index 95980ab..080ec18 100644 --- a/inc/accounts.php +++ b/inc/accounts.php @@ -31,6 +31,12 @@ else { $cache = $conf['cache']; } +/** + * Create a new domain (local only) + * @param FormPage $form + * @param string $admin_mail + * @return array + */ function web_add($form, $admin_mail) { global $conf; @@ -84,6 +90,12 @@ function web_add($form, $admin_mail) { return array($exec_cmd, $exec_return, $exec_output); } +/** + * Create a new domain (cluster only) + * @param FormPage $form + * @param string $admin_mail + * @return array + */ function web_add_cluster($form, $admin_mail) { global $cache; global $conf; diff --git a/inc/common.php b/inc/common.php index 129ae90..8bb1ece 100644 --- a/inc/common.php +++ b/inc/common.php @@ -16,6 +16,12 @@ /** * Functions */ + + /** + * Check if a file exists and is readable and `die()` if it doesnt. + * @param string $file + * @return void + */ function test_exist($file) { if(!file_exists($file)) { die("Erreur, vous devez mettre en place le fichier $file !\n"); @@ -25,11 +31,20 @@ function test_exist($file) { } } +/** + * Redirect the page to $path on the same HOST + * @param string $path + * @return never + */ function http_redirect($path) { header('Location: '.$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$path); exit(0); } +/** + * @param string $filename + * @return string + */ function findexts ($filename) { $filename = strtolower($filename) ; @@ -39,15 +54,26 @@ function findexts ($filename) return $exts; } +/** + * Check if the user is a superadmin + * @return bool + */ function is_superadmin() { global $conf; if(!empty($_SESSION['user']) && in_array($_SESSION['user'], $conf['superadmin'])) { - return 1; + return true; } else { - return 0; + return false; } } +/** + * Execute a command with sudo + * @param string $cmd The command that will be executed. + * @param array $output output of the command. + * @param int $return_var return status of the command. + * @return void + */ function sudoexec($cmd, &$output, &$return_var) { global $conf; @@ -60,7 +86,8 @@ function sudoexec($cmd, &$output, &$return_var) { } /** - * Return TRUE is Evoadmin is installed in cluster mode. + * Check if Evoadmin is installed in cluster mode + * @return boolean */ function is_cluster_mode() { global $conf; @@ -68,7 +95,8 @@ function is_cluster_mode() { } /** - * Return TRUE is Evoadmin is installed in multi-cluster mode. + * Check if Evoadmin is installed in multi-cluster mode. + * @return boolean */ function is_mcluster_mode() { global $conf; @@ -77,6 +105,8 @@ function is_mcluster_mode() { /** * Load config file for the specified cluster. + * @param string $cluster + * @return void */ function load_config_cluster($cluster) { global $conf; @@ -87,8 +117,7 @@ function load_config_cluster($cluster) { } /** - * Return wether or not this evoadmin install is a multi PHP install - * + * Check if evoadmin install is a multi PHP install * @return boolean - True when it's a multi PHP system */ function is_multiphp() { @@ -97,9 +126,9 @@ function is_multiphp() { } /** - * Webadd - * - * @return boolean - True when it's a multi PHP system + * Webadd + * @param string $command webadd command to run + * @return array output from the command */ function run_webadd_cmd($command) { global $conf; @@ -127,6 +156,11 @@ if (!(ini_set('include_path', ini_get('include_path')))) { require_once 'PEAR.php'; require_once 'Log.php'; + /** + * (simply there to silence a warning) + * @var array $oriconf + * @var array $localconf + */ // config files // (here because need Log PEAR lib) test_exist('../conf/connect.php'); diff --git a/inc/ftpadmin.php b/inc/ftpadmin.php index 98d8884..983dc00 100644 --- a/inc/ftpadmin.php +++ b/inc/ftpadmin.php @@ -229,6 +229,12 @@ if ($action=="add") { $_SESSION['error']=null; $_SESSION['form']=null; +/** + * Format Byte representation in human readable format (power of 1024) + * @param float|int $bytes + * @param int|null $precision + * @return string Human formatted amount of bytes + */ function formatBytes($bytes, $precision = 2) { $bytes *= 1024; $units = array('o', 'Ko', 'Mo', 'Go', 'To'); @@ -242,7 +248,9 @@ function formatBytes($bytes, $precision = 2) { return round($bytes, $precision) . ' ' . $units[$pow]; } - +/** + * @return string[] + */ function get_owner_list() { $owner_list = array(); diff --git a/lib/bdd.php b/lib/bdd.php index 6784650..1129a78 100644 --- a/lib/bdd.php +++ b/lib/bdd.php @@ -1,7 +1,7 @@ "$name", * 'domain' => "$domain", @@ -236,7 +236,7 @@ class bdd { /** - * @desc Add an alias to the table Serveralias + * Add an alias to the table Serveralias * @param array { * 'domain' => "$domain", * 'alias' => "$alias", @@ -264,7 +264,7 @@ class bdd { } /** - * @desc Del an alias from the table Serveralias + * Delete an alias from the table Serveralias * @param array { * 'domain' => "$domain", * 'alias' => "$alias", @@ -289,7 +289,7 @@ class bdd { } /** - * @desc Get the server id of a server_name + * Get the server id of a server_name * @param string $server_name Name of the server * @return int 0 if server_name doesn't exist, * id else @@ -312,7 +312,7 @@ class bdd { } /** - * @desc Check if server_name entry exists on table Servers + * Check if server_name entry exists on table Servers * @param string $server_name Name of the server * @return int 1 if it exists, * 0 else @@ -324,7 +324,7 @@ class bdd { /** - * @desc Add an server to the table Servers + * Add an server to the table Servers * @param array { * 'name' => "$name", * } @@ -353,7 +353,7 @@ class bdd { } /** - * @desc Add a role to the table Roles + * Add a role to the table Roles * @param string $account_name * string $server_name * string $role master or slave @@ -397,7 +397,7 @@ class bdd { /** - * @desc List domains by server's role + * List domains by server's role * @param none * @return list of array * example : Array ( diff --git a/lib/domain.php b/lib/domain.php index 1e6dea7..5c189f3 100644 --- a/lib/domain.php +++ b/lib/domain.php @@ -1,5 +1,13 @@ $currentDate) ? true : false; } + /** + * Check if the requested domain is included in the certificate + * @param string $domainRequested + * @param string[]|string $san + * @return bool + */ public function isDomainIncludedInCert($domainRequested, $san) { $san = preg_replace('/DNS:| DNS:/', '', $san);