Example #1
0
 function add_menu()
 {
     add_menu_page(_n('Gallery', 'Galleries', 1, 'nggallery'), _n('Gallery', 'Galleries', 1, 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array(&$this, 'show_menu'), 'div');
     add_submenu_page(NGGFOLDER, __('Overview', 'nggallery'), __('Overview', 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Add Gallery / Images', 'nggallery'), __('Add Gallery / Images', 'nggallery'), 'NextGEN Upload images', 'nggallery-add-gallery', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'NextGEN Manage gallery', 'nggallery-manage-gallery', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, _n('Album', 'Albums', 1, 'nggallery'), _n('Album', 'Albums', 1, 'nggallery'), 'NextGEN Edit album', 'nggallery-manage-album', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Tags', 'nggallery'), __('Tags', 'nggallery'), 'NextGEN Manage tags', 'nggallery-tags', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Options', 'nggallery'), __('Options', 'nggallery'), 'NextGEN Change options', 'nggallery-options', array(&$this, 'show_menu'));
     if (wpmu_enable_function('wpmuStyle')) {
         add_submenu_page(NGGFOLDER, __('Style', 'nggallery'), __('Style', 'nggallery'), 'NextGEN Change style', 'nggallery-style', array(&$this, 'show_menu'));
     }
     if (wpmu_enable_function('wpmuRoles') || wpmu_site_admin()) {
         add_submenu_page(NGGFOLDER, __('Roles', 'nggallery'), __('Roles', 'nggallery'), 'activate_plugins', 'nggallery-roles', array(&$this, 'show_menu'));
     }
     add_submenu_page(NGGFOLDER, __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'NextGEN Gallery overview', 'nggallery-about', array(&$this, 'show_menu'));
     //TODO: Remove after WP 3.1 release, not longer needed
     if (is_multisite() && wpmu_site_admin()) {
         add_submenu_page('ms-admin.php', __('NextGEN Gallery', 'nggallery'), __('NextGEN Gallery', 'nggallery'), 'activate_plugins', 'nggallery-wpmu', array(&$this, 'show_menu'));
     }
     if (!is_multisite() || wpmu_site_admin()) {
         add_submenu_page(NGGFOLDER, __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array(&$this, 'show_menu'));
     }
     //register the column fields
     $this->register_columns();
 }
Example #2
0
/**
 * Show the server settings
 * 
 * @return void
 */
function ngg_overview_server()
{
    ?>
<div id="dashboard_server_settings" class="dashboard-widget-holder wp_dashboard_empty">
	<div class="ngg-dashboard-widget">
	  <?php 
    if (IS_WPMU) {
        if (wpmu_enable_function('wpmuQuotaCheck')) {
            echo ngg_SpaceManager::details();
        } else {
            //TODO:WPMU message in WP2.5 style
            echo ngg_SpaceManager::details();
        }
    } else {
        ?>
	  	<div class="dashboard-widget-content">
      		<ul class="settings">
      		<?php 
        ngg_get_serverinfo();
        ?>
	   		</ul>
		</div>
	  <?php 
    }
    ?>
    </div>
</div>
<?php 
}
Example #3
0
 function add_menu()
 {
     add_menu_page(__ngettext('Gallery', 'Galleries', 1, 'nggallery'), __ngettext('Gallery', 'Galleries', 1, 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array(&$this, 'show_menu'), NGGALLERY_URLPATH . 'admin/images/nextgen.png');
     add_submenu_page(NGGFOLDER, __('Overview', 'nggallery'), __('Overview', 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Add Gallery / Images', 'nggallery'), __('Add Gallery / Images', 'nggallery'), 'NextGEN Upload images', 'nggallery-add-gallery', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'NextGEN Manage gallery', 'nggallery-manage-gallery', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __ngettext('Album', 'Albums', 1, 'nggallery'), __ngettext('Album', 'Albums', 1, 'nggallery'), 'NextGEN Edit album', 'nggallery-manage-album', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Tags', 'nggallery'), __('Tags', 'nggallery'), 'NextGEN Manage tags', 'nggallery-tags', array(&$this, 'show_menu'));
     add_submenu_page(NGGFOLDER, __('Options', 'nggallery'), __('Options', 'nggallery'), 'NextGEN Change options', 'nggallery-options', array(&$this, 'show_menu'));
     if (wpmu_enable_function('wpmuStyle')) {
         add_submenu_page(NGGFOLDER, __('Style', 'nggallery'), __('Style', 'nggallery'), 'NextGEN Change style', 'nggallery-style', array(&$this, 'show_menu'));
     }
     add_submenu_page(NGGFOLDER, __('Setup Gallery', 'nggallery'), __('Setup', 'nggallery'), 'activate_plugins', 'nggallery-setup', array(&$this, 'show_menu'));
     if (wpmu_enable_function('wpmuRoles')) {
         add_submenu_page(NGGFOLDER, __('Roles', 'nggallery'), __('Roles', 'nggallery'), 'activate_plugins', 'nggallery-roles', array(&$this, 'show_menu'));
     }
     add_submenu_page(NGGFOLDER, __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'NextGEN Gallery overview', 'nggallery-about', array(&$this, 'show_menu'));
     if (wpmu_site_admin()) {
         add_submenu_page('wpmu-admin.php', __('NextGEN Gallery', 'nggallery'), __('NextGEN Gallery', 'nggallery'), 'activate_plugins', 'nggallery-wpmu', array(&$this, 'show_menu'));
     }
 }
Example #4
0
    function tab_uploadimage()
    {
        global $ngg;
        // check the cookie for the current setting
        $checked = get_user_setting('ngg_upload_resize') ? ' checked="true"' : '';
        ?>
    	<!-- upload images -->
    	<h2><?php 
        _e('Upload Images', 'nggallery');
        ?>
</h2>
		<form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php 
        echo $this->filepath . '#uploadimage';
        ?>
" accept-charset="utf-8" >
		<?php 
        wp_nonce_field('ngg_addgallery');
        ?>
			<table class="form-table">
            
			<tr valign="top">
				<th scope="row"><?php 
        _e('Upload image', 'nggallery');
        ?>
</th>
                <?php 
        if ($ngg->options['swfUpload'] && defined('IS_WP_3_3')) {
            ?>
				<td>
                <div id="plupload-upload-ui">
                	<div>
                    	<?php 
            _e('Choose files to upload');
            ?>
                    	<input id="plupload-browse-button" type="button" value="<?php 
            esc_attr_e('Select Files');
            ?>
" class="button" />
                	</div>
                	<p class="ngg-dragdrop-info howto" style="display:none;" ><?php 
            _e('Or you can drop the files into this window.');
            ?>
</p>
                    <div id='uploadQueue'></div>
                    <p><label><input name="image_resize" type="checkbox" id="image_resize" value="true"<?php 
            echo $checked;
            ?>
 />
                        <?php 
            printf(__('Scale images to max width %1$dpx or max height %2$dpx', 'nggallery'), (int) $ngg->options['imgWidth'], (int) $ngg->options['imgHeight']);
            ?>
                        <div id='image_resize_pointer'>&nbsp;</div>
                        </label>
                    </p>
                    
                 </div>
                </td>
                <?php 
        } else {
            ?>
				<td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
                <?php 
        }
        ?>
            </tr> 
			<tr valign="top"> 
				<th scope="row"><?php 
        _e('in to', 'nggallery');
        ?>
</th> 
				<td><select name="galleryselect" id="galleryselect">
				<option value="0" ><?php 
        _e('Choose gallery', 'nggallery');
        ?>
</option>
				<?php 
        foreach ($this->gallerylist as $gallery) {
            //special case : we check if a user has this cap, then we override the second cap check
            if (!current_user_can('NextGEN Upload in all galleries')) {
                if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
                    continue;
                }
            }
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr($name) . '</option>' . "\n";
        }
        ?>
				</select>
				<br /><?php 
        echo $this->maxsize;
        ?>
				<br /><?php 
        if (is_multisite() && wpmu_enable_function('wpmuQuotaCheck')) {
            display_space_usage();
        }
        ?>
</td> 
			</tr> 
			</table>
			<div class="submit">
				<?php 
        if ($ngg->options['swfUpload']) {
            ?>
				<input type="submit" name="disable_flash" id="disable_flash" title="<?php 
            _e('The batch upload requires Adobe Flash 10, disable it if you have problems', 'nggallery');
            ?>
" value="<?php 
            _e('Disable flash upload', 'nggallery');
            ?>
" />
				<?php 
        } else {
            ?>
				<input type="submit" name="enable_flash" id="enable_flash" title="<?php 
            _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'nggallery');
            ?>
" value="<?php 
            _e('Enable flash based upload', 'nggallery');
            ?>
" />
				<?php 
        }
        ?>
				<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
        _e('Upload images', 'nggallery');
        ?>
" />
			</div>
		</form>
    <?php 
    }
Example #5
0
function nggallery_picturelist()
{
    // *** show picture list
    global $wpdb, $nggdb, $user_ID, $ngg;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    $counter = 0;
    $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $ngg->manage_page->search_result;
        // we didn't set a gallery or a pagination
        $act_gid = 0;
        $_GET['paged'] = 1;
        $page_links = false;
    } else {
        // GET variables
        $act_gid = $ngg->manage_page->gid;
        // Load the gallery metadata
        $gallery = $nggdb->find_gallery($act_gid);
        if (!$gallery) {
            nggGallery::show_error(__('Gallery not found.', 'nggallery'));
            return;
        }
        // Check if you have the correct capability
        if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
            nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
            return;
        }
        // look for pagination
        $_GET['paged'] = isset($_GET['paged']) && $_GET['paged'] > 0 ? absint($_GET['paged']) : 1;
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $nggdb->get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false, 50, $start);
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $nggdb->find_all_galleries();
    //get the columns
    $image_columns = $wp_list_table->get_columns();
    $hidden_columns = get_hidden_columns('nggallery-manage-images');
    $num_columns = count($image_columns) - count($hidden_columns);
    $attr = nggGallery::current_user_can('NextGEN Edit gallery options') ? '' : 'disabled="disabled"';
    ?>
<script type="text/javascript">
<!--
function showDialog( windowId, title ) {
	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);
    // now show the dialog
	jQuery( "#" + windowId ).dialog({
		width: 640,
        resizable : false,
		modal: true,
        title: title,
		position: {
			my:		'center',
			at:		'center',
			of:		window.parent
		}
	});
    jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
}

jQuery(function (){

    jQuery('span.tooltip, label.tooltip').tooltip();

    // load a content via ajax
    jQuery('a.ngg-dialog').click(function() {
    	var dialogs = jQuery('.ngg-overlay-dialog:visible');
    	if (dialogs.size() > 0) {
    		return false;
    	}

      if ( jQuery( "#spinner" ).length == 0) {
      	jQuery("body").append('<div id="spinner"></div>');
      }

    	var $this = jQuery(this);
      var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
    	var width  = ( results ) ? results[1] : 600;
      var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
	    var height = ( results ) ? results[1] : 440;
      var container = window;

      if (window.parent) {
      	container = window.parent;
      }

      jQuery('#spinner').fadeIn();
      jQuery('#spinner').position({ my: "center", at: "center", of: container });

      var dialog = jQuery('<div class="ngg-overlay-dialog" style="display:hidden"></div>').appendTo('body');
      // load the remote content
      dialog.load(
          this.href,
          {},
          function () {
              jQuery('#spinner').hide();

              dialog.dialog({
                  title: ($this.attr('title')) ? $this.attr('title') : '',
                  position: { my: "center", at: "center", of: container },
                  width: width,
                  height: height,
                  modal: true,
                  resizable: false,
                  close: function() { dialog.remove(); }
              }).width(width - 30).height(height - 30);
          }
      );

      //prevent the browser to follow the link
      return false;
    });
});

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 (typeof document.activeElement == "undefined" && document.addEventListener) {
    	document.addEventListener("focus", function (e) {
    		document.activeElement = e.target;
    	}, true);
    }

    if ( document.activeElement.name == 'post_paged' )
        return true;

	if(numchecked < 1) {
		alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
		return false;
	}

	actionId = jQuery('#bulkaction').val();

	switch (actionId) {
		case "copy_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Copy image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "move_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Move image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "add_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Add new tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "delete_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Delete tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "overwrite_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Overwrite', 'nggallery'));
    ?>
');
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
			return false;
			break;
	}

	return confirm('<?php 
    echo sprintf(esc_js(__("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($) {
	if ($(this).data('ready')) return;

	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('ngg-manage-gallery');

	$(this).data('ready', true);
});

//-->
</script>
<div class="wrap">
<?php 
    //include('templates/social_media_buttons.php');
    screen_icon('nextgen-gallery');
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html(get_search_query()));
        ?>
</h2>
<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="media-search-input"><?php 
        _e('Search Images', 'nggallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'nggallery');
        ?>
" class="button" />
</p>
</form>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query();
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
    } else {
        ?>
<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'nggallery');
        ?>
 : <?php 
        echo esc_html(nggGallery::i18n($gallery->title));
        ?>
</h2>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . $_GET['paged'];
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
        if (nggGallery::current_user_can('NextGEN Edit gallery options')) {
            ?>
<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 <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery title');
            ?>
 type="text" size="50" name="title" value="<?php 
            echo esc_attr(stripslashes($gallery->title));
            ?>
"  /></th>
					<th align="right"><?php 
            _e('Page Link to', 'nggallery');
            ?>
:</th>
					<th align="left">
					<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery page id');
            ?>
  name="pageid" style="width:95%">
						<option value="0" ><?php 
            _e('Not linked', 'nggallery');
            ?>
</option>
                        <?php 
            foreach (get_pages() as $page) {
                ?>
                            <option <?php 
                selected($gallery->pageid, $page->ID);
                ?>
 value="<?php 
                echo esc_attr($page->ID);
                ?>
"><?php 
                echo esc_html($page->post_title);
                ?>
</option>
                        <?php 
            }
            ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Description');
            ?>
:</th>
					<th align="left"><textarea  <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery description');
            ?>
 name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
            echo esc_attr(stripslashes($gallery->galdesc));
            ?>
</textarea></th>
					<th align="right"><?php 
            _e('Preview image', 'nggallery');
            ?>
:</th>
					<th align="left">
						<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery preview pic');
            ?>
 name="previewpic" style="width:95%" >
							<option value="0" ><?php 
            _e('No Picture', 'nggallery');
            ?>
</option>
							<?php 
            // ensure that a preview pic from a other page is still shown here
            if (intval($gallery->previewpic) != 0) {
                if (!array_key_exists($gallery->previewpic, $picturelist)) {
                    $previewpic = $nggdb->find_image($gallery->previewpic);
                    if ($previewpic) {
                        echo '<option value="' . $previewpic->pid . '" selected="selected" >' . $previewpic->pid . ' - ' . esc_attr($previewpic->filename) . '</option>' . "\n";
                    }
                }
            }
            if (is_array($picturelist)) {
                foreach ($picturelist as $picture) {
                    if ($picture->exclude) {
                        continue;
                    }
                    $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
                    echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . esc_attr($picture->filename) . '</option>' . "\n";
                }
            }
            ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Path', 'nggallery');
            ?>
:</th>
					<th align="left"><input 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 && nggGallery::current_user_can('NextGEN Edit gallery author')) {
                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>
				<?php 
            if (current_user_can('publish_pages')) {
                ?>
				<tr>
					<th align="left">&nbsp;</th>
					<th align="left">&nbsp;</th>
					<th align="right">
                        <label for='ngg_settings_parent_id'
                               class='tooltip'
                               title="Clicking <?php 
                _e('Add Page');
                ?>
 will create a new page with the same name as this gallery and will display the gallery on that new page. You can create a sub-page by selecting the parent page from the drop down.">
                            <?php 
                _e('Create new page', 'nggallery');
                ?>
:
                        </label>
                    </th>
					<th align="left">
					<select name="parent_id" style="width:95%" id='ngg_settings_parent_id'>
						<option value="0"><?php 
                _e('Main page (No parent)', 'nggallery');
                ?>
</option>
						<?php 
                foreach (get_pages() as $page) {
                    ?>
                        <option value="<?php 
                    echo esc_attr($page->ID);
                    ?>
"><?php 
                    echo esc_html($page->post_title);
                    ?>
</option>
                        <?php 
                }
                ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
                _e('Add page', 'nggallery');
                ?>
" id="group"/>
					</th>
				</tr>
				<?php 
            }
            ?>
                <?php 
            do_action('ngg_manage_gallery_settings', $act_gid);
            ?>

			</table>

			<div class="submit">
				<?php 
            if (wpmu_enable_function('wpmuScanFolder') && nggGallery::current_user_can('NextGEN Scan folder')) {
                ?>
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
                _e("Scan Folder for new images", 'nggallery');
                ?>
 " />
				<?php 
            }
            ?>
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
            _e("Save Changes", 'nggallery');
            ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->
<?php 
        }
        ?>

<?php 
    }
    ?>

<div class="tablenav top ngg-tablenav">
    <?php 
    $ngg->manage_page->pagination('top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page']);
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("Bulk actions", 'nggallery');
    ?>
</option>
		<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="recover_images" ><?php 
    _e("Recover from backup", 'nggallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'nggallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'nggallery');
    ?>
</option>
		<option value="rotate_cw" ><?php 
    _e("Rotate images clockwise", 'nggallery');
    ?>
</option>
		<option value="rotate_ccw" ><?php 
    _e("Rotate images counter-clockwise", 'nggallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'nggallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'nggallery');
    ?>
</option>
		<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>
	</select>
	<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
    _e('Apply', 'nggallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />

	<?php 
    if ($ngg->options['galSort'] == "sortorder" && !$is_search) {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e('Sort gallery', 'nggallery');
        ?>
" />
	<?php 
    }
    ?>

	<input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
	</div>
</div>

<table id="ngg-listimages" class="widefat fixed" cellspacing="0" >

	<thead>
	<tr>
<?php 
    $wp_list_table->print_column_headers(true);
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    $wp_list_table->print_column_headers(false);
    ?>
	</tr>
	</tfoot>
	<tbody id="the-list">
<?php 
    if ($picturelist) {
        $thumbsize = '';
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!nggAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $counter++;
            $pid = (int) $picture->pid;
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : '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;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
			<?php 
            foreach ($image_columns as $image_column_key => $column_display_name) {
                $class = "class='{$image_column_key} column-{$image_column_key}'";
                $style = '';
                if (in_array($image_column_key, $hidden_columns)) {
                    $style = ' style="display:none;"';
                }
                $attributes = $class . $style;
                switch ($image_column_key) {
                    case 'cb':
                        $attributes = 'class="column-cb check-column"' . $style;
                        ?>
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
 style=""><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'filename':
                        $attributes = 'class="title column-filename column-title"' . $style;
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo nextgen_esc_url($picture->imageURL);
                        ?>
" class="thickbox" title="<?php 
                        echo esc_attr($picture->filename);
                        ?>
">
								<?php 
                        echo empty($picture->alttext) ? esc_html($picture->filename) : esc_html(stripslashes(nggGallery::i18n($picture->alttext)));
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data)) {
                            ?>
							<br /><?php 
                            echo $picture->meta_data['width'];
                            ?>
 x <?php 
                            echo $picture->meta_data['height'];
                            ?>
 <?php 
                            _e('pixel', 'nggallery');
                            ?>

							<?php 
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="shutter" href="' . nextgen_esc_url($picture->imageURL) . '" title="' . esc_attr(sprintf(__('View "%s"'), sanitize_title($picture->filename))) . '">' . __('View', 'nggallery') . '</a>';
                        $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
                        $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate', 'nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
                        if (current_user_can('publish_posts')) {
                            $actions['publish'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/publish.php?id=' . $pid . '&h=230" title="' . __('Publish this image', 'nggallery') . '">' . __('Publish', 'nggallery') . '</a>';
                        }
                        if (file_exists($picture->imagePath . '_backup')) {
                            $actions['recover'] = '<a class="confirmrecover" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=recoverpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_recoverpicture') . '" title="' . __('Recover', 'nggallery') . '" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Recover "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Recover', 'nggallery') . '</a>';
                        }
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete') . '</a>';
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        foreach ($actions as $action => $link) {
                            ++$i;
                            $i == $action_count ? $sep = '' : ($sep = ' | ');
                            echo "<span class='{$action}'>{$link}{$sep}</span>";
                        }
                        echo '</div>';
                        ?>
</p>
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        $attributes = 'class="id column-thumbnail media-icon"' . $style;
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo nextgen_esc_url(add_query_arg('i', mt_rand(), $picture->imageURL));
                        ?>
" class="shutter" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo nextgen_esc_url(add_query_arg('i', mt_rand(), $picture->thumbURL));
                        ?>
" id="thumb<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_attr(stripslashes($picture->alttext));
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo esc_attr(stripslashes($picture->description));
                        ?>
</textarea>
						</td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><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 <?php 
                        echo $attributes;
                        ?>
><textarea name="tags[<?php 
                        echo $pid;
                        ?>
]" style="width:95%;" rows="2"><?php 
                        echo $picture->tags;
                        ?>
</textarea></td>
						<?php 
                        break;
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('ngg_manage_image_custom_column', $image_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>

		</tbody>
	</table>
    <div class="tablenav bottom">
    <input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
    <?php 
    $ngg->manage_page->pagination('bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page']);
    ?>
    </div>
	</form>
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="entertags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" />
		    	</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');
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e('Select the destination gallery:', 'nggallery');
    ?>
&nbsp;
		    		<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 esc_attr(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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
    <table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td>
				<?php 
    include dirname(__FILE__) . '/thumbnails-template.php';
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('nggallery-manage-images');});
	/* ]]> */
	</script>
	<?php 
}
Example #6
0
function nggallery_picturelist($controller)
{
    // *** show picture list
    global $wpdb, $nggdb, $user_ID, $ngg;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    $counter = 0;
    $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $ngg->manage_page->search_result;
        // we didn't set a gallery or a pagination
        $act_gid = 0;
        $_GET['paged'] = 1;
        $page_links = false;
    } else {
        // GET variables
        $act_gid = $ngg->manage_page->gid;
        // Load the gallery metadata
        $mapper = C_Gallery_Mapper::get_instance();
        $gallery = $mapper->find($act_gid);
        if (!$gallery) {
            nggGallery::show_error(__('Gallery not found.', 'nggallery'));
            return;
        }
        // Check if you have the correct capability
        if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
            nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
            return;
        }
        // look for pagination
        $_GET['paged'] = isset($_GET['paged']) && $_GET['paged'] > 0 ? absint($_GET['paged']) : 1;
        $items_per_page = 50;
        $start = ($_GET['paged'] - 1) * $items_per_page;
        // get picture values
        $image_mapper = C_Image_Mapper::get_instance();
        $total_number_of_images = count($image_mapper->select($image_mapper->get_primary_key_column())->where(array("galleryid = %d", $act_gid))->run_query(FALSE, TRUE));
        $picturelist = $image_mapper->select()->where(array("galleryid = %d", $act_gid))->order_by($ngg->options['galSort'], $ngg->options['galSortDir'])->limit($items_per_page, $start)->run_query();
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $nggdb->find_all_galleries();
    //get the columns
    $image_columns = $wp_list_table->get_columns();
    $hidden_columns = get_hidden_columns('nggallery-manage-images');
    $num_columns = count($image_columns) - count($hidden_columns);
    $attr = nggGallery::current_user_can('NextGEN Edit gallery options') ? '' : 'disabled="disabled"';
    ?>
<script type="text/javascript">
<!--
function showDialog( windowId, title ) {
	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);
    // now show the dialog
	jQuery( "#" + windowId ).dialog({
		width: 640,
        resizable : false,
		modal: true,
        title: title,
		position: {
			my:		'center',
			at:		'center',
			of:		window.parent
		}
	});
    jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
}

jQuery(function (){

    jQuery('span.tooltip, label.tooltip').tooltip();

    // load a content via ajax
    jQuery('a.ngg-dialog').click(function() {
    	var dialogs = jQuery('.ngg-overlay-dialog:visible');
    	if (dialogs.size() > 0) {
    		return false;
    	}

      if ( jQuery( "#spinner" ).length == 0) {
      	jQuery("body").append('<div id="spinner"></div>');
      }

    	var $this = jQuery(this);
      var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
    	var width  = ( results ) ? results[1] : 600;
      var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
	    var height = ( results ) ? results[1] : 440;
      var container = window;

      if (window.parent) {
      	container = window.parent;
      }

      jQuery('#spinner').fadeIn();
      jQuery('#spinner').position({ my: "center", at: "center", of: container });

      var dialog = jQuery('<div class="ngg-overlay-dialog" style="display:hidden"></div>').appendTo('body');
      // load the remote content
      dialog.load(
          this.href,
          {},
          function () {
              jQuery('#spinner').hide();

              dialog.dialog({
                  title: ($this.attr('title')) ? $this.attr('title') : '',
                  position: { my: "center", at: "center", of: container },
                  width: width,
                  height: height,
                  modal: true,
                  resizable: false,
                  close: function() { dialog.remove(); }
              }).width(width - 30).height(height - 30);
          }
      );

      //prevent the browser to follow the link
      return false;
    });
});

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 (typeof document.activeElement == "undefined" && document.addEventListener) {
    	document.addEventListener("focus", function (e) {
    		document.activeElement = e.target;
    	}, true);
    }

    if ( document.activeElement.name == 'post_paged' )
        return true;

	if(numchecked < 1) {
		alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
		return false;
	}

	actionId = jQuery('#bulkaction').val();

	switch (actionId) {
		case "copy_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Copy image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "move_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Move image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "add_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Add new tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "delete_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Delete tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "overwrite_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Overwrite', 'nggallery'));
    ?>
');
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
			return false;
			break;
	}

	return confirm('<?php 
    echo sprintf(esc_js(__("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($) {
	if ($(this).data('ready')) return;

	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('ngg-manage-gallery');

	jQuery('.iedit').mouseover(
		function(e){
			jQuery(this).parent().find('.row-actions').css('visibility', 'hidden');
			jQuery(this).next('.row_actions:first').find('.row-actions:first').css('visibility', 'visible');
		}
	);

	$(this).data('ready', true);
});

//-->
</script>
<div class="wrap">
<?php 
    //include('templates/social_media_buttons.php');
    screen_icon('nextgen-gallery');
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html(get_search_query()));
        ?>
</h2>
<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="media-search-input"><?php 
        _e('Search Images', 'nggallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'nggallery');
        ?>
" class="button" />
</p>
</form>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query();
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
    } else {
        ?>
<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'nggallery');
        ?>
 : <?php 
        echo esc_html(nggGallery::i18n($gallery->title));
        ?>
</h2>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . esc_attr($_GET['paged']);
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
        if (nggGallery::current_user_can('NextGEN Edit gallery options')) {
            ?>
<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">
			<?php 
            $controller->render_gallery_fields();
            ?>

			<div class="submit">
				<?php 
            if (wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can('NextGEN Import image folder')) {
                ?>
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
                _e("Scan Folder for new images", 'nggallery');
                ?>
 " />
				<?php 
            }
            ?>
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
            _e("Save Changes", 'nggallery');
            ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->
<?php 
        }
        ?>

<?php 
    }
    ?>

<div class="tablenav top ngg-tablenav">
    <?php 
    $ngg->manage_page->pagination('top', $_GET['paged'], $total_number_of_images, $items_per_page);
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("Bulk actions", 'nggallery');
    ?>
</option>
		<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="recover_images" ><?php 
    _e("Recover from backup", 'nggallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'nggallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'nggallery');
    ?>
</option>
		<option value="rotate_cw" ><?php 
    _e("Rotate images clockwise", 'nggallery');
    ?>
</option>
		<option value="rotate_ccw" ><?php 
    _e("Rotate images counter-clockwise", 'nggallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'nggallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'nggallery');
    ?>
</option>
		<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>
	</select>
	<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
    _e('Apply', 'nggallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />

	<?php 
    if ($ngg->options['galSort'] == "sortorder" && !$is_search) {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e('Sort gallery', 'nggallery');
        ?>
" />
	<?php 
    }
    ?>

	<input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
	</div>
</div>
<table id="ngg-listimages" class="widefat fixed" cellspacing="0" >

	<thead>
		<?php 
    $controller->render_image_row_header();
    ?>
	</thead>
	<tfoot>
		<?php 
    $controller->render_image_row_header();
    ?>
	</tfoot>
	<tbody id="the-list">
<?php 
    if ($picturelist) {
        $thumbsize = '';
        $storage = C_Gallery_Storage::get_instance();
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!nggAdmin::can_manage_this_gallery($gallery->author) && $is_search) {
                continue;
            }
            $counter++;
            $picture->imageURL = $storage->get_image_url($picture);
            $picture->thumbURL = $storage->get_thumb_url($picture);
            $picture->imagePath = $storage->get_image_abspath($picture);
            $picture->thumbPath = $storage->get_thumb_abspath($picture);
            echo apply_filters('ngg_manage_images_row', $picture, $counter);
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>

		</tbody>
	</table>
    <div class="tablenav bottom">
    <input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
    <?php 
    $ngg->manage_page->pagination('bottom', $_GET['paged'], $total_number_of_images, $items_per_page);
    ?>
    </div>
	</form>
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="entertags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" />
		    	</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');
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e('Select the destination gallery:', 'nggallery');
    ?>
&nbsp;
		    		<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 esc_attr(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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
    <table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td>
				<?php 
    include dirname(__FILE__) . '/thumbnails-template.php';
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('nggallery-manage-images');});
	/* ]]> */
	</script>
	<?php 
}
Example #7
0
function ngg_dashboard_quota()
{
    if (get_site_option('upload_space_check_disabled')) {
        return;
    }
    if (!wpmu_enable_function('wpmuQuotaCheck')) {
        return;
    }
    $quota = get_space_allowed();
    $used = get_dirsize(BLOGUPLOADDIR) / 1024 / 1024;
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_color = $percentused < 70 ? $percentused >= 40 ? 'waiting' : 'approved' : 'spam';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<p class="sub musub" style="position:static" ><?php 
    _e('Storage Space');
    ?>
</p>
	<div class="table table_content musubtable">
	<table>
		<tr class="first">
			<td class="first b b-posts"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>'), esc_url(admin_url('admin.php?page=nggallery-manage-gallery')), $quota);
    ?>
</td>
			<td class="t posts"><?php 
    _e('Space Allowed');
    ?>
</td>
		</tr>
	</table>
	</div>
	<div class="table table_discussion musubtable">
	<table>
		<tr class="first">
			<td class="b b-comments"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>'), esc_url(admin_url('admin.php?page=nggallery-manage-gallery')), $used, $percentused);
    ?>
</td>
			<td class="last t comments <?php 
    echo $used_color;
    ?>
"><?php 
    _e('Space Used');
    ?>
</td>
		</tr>
	</table>
	</div>
	<br class="clear" />
	<?php 
}
Example #8
0
 /**
  * Add help and options to the correct screens
  *
  * @since 1.9.24
  *
  * @param object $screen The current screen.
  *
  * @return object $screen The current screen.
  */
 function edit_current_screen($screen)
 {
     // menu title is localized, so we need to change the toplevel name
     $i18n = strtolower(__('Galleries', 'nggallery'));
     switch ($screen->id) {
         case 'toplevel_page_' . NGGFOLDER:
             //The tab content
             $help = '<p>' . __('Welcome to your NextCellent Dashboard! This screen gives you all kinds of information about NextCellent at glance. You can get help for any screen by clicking the Help tab in the upper corner.') . '</p>';
             //Add the tab
             $screen->add_help_tab(array('id' => $screen->id . '-welcome', 'title' => 'Overview', 'content' => $help));
             //The tab content
             $help = '<p>' . __('The boxes on your overview screen are:', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('At a Glance', 'nggallery') . '</strong> - ' . __('Shows some general information about your site, such as the number of pictures, albums and galleries.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Latest News', 'nggallery') . '</strong> - ' . __('The latest NextCellent news.', 'nggallery') . '</p>';
             if (!is_multisite() || is_super_admin()) {
                 $help .= '<p><strong>' . __('Related plugins', 'nggallery') . '</strong> - ' . __('Shows plugins that extend NextCellent.', 'nggallery') . ' <strong>' . __('Pay attention', 'nggallery') . '</strong>: ' . __('third parties plugins that are compatible with NGG may not be 100% compatible with NextCellent Gallery!', 'nggallery') . '</p>';
             }
             $help .= '<p><strong>' . __('Help me help YOU!', 'nggallery') . '</strong> - ' . __('Shows general information about he plugin and some links.', 'nggallery') . '</p>';
             if (!(get_locale() == 'en_US')) {
                 $help .= '<p><strong>' . __('Translation', 'nggallery') . '</strong> - ' . __('View information about the current translation.') . '</p>';
             }
             if (!is_multisite() || is_super_admin()) {
                 $help .= '<p><strong>' . __('Server Settings', 'nggallery') . '</strong> - ' . __('Show all the server settings!.', 'nggallery') . '</p>';
                 $help .= '<p><strong>' . __('Plugin Check', 'nggallery') . '</strong> - ' . __('Check if there are known errors in your installation.', 'nggallery') . '</p>';
             }
             //Add the tab
             $screen->add_help_tab(array('id' => $screen->id . '-content', 'title' => 'Content', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-add-gallery":
             global $nggdb;
             $gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
             //look for galleries
             $help = '<p>' . __('On this page you can add galleries and pictures to those galleries.', 'nggallery') . '</p>';
             if (nggGallery::current_user_can('NextGEN Add new gallery')) {
                 $help .= '<p><strong>' . __('New gallery', 'nggallery') . '</strong> - ' . __('Add new galleries to NextCellent.', 'nggallery') . '</p>';
             }
             if (empty($gallerylist)) {
                 $help .= '<p><strong>' . __('You must add a gallery before adding images!', 'nggallery') . '</strong>';
             } else {
                 $help .= '<p><strong>' . __('Images', 'nggallery') . '</strong> - ' . __('Add new images to a gallery.', 'nggallery') . '</p>';
             }
             if (wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can('NextGEN Upload a zip') && !empty($gallerylist)) {
                 $help .= '<p><strong>' . __('ZIP file', 'nggallery') . '</strong> - ' . __('Add images from a ZIP file.', 'nggallery') . '</p>';
             }
             if (wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can('NextGEN Import image folder')) {
                 $help .= '<p><strong>' . __('Import folder', 'nggallery') . '</strong> - ' . __('Import a folder from the server as a new gallery.', 'nggallery') . '</p>';
             }
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Add things', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-manage-gallery":
             // we would like to have screen option only at the manage images / gallery page
             if (isset($_GET['mode']) && $_GET['mode'] == 'edit' || isset($_POST['backToGallery'])) {
                 $screen->base = $screen->id = 'nggallery-manage-images';
             } else {
                 $screen->base = $screen->id = 'nggallery-manage-gallery';
             }
             $help = '<p>' . __('Manage your images and galleries.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Manage everything', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-manage-album":
             $help = '<p>' . __('Organize your galleries into albums.', 'nggallery') . '</p><p>' . __('First select an album from the dropdown and then drag the galleries you want to add or remove from the selected album.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Organize everything', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-tags":
             $help = '<p>' . __('Organize your pictures with tags.', 'nggallery') . '</p><p>' . __('Rename, delete and edit tags. Use the rename function to merge tags.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Organize pictures', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-options":
             $help = '<p>' . __('Edit all of NextCellent\'s options. The options are sorted in multiple categories.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('General', 'nggallery') . '</strong> - ' . __('General NextCellent options. Contains options for permalinks and related images.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Images', 'nggallery') . '</strong> - ' . __('All image-related options. Also contains options for thumbnails.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Gallery', 'nggallery') . '</strong> - ' . __('Everything about galleries. From sorting options to the number of images, it\'s all in here.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Effects', 'nggallery') . '</strong> - ' . __('Make your gallery look beautiful.', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Watermark', 'nggallery') . '</strong> - ' . __('Who doesn\'t want theft-proof images?', 'nggallery') . '</p>';
             $help .= '<p><strong>' . __('Slideshow', 'nggallery') . '</strong> - ' . __('Edit options for the slideshow.', 'nggallery') . '</p>';
             $help .= '<p>' . __('Don\'t forget to press save!', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Edit options', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-style":
             $help = '<p>' . __('You can edit the css file to adjust how your gallery looks.', 'nggallery') . '</p>';
             $help .= '<p>' . __('When you save an edited file, NextCellent automatically saves it as a copy in the folder ngg_styles. This protects your changes from upgrades.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Style your gallery', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-roles":
             $help = '<p>' . __('You can assign the lowest user role that has access to a certain feature. Needless to say, all greater user roles will also have access to that feature.', 'nggallery') . '</p>';
             $help .= '<p>' . __('NextCellent also works with various plugins that extend the default roles capabilities.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Grant permissions', 'content' => $help));
             break;
         case "{$i18n}_page_nggallery-setup":
             $help = '<p>' . __('If \'someone\' messed with your settings (yeah, definitely not you), you can reset them here.', 'nggallery') . '</p>';
             $help .= '<p><b>' . __('Attention!', 'nggallery') . '</b> ' . __('You should not use the Uninstall Plugin button, unless you know what you\'re doing! It should never be necessary to press it.', 'nggallery') . '</p>';
             $screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Reset', 'content' => $help));
             break;
     }
     //Set the sidebar (same on all pages)
     $screen->set_help_sidebar('<p><strong>' . __('For more information:', 'nggallery') . '</strong></p>' . '<p><a href="http://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">' . __('Support Forums', 'nggallery') . '</a></p>' . '<p><a href="https://bitbucket.org/wpgetready/nextcellent" target="_blank">' . __('Source Code', 'nggallery') . '</a></p>');
     return $screen;
 }
Example #9
0
 /**
  * Adding NextGEN Gallery to the Admin bar
  * 
  * @since 1.9.0
  * 
  * @return void
  */
 function admin_bar_menu()
 {
     // If the current user can't write posts, this is all of no use, so let's not output an admin menu
     if (!current_user_can('NextGEN Gallery overview')) {
         return;
     }
     global $wp_admin_bar;
     $wp_admin_bar->add_menu(array('id' => 'ngg-menu', 'title' => __('Gallery'), 'href' => admin_url('admin.php?page=' . NGGFOLDER)));
     $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-overview', 'title' => __('Overview', 'nggallery'), 'href' => admin_url('admin.php?page=' . NGGFOLDER)));
     if (current_user_can('NextGEN Upload images')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-add-gallery', 'title' => __('Add Gallery / Images', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-add-gallery')));
     }
     if (current_user_can('NextGEN Manage gallery')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-gallery', 'title' => __('Manage Gallery', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-manage-gallery')));
     }
     if (current_user_can('NextGEN Edit album')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-album', 'title' => _n('Album', 'Albums', 1, 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-manage-album')));
     }
     if (current_user_can('NextGEN Manage tags')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-tags', 'title' => __('Tags', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-tags')));
     }
     if (current_user_can('NextGEN Change options')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-options', 'title' => __('Options', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-options')));
     }
     if (wpmu_enable_function('wpmuStyle') && current_user_can('NextGEN Change style')) {
         $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-style', 'title' => __('Style', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-style')));
     }
     $wp_admin_bar->add_menu(array('parent' => 'ngg-menu', 'id' => 'ngg-menu-about', 'title' => __('About', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-about')));
 }
Example #10
0
function nggallery_admin_add_gallery()
{
    global $wpdb, $ngg;
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
    // link for the flash file
    $swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
    $swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload');
    //flash doesn't seem to like encoded ampersands, so convert them back here
    $swf_upload_link = str_replace('&#038;', '&', $swf_upload_link);
    $defaultpath = $ngg->options['gallerypath'];
    if ($_POST['addgallery']) {
        check_admin_referer('ngg_addgallery');
        $newgallery = attribute_escape($_POST['galleryname']);
        if (!empty($newgallery)) {
            nggAdmin::create_gallery($newgallery, $defaultpath);
        }
    }
    if ($_POST['zipupload']) {
        check_admin_referer('ngg_addgallery');
        if ($_FILES['zipfile']['error'] == 0) {
            $messagetext = nggAdmin::import_zipfile(intval($_POST['zipgalselect']));
        } else {
            nggGallery::show_error(__('Upload failed!', 'nggallery'));
        }
    }
    if ($_POST['importfolder']) {
        check_admin_referer('ngg_addgallery');
        $galleryfolder = $_POST['galleryfolder'];
        if (!empty($galleryfolder) and $defaultpath != $galleryfolder) {
            nggAdmin::import_gallery($galleryfolder);
        }
    }
    if ($_POST['uploadimage']) {
        check_admin_referer('ngg_addgallery');
        if ($_FILES['MF__F_0_0']['error'] == 0) {
            $messagetext = nggAdmin::upload_images();
        } else {
            nggGallery::show_error(__('Upload failed!', 'nggallery'));
        }
    }
    if (isset($_POST['swf_callback'])) {
        if ($_POST['galleryselect'] == "0") {
            nggGallery::show_error(__('No gallery selected !', 'nggallery'));
        } else {
            // get the path to the gallery
            $galleryID = (int) $_POST['galleryselect'];
            $gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$galleryID}' ");
            nggAdmin::import_gallery($gallerypath);
        }
    }
    if (isset($_POST['disable_flash'])) {
        check_admin_referer('ngg_addgallery');
        $ngg->options['swfUpload'] = false;
        update_option('ngg_options', $ngg->options);
    }
    if (isset($_POST['enable_flash'])) {
        check_admin_referer('ngg_addgallery');
        $ngg->options['swfUpload'] = true;
        update_option('ngg_options', $ngg->options);
    }
    //get all galleries (after we added new ones)
    $gallerylist = nggdb::find_all_galleries();
    ?>
	
	<?php 
    if ($ngg->options['swfUpload']) {
        ?>
	<!-- SWFUpload script -->
	<script type="text/javascript">
		var ngg_swf_upload;
			
		window.onload = function () {
			ngg_swf_upload = new SWFUpload({
				// Backend settings
				upload_url : "<?php 
        echo $swf_upload_link;
        ?>
",
				flash_url : "<?php 
        echo NGGALLERY_URLPATH;
        ?>
admin/js/swfupload.swf",
				
				// Button Settings
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 300,
				button_height: 27,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
								
				// File Upload Settings
				file_size_limit : "<?php 
        echo wp_max_upload_size();
        ?>
b",
				file_types : "*.jpg;*.gif;*.png",
				file_types_description : "<?php 
        _e('Image Files', 'nggallery');
        ?>
",
				
				// Queue handler
				file_queued_handler : fileQueued,
				
				// Upload handler
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				
				post_params : {
					"auth_cookie" : "<?php 
        echo $_COOKIE[AUTH_COOKIE];
        ?>
",
					"galleryselect" : "0"
				},
				
				// i18names
				custom_settings : {
					"remove" : "<?php 
        _e('remove', 'nggallery');
        ?>
",
					"browse" : "<?php 
        _e('Browse...', 'nggallery');
        ?>
",
					"upload" : "<?php 
        _e('Upload images', 'nggallery');
        ?>
"
				},

				// Debug settings
				debug: false
				
			});
			
			// on load change the upload to swfupload
			initSWFUpload();
			
		};
	</script>
	
	<div class="wrap" id="progressbar-wrap">
		<div class="progressborder">
			<div class="progressbar" id="progressbar">
				<span>0%</span>
			</div>
		</div>
	</div>
	
	<?php 
    } else {
        ?>
	<!-- MultiFile script -->
	<script type="text/javascript">	
		jQuery(function(){
			jQuery('#imagefiles').MultiFile({
				STRING: {
			    	remove:'<?php 
        _e('remove', 'nggallery');
        ?>
'
  				}
		 	});
		});
	</script>
	<?php 
    }
    ?>
	<!-- jQuery Tabs script -->
	<script type="text/javascript">
		jQuery(function() {
			jQuery('#slider > ul').tabs({ fxFade: true, fxSpeed: 'fast' });	
		});
	</script>
		
	<div id="slider" class="wrap">
	
		<ul id="tabs">
			<li><a href="#addgallery"><?php 
    _e('Add new gallery', 'nggallery');
    ?>
</a></li>
			<?php 
    if (wpmu_enable_function('wpmuZipUpload')) {
        ?>
			<li><a href="#zipupload"><?php 
        _e('Upload a Zip-File', 'nggallery');
        ?>
</a></li>
			<?php 
    }
    if (!IS_WPMU) {
        ?>
			<li><a href="#importfolder"><?php 
        _e('Import image folder', 'nggallery');
        ?>
</a></li>
			<?php 
    }
    ?>
			<li><a href="#uploadimage"><?php 
    _e('Upload Images', 'nggallery');
    ?>
</a></li>
		</ul>

		<!-- create gallery -->
		<div id="addgallery">
		<h2><?php 
    _e('Add new gallery', 'nggallery');
    ?>
</h2>
			<form name="addgallery" id="addgallery_form" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8" >
			<?php 
    wp_nonce_field('ngg_addgallery');
    ?>
				<table class="form-table"> 
				<tr valign="top"> 
					<th scope="row"><?php 
    _e('New Gallery', 'nggallery');
    ?>
:</th> 
					<td><input type="text" size="35" name="galleryname" value="" /><br />
					<?php 
    if (!IS_WPMU) {
        ?>
					<?php 
        _e('Create a new , empty gallery below the folder', 'nggallery');
        ?>
  <strong><?php 
        echo $defaultpath;
        ?>
</strong><br />
					<?php 
    }
    ?>
					<i>( <?php 
    _e('Allowed characters for file and folder names are', 'nggallery');
    ?>
: a-z, A-Z, 0-9, -, _ )</i></td>
				</tr>
				</table>
				<div class="submit"><input class="button-primary" type="submit" name= "addgallery" value="<?php 
    _e('Add gallery', 'nggallery');
    ?>
"/></div>
			</form>
		</div>
		<?php 
    if (wpmu_enable_function('wpmuZipUpload')) {
        ?>
		<!-- zip-file operation -->
		<div id="zipupload">
		<h2><?php 
        _e('Upload a Zip-File', 'nggallery');
        ?>
</h2>
			<form name="zipupload" id="zipupload_form" method="POST" enctype="multipart/form-data" action="<?php 
        echo $filepath . '#zipupload';
        ?>
" accept-charset="utf-8" >
			<?php 
        wp_nonce_field('ngg_addgallery');
        ?>
				<table class="form-table"> 
				<tr valign="top"> 
					<th scope="row"><?php 
        _e('Select Zip-File', 'nggallery');
        ?>
:</th> 
					<td><input type="file" name="zipfile" id="zipfile" size="35" class="uploadform"/><br />
					<?php 
        _e('Upload a zip file with images', 'nggallery');
        ?>
</td> 
				</tr>
				<tr valign="top"> 
					<th scope="row"><?php 
        _e('in to', 'nggallery');
        ?>
</th> 
					<td><select name="zipgalselect">
					<option value="0" ><?php 
        _e('a new gallery', 'nggallery');
        ?>
</option>
					<?php 
        foreach ($gallerylist as $gallery) {
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            echo '<option value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
        }
        ?>
					</select>
					<br /><?php 
        echo _e('Note : The upload limit on your server is ', 'nggallery') . "<strong>" . ini_get('upload_max_filesize') . "Byte</strong>\n";
        ?>
					<br /><?php 
        if (IS_WPMU && wpmu_enable_function('wpmuQuotaCheck')) {
            display_space_usage();
        }
        ?>
</td> 
				</tr> 
				</table>
				<div class="submit"><input class="button-primary" type="submit" name= "zipupload" value="<?php 
        _e('Start upload', 'nggallery');
        ?>
"/></div>
			</form>
		</div>
		<?php 
    }
    if (!IS_WPMU) {
        ?>
		<!-- import folder -->
		<div id="importfolder">
		<h2><?php 
        _e('Import image folder', 'nggallery');
        ?>
</h2>
			<form name="importfolder" id="importfolder_form" method="POST" action="<?php 
        echo $filepath . '#importfolder';
        ?>
" accept-charset="utf-8" >
			<?php 
        wp_nonce_field('ngg_addgallery');
        ?>
				<table class="form-table"> 
				<tr valign="top"> 
					<th scope="row"><?php 
        _e('Import from Server path:', 'nggallery');
        ?>
</th> 
					<td><input type="text" size="35" name="galleryfolder" value="<?php 
        echo $defaultpath;
        ?>
" /><br />
					<?php 
        _e('Import a folder with all images.', 'nggallery');
        ?>
					<?php 
        if (SAFE_MODE) {
            ?>
<br /><?php 
            _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'nggallery');
        }
        ?>
</td> 
				</tr>
				</table>
				<div class="submit"><input class="button-primary" type="submit" name= "importfolder" value="<?php 
        _e('Import folder', 'nggallery');
        ?>
"/></div>
			</form>
		</div>
		<?php 
    }
    ?>
 
		<!-- upload images -->
		<div id="uploadimage">
		<h2><?php 
    _e('Upload Images', 'nggallery');
    ?>
</h2>
			<form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php 
    echo $filepath . '#uploadimage';
    ?>
" accept-charset="utf-8" >
			<?php 
    wp_nonce_field('ngg_addgallery');
    ?>
				<table class="form-table"> 
				<tr valign="top"> 
					<th scope="row"><?php 
    _e('Upload image', 'nggallery');
    ?>
</th>
					<td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles" id="imagefiles" size="35" class="imagefiles"/></td>
				</tr> 
				<tr valign="top"> 
					<th scope="row"><?php 
    _e('in to', 'nggallery');
    ?>
</th> 
					<td><select name="galleryselect" id="galleryselect">
					<option value="0" ><?php 
    _e('Choose gallery', 'nggallery');
    ?>
</option>
					<?php 
    foreach ($gallerylist as $gallery) {
        $name = empty($gallery->title) ? $gallery->name : $gallery->title;
        echo '<option value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
    }
    ?>
					</select>
					<br /><?php 
    echo _e('Note : The upload limit on your server is ', 'nggallery') . "<strong>" . ini_get('upload_max_filesize') . "Byte</strong>\n";
    ?>
					<br /><?php 
    if (IS_WPMU && wpmu_enable_function('wpmuQuotaCheck')) {
        display_space_usage();
    }
    ?>
</td> 
				</tr> 
				</table>
				<div class="submit">
					<?php 
    if ($ngg->options['swfUpload']) {
        ?>
					<input type="submit" name="disable_flash" id="disable_flash" title="<?php 
        _e('The batch upload requires Adobe Flash 9, disable it if you have problems', 'nggallery');
        ?>
" value="<?php 
        _e('Disable flash upload', 'nggallery');
        ?>
" />
					<?php 
    } else {
        ?>
					<input type="submit" name="enable_flash" id="enable_flash" title="<?php 
        _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'nggallery');
        ?>
" value="<?php 
        _e('Enable flash based upload', 'nggallery');
        ?>
" />
					<?php 
    }
    ?>
					<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
    _e('Upload images', 'nggallery');
    ?>
" />
				</div>
			</form>
		</div>
	</div>
	<?php 
}
Example #11
0
    function tab_uploadimage()
    {
        global $ngg;
        ?>
    	<!-- upload images -->
    	<h2><?php 
        _e('Upload Images', 'nggallery');
        ?>
</h2>
		<form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php 
        echo $this->filepath . '#uploadimage';
        ?>
" accept-charset="utf-8" >
		<?php 
        wp_nonce_field('ngg_addgallery');
        ?>
			<table class="form-table"> 
			<tr valign="top"> 
				<th scope="row"><?php 
        _e('Upload image', 'nggallery');
        ?>
</th>
				<td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
			</tr> 
			<tr valign="top"> 
				<th scope="row"><?php 
        _e('in to', 'nggallery');
        ?>
</th> 
				<td><select name="galleryselect" id="galleryselect">
				<option value="0" ><?php 
        _e('Choose gallery', 'nggallery');
        ?>
</option>
				<?php 
        foreach ($this->gallerylist as $gallery) {
            //special case : we check if a user has this cap, then we override the second cap check
            if (!current_user_can('NextGEN Upload in all galleries')) {
                if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
                    continue;
                }
            }
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . $name . '</option>' . "\n";
        }
        ?>
				</select>
				<br /><?php 
        echo $this->maxsize;
        ?>
				<br /><?php 
        if (is_multisite() && wpmu_enable_function('wpmuQuotaCheck')) {
            display_space_usage();
        }
        ?>
</td> 
			</tr> 
			</table>
			<div class="submit">
				<?php 
        if ($ngg->options['swfUpload']) {
            ?>
				<input type="submit" name="disable_flash" id="disable_flash" title="<?php 
            _e('The batch upload requires Adobe Flash 10, disable it if you have problems', 'nggallery');
            ?>
" value="<?php 
            _e('Disable flash upload', 'nggallery');
            ?>
" />
				<?php 
        } else {
            ?>
				<input type="submit" name="enable_flash" id="enable_flash" title="<?php 
            _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'nggallery');
            ?>
" value="<?php 
            _e('Enable flash based upload', 'nggallery');
            ?>
" />
				<?php 
        }
        ?>
				<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
        _e('Upload images', 'nggallery');
        ?>
" />
			</div>
		</form>
    <?php 
    }
Example #12
0
 function check_quota()
 {
     // Only for WPMU
     if (IS_WPMU && wpmu_enable_function('wpmuQuotaCheck')) {
         if ($error = upload_is_user_over_quota(false)) {
             nggGallery::show_error(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'nggallery'));
             return true;
         }
     }
     return false;
 }
Example #13
0
    function dashboard_quota()
    {
        if (get_site_option('upload_space_check_disabled')) {
            return;
        }
        if (!wpmu_enable_function('wpmuQuotaCheck')) {
            return;
        }
        $settings = C_NextGen_Settings::get_instance();
        $fs = C_Fs::get_instance();
        $dir = $fs->join_paths($fs->get_document_root('content'), $settings->gallerypath);
        $quota = get_space_allowed();
        $used = get_dirsize($dir) / 1024 / 1024;
        if ($used > $quota) {
            $percentused = '100';
        } else {
            $percentused = $used / $quota * 100;
        }
        $used_color = $percentused < 70 ? $percentused >= 40 ? 'yellow' : 'green' : 'red';
        $used = round($used, 2);
        $percentused = number_format($percentused);
        ?>
        <p><?php 
        print __('Storage Space');
        ?>
</p>
        <ul>
            <li><?php 
        printf(__('%1$sMB Allowed', 'nggallery'), $quota);
        ?>
</li>
            <li class="<?php 
        print $used_color;
        ?>
"><?php 
        printf(__('%1$sMB (%2$s%%) Used', 'nggallery'), $used, $percentused);
        ?>
</li>
        </ul>
        <?php 
    }
Example #14
0
    function tab_uploadimage()
    {
        global $ngg;
        // check the cookie for the current setting
        //$checked = get_user_setting('ngg_upload_resize') ? ' checked="true"' : '';
        ?>
    	<!-- upload images -->
    	<h3><?php 
        _e('Upload images', 'nggallery');
        ?>
</h3>
		<form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php 
        echo $this->filepath . '#uploadimage';
        ?>
" accept-charset="utf-8" >
		<?php 
        wp_nonce_field('ngg_addgallery');
        ?>
			<table class="form-table">
			<tr valign="top">
				<td scope="row" style="padding: 0;" colspan="2"><?php 
        _e('in to', 'nggallery');
        ?>
<select style="margin-left:10px;" name="galleryselect" id="galleryselect">
				<option value="0" ><?php 
        _e('Choose gallery', 'nggallery');
        ?>
</option>
				<?php 
        foreach ($this->gallerylist as $gallery) {
            //special case : we check if a user has this cap, then we override the second cap check
            if (!current_user_can('NextGEN Upload in all galleries')) {
                if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
                    continue;
                }
            }
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr($name) . '</option>' . "\n";
        }
        ?>
				</select>
				<br /><?php 
        echo $this->maxsize;
        ?>
				<br /><?php 
        if (is_multisite() && wpmu_enable_function('wpmuQuotaCheck')) {
            display_space_usage();
        }
        ?>
</td>
			</tr>
			<tr valign="top">
                <?php 
        if ($ngg->options['swfUpload']) {
            ?>
				<td colspan="2" style="padding: 0;">
                <div id="plupload-upload-ui">
				<div id="drag-drop-area" style="border: 4px dashed #bbb;height: 150px; padding:20px;">
				<div class="drag-drop-inside" style="margin:auto; text-align:center; width: 250px;">
					<p class="ngg-dragdrop-info drag-drop-info" style="font-size:20px;" >
					<?php 
            _e('Drop your files in this window', 'nggallery');
            ?>
<br/><span style="font-size:14px;"><?php 
            _e('Or', 'nggallery');
            ?>
</p>
                    <input style="margin:auto; text-align:center;" id="plupload-browse-button" type="button" value="<?php 
            esc_attr_e('Select Files', 'nggallery');
            ?>
" class="button" />
					</div>
					</div>
					</div>
                </td>
                <?php 
        } else {
            ?>
				<td><span id='spanButtonPlaceholder'></span>
				<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles" multiple/></td>
                <?php 
        }
        ?>
				</tr>
				<tr><td><div id='uploadQueue' style="margin-top: 10px;"><td></div>
            </tr>
			</table>
			<div class="submit">
				<?php 
        if ($ngg->options['swfUpload']) {
            ?>
				<input class="button action" type="submit" name="disable_flash" id="disable_flash" title="<?php 
            _e('Click here to use the browser upload instead', 'nggallery');
            ?>
" value="<?php 
            _e('Use basic uploader', 'nggallery');
            ?>
" />
				<?php 
        } else {
            ?>
				<input class="button action" type="submit" name="enable_flash" id="enable_flash" title="<?php 
            _e('Advanced uploading', 'nggallery');
            ?>
" value="<?php 
            _e('Use advanced uploader', 'nggallery');
            ?>
" />
				<?php 
        }
        ?>
				<input <?php 
        if (!$ngg->options['swfUpload']) {
            ?>
 onclick="checkForm('galleryselect'); checkImgFile()" <?php 
        }
        ?>
 class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
        _e('Upload images', 'nggallery');
        ?>
" />
				<?php 
        if ($ngg->options['imgAutoResize'] == 1) {
            ?>
				<span class="description" style="margin-left: 10px;"><?php 
            printf(__('Your images will be rescaled to max width %1$dpx or max height %2$dpx.', 'nggallery'), (int) $ngg->options['imgWidth'], (int) $ngg->options['imgHeight']);
            ?>
</span>
				<?php 
        }
        ?>
			</div>
		</form>
    <?php 
    }