diff --git a/bureau/class/config.php b/bureau/class/config.php
index 0bc75529..03ebdaf8 100644
--- a/bureau/class/config.php
+++ b/bureau/class/config.php
@@ -50,7 +50,7 @@ if (getenv("REMOTE_ADDR")!="127.0.0.1") {
Merci de revenir plus tard.";
exit();
}
-/* */
+
/* Toutes les pages du bureau passent ici. On utilise une s�maphore pour
s'assurer que personne ne pourra acc�der � 2 pages du bureau en m�me temps.
@@ -67,7 +67,7 @@ function alternc_shutdown() {
register_shutdown_function("alternc_shutdown");
// 4. Acquire the semaphore : with that process,
sem_acquire( $alternc_sem );
-/* */
+
if (ini_get("safe_mode")) {
echo "SAFE MODE IS ENABLED for the web panel ! It's a bug in your php or apache configuration, please fix it !!";
diff --git a/bureau/class/db_mysql.php b/bureau/class/db_mysql.php
index 81992ba2..88cebaf0 100644
--- a/bureau/class/db_mysql.php
+++ b/bureau/class/db_mysql.php
@@ -172,7 +172,7 @@ class DB_Sql {
}
if (isset($debug_alternc)) {
- $debug_alternc->add("SQL Query : (".substr($debug_chrono_start,0,5)." ms)\t $Query_String");
+ $debug_alternc->add("SQL Query : (".substr($debug_chrono_start,0,5)." ms) $Query_String");
$debug_alternc->nb_sql_query++;
$debug_alternc->tps_sql_query += $debug_chrono_start;
}
diff --git a/bureau/class/functions.php b/bureau/class/functions.php
index 892061b2..aaafe7c9 100644
--- a/bureau/class/functions.php
+++ b/bureau/class/functions.php
@@ -476,7 +476,7 @@ function ssla($str) {
}
}
- /* ----------------------------------------------------------------- */
+
/** Hashe un mot de passe en clair en MD5 avec un salt al�atoire
* @param string $pass Mot de passe � crypter (max 32 caract�res)
* @return string Retourne le mot de passe crypt�
@@ -504,7 +504,7 @@ function split_mysql_database_name($dbname) {
}
-/* ----------------------------------------------------------------- */
+
/** Echappe les caract�res pouvant perturber un flux XML standard :
* @param string $string Chaine de caract�re � encoder en valeur xml.
* @return string Retourne la cha�ne modifi�e si besoin.
@@ -514,7 +514,7 @@ function xml_entities($string) {
return str_replace("<","<",str_replace(">",">",str_replace("&","&",$string)));
}
-/* ----------------------------------------------------------------- */
+
/** Converti un nombre de mois en une chaine plus lisible
* @param integer $months Nombre de mois
* @return string Cha�ne repr�sentant le nombre de mois
@@ -529,7 +529,7 @@ function pretty_months($months) {
}
}
-/* ----------------------------------------------------------------- */
+
/** Fabrique un drop-down pour les dur�es de comptes
* @name string $name Nom pour le composasnt
* @selected number Option selection�e du composant
diff --git a/bureau/class/m_action.php b/bureau/class/m_action.php
index a1bec46d..77a47b17 100644
--- a/bureau/class/m_action.php
+++ b/bureau/class/m_action.php
@@ -31,7 +31,7 @@
*
*/
class m_action {
- /* --------------------------------------------------------------------------- */
+
/**
* Constructor
@@ -222,7 +222,7 @@ class m_action {
* This seems to be unused ?
*
* @global m_err $err
- * @global m_mysql $db
+ * @global m_mysql $db
* @return boolean
*/
function get_old() {
diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php
index 9f3f1c73..6f38641d 100644
--- a/bureau/class/m_admin.php
+++ b/bureau/class/m_admin.php
@@ -23,7 +23,7 @@
----------------------------------------------------------------------
*/
-/* ----------------------------------------------------------------- */
+
/**
* Manage the AlternC's account administration (create/edit/delete)
@@ -31,12 +31,12 @@
class m_admin {
- /* ----------------------------------------------------------------- */
+
/** $enabled tells if the logged user is super-admin or not
*/
var $enabled=0;
- /* ----------------------------------------------------------------- */
+
/** List of the controls made for each TLD
*
* $tldmode is used by the administration panel, while choosing
@@ -505,7 +505,7 @@ class m_admin {
* When the admin want to delegate a subdomain to an account
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @global m_dom $dom
* @global m_mem $mem
* @global int $cuid
@@ -541,7 +541,7 @@ class m_admin {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Creates a new hosted account
*
* Creates a new hosted account (in the tables membres
@@ -549,7 +549,7 @@ class m_admin {
* the account $mid is not super-admin.
*
*
- * @global m_err $err
+ * @global m_err $err
* @global m_quota $quota
* @global array $classes
* @global int $cuid
@@ -668,7 +668,7 @@ class m_admin {
* AlternC's standard function called when a user is created
* This sends an email if configured through the interface.
*
- * @global m_err $err
+ * @global m_err $err
* @global int $cuid
* @global string $L_FQDN
* @global string $L_HOSTING
@@ -731,7 +731,7 @@ EOF;
* and local
). Prevents any manipulation of the account if
* the account $mid is not super-admin.
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @global int $cuid
* @global m_quota $quota
@@ -790,7 +790,7 @@ EOF;
*
* Lock an account and prevent the user to access its account.
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @return boolean Returns FALSE if an error occurs, TRUE if not.
@@ -819,7 +819,7 @@ EOF;
* UnLock an account and prevent the user to access its account.
*
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @return boolean Returns FALSE if an error occurs, TRUE if not.
@@ -842,12 +842,12 @@ EOF;
}
- /* ----------------------------------------------------------------- */
+
/** Deletes an account
* Deletes the specified account. Prevents any manipulation of the account if
* the account $mid is not super-admin.
*
- * @global m_err $err
+ * @global m_err $err
* @global m_quota $quota
* @global array $classes
* @global int $cuid
@@ -901,7 +901,7 @@ EOF;
*
* Renew an account for its duration
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @param int $periods The new duration, in months, of the account
@@ -927,7 +927,7 @@ EOF;
/**
* Update the duration information for an account
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @param int $duration The new duration, in months, of the account
@@ -965,7 +965,7 @@ EOF;
}
- /* ----------------------------------------------------------------- */
+
/**
* Get the expiry status for an account
*
@@ -1016,7 +1016,7 @@ EOF;
/**
* Turns a common account into a super-admin account
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @return boolean
@@ -1040,7 +1040,7 @@ EOF;
/**
* Turns a super-admin account into a common account
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mysql $db
* @param int $uid The uid number of the account
* @return boolean Returns FALSE if an error occurs, TRUE if not.
@@ -1208,7 +1208,7 @@ EOF;
* from its account
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $domain Domain name to lock / unlock
* @return boolean TRUE if the domain has been locked/unlocked or FALSE if it does not exist.
*/
@@ -1228,7 +1228,7 @@ EOF;
* Add a new TLD to the list of the authorized TLDs
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $tld top-level domain to add (org, com...)
* @return boolean TRUE if the tld has been successfully added, FALSE if not.
*/
@@ -1263,7 +1263,7 @@ EOF;
* on this TLD
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $tld The TLD you want to delete
* @return boolean returns true if the TLD has been deleted, or
* false if an error occured.
@@ -1280,7 +1280,7 @@ EOF;
}
- /* ----------------------------------------------------------------- */
+
/** Add a TLD to the list of the authorized TLDs during the installation
*
* Note: If you check in the whois, be sure that
@@ -1288,7 +1288,7 @@ EOF;
* domain!
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $tld string TLD we want to authorize
* @param boolean $mode Controls to make on this TLD.
* @return boolean TRUE if the TLD has been successfully
@@ -1319,7 +1319,7 @@ EOF;
* Modify a TLD of the list of the authorized TLDs
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $tld TLD we want to modify
* @param int $mode Controls to make on this TLD.
* @return boolean TRUE if the TLD has been successfully
@@ -1371,16 +1371,6 @@ EOF;
while ($db->next_record()) {
$tmp1[$db->Record["name"]]=$db->Record;
}
-/* * /
- foreach($classes as $c) {
- if (method_exists($GLOBALS[$c],"alternc_password_policy")) {
- $res=$GLOBALS[$c]->alternc_password_policy(); // returns an array
- foreach($res as $k=>$v) {
- $tmp2[$k]=$v;
- }
- }
- }
-/* */
$tmp3=$hooks->invoke("alternc_password_policy");
foreach ($tmp3 as $v) {
foreach ($v as $l=>$m) {
@@ -1441,7 +1431,7 @@ EOF;
/**
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @param string $policy Name of the policy to check for
* @param string $login The login that will be set
* @param string $password The password we have to check
diff --git a/bureau/class/m_authip.php b/bureau/class/m_authip.php
index d8de563e..7dc7295b 100644
--- a/bureau/class/m_authip.php
+++ b/bureau/class/m_authip.php
@@ -355,7 +355,7 @@ class m_authip {
* affectationt ip<=>ressource dont l'id est en parametre
*
* @global m_hooks $hooks
- * @global m_err $err
+ * @global m_err $err
* @param string $function Nom de la fonction a rechercher et appeller dans les classes
* @param integer $affectation_id Id de l'affectation correspondante
* @return boolean Retourne TRUE
diff --git a/bureau/class/m_bro.php b/bureau/class/m_bro.php
index 8835a695..d8309a4b 100644
--- a/bureau/class/m_bro.php
+++ b/bureau/class/m_bro.php
@@ -192,7 +192,7 @@ class m_bro {
*
* @global m_mysql $db
* @global int $cuid
- * @global m_err $err
+ * @global m_err $err
* @param string $dir Dossier relatif au dossier racine du compte du membre courant
* @param boolean $showdirsize
* @return array Le tableau contenant les fichiers de $dir, et
@@ -387,7 +387,7 @@ class m_bro {
*
* @global m_mysql $db
* @global int $cuid
- * @global m_err $err
+ * @global m_err $err
* @param string $dir Dossier dans lequel on veut crer un sous-dossier
* @param string $file Nom du dossier à créer
* @return boolean TRUE si le dossier a été créé, FALSE si une erreur s'est produite.
@@ -415,7 +415,7 @@ class m_bro {
* Crée un fichier vide dans un dossier
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @global int $cuid
* @param string $dir Dossier dans lequel on veut crer un sous-dossier
* @param string $file Nom du dossier à créer
@@ -443,7 +443,7 @@ class m_bro {
/**
* Efface les fichiers du tableau $file_list dans le dossier $R
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mem $mem
* @param array $file_list Liste des fichiers effacer.
* @param string $R Dossier dans lequel on efface les fichiers
@@ -470,7 +470,7 @@ class m_bro {
/**
* Renomme les fichier de $old du dossier $R en $new
*
- * @global m_err $err
+ * @global m_err $err
* @param string $R Dossier dans lequel se trouve les fichiers renommer.
* @param array $old Ancien nom des fichiers
* @param array $new Nouveau nom des fichiers
@@ -504,7 +504,7 @@ class m_bro {
/**
* Déplace les fichier de $d du dossier $old vers $new
*
- * @global m_err $err
+ * @global m_err $err
* @param array $d Liste des fichiers du dossier $old dplacer
* @param string $old Dossier dans lequel se trouve les fichiers dplacer.
* @param string $new Dossier vers lequel seront dplacs les fichiers.
@@ -545,7 +545,7 @@ class m_bro {
/**
* Change les droits d'acces aux fichier de $d du dossier $R en $p
*
- * @global m_err $err
+ * @global m_err $err
* @param string $R Dossier dans lequel se trouve les fichiers renommer.
* @param boolean $verbose Shall we 'echo' what we did ?
* @return boolean TRUE Si les fichiers ont t renomms, FALSE si une erreur s'est produite.
@@ -587,7 +587,7 @@ class m_bro {
*
*
* @global array $_FILES
- * @global m_err $err
+ * @global m_err $err
* @global int $cuid
* @global m_action $action
* @param string $R Dossier dans lequel on upload le fichier
@@ -640,7 +640,7 @@ class m_bro {
/**
* Extract an archive by using GNU and non-GNU tools
*
- * @global m_err $err
+ * @global m_err $err
* @global int $cuid
* @global m_mem $mem
* @global m_action $action
@@ -692,7 +692,7 @@ class m_bro {
/**
* Copy many files from point A to point B
*
- * @global m_err $err
+ * @global m_err $err
* @param array $d List of files to move
* @param string $old
* @param string $new
@@ -731,7 +731,7 @@ class m_bro {
*
* Note that we assume that the inputs have been convertabsolute()'d
*
- * @global m_err $err
+ * @global m_err $err
* @param string $src Path or URL
* @param string $dest Absolute path inside the users directory
* @return boolean false on error
@@ -785,7 +785,7 @@ class m_bro {
* Affiche le contenu du fichier $file dans le dossier $R. Le contenu
* du fichier est reformat pour pouvoir entrer dans un champs TextArea
*
- * @global m_err $err
+ * @global m_err $err
* @param string $R Dossier dans lequel on cherche le fichier
* @param string $file Fichier dont on souhaite obtenir le contenu.
* @return string|false TRUE si le fichier a bien été mis sur
@@ -868,7 +868,7 @@ class m_bro {
/**
*
* @global m_mem $mem
- * @global m_err $err
+ * @global m_err $err
* @param string $dir
* @param string $name
* @return null|boolean
@@ -939,7 +939,7 @@ class m_bro {
/**
*
- * @global m_err $err
+ * @global m_err $err
* @param string $dir
* @param string $file
*/
@@ -956,7 +956,7 @@ class m_bro {
/**
* Echoes the content of the file $file located in directory $R
*
- * @global m_err $err
+ * @global m_err $err
* @param string $R
* @param string $file
* @return null|false
@@ -981,7 +981,7 @@ class m_bro {
* le contenu est issu d'un textarea, et ne DOIT PAS contenir de \ ajouts
* automatiquement par addslashes
*
- * @global m_err $err
+ * @global m_err $err
* @param string $file Nom du fichier sauver. S'il existe déjà , il sera
* écrasé sans confirmation.
* @param string $R Dossier dans lequel on modifie le fichier
@@ -1124,7 +1124,7 @@ class m_bro {
* Produit en sorti un tableau formatté ( pour le moment) en HTML
*
* @global m_mysql $db
- * @global m_err $err
+ * @global m_err $err
* @return string
*/
function alternc_export_conf() {
@@ -1151,7 +1151,7 @@ class m_bro {
* Function d'exportation des données appelé par la classe m_export via un hooks
*
* @global m_mem $mem
- * @global m_err $err
+ * @global m_err $err
* @param string $dir Le chemin destination du tarball produit
* @return boolean|null
*/
diff --git a/bureau/class/m_cron.php b/bureau/class/m_cron.php
index 3a0f2eb6..3765ce6a 100644
--- a/bureau/class/m_cron.php
+++ b/bureau/class/m_cron.php
@@ -29,12 +29,18 @@
class m_cron {
- /*---------------------------------------------------------------------------*/
/** Constructor
*/
+ /**
+ *
+ */
function m_cron() {
}
+ /**
+ *
+ * @return type
+ */
function schedule() {
return Array(
Array('unit'=>1440, 'name'=>_("Daily")),
@@ -44,10 +50,16 @@ class m_cron {
}
- /*---------------------------------------------------------------------------*/
/** List the crontab for the current user.
* @return array an hash for each crontab.
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function lst_cron() {
global $cuid,$db,$err;
$err->log("cron","lst_cron");
@@ -67,6 +79,10 @@ class m_cron {
return $r;
}
+ /**
+ *
+ * @return int
+ */
function hook_menu() {
$obj = array(
'title' => _("Scheduled tasks"),
@@ -78,11 +94,15 @@ class m_cron {
return $obj;
}
- /*---------------------------------------------------------------------------*/
/** update the crontab
* @param $arr array the crontab information, including its ID
* @return boolean TRUE if the crontab has been edited
*/
+ /**
+ *
+ * @param type $arr
+ * @return boolean
+ */
function update($arr) {
$ok=true;
foreach ($arr as $a) {
@@ -96,11 +116,18 @@ class m_cron {
}
- /*---------------------------------------------------------------------------*/
/** delete a crontab
* @param $id the id of the crontab to delete
* @return boolean TRUE if the crontab has been deleted
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $id
+ * @return type
+ */
function delete_one($id) {
global $db,$err,$cuid;
$err->log("cron","delete_one");
@@ -108,10 +135,23 @@ class m_cron {
}
- /*---------------------------------------------------------------------------*/
/** update a crontab,
* @return boolean TRUE if the crontab has been edited
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global m_mem $mem
+ * @param type $url
+ * @param type $user
+ * @param type $password
+ * @param type $email
+ * @param type $schedule
+ * @param type $id
+ * @return boolean|string
+ */
private function _update_one($url, $user, $password, $email, $schedule, $id=null) {
global $db,$err,$quota,$cuid;
$err->log("cron","update_one");
@@ -159,11 +199,15 @@ class m_cron {
}
- /*---------------------------------------------------------------------------*/
/** validate a crontab schedule
* @param $s array schedule paramters
* @return boolean TRUE if the schedule is valid
*/
+ /**
+ *
+ * @param type $s
+ * @return boolean
+ */
function valid_schedule($s) {
$s2 = intval($s);
if ($s2 != $s) return false;
@@ -174,9 +218,15 @@ class m_cron {
return $r;
}
- /*---------------------------------------------------------------------------*/
/** hook for quota computation
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function hook_quota_get() {
global $cuid,$db,$err;
$err->log("cron","alternc_get_quota");
diff --git a/bureau/class/m_crypto.php b/bureau/class/m_crypto.php
index 2fc844bc..adef79db 100644
--- a/bureau/class/m_crypto.php
+++ b/bureau/class/m_crypto.php
@@ -1,44 +1,46 @@
status=true;
- ini_set('display_errors', '1');
+ var $infos = "";
+ var $status = false;
+ var $nb_sql_query = 0;
+ var $tps_sql_query = 0;
+ var $generation_started = null;
+
+ /** Constructor
+ */
+
+ /**
+ *
+ */
+ function m_debug_alternc() {
+ if (isset($_COOKIE['alternc_debugme']) && $_COOKIE['alternc_debugme']) {
+ $this->status = true;
+ ini_set('display_errors', '1');
+ }
+ $this->nb_sql_query = 0;
+ $this->tps_sql_query = 0;
+ $this->generation_started = microtime(true);
}
- $this->nb_sql_query=0;
- $this->tps_sql_query=0;
- $this->generation_started=microtime(true);
- }
- function activate() {
- setcookie('alternc_debugme','1', time()+3600); // expire in 1 hour
- $this->status="";
- return true;
- }
+ /**
+ *
+ * @return boolean
+ */
+ function activate() {
+ setcookie('alternc_debugme', '1', time() + 3600); // expire in 1 hour
+ $this->status = "";
+ return true;
+ }
- function desactivate() {
- setcookie('alternc_debugme','0');
- $this->status=false;
- return true;
- }
+ /**
+ *
+ * @return boolean
+ */
+ function desactivate() {
+ setcookie('alternc_debugme', '0');
+ $this->status = false;
+ return true;
+ }
- function add($txt) {
- $this->infos .= "\n$txt";
- return true;
- }
+ /**
+ *
+ * @param type $txt
+ * @return boolean
+ */
+ function add($txt) {
+ $this->infos .= "\n$txt";
+ return true;
+ }
- function dump() {
- global $cuid;
- if ( $cuid!=2000 ) return false;
- if ( ! $this->status ) return false;
+ /**
+ *
+ * @global m_mem $mem
+ * @return boolean
+ */
+ function dump() {
+ global $cuid;
+ if ($cuid != 2000)
+ return false;
+ if (!$this->status)
+ return false;
- $generation_time = (microtime(true) - $this->generation_started) * 1000;
+ $generation_time = (microtime(true) - $this->generation_started) * 1000;
- echo "
";
- return true;
- }
+ echo "";
+ return true;
+ }
-} /* Class debug_alternc */
+}
-?>
+/* Class debug_alternc */
\ No newline at end of file
diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php
index 6dcc8283..8327651d 100644
--- a/bureau/class/m_dom.php
+++ b/bureau/class/m_dom.php
@@ -79,16 +79,25 @@ class m_dom {
var $tld_no_check_at_all = "1";
var $cache_domains_type_lst = false;
- /* ----------------------------------------------------------------- */
+
/**
* Constructeur
*/
+ /**
+ *
+ */
function m_dom() {
$this->tld_no_check_at_all = variable_get('tld_no_check_at_all', 0, 'Disable ALL check on the TLD (users will be able to add any domain)', array('desc' => 'Disabled', 'type' => 'boolean'));
variable_get('mailname_bounce', '%%FQDN%%', 'FQDN of the mail server, used to create vhost virtual mail_adress.', array('desc' => 'FQDN', 'type' => 'string'));
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function get_panel_url_list() {
global $db, $err;
$err->log("dom", "get_panel_url_list");
@@ -103,6 +112,9 @@ class m_dom {
/**
* @param string $fqdn
*/
+ /**
+ *
+ */
function get_sub_domain_id_and_member_by_name($fqdn) {
global $db, $err, $cuid;
$err->log("dom", "get_sub_domain_by_name");
@@ -113,6 +125,9 @@ class m_dom {
return array('sub_id' => intval($db->f('id')), 'member_id' => intval($db->f('compte')));
}
+ /**
+ *
+ */
function hook_menu() {
global $quota;
$obj = array(
@@ -143,7 +158,6 @@ class m_dom {
return $obj;
}
- /* ----------------------------------------------------------------- */
/**
* Retourne un tableau contenant les types de domaines
@@ -151,6 +165,12 @@ class m_dom {
* @return array retourne un tableau indexé contenant la liste types de domaines
* authorisé. Retourne FALSE si une erreur s'est produite.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function domains_type_lst() {
global $db, $err;
$err->log("dom", "domains_type_lst");
@@ -164,6 +184,13 @@ class m_dom {
return $this->cache_domains_type_lst;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return type
+ */
function domains_type_enable_values() {
global $db, $err, $cuid;
$err->log("dom", "domains_type_target_values");
@@ -183,6 +210,14 @@ class m_dom {
/**
* @param integer $type
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $type
+ * @return boolean
+ */
function domains_type_target_values($type = null) {
global $db, $err, $cuid;
$err->log("dom", "domains_type_target_values");
@@ -206,6 +241,15 @@ class m_dom {
}
}
+ /**
+ *
+ * @global m_err $err
+ * @param type $zone
+ * @param type $domain
+ * @param type $detect_redirect
+ * @param type $save
+ * @return boolean
+ */
function import_manual_dns_zone($zone, $domain, $detect_redirect = true, $save = false) {
global $err;
if ($save) {
@@ -228,6 +272,9 @@ class m_dom {
/**
* @param string $zone
*/
+ /**
+ *
+ */
function import_manual_dns_entry($zone, $domain, $detect_redirect = true, $save = false) {
global $cuid, $err;
$err->log("dom", "import_manual_dns_entry");
@@ -405,7 +452,7 @@ class m_dom {
return $val;
}
-
+
private function import_manual_dns_entry_doit($entry) {
global $err;
$entry['did_it'] = 0;
@@ -477,7 +524,13 @@ class m_dom {
/**
* @param string $url
*/
+ /**
+ *
+ * @param type $url
+ * @return boolean
+ */
function is_it_a_redirect($url) {
+
try {
$params = array('http' => array(
'method' => 'HEAD',
@@ -517,6 +570,14 @@ class m_dom {
}
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $name
+ * @return boolean
+ */
function domains_type_regenerate($name) {
global $db, $err, $cuid;
$name = mysql_real_escape_string($name);
@@ -525,6 +586,14 @@ class m_dom {
return true;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $name
+ * @return type
+ */
function domains_type_get($name) {
global $db, $err, $cuid;
$name = mysql_real_escape_string($name);
@@ -533,6 +602,14 @@ class m_dom {
return $db->Record;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $name
+ * @return boolean
+ */
function domains_type_del($name) {
global $db, $err, $cuid;
$name = mysql_real_escape_string($name);
@@ -540,6 +617,24 @@ class m_dom {
return true;
}
+ /**
+ *
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @param type $name
+ * @param type $description
+ * @param type $target
+ * @param type $entry
+ * @param type $compatibility
+ * @param type $enable
+ * @param type $only_dns
+ * @param type $need_dns
+ * @param type $advanced
+ * @param type $create_tmpdir
+ * @param type $create_targetdir
+ * @return boolean
+ */
function domains_type_update($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns, $advanced, $create_tmpdir, $create_targetdir) {
global $err, $cuid, $db;
// The name MUST contain only letter and digits, it's an identifier after all ...
@@ -562,6 +657,15 @@ class m_dom {
return true;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sub_id
+ * @param type $status
+ * @return boolean
+ */
function sub_domain_change_status($sub_id, $status) {
global $db, $err, $cuid;
$err->log("dom", "sub_domain_change_status");
@@ -584,7 +688,7 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/**
* Retourne un tableau contenant les domaines d'un membre.
@@ -594,6 +698,14 @@ class m_dom {
* domaines hébergés sur le compte courant. Retourne FALSE si une
* erreur s'est produite.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $uid
+ * @return type
+ */
function enum_domains($uid = -1) {
global $db, $err, $cuid;
$err->log("dom", "enum_domains");
@@ -610,6 +722,15 @@ class m_dom {
return $this->domains;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global array $classes
+ * @global m_mem $mem
+ * @param type $dom
+ * @return boolean
+ */
function del_domain_cancel($dom) {
global $db, $err, $classes, $cuid;
$err->log("dom", "del_domaini_canl", $dom);
@@ -622,7 +743,7 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/**
* Efface un domaine du membre courant, et tous ses sous-domaines
@@ -635,6 +756,16 @@ class m_dom {
* @param string $dom nom de domaine é effacer
* @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global array $classes
+ * @global m_mem $mem
+ * @global m_hooks $hooks
+ * @param type $dom
+ * @return boolean
+ */
function del_domain($dom) {
global $db, $err, $classes, $cuid, $hooks;
$err->log("dom", "del_domain", $dom);
@@ -661,11 +792,17 @@ class m_dom {
return true;
}
+ /**
+ *
+ * @param type $dom
+ * @param type $sub
+ * @return type
+ */
function domshort($dom, $sub = "") {
return str_replace("-", "", str_replace(".", "", empty($sub) ? "" : "$sub.") . $dom);
}
- /* ----------------------------------------------------------------- */
+
/**
* Installe un domaine sur le compte courant.
@@ -686,6 +823,26 @@ class m_dom {
* force ne devrait étre utilisé que par le super-admin.
$ @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global array $classes
+ * @global string $L_MX
+ * @global string $L_FQDN
+ * @global array $tld
+ * @global m_mem $mem
+ * @global m_bro $bro
+ * @global m_hooks $hooks
+ * @param type $domain
+ * @param type $dns
+ * @param type $noerase
+ * @param type $force
+ * @param type $isslave
+ * @param type $slavedom
+ * @return boolean
+ */
function add_domain($domain, $dns, $noerase = false, $force = false, $isslave = false, $slavedom = "") {
global $db, $err, $quota, $classes, $L_MX, $L_FQDN, $tld, $cuid, $bro, $hooks;
$err->log("dom", "add_domain", $domain);
@@ -807,6 +964,13 @@ class m_dom {
/**
* @param string $domain
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $domain
+ * @param type $target_domain
+ */
function create_default_subdomains($domain, $target_domain = "") {
global $db, $err;
$err->log("dom", "create_default_subdomains", $domain);
@@ -831,6 +995,13 @@ class m_dom {
/**
* @param string $domain
*/
+ /**
+ *
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @param type $domain
+ * @return type
+ */
function domdefaultdir($domain) {
global $bro, $cuid;
$dest_root = $bro->get_userid_root($cuid);
@@ -838,11 +1009,23 @@ class m_dom {
return "/www/" . $this->domshort($domain);
}
+ /**
+ *
+ * @param type $domain
+ * @param type $ns
+ * @return type
+ */
function dump_axfr($domain, $ns = 'localhost') {
exec('/usr/bin/dig AXFR "' . escapeshellcmd($domain) . '" @"' . escapeshellcmd($ns) . '"', $axfr);
return $axfr;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function lst_default_subdomains() {
global $db, $err;
$err->log("dom", "lst_default_subdomains");
@@ -862,6 +1045,12 @@ class m_dom {
return $c;
}
+ /**
+ *
+ * @global m_err $err
+ * @param type $arr
+ * @return boolean
+ */
function update_default_subdomains($arr) {
global $err;
$err->log("dom", "update_default_subdomains");
@@ -881,6 +1070,18 @@ class m_dom {
return $ok;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $domain_type
+ * @param type $sub
+ * @param type $domain_type_parameter
+ * @param type $concerned
+ * @param type $enabled
+ * @param type $id
+ * @return boolean
+ */
function update_one_default($domain_type, $sub, $domain_type_parameter, $concerned, $enabled, $id = null) {
global $db, $err;
$err->log("dom", "update_one_default");
@@ -893,6 +1094,13 @@ class m_dom {
//update
}
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @param type $id
+ * @return boolean
+ */
function del_default_type($id) {
global $err, $db;
$err->log("dom", "del_default_type");
@@ -905,7 +1113,7 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/**
* Retourne les entrées DNS du domaine $domain issues du WHOIS.
@@ -921,6 +1129,13 @@ class m_dom {
* du domaine demandé. Retourne FALSE si une erreur s'est produite.
*
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $domain
+ * @return boolean
+ */
function whois($domain) {
global $db, $err;
$err->log("dom", "whois", $domain);
@@ -1067,7 +1282,7 @@ class m_dom {
// whois
- /* ----------------------------------------------------------------- */
+
/**
* vérifie la presence d'un champs mx valide sur un serveur DNS
@@ -1077,6 +1292,14 @@ class m_dom {
*
* @param string $domaine
*/
+ /**
+ *
+ * @global string $L_DEFAULT_MX
+ * @global string $L_DEFAULT_SECONDARY_MX
+ * @param type $domaine
+ * @param type $ref_domain
+ * @return int
+ */
function checkmx($domaine, $ref_domain = '') {
global $L_DEFAULT_MX, $L_DEFAULT_SECONDARY_MX;
@@ -1115,7 +1338,7 @@ class m_dom {
//checkmx
- /* ----------------------------------------------------------------- */
+
/**
* retourne TOUTES les infos d'un domaine
@@ -1136,6 +1359,14 @@ class m_dom {
* Retourne FALSE si une erreur s'est produite.
*
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $dom
+ * @return boolean|string
+ */
function get_domain_all($dom) {
global $db, $err, $cuid;
$err->log("dom", "get_domain_all", $dom);
@@ -1193,7 +1424,7 @@ class m_dom {
// get_domain_all
- /* ----------------------------------------------------------------- */
+
/**
* Retourne TOUTES les infos d'un sous domaine du compte courant.
@@ -1207,6 +1438,14 @@ class m_dom {
* $r["type"]= Type (0-n) de la redirection.
* Retourne FALSE si une erreur s'est produite.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sub_domain_id
+ * @return boolean
+ */
function get_sub_domain_all($sub_domain_id) {
global $db, $err, $cuid;
$err->log("dom", "get_sub_domain_all", $sub_domain_id);
@@ -1241,6 +1480,15 @@ class m_dom {
* @param integer $type
* @param string $value
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $type
+ * @param string $value
+ * @return boolean
+ */
function check_type_value($type, $value) {
global $db, $err, $cuid;
@@ -1314,7 +1562,7 @@ class m_dom {
//check_type_value
- /* ----------------------------------------------------------------- */
+
/**
* Check the compatibility of the POSTed parameters with the chosen
@@ -1324,6 +1572,17 @@ class m_dom {
* @param string $sub SUBdomain
* @return boolean tell you if the subdomain can be installed there
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $dom
+ * @param type $sub
+ * @param type $type
+ * @param type $sub_domain_id
+ * @return boolean
+ */
function can_create_subdomain($dom, $sub, $type, $sub_domain_id = 'null') {
global $db, $err, $cuid;
$err->log("dom", "can_create_subdomain", $dom . "/" . $sub);
@@ -1347,7 +1606,7 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/**
* Modifier les information du sous-domaine demandé.
@@ -1362,6 +1621,19 @@ class m_dom {
* de $type (url, ip, dossier...)
* @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_bro $bro
+ * @param type $dom
+ * @param type $sub
+ * @param type $type
+ * @param type $dest
+ * @param type $sub_domain_id
+ * @return boolean
+ */
function set_sub_domain($dom, $sub, $type, $dest, $sub_domain_id = null) {
global $db, $err, $cuid, $bro;
$err->log("dom", "set_sub_domain", $dom . "/" . $sub . "/" . $type . "/" . $dest);
@@ -1444,7 +1716,7 @@ class m_dom {
// set_sub_domain
- /* ----------------------------------------------------------------- */
+
/**
* Supprime le sous-domaine demandé
@@ -1452,6 +1724,14 @@ class m_dom {
* @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sub_domain_id
+ * @return boolean
+ */
function del_sub_domain($sub_domain_id) {
global $db, $err, $cuid;
$err->log("dom", "del_sub_domain", $sub_domain_id);
@@ -1475,6 +1755,13 @@ class m_dom {
/**
* @param integer $dom_id
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $dom_id
+ * @param type $ttl
+ * @return type
+ */
function set_ttl($dom_id, $ttl) {
global $err;
$err->log("dom", "set_ttl", "$dom_id / $ttl");
@@ -1487,7 +1774,7 @@ class m_dom {
return $j;
}
- /* ----------------------------------------------------------------- */
+
/**
* Modifie les information du domaine précisé.
@@ -1501,6 +1788,21 @@ class m_dom {
* TRUE sinon.
*
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global string $L_MX
+ * @global array $classes
+ * @global m_mem $mem
+ * @global m_hooks $hooks
+ * @param type $dom
+ * @param string $dns
+ * @param type $gesmx
+ * @param type $force
+ * @param int $ttl
+ * @return boolean
+ */
function edit_domain($dom, $dns, $gesmx, $force = false, $ttl = 86400) {
global $db, $err, $L_MX, $classes, $cuid, $hooks;
$err->log("dom", "edit_domain", $dom . "/" . $dns . "/" . $gesmx);
@@ -1584,11 +1886,17 @@ class m_dom {
/* * ************************* */
- /* ----------------------------------------------------------------- */
+
/** Return the list of ip addresses and classes that are allowed access to domain list
* through AXFR Transfers from the bind server.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function enum_slave_ip() {
global $db, $err;
$db->query("SELECT * FROM slaveip;");
@@ -1602,10 +1910,18 @@ class m_dom {
return $res;
}
- /* ----------------------------------------------------------------- */
+
/** Add an ip address (or a ip class) to the list of allowed slave ip access list.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $ip
+ * @param type $class
+ * @return boolean
+ */
function add_slave_ip($ip, $class = "32") {
global $db, $err;
if (!checkip($ip)) {
@@ -1627,10 +1943,17 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Remove an ip address (or a ip class) from the list of allowed slave ip access list.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $ip
+ * @return boolean
+ */
function del_slave_ip($ip) {
global $db, $err;
if (!checkip($ip)) {
@@ -1644,10 +1967,18 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Check for a slave account
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @param type $pass
+ * @return boolean
+ */
function check_slave_account($login, $pass) {
global $db, $err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login' AND pass='$pass';");
@@ -1657,10 +1988,17 @@ class m_dom {
return false;
}
- /* ----------------------------------------------------------------- */
+
/** Out (echo) the complete hosted domain list :
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $integrity
+ * @return boolean
+ */
function echo_domain_list($integrity = false) {
global $db, $err;
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 ORDER BY domaine");
@@ -1676,10 +2014,17 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Returns the complete hosted domain list :
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $uid
+ * @return type
+ */
function get_domain_list($uid = -1) {
global $db, $err;
$uid = intval($uid);
@@ -1699,6 +2044,12 @@ class m_dom {
*
* @return array
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function get_domain_all_summary() {
global $db, $err;
$res = array();
@@ -1714,12 +2065,20 @@ class m_dom {
return $res;
}
- /* ----------------------------------------------------------------- */
+
/** Returns the name of a domain for the current user, from it's domain_id
* @param $dom_id integer the domain_id to search for
* @return string the domain name, or false with an error raised.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $dom_id
+ * @return boolean
+ */
function get_domain_byid($dom_id) {
global $db, $err, $cuid;
$dom_id = intval($dom_id);
@@ -1738,12 +2097,20 @@ class m_dom {
}
}
- /* ----------------------------------------------------------------- */
+
/** Returns the id of a domain for the current user, from it's domain name
* @param $domain string the domain name to search for
* @return integer the domain id, or false with an error raised.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $domain
+ * @return boolean
+ */
function get_domain_byname($domain) {
global $db, $err, $cuid;
$domain = trim($domain);
@@ -1762,10 +2129,17 @@ class m_dom {
}
}
- /* ----------------------------------------------------------------- */
+
/** Count all domains, for all users
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return int
+ */
function count_domains_all() {
global $db, $err, $cuid;
$db->query("SELECT COUNT(*) AS count FROM domaines;");
@@ -1776,10 +2150,16 @@ class m_dom {
}
}
- /* ----------------------------------------------------------------- */
+
/** Return the list of allowed slave accounts
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function enum_slave_account() {
global $db, $err;
$db->query("SELECT * FROM slaveaccount;");
@@ -1792,10 +2172,18 @@ class m_dom {
return $res;
}
- /* ----------------------------------------------------------------- */
+
/** Add a slave account that will be allowed to access the domain list
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @param type $pass
+ * @return boolean
+ */
function add_slave_account($login, $pass) {
global $db, $err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login'");
@@ -1807,10 +2195,17 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Remove a slave account
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @return boolean
+ */
function del_slave_account($login) {
global $db, $err;
$db->query("DELETE FROM slaveaccount WHERE login='$login'");
@@ -1822,11 +2217,17 @@ class m_dom {
/* * ********** */
- /* ----------------------------------------------------------------- */
+
/** Try to lock a domain
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function lock() {
global $db, $err;
$err->log("dom", "lock");
@@ -1840,12 +2241,18 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Unlock the cron for domain management
* return true
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function unlock() {
global $db, $err;
$err->log("dom", "unlock");
@@ -1856,11 +2263,17 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Declare that a domain's emails are hosted in this server :
* This adds 2 MX entries in this domain (if required)
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $dom_id
+ * @return boolean
+ */
function hook_dom_add_mx_domain($dom_id) {
global $err;
$domain = $this->get_domain_byid($dom_id);
@@ -1872,11 +2285,16 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/**
* Delete an account (all his domains)
*/
+ /**
+ *
+ * @global m_err $err
+ * @return boolean
+ */
function hook_admin_del_member() {
global $err;
$err->log("dom", "alternc_del_member");
@@ -1887,13 +2305,14 @@ class m_dom {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Returns the used quota for the $name service for the current user.
* @param $name string name of the quota
* @return integer the number of service used or false if an error occured
* @access private
*/
+ /**
function hook_quota_get() {
global $db, $err, $cuid;
$err->log("dom", "get_quota");
@@ -1905,11 +2324,17 @@ class m_dom {
return $q;
}
- /* --------------------------------------------------------------------- */
+
/** Returns the global domain(s) configuration(s) of a particular user
* No parameters needed
* */
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return string
+ */
function alternc_export_conf() {
global $db, $err;
$err->log("dom", "export");
@@ -1961,6 +2386,15 @@ class m_dom {
* Optionnal parameters: id of the sub_domaines
*
* */
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $id
+ * @param type $only_apache
+ * @return type
+ *
+ */
function generation_parameters($id = null, $only_apache = true) {
global $db, $err;
$err->log("dom", "generation_parameters");
@@ -2010,6 +2444,11 @@ order by
* Warning: an Apache domains_type must have 'only_dns' == TRUE
*
* */
+ /**
+ *
+ * @global m_dom $dom
+ * @return type
+ */
function generation_domains_type() {
global $dom;
$d = array();
@@ -2026,6 +2465,13 @@ order by
}
// Launch old fashionned hooks as there was in AlternC 1.0
+ /**
+ *
+ * @param type $action
+ * @param type $lst_sub
+ * @param type $sub_obj
+ * @return boolean
+ */
function generate_conf_oldhook($action, $lst_sub, $sub_obj = null) {
if (is_null($sub_obj))
$sub_obj = $this->generation_parameters(null, false);
@@ -2056,6 +2502,11 @@ order by
* Die if a specific FQDN have 2 vhost conf.
*
* */
+ /**
+ *
+ * @param type $p
+ * @return string
+ */
function generate_apacheconf($p = null) {
// Get the parameters
$lst = $this->generation_parameters($p);
@@ -2104,6 +2555,12 @@ order by
}
// Return an array with the list of id of sub_domains waiting for an action
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return type
+ */
function generation_todo() {
global $db, $err;
$err->log("dom", "generation_todo");
@@ -2115,6 +2572,13 @@ order by
return $r;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $sub_domain_id
+ * @param type $action
+ * @return boolean
+ */
function subdomain_modif_are_done($sub_domain_id, $action) {
global $db;
$sub_domain_id = intval($sub_domain_id);
@@ -2132,25 +2596,43 @@ order by
/**
* @param string $dns_action
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $domain
+ * @param type $dns_action
+ * @return boolean
+ */
function set_dns_action($domain, $dns_action) {
global $db;
$db->query("UPDATE domaines SET dns_action='" . mysql_escape_string($dns_action) . "' WHERE domaine='" . mysql_escape_string($domain) . "'; ");
return true;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $domain
+ * @param type $dns_result
+ * @return boolean
+ */
function set_dns_result($domain, $dns_result) {
global $db;
$db->query("UPDATE domaines SET dns_result='" . mysql_escape_string($dns_result) . "' WHERE domaine='" . mysql_escape_string($domain) . "'; ");
return true;
}
- /* ----------------------------------------------------------------- */
+
/** hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
+ /**
+ *
+ * @return type
+ */
function hook_upnp_list() {
return array(
"dns-tcp" => array("port" => 53, "protocol" => "tcp", "mandatory" => 1),
@@ -2160,6 +2642,11 @@ order by
// List if there is problems in the domains.
// Problems can appear when editing domains type properties
+ /**
+ *
+ * @param type $domain
+ * @return type
+ */
function get_problems($domain) {
$this->lock();
$da = $this->get_domain_all($domain);
@@ -2194,6 +2681,9 @@ order by
return $errors;
}
+ /**
+ *
+ */
function default_domain_type() {
// This function is only used to allow translation of default domain types:
_("Locally hosted");
diff --git a/bureau/class/m_err.php b/bureau/class/m_err.php
index ed201cfc..4f06ea6c 100644
--- a/bureau/class/m_err.php
+++ b/bureau/class/m_err.php
@@ -61,6 +61,13 @@ class m_err {
* @return boolean TRUE si l'erreur est connue, FALSE sinon.
*
*/
+ /**
+ *
+ * @param type $clsid
+ * @param type $error
+ * @param type $param
+ * @return boolean
+ */
function raise($clsid,$error,$param="") {
/* Leve une exception. Si elle existe, sinon, stocke un message d'erreur sur erreur ...*/
if (_("err_".$clsid."_".$error)!="err_".$clsid."_".$error || is_string($error)) {
@@ -89,6 +96,11 @@ class m_err {
* @return string Chaine d'erreur.
*
*/
+ /**
+ *
+ * @return type
+ *
+ */
function errstr() {
if (is_string($this->error)) {
// new way of handling errors: message directly in the class
@@ -115,6 +127,10 @@ class m_err {
* Elle est appelée automatiquement par error
* @access private
*/
+ /**
+ *
+ * @global m_mem $mem
+ */
function logerr() {
global $mem;
@file_put_contents($this->logfile, date("d/m/Y H:i:s")." - ERROR - ".$mem->user["login"]." - ".$this->errstr(), FILE_APPEND );
@@ -132,6 +148,15 @@ class m_err {
* @return boolean TRUE si le log a été ajouté, FALSE sinon
*
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param type $clsid
+ * @param type $function
+ * @param type $param
+ * @return type
+ */
function log($clsid,$function,$param="") {
global $mem,$cuid;
return @file_put_contents($this->logfile,date("d/m/Y H:i:s")." - " .get_remote_ip(). " - CALL - ".$mem->user["login"]." - $clsid - $function - $param\n", FILE_APPEND );
@@ -139,4 +164,3 @@ class m_err {
}; /* Classe m_err */
-?>
diff --git a/bureau/class/m_export.php b/bureau/class/m_export.php
index 9289ea38..2766e95f 100644
--- a/bureau/class/m_export.php
+++ b/bureau/class/m_export.php
@@ -1,14 +1,21 @@
invoke('alternc_export_conf');
@@ -18,6 +25,12 @@ Class m_export {
/** le repertoire de base est passé en paramettre puis en construit une arborescence de la forme
//srv_name = variable_get('ftp_human_name', '%%FQDN%%','Human name for FTP server', array('desc'=>'Name','type'=>'string'));
@@ -44,10 +48,19 @@ class m_ftp {
/**
* Password kind used in this class (hook for admin class)
*/
+ /**
+ *
+ * @return type
+ */
function alternc_password_policy() {
return array("ftp"=>"FTP accounts");
}
+ /**
+ *
+ * @global m_quota $quota
+ * @return string
+ */
function hook_menu() {
global $quota;
$q = $quota->getquota("ftp");
@@ -83,6 +96,10 @@ class m_ftp {
// Return the values needed to activate security access. See get_auth_class()
// in authip for more informations
+ /**
+ *
+ * @return array
+ */
function authip_class() {
$c = Array();
$c['name']="FTP";
@@ -99,6 +116,15 @@ class m_ftp {
}
// Switch enabled status of an account
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $id
+ * @param type $status
+ * @return boolean
+ */
function switch_enabled($id,$status=null) {
global $cuid, $db, $err;
if (! $jj = $this->get_ftp_details($id)) {
@@ -123,14 +149,22 @@ class m_ftp {
/* ----------------------------------------------------------------- */
- /** Retourne la liste des comptes FTP du compte hébergé
- * Retourne la liste des comptes FTP sous forme de tableau indexé de
+ /** Retourne la liste des comptes FTP du compte h�berg�
+ * Retourne la liste des comptes FTP sous forme de tableau index� de
* tableaus associatifs comme suit :
* $a["id"]= ID du compte ftp
* $a["login"]= Nom de login du compte
- * $a["dir"]= Dossier relatif à la racine du compte de l'utilisateur
+ * $a["dir"]= Dossier relatif � la racine du compte de l'utilisateur
* @return array Retourne le tableau des comptes
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_bro $bro
+ * @return type
+ */
function get_list() {
global $db,$err,$cuid, $bro;
$err->log("ftp","get_list");
@@ -154,11 +188,19 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Retourne les détails d'un compte FTP (voir get_list)
- * Le tableau est celui du compte d'id spécifié
- * @param integer $id Numéro du compte dont on souhaite obtenir les détails
+ /** Retourne les d�tails d'un compte FTP (voir get_list)
+ * Le tableau est celui du compte d'id sp�cifi�
+ * @param integer $id Num�ro du compte dont on souhaite obtenir les d�tails
* @return array Tableau associatif contenant les infos du comptes ftp
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $id
+ * @return string|boolean
+ */
function get_ftp_details($id) {
global $db,$err,$cuid;
$err->log("ftp","get_ftp_details",$id);
@@ -194,6 +236,13 @@ class m_ftp {
* @return array tableau contenant la liste des prefixes (domaines + login)
* du compte actuel.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @return type
+ */
function prefix_list() {
global $db,$mem,$cuid;
$r=array();
@@ -210,6 +259,12 @@ class m_ftp {
*
* @param string $l
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $l
+ * @return boolean
+ */
function check_login($l) {
global $err;
@@ -233,11 +288,16 @@ class m_ftp {
/* ----------------------------------------------------------------- */
/** Affiche (ECHO) la liste des prefixes disponibles sous forme de champs d'option
- * Les champs sont affichés sous la forme ...
- * La valeur $current se voit affublée de la balise SELECTED.
- * @param string $current Prefixe sélectionné par défaut
+ * Les champs sont affich�s sous la forme ...
+ * La valeur $current se voit affubl�e de la balise SELECTED.
+ * @param string $current Prefixe s�lectionn� par d�faut
* @return boolean TRUE.
*/
+ /**
+ *
+ * @param type $current
+ * @return boolean
+ */
function select_prefix_list($current) {
$r=$this->prefix_list();
reset($r);
@@ -249,14 +309,29 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Modifie les paramètres du comptes FTP $id.
- * @param integer $id Numéro du compte dont on veut modifier les paramètres
+ /** Modifie les param�tres du comptes FTP $id.
+ * @param integer $id Num�ro du compte dont on veut modifier les param�tres
* @param string $prefixe Prefixe du compte FTP
- * @param string $login login ajouté au préfixe ($prefixe_$login)
+ * @param string $login login ajout� au pr�fixe ($prefixe_$login)
* @param string $pass mot de passe
- * @param string $dir Répertoire racine du compte
- * @return boolean TRUE si le compte a été modifié, FALSE si une erreur est survenue.
+ * @param string $dir R�pertoire racine du compte
+ * @return boolean TRUE si le compte a �t� modifi�, FALSE si une erreur est survenue.
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $id
+ * @param type $prefixe
+ * @param type $login
+ * @param type $pass
+ * @param type $dir
+ * @return boolean
+ */
function put_ftp_details($id,$prefixe,$login,$pass,$dir) {
global $mem,$db,$err,$bro,$cuid,$admin;
$err->log("ftp","put_ftp_details",$id);
@@ -311,10 +386,18 @@ class m_ftp {
/* ----------------------------------------------------------------- */
- /** Efface le compte ftp spécifié.
- * @param integer $id Numéro du compte FTP à supprimer.
- * @return boolean TRUE si le compte a été effacé, FALSE sinon.
+ /** Efface le compte ftp sp�cifi�.
+ * @param integer $id Num�ro du compte FTP � supprimer.
+ * @return boolean TRUE si le compte a �t� effac�, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $id
+ * @return boolean
+ */
function delete_ftp($id) {
global $db,$err,$cuid;
$err->log("ftp","delete_ftp",$id);
@@ -330,14 +413,29 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Crée un nouveau compte FTP.
+ /** Cr�e un nouveau compte FTP.
* @param string $prefixe Prefixe au login
* @param string $login Login ftp (login=prefixe_login)
* @param string $pass Mot de passe FTP
- * @param string $dir Répertoire racine du compte relatif à la racine du membre
- * @return boolean TRUE si le compte a été créé, FALSE sinon.
+ * @param string $dir R�pertoire racine du compte relatif � la racine du membre
+ * @return boolean TRUE si le compte a �t� cr��, FALSE sinon.
*
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $prefixe
+ * @param type $login
+ * @param type $pass
+ * @param type $dir
+ * @return boolean
+ */
function add_ftp($prefixe,$login,$pass,$dir) {
global $mem,$db,$err,$quota,$bro,$cuid,$admin;
$err->log("ftp","add_ftp",$prefixe."_".$login);
@@ -392,10 +490,18 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Retourne TRUE si $dir possède un compte FTP
- * @param string $dir Dossier à tester, relatif à la racine du compte courant
- * @return boolean retourne TRUE si $dir à un compte FTP, FALSE sinon.
+ /** Retourne TRUE si $dir poss�de un compte FTP
+ * @param string $dir Dossier � tester, relatif � la racine du compte courant
+ * @return boolean retourne TRUE si $dir � un compte FTP, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $dir
+ * @return boolean
+ */
function is_ftp($dir) {
global $mem,$db,$err;
$err->log("ftp","is_ftp",$dir);
@@ -410,10 +516,18 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Fonction appellée par domains quand un domaine est supprimé pour le membre
- * @param string $dom Domaine à détruire.
+ /** Fonction appell�e par domains quand un domaine est supprim� pour le membre
+ * @param string $dom Domaine � d�truire.
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $dom
+ * @return boolean
+ */
function alternc_del_domain($dom) {
global $db,$err,$cuid;
$err->log("ftp","alternc_del_domain",$dom);
@@ -422,9 +536,16 @@ class m_ftp {
}
/* ----------------------------------------------------------------- */
- /** Fonction appellée par membres quand un membre est effacé.
+ /** Fonction appell�e par membres quand un membre est effac�.
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return boolean
+ */
function alternc_del_member() {
global $db,$err,$cuid;
$err->log("ftp","alternc_del_member");
@@ -439,6 +560,13 @@ class m_ftp {
* @return integer the number of service used or false if an error occured
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return type
+ */
function hook_quota_get() {
global $db,$err,$cuid;
$err->log("ftp","getquota");
@@ -457,6 +585,12 @@ class m_ftp {
* @access private
* EXPERIMENTAL 'sid' function ;)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return string
+ */
function alternc_export_conf() {
global $db,$err;
$err->log("ftp","export");
@@ -478,6 +612,10 @@ class m_ftp {
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
+ /**
+ *
+ * @return type
+ */
function hook_upnp_list() {
return array(
"ftp" => array("port" => 21, "protocol" => "tcp", "mandatory" => 1),
diff --git a/bureau/class/m_hooks.php b/bureau/class/m_hooks.php
index 673b18d2..4d9d6786 100644
--- a/bureau/class/m_hooks.php
+++ b/bureau/class/m_hooks.php
@@ -30,14 +30,15 @@
*/
class m_hooks {
- /*---------------------------------------------------------------------------*/
/** Constructor
* hooks([$mid]) Constructeur de la classe hooks, ne fait rien pour le moment
*/
+ /**
+ *
+ */
function m_hooks() {
}
- /*---------------------------------------------------------------------------*/
/**
* invoke() permet de lancer une fonction donné en parametre dans toute les classes
* connues de alternc, avec les parametres donnés.
@@ -46,6 +47,14 @@ class m_hooks {
* @param array|string $hclass tableau contenant les classes spécifique qu'on veux appeler (si on veux pas TOUTE les appeler)
* @return array with the return of each classes
*/
+ /**
+ *
+ * @global array $classes
+ * @param type $hname
+ * @param type $hparam
+ * @param type $hclass
+ * @return type
+ */
function invoke($hname, $hparam = array(), $hclass = null) {
// Si $hclass est defini, on veut appeler le hooks QUE pour UNE
@@ -76,13 +85,18 @@ class m_hooks {
return $val;
}
- /*---------------------------------------------------------------------------*/
/**
* invoke each executable script of the directory (or the specified script)
* @param string $scripts a script or a directory
* @param array $parameters parameters for the scripts
* @return boolean TRUE
*/
+ /**
+ *
+ * @param type $scripts
+ * @param type $parameters
+ * @return boolean
+ */
function invoke_scripts($scripts, $parameters=array()) {
// First, build the list of script we want to launch
diff --git a/bureau/class/m_hta.php b/bureau/class/m_hta.php
index 78d5c79e..bdc90b3f 100644
--- a/bureau/class/m_hta.php
+++ b/bureau/class/m_hta.php
@@ -79,7 +79,7 @@ class m_hta {
*
* @global m_mem $mem
* @global m_bro $bro
- * @global m_err $err
+ * @global m_err $err
* @param string $dir
* @return boolean
*/
@@ -123,7 +123,7 @@ class m_hta {
/**
* Returns the list of all user folder currently protected by a .htpasswd file
*
- * @global m_err $err
+ * @global m_err $err
* @global m_mem $mem
* @return array Array containing user folder list
*/
@@ -152,7 +152,7 @@ class m_hta {
* Tells if a folder is protected.
*
* @global m_mem $mem
- * @global m_err $err
+ * @global m_err $err
* @param string $dir Folder to check
* @return boolean If the folder is protected, or FALSE if it is not
*/
@@ -172,7 +172,7 @@ class m_hta {
* Returns the list of login for a protected folder.
*
* @global m_mem $mem
- * @global m_err $err
+ * @global m_err $err
* @param string $dir The folder to lookup (relative to user root)
* @return array An array containing the list of logins from the .htpasswd file, or FALSE
*/
@@ -210,7 +210,7 @@ class m_hta {
*
* @global m_mem $mem
* @global m_bro $bro
- * @global m_err $err
+ * @global m_err $err
* @param string $dir Folder to unprotect, relative to user root
* @param boolean $skip For testing purpose mainly, skips the full user path search
* @return boolean TRUE if the folder has been unprotected, or FALSE if an error occurred
@@ -271,7 +271,7 @@ class m_hta {
/**
* Add a user to a protected folder
*
- * @global m_err $err
+ * @global m_err $err
* @global m_bro $bro
* @global m_admin $admin
* @param string $user
@@ -340,7 +340,7 @@ class m_hta {
* Delete a user from a protected folder.
*
* @global m_bro $bro
- * @global m_err $err
+ * @global m_err $err
* @param array $lst An array with login to delete.
* @param string $dir The folder, relative to user root, where we want to delete users.
* @return boolean TRUE if users has been deleted, or FALSE if an error occurred.
@@ -388,7 +388,7 @@ class m_hta {
* Change the password of a user in a protected folder
*
* @global m_bro $bro
- * @global m_err $err
+ * @global m_err $err
* @global m_admin $admin
* @param string $user
* @param string $newpass
@@ -437,7 +437,7 @@ class m_hta {
/**
* Check that a .htaccess file is valid (for authentication)
*
- * @global m_err $err
+ * @global m_err $err
* @param type $absolute
* @param string $absolute Folder we want to check (relative to user root)
* @return boolean TRUE is the .htaccess is protecting this folder, or FALSE else
diff --git a/bureau/class/m_log.php b/bureau/class/m_log.php
index a4b5dafa..e15e04bb 100644
--- a/bureau/class/m_log.php
+++ b/bureau/class/m_log.php
@@ -28,9 +28,19 @@
*/
class m_log {
+ /**
+ *
+ */
function m_log(){
}
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_err $err
+ * @param type $dir
+ * @return type
+ */
function list_logs_directory($dir){
global $cuid,$err;
$err->log("log","list_logs_directory");
@@ -54,6 +64,10 @@ class m_log {
}
+ /**
+ *
+ * @return string
+ */
function hook_menu() {
$obj = array(
'title' => _("Logs"),
@@ -65,6 +79,12 @@ class m_log {
return $obj;
}
+ /**
+ *
+ * @global m_err $err
+ * @param type $dirs
+ * @return type
+ */
function list_logs_directory_all($dirs){
global $err;
$err->log("log","get_logs_directory_all");
@@ -76,6 +96,13 @@ class m_log {
}
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_err $err
+ * @return string
+ */
function get_logs_directory(){
global $cuid,$mem,$err;
$err->log("log","get_logs_directory");
@@ -88,6 +115,12 @@ class m_log {
return $c;
}
+ /**
+ *
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $file
+ */
function download_link($file){
global $err,$mem;
$err->log("log","download_link");
diff --git a/bureau/class/m_lxc.php b/bureau/class/m_lxc.php
index 8bba638c..bda0378f 100644
--- a/bureau/class/m_lxc.php
+++ b/bureau/class/m_lxc.php
@@ -44,6 +44,7 @@ class m_lxc implements vm {
/**
* Constructor, initialize the class informations from AlternC's variables
*/
+ /**
function m_lxc() {
$this->IP = variable_get('lxc_ip', '', "IP address of the Alternc's LXC server. If empty, no LXC server.", array('desc'=>'IP address','type'=>'ip'));
$this->PORT = variable_get('lxc_port', '6504', "Port of the Alternc's LXC server", array('desc'=>'Port','type'=>'integer'));
@@ -55,6 +56,7 @@ class m_lxc implements vm {
/**
* HOOK: add the "Console Access" to AlternC's main menu
*/
+ /**
function hook_menu() {
if ( empty($this->IP)) return ; // No menu if no server
@@ -72,6 +74,7 @@ class m_lxc implements vm {
/**
* HOOK: remove VM history for AlternC account
*/
+ /**
function hook_admin_del_member() {
global $db,$err,$cuid;
$err->log("lxc","alternc_del_member");
diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php
index dbe77023..be85fece 100644
--- a/bureau/class/m_mail.php
+++ b/bureau/class/m_mail.php
@@ -36,14 +36,14 @@
class m_mail {
- /* ----------------------------------------------------------------- */
+
/** domain list for this account
* @access private
*/
var $domains;
- /* ----------------------------------------------------------------- */
+
/** If an email has those chars, 'not nice in shell env' ;)
* we don't store the email in $mail/u/{user}_domain, but in $mail/_/{address_id}_domain
* @access private
@@ -51,7 +51,7 @@ class m_mail {
var $specialchars=array('"',"'",'\\','/');
- /* ----------------------------------------------------------------- */
+
/** If an email has those chars, we will ONLY allow RECIPIENTS, NOT POP/IMAP for DOVECOT !
* Since Dovecot doesn't allow those characters
* @access private
@@ -59,7 +59,7 @@ class m_mail {
var $forbiddenchars=array('"',"'",'\\','/','?','!','*','$','|','#','+');
- /* ----------------------------------------------------------------- */
+
/** Number of results for a pager display
* @access public
*/
@@ -77,10 +77,13 @@ class m_mail {
var $cache_domain_mail_size = array();
var $enum_domains=array();
- /* ----------------------------------------------------------------- */
+
/**
* Constructeur
*/
+ /**
+ *
+ */
function m_mail() {
$this->srv_submission = variable_get('mail_human_submission', '%%FQDN%%','Human name for mail server (submission protocol)', array('desc'=>'Name','type'=>'string'));
$this->srv_smtp = variable_get('mail_human_smtp', '%%FQDN%%','Human name for mail server (SMTP protocol)', array('desc'=>'Name','type'=>'string'));
@@ -91,6 +94,10 @@ class m_mail {
$this->srv_pop3s = variable_get('mail_human_pop3s', '%%FQDN%%','Human name for POP3s mail server', array('desc'=>'Name','type'=>'string'));
}
+ /**
+ *
+ * @return string
+ */
function hook_menu() {
$obj = array(
'title' => _("Email Addresses"),
@@ -111,6 +118,12 @@ class m_mail {
return $obj;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $domain
+ * @return int
+ */
function get_total_size_for_domain($domain) {
global $db;
if (empty($this->cache_domain_mail_size)) {
@@ -129,6 +142,13 @@ class m_mail {
/**
* @param string $domain_id
*/
+ /**
+ *
+ * @global m_dom $dom
+ * @global m_mysql $db
+ * @param type $domain_id
+ * @return string
+ */
function catchall_getinfos($domain_id) {
global $dom, $db;
$rr=array(
@@ -159,6 +179,11 @@ class m_mail {
/**
* @param string $domain_id
*/
+ /**
+ *
+ * @param type $domain_id
+ * @return boolean
+ */
function catchall_del($domain_id) {
$catch = $this->catchall_getinfos($domain_id);
if (empty($catch['mail_id'])) return false;
@@ -169,6 +194,13 @@ class m_mail {
* @param string $domain_id
* @param string $target
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $domain_id
+ * @param type $target
+ * @return boolean
+ */
function catchall_set($domain_id, $target) {
global $err;
// target :
@@ -190,13 +222,20 @@ class m_mail {
}
- /* ----------------------------------------------------------------- */
+
/** get_quota (hook for quota class), returns the number of used
* service for a quota-bound service
* @param $name string the named quota we want
* @return the number of used service for the specified quota,
* or false if I'm not the one for the named quota
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return type
+ */
function hook_quota_get() {
global $db,$err,$cuid;
$err->log("mail","getquota");
@@ -209,19 +248,31 @@ class m_mail {
}
- /* ----------------------------------------------------------------- */
+
/** Password policy kind used in this class (hook for admin class)
* @return array an array of policykey => "policy name (for humans)"
*/
+ /**
+ *
+ * @return type
+ */
function alternc_password_policy() {
return array("pop"=>_("Email account password"));
}
- /* ----------------------------------------------------------------- */
+
/** Returns the list of mail-hosting domains for a user
* @return array indexed array of hosted domains
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $uid
+ * @return type
+ */
function enum_domains($uid=-1) {
global $db,$err,$cuid;
$err->log("mail","enum_domains");
@@ -250,12 +301,20 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** available: tells if an email address can be installed in the server
* check the domain part (is it mine too), the syntax, and the availability.
* @param $mail string email to check
* @return boolean true if the email can be installed on the server
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_dom $dom
+ * @param type $mail
+ * @return boolean
+ */
function available($mail){
global $db,$err,$dom;
$err->log("mail","available");
@@ -279,7 +338,7 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/* function used to list every mail address hosted on a domain.
* @param $dom_id integer the domain id.
* @param $search string search that string in recipients or address.
@@ -287,6 +346,19 @@ ORDER BY
* @param $count integer return no more than THAT much emails. -1 for ALL. Offset is ignored then.
* @result an array of each mail hosted under the domain.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_hooks $hooks
+ * @param type $dom_id
+ * @param type $search
+ * @param type $offset
+ * @param type $count
+ * @param type $show_systemmails
+ * @return type
+ */
function enum_domain_mails($dom_id = null, $search="", $offset=0, $count=30, $show_systemmails=false){
global $db,$err,$cuid,$hooks;
$err->log("mail","enum_domains_mail");
@@ -321,12 +393,17 @@ ORDER BY
}
+ /**
+ *
+ * @param type $detail
+ * @return type
+ */
function hook_mail_get_details($detail) {
if ($detail['type']=='catchall') return _(sprintf("Special mail address for catch-all. Click here to manage it.",$detail['domain_id']));
}
- /* ----------------------------------------------------------------- */
+
/** Function used to insert a new mail into the db
* should be used by the web interface, not by third-party programs.
*
@@ -339,6 +416,20 @@ ORDER BY
* @return an hashtable containing the database id of the newly created mail,
* or false if an error occured ($err is filled accordingly)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_quota $quota
+ * @global m_dom $dom
+ * @global m_hooks $hooks
+ * @param type $dom_id
+ * @param type $mail
+ * @param type $type
+ * @param type $dontcheck
+ * @return boolean
+ */
function create($dom_id, $mail,$type="",$dontcheck=false){
global $err,$db,$cuid,$quota,$dom,$hooks;
$err->log("mail","create",$mail);
@@ -382,11 +473,20 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** function used to get every information we can on a mail
* @param $mail_id integer
* @return array a hashtable with all the informations for that email
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_hooks $hooks
+ * @param type $mail_id
+ * @return boolean
+ */
function get_details($mail_id) {
global $db, $err, $cuid, $hooks;
$err->log("mail","get_details");
@@ -412,13 +512,21 @@ ORDER BY
private $isitmy_cache=array();
- /* ----------------------------------------------------------------- */
+
/** Check if an email is mine ...
*
* @param $mail_id integer the number of the email to check
* @return string the complete email address if that's mine, false if not
* ($err is filled accordingly)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @param type $mail_id
+ * @return type
+ */
function is_it_my_mail($mail_id){
global $err,$db,$cuid;
$mail_id=intval($mail_id);
@@ -435,13 +543,18 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Hook called when the DOMAIN class will delete a domain.
*
* @param $dom integer the number of the email to delete
* @return boolean if the email has been properly deleted
* or false if an error occured ($err is filled accordingly)
*/
+ /**
+ *
+ * @param type $dom_id
+ * @return boolean
+ */
function hook_dom_del_mx_domain($dom_id) {
$list=$this->enum_domain_mails($dom_id,"",0,-1);
if (is_array($list)) {
@@ -453,6 +566,13 @@ ORDER BY
}
// return the alternc account's ID of the mail_id
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $mail_id
+ * @return boolean
+ */
function get_account_by_mail_id($mail_id) {
global $db,$err;
$db->query("select compte as uid from domaines d, address a where a.domain_id = d.id and a.id = $mail_id");
@@ -463,7 +583,7 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Function used to delete a mail from the db
* should be used by the web interface, not by third-party programs.
*
@@ -471,6 +591,17 @@ ORDER BY
* @return boolean if the email has been properly deleted
* or false if an error occured ($err is filled accordingly)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_quota $quota
+ * @global m_dom $dom
+ * @global m_hooks $hooks
+ * @param type $mail_id
+ * @return boolean
+ */
function delete($mail_id){
global $err,$db,$cuid,$quota,$dom,$hooks;
$err->log("mail","delete");
@@ -517,7 +648,7 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Function used to undelete a pending deletion mail from the db
* should be used by the web interface, not by third-party programs.
*
@@ -525,6 +656,17 @@ ORDER BY
* @return boolean if the email has been properly undeleted
* or false if an error occured ($err is filled accordingly)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_quota $quota
+ * @global m_dom $dom
+ * @global m_hooks $hooks
+ * @param type $mail_id
+ * @return boolean
+ */
function undelete($mail_id){
global $err,$db,$cuid,$quota,$dom,$hooks;
$err->log("mail","undelete");
@@ -569,12 +711,21 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** set the password of an email address.
* @param $mail_id integer email ID
* @param $pass string the new password.
* @return boolean true if the password has been set, false else, raise an error.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_admin $admin
+ * @param type $mail_id
+ * @param type $pass
+ * @return boolean
+ */
function set_passwd($mail_id,$pass){
global $db,$err,$admin;
$err->log("mail","setpasswd");
@@ -586,11 +737,18 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Enables an email address.
* @param $mail_id integer Email ID
* @return boolean true if the email has been enabled.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $mail_id
+ * @return boolean
+ */
function enable($mail_id){
global $db,$err;
$err->log("mail","enable");
@@ -600,11 +758,18 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Disables an email address.
* @param $mail_id integer Email ID
* @return boolean true if the email has been enabled.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $mail_id
+ * @return boolean
+ */
function disable($mail_id){
global $db,$err;
$err->log("mail","disable");
@@ -614,7 +779,7 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Function used to update an email settings
* should be used by the web interface, not by third-party programs.
*
@@ -625,6 +790,22 @@ ORDER BY
* @return boolean if the email has been properly edited
* or false if an error occured ($err is filled accordingly)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_quota $quota
+ * @global m_dom $dom
+ * @global m_hooks $hooks
+ * @param type $mail_id
+ * @param type $islocal
+ * @param type $quotamb
+ * @param type $recipients
+ * @param type $delivery
+ * @param type $dontcheck
+ * @return boolean
+ */
function set_details($mail_id, $islocal, $quotamb, $recipients,$delivery="dovecot",$dontcheck=false) {
global $err,$db,$cuid,$quota,$dom,$hooks;
$delivery=mysql_real_escape_string($delivery);
@@ -669,7 +850,7 @@ ORDER BY
$db->query("UPDATE mailbox SET quota=".intval($quotamb)." WHERE address_id=".$mail_id.";");
}
- $recipients=preg_replace('/[\r\t\s]/', "\n", $recipients); // Handle space AND new line
+ $recipients=preg_replace('/[\r \s]/', "\n", $recipients); // Handle space AND new line
$r=explode("\n",$recipients);
$red="";
foreach($r as $m) {
@@ -686,13 +867,22 @@ ORDER BY
return true;
}
- /* ----------------------------------------------------------------- */
+
/** A wrapper used by mailman class to create it's needed addresses
* @ param : $dom_id , the domain id associated to a given address
* @ param : $m , the left part of the mail address being created
* @ param : $delivery , the delivery used to deliver the mail
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mail $mail
+ * @param type $dom_id
+ * @param type $m
+ * @param type $delivery
+ */
function add_wrapper($dom_id,$m,$delivery){
global $err,$db,$mail;
$err->log("mail","add_wrapper","creating $delivery $m address");
@@ -702,7 +892,7 @@ ORDER BY
// FIXME return error code
}
- /* ----------------------------------------------------------------- */
+
/** A function used to create an alias for a specific address
* @ param : $dom_id , the domain sql identifier
* @ param : $m , the alias we want to create
@@ -712,6 +902,17 @@ ORDER BY
* @param string $alias
* @param string $dom_id
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mail $mail
+ * @param type $dom_id
+ * @param type $m
+ * @param type $alias
+ * @param type $type
+ * @param type $dontcheck
+ */
function create_alias($dom_id,$m,$alias,$type="",$dontcheck=false) {
global $err,$db,$mail;
$err->log("mail","create_alias","creating $m alias for $alias type $type");
@@ -723,22 +924,35 @@ ORDER BY
- /* ----------------------------------------------------------------- */
+
/** A wrapper used by mailman class to create it's needed addresses
* @ param : $mail_id , the mysql id of the mail address we want to delete
* of the email for the current acccount.
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @param type $mail_id
+ */
function del_wrapper($mail_id){
global $err,$db;
$err->log("mail","del_wrapper");
$this->delete($mail_id);
}
- /* ----------------------------------------------------------------- */
+
/** Export the mail information of an account
* @return: str, string containing the complete configuration
* of the email for the current acccount.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mail $mail_localbox
+ * @return string
+ */
function alternc_export_conf() {
global $db,$err,$mail_localbox;
$err->log("mail","export");
@@ -775,11 +989,17 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/**
* Return the list of allowed slave accounts (secondary-mx)
* @return array
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function enum_slave_account() {
global $db,$err;
$db->query("SELECT login,pass FROM mxaccount;");
@@ -791,13 +1011,21 @@ ORDER BY
return $res;
}
- /* ----------------------------------------------------------------- */
+
/**
* Check for a slave account (secondary mx)
* @param string $login the login to check
* @param string $pass the password to check
* @return boolean TRUE if the password is correct, or FALSE if an error occurred.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @param type $pass
+ * @return boolean
+ */
function check_slave_account($login,$pass) {
global $db,$err;
$login=mysql_real_escape_string($login);
@@ -810,9 +1038,16 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/** Out (echo) the complete hosted domain list :
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $format
+ * @return boolean
+ */
function echo_domain_list($format=null) {
global $db,$err;
$db->query("SELECT domaine FROM domaines WHERE gesmx=1 ORDER BY domaine");
@@ -838,13 +1073,21 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/**
* Add a slave account that will be allowed to access the mxdomain list
* @param string $login the login to add
* @param string $pass the password to add
* @return boolean TRUE if the account has been created, or FALSE if an error occurred.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @param type $pass
+ * @return boolean
+ */
function add_slave_account($login,$pass) {
global $db,$err;
$login=mysql_real_escape_string($login);
@@ -859,11 +1102,18 @@ ORDER BY
}
- /* ----------------------------------------------------------------- */
+
/**
* Remove a slave account
* @param string $login the login to delete
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $login
+ * @return boolean
+ */
function del_slave_account($login) {
global $db,$err;
$login=mysql_real_escape_string($login);
@@ -871,7 +1121,7 @@ ORDER BY
return true;
}
- /* ----------------------------------------------------------------- */
+
/** hook function called by AlternC when a domain is created for
* the current user account using the SLAVE DOMAIN feature
* This function create a CATCHALL to the master domain
@@ -879,6 +1129,13 @@ ORDER BY
* @param string $target_domain Master domain
* @access private
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $domain_id
+ * @param type $target_domain
+ * @return boolean
+ */
function hook_dom_add_slave_domain($domain_id,$target_domain) {
global $err;
$err->log("mail","hook_dom_add_slave_domain",$domain_id);
@@ -886,7 +1143,7 @@ ORDER BY
return true;
}
- /* ----------------------------------------------------------------- */
+
/** hook function called by AlternC when a domain is created for
* the current user account
* This function create a postmaster mail which is an alias to LOGIN @ FQDN
@@ -894,6 +1151,15 @@ ORDER BY
* @param string $domain_id Domain that has just been created
* @access private
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global string $L_FQDN
+ * @global m_mysql $db
+ * @param type $domain_id
+ * @return boolean
+ */
function hook_dom_add_mx_domain($domain_id) {
global $err, $mem, $L_FQDN,$db;
$err->log("mail","hook_dom_add_mx_domain",$domain_id);
@@ -910,12 +1176,16 @@ ORDER BY
- /* ----------------------------------------------------------------- */
+
/** hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
+ /**
+ *
+ * @return type
+ */
function hook_upnp_list() {
return array(
"imap" => array("port" => 143, "protocol" => "tcp", "mandatory" => 1),
diff --git a/bureau/class/m_mem.php b/bureau/class/m_mem.php
index aecd7431..e0d889f2 100644
--- a/bureau/class/m_mem.php
+++ b/bureau/class/m_mem.php
@@ -39,25 +39,34 @@ class m_mem {
var $user;
/** Tableau contenant les champs de la table "local" du membre courant
* Ce tableau est utilisable globalement par toutes les classes filles.
- * Note : les champs de "local" sont spécifiques à l'hébergeur.
+ * Note : les champs de "local" sont sp�cifiques � l'h�bergeur.
*/
var $local;
- /* ----------------------------------------------------------------- */
/**
* Constructeur
*/
+ /**
+ *
+ */
function m_mem() {
}
- /* ----------------------------------------------------------------- */
/**
* Password kind used in this class (hook for admin class)
*/
+ /**
+ *
+ * @return type
+ */
function alternc_password_policy() {
return array("mem"=>"AlternC's account password");
}
+ /**
+ *
+ * @return type
+ */
function hook_menu() {
$obj = array(
'title' => _("Settings"),
@@ -69,15 +78,17 @@ class m_mem {
return $obj;
}
- /* ----------------------------------------------------------------- */
/** Check that the current user is an admnistrator.
* @return boolean TRUE if we are super user, or FALSE if we are not.
*/
+ /**
+ *
+ * @return type
+ */
function checkright() {
return ($this->user["su"]=="1");
}
- /* ----------------------------------------------------------------- */
/** Start a session in the web desktop. Check username and password.
* Note : If the user entered a bas password, the failure will be logged
* and told to the corresponding user on next successfull login.
@@ -85,11 +96,22 @@ class m_mem {
* @param $password string User Password.
* @return boolean TRUE if the user has been successfully connected, or FALSE if an error occured.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_authip $authip
+ * @global m_admin $admin
+ * @param type $username
+ * @param type $password
+ * @param type $restrictip
+ * @param type $authip_token
+ * @return boolean
+ */
function login($username,$password,$restrictip=0,$authip_token=false) {
global $db,$err,$cuid,$authip,$admin;
$err->log("mem","login",$username);
- // $username=addslashes($username);
- // $password=addslashes($password);
$db->query("select * from membres where login='$username';");
if ($db->num_rows()==0) {
$err->raise("mem",_("User or password incorrect"));
@@ -113,7 +135,6 @@ class m_mem {
return false;
}
- // AuthIP
$allowed_ip=false;
if ( $authip_token ) $allowed_ip = $this->authip_tokencheck($authip_token);
@@ -122,27 +143,21 @@ class m_mem {
if ( $authip->is_in_subnet(get_remote_ip(), $v['ip'], $v['subnet']) ) $allowed=true ;
}
- // Error if there is rules, the IP is not allowed and it's not in the whitelisted IP
if ( sizeof($aga)>1 && !$allowed_ip && !$authip->is_wl(get_remote_ip()) ) {
$err->raise("mem",_("Your IP isn't allowed to connect"));
return false;
}
- // End AuthIP
if ($restrictip) {
$ip="'".get_remote_ip()."'";
} else $ip="''";
- /* Close sessions that are more than 2 days old. */
$db->query("DELETE FROM sessions WHERE DATE_ADD(ts,INTERVAL 2 DAY)query("insert into sessions (sid,ip,uid) values ('$sess',$ip,'$cuid');");
setcookie("session",$sess,0,"/");
$err->error=0;
- /* Fill in $local */
$db->query("SELECT * FROM local WHERE uid='$cuid';");
if ($db->num_rows()) {
$db->next_record();
@@ -151,7 +166,6 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
/** Start a session as another user from an administrator account.
* This function is not the same as su. setid connect the current user in the destination
* account (for good), and su allow any user to become another account for some commands only.
@@ -160,6 +174,16 @@ class m_mem {
* @param $id integer User id where we will connect to.
* @return boolean TRUE if the user has been successfully connected, FALSE else.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mysql $mysql
+ * @global m_quota $quota
+ * @param type $id
+ * @return boolean
+ */
function setid($id) {
global $db,$err,$cuid,$mysql,$quota;
$err->log("mem","setid",$id);
@@ -171,7 +195,6 @@ class m_mem {
$db->next_record();
$this->user=$db->Record;
$cuid=$db->f("uid");
- // And recreate the $db->dbus
$mysql->reload_dbus();
$ip=get_remote_ip();
@@ -180,7 +203,6 @@ class m_mem {
$db->query("insert into sessions (sid,ip,uid) values ('$sess','$ip','$cuid');");
setcookie("session",$sess,0,"/");
$err->error=0;
- /* Fill in $local */
$db->query("SELECT * FROM local WHERE uid='$cuid';");
if ($db->num_rows()) {
$db->next_record();
@@ -190,9 +212,13 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
- /** Suite à la connexion de l'utilisateur, réinitialise ses paramètres de dernière connexion
+ /** Suite � la connexion de l'utilisateur, r�initialise ses param�tres de derni�re connexion
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ */
function resetlast() {
global $db,$cuid;
$ip=addslashes(getenv("REMOTE_HOST"));
@@ -200,6 +226,13 @@ class m_mem {
$db->query("UPDATE membres SET lastlogin=NOW(), lastfail=0, lastip='$ip' WHERE uid='$cuid';");
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @param type $bis
+ * @return type
+ */
function authip_token($bis=false) {
global $db,$cuid;
$db->query("select pass from membres where uid='$cuid';");
@@ -212,12 +245,22 @@ class m_mem {
/**
* @param boolean $t
*/
+ /**
+ *
+ * @param type $t
+ * @return boolean
+ */
function authip_tokencheck($t) {
if ($t==$this->authip_token() || $t==$this->authip_token(true) ) return true;
return false;
}
-/* Faut finir de l'implémenter :) * /
+// Faut finir de l'impl�menter :) *
+ /**
+ *
+ * @global m_mem $mem
+ * @return string
+ */
function authip_class() {
global $cuid;
$c = Array();
@@ -227,20 +270,26 @@ class m_mem {
return $c;
}
-/* */
+// *
- /* ----------------------------------------------------------------- */
- /** Vérifie que la session courante est correcte (cookie ok et ip valide).
- * Si besoin, et si réception des champs username & password, crée une nouvelle
- * session pour l'utilisateur annoncé.
- * Cette fonction doit être appellée à chaque page devant être authentifiée.
- * et AVANT d'émettre des données. (un cookie peut être envoyé)
+ /** V�rifie que la session courante est correcte (cookie ok et ip valide).
+ * Si besoin, et si r�ception des champs username & password, cr�e une nouvelle
+ * session pour l'utilisateur annonc�.
+ * Cette fonction doit �tre appell�e � chaque page devant �tre authentifi�e.
+ * et AVANT d'�mettre des donn�es. (un cookie peut �tre envoy�)
* @global string $session Le cookie de session eventuel
* @global string $username/password le login/pass de l'utilisateur
* @return boolean TRUE si la session est correcte, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return boolean
+ */
function checkid() {
- global $db,$err,$cuid,$restrictip,$authip;
+ global $db,$err,$cuid;
if (isset($_REQUEST["username"])) {
if ( empty($_REQUEST['password']) ) {
$err->raise("mem",_("Missing password"));
@@ -279,7 +328,6 @@ class m_mem {
$db->next_record();
$this->user=$db->Record;
$err->error=0;
- /* Remplissage de $local */
$db->query("SELECT * FROM local WHERE uid='$cuid';");
if ($db->num_rows()) {
$db->next_record();
@@ -288,11 +336,19 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
- /** Change l'identité d'un utilisateur temporairement.
- * @global string $uid Utilisateur dont on prends l'identité
+ /** Change l'identit� d'un utilisateur temporairement.
+ * @global string $uid Utilisateur dont on prends l'identit�
* @return TRUE si la session est correcte, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mysql $mysql
+ * @param type $uid
+ * @return boolean
+ */
function su($uid) {
global $cuid,$db,$err,$mysql;
if (!$this->olduid)
@@ -306,33 +362,44 @@ class m_mem {
$this->user=$db->Record;
$cuid=$db->f("uid");
- // And recreate the $db->dbus
$mysql->reload_dbus();
return true;
}
- /* ----------------------------------------------------------------- */
/** Retourne a l'identite d'origine de l'utilisateur apres su.
* @return boolean TRUE si la session est correcte, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $mysql
+ * @return boolean
+ */
function unsu() {
global $cuid,$mysql;
if (!$this->olduid)
return false;
$this->su($this->olduid);
$this->olduid=0;
- // And recreate the $db->dbus
$mysql->reload_dbus();
return true;
}
- /* ----------------------------------------------------------------- */
/** Termine une session du bureau virtuel (logout)
- * @return boolean TRUE si la session a bien été détruite, FALSE sinon.
+ * @return boolean TRUE si la session a bien �t� d�truite, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global array $classes
+ * @global m_hooks $hooks
+ * @return boolean
+ */
function del_session() {
- global $db,$user,$err,$cuid,$classes,$hooks;
+ global $db,$err,$cuid,$classes,$hooks;
$_COOKIE["session"]=addslashes(isset($_COOKIE["session"])?$_COOKIE["session"]:'');
setcookie("session","",0,"/");
setcookie("oldid","",0,"/");
@@ -360,13 +427,7 @@ class m_mem {
$err->error=0;
# Invoker le logout dans toutes les autres classes
- /*
- foreach($classes as $c) {
- if (method_exists($GLOBALS[$c],"alternc_del_session")) {
- $GLOBALS[$c]->alternc_del_session();
- }
- }
- */
+
$hooks->invoke("alternc_del_session");
session_unset();
@@ -374,13 +435,23 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
/** Change le mot de passe de l'utilisateur courant.
* @param string $oldpass Ancien mot de passe.
* @param string $newpass Nouveau mot de passe
- * @param string $newpass2 Nouveau mot de passe (à nouveau)
- * @return boolean TRUE si le mot de passe a été changé, FALSE sinon.
+ * @param string $newpass2 Nouveau mot de passe (� nouveau)
+ * @return boolean TRUE si le mot de passe a �t� chang�, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $oldpass
+ * @param type $newpass
+ * @param type $newpass2
+ * @return boolean
+ */
function passwd($oldpass,$newpass,$newpass2) {
global $db,$err,$cuid,$admin;
$err->log("mem","passwd");
@@ -411,11 +482,18 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
- /** Change les préférences administrateur d'un compte
+ /** Change les pr�f�rences administrateur d'un compte
* @param integer $admlist Mode de visualisation des membres (0=large 1=courte)
- * @return boolean TRUE si les préférences ont été changées, FALSE sinon.
+ * @return boolean TRUE si les pr�f�rences ont �t� chang�es, FALSE sinon.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $admlist
+ * @return boolean
+ */
function adminpref($admlist) {
global $db,$err,$cuid;
$err->log("mem","admlist");
@@ -428,13 +506,21 @@ class m_mem {
return true;
}
- /* ----------------------------------------------------------------- */
/** Envoie en mail le mot de passe d'un compte.
* Note : On ne peut demander le mot de passe qu'une seule fois par jour.
* TODO : Translate this mail into the localization program.
* TODO : Check this function's !
- * @return boolean TRUE si le mot de passe a été envoyé avec succès, FALSE sinon.
+ * @return boolean TRUE si le mot de passe a �t� envoy� avec succ�s, FALSE sinon.
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global string $L_HOSTING
+ * @global string $L_FQDN
+ * @param type $login
+ * @return boolean
+ */
function send_pass($login) {
global $err,$db,$L_HOSTING,$L_FQDN;
$err->log("mem","send_pass");
@@ -472,12 +558,21 @@ Cordially.
return true;
}
- /* ----------------------------------------------------------------- */
- /** Change le mail d'un membre (première etape, envoi du CookiE)
+ /** Change le mail d'un membre (premi�re etape, envoi du CookiE)
* TODO : insert this mail string into the localization system
- * @param string $newmail Nouveau mail souhaité pour le membre.
- * @return string le cookie si le mail a bien été envoyé, FALSE sinon
+ * @param string $newmail Nouveau mail souhait� pour le membre.
+ * @return string le cookie si le mail a bien �t� envoy�, FALSE sinon
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global string $L_HOSTING
+ * @global string $L_FQDN
+ * @global m_mem $mem
+ * @param type $newmail
+ * @return boolean
+ */
function ChangeMail1($newmail) {
global $err,$db,$L_HOSTING,$L_FQDN,$cuid;
$err->log("mem","changemail1",$newmail);
@@ -488,9 +583,7 @@ Cordially.
}
$db->next_record();
- // un cookie de 20 caractères pour le mail
$COOKIE=substr(md5(uniqid(rand(), true)),0,20);
- // et de 6 pour la clé à entrer. ca me semble suffisant...
$KEY=substr(md5(uniqid(rand(), true)),0,6);
$link="https://$L_FQDN/mem_cm.php?usr=$cuid&cookie=$COOKIE";
$txt=sprintf(_("Hello,
@@ -513,22 +606,30 @@ again, please contact your server's administrator.
Cordially.
"), $db->f("login"), $L_HOSTING, $link);
mail($newmail,"Email modification request on $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN");
- // Supprime les demandes précédentes de ce compte !
$db->query("DELETE FROM chgmail WHERE uid='$cuid';");
$db->query("INSERT INTO chgmail (cookie,ckey,uid,mail,ts) VALUES ('$COOKIE','$KEY','$cuid','$newmail',".time().");");
- // Supprime les cookies de la veille :)
$lts=time()-86400;
$db->query("DELETE FROM chgmail WHERE ts<'$lts';");
return $KEY;
}
- /* ----------------------------------------------------------------- */
- /** Change le mail d'un membre (seconde etape, CookiE+clé = application)
- * @param string $COOKIE Cookie envoyé par mail
- * @param string $KEY clé affichée à l'écran
- * @param integer $uid Utilisateur concerné (on est hors session)
- * @return boolean TRUE si le mail a bien été modifié, FALSE sinon
+ /** Change le mail d'un membre (seconde etape, CookiE+cl� = application)
+ * @param string $COOKIE Cookie envoy� par mail
+ * @param string $KEY cl� affich�e � l'�cran
+ * @param integer $uid Utilisateur concern� (on est hors session)
+ * @return boolean TRUE si le mail a bien �t� modifi�, FALSE sinon
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global string $L_HOSTING
+ * @global string $L_FQDN
+ * @param type $COOKIE
+ * @param type $KEY
+ * @param type $uid
+ * @return boolean
+ */
function ChangeMail2($COOKIE,$KEY,$uid) {
global $err,$db,$L_HOSTING,$L_FQDN;
$err->log("mem","changemail2",$uid);
@@ -539,39 +640,52 @@ Cordially.
}
$db->next_record();
- // met à jour le compte :
$db->query("UPDATE membres SET mail='".$db->f("mail")."' WHERE uid='$uid';");
$db->query("DELETE FROM chgmail WHERE uid='$uid';");
- // Supprime les cookies de la veille :)
$lts=time()-86400;
$db->query("DELETE FROM chgmail WHERE ts<'$lts';");
return true;
}
- /* ----------------------------------------------------------------- */
- /** Modifie le paramètre d'aide en ligne (1/0)
+ /** Modifie le param�tre d'aide en ligne (1/0)
* @param integer $show Faut-il (1) ou non (0) afficher l'aide en ligne
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $show
+ */
function set_help_param($show) {
global $db,$err,$cuid;
$err->log("mem","set_help_param",$show);
$db->query("UPDATE membres SET show_help='$show' WHERE uid='$cuid';");
}
- /* ----------------------------------------------------------------- */
- /** Dit si l'aide en ligne est demandée
- * @return boolean TRUE si l'aide en ligne est demandée, FALSE sinon.
+ /** Dit si l'aide en ligne est demand�e
+ * @return boolean TRUE si l'aide en ligne est demand�e, FALSE sinon.
*/
+ /**
+ *
+ * @return type
+ */
function get_help_param() {
return $this->user["show_help"];
}
- /* ----------------------------------------------------------------- */
/** Affiche (echo) l'aide contextuelle
- * @param integer $file Numéro de fichier d'aide à afficher.
- * @return boolean TRUE si l'aide contextuelle a été trouvée, FALSE sinon
+ * @param integer $file Num�ro de fichier d'aide � afficher.
+ * @return boolean TRUE si l'aide contextuelle a �t� trouv�e, FALSE sinon
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $file
+ * @param type $force
+ * @return boolean
+ */
function show_help($file,$force=false) {
global $err;
if ($this->user["show_help"] || $force) {
@@ -592,6 +706,13 @@ Cordially.
/**
* @param integer $uid
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $uid
+ * @return boolean
+ */
function get_creator_by_uid($uid) {
global $db,$err;
$err->log("dom","get_creator_by_uid");
@@ -602,11 +723,16 @@ Cordially.
}
- /* ----------------------------------------------------------------- */
/**
* Exports all the personnal user related information for an account.
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return string
+ */
function alternc_export_conf() {
global $db,$err;
$err->log("mem","export");
@@ -626,6 +752,12 @@ Cordially.
return $str;
}
+ /**
+ *
+ * @global int $uid
+ * @param type $v
+ * @return boolean
+ */
function session_tempo_params_get($v) {
global $uid;
if (empty($_COOKIE['session'])) return false;
@@ -641,6 +773,14 @@ Cordially.
return false;
}
+ /**
+ *
+ * @global int $uid
+ * @param type $k
+ * @param type $v
+ * @param type $ecrase
+ * @return boolean
+ */
function session_tempo_params_set($k, $v, $ecrase=false) {
global $uid;
if (empty($_COOKIE['session'])) return false;
@@ -658,6 +798,4 @@ Cordially.
return true;
}
-} /* Classe Membre */
-
-?>
+} /* Classe Membre */
\ No newline at end of file
diff --git a/bureau/class/m_menu.php b/bureau/class/m_menu.php
index 131e98a5..a01bad4a 100644
--- a/bureau/class/m_menu.php
+++ b/bureau/class/m_menu.php
@@ -30,13 +30,22 @@
*/
class m_menu {
- /*---------------------------------------------------------------------------*/
/** Constructor
* menu([$mid]) Constructeur de la classe menu, ne fait rien pour le moment
*/
+ /**
+ *
+ */
function m_menu() {
}
+ /**
+ *
+ * @global m_hooks $hooks
+ * @global m_quota $quota
+ * @global m_mem $mem
+ * @return type
+ */
function getmenu() {
global $hooks, $quota, $mem;
@@ -97,11 +106,23 @@ class m_menu {
return $lst;
} //getmenu
+ /**
+ *
+ * @param type $a
+ * @param type $b
+ * @return type
+ */
function order_menu($a, $b) {
// Use to order the menu with a usort
return $a['pos'] > $b['pos'];
}
+ /**
+ * @global string $help_baseurl
+ * @global array $lang_translation
+ * @global array $locales
+ * @return type
+ */
function system_menu() {
// Here some needed menu who don't have a class
global $help_baseurl, $lang_translation, $locales;
diff --git a/bureau/class/m_mysql.php b/bureau/class/m_mysql.php
index a9b10bbf..14eb1813 100644
--- a/bureau/class/m_mysql.php
+++ b/bureau/class/m_mysql.php
@@ -40,6 +40,13 @@ class DB_users extends DB_Sql {
/**
* Creator
*/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $empty
+ */
function DB_users($empty=false) { // Sometimes we need to create this object with empty parameters, but by default we fill them with those of the current user's DB
global $cuid, $db, $err;
@@ -80,6 +87,10 @@ class m_mysql {
/** Constructor
* m_mysql([$mid]) Constructeur de la classe m_mysql, initialise le membre concerne
*/
+ /**
+ *
+ * @global m_mem $mem
+ */
function m_mysql() {
global $cuid;
if (!empty($cuid)) {
@@ -88,10 +99,18 @@ class m_mysql {
variable_get('sql_allow_users_backups', 1,'Set 1 to allow users to configure backup of their databases, 0 if you want do disable this feature. Warning: it will not stop configured backup made by sqlbackup.sh');
}
+ /**
+ *
+ */
function reload_dbus() {
$this->dbus = new DB_users();
}
+ /**
+ *
+ * @global m_mysql $db
+ * @return type
+ */
function list_db_servers() {
global $db;
$db->query("select d.*, IFNULL(count(m.uid),0) as nb_users from db_servers d left join membres m on d.id = m.db_server_id group by d.id,m.db_server_id order by d.name,d.id;");
@@ -102,6 +121,11 @@ class m_mysql {
return $c;
}
+ /**
+ *
+ * @global m_quota $quota
+ * @return type
+ */
function hook_menu() {
global $quota;
$q = $quota->getquota("mysql");
@@ -141,6 +165,10 @@ class m_mysql {
/**
* Password kind used in this class (hook for admin class)
*/
+ /**
+ *
+ * @return type
+ */
function alternc_password_policy() {
return array("mysql"=>"MySQL users");
}
@@ -152,6 +180,14 @@ class m_mysql {
* "dir" => Backup folder.
* Returns an array (empty) if no databases
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @return type
+ */
function get_dblist() {
global $db,$err,$bro,$cuid;
$err->log("mysql","get_dblist");
@@ -170,6 +206,13 @@ class m_mysql {
* @return array returns an associative array with login and password
* Returns FALSE if error
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_err $err
+ * @return boolean
+ */
function php_myadmin_connect(){
global $db,$cuid,$err;
$err->log("mysql","php_myadmin_connect");
@@ -201,6 +244,16 @@ class m_mysql {
* "gzip" => Does we compress the dumps ?
* Returns FALSE if the user has no database of if the database does not exist.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param type $dbn
+ * @return type
+ */
function get_mysql_details($dbn) {
global $db,$err,$bro,$mem,$cuid;
$root=getuserpath();
@@ -224,6 +277,13 @@ class m_mysql {
return array("enabled"=>true,"login"=>$db->f("login"),"db"=>$db->f("db"), "name"=>$dbn,"bck"=>$db->f("bck_mode"), "dir"=>substr($db->f("bck_dir"),strlen($root)), "size"=>$size, "pass"=>$db->f("pass"), "history"=>$db->f("bck_history"), "gzip"=>$db->f("bck_gzip"));
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $dbname
+ */
function test_get_param($dbname){
global $db,$err,$cuid;
$db->query("SELECT ");
@@ -237,6 +297,17 @@ class m_mysql {
* @return boolean if the database $user_$db has been successfully created, or FALSE if
* an error occured, such as over quota user.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $dbn
+ * @return boolean
+ */
function add_db($dbn) {
global $db,$err,$quota,$mem,$cuid,$admin;
$err->log("mysql","add_db",$dbn);
@@ -318,6 +389,15 @@ class m_mysql {
* @return boolean if the database $user_$db has been successfully deleted, or FALSE if
* an error occured, such as db does not exist.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param type $dbn
+ * @return boolean
+ */
function del_db($dbn) {
global $db,$err,$mem,$cuid;
$err->log("mysql","del_db",$dbn);
@@ -358,6 +438,20 @@ class m_mysql {
* @param $bck_dir string Directory relative to the user account where the backup will be stored
* @return boolean true if the backup parameters has been successfully changed, false if not.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @param type $dbn
+ * @param type $bck_mode
+ * @param type $bck_history
+ * @param type $bck_gzip
+ * @param type $bck_dir
+ * @return boolean
+ */
function put_mysql_backup($dbn,$bck_mode,$bck_history,$bck_gzip,$bck_dir) {
global $db,$err,$mem,$bro,$cuid;
$err->log("mysql","put_mysql_backup");
@@ -411,6 +505,16 @@ class m_mysql {
* @param $password string new password (cleartext)
* @return boolean TRUE if the password has been successfully changed, FALSE else.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $password
+ * @return boolean
+ */
function put_mysql_details($password) {
global $db,$err,$mem,$cuid,$admin;
$err->log("mysql","put_mysql_details");
@@ -453,6 +557,17 @@ class m_mysql {
* @pass : user password ( optional, if not given the pass stays the same, else it takes the new value )
* @table : sql tables to apply rights
**/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @param string $base
+ * @param type $user
+ * @param string $rights
+ * @param type $pass
+ * @param type $table
+ * @return boolean
+ */
function grant($base,$user,$rights=null,$pass=null,$table='*'){
global $err,$db;
$err->log("mysql","grant",$base."-".$rights."-".$user);
@@ -509,6 +624,18 @@ class m_mysql {
* @param $id integer The ID of the database to dump to.
* @return boolean TRUE if the database has been restored, or FALSE if an error occurred
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @global string $L_MYSQL_HOST
+ * @global m_mysql $db
+ * @param type $file
+ * @param type $stdout
+ * @param type $id
+ * @return boolean
+ */
function restore($file,$stdout,$id) {
global $err,$bro,$mem,$L_MYSQL_HOST,$db;
if (empty($file)) {
@@ -557,6 +684,13 @@ class m_mysql {
* @return integer database size
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $dbname
+ * @return type
+ */
function get_db_size($dbname) {
global $db,$err;
@@ -574,6 +708,15 @@ class m_mysql {
/**
* Returns the list of database users of an account
**/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @param type $all
+ * @return type
+ */
function get_userslist($all=null) {
global $db,$err,$bro,$cuid;
$err->log("mysql","get_userslist");
@@ -596,6 +739,15 @@ class m_mysql {
return $c;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_bro $bro
+ * @global m_mem $mem
+ * @param type $dbn
+ * @return array
+ */
function get_defaultsparam($dbn){
global $db,$err,$bro,$cuid;
$err->log("mysql","getdefaults");
@@ -692,6 +844,19 @@ class m_mysql {
* @param string $passconf The password confirmation
* @return boolean if the user has been created in MySQL or FALSE if an error occurred
**/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $usern
+ * @param type $password
+ * @param type $passconf
+ * @return boolean
+ */
function add_user($usern,$password,$passconf) {
global $db,$err,$quota,$mem,$cuid,$admin;
$err->log("mysql","add_user",$usern);
@@ -756,6 +921,19 @@ class m_mysql {
* @param $passconf The password confirmation
* @return boolean if the password has been changed in MySQL or FALSE if an error occurred
**/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_quota $quota
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_admin $admin
+ * @param type $usern
+ * @param type $password
+ * @param type $passconf
+ * @return boolean
+ */
function change_user_password($usern,$password,$passconf) {
global $db,$err,$quota,$mem,$cuid,$admin;
$err->log("mysql","change_user_pass",$usern);
@@ -788,6 +966,16 @@ class m_mysql {
* @param integer $all
* @return boolean if the user has been deleted in MySQL or FALSE if an error occurred
**/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param type $user
+ * @param type $all
+ * @return boolean
+ */
function del_user($user,$all=null) {
global $db,$err,$mem,$cuid;
$err->log("mysql","del_user",$user);
@@ -826,6 +1014,15 @@ class m_mysql {
* @return array An array of database name and rights
**/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param type $user
+ * @return boolean|string
+ */
function get_user_dblist($user){
global $db,$err,$mem,$cuid;
@@ -874,6 +1071,16 @@ class m_mysql {
* @return boolean TRUE if the rights has been applied or FALSE if an error occurred
*
**/
+ /**
+ *
+ * @global m_mem $mem
+ * @global m_err $err
+ * @global m_mysql $db
+ * @param type $user
+ * @param type $dbn
+ * @param type $rights
+ * @return boolean
+ */
function set_user_rights($user,$dbn,$rights) {
global $mem,$err,$db;
$err->log("mysql","set_user_rights");
@@ -881,7 +1088,7 @@ class m_mysql {
$usern=addslashes($user);
$dbname=addslashes($dbn);
$dbname=str_replace('_','\_',$dbname);
- // On génère les droits en fonction du tableau de droits
+ // On g�n�re les droits en fonction du tableau de droits
$strrights="";
for( $i=0 ; $ilog("mysql","alternc_get_quota");
@@ -987,6 +1204,13 @@ class m_mysql {
* @return integer the number of service used or false if an error occured
* @access private
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @return type
+ */
function hook_quota_get() {
global $err,$db,$cuid;
$err->log("mysql","alternc_get_quota");
@@ -1003,6 +1227,14 @@ class m_mysql {
* AlternC's standard function that create a member
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @return boolean
+ */
function alternc_add_member() {
global $db,$err,$cuid,$mem;
$err->log("mysql","alternc_add_member");
@@ -1030,6 +1262,13 @@ class m_mysql {
* AlternC's standard function that delete a member
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return boolean
+ */
function alternc_del_member() {
global $db,$err,$cuid;
$err->log("mysql","alternc_del_member");
@@ -1054,6 +1293,9 @@ class m_mysql {
* We just remove the cookie created in admin/sql_admin.php
a @access private
*/
+ /**
+ *
+ */
function alternc_del_session() {
$_SESSION['PMA_single_signon_user'] = '';
$_SESSION['PMA_single_signon_password'] = '';
@@ -1067,6 +1309,13 @@ class m_mysql {
* @access private
* EXPERIMENTAL 'sid' function ;)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return string
+ */
function alternc_export_conf() {
//TODO don't work with separated sql server for dbusers
global $db,$err,$cuid;
@@ -1099,6 +1348,14 @@ class m_mysql {
* @access private
* EXPERIMENTAL 'sid' function ;)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @param string $dir
+ */
function alternc_export_data ($dir){
global $db, $err, $cuid,$mem;
$err->log("mysql","export_data");
@@ -1126,6 +1383,17 @@ class m_mysql {
* @param $db_client the client to access the SQL db
* @return an array associating the name of the databases to their sizes : array(dbname=>size)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $db_name
+ * @param type $db_host
+ * @param type $db_login
+ * @param type $db_password
+ * @param type $db_client
+ * @return type
+ */
function get_dbus_size($db_name,$db_host,$db_login,$db_password,$db_client) {
global $db,$err;
$err->log("mysql","get_dbus_size",$db_host);
@@ -1155,4 +1423,3 @@ class m_mysql {
} /* Class m_mysql */
-?>
diff --git a/bureau/class/m_piwik.php b/bureau/class/m_piwik.php
index 58940475..510557f3 100644
--- a/bureau/class/m_piwik.php
+++ b/bureau/class/m_piwik.php
@@ -32,6 +32,11 @@ class m_piwik {
var $alternc_users;
var $alternc_sites;
+ /**
+ *
+ * @global m_quota $quota
+ * @return boolean|int
+ */
function hook_menu() {
global $quota;
if ( empty($this->piwik_server_uri) || empty($this->piwik_admin_token)) return false;
@@ -50,9 +55,11 @@ class m_piwik {
return $obj;
}
- /*---------------------------------------------------------------------------*/
/** Constructor
*/
+ /**
+ *
+ */
function m_piwik() {
$this->piwik_server_uri=variable_get('piwik_server_uri',null,'Remote Piwik server uri');
$this->piwik_admin_token=variable_get('piwik_admin_token',null,'Remote Piwik super-admin token');
@@ -60,21 +67,31 @@ class m_piwik {
$this->alternc_sites = $this->get_alternc_sites();
}
- /* ----------------------------------------------------------------- */
+
/** hook called when an AlternC account is deleted
*/
+ /**
+ *
+ * @return boolean
+ */
function hook_admin_del_member() {
//FIXME : implement the hook_admin_del_member for piwik
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Returns the used quota for the $name service for the current user.
* @param $name string name of the quota
* @return integer the number of service used or false if an error occured
* @access private
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @return type
+ */
function hook_quota_get() {
global $db, $cuid;
$db->query("SELECT COUNT(id) AS nb FROM piwik_users WHERE uid='$cuid'");
@@ -86,6 +103,10 @@ class m_piwik {
}
+ /**
+ *
+ * @return type
+ */
function url() {
return $this->piwik_server_uri;
}
@@ -96,6 +117,16 @@ class m_piwik {
/***********************/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_mem $mem
+ * @global m_err $err
+ * @param type $user_login
+ * @param type $user_mail
+ * @return boolean
+ */
function user_add($user_login, $user_mail = null) {
global $db, $mem, $cuid, $err;
@@ -120,15 +151,31 @@ class m_piwik {
// Edite un user
+ /**
+ *
+ * @return boolean
+ */
function user_edit() {
//FIXME
return true;
}
+ /**
+ *
+ * @param type $user_login
+ * @return type
+ */
function get_site_access($user_login) {
return $this->call_privileged_page('API', 'UsersManager.getSitesAccessFromUser', array('userLogin' => $user_login));
}
+ /**
+ *
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $site_id
+ * @return boolean
+ */
function get_users_access_from_site($site_id) {
global $err, $cuid;
@@ -157,6 +204,11 @@ class m_piwik {
/**
* @param string $user_login
*/
+ /**
+ *
+ * @param type $user_login
+ * @return boolean
+ */
function get_user($user_login) {
$api_data = $this->call_privileged_page('API', 'UsersManager.getUser', array('userLogin' => $user_login));
@@ -166,6 +218,13 @@ class m_piwik {
return FALSE;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @staticvar array $alternc_users
+ * @return array
+ */
function get_alternc_users() {
global $db, $cuid;
@@ -178,6 +237,14 @@ class m_piwik {
}
// Supprime l'utilisateur Piwik passé en parametre
// Ne le supprime pas localement tant que pas supprimé en remote
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_err $err
+ * @param type $piwik_user_login
+ * @return boolean
+ */
function user_delete($piwik_user_login) {
global $db, $cuid, $err;
@@ -199,6 +266,12 @@ class m_piwik {
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @return type
+ */
function users_list() {
global $db, $cuid;
$db->query("SELECT login FROM piwik_users WHERE uid = '$cuid'");
@@ -212,6 +285,11 @@ class m_piwik {
// Verifie que l'utilisateur existe bien dans piwik
+ /**
+ *
+ * @param type $puser_id
+ * @return boolean
+ */
function user_checkremote($puser_id) {
//FIXME
return true;
@@ -219,12 +297,20 @@ class m_piwik {
// Récupére un token pour le SSO avec piwik pour l'user
+ /**
+ *
+ * @return boolean
+ */
function user_remoteauth() {
//FIXME
return true;
}
// Montre la liste des site pour lesques un user à accés
+ /**
+ *
+ * @return boolean
+ */
function user_access() {
// FIXME
return true;
@@ -239,6 +325,10 @@ class m_piwik {
/***********************/
+ /**
+ *
+ * @return \stdClass|boolean
+ */
function site_list() {
$api_data = $this->call_privileged_page('API', 'SitesManager.getAllSites');
$data = array();
@@ -270,10 +360,22 @@ class m_piwik {
return FALSE;
}
+ /**
+ *
+ * @param type $site_id
+ * @return type
+ */
function site_js_tag($site_id) {
return $this->call_privileged_page('API', 'SitesManager.getJavascriptTag', array('idSite' => $site_id, 'piwikUrl' => $this->piwik_server_uri))->value;
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @staticvar array $alternc_sites
+ * @return array
+ */
function get_alternc_sites() {
global $db, $cuid;
@@ -285,12 +387,23 @@ class m_piwik {
return $alternc_sites;
}
+ /**
+ *
+ * @return type
+ */
function get_site_list()
{
return $this->call_privileged_page('API', 'SitesManager.getAllSites');
}
// Ajoute un site à Piwik
// can't figure out how to pass multiple url through the API
+ /**
+ *
+ * @param type $siteName
+ * @param type $urls
+ * @param type $ecommerce
+ * @return boolean
+ */
function site_add($siteName, $urls, $ecommerce = FALSE) {
$urls = is_array($urls) ? implode(',', $urls) : $urls;
$api_data = $this->call_privileged_page('API', 'SitesManager.addSite', array('siteName' => $siteName, 'urls' => $urls));
@@ -301,6 +414,14 @@ class m_piwik {
//SitesManager.deleteSite (idSite)
// Supprime un site de Piwik
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @global m_err $err
+ * @param type $site_id
+ * @return boolean
+ */
function site_delete($site_id) {
global $db, $cuid, $err;
@@ -323,6 +444,14 @@ class m_piwik {
}
+ /**
+ *
+ * @global m_err $err
+ * @param type $site_id
+ * @param type $login
+ * @param type $right
+ * @return boolean
+ */
function site_set_user_right($site_id, $login, $right)
{
global $err;
@@ -337,6 +466,10 @@ class m_piwik {
}
}
// Ajoute un alias sur un site existant
+ /**
+ *
+ * @return boolean
+ */
function site_alias_add() {
// FIXME
return true;
@@ -346,11 +479,19 @@ class m_piwik {
/* Helper code FIXME: rename those function using "private" + "_" prefix */
+ /**
+ *
+ * @param type $username
+ * @return type
+ */
function clean_user_name($username) {
return mysql_real_escape_string(trim($username));
}
+ /**
+ *
+ */
function dev() {
// $this->call_page('module', 'method', array('user' => 'fser', 'pass' => 'toto'));
// return $this->users_list();
@@ -361,6 +502,15 @@ class m_piwik {
* @param string $module
* @param string $method
*/
+ /**
+ *
+ * @global m_err $err
+ * @param type $module
+ * @param type $method
+ * @param type $arguments
+ * @param type $output
+ * @return boolean
+ */
function call_page($module, $method, $arguments=array(), $output = 'JSON') {
global $err;
$url = sprintf('%s/?module=%s&method=%s&format=%s', $this->piwik_server_uri, $module, $method, $output);
@@ -391,6 +541,14 @@ class m_piwik {
* @param string $module
* @param string $method
*/
+ /**
+ *
+ * @param type $module
+ * @param type $method
+ * @param array $arguments
+ * @param type $output
+ * @return type
+ */
function call_privileged_page($module, $method, $arguments=array(), $output = 'JSON') {
$arguments['token_auth'] = $this->piwik_admin_token;
return $this->call_page($module, $method, $arguments, $output);
diff --git a/bureau/class/m_quota.php b/bureau/class/m_quota.php
index ac7ab96d..96c3118a 100644
--- a/bureau/class/m_quota.php
+++ b/bureau/class/m_quota.php
@@ -44,10 +44,13 @@ class m_quota {
var $clquota; // Which class manage which quota.
- /* ----------------------------------------------------------------- */
+
/**
* Constructor
*/
+ /**
+ *
+ */
function m_quota() {
$this->disk_quota_enable = variable_get('disk_quota_enable', 1,'Are disk quota enabled for this server', array('desc'=>'Enabled','type'=>'boolean'));
if ( $this->disk_quota_enable ) {
@@ -60,6 +63,10 @@ class m_quota {
_("quota_web");
}
+ /**
+ *
+ * @return type
+ */
function hook_menu() {
$obj = array(
'title' => _("Show my quotas"),
@@ -82,22 +89,33 @@ class m_quota {
return $obj;
}
- /* ----------------------------------------------------------------- */
+
/** Check if a user can use a ressource.
* @param string $ressource the ressource name (a named quota)
* @Return TRUE if the user can create a ressource (= is there any quota left ?)
* @return boolean
*/
+ /**
+ *
+ * @param type $ressource
+ * @return type
+ */
function cancreate($ressource="") {
$t=$this->getquota($ressource);
return $t["u"]<$t["t"];
}
- /* ----------------------------------------------------------------- */
+
/** List the quota-managed services in the server
* @Return array the quota names and description (translated)
*/
+ /**
+ *
+ * @global array $classes
+ * @global m_hooks $hooks
+ * @return type
+ */
function qlist() {
global $classes,$hooks;
$qlist=array();
@@ -122,6 +140,12 @@ class m_quota {
* If the quota entry doesn't exist for the user, create it with
* the defaults value.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return boolean
+ */
function synchronise_user_profile() {
global $db,$err;
$err->log("quota","synchronise_user_profile");
@@ -135,6 +159,13 @@ class m_quota {
* when a new quota appear
*
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_quota $quota
+ * @global m_err $err
+ * @return boolean
+ */
function create_missing_quota_profile() {
global $db,$quota,$err;
$err->log("quota","create_missing_quota_profile");
@@ -148,11 +179,23 @@ class m_quota {
return true;
}
- /* ----------------------------------------------------------------- */
+
/** Return a ressource usage (u) and total quota (t)
* @param string $ressource ressource to get quota of
* @Return array the quota used and total for this ressource (or for all ressource if unspecified)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @global array $get_quota_cache
+ * @global m_hooks $hooks
+ * @global m_mem $mem
+ * @param type $ressource
+ * @param type $recheck
+ * @return int
+ */
function getquota($ressource="",$recheck=false) {
global $db,$err,$cuid,$get_quota_cache,$hooks,$mem;
$err->log("quota","getquota",$ressource);
@@ -219,11 +262,20 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Set the quota for a user (and for a ressource)
* @param string $ressource ressource to set quota of
* @param integer size of the quota (available or used)
*/
+ /**
+ *
+ * @global m_err $err
+ * @global m_mysql $db
+ * @global m_mem $mem
+ * @param type $ressource
+ * @param string $size
+ * @return boolean
+ */
function setquota($ressource,$size) {
global $err,$db,$cuid;
$err->log("quota","setquota",$ressource."/".$size);
@@ -249,10 +301,17 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/**
* Erase all quota information about the user.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return boolean
+ */
function delquotas() {
global $db,$err,$cuid;
$err->log("quota","delquota");
@@ -261,10 +320,15 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Get the default quotas as an associative array
* @return array the array of the default quotas
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @return type
+ */
function getdefaults() {
global $db;
$c=array();
@@ -282,10 +346,16 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Set the default quotas
* @param array associative array of quota (key=>val)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $newq
+ * @return boolean
+ */
function setdefaults($newq) {
global $db;
$qlist=$this->qlist();
@@ -302,11 +372,18 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Add an account type for quotas
* @param string $type account type to be added
* @return boolean true if all went ok
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @param type $type
+ * @return boolean
+ */
function addtype($type) {
global $db,$err;
$qlist=$this->qlist();
@@ -325,10 +402,15 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** List for quotas
* @return array
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @return type
+ */
function listtype() {
global $db;
$db->query("SELECT distinct(type) FROM defquotas ORDER by type");
@@ -340,11 +422,17 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Delete an account type for quotas
* @param string $type account type to be deleted
* @return boolean true if all went ok
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @param type $type
+ * @return boolean
+ */
function deltype($type) {
global $db;
@@ -357,10 +445,17 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Create default quotas entries for a new user.
* The user we are talking about is in the global $cuid.
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @return boolean
+ */
function addquotas() {
global $db,$err,$cuid;
$err->log("quota","addquota");
@@ -384,13 +479,19 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Return a quota value with its unit (when it is a space quota)
* in MB, GB, TB ...
* @param string $type The quota type
* @param integer $value The quota value
* @return string a quota value with its unit.
*/
+ /**
+ *
+ * @param type $type
+ * @param type $value
+ * @return type
+ */
function display_val($type, $value) {
switch ($type) {
case 'bw_web':
@@ -404,6 +505,14 @@ class m_quota {
/* get size_xx function (filled by spoolsize.php) */
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sql
+ * @return type
+ */
function _get_sum_sql($sql) {
global $db,$err,$cuid;
$db->query($sql);
@@ -416,6 +525,14 @@ class m_quota {
}
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sql
+ * @return int
+ */
function _get_count_sql($sql) {
global $db,$err,$cuid;
$db->query($sql);
@@ -428,6 +545,14 @@ class m_quota {
}
}
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @global m_mem $mem
+ * @param type $sql
+ * @return type
+ */
function _get_size_and_record_sql($sql) {
global $db,$err,$cuid;
$db->query($sql);
@@ -443,97 +568,186 @@ class m_quota {
}
/* sum of websites sizes from all users */
+ /**
+ *
+ * @return type
+ */
function get_size_web_sum_all() {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_web;");
}
/* sum of websites sizes from one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_web_sum_user($u) {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_web WHERE uid='$u';");
}
/* sum of mailbox sizes from all domains */
+ /**
+ *
+ * @return type
+ */
function get_size_mail_sum_all() {
return $this->_get_sum_sql("SELECT SUM(bytes) AS sum FROM mailbox;");
}
/* sum of mailbox sizes for one domain */
+ /**
+ *
+ * @global m_mail $mail
+ * @param type $dom
+ * @return type
+ */
function get_size_mail_sum_domain($dom) {
global $mail;
return $mail->get_total_size_for_domain($dom);
}
/* count of mailbox sizes from all domains */
+ /**
+ *
+ * @return type
+ */
function get_size_mail_count_all() {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM mailbox;");
}
/* count of mailbox for one domain */
+ /**
+ *
+ * @param type $dom
+ * @return type
+ */
function get_size_mail_count_domain($dom) {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM dovecot_view WHERE user LIKE '%@{$dom}'");
}
/* get list of mailbox alias and size for one domain */
+ /**
+ *
+ * @param type $dom
+ * @return type
+ */
function get_size_mail_details_domain($dom) {
return $this->_get_size_and_record_sql("SELECT user as alias,quota_dovecot as size FROM dovecot_view WHERE user LIKE '%@{$dom}' ORDER BY alias;");
}
/* sum of mailman lists sizes from all domains */
+ /**
+ *
+ * @return type
+ */
function get_size_mailman_sum_all() {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_mailman;");
}
/* sum of mailman lists sizes for one domain */
+ /**
+ *
+ * @param type $dom
+ * @return type
+ */
function get_size_mailman_sum_domain($dom) {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_mailman WHERE list LIKE '%@{$dom}'");
}
/* sum of mailman lists for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_mailman_sum_user($u) {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_mailman WHERE uid = '{$u}'");
}
/* count of mailman lists sizes from all domains */
+ /**
+ *
+ * @return type
+ */
function get_size_mailman_count_all() {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM size_mailman;");
}
/* count of mailman lists for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_mailman_count_user($u) {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM size_mailman WHERE uid = '{$u}'");
}
/* get list of mailman list and size for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_mailman_details_user($u) {
return $this->_get_size_and_record_sql("SELECT s.size,CONCAT(m.list,'@',m.domain) as list FROM size_mailman s LEFT JOIN mailman m ON s.list=m.name WHERE s.uid='{$u}' ORDER BY s.list ASC");
}
/* sum of databases sizes from all users */
+ /**
+ *
+ * @return type
+ */
function get_size_db_sum_all() {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_db;");
}
/* sum of databases sizes for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_db_sum_user($u) {
return $this->_get_sum_sql("SELECT SUM(size) AS sum FROM size_db WHERE db = '{$u}' OR db LIKE '{$u}\_%'");
}
/* count of databases from all users */
+ /**
+ *
+ * @return type
+ */
function get_size_db_count_all() {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM size_db;");
}
/* count of databases for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_db_count_user($u) {
return $this->_get_count_sql("SELECT COUNT(*) AS count FROM size_db WHERE db = '{$u}' OR db LIKE '{$u}\_%'");
}
/* get list of databases name and size for one user */
+ /**
+ *
+ * @param type $u
+ * @return type
+ */
function get_size_db_details_user($u) {
return $this->_get_size_and_record_sql("SELECT db,size FROM size_db WHERE db='{$u}' OR db LIKE '{$u}\_%';");
}
/* Return appropriate value and unit of a size given in Bytes (e.g. 1024 Bytes -> return 1 KB) */
+ /**
+ *
+ * @param type $size
+ * @return type
+ */
function get_size_unit($size) {
$units=array(1073741824=>_("GB"), 1048576=>_("MB"), 1024=>_("KB"), 0=>_("B"));
foreach($units as $value=>$unit){
@@ -549,6 +763,11 @@ class m_quota {
// 0 = Pas de changement de couleur
// 1 = Progression du vert vers le rouge en fonction du porcentage
// 2 = Progression du rouge vers le vert en fonction du porcentage
+ /**
+ *
+ * @param type $usage
+ * @param type $color_type
+ */
function quota_displaybar($usage, $color_type=1) {
if ($color_type == 1) {
$csscolor = " background-color:".PercentToColor($usage);
@@ -568,21 +787,28 @@ class m_quota {
/* ==== Hook functions ==== */
- /* ----------------------------------------------------------------- */
+
/** Hook function call when a user is deleted
* AlternC's standard function called when a user is deleted
* globals $cuid is the appropriate user
*/
+ /**
+ *
+ */
function hook_admin_del_member() {
$this->delquotas();
}
- /* ----------------------------------------------------------------- */
+
/** Hook function called when a user is created
* This function initialize the user's quotas.
* globals $cuid is the appropriate user
*/
+ /**
+ *
+ * @global m_err $err
+ */
function hook_admin_add_member() {
global $err;
$err->log("quota","hook_admin_add_member");
@@ -591,11 +817,17 @@ class m_quota {
}
- /* ----------------------------------------------------------------- */
+
/** Exports all the quota related information for an account.
* @access private
* EXPERIMENTAL function ;)
*/
+ /**
+ *
+ * @global m_mysql $db
+ * @global m_err $err
+ * @return string
+ */
function alternc_export_conf() {
global $db,$err;
$err->log("quota","export");
diff --git a/bureau/class/m_variables.php b/bureau/class/m_variables.php
index 06c3dcaf..f0bf7155 100644
--- a/bureau/class/m_variables.php
+++ b/bureau/class/m_variables.php
@@ -79,7 +79,7 @@ class m_variables {
* with variable_set() as well as those explicitly specified in the configuration
* file.
*
- * @global int $cuid
+ * @global int $cuid
* @return array
*/
function variable_init() {
diff --git a/bureau/class/reset_stats_conf.php b/bureau/class/reset_stats_conf.php
index f70af959..df7387af 100644
--- a/bureau/class/reset_stats_conf.php
+++ b/bureau/class/reset_stats_conf.php
@@ -1,5 +1,7 @@
enabled) {
diff --git a/bureau/class/vm.class.php b/bureau/class/vm.class.php
index 17911441..dfc2dfe0 100644
--- a/bureau/class/vm.class.php
+++ b/bureau/class/vm.class.php
@@ -1,5 +1,8 @@