Include this file in each directory of your website to display plots in a nice and searchable way ([[cern:website|full instructions]]). Made by Giovanni. (Replace the location of your website's icon ''favicon.ico''.)
\n";
print "Directories \n";
print "[parent] ";
foreach(glob("*") as $filename){
if(is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))){
print " [$filename] ";
}
}
print "";
}else{
print "";
}
foreach(array("00_README.txt", "README.txt", "readme.txt") as $readme){
if(file_exists($readme)){
#print "\n"; readfile($readme); print " ";
$readmeblock = file_get_contents($readme);
#$readmeblock = preg_replace("|\[\[([^\|\]]*)\|([^\|\]]*)\]\]|","$2 ",$readmeblock);
$readmeblock = preg_replace("|\[\[((?:(?!\]\])[^\|])*)\|([^\|\]]*)\]\]|","$2 ",$readmeblock);
$readmeblock = preg_replace("|\[\[([^\|\]]*)\]\]|","$1 ",$readmeblock);
print "\n"; print $readmeblock; print " ";
}
}
?>
1;
}
$displayed = array();
if($_GET['noplots']){
print "Plots will not be displayed.\n";
}else{
// Get images to be diplayed
$disp_filenames = array(); // images to be displayed
$png_filenames = glob("*.png");
$keywords = explode(" ",$_GET['match']);
$regex = isset($_GET['regexp']) && $_GET['regexp'];
foreach(glob("*.gif") as $filename){ // get animated GIFs
if(!matches($filename,$keywords,$regex)) continue;
//$png_filename = str_replace('.gif','.png',$filename);
$png_filename = preg_replace("~\.gif$~",'.png',$filename);
if(is_animated($filename)){
if(in_array($png_filename,$png_filenames)) // remove PNG
$png_filenames = array_diff($png_filenames,array($png_filename));
}else if(in_array($png_filename,$png_filenames)){ // give preference to PNG
continue;
}
array_push($disp_filenames,$filename);
}
foreach($png_filenames as $filename){ // get PNGs
if(!matches($filename,$keywords,$regex)) continue;
array_push($disp_filenames,$filename);
}
foreach(glob("*.jpg") as $filename){ // get JPGs
if(!matches($filename,$keywords,$regex)) continue;
$png_filename = preg_replace("~\.jpg$~",'.png',$filename);
$gif_filename = preg_replace("~\.jpg$~",'.gif',$filename);
if(!in_array($png_filename,$disp_filenames) and
!in_array($gif_filename,$disp_filenames)){ // give preference to PNG or animated GIF
array_push($disp_filenames,$filename);
}
}
// Display, and include other extensions
$other_exts = array('.pdf','.jpg','.png','.gif','.jpeg','.jpg','.eps','.root','.C','.cc','.cpp','.cxx','.txt','.tex','.log','.dir','.info','.psd');
natsort($disp_filenames); // natural sorting (for numbers)
foreach($disp_filenames as $filename){ // get PNGs
array_push($displayed, $filename);
$brfname = str_replace("_","_
",$filename); //
print "\n";
print "
";
print "
";
$others = array();
foreach($other_exts as $ex){
//$other_filename = str_replace('.png', $ex, $filename);
$other_filename = preg_replace("~\.(png|gif)$~",$ex,$filename);
if(strcmp($other_filename,$filename)==0) continue;
if(!file_exists($other_filename)) continue;
array_push($others, "
[" . $ex . "] ");
if($ex != '.txt') array_push($displayed, $other_filename);
}
if($others) print "
Also as ".implode(', ',$others)."
";
print "
";
}
}
?>