/*
This script is part of FunkGallery. A PHP based photo gallery
Copyright (C) 2004 Colin Birch
This copyright message MUST NOT be removed
You can contact Colin Birch at: colin@funkboard.co.uk
*/
require("global.php");
require("text1.php");
//22-02-04
// added cat order_by
// added photoorder
// added thumbs in menu (tpath)
// added webmaster email check section
// altered _get & _post
$action=$_POST[action];
if(!$action) {$action=$_GET[action];}
$gll=$_POST[gll];
if(!$gll) {$gll=$_GET[gll];}
$maxp=$_POST[maxp];
if(!$maxp) {$maxp=$_GET[maxp];}
$vpic=$_POST[vpic];
if(!$vpic) {$vpic=$_GET[vpic];}
$tpic=$_POST[tpic];
if(!$tpic) {$tpic=$_GET[tpic];}
$picgal=$_POST[picgal];
if(!$picgal) {$picgal=$_GET[picgal];}
$wme=templates(webmasteremail);
if ($wme=='you@yourdomain.com') {
echo "Before you can run FunkGallery you MUST configure the Webmaster Email in the Admin Control Panel
To do this log into your Control Panel and click on Settings>Global Settings";
die;
}
list($galleryname,$trcolor,$trtext,$alt1,$alt2,$ext)=special_get();
$num=$funk->num_vals("SELECT uid FROM $cats ORDER BY order_by");
$cpnum=sizeof($num);
if ($cpnum>"0") $cpnum--;
if ($cpnum>"0") {
for($x=0;$x<=$cpnum;$x++) {
$categ[$x+1]=$funk->db_query("SELECT cat_name FROM $cats WHERE uid = '$num[$x]'");
}
}
$myhtml->top_html($galleryname,$galleryname,"","");
if (!$action) {
$c=$funk->num_vals("SELECT * FROM $files ORDER BY uploadtime");
while(list($i,$v) = each($c)) {
$vis=$funk->db_query("SELECT uploadtime FROM $files WHERE uid = '$v'");
$gal=$funk->db_query("SELECT gallery FROM $files WHERE uid = '$v'");
}
$vis=date("d/m/y",$vis);
$galn=$funk->db_query("SELECT gallery_name FROM $gallery WHERE uid = '$gal'");
$galn=stripslashes($galn);
?>
echo $tx1." ".$galn." ".$vis; ?>
|
echo $tx13; ?> | echo $tx14; ?> |
|
if ($picgal!="") {
$c=$funk->num_vals("SELECT * FROM $gallery WHERE category='$picgal' ORDER BY order_by");}
else {$c=$funk->num_vals("SELECT * FROM $gallery ORDER BY order_by");}
while(list($i,$v) = each($c)) {
$gn=$funk->db_query("SELECT gallery_name FROM $gallery WHERE uid = '$v'");
$tpath=$funk->db_query("SELECT tpath FROM $gallery WHERE uid = '$v'");
$vis=$funk->db_query("SELECT visible FROM $gallery WHERE uid = '$v'");
$co=$funk->db_query("SELECT gallery_comment FROM $gallery WHERE uid = '$v'");
$gn=stripslashes($gn);
$co=stripslashes($co);
if ($vis=="1") {
echo "";
if ($tpath!="") {$tpath="";
echo $tpath." ";
}
echo"$gn |
$co |
\n";
}
}
?>
} // end of action =""
elseif ($action=="view") {
$gn=$funk->db_query("SELECT gallery_name FROM $gallery WHERE uid = '$gll'");
$gn=stripslashes($gn);
?>
echo $gn;?> |
$twidth=templates(twidth);
$theight=templates(theight);
$s="SELECT * FROM $files WHERE gallery='$gll'";
$photoorder=templates(photoorder);
if ($photoorder=="0") {$s=$s." ORDER BY uid";}
if ($photoorder=="1") {$s=$s." ORDER BY file_name";}
if ($photoorder=="2") {$s=$s." ORDER BY file_name DESC";}
//$c=$funk->num_vals("SELECT * FROM $files WHERE gallery='$gll'");
$c=$funk->num_vals($s);
$pnum=sizeof($c);
if ($pnum=="0") {echo " $tx15";}
$tot=0;
$tpr=templates(tpr);
while(list($i,$v) = each($c)) {
if ($tot=="0") echo "";
$fln=$funk->db_query("SELECT file_name FROM $files WHERE uid='$v'");
$tpath=$funk->db_query("SELECT thumb_path FROM $gallery WHERE uid='$gll'");
if (!$tpath) {$fl="images/thumbs/".$fln;
} else {$fl=$tpath.$fln; }
if ($fln!="") {echo" | \n";}
else echo" | ";
$tot++;
if ($tot==$tpr) {echo " ";
$tot="0";}
}
?>
$c=$funk->num_vals("SELECT * FROM $comments WHERE gallery='$gll'");
while(list($i,$v) = each($c)) {
$nf=$funk->db_query("SELECT name_from FROM $comments WHERE uid = '$v'");
$comment=$funk->db_query("SELECT comment FROM $comments WHERE uid = '$v'");
$comment=stripslashes($comment);
$dt=$funk->db_query("SELECT date FROM $comments WHERE uid = '$v'");
$cdate=date("D d M Y @ H:i",$dt);
$outcomm=" From : ".$nf." (".$cdate.") ".$comment;
// echo $outcomm."
\n";
}
?>
if (templates(allowcomment)=="yes") {
?>
echo $tx2; ?>
}
?>
|
} // end of 'view'
elseif ($action=="addcomment"){
?>