/* * 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 at agat.net, oachler at ucsd.edu * WEB page: http://manu.agat.net/yappa/ * LICENSE: GPL. * Date: see version (YYYYMMDD) * Requirement: http://www.sentex.net/~mwandel/jhead/ for jpeg comments * * Don't forget to make the current dir writeable by the web server * */ // The next line must ONLY contain the version , no comments or other! $version="20030411"; //Forked 3.1.3 equivalent // Let's rename it to: 3.1.4 error_reporting(1); function writeconfig($dir,$varallow_comments,$varallow_jpeginfo,$varimg_per_row) { global $allow_comments,$img_per_row,$allow_jpeginfo; $allow_comments=$varallow_comments; $img_per_row=$varimg_per_row; $allow_jpeginfo=$varallow_jpeginfo; $fd=fopen("$dir/config.php","w"); $data=" \$img_per_row=$img_per_row;\n"; $data.="\$allow_comments=$allow_comments;\n"; $data.="\$allow_jpeginfo=$allow_jpeginfo;\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 ((ereg(".jpg$",$filename)) || (ereg(".JPG$",$filename)) || (ereg(".jpeg$",$filename))) { echo "photo's comment | "; } else { if (ereg("config.php$",$filename)) { echo "config file | "; } else { echo ""; } } } echo " | delete file | " ; if ((ereg(".jpg$",$filename)) || (ereg(".JPG$",$filename)) || (ereg(".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 "
";
system("jhead \"".rawurlencode($thedir.$image)."\"");
echo "";
if ($allow_comments==1) {
echo "\n";
}
}
//write a file in the current directory with al data for a comment
function addcomment($remote,$date,$text,$name,$file) {
if (is_writable(".")) {
$fd=fopen($file.".txt","a+");
fwrite($fd,"$remote|$date|$name|$text\n");
fclose($fd);
} else {
echo "pb pour ecrire";
};
};
// display a text file passed as argument
function displaycomment($file) {
if ((file_exists($file.".txt")) && (is_readable($file))) {
$fd=fopen($file.".txt","r");
$data=fread($fd,filesize($file));
fclose($fd);
$dataexploded=explode("\n",$data);
for($i=0;$i| 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.php")) {
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($jpeginfo)) { infodisplay($jpeginfo,$indexpictures); } else if (isset($original)) { originaldisplay($original,$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(getcwd(),"color"); } displaygeneralcomment(); // display them displaytn($uri); } echo "\n"; echo " | \n"; // ############### end right side echo "
Welcome to yappa. Please write your email, so I can send you a new password to administrate your Yet Another PHP Photo Album. If you don't have htpasswd in your path, edit and modifiy the script, or you won't be able to change your password! (will be fixed in next version)";
echo "