ruạṛ
<?php session_start(); require_once 'scripts-includes/universal.php'; require_once 'scripts-includes/display.php'; $connID = connect_to_db(); $gallery_id = is_numeric_id($_GET['gallery']); $gallery = mysql_query(" select * from gallery_data where gallery_id = '$gallery_id' "); $images = mysql_query("select * from image_data where image_type = 'gallery' and container_id = '$gallery_id' order by order_id desc, image_id"); if(!$gallery || mysql_num_rows($gallery)<1) { $table = '<p class="center">Gallery not found</p>'; } else { $num_images = ($images) ? mysql_num_rows($images) : 0; $g = mysql_fetch_assoc($gallery); $heading = '<h1>Edit '.$g['gallery_name'].'</h1><p>'.$num_images.' images<br />Code: %%GALLERY-'.$gallery_id.'%% </p>'; if($num_images==0) { $table = ''; } else { $table = ' <table class="control_panel images"> <thead> <tr> <th class="pad"> </th> <th>Thumbnail</th> <th>Links</th> <th class="control">Active</th> <th class="control">Up/Down</th> <th class="control">Delete</th> <th class="pad"> </th> </tr> </thead> <tfoot></tfoot> <tbody> '; while($i = mysql_fetch_assoc($images)) { //$src = $g['gallery_path'].$i['filename']; //$tSrc = $g['gallery_path'].'thumb-'.$i['filename']; $src = $g['gallery_path'].$i['image_filename']; $tSrc = $g['gallery_path'].THUMBNAIL_PREFIX.$i['image_filename']; $iid = $i['image_id']; $table .= '<tr> <td> </td> <td> <a href="'.$src.'" rel="gallery" title="'.$i['title'].'"> <img src="'.$tSrc.'" alt="'.$i['title'].'" class="thumbnail" /> </a> </td> <td> Image ID: %%IMAGE-'.$iid.'%%<br /> <form name="image-title-'.$iid.'" id="image-title-'.$iid.'" action="processes/process-image-title.php" method="post" enctype="multipart/form-data"> <input name="image_id" type="hidden" value="'.$iid.'" /> Title: <input name="title" type="text" size="60" maxlength="100" value="'.$i['title'].'" /> <input name="update" type="submit" value="Change" /><br /> Full size image ('.$i['width'].'x'.$i['height'].'):<br /> <input type="text" size="80" value="http://'.SITE_ROOT.$src.'" onfocus="this.select()" /><br /> Thumbnail: <br /> <input type="text" size="80" value="http://'.SITE_ROOT.$tSrc.'" onfocus="this.select()" /> </form> </td> <td> <a href="processes/process-switch.php?f=active&image='.$iid.'" class="toggle"> '.onOrOff($i['active']).' </a> </td> <td> <a href="processes/process-order.php?image='.$iid.'&move=up"><img src="images/img-up.png" alt="Up"></a> <a href="processes/process-order.php?image='.$iid.'&move=down"><img src="images/img-down.png" alt="Down"></a> </td> <td> <a href="processes/process-image-remove.php?image='.$iid.'&gallery='.$gallery_id.'" onClick="if(confirm(\'Delete image?\')){return true}else{return false}" class="delete"> <img src="images/img-del.png" alt="Delete" /> </a> </td> <td> </td> </tr> '; } // end while $i $table .='</tbody> </table>'; }// end if/else $num_images } // end if $gallery head('gallery','Galleries'); if($heading) { echo $heading; } ?> <div class="tabs"> <ul> <li><a href="#tab1">Images</a></li> <li><a href="#tab2">Description</a></li> </ul> <div class="" id="tab1"> <form name="add_image" id="add_image" action="processes/process-gallery-image-add.php" method="post" enctype="multipart/form-data" class="add"> <p class="center"> <input name="gallery" type="hidden" value="<?php echo $gallery_id; ?>" /> <label for="new_image">Upload an image:</label> <input name="new" id="new_image" type="file" size="25" /> <label for="new_title">Title:</label> <input type="text" name="title" id="new_title" size="40"> <input name="add" type="submit" value="Upload" /> </p> </form> <p> </p> <hr /> <?php echo $table; ?> </div><!-- end #tab1 --> <div class="<?php if($_GET['tab']=='details'){ echo ' active'; } ?>" id="tab2"> <form name="edit_gallery" id="edit_gallery" action="processes/process-gallery-edit.php" method="post" enctype="multipart/form-data"> <input name="gallery" type="hidden" value="<?php echo $gallery_id; ?>" /> <div class="mock_table"> <label for="title"><span class="right">Title:</span><span class="left"><input name="title" id="title" type="text" size="60" maxlength="60" value="<?php echo $g['gallery_title']; ?>" /></span></label> <label for="description"><span class="right">Description:</span><span class="left"><textarea name="description" id="description" cols="50" rows="12"><?php echo html_entity_decode($g['gallery_description'],ENT_QUOTES); ?></textarea></span></label> <br class="clear" /> </div> <p class="center"> <input name="submit" id="submit" type="submit" value="Update Gallery" /> </p> </form> </div><!-- end #tab2 --> </div><!-- end tabs --> <?php footer(); exit; ?>
cải xoăn