/* * Yappa: Yet Another PHP Photo Album * A simple php file to put on a web server to administrate and see in a easy way all your photos. * Currently the easyest program to INSTALL AND MANAGE photos. * Author: manu@agat.net * WEB page: http://manu.agat.net/yappa/ * LICENSE: GPL. * Date: see version (YYYYMMDD) * Don't forget to make the current dir writeable by the web server */ $version="20010901"; //4.0.0 equivalent //error_reporting(0); //return the name of my own name cad index.php or index.php3 function getmyownname() { $data=basename($GLOBALS["PATH_TRANSLATED"]); return($data); }; //return current path (getcwd() came with php4 only) function mygetcwd() { $data=dirname($GLOBALS["PATH_TRANSLATED"]); return $data; }; //save the config file function writeconfig($dir,$varallow_comments,$varimg_per_row) { global $allow_comments,$img_per_row; $allow_comments=$varallow_comments; $img_per_row=$varimg_per_row; $fd=fopen("$dir/config.php","w"); $data=" \$img_per_row=$img_per_row;\n"; $data.="\$allow_comments=$allow_comments;\n"; $data.=" \n?>"; fwrite($fd,$data); fflush($fd); fclose($fd); }; function adminheaders($baseURL) { echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "| Yappa generated | "; echo "Administration center | Base of the photo album |
| "; } function adminendhtml() { echo " |
.
\n"; echo " \n"; echo "\n"; } // cut the begin of a path function stripbeginfrompath($base,$dir) { $data=split($base,$dir); return($data[1]); } // display directories recurslivy, $base is used to strip the begin of path. function recursdir($adir,$base) { $handle=opendir($adir); while ($file = readdir($handle)) { if (is_dir($adir."/".$file) && ($file!=".") && ($file!="..")&& ($file!=".tn") && ($file!="admin")) { $dir=$adir."/".$file; $actiondir=stripbeginfrompath($base,$dir); echo "| Base directory | "; echo "
| ".$file." | "; if ((eregi(".jpg$",$filename)) || (eregi(".jpeg$",$filename))) { echo "photo's comment | "; } else { if (ereg("config.php$",$filename)) { echo "config file | "; } else { echo ""; } } } echo " | delete file | " ; if ((eregi(".jpg$",$filename)) || (eregi(".jpeg$",$filename))) { echo "add a comment:"; echo " | "; } else { if (ereg("config.php$",$filename)) { echo "To use general options for comments and number of thumbnails per line, delete this file | "; } else { echo ""; } } echo " |
$file "; displaycomment($file); echo " | \n" ;
$counter++;
if ($counter==$img_per_row+1) { echo "
| Yappa generated | \n"; mysplit($uri); echo "\n"; echo ""; echo " | \n"; echo "
| \n";
mydirectorylist($uri);
echo "\n";
// If we are on the base directory, add admin link and forgotten pass
if (!is_link($index)) {
echo " "; echo "Administration (restricted area)"; echo " "; echo " (email will be verified before)"; } echo " | \n";
// end left side
// ############### begin for right side for photos
echo "\n"; // compute a table of all files. $indexpictures=GetDirArray(realpath(".")); if (isset($big)) { fulldisplay($big,$indexpictures); } else { if ((isset($Valider)) && ($allow_comments==1) ) { addcomment($ip,date("Y-m-d H:i"),$text,$nom,$img); } // create thumbnails if they don't exists. if ($autocreatethumbnails==1) { createtn(mygetcwd(),"color"); } displaygeneralcomment(); // display them displaytn($uri); } echo "\n"; echo " | \n"; // ############### end right side echo "
Yet Another PHP Photo Album";
echo "";
echo "Thanks for using YAPPA!";
echo "