<?php
 /***************************************************************************
 *   Copyright (C) 2008 by oscim   Project lossim                          *
 *   a@oscim.fr                                                            *
 *       [created : 14.03.2008, 17:53:41] @oscim                           *
 ***************************************************************************/

 print "<div style='color:red'>";
if ( (!file_exists('../img/'))  AND (!@mkdir('../img/', 0777)) ) print ALERT_DIR." /img <br />";
if ( (!file_exists('../tmp/'))  AND (!@mkdir('../tmp/', 0777)) ) print ALERT_DIR." /tmp <br />";
if ( (!file_exists('../log/'))  AND (!@mkdir('../log/', 0777)) ) print ALERT_DIR." /log <br />";
if ( (!file_exists('../img/thumb/'))  AND(!@mkdir('../img/thumb/', 0777)) ) print ALERT_DIR." ../img/thumb/<br />";
if ( (!file_exists('../img/mini/'))  AND(!@mkdir('../img/mini/', 0777)) ) print ALERT_DIR." ../img/thumb/<br />";
if ( (!file_exists('../xml/'))  AND(!@mkdir('../xml/',0777)) ) print ALERT_DIR." /xml<br />";
if ( (!file_exists('../xml/bak/'))  AND(!@mkdir('../xml/bak/', 0777)) ) print ALERT_DIR." /xml/bak/<br />";
if ( (!file_exists('../cache/'))  AND(!@mkdir('../cache/', 0777)) ) print ALERT_DIR." /cache<br />";
if ( (!file_exists('../rss/'))  AND(!@mkdir('../rss/', '0777')) ) print ALERT_DIR." /rss<br />";
if ( (!file_exists('../include/menu/'))  AND(!@mkdir('../include/menu/', 0777)) ) print ALERT_DIR." /include/menu<br />";
if ( (!file_exists('../include/config/'))  AND(!@mkdir('../include/config/', 0777)) ) print ALERT_DIR." /include/config<br />";
if ( (!file_exists('../template/'))  AND(!@mkdir('../template/', 0777)) ) print ALERT_DIR." /template/<br />";
if ( (!file_exists('../admin/cache/'))  AND(!@mkdir('../admin/cache/', 0777)) ) print ALERT_DIR." /admin/cache/<br />";
if ( (!file_exists('../admin/config/'))  AND(!@mkdir('../admin/config/', 0777)) ) print ALERT_DIR." /admin/config/<br />";
if ( (!file_exists('../admin/config/users/'))  AND(!@mkdir('../admin/config/users/', 0777)) ) print ALERT_DIR." /admin/config/users/<br />";
 print "</div>";
 ?>
<h1><?php print TITLE_ETP_1." ".$_PX_config['vers_setup'] ?></h1>
<form name='formt' enctype="multipart/form-data" action='setup.php?etape=2' Method='POST'>
<h2><?php print CHOIX_LANG ?></h2>
<p><?php print NOTE_CHOIX_LANG ?></p>
<select name="choix_lang">
 	<option value="fr"><?php print FR ?></option>
	<option value="en"><?php print EN ?></option>
</select>

<h2><?php print TYPE_INSTALL ?></h2>
<p><?php print NOTE_TYPE_INSTALL ?></p>
install<input type='radio' name='install' value='i' checked/> re-install <input type='radio' name='install' value='r' />

<h2>Config</h2>
<p><?php print "OS system: ".OS_DU_SERVEUR  ?></p>
<p><?php print "PHP version: ".PHP  ?></p>

<h2><?php echo TIT_ETP_1_H2 ?></h2>

<?php
##Fichier et repertoire a controller
$rep_a_verif=array( "Les Datas" => "../xml/",
		"Les feeds" => "../rss",
		"temporaire" => "../tmp",
		"Les includes" => "../include",
		"Les modules" => "../include/modules",
		"Les menu public" => "../include/menu",
		"config" => "../include/config",
		 "Les templates" => "../template",
		 "Les images" => "../img",
		 "Les images miniature" => "../img/thumb",
		"rep config admin" => "../admin/config",
		"Le rep cache admin" => "../admin/cache",
		"Le repertoire du cache" => "../cache"
		);
## Fichier et rep necessaire en lecture ecriture
$rep_ecriture=array( "../xml/",
		"../rss",
		"../tmp",
		"../img/thumb",
		"../img",
		"../cache",
		"../admin/cache",
		"../template",
		"../include/modules",
		"../include/menu",
	 	"../include/config",
  		"../include",
		"../admin/config",
		"../admin/config/users/"

		);

if (!empty($rep_a_verif)) {
	$aff.= "<table>\n"
	."<tbody>\n"
		."";

	$aff.= " <tr>\n"
		."<th>repertoire</th><th>etat</th>"
		."</tr>\n";



 while ( $row =each($rep_a_verif)){
	if (file_exists ($row['value'])){
		if (is_dir($row['value'])) {
			if  ( (is_writable($row['value'])) OR OS_DU_SERVEUR == "windows") {
				if (in_array($row['value'],$rep_ecriture)) $aff .="<tr><td>".$row['value']."</td><td class='ok'>Ecriture possible Ok</td></tr>\n";
				else $aff .="<tr><td>".$row['value']."</td><td class='erreur'>Erreur Ecriture impossible</td></tr>\n";
			}
			else {
// 			if  ( (is_writable($row['value'])) OR OS_DU_SERVEUR == "windows") {
				if (in_array($row['value'],$rep_ecriture)) $aff .="<tr><td>".$row['value']."</td><td class='erreur'>Erreur Ecriture impossible</td></tr>\n";
				else $aff .="<tr><td>".$row['value']."</td><td class='ok'>Lecture uniquement Ok</td></tr>\n";
			}
// 			}
		}elseif (is_file($row['value'])) {
			if ( (is_writable($row['value'])) OR OS_DU_SERVEUR == "windows") {
				if (in_array($row['value'],$rep_ecriture)) $aff .="<tr><td>".$row['value']."</td><td class='ok'>Ecriture possible Ok</td></tr>\n";
				else $aff .="<tr><td>".$row['value']."</td><td class='erreur'>Erreur Ecriture impossible</td></tr>\n";
			}
			else {
// 			if  ( (is_writable($row['value'])) OR OS_DU_SERVEUR == "windows") {
				if (in_array($row['value'],$rep_ecriture)) $aff .="<tr><td>".$row['value']."</td><td class='erreur'>Erreur Ecriture impossible</td></tr>\n";
				else $aff .="<tr><td>".$row['value']."</td><td class='ok'>Lecture uniquement Ok</td></tr>\n";
			}
// 			}
		}else $aff .="<tr><td>le fichier ".$row['key']."</td><td>".$row['value']."</td><td>Inconnu</td></tr>\n";
	}else $aff .="<tr><td> ".$row['key']."</td><td>".$row['value']."</td><td>Le fichier ou repertoire doit être creer</td></tr>\n";
}
	$aff.= "</table>\n"
	."</tbody>\n"
		."";
}


echo $aff;



?>
<p><?php echo NOTE_ETP_1 ?></p>
<input type='submit' name='boutton' value='Suivant'>
<a href="#" onclick="window.location.reload()"><?php print RECHARGER ?></a>
</form>

