Show
Ignore:
Timestamp:
04/26/06 14:51:03 (3 years ago)
Author:
benjamin
Message:

Prevents the overwrite of existing stats or web pages by webalizer daily process. Closes #89

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc-webalizer/trunk/bureau/class/m_webalizer.php

    r1520 r1525  
    237237    $lo=$mem->user["login"]; 
    238238    $l=substr($lo,0,1); 
     239    // Un jeu de stat utilise-t-il déjà ce dossier ?  
     240    $db->query("SELECT COUNT(*) AS ct FROM stats WHERE dir='/var/alternc/html/$l/$lo/$dir' AND id!='$id';"); 
     241    $db->next_record(); 
     242    if ($db->f("ct")) { 
     243      $err->raise("webalizer",7); 
     244      return false; 
     245    } 
     246    // Un fichier index existe-t-il déjà dans ce dossier ?  
     247    if (file_exists("/var/alternc/html/$l/$lo/$dir/index.html") ||  
     248        file_exists("/var/alternc/html/$l/$lo/$dir/index.htm") ||  
     249        file_exists("/var/alternc/html/$l/$lo/$dir/index.php") ||  
     250        file_exists("/var/alternc/html/$l/$lo/$dir/index.php3") ||  
     251        file_exists("/var/alternc/html/$l/$lo/$dir/index.php4") 
     252        ) { 
     253      $err->raise("webalizer",8); 
     254      return false; 
     255    } 
    239256    $db->query("UPDATE stats SET lang='$stlang', dir='/var/alternc/html/$l/$lo/$dir', uid='$cuid' WHERE id='$id';"); 
    240257    $this->_createconf($id); 
     
    289306    $lo=$mem->user[login]; 
    290307    $l=substr($lo,0,1); 
     308    // Un jeu de stat utilise-t-il déjà ce dossier ?  
     309    $db->query("SELECT COUNT(*) AS ct FROM stats WHERE dir='/var/alternc/html/$l/$lo/$dir';"); 
     310    $db->next_record(); 
     311    if ($db->f("ct")) { 
     312      $err->raise("webalizer",7); 
     313      return false; 
     314    } 
     315    // Un fichier index existe-t-il déjà dans ce dossier ?  
     316    if (file_exists("/var/alternc/html/$l/$lo/$dir/index.html") ||  
     317        file_exists("/var/alternc/html/$l/$lo/$dir/index.htm") ||  
     318        file_exists("/var/alternc/html/$l/$lo/$dir/index.php") ||  
     319        file_exists("/var/alternc/html/$l/$lo/$dir/index.php3") ||  
     320        file_exists("/var/alternc/html/$l/$lo/$dir/index.php4") 
     321        ) { 
     322      $err->raise("webalizer",8); 
     323      return false; 
     324    } 
    291325    // Le compte n'existe pas, on le crée. 
    292326    if ($quota->cancreate("stats")) {