[Openfirst-cvscommit] photogallery/admin cleargallery.php,1.4,1.5 edit.php,1.4,1.5 editphoto.php,1.2
Brought to you by:
xtimg
Update of /cvsroot/openfirst/photogallery/admin In directory sc8-pr-cvs1:/tmp/cvs-serv11940 Modified Files: cleargallery.php edit.php editphoto.php galleryglobals.php index.php makethumb.php newgallery.php preview.php upload.php Log Message: Make auditing changes (mainly small things, like header info, tabs instead of spaces, etc.) Index: cleargallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/cleargallery.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cleargallery.php 22 Aug 2003 14:58:04 -0000 1.4 --- cleargallery.php 22 Aug 2003 16:24:42 -0000 1.5 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - cleargallery.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/cleargallery.php * * Copyright (C) 2003, *************** *** 33,37 **** // Check if user is an admin then allow processes ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); --- 33,37 ---- // Check if user is an admin then allow processes ! if(! isset($user->user)){ showlogin(); die(include($footer)); *************** *** 41,74 **** $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); - - // Check if user initiates the confirm of clearing the gallery - - if (ISSET($_GET['CONFIRM'])){ - - $dirlocate = "../".$gallerydir.$gallery->GalleryName; - $dir = opendir($dirlocate); ! // Run through the files in the current folder ! while(! (($file = readdir($dir) === false)){ ! // Delete file and its thumbs in the folder ! if (is_file($dirlocate."/".$file)){ ! unlink($dirlocate."/".$file); ! if (file_exists($dirlocate."/thumbs/".$file)){ ! unlink($dirlocate."/thumbs/".$file); ! } ! } ! echo "<br><br><center>The <b>".$gallery->GalleryName."</b> gallery has been reset. [ <a href='index.php'>Manage</a> ]<br><br>"; ! 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); ?> --- 41,70 ---- $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! // Check if user initiates the confirm of clearing the gallery ! if (isset($_GET['CONFIRM'])){ ! $dirlocate = "../".$gallerydir.$gallery->GalleryName; ! $dir = opendir($dirlocate); ! // Run through the files in the current folder ! while(! (($file = readdir($dir) === false)){ ! // Delete file and its thumbs in the folder ! if (is_file($dirlocate."/".$file)){ ! unlink($dirlocate."/".$file); ! if (file_exists($dirlocate."/thumbs/".$file)){ ! unlink($dirlocate."/thumbs/".$file); ! } ! } ! echo "<br><br><center>The <b>".$gallery->GalleryName."</b> gallery has been reset. [ <a href='index.php'>Manage</a> ]<br><br>"; ! die(include($footer)); ! } } ! ! ?><p> 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); ?> Index: edit.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/edit.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** edit.php 22 Aug 2003 14:58:04 -0000 1.4 --- edit.php 22 Aug 2003 16:24:43 -0000 1.5 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - edit.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/edit.php * * Copyright (C) 2003, *************** *** 33,49 **** // Check if user is an admin then allow processes ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); } ! // Check if user initiated delete and run delete process if(ISSET($_GET['DELETE']) == true && isset($_GET["CONFIRMED"]) == false) { echo("<p>Are you absolutely sure you want to delete this gallery? All pictures in the gallery will be removed from the server.</p> <a href='edit.php?DELETE=" . $_GET["DELETE"] . "&CONFIRMED=1'>Yes, I am sure</a> <a href='edit.php'>No, I've changed my mind</a>"); die(include($footer)); ! }elseif(isset($_GET["DELETE"]) == true && isset($_GET["CONFIRMED"]) == true) { ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['DELETE']."'") or die(mysql_error()); ! $gallery = mysql_fetch_object($query); ! // Delete the directory as asked above function deldir($dir){ --- 33,49 ---- // Check if user is an admin then allow processes ! if(! ISSET($user->user) || $user->membertype != "administrator"){ showlogin(); die(include($footer)); } ! // Check if user initiated delete and run delete process if(ISSET($_GET['DELETE']) == true && isset($_GET["CONFIRMED"]) == false) { echo("<p>Are you absolutely sure you want to delete this gallery? All pictures in the gallery will be removed from the server.</p> <a href='edit.php?DELETE=" . $_GET["DELETE"] . "&CONFIRMED=1'>Yes, I am sure</a> <a href='edit.php'>No, I've changed my mind</a>"); die(include($footer)); ! } elseif(isset($_GET["DELETE"]) == true && isset($_GET["CONFIRMED"]) == true) { ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['DELETE']."'") or die(mysql_error()); ! $gallery = mysql_fetch_object($query); ! // Delete the directory as asked above function deldir($dir){ *************** *** 56,61 **** } } ! ! // Close the directory for future reading closedir($current_dir); rmdir(${dir}); --- 56,61 ---- } } ! ! // Close the directory for future reading closedir($current_dir); rmdir(${dir}); *************** *** 72,105 **** } ! 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='index.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='index.php'>Manage</a> ]"); ! ! // If the file exists then delete the image and its thumbs ! 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='index.php'>Manage</a> ]"); die("<br><br><center>The photo and its thumbnail have been deleted! [ <a href='index.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); ! }else{ ! die("<br><br><center>The photo has been deleted! [ <a href='index.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); ! } } ! // Get information above the gallery $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! ?> <h2>Edit Gallery</h2> ! <em><?php echo $gallery->GalleryName; ?></em> Options -<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> --- 72,105 ---- } ! 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='index.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='index.php'>Manage</a> ]"); ! ! // If the file exists then delete the image and its thumbs ! 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='index.php'>Manage</a> ]"); die("<br><br><center>The photo and its thumbnail have been deleted! [ <a href='index.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); ! } else { ! die("<br><br><center>The photo has been deleted! [ <a href='index.php?ID=".$_GET['ID']."'>Manage</a> ]</center>"); ! } } ! // Get information above the gallery $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! ?> <h2>Edit Gallery</h2> ! <em><?php echo $gallery->GalleryName; ?></em> Options -<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> *************** *** 108,116 **** <table width="388" align="center"> ! <tr> ! <th width="48" valign="top"> <div align="center"> </div></th> ! <th width="149"><strong>Photo Name </strong></th> ! <th width="87"><strong>Thumbnail</strong></th> ! <th width="84"><strong>Option</strong></th> </tr> <?php --- 108,116 ---- <table width="388" align="center"> ! <tr> ! <th width="48"></th> ! <th width="149">Photo Name</th> ! <th width="87">Thumbnail</th> ! <th width="84">Option</th> </tr> <?php *************** *** 127,144 **** ?> ! <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 // Check if the file exists then print if it has a thumb or not ! if (file_exists($dirlocate."/thumbs/".$file)){ ! echo "Yes"; ! }else{ ! echo "No"; ! } ! ?> </td> <td valign="top">[ <a href="editphoto.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $file; ?>">Edit</a> ]<br> --- 127,144 ---- ?> ! <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 // Check if the file exists then print if it has a thumb or not ! if (file_exists($dirlocate."/thumbs/".$file)){ ! echo "Yes"; ! } else { ! echo "No"; ! } ! ?> </td> <td valign="top">[ <a href="editphoto.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $file; ?>">Edit</a> ]<br> *************** *** 149,156 **** } } ! // If there is no record then preview no photos message if($num == 0){ ! echo "<tr><td> </td><td><br>No photos in gallery!<br><br></td><td> </td><td> </td></tr>"; } ?> --- 149,156 ---- } } ! // If there is no record then preview no photos message if($num == 0){ ! echo "<tr><td> </td><td><br>No photos in gallery!<br><br></td><td> </td><td> </td></tr>"; } ?> *************** *** 161,163 **** <br> </center> ! <?php include($footer); ?> --- 161,163 ---- <br> </center> ! <?php include($footer); ?> \ No newline at end of file Index: editphoto.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/editphoto.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editphoto.php 22 Aug 2003 14:58:04 -0000 1.2 --- editphoto.php 22 Aug 2003 16:24:43 -0000 1.3 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - edit.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/editphoto.php * * Copyright (C) 2003, *************** *** 33,37 **** // Check if user is an admin then allow processes ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); --- 33,37 ---- // Check if user is an admin then allow processes ! if(! isset($user->user) || $user->membertype != "administrator"){ showlogin(); die(include($footer)); *************** *** 45,49 **** Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'") or die(mysql_error()); $image = mysql_fetch_object($imgquery); ! // Check if a text file relating to this image is present then prepare to fill it into the descriptions box $textfile = substr($_GET['PHOTO'],0,-4).".txt"; --- 45,49 ---- Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'") or die(mysql_error()); $image = mysql_fetch_object($imgquery); ! // Check if a text file relating to this image is present then prepare to fill it into the descriptions box $textfile = substr($_GET['PHOTO'],0,-4).".txt"; *************** *** 51,170 **** $file = fopen("../gallery/$gallery->GalleryName/".$textfile,'r'); $description = ""; ! while(! feof($file)){ $line = fgets($file,1024); $description .= $line."<br>"; } ! fclose($file); } // Check if user initiated delete and run delete process ! if(ISSET($_POST['update'])){ ! ! // Check to see if the user wants to update with the textfile or the posted description ! if(! ISSET($_POST['txtupdate'])){ ! $description = $_POST['description']; ! } ! ! if(mysql_num_rows($imgquery) == 0){ ! mysql_query("INSERT INTO ofirst_photogallery_image SET ! Image = '".$_GET['PHOTO']."', ! Gallery = '".$_GET['ID']."', ! ImageName = '".$_POST['imagename']."', ! Description = '".$description."', ! Dates = '".$_POST['date']."'") or die(mysql_error()); ! ! }else{ ! mysql_query("UPDATE ofirst_photogallery_image SET ! ImageName = '".$_POST['imagename']."', ! Description = '".$description."', ! Dates = '".$_POST['date']."' ! WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'") or die(mysql_error()); ! } ! ! // Delete the textfile that goes with the actual image ! if(ISSET($_POST['deletefile'])){ ! $textfile = substr($_GET['PHOTO'],0,-4).".txt"; ! unlink("../gallery/$gallery->GalleryName/".$textfile); ! echo "<br><br>Image information updated. Relating text file has been deleted in the process!"; ! }else{ ! echo "<br><br>Image information updated."; ! } ! echo " [ <a href='editphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."'>Manage</a> ]<br><br>"; ! die(include($footer)); } ! // Delete file information from the database upon request ! if(ISSET($_POST['deleteall'])){ mysql_query("DELETE FROM ofirst_photogallery_image WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! echo "<br><br>The description of this image has been removed! [ <a href='editphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."'>Manage</a> ]<br><br>"; ! die(include($footer)); } ! ?> <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> <p align="center"><img src="../gallery/<?php echo $gallery->GalleryName; ?>/<?php echo $_GET['PHOTO']; ?>" width="300" height="225"><br> <br>[ <a href="makethumb.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>">Make Thumbnail</a> ]</p> <form action='editphoto.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>' method='POST'> ! <table width="456" align="center"> ! <tr> ! <th width="101" valign="top"> <div align="center"> </div></th> ! <th width="275"><strong>Photo Information</strong></th> </tr> ! <tr> ! <td valign="top"><div align="right"><strong>File Name:</strong></div></td> ! <td valign="top"><?php echo $_GET['PHOTO']; ?></td> </tr> ! <tr> ! <td valign="top"><div align="right"><strong>Photo Name:</strong></div></td> ! <td valign="top"><input name="imagename" type="text" id="imagename" value="<?php if(ISSET($image->ImageName)){ echo $image->ImageName; } ?>" size="30"></td> </tr> ! <tr> ! <td valign="top"><div align="right"><strong>Date:</strong></div></td> ! <td valign="top"><input name="date" type="text" id="date" value="<?php if(ISSET($image->Dates)){ echo $image->Dates; }else{ echo date("F j, Y, g:i a",time()); } ?>" size="30"></td> </tr> ! <tr> ! <td valign="top"> <div align="right"><strong>Description:</strong></div></td> ! <td valign="top"> <textarea name="description" cols="40" rows="10" id="description"><?php echo $image->Description; ?></textarea> </td> </tr> ! <?php if(ISSET($description)){ ?> ! <tr> ! <td valign="top"> </td> ! <td valign="top"><table width="85%" bordercolor="#000000"> ! <tr> <th><div align="center">Text File Found</div></th> </tr> ! <tr> <td><?php echo $description; ?></td> </tr> </table></td> </tr> ! <tr> ! <td valign="top"><div align="right"> ! <input name="txtupdate" type="checkbox" id="deletefile5" value="checkbox"> ! </div></td> ! <td valign="top">Use description from .txt file in updating the image description. The .txt contets are in the above table.</td> </tr> ! <tr> ! <td valign="top"><div align="right"> ! <input name="deletefile" type="checkbox" id="deletefile4" value="checkbox"> ! </div></td> ! <td valign="top">Delete .txt file after adding this description to the image.</td> </tr> ! <?php } ?> ! <tr> ! <td valign="top"> </td> ! <td valign="top"> <input name='update' type='submit' id='update' value='Update Image Info'> ! <input name='deleteall' type='submit' id='update3' value='Delete Description'> </td> </tr> </table> ! </form><br><br> ! <?php include($footer); ?> --- 51,168 ---- $file = fopen("../gallery/$gallery->GalleryName/".$textfile,'r'); $description = ""; ! while(! feof($file)){ $line = fgets($file,1024); $description .= $line."<br>"; } ! fclose($file); } // Check if user initiated delete and run delete process ! if(isset($_POST['update'])){ ! // Check to see if the user wants to update with the textfile or the posted description ! if(! isset($_POST['txtupdate'])){ ! $description = $_POST['description']; ! } + if(mysql_num_rows($imgquery) == 0){ + mysql_query("INSERT INTO ofirst_photogallery_image SET + Image = '".$_GET['PHOTO']."', + Gallery = '".$_GET['ID']."', + ImageName = '".$_POST['imagename']."', + Description = '".$description."', + Dates = '".$_POST['date']."'") or die(mysql_error()); + } else { + mysql_query("UPDATE ofirst_photogallery_image SET + ImageName = '".$_POST['imagename']."', + Description = '".$description."', + Dates = '".$_POST['date']."' + WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'") or die(mysql_error()); + } + if(isset($_POST['deletefile'])){ + // Delete the textfile that goes with the actual image + $textfile = substr($_GET['PHOTO'],0,-4).".txt"; + unlink("../gallery/$gallery->GalleryName/".$textfile); + echo "<br><br>Image information updated. Relating text file has been deleted in the process!"; + } else { + echo "<br><br>Image information updated."; + } + echo " [ <a href='editphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."'>Manage</a> ]<br><br>"; + die(include($footer)); } ! // Delete file information from the database upon request ! if(isset($_POST['deleteall'])){ mysql_query("DELETE FROM ofirst_photogallery_image WHERE Gallery = '".$_GET['ID']."' AND Image = '".$_GET['PHOTO']."'"); ! echo "<br><br>The description of this image has been removed! [ <a href='editphoto.php?ID=".$_GET['ID']."&PHOTO=".$_GET['PHOTO']."'>Manage</a> ]<br><br>"; ! die(include($footer)); } ! ?> <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></p> <p align="center"><img src="../gallery/<?php echo $gallery->GalleryName; ?>/<?php echo $_GET['PHOTO']; ?>" width="300" height="225"><br> <br>[ <a href="makethumb.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>">Make Thumbnail</a> ]</p> <form action='editphoto.php?ID=<?php echo $_GET['ID']; ?>&PHOTO=<?php echo $_GET['PHOTO']; ?>' method='POST'> ! <table width="456"> ! <tr> ! <th width="101"> </th> ! <th width="275">Photo Information</th> </tr> ! <tr> ! <th>File Name</th> ! <td><?php echo $_GET['PHOTO']; ?></td> </tr> ! <tr> ! <th>Photo Name</th> ! <td><input name="imagename" type="text" id="imagename" value="<?php if(isset($image->ImageName)){ echo $image->ImageName; } ?>" size="30"></td> </tr> ! <tr> ! <th>Date</th> ! <td><input name="date" type="text" id="date" value="<?php if(isset($image->Dates)){ echo $image->Dates; }else{ echo date("F j, Y, g:i a",time()); } ?>" size="30"></td> </tr> ! <tr> ! <th>Description:</th> ! <td> <textarea name="description" cols="40" rows="10" id="description"><?php echo $image->Description; ?></textarea> </td> </tr> ! <?php if(isset($description)){ ?> ! <tr> ! <th> </th> ! <td><table width="85%"> ! <tr> <th><div align="center">Text File Found</div></th> </tr> ! <tr> <td><?php echo $description; ?></td> </tr> </table></td> </tr> ! <tr> ! <td> ! <input name="txtupdate" type="checkbox" id="deletefile5" value="checkbox"> ! </td> ! <td>Use description from .txt file in updating the image description. The .txt contets are in the above table.</td> </tr> ! <tr> ! <td> ! <input name="deletefile" type="checkbox" id="deletefile4" value="checkbox"> ! </td> ! <td>Delete .txt file after adding this description to the image.</td> </tr> ! <?php } ?> ! <tr> ! <td> </td> ! <td> <input name='update' type='submit' id='update' value='Update Image Info'> ! <input name='deleteall' type='submit' id='update3' value='Delete Description'> </td> </tr> </table> ! </form> ! <?php ! include($footer); ! ?> Index: galleryglobals.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/galleryglobals.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** galleryglobals.php 22 Aug 2003 14:58:04 -0000 1.2 --- galleryglobals.php 22 Aug 2003 16:24:43 -0000 1.3 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - galleryglobals.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/galleryglobals.php * * Copyright (C) 2003, Index: index.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/index.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.php 22 Aug 2003 14:58:04 -0000 1.4 --- index.php 22 Aug 2003 16:24:43 -0000 1.5 *************** *** 33,37 **** // Check if user is an admin then allow processes ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); --- 33,37 ---- // Check if user is an admin then allow processes ! if(! isset($user->user) || $user->membertype != "administrator"){ showlogin(); die(include($footer)); *************** *** 40,50 **** ?> <h2>Gallery Manager</h2> ! Here is a list of current galleries installed on our website.<br> <table width="633" align="center"> ! <tr> ! <th valign="top"><div align="center"></div></th> ! <th><strong>Gallery Name</strong></th> ! <th><strong>Description</strong></th> ! <th> <div align="left"><strong>Option</strong></div></th> </tr> <?php --- 40,51 ---- ?> <h2>Gallery Manager</h2> ! <p>Here is a list of current galleries installed on our website.</p> ! <p> <table width="633" align="center"> ! <tr> ! <th> </th> ! <th>Gallery Name</th> ! <th>Description</th> ! <th>Option</th> </tr> <?php *************** *** 55,63 **** ?> ! <tr> ! <td width="58" 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="145" valign="top"><?php echo $gallery->GalleryName; ?></td> ! <td width="307" valign="top"><?php echo $gallery->Description; ?></td> ! <td width="75" valign="top">[ <a href="edit.php?ID=<?php echo $gallery->ID; ?>">Edit</a> ]<br> [ <a href="edit.php?DELETE=<?php echo $gallery->ID; ?>">Delete</a> ]</td> --- 56,64 ---- ?> ! <tr> ! <td width="58"><a href="../gallery.php?ID=<?php echo $gallery->ID; ?>"><img src="../gallery.PNG" width="58" height="51" border="0"></a></td> ! <td width="145"><?php echo $gallery->GalleryName; ?></td> ! <td width="307"><?php echo $gallery->Description; ?></td> ! <td width="75">[ <a href="edit.php?ID=<?php echo $gallery->ID; ?>">Edit</a> ]<br> [ <a href="edit.php?DELETE=<?php echo $gallery->ID; ?>">Delete</a> ]</td> *************** *** 69,78 **** // If there are no values then preview an error if (mysql_num_rows($query) == 0){ ! echo "\n <tr>\n <td> </td>\n <td><br>There are no galleries uploaded<br><br></td>\n"; } - ?> </table> ! <br></p> ! <p align="center"> </p> ! <?php include($footer); ?> --- 70,79 ---- // If there are no values then preview an error if (mysql_num_rows($query) == 0){ ! echo "\n <tr>\n <td> </td>\n <td><br>There are no galleries uploaded<br><br></td>\n"; } ?> </table> ! </p> ! <?php ! include($footer); ! ?> Index: makethumb.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/makethumb.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** makethumb.php 21 Aug 2003 14:19:21 -0000 1.3 --- makethumb.php 22 Aug 2003 16:24:43 -0000 1.4 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - makethumb.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/makethumb.php * * Copyright (C) 2003, *************** *** 36,68 **** 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)); ! } ! ! // Make thumbnail for entire gallery ! if(ISSET($_GET['OPTION'])){ ! $dir = opendir($dirlocate); ! while(! (($file = readdir($dir)) === false)){ ! if (is_file($dirlocate."/".$file)){ ! makethumb($dirlocate,$file,$imgtypes); ! } } - echo "<br><br><center>Thumbnails created for gallery! [ <a href='edit.php?ID=".$_GET['ID']."'>Edit</a> ]"; - die(include($footer)); - } ! }else{ showlogin(); } include($footer); - ?> --- 36,67 ---- 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 "<p>Thumbnail created! [ <a href='edit.php?ID=".$_GET['ID']."'>Edit</a> ]</p>"; ! die(include($footer)); ! } ! // Make thumbnail for entire gallery ! if(isset($_GET['OPTION'])){ ! ! $dir = opendir($dirlocate); ! while(! (($file = readdir($dir)) === false)){ ! if (is_file($dirlocate."/".$file)){ ! makethumb($dirlocate,$file,$imgtypes); ! } ! } ! echo "<p>Thumbnails created for gallery! [ <a href='edit.php?ID=".$_GET['ID']."'>Edit</a> ]</p>"; ! die(include($footer)); } ! } else { showlogin(); } include($footer); ?> Index: newgallery.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/newgallery.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** newgallery.php 22 Aug 2003 14:58:04 -0000 1.4 --- newgallery.php 22 Aug 2003 16:24:43 -0000 1.5 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - newgallery.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/newgallery.php * * Copyright (C) 2003, *************** *** 26,30 **** * */ ! // Import globals and estbalish database connection include("../../config/globals.php"); --- 26,30 ---- * */ ! // Import globals and estbalish database connection include("../../config/globals.php"); *************** *** 32,36 **** include("galleryglobals.php"); ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); --- 32,36 ---- include("galleryglobals.php"); ! if(! isset($user->user)){ showlogin(); die(include($footer)); *************** *** 38,53 **** // Check if user initiates create option and run create options ! 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)); } --- 38,51 ---- // Check if user initiates create option and run create options ! 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']."')"); ! echo "<br><br><center>New gallery added! [ <a href='index.php'>Manage</a> ]</center><br><br>"; ! die(include($footer)); } *************** *** 57,84 **** 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 include($footer); ?> --- 55,82 ---- images from this script, you can only create the folders first.</p> <form method="POST" action="newgallery.php"> ! <table width="499"> ! <tr> ! <th> </th> ! <th>New Gallery Options</th> </tr> ! <tr> ! <th width="130">Gallery Name</th> ! <td width="345"><input name="galleryname" type="text" id="galleryname"></td> </tr> ! <tr> ! <th>Date</th> ! <td><?php echo date("F j, Y, g:i a",time()); ?></td> </tr> ! <tr> ! <th>Description</th> ! <td> <textarea name="description" cols="40" rows="10" id="description"></textarea></td> </tr> ! <tr> ! <th> </th> ! <td><input name="create" type="submit" id="create" value="Create Gallery"></td> </tr> </table> </form> ! <?php ! include($footer); ! ?> Index: preview.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/preview.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** preview.php 8 Jun 2003 02:40:59 -0000 1.1 --- preview.php 22 Aug 2003 16:24:43 -0000 1.2 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - preview.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/preview.php * * Copyright (C) 2003, *************** *** 135,137 **** } ! ?> \ No newline at end of file --- 135,137 ---- } ! ?> Index: upload.php =================================================================== RCS file: /cvsroot/openfirst/photogallery/admin/upload.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** upload.php 22 Aug 2003 14:58:04 -0000 1.6 --- upload.php 22 Aug 2003 16:24:43 -0000 1.7 *************** *** 1,5 **** <?php /* ! * openFIRST.photogallery - upload.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openFIRST.photogallery - admin/upload.php * * Copyright (C) 2003, *************** *** 31,100 **** include($header); include("galleryglobals.php"); ! // Check if user is an admin then allow processes ! if(! ISSET($user->user)){ showlogin(); die(include($footer)); } ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! // Check if user initiates upload process and run upload process if(ISSET($_POST['upload'])){ ! ini_set("max_execution_time",$gallery_execution_time); ! $dirlocate = "../".$gallerydir.$gallery->GalleryName; ! $imgtypes .= ",txt"; ! $imgtypes = explode(",",$imgtypes); ! ! for ($num=1;$num<=$_POST['NUM_UPLOADS'];$num++){ ! ! // If upload field is empty then exit the particular loop ! ! if (! $_FILES['upload'.$num]['name'] == ""){ ! $continue = false; ! ! // NOTE: The change to uppercase in the if statement helps remove errors ! // I noticed this when I found that some software applications save images ! // extensions as upper case, so just making sure it doesn't give people problems. ! foreach($imgtypes As $type){ ! $extension = substr($_FILES['upload'.$num]['name'],-3); ! if(strtoupper($extension) == strtoupper($type)){ ! $continue = true; ! continue; ! } ! } ! if(! $continue){ ! echo "<center><br>".$_FILES['upload'.$num]['name']." - ".$_FILES['upload'.$num]['size']." - ".$_FILES['upload'.$num]['type']." - <font color='Red'>Illegal file type!</font></center>"; ! continue; ! } ! ! // Copy files to the proper directory ! copy($_FILES['upload'.$num]['tmp_name'], $dirlocate."/".$_FILES['upload'.$num]['name']) or $error = true; ! echo "<center><br>".$_FILES['upload'.$num]['name']." - ".$_FILES['upload'.$num]['size']." - ".$_FILES['upload'.$num]['type']." - "; if(empty($error)){ ! echo "<font color='Green'>Successful</font><br></center>\n"; ! }else{ echo "<font color='Red'>Not Successful</font><br></center>\n"; } ! } ! } } ! // Prepare fields for uploading next time if(ISSET($_POST['setuploads'])){ ! $uploads = $_POST['uploads']; ! }else{ ! $uploads = 5; } ?> <h2>Upload to 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> </p> <p align="center">Current Files Allowed: <?php echo $imgtypes; ?></p> --- 31,99 ---- include($header); include("galleryglobals.php"); ! // Check if user is an admin then allow processes ! if(! ISSET($user->user) || $user->membertype != "administrator"){ showlogin(); die(include($footer)); } ! $query = mysql_query("SELECT * FROM ofirst_photogallery_galleries WHERE ID = '".$_GET['ID']."'"); $gallery = mysql_fetch_object($query); ! // Check if user initiates upload process and run upload process if(ISSET($_POST['upload'])){ ! ini_set("max_execution_time",$gallery_execution_time); ! $dirlocate = "../".$gallerydir.$gallery->GalleryName; ! $imgtypes .= ",txt"; ! $imgtypes = explode(",",$imgtypes); ! for ($num=1;$num<=$_POST['NUM_UPLOADS'];$num++){ ! // If upload field is empty then exit the particular loop ! ! if (! $_FILES['upload'.$num]['name'] == ""){ ! $continue = false; ! ! foreach($imgtypes As $type){ ! $extension = substr($_FILES['upload'.$num]['name'],-3); ! // NOTE: The change to uppercase in the if statement helps remove errors ! // I noticed this when I found that some software applications save images ! // extensions as upper case, so just making sure it doesn't give people problems. ! if(strtoupper($extension) == strtoupper($type)){ ! $continue = true; ! continue; ! } ! } ! ! if(! $continue){ ! echo "<center><br>".$_FILES['upload'.$num]['name']." - ".$_FILES['upload'.$num]['size']." - ".$_FILES['upload'.$num]['type']." - <font color='Red'>Illegal file type!</font></center>"; ! continue; ! } ! ! // Copy files to the proper directory ! copy($_FILES['upload'.$num]['tmp_name'], $dirlocate."/".$_FILES['upload'.$num]['name']) or $error = true; ! echo "<center><br>".$_FILES['upload'.$num]['name']." - ".$_FILES['upload'.$num]['size']." - ".$_FILES['upload'.$num]['type']." - "; if(empty($error)){ ! echo "<font color='Green'>Successful</font><br></center>\n"; ! } else { echo "<font color='Red'>Not Successful</font><br></center>\n"; } ! } ! } } ! // Prepare fields for uploading next time if(ISSET($_POST['setuploads'])){ ! $uploads = $_POST['uploads']; ! } else { ! $uploads = 5; } ?> <h2>Upload to 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> </p> <p align="center">Current Files Allowed: <?php echo $imgtypes; ?></p> *************** *** 109,113 **** // Output upload fields depending on the user request or not for($n = 1; $n <= $uploads ; $n++ ){ ! echo $n.". <input type='file' name='upload".$n."' size='29'><br>\n"; } --- 108,112 ---- // Output upload fields depending on the user request or not for($n = 1; $n <= $uploads ; $n++ ){ ! echo $n.". <input type='file' name='upload".$n."' size='29'><br>\n"; } *************** *** 116,118 **** <input name="upload" type="submit" value="Upload To Gallery"> </form> ! <?php include($footer); ?> --- 115,117 ---- <input name="upload" type="submit" value="Upload To Gallery"> </form> ! <?php include($footer); ?> \ No newline at end of file |