/** * nggAdmin::set_gallery_preview() - define a preview pic after the first upload, can be changed in the gallery settings * * @class nggAdmin * @param int $galleryID * @return void */ function set_gallery_preview($galleryID) { global $wpdb; $gallery = nggdb::find_gallery($galleryID); // in the case no preview image is setup, we do this now if ($gallery->previewpic == 0) { $firstImage = $wpdb->get_var("SELECT pid FROM {$wpdb->nggpictures} WHERE exclude != 1 AND galleryid = '{$galleryID}' ORDER by pid DESC limit 0,1"); if ($firstImage) { $wpdb->query("UPDATE {$wpdb->nggallery} SET previewpic = '{$firstImage}' WHERE gid = '{$galleryID}'"); wp_cache_delete($galleryID, 'ngg_gallery'); } } return; }
/** * Get the last images registered in the database with a maximum number of $limit results * * @param integer $page start offset as page number (0,1,2,3,4...) * @param integer $limit the number of result * @param bool $exclude do not show exluded images * @param int $galleryId Only look for images with this gallery id, or in all galleries if id is 0 * @param string $orderby is one of "id" (default, order by pid), "date" (order by exif date), sort (order by user sort order) * @return */ static function find_last_images($page = 0, $limit = 30, $exclude = true, $galleryId = 0, $orderby = "id") { global $wpdb; // Check for the exclude setting $exclude_clause = $exclude ? ' AND exclude<>1 ' : ''; // a limit of 0 makes no sense $limit = $limit == 0 ? 30 : $limit; // calculate the offset based on the pagr number $offset = (int) $page * $limit; $galleryId = (int) $galleryId; $gallery_clause = $galleryId === 0 ? '' : ' AND galleryid = ' . $galleryId . ' '; // default order by pid $order = 'pid DESC'; switch ($orderby) { case 'date': $order = 'imagedate DESC'; break; case 'sort': $order = 'sortorder ASC'; break; } $result = array(); $gallery_cache = array(); // Query database $images = $wpdb->get_results("SELECT * FROM {$wpdb->nggpictures} WHERE 1=1 {$exclude_clause} {$gallery_clause} ORDER BY {$order} LIMIT {$offset}, {$limit}"); // Build the object from the query result if ($images) { foreach ($images as $key => $image) { // cache a gallery , so we didn't need to lookup twice if (!array_key_exists($image->galleryid, $gallery_cache)) { $gallery_cache[$image->galleryid] = nggdb::find_gallery($image->galleryid); } // Join gallery information with picture information foreach ($gallery_cache[$image->galleryid] as $index => $value) { $image->{$index} = $value; } // Now get the complete image data $result[$key] = new nggImage($image); } } return $result; }
function post_processor_galleries() { global $wpdb, $ngg, $nggdb; // bulk update in a single gallery if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) { check_admin_referer('ngg_bulkgallery'); switch ($_POST['bulkaction']) { case 'no_action': // No action break; case 'recover_images': // Recover images from backup // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_recover_image', $_POST['doaction'], __('Recover from backup', 'nggallery')); break; case 'set_watermark': // Set watermark // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_set_watermark', $_POST['doaction'], __('Set watermark', 'nggallery')); break; case 'import_meta': // Import Metadata // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_import_metadata', $_POST['doaction'], __('Import metadata', 'nggallery')); break; case 'delete_gallery': // Delete gallery if (is_array($_POST['doaction'])) { $deleted = false; foreach ($_POST['doaction'] as $id) { // get the path to the gallery $gallery = nggdb::find_gallery($id); if ($gallery) { //TODO:Remove also Tag reference, look here for ids instead filename $imagelist = $wpdb->get_col("SELECT filename FROM {$wpdb->nggpictures} WHERE galleryid = '{$gallery->gid}' "); if ($ngg->options['deleteImg']) { if (is_array($imagelist)) { foreach ($imagelist as $filename) { @unlink(WINABSPATH . $gallery->path . '/thumbs/thumbs_' . $filename); @unlink(WINABSPATH . $gallery->path . '/' . $filename); @unlink(WINABSPATH . $gallery->path . '/' . $filename . '_backup'); } } // delete folder @rmdir(WINABSPATH . $gallery->path . '/thumbs'); @rmdir(WINABSPATH . $gallery->path); } } do_action('ngg_delete_gallery', $id); $deleted = nggdb::delete_gallery($id); } if ($deleted) { nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery')); } } break; } } if (isset($_POST['addgallery']) && isset($_POST['galleryname'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Add new gallery')) { wp_die(__('Cheatin’ uh?')); } // get the default path for a new gallery $defaultpath = $ngg->options['gallerypath']; $newgallery = esc_attr($_POST['galleryname']); if (!empty($newgallery)) { nggAdmin::create_gallery($newgallery, $defaultpath); } do_action('ngg_update_addgallery_page'); } if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) { check_admin_referer('ngg_thickbox_form'); //save the new values for the next operation $ngg->options['imgWidth'] = (int) $_POST['imgWidth']; $ngg->options['imgHeight'] = (int) $_POST['imgHeight']; // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback update_option('ngg_options', $ngg->options); $gallery_ids = explode(',', $_POST['TB_imagelist']); // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_resize_image', $gallery_ids, __('Resize images', 'nggallery')); } if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) { check_admin_referer('ngg_thickbox_form'); //save the new values for the next operation $ngg->options['thumbwidth'] = (int) $_POST['thumbwidth']; $ngg->options['thumbheight'] = (int) $_POST['thumbheight']; $ngg->options['thumbfix'] = isset($_POST['thumbfix']) ? true : false; // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback update_option('ngg_options', $ngg->options); $gallery_ids = explode(',', $_POST['TB_imagelist']); // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_create_thumbnail', $gallery_ids, __('Create new thumbnails', 'nggallery')); } }
/** * Method "ngg.getImages" * Return the list of all images inside a gallery * * @since 1.4 * * @param array $args Method parameters. * - int blog_id * - string username * - string password * - int gallery_id * @return array with all images */ function getImages($args) { global $nggdb; require_once dirname(dirname(__FILE__)) . '/admin/functions.php'; // admin functions $this->escape($args); $blog_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $gid = (int) $args[3]; if (!($user = $this->login($username, $password))) { return $this->error; } // Look for the gallery , could we find it ? if (!($gallery = nggdb::find_gallery($gid))) { return new IXR_Error(404, __('Could not find gallery ' . $gid)); } // Now check if you have the correct capability for this gallery if (!nggAdmin::can_manage_this_gallery($gallery->author)) { logIO('O', '(NGG) User does not have upload_files capability'); $this->error = new IXR_Error(401, __('You are not allowed to upload files to this gallery.')); return $this->error; } // get picture values $picture_list = $nggdb->get_gallery($gid, 'pid', 'ASC', false); return $picture_list; }
/** * call the callback after nggallery image upload * @param $image_info */ public function nggallery_image_upload_hook($image_info) { //get the gallery path gallerypath $nggdb = new nggdb(); $current_gallery = $nggdb->find_gallery($image_info['galleryID']); $current_filename = $image_info["filename"]; //now get the absolute path $ws_image_path = $options = get_option('siteurl') . "/" . $current_gallery->path . "/" . $current_filename; $static_generator = new StaticGenerator(); $options = get_option(MakeItStatic::CONFIG_TABLE_FIELD); $callback_urls = $options["nggallery_callback_url"]; $static_generator->callback_file($ws_image_path, $callback_urls, $current_filename, 'nggallery_image'); }
function post_processor_galleries() { global $wpdb, $ngg, $nggdb; // bulk update in a single gallery if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) { check_admin_referer('ngg_bulkgallery'); switch ($_POST['bulkaction']) { case 'no_action': // No action break; case 'recover_images': // Recover images from backup // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_recover_image', $_POST['doaction'], __('Recover from backup', 'nggallery')); break; case 'set_watermark': // Set watermark // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_set_watermark', $_POST['doaction'], __('Set watermark', 'nggallery')); break; case 'import_meta': // Import Metadata // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_import_metadata', $_POST['doaction'], __('Import metadata', 'nggallery')); break; case 'delete_gallery': // Delete gallery if (is_array($_POST['doaction'])) { $deleted = false; foreach ($_POST['doaction'] as $id) { // get the path to the gallery $gallery = nggdb::find_gallery($id); if ($gallery) { //TODO:Remove also Tag reference, look here for ids instead filename $imagelist = $wpdb->get_col("SELECT pid FROM {$wpdb->nggpictures} WHERE galleryid = '{$gallery->gid}' "); if ($ngg->options['deleteImg']) { $storage = C_Component_Registry::get_instance()->get_utility('I_Gallery_Storage'); if (is_array($imagelist)) { foreach ($imagelist as $pid) { $storage->delete_image($pid); } } // delete folder. abspath provided by nggdb::find_gallery() $fs = C_Fs::get_instance(); @rmdir($fs->join_paths($gallery->abspath, 'thumbs')); @rmdir($fs->join_paths($gallery->abspath, 'dynamic')); @rmdir($gallery->abspath); } } do_action('ngg_delete_gallery', $id); $deleted = nggdb::delete_gallery($id); } if ($deleted) { nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery')); } } break; } } if (isset($_POST['addgallery']) && isset($_POST['galleryname'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Add new gallery')) { wp_die(__('Cheatin’ uh?', 'nggallery')); } // get the default path for a new gallery $defaultpath = $ngg->options['gallerypath']; $newgallery = $_POST['galleryname']; if (!empty($newgallery)) { nggAdmin::create_gallery($newgallery, $defaultpath); } do_action('ngg_update_addgallery_page'); } if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) { check_admin_referer('ngg_thickbox_form'); //save the new values for the next operation $ngg->options['imgWidth'] = (int) $_POST['imgWidth']; $ngg->options['imgHeight'] = (int) $_POST['imgHeight']; // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback update_option('ngg_options', $ngg->options); $gallery_ids = explode(',', $_POST['TB_imagelist']); // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_resize_image', $gallery_ids, __('Resize images', 'nggallery')); } if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) { check_admin_referer('ngg_thickbox_form'); // save the new values for the next operation $settings = C_NextGen_Settings::get_instance(); $settings->thumbwidth = (int) $_POST['thumbwidth']; $settings->thumbheight = (int) $_POST['thumbheight']; $settings->thumbfix = isset($_POST['thumbfix']) ? TRUE : FALSE; $settings->save(); ngg_refreshSavedSettings(); // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback $gallery_ids = explode(',', $_POST['TB_imagelist']); // A prefix 'gallery_' will first fetch all ids from the selected galleries nggAdmin::do_ajax_operation('gallery_create_thumbnail', $gallery_ids, __('Create new thumbnails', 'nggallery')); } }
/** * Get the last images registered in the database with a maximum number of $limit results * * @param integer $page * @param integer $limit * @param bool $use_exclude * @return */ function find_last_images($page = 0, $limit = 30, $exclude = true) { global $wpdb; // Check for the exclude setting $exclude_clause = $exclude ? ' AND exclude<>1 ' : ''; $offset = (int) $page * $limit; $result = array(); $gallery_cache = array(); // Query database $images = $wpdb->get_results("SELECT * FROM {$wpdb->nggpictures} WHERE 1=1 {$exclude_clause} ORDER BY pid DESC LIMIT {$offset}, {$limit}"); // Build the object from the query result if ($images) { foreach ($images as $key => $image) { // cache a gallery , so we didn't need to lookup twice if (!array_key_exists($image->galleryid, $gallery_cache)) { $gallery_cache[$image->galleryid] = nggdb::find_gallery($image->galleryid); } // Join gallery information with picture information foreach ($gallery_cache[$image->galleryid] as $index => $value) { $image->{$index} = $value; } // Now get the complete image data $result[$key] = new nggImage($image); } } return $result; }
/** * build download title from NextGEN 2 displayed gallery properties, e.g. selected galleries, taglist, etc. * @param C_Displayed_Gallery $displayed_gallery * @return string */ protected static function getNgg2DownloadTitle($displayed_gallery) { switch ($displayed_gallery->source) { case 'galleries': $titles = array(); foreach ($displayed_gallery->container_ids as $gallery_id) { $gallery = nggdb::find_gallery($gallery_id); $titles[] = $gallery->title; } $title = implode(',', $titles); break; case 'tags': $taglist = implode(',', $displayed_gallery->container_ids); $title = self::getTitleFromTaglist($taglist); break; default: // allow title to be confected // TODO: extend this function to pick up other NGG2 gallery sources $title = ''; break; } // restrict length to 250 characters $title = substr($title, 0, 250); return $title; }
/** * Copy images to another gallery */ function copy_images($pic_ids, $dest_gid) { $errors = $messages = ''; if (!is_array($pic_ids)) { $pic_ids = array($pic_ids); } // Get destination gallery $destination = nggdb::find_gallery($dest_gid); if ($destination == null) { nggGallery::show_error(__('The destination gallery does not exist', 'nggallery')); return; } // Check for folder permission if (!is_writeable(WINABSPATH . $destination->path)) { $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), WINABSPATH . $destination->path); nggGallery::show_error($message); return; } // Get pictures $images = nggdb::find_images_in_list($pic_ids); $destination_path = WINABSPATH . $destination->path; foreach ($images as $image) { // WPMU action if (nggAdmin::check_quota()) { return; } $i = 0; $tmp_prefix = ''; $destination_file_name = $image->filename; while (file_exists($destination_path . '/' . $destination_file_name)) { $tmp_prefix = 'copy_' . $i++ . '_'; $destination_file_name = $tmp_prefix . $image->filename; } $destination_file_path = $destination_path . '/' . $destination_file_name; $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name; // Copy files if (!@copy($image->imagePath, $destination_file_path)) { $errors .= sprintf(__('Failed to copy image %1$s to %2$s', 'nggallery'), $image->filename, $destination_file_path) . '<br />'; continue; } // Copy the thumbnail if possible !@copy($image->thumbPath, $destination_thumb_file_path); // Create new database entry for the image $new_pid = nggdb::insert_image($destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude); if (!isset($new_pid)) { $errors .= sprintf(__('Failed to copy database row for picture %s', 'nggallery'), $image->pid) . '<br />'; continue; } // Copy tags nggTags::copy_tags($image->pid, $new_pid); if ($tmp_prefix != '') { $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) » The file already existed in the destination gallery.', 'nggallery'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />'; } else { $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)', 'nggallery'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />'; } } // Finish by showing errors or success if ($errors == '') { $link = '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>'; $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .', 'nggallery'), count($images), $link); } if ($messages != '') { nggGallery::show_message($messages); } if ($errors != '') { nggGallery::show_error($errors); } return; }
function nggallery_picturelist() { // *** show picture list global $wpdb, $user_ID, $ngg; // GET variables $act_gid = $ngg->manage_page->gid; $showTags = $ngg->manage_page->showTags; $hideThumbs = $ngg->manage_page->hideThumbs; // Load the gallery metadata $gallery = nggdb::find_gallery($act_gid); if (!$gallery) { nggGallery::show_error(__('Gallery not found.', 'nggallery')); return; } // get picture values $picturelist = nggdb::get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false); // get the current author $act_author_user = get_userdata((int) $gallery->author); // list all galleries $gallerylist = nggdb::find_all_galleries(); ?> <script type="text/javascript"> function showDialog( windowId ) { var form = document.getElementById('updategallery'); var elementlist = ""; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) if (elementlist == "") elementlist = form.elements[i].value else elementlist += "," + form.elements[i].value ; } } jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val()); jQuery("#" + windowId + "_imagelist").val(elementlist); // console.log (jQuery("#TB_imagelist").val()); tb_show("", "#TB_inline?width=640&height=120&inlineId=" + windowId + "&modal=true", false); } </script> <script type="text/javascript"> <!-- function checkAll(form) { for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") { if(form.elements[i].checked == true) form.elements[i].checked = false; else form.elements[i].checked = true; } } } } function getNumChecked(form) { var num = 0; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) num++; } } return num; } // this function check for a the number of selected images, sumbmit false when no one selected function checkSelected() { var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); return false; } //TODO: For copy to and move to we need some better way around if (jQuery('#bulkaction').val() == 'copy_to') { showDialog('selectgallery'); return false; } if (jQuery('#bulkaction').val() == 'move_to') { showDialog('selectgallery'); return false; } return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> '); } jQuery(document).ready( function() { // close postboxes that should be closed jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); if (typeof postboxes != "undefined") postboxes.add_postbox_toggles('ngg-manage-gallery'); // WP 2.7 else add_postbox_toggles('ngg-manage-gallery'); // WP 2.6 }); //--> </script> <div class="wrap"> <h2><?php echo __ngettext('Gallery', 'Galleries', 1, 'nggallery'); ?> : <?php echo $gallery->title; ?> </h2> <br style="clear: both;" /> <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&mode=edit&gid=' . $act_gid; ?> " accept-charset="utf-8"> <?php wp_nonce_field('ngg_updategallery'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <div id="poststuff"> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <div id="gallerydiv" class="postbox <?php echo postbox_classes('gallerydiv', 'ngg-manage-gallery'); ?> " > <h3><?php _e('Gallery settings', 'nggallery'); ?> <small> (<?php _e('Click here for more settings', 'nggallery'); ?> )</small></h3> <div class="inside"> <table class="form-table" > <tr> <th align="left"><?php _e('Title'); ?> :</th> <th align="left"><input type="text" size="50" name="title" value="<?php echo $gallery->title; ?> " /></th> <th align="right"><?php _e('Page Link to', 'nggallery'); ?> :</th> <th align="left"> <select name="pageid" style="width:95%"> <option value="0" ><?php _e('Not linked', 'nggallery'); ?> </option> <?php parent_dropdown($gallery->pageid); ?> </select> </th> </tr> <tr> <th align="left"><?php _e('Description'); ?> :</th> <th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo $gallery->galdesc; ?> </textarea></th> <th align="right"><?php _e('Preview image', 'nggallery'); ?> :</th> <th align="left"> <select name="previewpic" style="width:95%" > <option value="0" ><?php _e('No Picture', 'nggallery'); ?> </option> <?php if (is_array($picturelist)) { foreach ($picturelist as $picture) { $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : ''; echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n"; } } ?> </select> </th> </tr> <tr> <th align="left"><?php _e('Path', 'nggallery'); ?> :</th> <th align="left"><input <?php if (IS_WPMU) { echo 'readonly = "readonly"'; } ?> type="text" size="50" name="path" value="<?php echo $gallery->path; ?> " /></th> <th align="right"><?php _e('Author', 'nggallery'); ?> :</th> <th align="left"> <?php $editable_ids = $ngg->manage_page->get_editable_user_ids($user_ID); if ($editable_ids && count($editable_ids) > 1) { wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author)); } else { echo $act_author_user->display_name; } ?> </th> </tr> <tr> <th align="left"> </th> <th align="left"> </th> <th align="right"><?php _e('Create new page', 'nggallery'); ?> :</th> <th align="left"> <select name="parent_id" style="width:95%"> <option value="0"><?php _e('Main page (No parent)', 'nggallery'); ?> </option> <?php parent_dropdown(); ?> </select> <input class="button-secondary action" type="submit" name="addnewpage" value="<?php _e('Add page', 'nggallery'); ?> " id="group"/> </th> </tr> </table> <div class="submit"> <input type="submit" class="button-secondary" name="scanfolder" value="<?php _e("Scan Folder for new images", 'nggallery'); ?> " /> <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'nggallery'); ?> " /> </div> </div> </div> </div> <!-- poststuff --> <div class="tablenav ngg-tablenav"> <div class="alignleft actions" style="float: left;"> <select id="bulkaction" name="bulkaction"> <option value="no_action" ><?php _e("No action", 'nggallery'); ?> </option> <?php if (!$showTags) { ?> <option value="set_watermark" ><?php _e("Set watermark", 'nggallery'); ?> </option> <option value="new_thumbnail" ><?php _e("Create new thumbnails", 'nggallery'); ?> </option> <option value="resize_images" ><?php _e("Resize images", 'nggallery'); ?> </option> <option value="delete_images" ><?php _e("Delete images", 'nggallery'); ?> </option> <option value="import_meta" ><?php _e("Import metadata", 'nggallery'); ?> </option> <option value="copy_to" ><?php _e("Copy to...", 'nggallery'); ?> </option> <option value="move_to"><?php _e("Move to...", 'nggallery'); ?> </option> <?php } else { ?> <option value="add_tags" ><?php _e("Add tags", 'nggallery'); ?> </option> <option value="delete_tags" ><?php _e("Delete tags", 'nggallery'); ?> </option> <option value="overwrite_tags" ><?php _e("Overwrite tags", 'nggallery'); ?> </option> <?php } ?> </select> <?php if (!$showTags) { ?> <input class="button-secondary" type="submit" name="doaction" value="<?php _e("OK", 'nggallery'); ?> " onclick="if ( !checkSelected() ) return false;" /> <?php } else { ?> <input class="button-secondary" type="submit" name="showThickbox" value="<?php _e("OK", 'nggallery'); ?> " onclick="showDialog('tags'); return false;" /> <?php } ?> <?php if (!$hideThumbs) { ?> <input class="button-secondary" type="submit" name="togglethumbs" value="<?php _e("Hide thumbnails ", 'nggallery'); ?> " /> <?php } else { ?> <input class="button-secondary" type="submit" name="togglethumbs" value="<?php _e("Show thumbnails ", 'nggallery'); ?> " /> <?php } ?> <?php if (!$showTags) { ?> <input class="button-secondary" type="submit" name="toggletags" value="<?php _e("Show tags", 'nggallery'); ?> " /> <?php } else { ?> <input class="button-secondary" type="submit" name="toggletags" value="<?php _e("Hide tags", 'nggallery'); ?> " /> <?php } ?> <?php if ($ngg->options['galSort'] == "sortorder") { ?> <input class="button-secondary" type="submit" name="sortGallery" value="<?php _e("Sort gallery", 'nggallery'); ?> " /> <?php } ?> </div> <span style="float:right; padding:2px 8px 0 0;"><input type="submit" name="updatepictures" class="button-primary action" value="<?php _e("Save Changes", 'nggallery'); ?> " /></span> </div> <table id="ngg-listimages" class="widefat" > <thead> <tr> <?php $gallery_columns = ngg_manage_gallery_columns(); ?> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': $class = ' class="check-column;"'; break; case 'tags': $class = ' style="width:70%;"'; break; case 'action': $class = ' colspan="3" style="text-align: center;"'; break; default: $class = ' style="text-align: center;"'; } ?> <th scope="col"<?php echo $class; ?> ><?php echo $column_display_name; ?> </th> <?php } ?> </tr> </thead> <tfoot> <tr> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': $class = ' class="check-column;"'; break; case 'tags': $class = ' style="width:70%;"'; break; case 'action': $class = ' colspan="3" style="text-align: center;"'; break; default: $class = ' style="text-align: center;"'; } ?> <th scope="col"<?php echo $class; ?> ><?php echo $column_display_name; ?> </th> <?php } ?> </tr> </tfoot> <tbody> <?php if ($picturelist) { $thumbsize = ""; if ($ngg->options['thumbfix']) { $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"'; } if ($ngg->options['thumbcrop']) { $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbwidth'] . '"'; } foreach ($picturelist as $picture) { $pid = (int) $picture->pid; $class = $class == 'class="alternate"' ? '' : 'class="alternate"'; $exclude = $picture->exclude ? 'checked="checked"' : ''; $date = mysql2date(get_option('date_format'), $picture->imagedate); $time = mysql2date(get_option('time_format'), $picture->imagedate); ?> <tr id="picture-<?php echo $pid; ?> " <?php echo $class; ?> style="text-align:center"> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': ?> <td class="check-column" scope="row"><input name="doaction[]" type="checkbox" value="<?php echo $pid; ?> " /></td> <?php break; case 'id': ?> <td class="id column-id" scope="row" style="text-align: center"><?php echo $pid; ?> </td> <?php break; case 'filename': ?> <td class="media-icon" style="text-align: left;"> <a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <?php echo $picture->filename; ?> </a> <br /><?php echo $date; ?> </td> <?php break; case 'thumbnail': ?> <td class="thumbnail column-thumbnail"><a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <img class="thumb" src="<?php echo $picture->thumbURL; ?> " <?php echo $thumbsize; ?> /> </a> <br /><?php echo $date; ?> </td> <?php break; case 'alt_title_desc': ?> <td class="altdesc column-altdesc" style="width:500px"> <input name="alttext[<?php echo $pid; ?> ]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext); ?> " /><br/> <textarea name="description[<?php echo $pid; ?> ]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description); ?> </textarea> </td> <?php break; case 'description': ?> <td class="description column-description"><textarea name="description[<?php echo $pid; ?> ]" class="textarea1" cols="42" rows="2" ><?php echo stripslashes($picture->description); ?> </textarea></td> <?php break; case 'alt_title_text': ?> <td class="alttext column-alttext"><input name="alttext[<?php echo $pid; ?> ]" type="text" size="30" value="<?php echo stripslashes($picture->alttext); ?> " /></td> <?php break; case 'exclude': ?> <td class="exclude column-exclude"><input name="exclude[<?php echo $pid; ?> ]" type="checkbox" value="1" <?php echo $exclude; ?> /></td> <?php break; case 'tags': $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names'); if (is_array($picture->tags)) { $picture->tags = implode(', ', $picture->tags); } ?> <td class="tags column-tags" style="width:500px;"><textarea name="tags[<?php echo $pid; ?> ]" style="width:95%;" rows="2"><?php echo $picture->tags; ?> </textarea></td> <?php break; case 'action': ?> <td><a href="<?php echo NGGALLERY_URLPATH . "admin/showmeta.php?id=" . $pid; ?> " class="thickbox" title="<?php _e("Show Meta data", 'nggallery'); ?> " ><?php _e('Meta'); ?> </a></td> <td><a href="<?php echo wp_nonce_url("admin.php?page=nggallery-manage-gallery&mode=delpic&gid=" . $act_gid . "&pid=" . $pid, 'ngg_delpicture'); ?> " class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this file ?", 'nggallery'); ?> ');if(check==false) return false;" ><?php _e('Delete'); ?> </a></td> <?php break; default: ?> <td><?php do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $pid); ?> </td> <?php break; } ?> <?php } ?> </tr> <?php } } else { echo '<tr><td colspan="8" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>'; } ?> </tbody> </table> <p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'nggallery'); ?> " /></p> </form> <br class="clear"/> </div><!-- /#wrap --> <!-- #entertags --> <div id="tags" style="display: none;" > <form id="form-tags" method="POST" accept-charset="utf-8"> <?php wp_nonce_field('ngg_thickbox_form'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } ?> <?php if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <input type="hidden" id="tags_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="tags_bulkaction" name="TB_bulkaction" value="" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr> <th><?php _e("Enter the tags", 'nggallery'); ?> : <input name="taglist" type="text" style="width:90%" value="" /></th> </tr> <tr align="right"> <td class="submit"> <input class="button-primary" type="submit" name="TB_EditTags" value="<?php _e("OK", 'nggallery'); ?> " onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); tb_remove(); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> ')" /> <input class="button-secondary" type="reset" value=" <?php _e("Cancel", 'nggallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#entertags --> <!-- #selectgallery --> <div id="selectgallery" style="display: none;" > <form id="form-select-gallery" method="POST" accept-charset="utf-8"> <?php wp_nonce_field('ngg_thickbox_form'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } ?> <?php if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr> <th> <?php _e("Select the destination gallery:", 'nggallery'); ?> <select name="dest_gid" style="width:90%" > <?php foreach ($gallerylist as $gallery) { if ($gallery->gid != $act_gid) { ?> <option value="<?php echo $gallery->gid; ?> " ><?php echo $gallery->gid; ?> - <?php echo stripslashes($gallery->title); ?> </option> <?php } } ?> </select> </th> </tr> <tr align="right"> <td class="submit"> <input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php _e("OK", 'nggallery'); ?> " onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); tb_remove(); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to copy or move %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> ')" /> <input class="button-secondary" type="reset" value="<?php _e("Cancel", 'nggallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#selectgallery --> <?php }