require 'config.php';
+// global variables, globals should remain contant
+$scriptUrl = $_SERVER["SCRIPT_NAME"];
+$rootUrl = dirname($scriptUrl);
+if (substr($rootUrl, -1) !== '/') $rootUrl.='/'; // add a trailing / to rootUrl
+// $scriptUrl = "/path/to/bizou/index.php"
+// $rootUrl = "/path/to/bizou/"
+
// load plugins
$plugins = array();
if (is_dir("plugins")) {
if (! function_exists('getImageLink')) {
function getImageLink($imageSimplePath)
{
- return dirname($_SERVER["SCRIPT_NAME"]).'/'.IMAGES_DIR.$imageSimplePath;
+ return $GLOBALS['rootUrl'].IMAGES_DIR.$imageSimplePath;
}
}
imagedestroy($newImg);
}
- return dirname($_SERVER["SCRIPT_NAME"])."/".$newImgFile;
+ return $GLOBALS['rootUrl'].$newImgFile;
}
function getAlbumPreview($dir)
return '';
}
-$scriptUrl = $_SERVER["SCRIPT_NAME"];
-$rootUrl = dirname($scriptUrl);
-// $scriptUrl = "/path/to/bizou/index.php"
-// $rootUrl = "/path/to/bizou"
-
// if url == http://localhost/photos/index.php/toto/titi, path_info == /toto/titi
// if url == http://localhost/photos/index.php, path_info is not set
// if url == http://localhost/photos/, path_info is not set
if ($ext == ".jpg" or $ext == ".png") {
$imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => getImageLink("$simplePath/$file") );
} else {
- $otherFiles[] = array( "name" => $file, "link" => "$rootUrl/$realDir/$file" );
+ $otherFiles[] = array( "name" => $file, "link" => "$rootUrl$realDir/$file" );
}
}
}
}
</style>
<?php foreach ($plugins as $p) if (is_file("plugins/$p/style.css")) { ?>
- <link rel="stylesheet" type="text/css" href="<?php echo "$rootUrl/plugins/$p/style.css" ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php echo $rootUrl."plugins/$p/style.css" ?>" />
<?php } ?>
</head>
<body>