[Openfirst-cvscommit] photogallery/admin edit.php,NONE,1.1 cleargallery.php,1.1,1.2 email.php,1.1,1.
Brought to you by:
xtimg
Update of /cvsroot/openfirst/photogallery/admin In directory sc8-pr-cvs1:/tmp/cvs-serv30105 Modified Files: cleargallery.php email.php index.php makethumb.php newgallery.php upload.php Added Files: edit.php Log Message: Photogallery has now been heavily updated to work with the file common file arrangements that we had established approximately 2 months ago. The module has also been edited for the new headers design. --- NEW FILE: edit.php --- <?php /* * openFIRST.photogallery - edit.php * * Copyright (C) 2003, * openFIRST Project * Original Author: David Di Biase <dav...@ea...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Import globals and estbalish database connection include("../../config/globals.php"); include($header); include("galleryglobals.php"); // Check if user is an admin then allow processes if (isset($user->user)){ // Check if user initiated delete and run delete process if(ISSET($_GET['DELETE'])){ $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['DELETE']."'") or die(mysql_error()); $gallery = mysql_fetch_object($query); rmdir("../".$gallerydir.$gallery->GalleryName."/thumbs") or die("<br><br><center>Can't remove gallery! [ <a href='index.php'>Manage</a> ]"); rmdir("../".$gallerydir.$gallery->GalleryName) or die("<br><br><center>Can't remove gallery! [ <a href='index.php'>Manage</a> ]"); mysql_query("DELETE FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['DELETE']."'") or die(mysql_error()); echo "<br><br><center>The gallery has been deleted! [ <a href='manage.php'>Manage</a> ]</center><br>"; die(include($footer)); } // Check if user initiated delete of particular photo and run photo and thumb delete if(ISSET($_GET['DELETEPHOTO'])){ $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'") or die(mysql_error()); $gallery = mysql_fetch_object($query); unlink("../".$gallerydir.$gallery->GalleryName."/".$_GET['PHOTO']) or die("<br><br><center>Can't remove gallery! [ <a href='manage.php'>Manage</a> ]"); if (file_exists("../".$gallerydir.$gallery->GalleryName."/thumbs/".$_GET['PHOTO'])){ unlink("../".$gallerydir.$gallery->GalleryName."/thumbs/".$_GET['PHOTO']) or die("<br><br><center>Can't remove gallery! [ <a href='manage.php'>Manage</a> ]"); die("<br><br><center>The photo and its thumbnail have been deleted! [ <a href='edit.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); }else{ die("<br><br><center>The photo has been deleted! [ <a href='edit.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); } } $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ?> <h2>Edit Gallery</h2> <p><em><?php echo $gallery->GalleryName; ?> Options - </em><a href="edit.php?ID=<?php echo $_GET['ID']; ?>">Edit</a> | <a href="upload.php?ID=<?php echo $_GET['ID']; ?>">Upload Photos</a> | <a href="cleargallery.php?ID=<?php echo $_GET['ID']; ?>">Clear Gallery</a> | <a href="edit.php?DELETE=<?php echo $_GET['ID']; ?>">Delete Gallery</a> (Must be empty to perform operation)</p> <table width="457" align="center"> <tr> <th valign="top"> <div align="center"> </div></th> <th><strong>Photo Name </strong></th> <th><strong>Thumbnail</strong></th> <th><strong>Option</strong></th> </tr> <?php // List photos in current gallery $dirlocate = "../".$gallerydir.$gallery->GalleryName; $dir = opendir($dirlocate); $num = 0; while(! (($file = readdir($dir)) === false)){ if (is_file($dirlocate."/".$file)){ $num++; ?> <tr> <td valign="top"><div align="center"> <a href="viewphoto.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $file; ?>" target="_blank"><img src="../photo.PNG" width="27" height="31" border="0"></a></div></td> <td valign="top"><?php echo $file; ?></td> <td valign="top"> <?php if (file_exists($dirlocate."/thumbs/".$file)){ echo "Yes"; }else{ echo "No"; } ?> </td> <td valign="top"><a href='makethumb.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $file; ?>'>Make Thumbnail</a> <br> <a href='edit.php?ID=<?php echo $_GET['ID']; ?>&DELETEPHOTO=True&PHOTO=<?php echo $file; ?>'>Delete</a></td> </tr> <?php } } if($num == 0){ echo "<tr><td>--</td><td><br>No photos in gallery!<br><br></td><td>--</td><td>--</td></tr>"; } ?> </table> <center> <br> <a href='makethumb.php?ID=<?php echo $_GET['ID']; ?>; ?>&OPTION=all'>Make Thumbnail's for Entire Gallery</a><br> <br> </center> <?php }else{ showlogin(); } include($footer); ?> Index: cleargallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/cleargallery.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cleargallery.php 8 Jun 2003 02:40:59 -0000 1.1 --- cleargallery.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,32 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); --- 28,32 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); *************** *** 34,38 **** mysql_select_db($sqldatabase,$sqlconnection); ! $query = mysql_query("SELECT * FROM ofirst_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); --- 34,38 ---- mysql_select_db($sqldatabase,$sqlconnection); ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); *************** *** 50,64 **** } } ! die("<br><br><center>The <b>".$gallery->GalleryName."</b> gallery has been reset. [ <a href='manage.php'>Manage</a> ]"); } } ! ?> ! <h2>Edit Gallery</h2><p><a href="manage.php">Manager</a> <a href="newgallery.php">Add New Gallery</a><?php membersmenu($user->membertype); ?></p> ! <p><em><?php echo $gallery->GalleryName; ?> Options -</em><a href="edit.php?ID=<?php echo $_GET['ID']; ?>">Edit</a> ! <a href="upload.php?ID=<?php echo $_GET['ID']; ?>">Upload Photos</a> ! <a href="cleargallery.php?ID=<?php echo $_GET['ID']; ?>">Clear Gallery</a></p> ! <br><br><p align="center">You are trying to clear the entire <b><?php echo $gallery->GalleryName; ?></b> ! gallery! <a href="cleargallery.php?ID=<?php echo $_GET['ID']; ?>&CONFIRM=True">Confirm</a></p> <?php include($footer); ?> --- 50,66 ---- } } ! echo "<br><br><center>The <b>".$gallery->GalleryName."</b> gallery has been reset. [ <a href='manage.php'>Manage</a> ]"; ! die(include($footer)); } } ! ?> <br><br><br> <br> ! You are trying to clear the entire <b><?php echo $gallery->GalleryName; ?></b> ! gallery! <a href="cleargallery.php?ID=<?php echo $_GET['ID']; ?>&CONFIRM=True">Confirm</a></p> ! <br> ! <br> ! <br> ! <br> ! <br> <?php include($footer); ?> Index: email.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/email.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** email.php 8 Jun 2003 02:40:59 -0000 1.1 --- email.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,32 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); --- 28,32 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); *************** *** 79,84 **** mail($recipientemail,$title." Gallery Photo Sender",$message,$headers) or die("<br><br><br><center>E-Mail was <b>not</b> successfully sent!</center>"); ! ! die("<br><br><br><center>Photo was successfully sent recipient, thank you! [ <a href='index.php'>Galleries</a> ]</center>"); } --- 79,84 ---- 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)); } Index: index.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/index.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.php 8 Jun 2003 02:40:59 -0000 1.1 --- index.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,37 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); - mysql_select_db($sqldatabase,$sqlconnection); - // Check if user is an admin then allow processes if (isset($user->user)){ --- 28,35 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); // Check if user is an admin then allow processes if (isset($user->user)){ *************** *** 39,61 **** ?> <h2>Gallery Manager</h2> ! <p><a href="manage.php">Manager</a> <a href="newgallery.php">Add New Gallery</a><?php membersmenu($user->membertype); ?></p> <p align="center"> ! <table width="633" border="0" align="center" cellpadding="6" cellspacing="0"> ! <tr bgcolor="#999999"> ! <td valign="top"> <div align="center"> </div></td> ! <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Gallery ! Name</strong></font></td> ! <td><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description</font></strong></td> ! <td> <div align="left"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Option</font></strong></div></td> </tr> <?php // Retrieve galleries from database and list them accordingly ! $query = mysql_query("SELECT * FROM ofirst_galleries"); while($gallery = mysql_fetch_object($query)){ ?> <tr> ! <td width="58" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="gallery.PNG" width="58" height="51" border="0"></a></font></td> <td width="145" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $gallery->GalleryName; ?></font></td> <td width="307" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $gallery->Description; ?></font></td> --- 37,58 ---- ?> <h2>Gallery Manager</h2> ! Here is a list of current galleries installed on our website. <p align="center"> ! <table width="633" align="center"> ! <tr> ! <th valign="top"> <div align="center"> </div></td> ! <th><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Gallery Name</strong></font></th> ! <th><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description</font></strong></th> ! <th> <div align="left"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Option</font></strong></div></th> </tr> <?php // Retrieve galleries from database and list them accordingly ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries"); while($gallery = mysql_fetch_object($query)){ ?> <tr> ! <td width="58" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="../gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="../gallery.PNG" width="58" height="51" border="0"></a></font></td> <td width="145" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $gallery->GalleryName; ?></font></td> <td width="307" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $gallery->Description; ?></font></td> Index: makethumb.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/makethumb.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** makethumb.php 8 Jun 2003 02:40:59 -0000 1.1 --- makethumb.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,50 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); include("preview.php"); - mysql_select_db($sqldatabase,$sqlconnection); - // Check if user is an admin then allow processes if (isset($user->user)){ ! $query = mysql_query("SELECT * FROM ofirst_galleries WHERE ID = '".$_GET['ID']."'") or die(mysql_error()); $gallery = mysql_fetch_object($query); ! $dirlocate = $gallerydir.$gallery->GalleryName; // Make thumbnail for particular photo if(ISSET($_GET['PHOTO'])){ makethumb($dirlocate,$_GET['PHOTO'],$imgtypes); ! die("<br><br><center>Thumbnail created! [ <a href='edit.php?ID=".$_GET['ID']."'>Edit</a> ]"); } --- 28,49 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); include("preview.php"); // Check if user is an admin then allow processes if (isset($user->user)){ ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'") or die(mysql_error()); $gallery = mysql_fetch_object($query); ! $dirlocate = "../".$gallerydir.$gallery->GalleryName; // Make thumbnail for particular photo if(ISSET($_GET['PHOTO'])){ makethumb($dirlocate,$_GET['PHOTO'],$imgtypes); ! echo "<br><br><center>Thumbnail created! [ <a href='edit.php?ID=".$_GET['ID']."'>Edit</a> ]"; ! die(include($footer)); } Index: newgallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/newgallery.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** newgallery.php 20 Aug 2003 16:54:21 -0000 1.1 --- newgallery.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,38 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); - mysql_select_db($sqldatabase,$sqlconnection); - - // Check if user is an admin then allow processes if (isset($user->user)){ --- 28,35 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); // Check if user is an admin then allow processes if (isset($user->user)){ *************** *** 41,90 **** if(ISSET($_POST['create'])){ ! mkdir($gallerydir.$_POST['galleryname'],0777) or die("<br><br><center>Can't create folder! [ <a href='manage.php'>Manage</a> ]"); ! mkdir($gallerydir.$_POST['galleryname']."/thumbs",0777) or die("<br><br><center>Can't create folder! [ <a href='manage.php'>Manage</a> ]"); ! mysql_query("INSERT INTO ofirst_galleries (GalleryName, Author, Date, Description) values( '".$_POST['galleryname']."' ! ,'".$_POST['author']."' ,'".time()."' ,'".$_POST['description']."')") or die(mysql_error()); ! ! die("<br><br><center>New gallery added! [ <a href='manage.php'>Manage</a> ]</center>"); } ?> <h2>New Gallery</h2> ! <p><a href="manage.php">Manager</a> <a href="newgallery.php">Add New Gallery</a><?php membersmenu($user->membertype); ?></p> <form method="POST" action="newgallery.php"> ! <table width="499" border="0" align="center" cellpadding="6" cellspacing="0"> ! <tr bgcolor="#999999"> ! <td valign="top"> <div align="center"> </div></td> ! <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Gallery ! Name</strong></font></td> ! </tr> ! <tr> ! <td width="135" valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Gallery ! Name:</font></div></td> ! <td width="275" valign="top"><input name="galleryname" type="text" id="galleryname"></td> ! </tr> ! <tr> ! <td valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Author:</font></div></td> ! <td valign="top"><font size="2"> ! <input name="author" type="text" id="author"> ! (Temporarily an option until openfirst.members is released)</font></td> ! </tr> ! <tr> ! <td valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Date:</font></div></td> ! <td valign="top"><?php echo date("F j, Y, g:i a",time()); ?></td> ! </tr> ! <tr> ! <td valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description:</font></div></td> ! <td valign="top"> <textarea name="description" cols="40" rows="10" id="description"></textarea></td> ! </tr> ! <tr> ! <td valign="top"> </td> ! <td valign="top"><input name="create" type="submit" id="create" value="Create Gallery"></td> ! </tr> ! </table> </form> <?php --- 38,82 ---- if(ISSET($_POST['create'])){ ! mkdir("../".$gallerydir.$_POST['galleryname'],0777) or die("<br><br><center>Can't create folder! [ <a href='manage.php'>Manage</a> ]"); ! mkdir("../".$gallerydir.$_POST['galleryname']."/thumbs",0777) or die("<br><br><center>Can't create folder! [ <a href='manage.php'>Manage</a> ]"); ! mysql_query("INSERT INTO ofirst_photogallery_galleries (GalleryName, Author, Dates, Description) values( '".$_POST['galleryname']."' ! ,'".$user->user."' ,'".time()."' ,'".$_POST['description']."')") or die(mysql_error()); ! echo "<br><br><center>New gallery added! [ <a href='index.php'>Manage</a> ]</center><br><br>"; ! die(include($footer)); } ?> <h2>New Gallery</h2> ! <p>You may use this page to install new galleries. Note that you may not upload<br> ! images from this script, you can only create the folders first.</p> <form method="POST" action="newgallery.php"> ! <table width="499" align="center"> ! <tr bgcolor="#999999"> ! <th valign="top"> <div align="center"> </div></th> ! <th><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>New ! Gallery Options</strong></font></th> ! </tr> ! <tr> ! <td width="130" valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Gallery ! Name:</font></div></td> ! <td width="345" valign="top"><input name="galleryname" type="text" id="galleryname"></td> ! </tr> ! <tr> ! <td valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Date:</font></div></td> ! <td valign="top"><?php echo date("F j, Y, g:i a",time()); ?></td> ! </tr> ! <tr> ! <td valign="top"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description:</font></div></td> ! <td valign="top"> <textarea name="description" cols="40" rows="10" id="description"></textarea></td> ! </tr> ! <tr> ! <td valign="top"> </td> ! <td valign="top"><input name="create" type="submit" id="create" value="Create Gallery"></td> ! </tr> ! </table> </form> <?php Index: upload.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/upload.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** upload.php 8 Jun 2003 02:40:59 -0000 1.1 --- upload.php 20 Aug 2003 19:04:07 -0000 1.2 *************** *** 28,41 **** // Import globals and estbalish database connection ! include("../config/globals.php"); include($header); include("galleryglobals.php"); - - mysql_select_db($sqldatabase,$sqlconnection); // Check if user is an admin then allow processes if (isset($user->user)){ ! $query = mysql_query("SELECT * FROM ofirst_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); --- 28,39 ---- // Import globals and estbalish database connection ! include("../../config/globals.php"); include($header); include("galleryglobals.php"); // Check if user is an admin then allow processes if (isset($user->user)){ ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); *************** *** 44,48 **** ini_set("max_execution_time",$gallery_execution_time); ! $dirlocate = $gallerydir.$gallery->GalleryName; $imgtypes = explode(",",$imgtypes); --- 42,46 ---- ini_set("max_execution_time",$gallery_execution_time); ! $dirlocate = "../".$gallerydir.$gallery->GalleryName; $imgtypes = explode(",",$imgtypes); *************** *** 92,96 **** ?> <h2>Upload to Gallery</h2> - <p><a href="manage.php">Manager</a> <a href="newgallery.php">Add New Gallery</a><?php membersmenu($user->membertype); ?></p> <p><em><?php echo $gallery->GalleryName; ?> Options - </em><a href="edit.php?ID=<?php echo $_GET['ID']; ?>">Edit </a> <a href="upload.php?ID=<?php echo $_GET['ID']; ?>">Upload Photos</a> --- 90,93 ---- |