Recursos JClic Aula
settings->title;
}
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
return $rsc_name;
} // try
catch(Exception $e) {
echo 'Caught exception: '.$e->getMessage()."\n";
return $dir;
}
}
function CreateButton($dir, $resource, $class){
if ($class=="html"){
print(" ");
} else{
$rsc_name=getNameFromZip($dir, $resource);
if (!$rsc_name){$rsc_name=$dir;}
print(" ");
}
}
function LoadResourcesFromDir($jclicdirectory){
$jclicconten = opendir($jclicdirectory);
$lista = array();
while($jclicfile = readdir($jclicconten))
{
if (substr("$jclicfile", 0, 1) != ".")
{
$lista[] = $jclicfile;
}
}
if(count($lista)>0)
{
sort($lista);
// Search .html
$resource="";
foreach($lista as $item)
if($item=="index.html"){
$resource=$item;
break; }
if ($resource!=""){ // Found .html
// Button for resource
CreateButton($jclicdirectory, $resource, "html");
} else{ // Not found .html... search jclic.jclic
foreach($lista as $item){
if($item=="jclic.jclic"){
$resource=$item;
break;
}
}
if($resource!=""){ // Found jclic.jclic
//Button for jclic.jclic
CreateButton($jclicdirectory, $resource, "jclic");
} else {
foreach($lista as $item){
if((substr($item, -6 )==".jclic")){
$resource=$item;
break;
}
}
if($resource!=""){ // Found any .jclic
//Button for *.jclic
CreateButton($jclicdirectory, $resource, "jclic");
} else {
foreach($lista as $item){
if((substr($item, -10 )==".jclic.zip")){
//echo "FOUND JCLIC LISTS!!!!!";
$resource=$item;
if ($resource!=""){
// Button for .jclic.zip
CreateButton($jclicdirectory, $resource, "jclic");
}
//break;
}
}
/*if ($resource!=""){ -------> MOVED UP
// Button for .jclic.zip
CreateButton($jclicdirectory, $resource, "jclic");
}*/
}
}
}
}
}
function LoadResourcesFromMainDir($basePath){
// Loads any jclic resource from basepath
// loop through the array of files and print them all
$rootdirectory = opendir($basePath);
//Read directory
while($jclicdirectory = readdir($rootdirectory))
{
//Only list directories (or zips)
//echo($jclicdirectory." is ".mime_content_type($jclicdirectory).""); if (filetype($jclicdirectory) == "dir" || filetype($jclicdirectory) == "link") { //if (substr($jclicdirectory, -4)==".zip") echo "ES UN ZIP"; //Only enter non hide directory if (substr("$jclicdirectory", 0, 1) != "."&&$jclicdirectory!="jclic_uploads") { LoadResourcesFromDir($jclicdirectory); } } // if filetype... } // While } //obtener el locale $locale= get_locale(); // buscar title $titles = array(); $titles = preg_find("/\.title/", "./"); foreach ($titles as $title) { $txt=""; // comprobamos si no tiene extension "localizada" if ( ereg("\.title$", $title) ) { // lo mostraremos solamente si no existe version especifica para nuestro "locale" $testfile=$title . "." . $locale ; if ( ! is_file( $testfile ) ) $txt = file_get_contents($title); // en caso contrario, se muestra sólo si tiene extension para el "locale" actual } elseif ( ereg("\.title." . $locale, $title) ) { $txt = file_get_contents($title); } echo "
$txt
"; } ?>Running Lliurex