<?php
/**
* $Id$
* $Log$
*/
/**
* Vérifie que le chemin est correcte.
* @param $path le chemin à vérifier
* @return booléen
*/
function is_path_is_ok($path)
{
$realpath = BASE_dir . $path;
if(! (strpos($path, "..") > 0))
{
if(is_dir($realpath))
{
if(is_readable($realpath))
{
return("0 - ok");
}else return("3 - access denied");
}else return("2 - is not a directory");
}else return("1 - bad path");
}/* is_path_is_ok */
/**
* affiche une table et les tables internes, si il y en a
* @param $table la table
* @param $i profondeur de la table
*/
function afficheTable($table, $i)
{
while(list($k, $v) = each($table))
{
for($x=0; $x < $i; $x++) print(" ");
print("[$k,");
if(is_array($v))
{
print("<br>");
afficheTable($v, $i+1);
for($x=0; $x < $i; $x++) print(" ");
print("]<br>");
}
else
{
print("$v]<br>");
}
}
}/* afficheTable() */
/**
*
*/
function makeCSSList($current)
{
$list = array();
$path = CssDIR;
$mydir = opendir($path);
while($entry = readdir($mydir))
{
switch(filetype("$path/$entry"))
{
// Fichier à traiter
case "file":
if(preg_match("/^(.+)\.css$/", $entry, $matches))
{
if($current == "$entry")
$select = "selected";
else
$select = "";
$list[] = array("value" => $matches[0], "text" => $matches[1], "select" => $select);
}
break;
}
}
return($list);
}/*makeCSSList*/
function checkTmpDIR()
{
if(!is_dir(TmpDIR))
if(!mkdir(TmpDIR, 0777))
return(false);
if(!chmod(TmpDIR, 0777))
return(false);
return(true);
}
function disconnect()
{
header("WWW-Authenticate: Basic realm=\" RCS Manager \"");
header("HTTP/1.1 401 Unauthorized");
$page = new XTemplate(TplDIR . "/disconnect.xtpl");
$page->assign("redirect", "http://" . MySERVER);
$page->parse("main");
$page->out("main");
exit();
}
?>