diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index 699c06ad..acfb2504 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -46,9 +46,11 @@ class m_admin { var $archive=''; - - /* ----------------------------------------------------------------- */ - /** Constructor + /** + * Constructor + * + * @global type $db + * @global type $cuid */ function m_admin() { global $db,$cuid; @@ -66,7 +68,14 @@ class m_admin { ); $this->archive=variable_get('archive_del_data','','If folder specified html folder of deleted user is archived, else it is deleted. '); } - + /** + * + * @global type $mem + * @global type $cuid + * @global type $debug_alternc + * @global type $L_INOTIFY_UPDATE_DOMAIN + * @return boolean|string + */ function hook_menu() { global $mem, $cuid, $debug_alternc, $L_INOTIFY_UPDATE_DOMAIN; if (!$mem->checkRight()) return false; @@ -136,6 +145,9 @@ class m_admin { return $obj; } + /** + * + */ function stop_if_jobs_locked() { if ( file_exists(ALTERNC_LOCK_JOBS)) { echo "There is a file ".ALTERNC_LOCK_JOBS."\n"; @@ -145,7 +157,13 @@ class m_admin { } } - # return the uid of an alternc account + /** + * return the uid of an alternc account + * + * @global type $db + * @param type $login + * @return null + */ function get_uid_by_login($login) { global $db; $db->query("SELECT uid FROM membres WHERE login='$login';"); @@ -156,14 +174,19 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** Returns the known information about a hosted account + /** + * Returns the known information about a hosted account * * Returns all what we know about an account (contents of the tables * membres et local) * Ckecks if the account is super-admin - * @param integer $uid a unique integer identifying the account - * @return an associative array containing all the fields of the + * + * @global type $err + * @global type $db + * @global string $lst_users_properties + * @param int $uid a unique integer identifying the account + * @param boolean $recheck + * @return array|boolean an associative array containing all the fields of the * table membres and local of the corresponding account. * Returns FALSE if an error occurs. */ @@ -213,9 +236,15 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** Returns the known information about a specific hosted account + /** + * Returns the known information about a specific hosted account + * * Similar to get_list() but for creators/resellers. + * + * @global type $err + * @global type $db + * @param int $uid + * @return boolean */ function get_creator($uid) { global $err,$db; @@ -257,8 +286,9 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** @return boolean if there's only ONE admin account + /** + * + * @global type $db * @return boolean TRUE if there is only one admin account * (allow the program to prevent the destruction of the last admin account) */ @@ -270,14 +300,23 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** Returns the list of the hosted accounts + /** + * Returns the list of the hosted accounts * * Returns all what we know about ALL the accounts (contents of the tables * membres et local) * Check for super-admin accounts * @param - * @return an associative array containing all the fields of the + * @return + * + * @global type $err + * @global type $mem + * @global type $cuid + * @param boolean $all + * @param boolean $creator + * @param string $pattern + * @param string $pattern_type + * @return boolean | array an associative array containing all the fields of the * table membres and local of all the accounts. * Returns FALSE if an error occurs. */ @@ -358,13 +397,18 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** Send an email to all AlternC's accounts - * @param $subject string Subject of the email to send - * @param $message string Message to send - * @param $from string expeditor of that email. - * @return boolean if the mail has been successfully sent. - */ + /** + * Send an email to all AlternC's accounts + * + * @global type $err + * @global type $mem + * @global type $cuid + * @global type $db + * @param string $subject Subject of the email to send + * @param string $message Message to send + * @param string $from Expeditor of that email + * @return boolean + */ function mailallmembers($subject,$message,$from) { global $err,$mem,$cuid,$db; $err->log("admin","mailallmembers"); @@ -397,11 +441,16 @@ class m_admin { } - /* ----------------------------------------------------------------- */ - /** Returns an array with the known information about resellers (uid, login, number of accounts) + /** + * Returns an array with the known information about resellers (uid, login, number of accounts) * Does not include account 2000 in the list. * May only be called by the admin account (2000) * If there are no reseller accounts, returns an empty array. + * + * @global type $err + * @global type $mem + * @global type $cuid + * @return boolean */ function get_creator_list() { global $err,$mem,$cuid; @@ -428,10 +477,15 @@ class m_admin { return $creators2; } - /* ----------------------------------------------------------------- */ - /** Check if I am the creator of the member $uid - * @param integer $uid a unique integer identifying the account - * @return boolean TRUE if I am the creator of that account. FALSE else. + /** + * Check if I am the creator of the member $uid + * + * @global type $err + * @global type $mem + * @global type $db + * @global type $cuid + * @param int $uid a unique integer identifying the account + * @return boolean TRUE if I am the creator of that account. FALSE else. */ function checkcreator($uid) { global $err,$mem,$db,$cuid; @@ -447,10 +501,17 @@ class m_admin { return true; } - // When the admin want to delegate a subdomain to an account - /** - * @param boolean $domain_name + * When the admin want to delegate a subdomain to an account + * + * @global m_mysql $db + * @global m_err $err + * @global m_dom $dom + * @global m_mem $mem + * @global int $cuid + * @param string $u + * @param string $domain_name + * @return boolean */ function add_shared_domain($u, $domain_name) { global $db,$err,$dom,$mem,$cuid; @@ -487,13 +548,29 @@ class m_admin { * and local). Prevents any manipulation of the account if * the account $mid is not super-admin. * - * @param $login string Login name like [a-z][a-z0-9]* - * @param $pass string Password (max. 64 characters) - * @param $nom string Name of the account owner - * @param $prenom string First name of the account owner - * @param $mail string Email address of the account owner, useful to get - * one's lost password - * @pararm $type string Account type for quotas + * + * @global m_err $err + * @global m_quota $quota + * @global array $classes + * @global int $cuid + * @global m_mem $mem + * @global string $L_MYSQL_DATABASE + * @global string $L_MYSQL_LOGIN + * @global m_hooks $hooks + * @global m_action $action + * @param string $login Login name like [a-z][a-z0-9]* + * @param string $pass Password (max. 64 characters) + * @param string $nom Name of the account owner + * @param string $prenom First name of the account owner + * @param string $mail Email address of the account owner, useful to get + * one's lost password + * @param boolean $canpass + * @param string $type Account type for quotas + * @param int $duration + * @param string $notes + * @param boolean $force + * @param boolean $create_dom + * @param int $db_server_id * @return boolean Returns FALSE if an error occurs, TRUE if not. */ function add_mem($login, $pass, $nom, $prenom, $mail, $canpass=1, $type='default', $duration=0, $notes = "", $force=0, $create_dom=false, $db_server_id) { @@ -587,9 +664,15 @@ class m_admin { } } - /* ----------------------------------------------------------------- */ - /** AlternC's standard function called when a user is created + /** + * AlternC's standard function called when a user is created * This sends an email if configured through the interface. + * + * @global m_err $err + * @global int $cuid + * @global string $L_FQDN + * @global string $L_HOSTING + * @return boolean */ function hook_admin_add_member() { global $err, $cuid, $L_FQDN, $L_HOSTING; @@ -641,23 +724,29 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Edit an account + /** + * Edit an account * * Change an account (in the tables membres * and local). Prevents any manipulation of the account if * the account $mid is not super-admin. - * - * @param $uid integer the uid number of the account we want to modify - * @param login string new login name like [a-z][a-z0-9]* - * @param $pass string new password (max. 64 characters) - * @param $nom string new name of the account owner - * @param $prenom string new first name of the account owner - * @param $mail string new email address of the account owner - * @param $enabled integer (value: 0 or 1) activates or desactivates the - * @param $type string new type of account - * access to the virtual desktop of this account. - * @return boolean Returns FALSE if an error occurs, TRUE if not. + * + * @global m_err $err + * @global m_mysql $db + * @global int $cuid + * @global m_quota $quota + * @param int $uid The uid number of the account we want to modify + * @param string $mail New email address of the account owner + * @param string $nom New name of the account owner + * @param string $prenom New first name of the account owner + * @param string $pass New password (max. 64 characters) + * @param string $enabled (value: 0 or 1) activates or desactivates the + * @param boolean $canpass + * @param int $type New type of account + * @param int $duration + * @param string $notes + * @param boolean $reset_quotas + * @return boolean Returns FALSE if an error occurs, TRUE if not */ function update_mem($uid, $mail, $nom, $prenom, $pass, $enabled, $canpass, $type='default', $duration=0, $notes = "",$reset_quotas=false) { global $err,$db; @@ -696,11 +785,15 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Lock an account + /** + * Lock an account + * * Lock an account and prevent the user to access its account. - * @param $uid integer the uid number of the account we want to lock - * @return boolean Returns FALSE if an error occurs, TRUE if not. + * + * @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. */ function lock_mem($uid) { global $err,$db; @@ -720,11 +813,16 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** UnLock an account + /** + * UnLock an account + * * UnLock an account and prevent the user to access its account. - * @param $uid integer the uid number of the account we want to unlock - * @return boolean Returns FALSE if an error occurs, TRUE if not. + * + * + * @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. */ function unlock_mem($uid) { global $err,$db; @@ -748,8 +846,17 @@ EOF; /** Deletes an account * Deletes the specified account. Prevents any manipulation of the account if * the account $mid is not super-admin. - * @param $uid integer the uid number of the account we want to delete - * @return boolean Returns FALSE if an error occurs, TRUE if not. + * + * @global m_err $err + * @global m_quota $quota + * @global array $classes + * @global int $cuid + * @global m_mem $mem + * @global m_dom $dom + * @global m_hooks $hooks + * @global m_action $action + * @param int $uid The uid number of the account + * @return boolean Returns FALSE if an error occurs, TRUE if not. */ function del_mem($uid) { global $err,$quota,$classes,$cuid,$mem,$dom,$hooks,$action; @@ -789,12 +896,16 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Renew an account + /** + * Renew an account + * * Renew an account for its duration - * @param $uid integer the uid number of the account we want to renew - * @param $periods integer the number of periods we renew for - * @return boolean Returns FALSE if an error occurs, TRUE if not. + * + * @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 + * @return boolean Returns FALSE if an error occurs, TRUE if not. */ function renew_mem($uid, $periods=1) { global $err,$db; @@ -813,11 +924,14 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Update the duration information for an account - * @param $uid integer the uid number of the account we want to update - * @param integer $duration integer the new duration, in months, of the account - * @return boolean Returns FALSE if an error occurs, TRUE if not. + /** + * Update the duration information for an account + * + * @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 + * @return boolean Returns FALSE if an error occurs, TRUE if not. */ function renew_update($uid, $duration) { global $err,$db; @@ -836,10 +950,11 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Get the expiry date for an account - * @param $uid integer The uid number of the account - * @return string The expiry date, a string as printed by MySQL + /** + * Get the expiry date for an account + * + * @param int $uid The uid number of the account + * @return string The expiry date, a string as printed by MySQL */ function renew_get_expiry($uid) { $jj=$this->get($uid); @@ -851,9 +966,11 @@ EOF; /* ----------------------------------------------------------------- */ - /** Get the expiry status for an account - * @param $uid integer The uid number of the account - * @return integer The expiry status: + /** + * Get the expiry status for an account + * + * @param int $uid The uid number of the account + * @return integer The expiry status: * 0: account does not expire * 1: expires in more than duration, * 2: expires within the duration @@ -870,9 +987,11 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Get the expired/about to expire accounts. - * @return resource The recordset of the corresponding accounts + /** + * Get the expired/about to expire accounts. + * + * @global m_mysql $db + * @return array The recordset of the corresponding accounts */ function renew_get_expiring_accounts() { global $db; @@ -894,11 +1013,13 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Turns a common account into a super-admin account - * @param $uid integer the uid number of the common account we want to turn into a - * super-admin account. - * @return boolean FALSE if an error occurs, TRUE if not. + /** + * Turns a common account into a super-admin account + * + * @global m_err $err + * @global m_mysql $db + * @param int $uid The uid number of the account + * @return boolean */ function normal2su($uid) { global $err,$db; @@ -916,11 +1037,13 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Turns a super-admin account into a common account - * @param $uid integer the uid number of the super-admin account we want to turn into a - * common account. - * @return boolean Returns FALSE if an error occurs, TRUE if not. + /** + * Turns a super-admin account into a common account + * + * @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. */ function su2normal($uid) { global $err,$db; @@ -938,15 +1061,17 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** List of the authorized TLDs + /** + * List of the authorized TLDs * Returns the list of the authorized TLDs and also the way they are * authorized. A TLD is the last members (or the last two) of a * domain. For example, "com", "org" etc... AlternC keeps a table * containing the list of the TLDs authorized to be installed on the * server with the instructions to validate the installation of a * domain for each TLD (if necessary). - * @return array An associative array like $r["tld"], $r["mode"] where tld + * + * @global m_mysql $db + * @return array An associative array like $r["tld"], $r["mode"] where tld * is the tld and mode is the authorized mode. */ function listtld() { @@ -960,11 +1085,14 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** List the hosted domains on this server + /** + * List the hosted domains on this server + * * Return the list of hosted domains on this server, (an array of associative arrays) - * @param boolean $alsocheck Returns also errstr and errno telling the domains dig checks - * @param boolean $forcecheck Force the check of dig domain even if a cache exists. + * + * @global m_mysql $db + * @param boolean $alsocheck Returns also errstr and errno telling the domains dig checks + * @param boolean $forcecheck Force the check of dig domain even if a cache exists. * @return array $r[$i] / [domaine][member][noerase][gesdns][gesmx] */ function dom_list($alsocheck=false,$forcecheck=false) { @@ -994,8 +1122,15 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Check all the domains for their NS MX and IPs + /** + * Check all the domains for their NS MX and IPs + * + * @global m_mysql $db + * @global string $L_NS1 + * @global string $L_NS2 + * @global string $L_MX + * @global string $L_PUBLIC_IP + * @return int */ function checkalldom() { global $db,$L_NS1,$L_NS2,$L_MX,$L_PUBLIC_IP; @@ -1062,12 +1197,16 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Lock / Unlock a domain + /** + * Lock / Unlock a domain + * * Lock (or unlock) a domain, so that the member will be (not be) able to delete it * from its account - * @param $dom string Domain name to lock / unlock - * @return boolean TRUE if the domain has been locked/unlocked or FALSE if it does not exist. + * + * @global m_mysql $db + * @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. */ function dom_lock($domain) { global $db,$err; @@ -1081,13 +1220,14 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Add a new TLD to the list of the authorized TLDs - * - * @param $tld string top-level domain to add (org, com...) - * @param $mode integer number of the authorized mode (0 to 5) - * @return boolean TRUE if the tld has been successfully added, FALSE if not. - */ + /** + * Add a new TLD to the list of the authorized TLDs + * + * @global m_mysql $db + * @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. + */ function gettld($tld) { global $db,$err; $db->query("SELECT mode FROM tld WHERE tld='$tld';"); @@ -1099,9 +1239,10 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Prints the list of the actually authorized TLDs - * @param $current integer Value to select in the list + /** + * Prints the list of the actually authorized TLDs + * + * @param boolean $current Value to select in the list */ function selecttldmode($current=false) { for($i=0;$itldmode);$i++) { @@ -1112,12 +1253,15 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Deletes the specified tld in the list of the authorized TLDs + /** + * Deletes the specified tld in the list of the authorized TLDs * Note : This function does not delete the domains depending * on this TLD - * @param $tld string The TLD you want to delete - * @return boolean returns true if the TLD has been deleted, or + * + * @global m_mysql $db + * @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. */ function deltld($tld) { @@ -1134,12 +1278,16 @@ EOF; /* ----------------------------------------------------------------- */ /** Add a TLD to the list of the authorized TLDs during the installation - * @param $tld string TLD we want to authorize - * @param $mode integer Controls to make on this TLD. + * * Note: If you check in the whois, be sure that * m_domains knows how to name the whois of the specified - * domain ! - * @return boolean TRUE if the TLD has been successfully + * domain! + * + * @global m_mysql $db + * @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 * added. FALSE if not. */ function addtld($tld,$mode) { @@ -1163,12 +1311,16 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Modify a TLD of the list of the authorized TLDs - * @param $tld string TLD we want to modify - * @param $mode integer Controls to make on this TLD. - * @return boolean TRUE if the TLD has been successfully + /** + * Modify a TLD of the list of the authorized TLDs + * + * @global m_mysql $db + * @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 * modified. FALSE if not. + */ function edittld($tld,$mode) { global $db,$err; @@ -1184,9 +1336,11 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Get the login name of the main administrator account - * @return string the login name of admin, like 'root' for older alterncs + /** + * Get the login name of the main administrator account + * + * @global m_mysql $db + * @return string the login name of admin, like 'root' for older alterncs */ function getadmin() { global $db; @@ -1196,9 +1350,13 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** List the password policies currently installed in the policy table - * @return array an indexed array of associative array from the MySQL "policy" table + /** + * List the password policies currently installed in the policy table + * + * @global m_mysql $db + * @global array $classes + * @global m_hooks $hooks + * @return array an indexed array of associative array from the MySQL "policy" table */ function listPasswordPolicies() { global $db,$classes,$hooks; @@ -1246,15 +1404,16 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Change a password policy for one kind of password + /** + * Change a password policy for one kind of password * - * @param $policy string Name of the policy to edit - * @param $minsize integer Minimum Password size - * @param $maxsize integer Maximum Password size - * @param $classcount integer How many class of characters must this password have - * @param $allowlogin boolean Do we allow the password to be like the login ? - * @return boolean TRUE if the policy has been edited, or FALSE if an error occured. + * @global m_mysql $db + * @param string $policy Name of the policy to edit + * @param int $minsize Minimum Password size + * @param int $maxsize Maximum Password size + * @param int $classcount How many class of characters must this password have + * @param boolean $allowlogin Do we allow the password to be like the login ? + * @return booleanTRUE if the policy has been edited, or FALSE if an error occured. */ function editPolicy($policy,$minsize,$maxsize,$classcount,$allowlogin) { global $db; @@ -1276,12 +1435,14 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** Check a password and a login for a specific policy - * @param $policy string Name of the policy to check for - * @param $login The login that will be set - * @param $password The password we have to check - * @return boolean TRUE if the password if OK for this login and this policy, FALSE if it is not. + /** + * + * @global m_mysql $db + * @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 + * @return boolean TRUE if the password if OK for this login and this policy, FALSE if it is not. */ function checkPolicy($policy,$login,$password) { global $db,$err; @@ -1352,11 +1513,12 @@ EOF; } - /* ----------------------------------------------------------------- */ - /** hook function called by AlternC-upnp to know which open + /** + * 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 array a key => value list of port protocol name mandatory values */ function hook_upnp_list() { return array( diff --git a/bureau/class/m_authip.php b/bureau/class/m_authip.php index cedc4567..d8de563e 100644 --- a/bureau/class/m_authip.php +++ b/bureau/class/m_authip.php @@ -1,5 +1,5 @@ list_ip(true); } + /** + * + * @return array + */ function hook_menu() { $obj = array( 'title' => _("Access security"), @@ -46,10 +52,15 @@ class m_authip { return $obj; } - /* - * Retourne la liste des ip spécifiées par cet utilisateur + /** + * Retourne la liste des ip spécifiées par cet utilisateur * - * @return array retourne un tableau indexé des ip de l'utilisateur + * + * @global m_mysql $db + * @global m_mem $mem + * @global int $cuid + * @param boolean $whitelist + * @return array Retourne un tableau indexé des ip de l'utilisateur */ function list_ip($whitelist=false) { global $db, $mem; @@ -77,12 +88,17 @@ class m_authip { - /* + /** * Supprime une IP des IP de l'utilisateur - * et supprime les droits attaché en cascade + * et supprime les droits attaché en cascade * - * @param integer $id id de la ligne à supprimer - * @return boolean Retourne FALSE si erreur, sinon TRUE + * @param integer $id + * @return boolean + * + * @global m_mysql $db + * @global int $cuid + * @param int $id id de la ligne à supprimer + * @return boolean Retourne FALSE si erreur, sinon TRUE */ function ip_delete($id) { global $db, $cuid; @@ -99,12 +115,14 @@ class m_authip { return true; } - /* - * Liste les IP et subnet authorisés - * pour une classe donnée - * - * @param string $s classe concernée - * @return array Retourne un tableau + /** + * Liste les IP et subnet authorisés + * pour une classe donnée + * + * @global m_mysql $db + * @global int $cuid + * @param string $s Classe concernée + * @return array */ function get_allowed($s) { global $db, $cuid; @@ -119,6 +137,12 @@ class m_authip { return $r; } + /** + * + * @global m_mysql $db + * @param string $ip + * @return boolean + */ function is_wl($ip) { global $db; if (! $db->query("select ai.ip, ai.subnet from authorised_ip ai where ai.uid='0';") ) { @@ -131,9 +155,13 @@ class m_authip { return false; } - /* + /** * Retourne si l'ip appartient au subnet. * + * @param string $o + * @param string $ip + * @param string $sub + * @return boolean */ function is_in_subnet($o, $ip, $sub) { $o = inet_pton($o); @@ -144,16 +172,10 @@ class m_authip { return false; } - /* - * Sauvegarde une IP dans les IP TOUJOURS authorisée + /** + * Sauvegarde une IP dans les IP TOUJOURS authorisée * - * @param integer $id id de la ligne à modifier. Si vide ou - * égal à 0, alors c'est une insertion - * @param string $ipsub IP (v4 ou v6), potentiellement avec un subnet ( /24) - * @param string $infos commentaire pour l'utilisateur - * @param integer $uid Si $uid=0 et qu'on est super-admin, insertion avec uid=0 - * ce qui correspond a une ip toujours authorisée - * @return boolean Retourne FALSE si erreur, sinon TRUE + * @global m_mem $mem */ function ip_save_whitelist($id, $ipsub, $infos) { global $mem; @@ -161,16 +183,20 @@ class m_authip { return $this->ip_save($id, $ipsub, $infos, 0); } - /* - * Sauvegarde une IP dans les IP authorisée - * - * @param integer $id id de la ligne à modifier. Si vide ou - * égal à 0, alors c'est une insertion - * @param string $ipsub IP (v4 ou v6), potentiellement avec un subnet ( /24) - * @param string $infos commentaire pour l'utilisateur - * @param integer $uid Si $uid=0 et qu'on est super-admin, insertion avec uid=0 - * ce qui correspond a une ip toujours authorisée - * @return boolean Retourne FALSE si erreur, sinon TRUE + /** + * Sauvegarde une IP dans les IP authorisée + * + * @global m_mysql $db + * @global m_mem $mem + * @global int $cuid + * @param int $id id de la ligne à modifier. Si vide ou + * égal à 0, alors c'est une insertion + * @param string $ipsub IP (v4 ou v6), potentiellement avec un subnet ( /24) + * @param string $infos Commentaire pour l'utilisateur + * @param int $uid Si $uid=0 et qu'on est super-admin, insertion avec uid=0 + * ce qui correspond a une ip toujours authorisée + * @return boolean Retourne FALSE si erreur, sinon TRUE + * */ function ip_save($id, $ipsub, $infos, $uid=null) { global $db, $mem; @@ -228,10 +254,12 @@ class m_authip { return true; } - /* - * Fonction appelée par Alternc lors de la suppression d'un utilisateur + /** + * Fonction appelée par Alternc lors de la suppression d'un utilisateur * - * @return boolean Retourne TRUE + * @global int $cuid + * @global m_mysql $db + * @return boolean Retourne TRUE */ function alternc_del_member() { global $cuid,$db; @@ -243,11 +271,11 @@ class m_authip { } - /* - * Analyse les classes et récupéres les informations + /** + * Analyse les classes et récupéres les informations * des classes voulant de la restriction IP * - * @return array Retourne un tableau compliqué + * @return array Retourne un tableau compliqué */ function get_auth_class() { global $hooks; @@ -262,16 +290,17 @@ class m_authip { return $authclass; } - /* + /** * Enregistre ou modifie une affectation ip<=>ressource * Nota : lance des hooks sur la classe correspondante pour - * informer de l'édition/création + * informer de l'édition/création * - * @param integer $authorised_ip_id id de l'ip affecté - * @param string $protocol nom du protocole (définie dans la classe correspondante) - * @param string $parameters information propre au protocole - * @param integer $id présent si c'est une édition - * @return boolean Retourne FALSE si erreur, sinon TRUE + * @global m_mysql $db + * @param int $authorised_ip_id id de l'ip affecté + * @param string $protocol nom du protocole (définie dans la classe correspondante) + * @param string $parameters information propre au protocole + * @param int $id $id présent si c'est une édition + * @return boolean Retourne FALSE si erreur, sinon TRUE */ function ip_affected_save($authorised_ip_id, $protocol, $parameters, $id=null) { global $db; @@ -297,13 +326,14 @@ class m_authip { return true; } - /* + /** * Supprime une affectation ip<=>ressource * Nota : lance des hooks dans la classe correspondante * pour informer de la suppression * - * @param integer $id id de la ligne à supprimer - * @return boolean Retourne FALSE si erreur, sinon TRUE + * @global m_mysql $db + * @param int $id id de la ligne à supprimer + * @return boolean Retourne FALSE si erreur, sinon TRUE */ function ip_affected_delete($id) { global $db; @@ -320,18 +350,20 @@ class m_authip { } - /* - * Appel les hooks demandé avec en parametres les + /** + * Appel les hooks demandé avec en parametres les * affectationt ip<=>ressource dont l'id est en parametre * - * @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 + * @global m_hooks $hooks + * @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 */ function call_hooks($function, $affectation_id) { global $hooks,$err; - // On récure l'objet dont on parle + // On récure l'objet dont on parle $d = $this->list_affected(); if (! isset($d[$affectation_id] )) { $err->raise('authip', _("Object not available")); @@ -340,7 +372,7 @@ class m_authip { $affectation = $d[$affectation_id]; - // On en déduis la classe qui le concerne + // On en déduis la classe qui le concerne $e = $this->get_auth_class(); if (! isset($e[$affectation['protocol']])) { $err->raise('authip', sprintf(_("Can't identified class for the protocole %s"), $affectation['protocol'])); @@ -354,10 +386,13 @@ class m_authip { return true; } - /* + /** * Liste les affectation ip<=>ressource d'un utilisateur * - * @return array Retourne un tableau de valeurs + * @global m_mysql $db + * @global int $cuid + * @param int $ip_id + * @return array Retourne un tableau de valeurs */ function list_affected($ip_id=null) { global $db, $cuid; diff --git a/bureau/class/m_bro.php b/bureau/class/m_bro.php index 49b69d61..f63c85b7 100644 --- a/bureau/class/m_bro.php +++ b/bureau/class/m_bro.php @@ -56,14 +56,19 @@ class m_bro { */ var $mime_type=array(); + /** Internal cache for viewurl + */ + var $cacheurl=array(); + /** Font choice in the editor */ var $l_editor_font=array("Arial, Helvetica, Sans-serif","Times, Bookman, Serif","Courier New, Courier, Fixed"); /** font size in the editor */ var $l_editor_size=array("18px","14px","12px","10px","8px","0.8em","0.9em","1em","1.1em","1.2em"); - /* ----------------------------------------------------------------- */ - /** Constructor */ + /** + * Constructor + **/ function m_bro() { $this->l_mode=array( 0=>_("1 column, detailed"), 1=>_("2 columns, short"), 2=>_("3 columns, short") ); $this->l_tgz=array( 0=>_("tgz (Linux)"), 1=>_("tar.bz2 (Linux)"), 2=>_("zip (Windows/Dos)"), 3=>_("tar.Z (Unix)") ); @@ -71,6 +76,10 @@ class m_bro { $this->l_createfile=array( 0=>_("Go back to the file manager"), 1=>_("Edit the newly created file") ); } + /** + * + * @return array + */ function hook_menu() { $obj = array( 'title' => _("File browser"), @@ -84,11 +93,14 @@ class m_bro { - /* ----------------------------------------------------------------- */ - /** Verifie un dossier relatif au dossier de l'utilisateur courant + /** + * Verifie un dossier relatif au dossier de l'utilisateur courant * - * @param string $dir Dossier (absolu que l'on souhaite vrifier - * @return string Retourne le nom du dossier vrifi, relatif au + * @param string $dir + * @global m_mem $mem + * @param string $dir Dossier absolu que l'on souhaite vérifier + * @param boolean $strip + * @return boolean|string Retourne le nom du dossier vrifi, relatif au * dossier de l'utilisateur courant, ventuellement corrig. * ou FALSE si le dossier n'est pas dans le dossier de l'utilisateur. */ @@ -131,32 +143,34 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne le chemin complet vers la racine du repertoire de l'utilisateur. - * Returns the complete path to the root of the user's directory. + /** + * Retourne le chemin complet vers la racine du repertoire de l'utilisateur. * - * @param string $login Username - * @return string Returns the complete path to the root of the user's directory. + * Returns the complete path to the root of the user's directory. + * + * @param string $login Username + * @return string Returns the complete path to the root of the user's directory. */ function get_user_root($login) { return getuserpath(); } - /* ----------------------------------------------------------------- */ - /** Retourne le chemin complet vers la racine du repertoire de l'utilisateur. - * Returns the complete path to the root of the user's directory. + /** + * Retourne le chemin complet vers la racine du repertoire de l'utilisateur. + * Returns the complete path to the root of the user's directory. * - * @param string $uid User id. - * @return string Returns the complete path to the root of the user's directory. + * @todo [ML] Comment faire ca correctement? + * C'est utilise' dans class/m_dom.php quand un utilisateur ajoute un domaine dans son compte + * et nous devons savoir quel est le chemin complet vers la racine de son compte.. + * + * @global m_admin $admin + * @param int $uid User id. + * @return string Returns the complete path to the root of the user's directory. */ function get_userid_root($uid) { global $admin; - // FIXME [ML] Comment faire ca correctement? - // C'est utilise' dans class/m_dom.php quand un utilisateur ajoute un domaine dans son compte - // et nous devons savoir quel est le chemin complet vers la racine de son compte.. - $old_enabled = $admin->enabled; $admin->enabled = true; $member = $admin->get($uid); @@ -166,17 +180,22 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne un tableau contenant la liste des fichiers du dossier courant + /** + * Retourne un tableau contenant la liste des fichiers du dossier courant + * * Ce tableau contient tous les paramtres des fichiers du dossier courant * sous la forme d'un tableau index de tableaux associatifs comme suit : * $a["name"]=nom du fichier / dossier * $a["size"]=Taille totale du fichier / dossier + sous-dossier * $a["date"]=Date de dernire modification * $a["type"]=Type du fichier (1 pour fichier, 0 pour dossier) - * @param string $dir dossier relatif au dossier racine du compte du - * membre courant - * @return array le tableau contenant les fichiers de $dir, et + * + * @global m_mysql $db + * @global int $cuid + * @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 */ function filelist($dir="", $showdirsize = false) { global $db,$cuid,$err; @@ -200,11 +219,15 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne un tableau contenant les prfrences de l'utilisateur courant - * Ce tableau aqssociatif contient les valeurs des champs de la table "browser" + /** + * Retourne un tableau contenant les prfrences de l'utilisateur courant + * + * Ce tableau associatif contient les valeurs des champs de la table "browser" * pour l'utilisateur courant. - * @return array Tableau des prfrences de l'utilisateur courant. + * + * @global m_mysql $db + * @global int $cuid + * @return array Tableau des prfrences de l'utilisateur courant. */ function GetPrefs() { global $db,$cuid; @@ -218,20 +241,22 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Modifie les prfrences de l'utilisateur courant. + /** + Modifie les prfrences de l'utilisateur courant. * - * @param integer $editsizex Taille de l'diteur (nombre de colonnes) - * @param integer $editsizey Taille de l'diteur (nombre de lignes) - * @param integer $listmode Mode d'affichage de la liste des fichiers - * @param integer $showicons Faut-il afficher / cacher les icones des fichiers - * @param integer $downfmt Dans quel format faut-il tlcharger les dossiers compresss - * @param integer $createfile Faut-il editer/revenir au browser aprs cration d'un fichier - * @param integer $showtype Faut-il afficher le type mime des fichiers - * @param integer $editor_font Quelle police faut-il utiliser pour l'diteur - * @param integer $editor_size Quelle taille de police faut-il utiliser pour l'diteur - * @param integer $golastdir Faut-il revenir la racine ou au dernier dossier visit ? - * @return boolean TRUE + * @global m_mysql $db + * @global int $cuid + * @param integer $editsizex Taille de l'diteur (nombre de colonnes) + * @param integer $editsizey Taille de l'diteur (nombre de lignes) + * @param integer $listmode Mode d'affichage de la liste des fichiers + * @param integer $showicons Faut-il afficher / cacher les icones des fichiers + * @param integer $downfmt Dans quel format faut-il tlcharger les dossiers compresss + * @param integer $createfile Faut-il editer/revenir au browser aprs cration d'un fichier + * @param integer $showtype Faut-il afficher le type mime des fichiers + * @param integer $editor_font Quelle police faut-il utiliser pour l'diteur + * @param integer $editor_size Quelle taille de police faut-il utiliser pour l'diteur + * @param integer $golastdir Faut-il revenir la racine ou au dernier dossier visit ? + * @return boolean */ function SetPrefs($editsizex, $editsizey, $listmode, $showicons, $downfmt, $createfile, $showtype, $editor_font, $editor_size, $golastdir) { global $db,$cuid; @@ -248,11 +273,13 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne le nom du fichier icone associ au fichier donc le nom est $file + /** + * Retourne le nom du fichier icone associ au fichier donc le nom est $file * Note: Les fichiers icones sont mis en cache sur la page courante. - * @param string $file Fichier dont on souhaite connaitre le fichier icone - * @return string Fichier icone correspondant. + * + * @global array $bro_icon + * @param string $file Fichier dont on souhaite connaitre le fichier icone + * @return string Fichier icone correspondant. */ function icon($file) { global $bro_icon; @@ -273,12 +300,14 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne le type mime associ au fichier donc le nom est $file + /** + * Retourne le type mime associé au fichier donc le nom est $file * Note: Les types mimes sont mis en cache sur la page courante. * Le type mime est dtermin d'aprs l'extension du fichier. - * @param string $file Fichier dont on souhaite connaitre le type mime - * @return string Type mime / Sous type du fichier demand + * + * @global array $bro_type + * @param string $file Fichier dont on souhaite connaitre le type mime + * @return string Type mime / Sous type du fichier demand */ function mime($file) { global $bro_type; @@ -299,13 +328,15 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Retourne la taille du fichier $file + /** + * Retourne la taille du fichier $file * si $file est un dossier, retourne la taille de ce dossier et de tous * ses sous dossiers. - * @param string $file Fichier dont on souhaite connaitre la taille - * @param boolean $showdirsize recursively compute the directory size. - * @return integer Taille du fichier en octets. + * + * @param string $file Fichier dont on souhaite connaitre la taille + * @param boolean $showdirsize Recursively compute the directory size. + * @return integer Taille du fichier en octets. + * @return int|string */ function fsize($file, $showdirsize = false) { if (is_dir($file)) { @@ -320,10 +351,11 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Returns the size of a directory, by adding all it's files sizes - * @param string $dir the directory whose size we want to compute - * @return integer the total size in bytes. + /** + * Returns the size of a directory, by adding all it's files sizes + * + * @param string $dir The directory whose size we want to compute + * @return integer The total size in bytes. */ function dirsize($dir) { $totalsize = 0; @@ -346,11 +378,15 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Cre le dossier $file dans le dossier (parent) $dir - * @param string $dir dossier dans lequel on veut crer un sous-dossier - * @param string $file nom du dossier crer - * @return boolean TRUE si le dossier a t cr, FALSE si une erreur s'est produite. + /** + * Crée le dossier $file dans le dossier (parent) $dir + * + * @global m_mysql $db + * @global int $cuid + * @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. */ function CreateDir($dir,$file) { global $db,$cuid,$err; @@ -371,11 +407,15 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Cre un fichier vide dans un dossier - * @param string $dir Dossier dans lequel on cre le nouveau fichier - * @param string $file Fichier que l'on souhaite crer. - * @return boolean TRUE si le dossier a t cr, FALSE si une erreur s'est produite. + /** + * Crée un fichier vide dans un dossier + * + * @global m_mysql $db + * @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 + * @return boolean TRUE si le dossier a été créé, FALSE si une erreur s'est produite. */ function CreateFile($dir,$file) { global $db,$err,$cuid; @@ -396,11 +436,14 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Efface les fichiers du tableau $file_list dans le dossier $R - * @param array $file_list Liste des fichiers effacer. - * @param string $R Dossier dans lequel on efface les fichiers - * @return boolean TRUE si les fichiers ont t effacs, FALSE si une erreur s'est produite. + /** + * Efface les fichiers du tableau $file_list dans le dossier $R + * + * @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 + * @return boolean TRUE si les fichiers ont t effacs, FALSE si une erreur s'est produite. */ function DeleteFile($file_list,$R) { global $err, $mem; @@ -420,12 +463,14 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Renomme les fichier de $old du dossier $R en $new - * @param string $R dossier dans lequel se trouve les fichiers renommer. - * @param array of string $old Ancien nom des fichiers - * @param array of string $new Nouveau nom des fichiers - * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. + /** + * Renomme les fichier de $old du dossier $R en $new + * + * @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 + * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. */ function RenameFile($R,$old,$new) { global $err; @@ -452,12 +497,14 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Dplace les fichier de $d du dossier $old vers $new - * @param array of string $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. - * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. + /** + * Déplace les fichier de $d du dossier $old vers $new + * + * @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. + * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. */ function MoveFile($d,$old,$new) { global $err; @@ -491,13 +538,15 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Change les droits d'acces aux fichier de $d du dossier $R en $p - * @param string $R dossier dans lequel se trouve les fichiers renommer. - * @param array of string $old Ancien nom des fichiers - * @param array of string $new Nouveau nom des fichiers - * @param $verbose boolean shall we 'echo' what we did ? - * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. + /** + * Change les droits d'acces aux fichier de $d du dossier $R en $p + * + * @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 + * @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. */ function ChangePermissions($R,$d,$perm,$verbose=false) { global $err; @@ -529,12 +578,18 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Recoit un champ file upload (Global) et le stocke dans le dossier $R + /** + * Recoit un champ file upload (Global) et le stocke dans le dossier $R * Le champ file-upload originel doit s'appeler "userfile" et doit - * bien tre un fichier d'upload. - * @param string $R Dossier dans lequel on upload le fichier - * @returns the path where the file resides or false if upload failed + * bien être un fichier d'upload. + * + * + * @global array $_FILES + * @global m_err $err + * @global int $cuid + * @global m_action $action + * @param string $R Dossier dans lequel on upload le fichier + * @returns string The path where the file resides or false if upload failed */ function UploadFile($R) { global $_FILES,$err,$cuid,$action; @@ -580,13 +635,17 @@ class m_bro { } - /* ----------------------------------------------------------------- */ /** * Extract an archive by using GNU and non-GNU tools - * @param string $file is the full or relative path to the archive - * @param string $dest is the path of the extract destination, the - * same directory as the archive by default - * @return integer|null != 0 on error + * + * @global m_err $err + * @global int $cuid + * @global m_mem $mem + * @global m_action $action + * @param string $file Full or relative path to the archive + * @param string $dest Path of the extract destination, the + * same directory as the archive by default + * @return boolean != 0 on error */ function ExtractFile($file, $dest=null) { global $err,$cuid,$mem,$action; @@ -628,8 +687,14 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Copy many files from point A to point B + /** + * Copy many files from point A to point B + * + * @global m_err $err + * @param array $d List of files to move + * @param string $old + * @param string $new + * @return boolean */ function CopyFile($d,$old,$new) { global $err; @@ -657,16 +722,17 @@ class m_bro { } - /* ----------------------------------------------------------------- */ /** * Copy a source to a destination by either copying recursively a * directory or by downloading a file with a URL (only http:// is * supported) - * @param string $src is the path or URL - * @param string $dest is the absolute path inside the users directory - * @return boolean false on error * * Note that we assume that the inputs have been convertabsolute()'d + * + * @global m_err $err + * @param string $src Path or URL + * @param string $dest Absolute path inside the users directory + * @return boolean false on error */ function CopyOneFile($src, $dest) { global $err; @@ -681,14 +747,16 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Affiche le chemin et les liens de la racine au dossier $path + /** + * Affiche le chemin et les liens de la racine au dossier $path * Affiche autant de liens HTML (anchor) que le chemin $path contient de * niveaux de dossier. Chaque lien est associ la page web $action * laquelle on ajoute le paramtre R=+Le nom du dossier courant. - * @param string $path Dossier vers lequel on trace le chemin - * @param string $action Page web de destination des liens - * @return string le code HTML ainsi obtenu. + * + * @param string $path Dossier vers lequel on trace le chemin + * @param string $action Page web de destination des liens + * @param boolean $justparent + * @return string Le code HTML ainsi obtenu. */ function PathList($path,$action, $justparent=false) { $path=$this->convertabsolute($path,1); @@ -709,14 +777,17 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Affiche le contenu d'un fichier pour un champ VALUE de textarea + /** + * Affiche le contenu d'un fichier pour un champ VALUE de textarea + * * Affiche le contenu du fichier $file dans le dossier $R. Le contenu * du fichier est reformat pour pouvoir entrer dans un champs TextArea - * @param string $R Dossier dans lequel on cherche le fichier - * @param string $file Fichier dont on souhaite obtenir le contenu. - * @return false|string retourne TRUE si le fichier a bien t mis sur - * echo, ou FALSE si une erreur est survenue. + * + * @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 boolean TRUE si le fichier a bien été mis sur + * echo, ou FALSE si une erreur est survenue. */ function content($R,$file) { global $err; @@ -737,21 +808,21 @@ class m_bro { } - /** Internal cache for viewurl - */ - var $cacheurl=array(); - - /* ----------------------------------------------------------------- */ - // Return a browsing url if available. - // Maintain a url cache (positive AND negative(-) cache) - /* ----------------------------------------------------------------- */ - /** Retourne une url de navigation pour le fichier $name du dossier $dir + /** + * Retourne une url de navigation pour le fichier $name du dossier $dir * Les url sont mises en caches. Il se peut qu'aucune url n'existe, ou que * celle-ci soit protge par un .htaccess. - * @param string $dir Dossier concern - * @param string $name Fichier dont on souhaite obtenir une URL - * @return string URL concerne, ou FALSE si aucune URL n'est disponible pour ce fichier + * + * Return a browsing url if available. + * Maintain a url cache (positive AND negative(-) cache) + * + * @global m_mysql $db + * @global int $cuid + * + * @param string $dir Dossier concerné + * @param string $name Fichier dont on souhaite obtenir une URL + * @return string URL concerne, ou FALSE si aucune URL n'est disponible pour ce fichier */ function viewurl($dir,$name) { global $db,$cuid; @@ -792,9 +863,13 @@ class m_bro { } } - - /* ----------------------------------------------------------------- */ /** + * + * @global m_mem $mem + * @global m_err $err + * @param string $dir + * @param string $name + * @return boolean */ function can_edit($dir,$name) { global $mem,$err; @@ -814,8 +889,12 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Return a HTML snippet representing an extraction function only if the mimetype of $name is supported + /** + * Return a HTML snippet representing an extraction function only if the mimetype of $name is supported + * + * @param string $dir + * @param string $name + * @return boolean */ function is_extractable($dir,$name) { if ($parts = explode(".", $name)) { @@ -841,7 +920,13 @@ class m_bro { return false; } - // return true if file is a sql dump (end with .sql or .sql.gz) + /** + * return true if file is a sql dump (end with .sql or .sql.gz) + * + * @param type $dir + * @param type $name + * @return boolean + */ function is_sqlfile($dir,$name) { if ($parts = explode(".", $name)) { $ext = array_pop($parts); @@ -851,9 +936,11 @@ class m_bro { return false; } - - /* ----------------------------------------------------------------- */ /** + * + * @global m_err $err + * @param string $dir + * @param string $file */ function download_link($dir,$file){ global $err; @@ -865,8 +952,13 @@ class m_bro { } - /* ------------------------------------------------------------------ */ - /** Echoes the content of the file $file located in directory $R + /** + * Echoes the content of the file $file located in directory $R + * + * @global m_err $err + * @param string $R + * @param string $file + * @return boolean */ function content_send($R,$file) { global $err; @@ -883,15 +975,17 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Sauve le fichier $file dans le dossier $R avec pour contenu $texte + /** + * Sauve le fichier $file dans le dossier $R avec pour contenu $texte * le contenu est issu d'un textarea, et ne DOIT PAS contenir de \ ajouts * automatiquement par addslashes - * @param string $file Nom du fichier sauver. S'il existe dj, il sera - * cras sans confirmation. - * @param string $R Dossier dans lequel on modifie le fichier - * @param string $texte texte du fichier sauver dedans - * @return false|null TRUE si tout s'est bien pass, FALSE si une erreur s'est produite. + * + * @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 + * @param string $texte Texte du fichier à sauver dedans + * @return boolean TRUE si tout s'est bien pass, FALSE si une erreur s'est produite. */ function save($file,$R,$texte) { global $err; @@ -911,10 +1005,12 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Echo d'un flux .tar.Z contenant tout le contenu du dossier $dir - * @param string $dir dossier dumper, relatif la racine du compte du membre. - * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs + /** + * Echo d'un flux .tar.Z contenant tout le contenu du dossier $dir + * + * @global m_mem $mem + * @param string $dir Dossier à dumper, relatif la racine du compte du membre. + * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs */ function DownloadZ($dir="") { global $mem; @@ -927,10 +1023,12 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Echo d'un flux .tgz contenant tout le contenu du dossier $dir - * @param string $dir dossier dumper, relatif la racine du compte du membre. - * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs + /** + * Echo d'un flux .tgz contenant tout le contenu du dossier $dir + * + * @global type $mem + * @param string $dir Dossier à dumper, relatif la racine du compte du membre. + * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs */ function DownloadTGZ($dir="") { global $mem; @@ -943,10 +1041,12 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Echo d'un flux .tar.bz2 contenant tout le contenu du dossier $dir - * @param string $dir dossier dumper, relatif la racine du compte du membre. - * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs + /** + * Echo d'un flux .tar.bz2 contenant tout le contenu du dossier $dir + * + * @global type $mem + * @param string $dir Dossier à dumper, relatif la racine du compte du membre. + * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs */ function DownloadTBZ($dir="") { global $mem; @@ -959,10 +1059,13 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Echo d'un flux .ZIP contenant tout le contenu du dossier $dir - * @param string $dir dossier dumper, relatif la racine du compte du membre. - * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs + + /** + * Echo d'un flux .ZIP contenant tout le contenu du dossier $dir + * + * @global type $mem + * @param string $dir Dossier à dumper, relatif la racine du compte du membre. + * @return void NE RETOURNE RIEN, et il faut Quitter le script immdiatement aprs */ function DownloadZIP($dir="") { global $mem; @@ -975,9 +1078,13 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Fonction de tri perso utilis par filelist. - * @access private + /** + * Fonction de tri perso utilis par filelist. + * + * @access private + * @param string $a + * @param string $b + * @return int */ function _sort_filelist_name($a,$b) { if ($a["type"] && !$b["type"]) return 1; @@ -986,11 +1093,11 @@ class m_bro { } - /* ----------------------------------------------------------------- */ - /** Efface $file et tous ses sous-dossiers s'il s'agit d'un dossier + /** + * Efface $file et tous ses sous-dossiers s'il s'agit d'un dossier * A UTILISER AVEC PRECAUTION !!! - * @param string $file Fichier ou dossier supprimer. - * @access private + * @param string $file Fichier ou dossier supprimer. + * @access private */ function _delete($file) { // permet d'effacer de nombreux fichiers @@ -1011,9 +1118,13 @@ class m_bro { } - /*----------------------------------------------------------*/ - /** Function d'exportation de configuration appelé par la classe m_export via un hooks - *Produit en sorti un tableau formatté ( pour le moment) en HTML + /** + * Function d'exportation de configuration appelé par la classe m_export via un hooks + * Produit en sorti un tableau formatté ( pour le moment) en HTML + * + * @global m_mysql $db + * @global m_err $err + * @return string */ function alternc_export_conf() { global $db,$err; @@ -1035,9 +1146,13 @@ class m_bro { } - /*----------------------------------------------------------*/ - /** Function d'exportation des données appelé par la classe m_export via un hooks - *@param : le chemin destination du tarball produit. + /** + * Function d'exportation des données appelé par la classe m_export via un hooks + * + * @global m_mem $mem + * @global m_err $err + * @param string $dir Le chemin destination du tarball produit + * @return boolean */ function alternc_export_data($dir){ global $mem,$err; diff --git a/bureau/class/m_variables.php b/bureau/class/m_variables.php index 1fbbdbfb..19efe050 100644 --- a/bureau/class/m_variables.php +++ b/bureau/class/m_variables.php @@ -40,7 +40,7 @@ class m_variables { /** * - * @global type $L_FQDN + * @global string $L_FQDN */ function m_variables() { global $L_FQDN;