//$gallerypage = 1;
if (ini_set("register_globals", "1"));
else
{
foreach ($_REQUEST as $key => $value)
$$key = $value;
if (isset($_SESSION))
{
foreach ($_SESSION as $key => $value)
$$key = &$_SESSION[$key];
}
$PHP_SELF = $_SERVER["PHP_SELF"];
}
include("/var/www/common/share/util/lib/gallery.inc.php");
//$hdir = "http://202.1.119.149/gallery";
//$hdir = "http://60.242.28.17/gallery/";
//$hdir = "http://pedemont.net.au/~web4_daniel.g/g/";
$hdir = "http://pedemont.net.au/~dan/g/";
//$arrow_imgdir = "http://202.1.119.149/images";
//$arrow_imgdir = "http://60.242.28.17/images";
//$arrow_imgdir = "http://pedemont.net.au/~web4_daniel.g/images";
$arrow_imgdir = "http://pedemont.net.au/~dan/images";
//setup full disk path to gallery
//$GLOBALS["GDIR"] = _GINC_PATH . "/../gallery/";
$GLOBALS["GDIR"] = "/var/www/pedemont.net.au/user/dan/web/g/";
if (isset($dir))
{
$GLOBALS["GDIR"] = "{$GLOBALS['GDIR']}$dir/";
//setup full http path to gallery
$hdir = "{$hdir}$dir/";
}
// cache
$pad = 2; //amount of cells to side of index
$pa = get_pics($GDIR); // picture array
$pa_size = sizeof($pa); // lookup save
//setup index cell
if (isset($id) == false) $id = rand(0, $pa_size-1);
//setup left n right cells
//$lid = 0;
//$lid -= ($pa_size - $id) + $pad;
$lid = ($pa_size - $id) + $pad;
$l_gallery_pics = side_gallery($hdir, ",100", "$lid,$pad");
$r_gallery_pics = '';
if ($id < $pad)
{
$align=" align=\"right\"";
$l_gallery_pics = side_gallery($hdir, ",100", "0,".($pad+$id));
}
else
{
$l_gallery_pics = side_gallery($hdir, ",100", "$lid,$pad");
$r_gallery_pics = side_gallery($hdir, ",100", "$id,$pad");
}
//setup directory bar
$directory_pics = side_directory($hdir);
//setup navigation links
$phphrefattr = "?"; //"modules.php?name=Gallery&";
$prev = $id-1; $bar_prev = $id-($pad * 2);
$next = $id+1; $bar_next = $id+($pad * 2);
if ($bar_prev < 0 && $id > 0)
$bar_prev = 0;
if ($bar_next > ($pa_size-1) && $id < ($pa_size-1))
$bar_next = $pa_size-1;
if ($prev >= 0)
$xhtml_prev = "".($prev+1)." ";
else
$xhtml_prev = "";
if ($bar_prev >= 0)
$xhtml_bprev = ""
."
(".($bar_prev-$pad >= 0 ? ($bar_prev-$pad+1)." .. " : ($bar_prev+1 == 1 ? "" : "1 .. "))."".($bar_prev+1)." .. "
.($bar_prev+$pad).")";
else
$xhtml_bprev = "";
if ($next < $pa_size)
$xhtml_next = "".($next+1)." ";
else
$xhtml_next = "";
if ($bar_next < $pa_size)
$xhtml_bnext = ""
."
(".($bar_next-$pad+1)." .. ".($bar_next+1).""
.($bar_next+$pad < $pa_size ? ".. ".($bar_next+$pad+1) : "").")";
else
$xhtml_bnext = "";
//prepare xhtml
$filetype = @filetype($GDIR."/$pa[$id]");
if (! $filetype)
{
//if dir/id = bullshite
Header("Location: $hdir"); //"modules.php?name=Gallery");
return;
}
/*
if ($filetype == "dir" OR preg_match('/^\.\.$/', $pa[$id]))
{
list(, $id_img) = split("public_html/", _DIR_PIC);
$id_img = "/~swan/$id_img"; //"$id_img"; !!NB: this line can also make or brake things
}
*/
else
$id_img = "$hdir/$pa[$id]";
if (isset($dir))
$dir_html = "";
else
$dir_html = "";
$id_html = "";
$out = <<< EOF