[Openfirst-cvscommit] photogallery email.php,1.5,1.6 gallery.php,1.6,1.7 gallery.PNG,1.1.1.1,1.2 ind
Brought to you by:
xtimg
From: <dav...@us...> - 2003-08-22 14:57:31
|
Update of /cvsroot/openfirst/photogallery In directory sc8-pr-cvs1:/tmp/cvs-serv19444 Modified Files: email.php gallery.php gallery.PNG index.php photogallery.php viewphoto.php Log Message: Changed system syntax. Made some bug changes. Prepared this module for complete audit. Index: email.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/email.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** email.php 21 Aug 2003 18:02:40 -0000 1.5 --- email.php 22 Aug 2003 14:57:28 -0000 1.6 *************** *** 27,88 **** */ ! // Import globals and estbalish database connection include("../config/globals.php"); include($header); include("admin/galleryglobals.php"); $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! if(ISSET($_POST['send'])){ ! ini_set("MAX_EXECUTION_TIME",$gallery_execution_time); ! ini_set("SMTP",$SMTP); ! $from = $_POST['name']; ! $email = $_POST['email']; ! $recipient = $_POST['recipient']; ! $recipientemail = $_POST['recipientemail']; ! $comment = $_POST['comment']; ! $headers = "MIME-Version: 1.0\r\n"; ! $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; ! $headers .= "From: ".$title." Photo Gallery <".$mailfrom.">\r\n"; ! $headers .= "Reply-To: ".$mailfrom."\r\n"; ! $headers .= "X-Priority: 1\r\n"; ! $headers .= "X-MSMail-Priority: High\r\n"; ! $message = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> ! <html><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> ! </head><body><div align='center'> ! <table width='550' border='0' cellspacing='0' cellpadding='0'> ! <tr> ! <td height='23'><p>Hello ".$recipient.",</p> ! <p>This is a message from the <b>".$title."</b> photo ! gallery mailing system. <b>".$from." (".$email.")</b> ! has requested that you peview this image. Here are his comments:</p> ! <table width='400' border='1' align='center' cellpadding='6' cellspacing='0' bordercolor='#333333'> ! <tr> ! <td height='23'><p>".$comment."<br> ! </p> ! </td> ! </tr> ! </table> ! <p align='center'><img src='".$home.$basepath."/photogallery/gallery/$gallery->GalleryName".$_POST['photo']."' width='300' height='200'></p> ! <p align='left'>Thank you for your time,</p> ! <p align='left'>The <b>".$title."</b> photo gallery.<br> ! </p></td> ! </tr> ! </table> ! </div></body></html>"; ! if(funcion_exists("multipartmail")){ multipartmail($recipientemail, $title."Gallery Photo Sender", $message); }else{ mail($recipientemail,$title." Gallery Photo Sender",$message,$headers) or die("<br><br><br><center>E-Mail was <b>not</b> successfully sent!</center>"); } ! echo "<br><br><br><center>Photo was successfully sent recipient, thank you! [ <a href='index.php'>Galleries</a> ]</center>"; die(include($footer)); --- 27,96 ---- */ ! // Include important globals related to this module include("../config/globals.php"); include($header); include("admin/galleryglobals.php"); + // Get gallery information $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! ! ! // If user has hit the send option then if(ISSET($_POST['send'])){ ! // Set the max execution time for the script so that it will not time out, then set the SMTP server to send with ! ini_set("MAX_EXECUTION_TIME",$gallery_execution_time); ! ini_set("SMTP",$SMTP); ! // Prepare information to be placed in e-mail ! $from = $_POST['name']; ! $email = $_POST['email']; ! $recipient = $_POST['recipient']; ! $recipientemail = $_POST['recipientemail']; ! $comment = $_POST['comment']; ! // Set header information in case the multipartmail function is not present ! $headers = "MIME-Version: 1.0\r\n"; ! $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; ! $headers .= "From: ".$title." Photo Gallery <".$mailfrom.">\r\n"; ! $headers .= "Reply-To: ".$mailfrom."\r\n"; ! $headers .= "X-Priority: 1\r\n"; ! $headers .= "X-MSMail-Priority: Medium\r\n"; ! // Declare the information to be placed in the email ! $message = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> ! <html><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> ! </head><body><div align='center'> ! <table width='550' border='0' cellspacing='0' cellpadding='0'> ! <tr> ! <td height='23'><p>Hello ".$recipient.",</p><p>This is a message from the <b>".$title."</b> photo ! gallery mailing system. <b>".$from." (".$email.")</b> ! has requested that you peview this image. Here are his comments:</p> ! <table width='400' border='1' align='center' cellpadding='6' cellspacing='0' bordercolor='#333333'> ! <tr> ! <td height='23'><p>".$comment."<br></p></td> ! </tr> ! </table> ! ! <p align='center'><img src='".$home.$basepath."/photogallery/gallery/$gallery->GalleryName".$_POST['photo']."' width='300' height='200'></p> ! <p align='left'>Thank you for your time,</p> ! <p align='left'>The <b>".$title."</b> photo gallery.<br></p> ! </td> ! </tr> ! </table></div></body></html>"; ! ! // Check if multipartmail is declared or else use regular mailing function ! if(function_exists("multipartmail")){ multipartmail($recipientemail, $title."Gallery Photo Sender", $message); }else{ mail($recipientemail,$title." Gallery Photo Sender",$message,$headers) or die("<br><br><br><center>E-Mail was <b>not</b> successfully sent!</center>"); } ! ! // Print out the completion of the e-mailing then die out ! echo "<br><br><br>Photo was successfully sent to the recipient, thank you! [ <a href='index.php'>Galleries</a> ]<br><br><br>"; die(include($footer)); *************** *** 91,102 **** ?> <h2>Send To A Friend</h2> ! <p>[ <a href="index.php">View Galleries</a> ] ! <p align="center"><br> ! <img border="1px" src="gallery/<?php echo $gallery->GalleryName."/".$_GET['PHOTO']; ?>" width="200" height="150"><br> ! <br> ! You have requested to send this photo to a friend. Please enter the required<br> ! information below. <form method="POST" action="email.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>"> ! <input type="hidden" name="photo" value="<?php echo $_GET['PHOTO']; ?>"> <table width="521" border="0" align="center" cellpadding="6" cellspacing="0"> <tr bgcolor="#999999"> --- 99,110 ---- ?> <h2>Send To A Friend</h2> ! <p>[ <a href="index.php">View Galleries</a> ]<br><br> ! ! <img border="1px" src="gallery/<?php echo $gallery->GalleryName."/".$_GET['PHOTO']; ?>" width="200" height="150"><br><br> ! You have requested to send this photo to a friend. Please enter the required<br>information below. ! <form method="POST" action="email.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>"> ! <input type="hidden" name="photo" value="<?php echo $_GET['PHOTO']; ?>"> ! <table width="521" border="0" align="center" cellpadding="6" cellspacing="0"> <tr bgcolor="#999999"> *************** *** 142,145 **** </table> </form> - <p> <?php include($footer); ?> --- 150,152 ---- Index: gallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/gallery.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gallery.php 20 Aug 2003 19:03:31 -0000 1.6 --- gallery.php 22 Aug 2003 14:57:28 -0000 1.7 *************** *** 27,31 **** */ ! // Import globals and estbalish database connection include("../config/globals.php"); include($header); --- 27,31 ---- */ ! // Include important globals related to this module include("../config/globals.php"); include($header); *************** *** 43,51 **** </tr> </table> ! <p> </p> ! <div align="center"></div> ! <div align="center"></div> ! <table width="75" border="0" align="center" cellpadding="5" cellspacing="0"> ! <tr><th></th><th><?php echo $gallery->GalleryName; ?></th><th></th></tr> <?php --- 43,53 ---- </tr> </table> ! <br> ! <table width="450" border="0" align="center" cellpadding="5" cellspacing="0"> ! <tr> ! <th width="150"> </th> ! <th width="150"><?php echo $gallery->GalleryName; ?></th> ! <th width="150"> </th> ! </tr> <?php *************** *** 54,86 **** $dir = opendir($dirlocate); $num = 1; ! echo "<tr>"; while(! (($file = readdir($dir)) === false)){ if (! is_dir($dirlocate."/".$file)){ if ($num > 3){ ! echo "</tr><tr>"; $num = 1; } ! echo "<td width='34%'><center><a target='_blank' href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$file."'>"; ! if(file_exists($dirlocate."/thumbs/".$file)){ ! echo "<img border='1px' height=100 width=152 src='".$dirlocate."/thumbs/".$file."'>"; ! }else{ ! echo "<img border='1px' height=100 width=152 src='".$dirlocate."/".$file."'>"; ! } ! echo "</a><br><a href='email.php?PHOTO=".$dirlocate."/".$file."'><img border='0' src=email.PNG alt='Email to a friend'></a><img border='0' src='spacer.PNG'><a target='_blank' href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$file."'><img border='0' alt='Enlarge' src='enlarge.PNG'> ! </a></center></a></td>"; $num++; } ! } ?> ! </table> ! <p align="center"> </p> ! <p align="center">The content within the galleries are copyright of this website ! and its ownering team.<br> ! In order to use ! or copy its content please contact the teams webmaster.</p> ! <p align="center"> </p> <?php include($footer); ?> --- 56,121 ---- $dir = opendir($dirlocate); + // Set image count as 1 and echo the beginning row + $photo = 0; $num = 1; ! echo " <tr>\n"; ! ! // Begin reading the directory for images while(! (($file = readdir($dir)) === false)){ + + // If the directory is not a dir then continue the process if (! is_dir($dirlocate."/".$file)){ + + // Explode file type then check if the file is allowed by the photogallery globals + $imgtype = explode(",",$imgtypes); + $continue = false; + + foreach($imgtype As $type){ + $extension = substr($file,-3); + if(strtoupper($extension) == strtoupper($type)){ + $continue = true; + continue; + } + } + + // If continue, which is set true/false above, is false then stop the loop for this image + if($continue){ + + // If the current loop if greater then three then create a new row and set value back to 1 if ($num > 3){ ! echo " </tr>\n <tr>\n"; $num = 1; } ! ! // Setup column for the next image ! echo " <td width='34%'><center><a target='_blank' href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$file."'>"; ! // Check if there is a thumb available for this image, if so then use it or else preview the actual reduced image ! if(file_exists($dirlocate."/thumbs/".$file)){ ! echo "<img border='1px' height=100 width=152 src='".$dirlocate."/thumbs/".$file."'>"; ! }else{ ! echo "<img border='1px' height=100 width=152 src='".$dirlocate."/".$file."'>"; ! } ! // Add e-mail and image expand buttons as well as close column ! echo "</a><br><a href='email.php?PHOTO=$file&ID=".$_GET['ID']."'><img border='0' src=email.PNG alt='Email to a friend'></a> ! <img border='0' src='spacer.PNG'><a target='_blank' href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$file."'><img border='0' alt='Enlarge' src='enlarge.PNG'></a> ! </center></td>\n"; ! ! // Add number for amount of images previewed $num++; + $photo++; + } } ! } ! ! // If no photos have been found then preview a no photos message ! if($photo == 0){ ! echo "<td> </td>\n <td><br><br>No photos in gallery!<br><br><br></td>\n <td> </td>\n </tr>"; ! } ?> ! </table><br> ! The content within the galleries are copyright by the owners of this website.<br> ! In order to use or copy its content please contact the teams webmaster or team leader.</p> <?php include($footer); ?> Index: gallery.PNG =================================================================== RCS file: /cvsroot/openfirst/photogallery/gallery.PNG,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvsioP7lD and /tmp/cvs8UCQv6 differ Index: index.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/index.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.php 20 Aug 2003 19:03:31 -0000 1.4 --- index.php 22 Aug 2003 14:57:28 -0000 1.5 *************** *** 27,41 **** */ ! // Import globals and estbalish database connection include("../config/globals.php"); include($header); include("admin/galleryglobals.php"); - mysql_select_db($sqldatabase,$sqlconnection); - ?> ! <h2>View Galleries</h2> ! <p>Welcome to the gallery viewer. Please select a gallery from the list below:<br> ! </p> <table width="701" align="center"> <tr> --- 27,37 ---- */ ! // Include important globals related to this module include("../config/globals.php"); include($header); include("admin/galleryglobals.php"); ?> ! <h2>View Galleries</h2>Welcome to the gallery viewer. Please select a gallery from the list below:<br><br> <table width="701" align="center"> <tr> *************** *** 43,49 **** <th><strong>Gallery Name</strong></th> <th> <div align="center"><strong>Description</strong></div></th> ! <th width="229"><b>Date</b></th> </tr> ! <?php // List galleries from database --- 39,45 ---- <th><strong>Gallery Name</strong></th> <th> <div align="center"><strong>Description</strong></div></th> ! <th width="176"><b>Date</b></th> </tr> ! <?php // List galleries from database *************** *** 52,72 **** ?> ! <tr> ! <td width="59" valign="top"><a href="gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="gallery.PNG" width="58" height="51" border="0"></a></td> ! <td width="142" valign="top"><a href='gallery.php?ID=<?php echo $gallery->ID; ?>'><?php echo $gallery->GalleryName; ?></a></td> ! <td width="223" valign="top"><?php echo $gallery->Description; ?></td> ! <td width="223" valign="top"><?php echo date("F j, Y, g:i a",$gallery->Dates); ?></td> </tr> <?php } if (mysql_num_rows($query) == 0){ ! echo "<tr><td>--</td><td><br>There are no galleries uploaded<br><br></td>"; } ?> </table> ! <p align="center">The content within the galleries are copyright of this website ! and its ownering team.<br> ! In order to use or copy its content please contact the teams webmaster.</p> ! <?php include($footer); ?> --- 48,68 ---- ?> ! <tr onMouseOver="this.style.backgroundColor='#cccccc'" onMouseOut="this.style.backgroundColor='#ffffff'" bgcolor="#ffffff"> ! <td width="61" valign="top"><div align="center"><a href="gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="gallery.PNG" border="0"></a></div></td> ! <td width="147" valign="top"><a href='gallery.php?ID=<?php echo $gallery->ID; ?>'><?php echo $gallery->GalleryName; ?></a></td> ! <td width="297" valign="top"><?php echo $gallery->Description; ?></td> ! <td width="176" valign="top"><?php echo date("F j, Y, g:i a",$gallery->Dates); ?></td> </tr> <?php } + // If there are no galleries then say there are none if (mysql_num_rows($query) == 0){ ! echo "<tr><td> </td><td><br>There are no galleries uploaded<br><br></td>"; } ?> </table> ! <p align="center">The content within the galleries are copyright of this website and its ownering team.<br> ! In order to use or copy its content please contact the teams webmaster.</p> ! <?php include($footer); ?> \ No newline at end of file Index: photogallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/photogallery.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** photogallery.php 20 Aug 2003 23:09:49 -0000 1.2 --- photogallery.php 22 Aug 2003 14:57:28 -0000 1.3 *************** *** 27,32 **** */ ! // NOTE: The galleryrandimg() function still needs to be developed, although will not be available yet for time restraints. ! // Function to preview images from any gallery on command. --- 27,32 ---- */ ! // NOTE: The galleryrandimg() function still needs to be developed, ! // although will not be available yet for time restraints. // Function to preview images from any gallery on command. *************** *** 38,42 **** // If option is true then preview the image as a thumb else no thumb - $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '$gallery'"); $thisgallery = mysql_fetch_object($query); --- 38,41 ---- *************** *** 46,51 **** }else{ echo "<a href='$basepath/photogallery/viewphoto.php?ID=$gallery&PHOTO=$image'><img border='0' alt='Gallery Image' height='$height' width='$width' src='$basepath/photogallery/gallery/$thisgallery->GalleryName/$image'></a>"; ! } ! } --- 45,49 ---- }else{ echo "<a href='$basepath/photogallery/viewphoto.php?ID=$gallery&PHOTO=$image'><img border='0' alt='Gallery Image' height='$height' width='$width' src='$basepath/photogallery/gallery/$thisgallery->GalleryName/$image'></a>"; ! } } Index: viewphoto.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/viewphoto.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** viewphoto.php 21 Aug 2003 18:02:40 -0000 1.5 --- viewphoto.php 22 Aug 2003 14:57:28 -0000 1.6 *************** *** 27,31 **** */ ! // Import globals and estbalish database connection $header_condense = true; include("../config/globals.php"); --- 27,31 ---- */ ! // Include important globals related to this module $header_condense = true; include("../config/globals.php"); *************** *** 33,37 **** --- 33,39 ---- include("admin/galleryglobals.php"); + // If a comment is being added then run process if(ISSET($_POST['addcomment'])){ + mysql_query("INSERT INTO ofirst_photogallery_comments SET Image = '".$_GET['PHOTO']."', *************** *** 46,50 **** --- 48,54 ---- } + // If a comment is being deleted then check if the user is looged in then delete if(ISSET($_GET['COMMENT'])){ + if(ISSET($user->user)){ mysql_query("DELETE FROM ofirst_photogallery_comments WHERE ID = '".$_GET['COMMENT']."'"); *************** *** 52,59 **** die(include($footer)); } } ! $imgquery = mysql_query("SELECT * FROM ofirst_photogallery_image WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! $image = mysql_fetch_object($query); ?> --- 56,69 ---- die(include($footer)); } + } ! ! // Retrieve image data from the database $imgquery = mysql_query("SELECT * FROM ofirst_photogallery_image WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! $image = mysql_fetch_object($imgquery); ! ! // Retrieve information about the photos related gallery ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); ! $gallery = mysql_fetch_object($query); ?> *************** *** 65,79 **** <th>Photo</th> </tr> - <?php - - // Retrieve information about the photos related gallery - $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); - $gallery = mysql_fetch_object($query); - - ?> <tr> <td width="308" valign="top"><table width="100%"> <tr> ! <td width="20%"><a href="gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="gallery.PNG" width="58" height="51" border="0"></a></td> <td width="80%"><?php if(mysql_num_rows($imgquery) == 0){ echo $_GET['PHOTO']; }else{ echo $image->ImageName; } ?></td> </tr> --- 75,82 ---- <th>Photo</th> </tr> <tr> <td width="308" valign="top"><table width="100%"> <tr> ! <td width="20%"><a href="gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="gallery.PNG" border="0"></a></td> <td width="80%"><?php if(mysql_num_rows($imgquery) == 0){ echo $_GET['PHOTO']; }else{ echo $image->ImageName; } ?></td> </tr> *************** *** 87,91 **** </tr> <?php ! if(mysql_num_rows($query) == 0){ ?> <tr> --- 90,95 ---- </tr> <?php ! // If there are values for the query then preview the image ! if(! mysql_num_rows($imgquery) == 0){ ?> <tr> *************** *** 97,101 **** <td><?php echo date("F j, Y, g:i a",$image->Dates); ?></td> </tr> ! <?php } ?> <tr> <td> </td> --- 101,107 ---- <td><?php echo date("F j, Y, g:i a",$image->Dates); ?></td> </tr> ! <?php ! } ! ?> <tr> <td> </td> *************** *** 131,135 **** </td> <td width="433" valign="top"> ! <?php // Declare dir location --- 137,141 ---- </td> <td width="433" valign="top"> ! <?php // Declare dir location *************** *** 148,157 **** </tr> <?php $query = mysql_query("SELECT * FROM ofirst_photogallery_comments WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! while($comment = mysql_fetch_object($query)){ ?> ! <tr> <td width="33%"><strong><?php echo $comment->Author; ?><br></strong><a href='mailto:<?php echo $comment->EMail; ?>'>E-Mail Now</a><br> <?php if(ISSET($user->user)){ echo "<a href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."&COMMENT=".$comment->ID."'>Delete</a>"; --- 154,168 ---- </tr> <?php + // Check if there are comments in the database $query = mysql_query("SELECT * FROM ofirst_photogallery_comments WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! ! // Run through the comments and display them ! while($comment = mysql_fetch_object($query)){ ! ?> ! <tr onMouseOver="this.style.backgroundColor='#cccccc'" onMouseOut="this.style.backgroundColor='#ffffff'" bgcolor="#ffffff"> <td width="33%"><strong><?php echo $comment->Author; ?><br></strong><a href='mailto:<?php echo $comment->EMail; ?>'>E-Mail Now</a><br> <?php + // If user is logged in then offer the option of deleting the comment if(ISSET($user->user)){ echo "<a href='viewphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."&COMMENT=".$comment->ID."'>Delete</a>"; *************** *** 165,171 **** } if(mysql_num_rows($query) == 0){ ! echo "<tr><td>--</td><td>There are no comments for this image!</td></tr>"; } ?> </table> --- 176,184 ---- } + // If there are no values then preview no comments text if(mysql_num_rows($query) == 0){ ! echo "<tr><td> </td><td>There are no comments for this image!</td></tr>"; } + ?> </table> |