Changeset 1804

Show
Ignore:
Timestamp:
04/29/07 22:50:17 (1 year ago)
Author:
franck
Message:

Oublier les class :/

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/branches/franck-desktop/bureau/class/config.php

    r1797 r1804  
    4545} 
    4646*/ 
     47error_reporting(E_ALL); 
    4748 
    4849// 1. Get a semaphore id for the alternc magic number (18577) 
     
    6869} 
    6970 
     71$error = ""; 
     72 
    7073/* PHPLIB inclusions : */ 
    7174$root="/var/alternc/bureau/"; 
    7275/* Server Domain Name */ 
    7376$host=getenv("HTTP_HOST"); 
     77 
     78/* Custom PHP debugger */ 
     79require_once($root."class/error_handler.php"); 
     80$queryCount = 0; 
    7481 
    7582/* Global variables (AlternC configuration) */ 
     
    7885require_once($root."class/db_mysql.php"); 
    7986require_once($root."class/functions.php"); 
    80 require_once($root."class/functions2.php"); 
    8187require_once($root."class/variables.php"); 
    8288 
     89$tempsDebut = microtimeFloat(); 
     90 
    8391// Redirection si appel https://(!fqdn)/ 
    84 if ($_SERVER["HTTPS"] == "on" && $host != $L_FQDN) 
     92if ((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on") && $host == $L_FQDN) 
    8593{ 
    8694        header("Location: https://$L_FQDN/"); 
     
    116124 
    117125 
    118 $classes=array(); 
     126$classes = array(); 
    119127/* CLASSES PHP4 : automatic include : */ 
    120 $c=opendir($root."class/"); 
    121 while ($di=readdir($c)) { 
    122   if (ereg("^m_(.*)\\.php$",$di,$match)) { // $ 
    123     $name1="m_".$match[1]; 
    124     $name2=$match[1]; 
    125     $classes[]=$name2; 
    126     require_once($root."class/".$name1.".php"); 
    127   } 
     128$c = opendir($root . "class/"); 
     129while ($di=readdir($c)) 
     130
     131        if (ereg("^m_(.*)\\.php$",$di,$match)) { // $ 
     132                $name1="m_".$match[1]; 
     133                $name2=$match[1]; 
     134                $classes[]=$name2; 
     135                require_once($root."class/".$name1.".php"); 
     136        } 
    128137} 
    129138closedir($c); 
     
    136145bindtextdomain("alternc", "/var/alternc/bureau/locales"); 
    137146 
    138 if (!$do_not_set_lang_env) { 
     147if (!isset($do_not_set_lang_env)) { 
    139148  include("lang_env.php"); 
    140149} 
    141150 
    142 $mem=new m_mem(); 
    143 $err=new m_err(); 
     151$mem = new m_mem(); 
     152$err = new m_err(); 
    144153 
    145154/* Check the User identity (if required) */ 
    146 if (!defined('NOCHECK')) { 
    147   if (!$mem->checkid()) { 
    148     $error=$err->errstr(); 
    149     include("index.php"); 
    150     exit(); 
    151   } 
     155if (!defined('NOCHECK')) 
     156
     157        $fields = array ( 
     158                "username"  => array ("request", "string", ""), 
     159                "password"  => array ("request", "string", ""), 
     160                "restrictip" => array ("request", "integer", 0), 
     161        ); 
     162        getFields($fields); 
     163 
     164        if (!$mem->checkid($username, $password, $restrictip)) 
     165        { 
     166                $error = $err->errstr(); 
     167                include("index.php"); 
     168                exit(); 
     169        } 
    152170} 
    153171 
    154 for($i=0;$i<count($classes);$i++) { 
    155   if ($classes[$i]!="mem" && $classes[$i]!="err") { 
    156     $name2=$classes[$i]; 
    157     $name1="m_".$name2; 
    158     $$name2= new $name1(); 
    159   } 
     172for ($i = 0; $i < count($classes); $i++) 
     173
     174        if ($classes[$i] != "mem" && $classes[$i] != "err") 
     175        { 
     176                $name2 = $classes[$i]; 
     177                $name1 = "m_" . $name2; 
     178                $$name2 = new $name1(); 
     179        } 
    160180} 
    161181 
  • alternc/branches/franck-desktop/bureau/class/db_mysql.php

    r1797 r1804  
    124124  */ 
    125125  function query($Query_String) { 
     126    global $queryCount; 
    126127    /* No empty queries, please, since PHP4 chokes on them. */ 
    127128    if ($Query_String == "") 
     
    137138 
    138139    # New query, discard previous result. 
    139     if ($this->Query_ID) { 
     140    if (is_resource($this->Query_ID)) { 
    140141      $this->free(); 
    141142    } 
     
    153154 
    154155    # Will return nada if it fails. That's fine. 
     156    $queryCount++; 
    155157    return $this->Query_ID; 
    156158  } 
  • alternc/branches/franck-desktop/bureau/class/functions.php

    r1797 r1804  
    7575} 
    7676 
    77 /* Check that a domain can be hosted in that server,  
    78 without DNS managment.  
     77/* Check that a domain can be hosted in that server, 
     78without DNS managment. 
    7979*/ 
    8080function checkhostallow_nodns($domain) { 
     
    328328 
    329329/* ----------------------------------------------------------------- */ 
    330 /** Echappe les caractères pouvant perturber un flux XML standard :  
     330/** Echappe les caractères pouvant perturber un flux XML standard : 
    331331 * @param string $string Chaine de caractère à encoder en valeur xml. 
    332332 * @return string Retourne la chaîne modifiée si besoin. 
     
    382382} 
    383383 
     384/* ---------------------- */ 
     385 
     386function getFields($fields, $requestOnly = false) 
     387{ 
     388        $vars = array(); 
     389        $methodType = array ("get", "post", "request", "files"); 
     390 
     391        foreach ($fields AS $name => $options) 
     392        { 
     393                if (in_array($options[0], $methodType) === false) 
     394                        die ("Illegal method type used for field " . $name . " : " . $options[0]); 
     395 
     396                if ($requestOnly === true) 
     397                        $method = "_REQUEST"; 
     398                else 
     399                        $method = "_" . strtoupper($options[0]); 
     400 
     401                switch ($options[1]) 
     402                { 
     403                        case "integer": 
     404 
     405                                $vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? intval($GLOBALS[$method][$name]) : $options[2]); 
     406                                break; 
     407 
     408                        case "float": 
     409 
     410                                $vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? floatval($GLOBALS[$method][$name]) : $options[2]); 
     411                                break; 
     412 
     413                        case "string": 
     414 
     415                                $vars[$name] = (isset($GLOBALS[$method][$name]) ? trim($GLOBALS[$method][$name]) : $options[2]); 
     416                                break; 
     417 
     418                        case "array": 
     419 
     420                                $vars[$name] = (isset($GLOBALS[$method][$name]) && is_array($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]); 
     421                                break; 
     422 
     423                        case "boolean": 
     424 
     425                                $vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]); 
     426                                break; 
     427 
     428                        case "file": 
     429 
     430                                $vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]); 
     431                                break; 
     432 
     433                        default: 
     434                    die ("Illegal method type used for field " . $name . " : " . $options[1]); 
     435                } 
     436        } 
     437 
     438        // Insert into $GLOBALS 
     439        foreach ($vars AS $var => $value) 
     440                $GLOBALS[$var] = $value; 
     441 
     442        return $vars; 
     443} 
     444 
     445function printVar($array) 
     446{ 
     447        echo "<pre style=\"border: 1px solid black; text-align: left; font-size: 9px\">\n"; 
     448        print_r($array); 
     449        echo "</pre>\n"; 
     450} 
     451 
     452function startBox($boxClass) 
     453{ 
     454        echo "<table class=\"" . $boxClass . "\">"; 
     455        echo "<tr>"; 
     456        echo "<td class=\"boxTopLeft\"></td>"; 
     457        echo "<td class=\"boxTop\"></td>"; 
     458        echo "<td class=\"boxTopRight\"></td>"; 
     459        echo "</tr>"; 
     460        echo "<tr>"; 
     461        echo "<td class=\"boxLeft\"></td>"; 
     462        echo "<td class=\"boxContent\">"; 
     463} 
     464 
     465function endBox() 
     466{ 
     467        echo "</td>"; 
     468        echo "<td class=\"boxRight\"></td>"; 
     469        echo "</tr>"; 
     470        echo "<tr>"; 
     471        echo "<td class=\"boxBottomLeft\"></td>"; 
     472        echo "<td class=\"boxBottom\"></td>"; 
     473        echo "<td class=\"boxBottomRight\"></td>"; 
     474        echo "</tr>"; 
     475        echo "</table>"; 
     476} 
     477 
     478function microtimeFloat() 
     479{ 
     480        return array_sum(explode(" ", microtime())); 
     481} 
     482 
    384483?> 
  • alternc/branches/franck-desktop/bureau/class/lang_env.php

    r1797 r1804  
    1818// setlang is on the link at the login page 
    1919if (isset($_REQUEST["setlang"])) { 
    20   $lang=$_REQUEST["setlang"]; 
     20  $lang = $_REQUEST["setlang"]; 
    2121} 
    2222 
     
    2525update_locale(); 
    2626 
    27 if (!$lang) {  // Use the browser first preferred language 
    28   $lang=strtolower(substr(trim($HTTP_ACCEPT_LANGUAGE),0,5)); 
     27if (!isset($lang)) {  // Use the browser first preferred language 
     28  $lang=strtolower(substr(trim($_SERVER["HTTP_ACCEPT_LANGUAGE"]),0,5)); 
    2929} 
    3030 
    31  
    32 if (!$locales[$lang]) { // Requested language not found in locales 
     31if (!isset($locales[$lang])) { // Requested language not found in locales 
    3332  // treat special cases such as en_AU or fr_BF : use the language only, not the country. 
    3433  $ll=substr($lang,0,2); 
     
    4140} 
    4241 
    43 if (!$locales[$lang]) $lang=$locales[0]; 
     42if (!isset($locales[$lang])) 
     43        $lang = $locales[0]; 
    4444 
    45 if ($setlang && $lang) { 
    46   setcookie("lang",$lang); 
     45if (isset($setlang) && isset($lang)) 
     46
     47  setcookie("lang", $lang); 
    4748} 
    4849 
     
    5152 
    5253/* Language ok, set the locale environment */ 
    53 putenv("LC_MESSAGES=$lang"); 
    54 putenv("LANG=$lang"); 
    55 putenv("LANGUAGE=$lang"); 
     54putenv("LC_MESSAGES=" . $lang); 
     55putenv("LANG=" . $lang); 
     56putenv("LANGUAGE=" . $lang); 
    5657// this locale MUST be selected in "dpkg-reconfigure locales" 
    57 setlocale(LC_ALL,$lang); 
     58setlocale(LC_ALL, $lang); 
    5859textdomain("alternc"); 
    5960 
  • alternc/branches/franck-desktop/bureau/class/m_admin.php

    r1797 r1804  
    128128 
    129129  /* ----------------------------------------------------------------- */ 
     130  /** Retourne la liste des lettres pour lesquelles un utilisateur a 
     131   * des membres 
     132   * Retourne un tableau indexé où se trouvent les lettres 
     133   * @return array Tableau de lettres ou FALSE si erreur 
     134   */ 
     135  function get_letters() { 
     136    global $err,$mem,$cuid,$db; 
     137    $err->log("admin","get_letters"); 
     138    if ($mem->user["uid"]==2000) 
     139        $db->query("SELECT LEFT(login,1) as letter FROM membres GROUP BY letter ORDER BY letter;"); 
     140    else 
     141        $db->query("SELECT LEFT(login,1) as letter FROM membres where uid='$cuid' GROUP BY letter ORDER BY letter;"); 
     142    $res=array(); 
     143    while($db->next_record()) { 
     144      $res[]=$db->f("letter"); 
     145    } 
     146    return $res; 
     147  } 
     148 
     149  /* ----------------------------------------------------------------- */ 
    130150  /** 
    131151   * Returns the list of the hosted accounts 
     
    147167   * 
    148168   */ 
    149   function get_list($all=0) { 
     169  function get_list($all=0, $letter = "") { 
    150170    // PATCHBEN pour ne voir que les comptes que l'on a créé (sauf admin) 
    151171    global $err,$mem,$cuid; 
     
    156176    } 
    157177    $db=new DB_System(); 
    158     if ($mem->user[uid]==2000 || $all) { 
    159       $db->query("SELECT uid FROM membres ORDER BY login;"); 
     178    $letterQuery = ""; 
     179    if ($letter) 
     180        $letterQuery = "&& login LIKE '" . $letter . "%'"; 
     181    if ($mem->user["uid"]==2000 || $all) { 
     182      $db->query("SELECT uid FROM membres WHERE 1" . $letterQuery . " ORDER BY login;"); 
    160183    } else { 
    161       $db->query("SELECT uid FROM membres WHERE creator='".$cuid."' ORDER BY login;"); 
     184      $db->query("SELECT uid FROM membres WHERE creator = '" . $cuid . "'" . $letterQuery . " ORDER BY login;"); 
    162185    } 
    163186    if ($db->num_rows()) { 
     
    343366    if (($db->query("UPDATE local SET nom='$nom', prenom='$prenom' WHERE uid='$uid';")) 
    344367        &&($db->query("UPDATE membres SET mail='$mail', canpass='$canpass', enabled='$enabled', type='$type' $ssq WHERE uid='$uid';"))){ 
    345       if($_POST['reset_quotas'] == "on") 
     368      if(isset($_POST['reset_quotas']) && $_POST["reset_quotas"] == "on") 
    346369        $quota->addquotas(); 
    347370      $this->renew_update($uid, $duration); 
     
    573596  function renew_get_expiring_accounts() { 
    574597    global $db; 
    575  
     598                $res = array(); 
    576599    if(!$db->query("SELECT *, m.renewed + INTERVAL duration MONTH 'expiry'," . 
    577600                   " CASE WHEN m.duration IS NULL THEN 0" . 
  • alternc/branches/franck-desktop/bureau/class/m_bro.php

    r1797 r1804  
    128128  function filelist($dir="") { 
    129129    global $db,$cuid; 
     130    $c = array(); 
    130131    $db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';"); 
    131132    $absolute=$this->convertabsolute($dir,0); 
     
    393394   */ 
    394395  function UploadFile($R) { 
    395     global $_FILES,$err; 
     396    global $err; 
    396397    $absolute=$this->convertabsolute($R,0); 
    397398    if (!$absolute) { 
     
    424425   */ 
    425426  function PathList($path,$action) { 
     427    $c = ""; 
     428    $R = ""; 
    426429    $path=$this->convertabsolute($path,1); 
    427430    $a=explode("/",$path); 
     
    482485    if (substr($dir,0,1)=="/") $dir=substr($dir,1); 
    483486    if (substr($dir,-1)=="/") $dir=substr($dir,0,-1); 
    484     if (!$this->cacheurl["d".$dir]) { 
     487    if (!isset($this->cacheurl["d".$dir])) { 
    485488      // On parcours $dir en remontant les / 
    486489      $end="";  $beg=$dir;      $tofind=true; 
     
    507510      } 
    508511    } 
    509     if ($this->cacheurl["d".$dir] && $this->cacheurl["d".$dir]!="-") { 
     512    if (isset($this->cacheurl["d".$dir]) && $this->cacheurl["d".$dir]!="-") { 
    510513      return $this->cacheurl["d".$dir]."/".$name; 
    511514    } else { 
  • alternc/branches/franck-desktop/bureau/class/m_dom.php

    r1797 r1804  
    572572    $r["mail"]=$db->Record["gesmx"]; 
    573573    $r["mx"]=$db->Record["mx"]; 
    574     $r[noerase]=$db->Record[noerase]; 
     574    $r["noerase"]=$db->Record["noerase"]; 
    575575    $db->free(); 
    576576    $db->query("select count(*) as cnt from sub_domaines where compte='$cuid' and domaine='$dom'"); 
  • alternc/branches/franck-desktop/bureau/class/m_ftp.php

    r1004 r1804  
    9999      } 
    100100      return array( 
    101                    "id"=>$db->f("id"), 
    102                    "prefixe"=> $lg[0], 
    103                    "login"=>$lg[1]
    104                    "dir"=>$match[1] 
     101                   "id"      => $db->f("id"), 
     102                   "prefixe" => $lg[0], 
     103                   "login"   => isset($lg[1]) ? $lg[1] : ""
     104                   "dir"     => $match[1] 
    105105                   ); 
    106106    } else { 
     
    311311 
    312312  /* ----------------------------------------------------------------- */ 
    313   /**  
     313  /** 
    314314   * Returns the used quota for the $name service for the current user. 
    315    * @param $name string name of the quota  
     315   * @param $name string name of the quota 
    316316   * @return integer the number of service used or false if an error occured 
    317317   * @access private 
     
    332332   * Exporte toutes les informations ftp du compte AlternC 
    333333   * @access private 
    334    * EXPERIMENTAL 'sid' function ;)  
     334   * EXPERIMENTAL 'sid' function ;) 
    335335   */ 
    336336  function alternc_export() { 
     
    349349    return $str; 
    350350  } 
    351    
    352    
     351 
     352 
    353353} /* Class m_ftp */ 
    354354 
  • alternc/branches/franck-desktop/bureau/class/m_hta.php

    r1797 r1804  
    9696    for ($i=0;$i<count($sortie);$i++){ 
    9797      preg_match("/^\/var\/alternc\/html\/.\/[^\/]*\/(.*)\/\.htpasswd/", $sortie[$i], $matches); 
    98       $r[$i]=$matches[1]."/"; 
     98      $r[$i] = (isset($matches[1]) ? $matches[1] : "") . "/"; 
    9999    } 
    100100    return $r; 
     
    205205      } 
    206206      fseek($file,SEEK_END); 
    207       if (substr($t[1],-1)!="\n") { 
     207      if (isset($t[1]) && substr($t[1],-1)!="\n") { 
    208208        fwrite($file,"\n"); 
    209209      } 
  • alternc/branches/franck-desktop/bureau/class/m_mail.php

    r1802 r1804  
    182182      $account=str_replace($login,"",$db->f("alias")); 
    183183    } else { 
     184        $login = ""; 
    184185      $account=$db->f("alias"); 
    185186    } 
  • alternc/branches/franck-desktop/bureau/class/m_mailman.php

    r1797 r1804  
    2929*/ 
    3030class m_mailman { 
    31    
     31 
    3232  /* ----------------------------------------------------------------- */ 
    3333  function m_mailman() { 
    3434  } 
    35    
     35 
    3636  /* ----------------------------------------------------------------- */ 
    3737  /** 
     
    6363    return $mls; 
    6464  } 
    65    
     65 
    6666  /*****************************************************************************/ 
    6767  function prefix_list() { 
     
    8585    return true; 
    8686  } 
    87    
     87 
     88  /*****************************************************************************/ 
     89        /** Get list informations */ 
     90        function get_lst($id) 
     91        { 
     92                global $db, $err, $cuid; 
     93                $err->log("mailman","get_list", $cuid); 
     94 
     95                $q = "SELECT * FROM mailman WHERE uid = '" . $cuid . "' && id = '" . $id . "'"; 
     96                $db->query($q); 
     97                $db->next_record(); 
     98                if (!$db->f("id")) 
     99                { 
     100                        $err->raise("mailman",9); 
     101                        return false; 
     102                } 
     103                $login = $db->f("list"); 
     104                $domain = $db->f("domain"); 
     105                return $login . "@" . $domain; 
     106        } 
     107 
    88108  /*****************************************************************************/ 
    89109  /** Create a new list for this member : */ 
     
    91111    global $db,$err,$quota,$mail,$cuid; 
    92112    $err->log("mailman","add_lst",$login."@".$domain." - ".$owner); 
    93      
     113 
    94114    if ($login=="") { 
    95115      $err->raise("mailman",2); 
     
    116136    } 
    117137    // Prefixe OK, on verifie la non-existence des mails que l'on va créer... 
    118     if (!$mail->available($login."@".$domain) ||  
    119         !$mail->available($login."-request@".$domain) ||  
    120         !$mail->available($login."-owner@".$domain) ||  
    121         !$mail->available($login."-admin@".$domain) ||  
    122         !$mail->available($login."-bounces@".$domain) ||  
    123         !$mail->available($login."-confirm@".$domain) ||  
    124         !$mail->available($login."-join@".$domain) ||  
    125         !$mail->available($login."-leave@".$domain) ||  
    126         !$mail->available($login."-subscribe@".$domain) ||  
     138    if (!$mail->available($login."@".$domain) || 
     139        !$mail->available($login."-request@".$domain) || 
     140        !$mail->available($login."-owner@".$domain) || 
     141        !$mail->available($login."-admin@".$domain) || 
     142        !$mail->available($login."-bounces@".$domain) || 
     143        !$mail->available($login."-confirm@".$domain) || 
     144        !$mail->available($login."-join@".$domain) || 
     145        !$mail->available($login."-leave@".$domain) || 
     146        !$mail->available($login."-subscribe@".$domain) || 
    127147        !$mail->available($login."-unsubscribe@".$domain)) { 
    128148      // This is a mail account already !!! 
     
    132152    // Le compte n'existe pas, on vérifie le quota et on le créé. 
    133153    if ($quota->cancreate("mailman")) { 
    134       // Creation de la liste : 1. recherche du nom de la liste  
     154      // Creation de la liste : 1. recherche du nom de la liste 
    135155      // CA NE MARCHE PAS ! 
    136       $name=$login;  
     156      $name=$login; 
    137157      $db->query("INSERT INTO mailman (uid,list,domain,name) VALUES ('$cuid','$login','$domain','$name');"); 
    138       if (!$mail->add_wrapper($login,$domain,"/var/lib/mailman/mail/mailman post $name","mailman") ||  
    139           !$mail->add_wrapper($login."-request",$domain,"/var/lib/mailman/mail/mailman request $name","mailman") ||  
    140           !$mail->add_wrapper($login."-owner",$domain,"/var/lib/mailman/mail/mailman owner $name","mailman") ||  
    141           !$mail->add_wrapper($login."-admin",$domain,"/var/lib/mailman/mail/mailman admin $name","mailman") ||  
    142           !$mail->add_wrapper($login."-bounces",$domain,"/var/lib/mailman/mail/mailman bounces $name","mailman") ||  
    143           !$mail->add_wrapper($login."-confirm",$domain,"/var/lib/mailman/mail/mailman confirm $name","mailman") ||  
     158      if (!$mail->add_wrapper($login,$domain,"/var/lib/mailman/mail/mailman post $name","mailman") || 
     159          !$mail->add_wrapper($login."-request",$domain,"/var/lib/mailman/mail/mailman request $name","mailman") || 
     160          !$mail->add_wrapper($login."-owner",$domain,"/var/lib/mailman/mail/mailman owner $name","mailman") || 
     161          !$mail->add_wrapper($login."-admin",$domain,"/var/lib/mailman/mail/mailman admin $name","mailman") || 
     162          !$mail->add_wrapper($login."-bounces",$domain,"/var/lib/mailman/mail/mailman bounces $name","mailman") || 
     163          !$mail->add_wrapper($login."-confirm",$domain,"/var/lib/mailman/mail/mailman confirm $name","mailman") || 
    144164          !$mail->add_wrapper($login."-join",$domain,"/var/lib/mailman/mail/mailman join $name","mailman") || 
    145           !$mail->add_wrapper($login."-leave",$domain,"/var/lib/mailman/mail/mailman leave $name","mailman") ||  
    146           !$mail->add_wrapper($login."-subscribe",$domain,"/var/lib/mailman/mail/mailman subscribe $name","mailman") ||  
     165          !$mail->add_wrapper($login."-leave",$domain,"/var/lib/mailman/mail/mailman leave $name","mailman") || 
     166          !$mail->add_wrapper($login."-subscribe",$domain,"/var/lib/mailman/mail/mailman subscribe $name","mailman") || 
    147167          !$mail->add_wrapper($login."-unsubscribe",$domain,"/var/lib/mailman/mail/mailman unsubscribe $name","mailman") 
    148168          ) { 
    149169        $mail->del_wrapper($login,$domain);             $mail->del_wrapper($login."-request",$domain); 
    150170        $mail->del_wrapper($login."-owner",$domain);    $mail->del_wrapper($login."-admin",$domain); 
    151         $mail->del_wrapper($login."-bounces",$domain);  $mail->del_wrapper($login."-confirm",$domain);  
     171        $mail->del_wrapper($login."-bounces",$domain);  $mail->del_wrapper($login."-confirm",$domain); 
    152172        $mail->del_wrapper($login."-join",$domain);     $mail->del_wrapper($login."-leave",$domain); 
    153173        $mail->del_wrapper($login."-subscribe",$domain);        $mail->del_wrapper($login."-unsubscribe",$domain); 
     
    163183    } 
    164184  } 
    165    
     185 
    166186  /*****************************************************************************/ 
    167187  function delete_lst($id) { 
    168188    global $db,$err,$mail,$cuid; 
    169189    $err->log("mailman","delete_lst",$id); 
    170      
     190 
    171191    $db->query("SELECT * FROM mailman WHERE id=$id and uid='$cuid';"); 
    172192    $db->next_record(); 
     
    181201    $mail->del_wrapper($login,$domain);         $mail->del_wrapper($login."-request",$domain); 
    182202    $mail->del_wrapper($login."-owner",$domain);        $mail->del_wrapper($login."-admin",$domain); 
    183     $mail->del_wrapper($login."-bounces",$domain);      $mail->del_wrapper($login."-confirm",$domain);  
     203    $mail->del_wrapper($login."-bounces",$domain);      $mail->del_wrapper($login."-confirm",$domain); 
    184204    $mail->del_wrapper($login."-join",$domain); $mail->del_wrapper($login."-leave",$domain); 
    185205    $mail->del_wrapper($login."-subscribe",$domain);    $mail->del_wrapper($login."-unsubscribe",$domain); 
     
    188208 
    189209  /* ----------------------------------------------------------------- */ 
    190   /** Returns the list's members as a text file, one subscriber per  
    191    *   line.  
     210  /** Returns the list's members as a text file, one subscriber per 
     211   *   line. 
    192212   */ 
    193213 function members($id) { 
  • alternc/branches/franck-desktop/bureau/class/m_mem.php

    r1533 r1804  
    3333  /** Original uid for the temporary uid swapping (for administrators) */ 
    3434  var $olduid=0; 
    35    
     35 
    3636  /** This array contains the Tableau contenant les champs de la table "membres" du membre courant 
    3737   * Ce tableau est utilisable globalement par toutes les classes filles. 
     
    6767   * @return boolean TRUE if the user has been successfully connected, or FALSE if an error occured. 
    6868   */ 
    69   function login($username,$password,$restrictip=0) { 
    70     global $db,$session,$err,$cuid; 
    71     $err->log("mem","login",$username); 
     69  function login($username, $password, $restrictip = 0) { 
     70    global $db, $err, $cuid; 
     71    $err->log("mem", "login", $username); 
    7272    //    $username=addslashes($username); 
    7373    //    $password=addslashes($password); 
    74     $db->query("select * from membres where login='$username';"); 
     74    $db->query("SELECT * FROM membres WHERE login = '" . $username . "';"); 
    7575    if ($db->num_rows()==0) { 
    7676      $err->raise("mem",1); 
     
    8282      $err->raise("mem",1); 
    8383      return false; 
    84     }  
     84    } 
    8585    if (!$db->f("enabled")) { 
    8686      $err->raise("mem",2); 
     
    9595    $db->query("DELETE FROM sessions WHERE DATE_ADD(ts,INTERVAL 2 DAY)<NOW();"); 
    9696    /* Open the session : */ 
    97     $session=md5(uniqid(mt_rand())); 
     97    $session = md5(uniqid(mt_rand())); 
    9898    $db->query("insert into sessions (sid,ip,uid) values ('$session',$ip,'$cuid');"); 
    9999    setcookie("session",$session,0,"/"); 
     
    113113   * account (for good), and su allow any user to become another account for some commands only. 
    114114   * (del_user, add_user ...) and allow to bring back admin rights with unsu 
    115    *  
     115   * 
    116116   * @param $id integer User id where we will connect to. 
    117117   * @return boolean TRUE if the user has been successfully connected, FALSE else. 
    118118   */ 
    119119  function setid($id) { 
    120     global $db,$session,$err,$cuid; 
     120    global $db,$err,$cuid; 
    121121    $err->log("mem","setid",$username); 
    122122    $db->query("select * from membres where uid='$id';"); 
     
    162162   * @return TRUE si la session est correcte, FALSE sinon. 
    163163   */ 
    164   function checkid() { 
    165     global $db,$err,$session,$username,$password,$cuid,$restrictip; 
    166     if ($username && $password) { 
    167       return $this->login($username,$password,$restrictip); 
    168     } 
    169     $session=addslashes($session); 
    170     if (strlen($session)!=32) { 
    171       $err->raise("mem",3); 
    172       return false; 
    173     } 
    174     $ip=getenv("REMOTE_ADDR"); 
    175     $db->query("select uid,INET_ATON('$ip') as me,ip from sessions where sid='$session'"); 
    176     if ($db->num_rows()==0) { 
    177       $err->raise("mem",4); 
    178       return false; 
    179     } 
    180     $db->next_record(); 
    181     if ($db->f("ip")) { 
    182       if ($db->f("me")!=$db->f("ip")) { 
    183         $err->raise("mem",5); 
    184         return false; 
    185       } 
    186     } 
    187     $cuid=$db->f("uid"); 
    188     $db->query("select * from membres where uid='$cuid';"); 
    189     $db->next_record(); 
    190     $this->user=$db->Record; 
    191     $err->error=0; 
    192     /* Remplissage de $local */ 
    193     $db->query("SELECT * FROM local WHERE uid='$cuid';"); 
    194     if ($db->num_rows()) { 
    195       $db->next_record(); 
    196       $this->local=$db->Record; 
    197     } 
    198     return true; 
    199   } 
     164  function checkid($username, $password, $restrictip) { 
     165                global $db, $err, $cuid; 
     166 
     167                if ($username && $password) 
     168                { 
     169                        return $this->login($username, $password, $restrictip); 
     170                } 
     171 
     172                $session = isset($_COOKIE["session"]) ? addslashes($_COOKIE["session"]) : ""; 
     173                if (strlen($session) != 32) 
     174                { 
     175                        $err->raise("mem", 3); 
     176                        return false; 
     177                } 
     178                $ip = getenv("REMOTE_ADDR"); 
     179                $db->query("SELECT uid, INET_ATON('" . $ip . "') AS me, ip FROM sessions WHERE sid='" . $session . "'"); 
     180                if ($db->num_rows()==0) { 
     181                        $err->raise("mem",4); 
     182                        return false; 
     183                } 
     184                $db->next_record(); 
     185                if ($db->f("ip")) { 
     186                        if ($db->f("me")!=$db->f("ip")) { 
     187                                $err->raise("mem",5); 
     188                                return false; 
     189                        } 
     190                } 
     191                $cuid=$db->f("uid"); 
     192                $db->query("select * from membres where uid='$cuid';"); 
     193                $db->next_record(); 
     194                $this->user=$db->Record; 
     195                $err->error=0; 
     196                /* Remplissage de $local */ 
     197                $db->query("SELECT * FROM local WHERE uid='$cuid';"); 
     198                if ($db->num_rows()) { 
     199                        $db->next_record(); 
     200                        $this->local=$db->Record; 
     201                } 
     202                return true; 
     203        } 
    200204 
    201205  /* ----------------------------------------------------------------- */ 
     
    238242   */ 
    239243  function del_session() { 
    240     global $db,$session,$user,$err,$cuid; 
     244    global $db,$user,$err,$cuid; 
    241245    $err->log("mem","del_session"); 
    242     $session=addslashes($session)
     246    $session = isset($_COOKIE["session"]) ? addslashes($_COOKIE["session"]) : ""
    243247    setcookie("session","",0,"/"); 
    244248    if ($session=="") { 
     
    355359Note : si vous n'avez pas fait cette demande, cela signifie que 
    356360quelqu'un l'a faite pour vous. Vous pouvez donc ignorer ce message. 
    357 Si cela se reproduit, n'hésitez pas à contacter l'administrateur  
     361Si cela se reproduit, n'hésitez pas à contacter l'administrateur 
    358362de votre serveur. 
    359363 
     
    466470  function show_help($file) { 
    467471    global $err; 
    468     $err->log("mem","show_help",$show); 
     472    $err->log("mem","show_help"); 
    469473    if ($this->user["show_help"]) { 
    470474      $hlp=_("hlp_$file"); 
     
    487491   * Exports all the personnal user related information for an account. 
    488492   * @access private 
    489    * EXPERIMENTAL 'sid' function ;)  
     493   * EXPERIMENTAL 'sid' function ;) 
    490494   */ 
    491495  function alternc_export($tmpdir) { 
  • alternc/branches/franck-desktop/bureau/class/m_mysql.php

    r1797 r1804  
    517517        $r[]=array("db"=>$dblist[$i]["name"], "select"=>$db->f("Select_priv"), "insert"=>$db->f("Insert_priv"), "update"=>$db->f("Update_priv"), "delete"=>$db->f("Delete_priv"), "create"=>$db->f("Create_priv"), "drop"=>$db->f("Drop_priv"), "references"=>$db->f("References_priv"), "index"=>$db->f("Index_priv"), "alter"=>$db->f("Alter_priv"), "create_tmp"=>$db->f("Create_tmp_table_priv"), "lock"=>$db->f("Lock_tables_priv")); 
    518518      else 
    519         $r[]=array("db"=>$dblist[$i]["name"], "select"=>"N", "insert"=>"N", "update"=>"N", "delete"=>"N", "create"=>"N", "drop"=>"N", "references"=>"N", "index"=>"N", "alter"=>"N", "Create_tmp"=>"N", "lock"=>"N" ); 
     519        $r[]=array("db"=>$dblist[$i]["name"], "select"=>"N", "insert"=>"N", "update"=>"N", "delete"=>"N", "create"=>"N", "drop"=>"N", "references"=>"N", "index"=>"N", "alter"=>"N", "create_tmp"=>"N", "lock"=>"N" ); 
    520520    } 
    521521 
     
    525525  function set_user_rights($user,$dbn,$rights) { 
    526526    global $mem, $db; 
    527  
     527    $strrights = ""; 
    528528    $usern=addslashes($mem->user["login"].($user?"_":"").$user); 
    529529    $dbname=addslashes($mem->user["login"].($dbn?"_":"").$dbn); 
  • alternc/branches/franck-desktop/bureau/class/m_quota.php

    r1797 r1804  
    130130    } else { 
    131131      while ($db->next_record()) { 
    132         $ttmp[]=$db->Record; 
     132                       $ttmp[]=$db->Record; 
    133133      } 
    134134      foreach ($ttmp as $tt) { 
    135135        $g=array("t"=>$tt["total"],"u"=>0); 
    136         if (method_exists($GLOBALS[$this->clquota[$tt["name"]]],"alternc_get_quota")) { 
    137           $g["u"]=$GLOBALS[$this->clquota[$tt["name"]]]->alternc_get_quota($tt["name"]); 
    138         } 
     136        if (isset($this->disk[$tt["name"]])) 
     137                continue; 
     138 
     139                if (method_exists($GLOBALS[$this->clquota[$tt["name"]]],"alternc_get_quota")) 
     140                { 
     141                        $g["u"]=$GLOBALS[$this->clquota[$tt["name"]]]->alternc_get_quota($tt["name"]); 
     142                } 
     143 
    139144        $this->quotas[$tt["name"]]=$g; 
    140145      } 
     
    144149      $a=array(); 
    145150      exec("/usr/lib/alternc/quota_get ".$cuid." ".$val,$a); 
    146       $this->quotas[$val]=array("t"=>$a[1],"u"=>$a[0]); 
     151                        if (isset($a[0]) && isset($a[1])) 
     152        $this->quotas[$val] = array("t"=>$a[1],"u"=>$a[0]); 
     153                        else 
     154        $this->quotas[$val] = array("t" => "", "u" => ""); 
     155 
    147156    } 
    148157 
     
    163172    $err->log("quota","setquota",$ressource."/".$size); 
    164173    if (intval($size)==0) $size="0"; 
    165     if ($this->disk[$ressource]) { 
     174    if (isset($this->disk[$ressource])) { 
    166175      // It's a disk resource, update it with shell command 
    167176      exec("/usr/lib/alternc/quota_edit $cuid $size"); 
    168177      // Now we check that the value has been written properly : 
    169178      exec("/usr/lib/alternc/quota_get ".$cuid,$a); 
    170       if ($size!=$a[1]) { 
     179      if (isset($a[1]) && $size != $a[1]) { 
    171180                                $err->raise("quota",1); 
    172181                                return false; 
  • alternc/branches/franck-desktop/bureau/class/m_sta2.php

    r789 r1804  
    3131/** 
    3232* This class manages raw Apache log file for the end users. 
    33 *  
    34 * This class allow each AlternC's account to get its raw apache log  
     33* 
     34* This class allow each AlternC's account to get its raw apache log 
    3535* file put in its user space every day. <br> 
    3636* The file is stored in the user space and will grow from time to time... 
    37 *  
     37* 
    3838* @copyright    AlternC's Team 2002-2005 http://alternc.org/ 
    39 *  
     39* 
    4040*/ 
    4141class m_sta2 { 
     
    5050  /* ----------------------------------------------------------------- */ 
    5151  /** Hook function that returns the quota names for this class 
    52    *  
     52   * 
    5353   * @return string the quota names for this class 
    5454   */ 
    5555  function alternc_quota_names() { 
    5656    return "sta2"; 
    57   }  
     57  } 
    58