Suggested comments

This commit is contained in:
fufroma 2014-03-26 14:59:41 +01:00
parent 1c7ee90720
commit 7cd158c45c
21 changed files with 80 additions and 41 deletions

View File

@ -537,6 +537,10 @@ class m_aws {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/**
* @param integer $id
*/
function delete_allowed_login($id,$noconf=0) { function delete_allowed_login($id,$noconf=0) {
global $db,$err,$cuid; global $db,$err,$cuid;
$err->log("aws","delete_allowed_login"); $err->log("aws","delete_allowed_login");
@ -633,7 +637,6 @@ class m_aws {
/** /**
* This function is called when we are asked to compute the used quota * This function is called when we are asked to compute the used quota
* for a service * for a service
* @param integer $id The userid whose quota should be computed.
*/ */
function hook_quota_get() { function hook_quota_get() {
global $db,$err,$cuid; global $db,$err,$cuid;

View File

@ -44,6 +44,10 @@ $fields = array (
); );
getFields($fields); getFields($fields);
/**
* @param integer $pos
* @param integer $level
*/
function _subbrowse($curdir,$pos,$level) { function _subbrowse($curdir,$pos,$level) {
global $maxlevel,$root,$brlist; global $maxlevel,$root,$brlist;
if ($level>$maxlevel) if ($level>$maxlevel)

View File

@ -133,7 +133,6 @@ class system_bind {
/** /**
* *
* @param string $domain
* @return string * @return string
*/ */
function get_zone_header() { function get_zone_header() {
@ -177,7 +176,7 @@ class system_bind {
* Generate the domain DKIM key * Generate the domain DKIM key
* *
* @param string $domain * @param string $domain
* @return boolean * @return null|boolean
*/ */
function dkim_generate_key($domain) { function dkim_generate_key($domain) {
// Stop here if we do not manage the mail // Stop here if we do not manage the mail

View File

@ -51,14 +51,14 @@ class DB_Sql {
} }
/** /**
* @return the class variable Link_ID * @return resource class variable Link_ID
*/ */
function link_id() { function link_id() {
return $this->Link_ID; return $this->Link_ID;
} }
/** /**
* @return the class variable Query_ID * @return integer class variable Query_ID
*/ */
function query_id() { function query_id() {
return $this->Query_ID; return $this->Query_ID;
@ -289,6 +289,9 @@ class DB_Sql {
print $this->num_rows(); print $this->num_rows();
} }
/**
* @param string $Name
*/
function f($Name) { function f($Name) {
return $this->Record[$Name]; return $this->Record[$Name];
} }

View File

@ -104,7 +104,7 @@ function checkhostallow($domain,$dns) {
* Check that a domain can be hosted in that server, * Check that a domain can be hosted in that server,
* without DNS managment. * without DNS managment.
* @global m_mysql $db * @global m_mysql $db
* @param type $domain * @param string $domain
* @return int * @return int
*/ */
function checkhostallow_nodns($domain) { function checkhostallow_nodns($domain) {
@ -340,7 +340,7 @@ function selected($bool, $echo = TRUE) {
* @param boolean $test * @param boolean $test
* @param string $tr * @param string $tr
* @param string $fa * @param string $fa
* @param boolean $affiche * @param integer $affiche
* @return string * @return string
*/ */
function ecif($test,$tr,$fa="",$affiche=1) { function ecif($test,$tr,$fa="",$affiche=1) {
@ -381,7 +381,7 @@ function ife($test,$tr,$fa="") {
/** /**
* *
* @param int|string $size * @param int|string $size
* @param string $html * @param integer $html
* @return string * @return string
*/ */
function format_size($size,$html=0) { function format_size($size,$html=0) {
@ -512,7 +512,7 @@ function xml_entities($string) {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** Converti un nombre de mois en une chaine plus lisible /** Converti un nombre de mois en une chaine plus lisible
* @param number $months Nombre de mois * @param integer $months Nombre de mois
* @return string Cha<EFBFBD>ne repr<EFBFBD>sentant le nombre de mois * @return string Cha<EFBFBD>ne repr<EFBFBD>sentant le nombre de mois
* @access private * @access private
*/ */

View File

@ -94,7 +94,7 @@ class m_action {
* *
* @param string $dir * @param string $dir
* @param m_user $user * @param m_user $user
* @return type * @return boolean
*/ */
function fix_dir($dir, $user = "root") { function fix_dir($dir, $user = "root") {
return $this->set('fix_dir', $user, array('dir' => $dir)); return $this->set('fix_dir', $user, array('dir' => $dir));
@ -105,7 +105,7 @@ class m_action {
* *
* @param string $file * @param string $file
* @param m_user $user * @param m_user $user
* @return type * @return boolean
*/ */
function fix_file($file, $user = "root") { function fix_file($file, $user = "root") {
return $this->set('fix_file', $user, array('file' => $file)); return $this->set('fix_file', $user, array('file' => $file));
@ -116,7 +116,7 @@ class m_action {
* *
* @param string $dir * @param string $dir
* @param m_user $user * @param m_user $user
* @return type * @return boolean
*/ */
function del($dir, $user = "root") { function del($dir, $user = "root") {
return $this->set('delete', $user, array('dir' => $dir)); return $this->set('delete', $user, array('dir' => $dir));
@ -128,7 +128,7 @@ class m_action {
* @param string $src * @param string $src
* @param string $dst * @param string $dst
* @param m_user $user * @param m_user $user
* @return type * @return boolean
*/ */
function move($src, $dst, $user = "root") { function move($src, $dst, $user = "root") {
return $this->set('move', $user, array('src' => $src, 'dst' => $dst)); return $this->set('move', $user, array('src' => $src, 'dst' => $dst));
@ -304,7 +304,7 @@ class m_action {
* @global m_mysql $db * @global m_mysql $db
* @global m_err $err * @global m_err $err
* @param int $id * @param int $id
* @param type $return * @param integer $return
* @return boolean * @return boolean
*/ */
function finish($id, $return = 0) { function finish($id, $return = 0) {

View File

@ -258,7 +258,7 @@ class m_admin {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** @return TRUE if there's only ONE admin account /** @return boolean if there's only ONE admin account
* @return boolean TRUE if there is only one admin account * @return boolean TRUE if there is only one admin account
* (allow the program to prevent the destruction of the last admin account) * (allow the program to prevent the destruction of the last admin account)
*/ */
@ -363,7 +363,7 @@ class m_admin {
* @param $subject string Subject of the email to send * @param $subject string Subject of the email to send
* @param $message string Message to send * @param $message string Message to send
* @param $from string expeditor of that email. * @param $from string expeditor of that email.
* @return true if the mail has been successfully sent. * @return boolean if the mail has been successfully sent.
*/ */
function mailallmembers($subject,$message,$from) { function mailallmembers($subject,$message,$from) {
global $err,$mem,$cuid,$db; global $err,$mem,$cuid,$db;
@ -448,6 +448,10 @@ class m_admin {
} }
// When the admin want to delegate a subdomain to an account // When the admin want to delegate a subdomain to an account
/**
* @param boolean $domain_name
*/
function add_shared_domain($u, $domain_name) { function add_shared_domain($u, $domain_name) {
global $db,$err,$dom,$mem,$cuid; global $db,$err,$dom,$mem,$cuid;
$err->log("admin","add_shared_domain",$u."/".$domain_name); $err->log("admin","add_shared_domain",$u."/".$domain_name);
@ -812,7 +816,7 @@ EOF;
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** Update the duration information for an account /** Update the duration information for an account
* @param $uid integer the uid number of the account we want to update * @param $uid integer the uid number of the account we want to update
* @param $duration integer the new duration, in months, of the account * @param integer $duration integer the new duration, in months, of the account
* @return boolean Returns FALSE if an error occurs, TRUE if not. * @return boolean Returns FALSE if an error occurs, TRUE if not.
*/ */
function renew_update($uid, $duration) { function renew_update($uid, $duration) {
@ -894,7 +898,7 @@ EOF;
/** Turns a common account into a super-admin account /** Turns a common account into a super-admin account
* @param $uid integer the uid number of the common account we want to turn into a * @param $uid integer the uid number of the common account we want to turn into a
* super-admin account. * super-admin account.
* @return Returns FALSE if an error occurs, TRUE if not. * @return boolean FALSE if an error occurs, TRUE if not.
*/ */
function normal2su($uid) { function normal2su($uid) {
global $err,$db; global $err,$db;

View File

@ -586,7 +586,7 @@ class m_bro {
* @param string $file is the full or relative path to the archive * @param string $file is the full or relative path to the archive
* @param string $dest is the path of the extract destination, the * @param string $dest is the path of the extract destination, the
* same directory as the archive by default * same directory as the archive by default
* @return boolean != 0 on error * @return integer|null != 0 on error
*/ */
function ExtractFile($file, $dest=null) { function ExtractFile($file, $dest=null) {
global $err,$cuid,$mem,$action; global $err,$cuid,$mem,$action;
@ -715,7 +715,7 @@ class m_bro {
* du fichier est reformat pour pouvoir entrer dans un champs TextArea * du fichier est reformat pour pouvoir entrer dans un champs TextArea
* @param string $R Dossier dans lequel on cherche le fichier * @param string $R Dossier dans lequel on cherche le fichier
* @param string $file Fichier dont on souhaite obtenir le contenu. * @param string $file Fichier dont on souhaite obtenir le contenu.
* @return boolean retourne TRUE si le fichier a bien t mis sur * @return false|string retourne TRUE si le fichier a bien t mis sur
* echo, ou FALSE si une erreur est survenue. * echo, ou FALSE si une erreur est survenue.
*/ */
function content($R,$file) { function content($R,$file) {
@ -892,7 +892,7 @@ class m_bro {
* cras sans confirmation. * cras sans confirmation.
* @param string $R Dossier dans lequel on modifie le fichier * @param string $R Dossier dans lequel on modifie le fichier
* @param string $texte texte du fichier sauver dedans * @param string $texte texte du fichier sauver dedans
* @return boolean TRUE si tout s'est bien pass, FALSE si une erreur s'est produite. * @return false|null TRUE si tout s'est bien pass, FALSE si une erreur s'est produite.
*/ */
function save($file,$R,$texte) { function save($file,$R,$texte) {
global $err; global $err;

View File

@ -141,7 +141,7 @@ class m_hta {
/** /**
* Tells if a folder is protected. * Tells if a folder is protected.
* @param string $dir Folder to check * @param string $dir Folder to check
* @return TRUE if the folder is protected, or FALSE if it is not * @return boolean if the folder is protected, or FALSE if it is not
*/ */
function is_protected($dir){ function is_protected($dir){
global $mem,$err; global $mem,$err;
@ -221,7 +221,6 @@ class m_hta {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Add a user to a protected folder * Add a user to a protected folder
* @param string $login The user login to add
* @param string $password The password to add (cleartext) * @param string $password The password to add (cleartext)
* @param string $dir The folder we add it to (relative to user root). * @param string $dir The folder we add it to (relative to user root).
* @return boolean TRUE if the user has been added, or FALSE if an error occurred * @return boolean TRUE if the user has been added, or FALSE if an error occurred

View File

@ -157,6 +157,10 @@ class m_mail {
return $this->delete($catch['mail_id']); return $this->delete($catch['mail_id']);
} }
/**
* @param string $domain_id
* @param string $target
*/
function catchall_set($domain_id, $target) { function catchall_set($domain_id, $target) {
global $err; global $err;
// target : // target :
@ -427,7 +431,7 @@ ORDER BY
/** Hook called when the DOMAIN class will delete a domain. /** Hook called when the DOMAIN class will delete a domain.
* *
* @param $dom integer the number of the email to delete * @param $dom integer the number of the email to delete
* @return true if the email has been properly deleted * @return boolean if the email has been properly deleted
* or false if an error occured ($err is filled accordingly) * or false if an error occured ($err is filled accordingly)
*/ */
function hook_dom_del_mx_domain($dom_id) { function hook_dom_del_mx_domain($dom_id) {
@ -456,7 +460,7 @@ ORDER BY
* should be used by the web interface, not by third-party programs. * should be used by the web interface, not by third-party programs.
* *
* @param $mail_id integer the number of the email to delete * @param $mail_id integer the number of the email to delete
* @return true if the email has been properly deleted * @return boolean if the email has been properly deleted
* or false if an error occured ($err is filled accordingly) * or false if an error occured ($err is filled accordingly)
*/ */
function delete($mail_id){ function delete($mail_id){
@ -510,7 +514,7 @@ ORDER BY
* should be used by the web interface, not by third-party programs. * should be used by the web interface, not by third-party programs.
* *
* @param $mail_id integer the email id * @param $mail_id integer the email id
* @return true if the email has been properly undeleted * @return boolean if the email has been properly undeleted
* or false if an error occured ($err is filled accordingly) * or false if an error occured ($err is filled accordingly)
*/ */
function undelete($mail_id){ function undelete($mail_id){
@ -607,10 +611,10 @@ ORDER BY
* should be used by the web interface, not by third-party programs. * should be used by the web interface, not by third-party programs.
* *
* @param $mail_id integer the number of the email to delete * @param $mail_id integer the number of the email to delete
* @param $islocal boolean is it a POP/IMAP mailbox ? * @param integer $islocal boolean is it a POP/IMAP mailbox ?
* @param $quotamb integer if islocal=1, quota in MB * @param integer $quotamb integer if islocal=1, quota in MB
* @param $recipients string recipients, one mail per line. * @param $recipients string recipients, one mail per line.
* @return true if the email has been properly edited * @return boolean if the email has been properly edited
* or false if an error occured ($err is filled accordingly) * or false if an error occured ($err is filled accordingly)
*/ */
function set_details($mail_id, $islocal, $quotamb, $recipients,$delivery="dovecot",$dontcheck=false) { function set_details($mail_id, $islocal, $quotamb, $recipients,$delivery="dovecot",$dontcheck=false) {
@ -695,6 +699,8 @@ ORDER BY
* @ param : $m , the alias we want to create * @ param : $m , the alias we want to create
* @ param : $alias , the already existing aliased address * @ param : $alias , the already existing aliased address
* @ param : $type, the type of the alias created * @ param : $type, the type of the alias created
* @param string $m
* @param string $alias
*/ */
function create_alias($dom_id,$m,$alias,$type="",$dontcheck=false) { function create_alias($dom_id,$m,$alias,$type="",$dontcheck=false) {
global $err,$db,$mail; global $err,$db,$mail;

View File

@ -191,7 +191,7 @@ class m_mysql {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** Returns the details of a user's database. /** Returns the details of a user's database.
* $dbn is the name of the database (after the _) or nothing for the database "$user" * $dbn is the name of the database (after the _) or nothing for the database "$user"
* @return array returns an associative array as follow : * @return string returns an associative array as follow :
* "db" => Name of the database * "db" => Name of the database
* "bck" => Current bckup mode * "bck" => Current bckup mode
* "dir" => Backup directory * "dir" => Backup directory
@ -234,7 +234,7 @@ class m_mysql {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** Create a new database for the current user. /** Create a new database for the current user.
* @param $dbn string Database name ($user_$dbn is the mysql db name) * @param $dbn string Database name ($user_$dbn is the mysql db name)
* @return TRUE if the database $user_$db has been successfully created, or FALSE if * @return boolean if the database $user_$db has been successfully created, or FALSE if
* an error occured, such as over quota user. * an error occured, such as over quota user.
*/ */
function add_db($dbn) { function add_db($dbn) {
@ -315,7 +315,7 @@ class m_mysql {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** Delete a database for the current user. /** Delete a database for the current user.
* @param $dbn string Name of the database to delete. The db name is $user_$dbn * @param $dbn string Name of the database to delete. The db name is $user_$dbn
* @return TRUE if the database $user_$db has been successfully deleted, or FALSE if * @return boolean if the database $user_$db has been successfully deleted, or FALSE if
* an error occured, such as db does not exist. * an error occured, such as db does not exist.
*/ */
function del_db($dbn) { function del_db($dbn) {
@ -688,9 +688,9 @@ class m_mysql {
/** /**
* Create a new user in MySQL rights tables * Create a new user in MySQL rights tables
* @param $usern the username (we will add _[alternc-account] to it) * @param $usern the username (we will add _[alternc-account] to it)
* @param $password The password for this username * @param string $password The password for this username
* @param $passconf The password confirmation * @param string $passconf The password confirmation
* @return TRUE if the user has been created in MySQL or FALSE if an error occurred * @return boolean if the user has been created in MySQL or FALSE if an error occurred
**/ **/
function add_user($usern,$password,$passconf) { function add_user($usern,$password,$passconf) {
global $db,$err,$quota,$mem,$cuid,$admin; global $db,$err,$quota,$mem,$cuid,$admin;
@ -754,7 +754,7 @@ class m_mysql {
* @param $usern the username * @param $usern the username
* @param $password The password for this username * @param $password The password for this username
* @param $passconf The password confirmation * @param $passconf The password confirmation
* @return TRUE if the password has been changed in MySQL or FALSE if an error occurred * @return boolean if the password has been changed in MySQL or FALSE if an error occurred
**/ **/
function change_user_password($usern,$password,$passconf) { function change_user_password($usern,$password,$passconf) {
global $db,$err,$quota,$mem,$cuid,$admin; global $db,$err,$quota,$mem,$cuid,$admin;
@ -785,7 +785,8 @@ class m_mysql {
/** /**
* Delete a user in MySQL rights tables * Delete a user in MySQL rights tables
* @param $user the username (we will add "[alternc-account]_" to it) to delete * @param $user the username (we will add "[alternc-account]_" to it) to delete
* @return TRUE if the user has been deleted in MySQL or FALSE if an error occurred * @param integer $all
* @return boolean if the user has been deleted in MySQL or FALSE if an error occurred
**/ **/
function del_user($user,$all=null) { function del_user($user,$all=null) {
global $db,$err,$mem,$cuid; global $db,$err,$mem,$cuid;

View File

@ -154,6 +154,9 @@ class m_piwik {
else return FALSE; else return FALSE;
} }
/**
* @param string $user_login
*/
function get_user($user_login) { function get_user($user_login) {
$api_data = $this->call_privileged_page('API', 'UsersManager.getUser', array('userLogin' => $user_login)); $api_data = $this->call_privileged_page('API', 'UsersManager.getUser', array('userLogin' => $user_login));
@ -380,6 +383,10 @@ class m_piwik {
} }
/**
* @param string $module
* @param string $method
*/
function call_privileged_page($module, $method, $arguments=array(), $output = 'JSON') { function call_privileged_page($module, $method, $arguments=array(), $output = 'JSON') {
$arguments['token_auth'] = $this->piwik_admin_token; $arguments['token_auth'] = $this->piwik_admin_token;
return $this->call_page($module, $method, $arguments, $output); return $this->call_page($module, $method, $arguments, $output);

View File

@ -86,6 +86,7 @@ class m_quota {
/** Check if a user can use a ressource. /** Check if a user can use a ressource.
* @param string $ressource the ressource name (a named quota) * @param string $ressource the ressource name (a named quota)
* @Return TRUE if the user can create a ressource (= is there any quota left ?) * @Return TRUE if the user can create a ressource (= is there any quota left ?)
* @return boolean
*/ */
function cancreate($ressource="") { function cancreate($ressource="") {
$t=$this->getquota($ressource); $t=$this->getquota($ressource);

View File

@ -296,7 +296,7 @@ class m_variables {
* @param mixed $v * @param mixed $v
* @param string $varname * @param string $varname
* @param boolean $echo * @param boolean $echo
* @return type * @return string
*/ */
function display_valueraw_html($v,$varname,$echo = true) { function display_valueraw_html($v,$varname,$echo = true) {
$output = ""; $output = "";

View File

@ -1,5 +1,9 @@
<?php <?php
interface vm { interface vm {
public function start(); public function start();
/**
* @return boolean
*/
public function stop(); public function stop();
} }

View File

@ -22,6 +22,10 @@ class AutoLoader {
} }
} }
/**
* @param string $className
* @param string $fileName
*/
public static function registerClass($className, $fileName) { public static function registerClass($className, $fileName) {
AutoLoader::$classNames[$className] = $fileName; AutoLoader::$classNames[$className] = $fileName;
} }

View File

@ -17,7 +17,7 @@ abstract class AlterncTest extends PHPUnit_Extensions_Database_TestCase
/** /**
* *
* @param type $file_name * @param string $file_name
* @return \PHPUnit_Extensions_Database_DataSet_YamlDataSet * @return \PHPUnit_Extensions_Database_DataSet_YamlDataSet
* @throws \Exception * @throws \Exception
*/ */

View File

@ -69,7 +69,7 @@ class m_roundcube {
/** Hook called when an email is REALLY deleted (by the cron, not just in the panel) /** Hook called when an email is REALLY deleted (by the cron, not just in the panel)
* @param mail_id integer the ID of the mail in the AlternC database * @param mail_id integer the ID of the mail in the AlternC database
* @param fullmail string the deleted mail himself in the form of john@domain.tld * @param fullmail string the deleted mail himself in the form of john@domain.tld
* @return boolean * @return false|null
*/ */
function hook_mail_delete_for_real($mail_id, $fullmail) { function hook_mail_delete_for_real($mail_id, $fullmail) {
// Include Roundcube configuration // Include Roundcube configuration

View File

@ -69,7 +69,7 @@ class m_squirrelmail {
/** Hook called when an email is REALLY deleted (by the cron, not just in the panel) /** Hook called when an email is REALLY deleted (by the cron, not just in the panel)
* @param mail_id integer the ID of the mail in the AlternC database * @param mail_id integer the ID of the mail in the AlternC database
* @param fullmail string the deleted mail himself in the form of john@domain.tld * @param fullmail string the deleted mail himself in the form of john@domain.tld
* @return boolean * @return boolean|null
*/ */
function hook_mail_delete_for_real($mail_id, $fullmail) { function hook_mail_delete_for_real($mail_id, $fullmail) {
$fullmail2 = str_replace('@','_',$fullmail); // fullname with _ instead of @ (compatibility) $fullmail2 = str_replace('@','_',$fullmail); // fullname with _ instead of @ (compatibility)

View File

@ -2,6 +2,9 @@
<?php <?php
require_once("/usr/share/alternc/panel/class/config_nochk.php"); require_once("/usr/share/alternc/panel/class/config_nochk.php");
/**
* @param string $msg
*/
function usage($msg=null) { function usage($msg=null) {
if ($msg) { if ($msg) {
echo "Error:\n$msg"; echo "Error:\n$msg";

View File

@ -64,6 +64,7 @@ function procmail2sieve() {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** Parse ONE procmailrc, and write its sieve rules /** Parse ONE procmailrc, and write its sieve rules
* @param string $user
*/ */
function parseOneProcmail($user) { function parseOneProcmail($user) {
global $SIEVEROOT; global $SIEVEROOT;