function npu_plugin_options()
    {
        ?>
    
    <?php 
        if (current_user_can('manage_options')) {
            if (isset($_POST['Submit'])) {
                npu_update_options();
                echo "<div class=\"updated\">\n" . "<p>" . "<strong>" . __('Settings saved.') . "</strong>" . "</p>\n" . "</div>\n";
            }
            if (isset($_POST['Restore'])) {
                npu_restore_options();
                echo "<div class=\"updated\">\n" . "<p>" . "<strong>" . __('Default settings restored.') . "</strong>" . "</p>\n" . "</div>\n";
            }
        }
        ?>

		<div class="wrap">
        	<div class="icon32" id="icon-options-general"><br/></div>
        	
				<h2>NextGEN Public Uploader</h2>
        		<p><strong><?php 
        _e('Author', 'ngg-public-uploader');
        ?>
:</strong> <a href="http://webdevstudios.com">WebDevStudios</a></p>
        		<p><strong><?php 
        _e('Current Version', 'ngg-public-uploader');
        ?>
:</strong> <?php 
        echo NG_PUBLIC_UPLOADER_VERSION;
        ?>
</p>
        		<p><strong><?php 
        _e('Shortcode Examples', 'ngg-public-uploader');
        ?>
: </strong><code>[ngg_uploader]</code> or <code>[ngg_uploader id = 1]</code></p>
				<p><strong><a href="http://webdevstudios.com/support/wordpress-plugins/nextgen-public-uploader/"><?php 
        _e('Visit The Plugin Homepage', 'ngg-public-uploader');
        ?>
</a></strong></p>
				<p><strong><a href="http://webdevstudios.com/support/forum/nextgen-public-uploader/"><?php 
        _e('Visit The Support Forum', 'ngg-public-uploader');
        ?>
</a></strong></p>
				<p><strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056"><?php 
        _e('Donate To This Plugin', 'ngg-public-uploader');
        ?>
</a></strong></p>
				
				<form method="post">
        			<input type="hidden" name="action" value="update" />
					<?php 
        wp_nonce_field('update-options');
        ?>
        			<input type="hidden" name="npu_update_options" value="1">
					<table class="form-table">
        				<?php 
        include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
        $nggdb = new nggdb();
        $gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
        ?>
						<tr valign="top">
							<th scope="row"><?php 
        _e('Default Gallery ID', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<select name="npu_default_gallery">
        							<option selected><?php 
        echo get_option('npu_default_gallery');
        ?>
</option>
        							<?php 
        foreach ($gallerylist as $gallery) {
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            ?>
        								<?php 
            if (get_option('npu_default_gallery') != $gallery->gid) {
                ?>
        									<option <?php 
                selected($gallery->gid, $gal_id);
                ?>
 value="<?php 
                echo $gallery->gid;
                ?>
"><?php 
                _e($gallery->gid, 'nggallery');
                ?>
</option>
        								<?php 
            }
            ?>
        							<?php 
        }
        ?>
        						</select>
        						<span class="description"><?php 
        _e('Select the default gallery ID when using', 'ngg-public-uploader');
        ?>
 [ngg_uploader].</span>
        					</td>
						</tr>
        
        				<tr valign="top">
							<th scope="row"><?php 
        _e('Widget Uploader', 'ngg-public-uploader');
        ?>
: </th>
							<td>
								<select name="npu_widget_uploader_select">
									<option selected><?php 
        echo get_option('npu_widget_uploader_select');
        ?>
</option>
        								<?php 
        if (get_option('npu_widget_uploader_select') != "Enabled") {
            ?>
<option value="Enabled">Enabled</option><?php 
        }
        ?>
										<?php 
        if (get_option('npu_widget_uploader_select') != "Disabled") {
            ?>
<option value="Disabled">Disabled</option><?php 
        }
        ?>
								</select>
        						<span class="description"><?php 
        _e('Enable or disable the widget uploader.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
        
        				<tr valign="top">
							<th scope="row"><?php 
        _e('Description Field', 'ngg-public-uploader');
        ?>
: </th>
							<td>
								<select name="npu_image_description_select">
									<option selected><?php 
        echo get_option('npu_image_description_select');
        ?>
</option>
	        						<?php 
        if (get_option('npu_image_description_select') != "Enabled") {
            ?>
<option value="Enabled"><?php 
            _e('Enabled', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_image_description_select') != "Disabled") {
            ?>
<option value="Disabled"><?php 
            _e('Disabled', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
								</select>
        						<span class="description"><?php 
        _e('Enable or disable upload description field.', 'ngg-public-uploader');
        ?>
</span>
	        				</td>
						</tr>
        
        				<?php 
        if (get_option('npu_user_role_select') == 99) {
            $npu_selected_user_role = "Visitor";
        } else {
            if (get_option('npu_user_role_select') == 0) {
                $npu_selected_user_role = "Subscriber";
            } else {
                if (get_option('npu_user_role_select') == 1) {
                    $npu_selected_user_role = "Contributer";
                } else {
                    if (get_option('npu_user_role_select') == 2) {
                        $npu_selected_user_role = "Author";
                    } else {
                        if (get_option('npu_user_role_select') == 7) {
                            $npu_selected_user_role = "Editor";
                        } else {
                            if (get_option('npu_user_role_select') == 10) {
                                $npu_selected_user_role = "Admin";
                            }
                        }
                    }
                }
            }
        }
        ?>
        
        				<tr valign="top">
							<th scope="row"><?php 
        _e('Minimum User Role', 'ngg-public-uploader');
        ?>
: </th>
							<td>
        						<select name="npu_user_role_select">
									<option selected value="<?php 
        echo get_option('npu_user_role_select');
        ?>
"><?php 
        echo $npu_selected_user_role;
        ?>
</option>
        							<?php 
        if (get_option('npu_user_role_select') != 99) {
            ?>
<option value="99"><?php 
            _e('Visitor', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_user_role_select') != 0) {
            ?>
<option value="0"><?php 
            _e('Subscriber', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_user_role_select') != 1) {
            ?>
<option value="1"><?php 
            _e('Contributer', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_user_role_select') != 2) {
            ?>
<option value="2"><?php 
            _e('Author', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_user_role_select') != 7) {
            ?>
<option value="7"><?php 
            _e('Editor', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_user_role_select') != 10) {
            ?>
<option value="10"><?php 
            _e('Admin', 'ngg-public-uploader');
            ?>
</option><?php 
        }
        ?>
								</select>
        						<span class="description"><?php 
        _e('Select the minimum required user role for image uploading.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
        
						<tr valign="top">
							<th scope="row"><?php 
        _e('Notification Email', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_notification_email" value="<?php 
        echo get_option('npu_notification_email');
        ?>
" />
        						<span class="description"><?php 
        _e('Enter an email address to be notified when a image has been submitted.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
		
						<tr valign="top">
							<th scope="row"><?php 
        _e('Upload Button', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_upload_button" value="<?php 
        echo get_option('npu_upload_button');
        ?>
" />
        						<span class="description"><?php 
        _e('Customize text for upload button.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
		
						<tr valign="top">
							<th scope="row"><?php 
        _e('Description Text', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_description_text" value="<?php 
        echo get_option('npu_description_text');
        ?>
" />
        						<span class="description"><?php 
        _e('Message displayed for image description.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>

						<tr valign="top">
							<th scope="row"><?php 
        _e('Not Authorized', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_notlogged" value="<?php 
        echo get_option('npu_notlogged');
        ?>
" />
        						<span class="description"><?php 
        _e('Message displayed when a user does not have permission to upload.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>

						<tr valign="top">
							<th scope="row"><?php 
        _e('Upload Success', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_upload_success" value="<?php 
        echo get_option('npu_upload_success');
        ?>
" />
        						<span class="description"><?php 
        _e('Message displayed when an image has been successfully uploaded.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>

						<tr valign="top">
							<th scope="row"><?php 
        _e('No File', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_no_file" value="<?php 
        echo get_option('npu_no_file');
        ?>
" />
        						<span class="description"><?php 
        _e('Message displayed when no file has been selected.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>

						<tr valign="top">
							<th scope="row"><?php 
        _e('Upload Failed', 'ngg-public-uploader');
        ?>
:</th>
							<td>
        						<input type="text" name="npu_upload_failed" value="<?php 
        echo get_option('npu_upload_failed');
        ?>
" />
        						<span class="description"><?php 
        _e('Message displayed when an upload has failed.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
        
        				<tr valign="top">
							<th scope="row"><?php 
        _e('Exclude Uploaded Images', 'ngg-public-uploader');
        ?>
: </th>
							<td>
								<select name="npu_exclude_select">
									<option selected><?php 
        echo get_option('npu_exclude_select');
        ?>
</option>
        							<?php 
        if (get_option('npu_exclude_select') != "Enabled") {
            ?>
<option value="Enabled">Enabled</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_exclude_select') != "Disabled") {
            ?>
<option value="Disabled">Disabled</option><?php 
        }
        ?>
								</select>
        						<span class="description"><?php 
        _e('Enable or disable images flagged as excluded.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
        
        				<tr valign="top">
							<th scope="row"><?php 
        _e('Link Love', 'ngg-public-uploader');
        ?>
: </th>
							<td>
								<select name="npu_image_linklove_select">
									<option selected><?php 
        echo get_option('npu_image_linklove_select');
        ?>
</option>
        							<?php 
        if (get_option('npu_image_linklove_select') != "Enabled") {
            ?>
<option value="Enabled">Enabled</option><?php 
        }
        ?>
									<?php 
        if (get_option('npu_image_linklove_select') != "Disabled") {
            ?>
<option value="Disabled">Disabled</option><?php 
        }
        ?>
								</select>
        						<span class="description"><?php 
        _e('If you love this plugin link to us in your footer.', 'ngg-public-uploader');
        ?>
</span>
        					</td>
						</tr>
	
					</table>

					<input type="hidden" name="action" value="update" />
					<input type="hidden" name="npu_page_options" value="npu_default_gallery, npu_email_option, npu_notification_email, npu_notlogged, npu_upload_success, npu_no_file, npu_upload_failed, npu_widget_uploader_select, npu_exclude_select, npu_user_role_select, npu_image_description_select, npu_image_linklove_select, npu_upload_button, npu_description_text" />

					<p class="submit"><input type="submit" name="Submit" value="<?php 
        _e('Save Changes');
        ?>
" /></p>
        
				</form>
        
				<form name="Restore" method="post">
					<?php 
        wp_nonce_field('restore-options');
        ?>
					<p><strong><?php 
        _e('Restore Default Settings', 'ngg-public-uploader');
        ?>
</strong></p>
					<div>
            			<input type="submit" class="button" name="Restore" value="<?php 
        _e('Reset Options');
        ?>
" onclick="javascript:check=confirm('<?php 
        _e('WARNING: This will restore all default settings.\\n\\nChoose [Cancel] to Stop, [OK] to proceed.\\n');
        ?>
');if(check==false) return false;" />
            		</div>
				</form>
        
		</div>

	<?php 
    }
Пример #2
0
    function form($instance)
    {
        // Set Defaults
        $instance = wp_parse_args((array) $instance, array('gal_id' => '0'));
        include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
        $nggdb = new nggdb();
        $gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
        ?>

		<p><label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'nextgen-public-uploader');
        ?>
</label>
		<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" /></p>

		<p>
		<label for="<?php 
        echo $this->get_field_id('gal_id');
        ?>
"><?php 
        _e('Upload to :', 'nextgen-public-uploader');
        ?>
</label>
		<select id="<?php 
        echo $this->get_field_id('gal_id');
        ?>
" name="<?php 
        echo $this->get_field_name('gal_id');
        ?>
">
			<option value="0" ><?php 
        _e('Choose gallery', 'nextgen-public-uploader');
        ?>
</option>
			<?php 
        foreach ($gallerylist as $gallery) {
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            echo '<option ' . selected($instance['gal_id'], $gallery->gid, false) . ' value="' . $gallery->gid . '">ID: ' . $gallery->gid . ' &ndash; ' . $name . '</option>';
        }
        ?>
		</select>
		</p>
	<?php 
    }
Пример #3
0
        public function npu_upload_control($widget_args = 1)
        {
            global $wp_registered_widgets, $wpdb;
            static $updated = false;
            if (is_numeric($widget_args)) {
                $widget_args = array('number' => $widget_args);
            }
            $widget_args = wp_parse_args($widget_args, array('number' => -1));
            extract($widget_args, EXTR_SKIP);
            $options = get_option('npu_gal_upload');
            if (!is_array($options)) {
                $options = array();
            }
            if (!$updated && !empty($_POST['sidebar'])) {
                $sidebar = (string) $_POST['sidebar'];
                $sidebar_widgets = wp_get_sidebars_widgets();
                if (isset($sidebar_widgets[$sidebar])) {
                    $this_sidebar =& $sidebar_widgets[$sidebar];
                } else {
                    $this_sidebar = array();
                }
                foreach ($this_sidebar as $_widget_id) {
                    if ('npu_gallery_upload' == $wp_registered_widgets[$_widget_id]['classname'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number'])) {
                        $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
                        if (!in_array("npu-gallery-upload-{$widget_number}", $_POST['widget-id'])) {
                            unset($options[$widget_number]);
                        }
                    }
                }
                foreach ((array) $_POST['widget_npu_upload'] as $widget_number => $widget_npu_upload) {
                    if (!isset($widget_npu_upload['gal_id']) && isset($options[$widget_number])) {
                        continue;
                    }
                    $widget_npu_upload = stripslashes_deep($widget_npu_upload);
                    $options[$widget_number]['title'] = $widget_npu_upload['title'];
                    $options[$widget_number]['gal_id'] = $widget_npu_upload['gal_id'];
                }
                update_option('npu_gal_upload', $options);
                $updated = true;
            }
            if (-1 == $number) {
                $title = 'Upload';
                $gal_id = 0;
                $number = '%i%';
            } else {
                extract((array) $options[$number]);
            }
            include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
            $nggdb = new nggdb();
            $gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
            ?>
            <p>
                <label for="npu_upload-title-<?php 
            echo $number;
            ?>
"><?php 
            _e('Title :', 'nggallery');
            ?>
                	<input id="npu_upload-title-<?php 
            echo $number;
            ?>
" name="widget_npu_upload[<?php 
            echo $number;
            ?>
][title]" type="text" class="widefat" value="<?php 
            echo $title;
            ?>
" />
                </label>
            </p>
            <p>
                <label for="npu_upload-id-<?php 
            echo $number;
            ?>
"><?php 
            _e('Upload to :', 'nggallery');
            ?>
                	<select id="npu_upload-id-<?php 
            echo $number;
            ?>
" name="widget_npu_upload[<?php 
            echo $number;
            ?>
][gal_id]" >
                    	<option value="0" ><?php 
            _e('Choose gallery', 'nggallery');
            ?>
</option>
                    	<?php 
            foreach ($gallerylist as $gallery) {
                $name = empty($gallery->title) ? $gallery->name : $gallery->title;
                ?>
                        	<option <?php 
                selected($gallery->gid, $gal_id);
                ?>
 value="<?php 
                echo $gallery->gid;
                ?>
"><?php 
                _e($gallery->gid . ' - ' . $name, 'nggallery');
                ?>
</option>
                        <?php 
            }
            ?>
                	</select>
                </label>
            </p>
            <input type="hidden" id="npu_upload-submit-<?php 
            echo $number;
            ?>
" name="widget_npu_upload[<?php 
            echo $number;
            ?>
][submit]" value="1" />
            <?php 
        }
Пример #4
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 
}
Пример #5
0
		<ul>
			<li id="rss_tab" class="current"><span><a href="javascript:mcTabs.displayTab('rss_tab','rss_panel');" onmousedown="return false;"><?php 
_e("Gallery", 'ngg-public-uploader');
?>
</a></span></li>
		</ul>
	</div>
	
	<div class="panel_wrapper">
		<div id="rss_panel" class="panel current">
		<br />
		<table border="0" cellpadding="4" cellspacing="0">
        <?php 
include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
		<tr>
			<td nowrap="nowrap"><label for="rsstag"><?php 
_e("Select Gallery:", 'ngg-public-uploader');
?>
</label></td>
			<td>
        	<select id="rsstag" name="rsstag">
        		<?php 
foreach ($gallerylist as $gallery) {
    $name = empty($gallery->title) ? $gallery->name : $gallery->title;
    $galleryid = $gallery->gid . ': ';
    ?>
        			<option value="<?php 
    echo $gallery->gid;
Пример #6
0
function nggallery_manage_gallery_main()
{
    global $wpdb, $ngg;
    ?>
	<div class="wrap">
		<h2><?php 
    _e('Gallery Overview', 'nggallery');
    ?>
</h2>
		<br style="clear: both;"/>
		<table class="widefat">
			<thead>
			<tr>
				<th scope="col" ><?php 
    _e('ID');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Title', 'nggallery');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Description', 'nggallery');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Author', 'nggallery');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Page ID', 'nggallery');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Quantity', 'nggallery');
    ?>
</th>
				<th scope="col" ><?php 
    _e('Action');
    ?>
</th>
			</tr>
			</thead>
			<tbody>
<?php 
    $gallerylist = nggdb::find_all_galleries('gid', 'asc', TRUE);
    if ($gallerylist) {
        foreach ($gallerylist as $gallery) {
            $class = $class == 'class="alternate"' ? '' : 'class="alternate"';
            $gid = $gallery->gid;
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            $author_user = get_userdata((int) $gallery->author);
            ?>
		<tr id="gallery-<?php 
            echo $gid;
            ?>
" <?php 
            echo $class;
            ?>
 >
			<th scope="row"><?php 
            echo $gid;
            ?>
</th>
			<td>
				<?php 
            if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                ?>
					<a href="<?php 
                echo wp_nonce_url($ngg->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gid, 'ngg_editgallery');
                ?>
" class='edit' title="<?php 
                _e('Edit');
                ?>
" >
						<?php 
                echo $name;
                ?>
					</a>
				<?php 
            } else {
                ?>
					<?php 
                echo $gallery->title;
                ?>
				<?php 
            }
            ?>
			</td>
			<td><?php 
            echo $gallery->galdesc;
            ?>
&nbsp;</td>
			<td><?php 
            echo $author_user->display_name;
            ?>
</td>
			<td><?php 
            echo $gallery->pageid;
            ?>
</td>
			<td><?php 
            echo $gallery->counter;
            ?>
</td>
			<td>
				<?php 
            if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                ?>
					<a href="<?php 
                echo wp_nonce_url($ngg->manage_page->base_page . "&amp;mode=delete&amp;gid=" . $gid, 'ngg_editgallery');
                ?>
" class="delete" onclick="javascript:check=confirm( '<?php 
                _e("Delete this gallery ?", 'nggallery');
                ?>
');if(check==false) return false;"><?php 
                _e('Delete');
                ?>
</a>
				<?php 
            }
            ?>
			</td>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
			
			</tbody>
		</table>
	</div>
<?php 
}
Пример #7
0
 function npu_plugin_settings()
 {
     // Register our settings section
     add_settings_section('npu_settings', __('Plugin Settings', 'nextgen-public-uploader'), 'npu_settings_description', 'nextgen-public-uploader');
     // Register all our settings
     register_setting('npu_settings', 'npu_default_gallery', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_user_role_select', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_image_description_select', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_exclude_select', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_notification_email', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_upload_button', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_no_file', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_description_text', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_notlogged', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_upload_success', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_upload_failed', 'npu_settings_sanitization');
     register_setting('npu_settings', 'npu_image_link_love', 'npu_settings_sanitization');
     // Setup the options for our gallery selector
     $gallery_options = array();
     include_once NGGALLERY_ABSPATH . 'lib/ngg-db.php';
     $nggdb = new nggdb();
     $gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
     foreach ($gallerylist as $gallery) {
         $name = !empty($gallery->title) ? $gallery->title : $gallery->name;
         $gallery_options[$gallery->gid] = 'ID: ' . $gallery->gid . ' &ndash; ' . $name;
     }
     // Setup the options for our role selector
     $role_options = array('99' => __('Visitor', 'nextgen-public-uploader'), '0' => __('Subscriber', 'nextgen-public-uploader'), '1' => __('Contributor', 'nextgen-public-uploader'), '2' => __('Author', 'nextgen-public-uploader'), '7' => __('Editor', 'nextgen-public-uploader'), '10' => __('Admin', 'nextgen-public-uploader'));
     // Add our settings fields
     add_settings_field('npu_default_gallery', __('Default Gallery:', 'nextgen-public-uploader'), 'npu_settings_select', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_default_gallery', 'description' => sprintf(__('The default gallery ID when using %s with no ID specified.', 'nextgen-public-uploader'), '<code>[ngg_uploader]</code>'), 'options' => $gallery_options));
     add_settings_field('npu_user_role_select', __('Minimum User Role:', 'nextgen-public-uploader'), 'npu_settings_select', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_user_role_select', 'description' => __('The minimum user role required for image uploading.', 'nextgen-public-uploader'), 'options' => $role_options));
     add_settings_field('npu_exclude_select', __('Uploads Require Approval:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_exclude_select', 'description' => '', 'value' => 'Enabled', 'label' => __('Exclude images from appearing in galleries until they have been approved.', 'nextgen-public-uploader')));
     add_settings_field('npu_image_description_select', __('Show Description Field:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_image_description_select', 'description' => '', 'value' => 'Enabled', 'label' => __('Enable the Image Description text field.', 'nextgen-public-uploader')));
     add_settings_field('npu_description_text', __('Image Description Label:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_description_text', 'description' => __('Default label shown for the image description textbox.', 'nextgen-public-uploader')));
     add_settings_field('npu_notification_email', __('Notification Email:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_notification_email', 'description' => __('The email address to be notified when a image has been submitted.', 'nextgen-public-uploader')));
     add_settings_field('npu_upload_button', __('Upload Button Text:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_button', 'description' => __('Custom text for upload button.', 'nextgen-public-uploader')));
     add_settings_field('npu_no_file', __('No File Selected Warning:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_no_file', 'description' => __('Warning displayed when no file has been selected for upload.', 'nextgen-public-uploader')));
     add_settings_field('npu_notlogged', __('Unauthorized Warning:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_notlogged', 'description' => __('Warning displayed when a user does not have permission to upload.', 'nextgen-public-uploader')));
     add_settings_field('npu_upload_success', __('Upload Success Message:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_success', 'description' => __('Message displayed when an image has been successfully uploaded.', 'nextgen-public-uploader')));
     add_settings_field('npu_upload_failed', __('Upload Failed Message:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_failed', 'description' => __('Message displayed when an image failed to upload.', 'nextgen-public-uploader')));
     add_settings_field('npu_image_link_love', __('Link Love:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_image_link_love', 'description' => '', 'value' => true, 'label' => __('Display link to this plugin in your site\'s footer (because you love us!)', 'nextgen-public-uploader')));
 }
Пример #8
0
function nggallery_picturelist()
{
    // *** show picture list
    global $wpdb, $user_ID, $ngg;
    // GET variables
    $act_gid = $ngg->manage_page->gid;
    $showTags = $ngg->manage_page->showTags;
    $hideThumbs = $ngg->manage_page->hideThumbs;
    // Load the gallery metadata
    $gallery = nggdb::find_gallery($act_gid);
    if (!$gallery) {
        nggGallery::show_error(__('Gallery not found.', 'nggallery'));
        return;
    }
    // get picture values
    $picturelist = nggdb::get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false);
    // get the current author
    $act_author_user = get_userdata((int) $gallery->author);
    // list all galleries
    $gallerylist = nggdb::find_all_galleries();
    ?>

<script type="text/javascript"> 
	function showDialog( windowId ) {
		var form = document.getElementById('updategallery');
		var elementlist = "";
		for (i = 0, n = form.elements.length; i < n; i++) {
			if(form.elements[i].type == "checkbox") {
				if(form.elements[i].name == "doaction[]")
					if(form.elements[i].checked == true)
						if (elementlist == "")
							elementlist = form.elements[i].value
						else
							elementlist += "," + form.elements[i].value ;
			}
		}
		jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
		jQuery("#" + windowId + "_imagelist").val(elementlist);
		// console.log (jQuery("#TB_imagelist").val());
		tb_show("", "#TB_inline?width=640&height=120&inlineId=" + windowId + "&modal=true", false);
	}
</script>
<script type="text/javascript">
<!--
function checkAll(form)
{
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]") {
				if(form.elements[i].checked == true)
					form.elements[i].checked = false;
				else
					form.elements[i].checked = true;
			}
		}
	}
}

function getNumChecked(form)
{
	var num = 0;
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					num++;
		}
	}
	return num;
}

// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {

	var numchecked = getNumChecked(document.getElementById('updategallery'));
	 
	if(numchecked < 1) { 
		alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
');
		return false; 
	} 
	//TODO: For copy to and move to we need some better way around
	if (jQuery('#bulkaction').val() == 'copy_to') {
		showDialog('selectgallery');
		return false;
	}
	
	if (jQuery('#bulkaction').val() == 'move_to') {
		showDialog('selectgallery');
		return false;
	}
		
	return confirm('<?php 
    echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
');
}

jQuery(document).ready( function() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

	if (typeof postboxes != "undefined")
		postboxes.add_postbox_toggles('ngg-manage-gallery'); // WP 2.7
	else
		add_postbox_toggles('ngg-manage-gallery'); 	// WP 2.6

});
//-->
</script>

<div class="wrap">

<h2><?php 
    echo __ngettext('Gallery', 'Galleries', 1, 'nggallery');
    ?>
 : <?php 
    echo $gallery->title;
    ?>
</h2>

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

<form id="updategallery" class="nggform" method="POST" action="<?php 
    echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid;
    ?>
" accept-charset="utf-8">
<?php 
    wp_nonce_field('ngg_updategallery');
    ?>

<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
<div id="poststuff">
	<?php 
    wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
    ?>
	<div id="gallerydiv" class="postbox <?php 
    echo postbox_classes('gallerydiv', 'ngg-manage-gallery');
    ?>
" >
		<h3><?php 
    _e('Gallery settings', 'nggallery');
    ?>
<small> (<?php 
    _e('Click here for more settings', 'nggallery');
    ?>
)</small></h3>
		<div class="inside">
			<table class="form-table" >
				<tr>
					<th align="left"><?php 
    _e('Title');
    ?>
:</th>
					<th align="left"><input type="text" size="50" name="title" value="<?php 
    echo $gallery->title;
    ?>
"  /></th>
					<th align="right"><?php 
    _e('Page Link to', 'nggallery');
    ?>
:</th>
					<th align="left">
					<select name="pageid" style="width:95%">
						<option value="0" ><?php 
    _e('Not linked', 'nggallery');
    ?>
</option>
						<?php 
    parent_dropdown($gallery->pageid);
    ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
    _e('Description');
    ?>
:</th> 
					<th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
    echo $gallery->galdesc;
    ?>
</textarea></th>
					<th align="right"><?php 
    _e('Preview image', 'nggallery');
    ?>
:</th>
					<th align="left">
						<select name="previewpic" style="width:95%" >
							<option value="0" ><?php 
    _e('No Picture', 'nggallery');
    ?>
</option>
							<?php 
    if (is_array($picturelist)) {
        foreach ($picturelist as $picture) {
            $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
            echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n";
        }
    }
    ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
    _e('Path', 'nggallery');
    ?>
:</th> 
					<th align="left"><input <?php 
    if (IS_WPMU) {
        echo 'readonly = "readonly"';
    }
    ?>
 type="text" size="50" name="path" value="<?php 
    echo $gallery->path;
    ?>
"  /></th>
					<th align="right"><?php 
    _e('Author', 'nggallery');
    ?>
:</th>
					<th align="left"> 
					<?php 
    $editable_ids = $ngg->manage_page->get_editable_user_ids($user_ID);
    if ($editable_ids && count($editable_ids) > 1) {
        wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author));
    } else {
        echo $act_author_user->display_name;
    }
    ?>
					</th>
				</tr>
				<tr>
					<th align="left">&nbsp;</th>
					<th align="left">&nbsp;</th>				
					<th align="right"><?php 
    _e('Create new page', 'nggallery');
    ?>
:</th>
					<th align="left"> 
					<select name="parent_id" style="width:95%">
						<option value="0"><?php 
    _e('Main page (No parent)', 'nggallery');
    ?>
</option>
						<?php 
    parent_dropdown();
    ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
    _e('Add page', 'nggallery');
    ?>
" id="group"/>
					</th>
				</tr>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
    _e("Scan Folder for new images", 'nggallery');
    ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->

<div class="tablenav ngg-tablenav">
	<div class="alignleft actions" style="float: left;">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("No action", 'nggallery');
    ?>
</option>
	<?php 
    if (!$showTags) {
        ?>
		<option value="set_watermark" ><?php 
        _e("Set watermark", 'nggallery');
        ?>
</option>
		<option value="new_thumbnail" ><?php 
        _e("Create new thumbnails", 'nggallery');
        ?>
</option>
		<option value="resize_images" ><?php 
        _e("Resize images", 'nggallery');
        ?>
</option>
		<option value="delete_images" ><?php 
        _e("Delete images", 'nggallery');
        ?>
</option>
		<option value="import_meta" ><?php 
        _e("Import metadata", 'nggallery');
        ?>
</option>
		<option value="copy_to" ><?php 
        _e("Copy to...", 'nggallery');
        ?>
</option>
		<option value="move_to"><?php 
        _e("Move to...", 'nggallery');
        ?>
</option>
	<?php 
    } else {
        ?>
	
		<option value="add_tags" ><?php 
        _e("Add tags", 'nggallery');
        ?>
</option>
		<option value="delete_tags" ><?php 
        _e("Delete tags", 'nggallery');
        ?>
</option>
		<option value="overwrite_tags" ><?php 
        _e("Overwrite tags", 'nggallery');
        ?>
</option>
	<?php 
    }
    ?>
	
	</select>
	
	<?php 
    if (!$showTags) {
        ?>
 
		<input class="button-secondary" type="submit" name="doaction" value="<?php 
        _e("OK", 'nggallery');
        ?>
" onclick="if ( !checkSelected() ) return false;" />
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
        _e("OK", 'nggallery');
        ?>
" onclick="showDialog('tags'); return false;" />
	<?php 
    }
    ?>
	
	<?php 
    if (!$hideThumbs) {
        ?>
 
		<input class="button-secondary" type="submit" name="togglethumbs" value="<?php 
        _e("Hide thumbnails ", 'nggallery');
        ?>
" /> 
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="togglethumbs" value="<?php 
        _e("Show thumbnails ", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>
	
	<?php 
    if (!$showTags) {
        ?>
		<input class="button-secondary" type="submit" name="toggletags" value="<?php 
        _e("Show tags", 'nggallery');
        ?>
" /> 
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="toggletags" value="<?php 
        _e("Hide tags", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>
	
	<?php 
    if ($ngg->options['galSort'] == "sortorder") {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e("Sort gallery", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>

	</div>
	<span style="float:right; padding:2px 8px 0 0;"><input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" /></span>
</div>

<table id="ngg-listimages" class="widefat" >
	<thead>
	<tr>
		<?php 
    $gallery_columns = ngg_manage_gallery_columns();
    ?>
		<?php 
    foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
        switch ($gallery_column_key) {
            case 'cb':
                $class = ' class="check-column;"';
                break;
            case 'tags':
                $class = ' style="width:70%;"';
                break;
            case 'action':
                $class = ' colspan="3" style="text-align: center;"';
                break;
            default:
                $class = ' style="text-align: center;"';
        }
        ?>
			<th scope="col"<?php 
        echo $class;
        ?>
><?php 
        echo $column_display_name;
        ?>
</th>
		<?php 
    }
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
		<?php 
    foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
        switch ($gallery_column_key) {
            case 'cb':
                $class = ' class="check-column;"';
                break;
            case 'tags':
                $class = ' style="width:70%;"';
                break;
            case 'action':
                $class = ' colspan="3" style="text-align: center;"';
                break;
            default:
                $class = ' style="text-align: center;"';
        }
        ?>
			<th scope="col"<?php 
        echo $class;
        ?>
><?php 
        echo $column_display_name;
        ?>
</th>
		<?php 
    }
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    if ($picturelist) {
        $thumbsize = "";
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        if ($ngg->options['thumbcrop']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbwidth'] . '"';
        }
        foreach ($picturelist as $picture) {
            $pid = (int) $picture->pid;
            $class = $class == 'class="alternate"' ? '' : 'class="alternate"';
            $exclude = $picture->exclude ? 'checked="checked"' : '';
            $date = mysql2date(get_option('date_format'), $picture->imagedate);
            $time = mysql2date(get_option('time_format'), $picture->imagedate);
            ?>
		<tr id="picture-<?php 
            echo $pid;
            ?>
" <?php 
            echo $class;
            ?>
 style="text-align:center">
			<?php 
            foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
 
						<td class="check-column" scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></td>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td class="id column-id" scope="row" style="text-align: center"><?php 
                        echo $pid;
                        ?>
</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td class="media-icon" style="text-align: left;">
							<a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo $picture->filename;
                        ?>
							</a>
							<br /><?php 
                        echo $date;
                        ?>
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        ?>
						<td class="thumbnail column-thumbnail"><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        ?>
" <?php 
                        echo $thumbsize;
                        ?>
 />
							</a>
							<br /><?php 
                        echo $date;
                        ?>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td class="altdesc column-altdesc" style="width:500px">
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo stripslashes($picture->alttext);
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo stripslashes($picture->description);
                        ?>
</textarea>
						</td>
						<?php 
                        break;
                    case 'description':
                        ?>
						<td class="description column-description"><textarea name="description[<?php 
                        echo $pid;
                        ?>
]" class="textarea1" cols="42" rows="2" ><?php 
                        echo stripslashes($picture->description);
                        ?>
</textarea></td>
						<?php 
                        break;
                    case 'alt_title_text':
                        ?>
						<td class="alttext column-alttext"><input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" size="30" value="<?php 
                        echo stripslashes($picture->alttext);
                        ?>
" /></td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td class="exclude column-exclude"><input name="exclude[<?php 
                        echo $pid;
                        ?>
]" type="checkbox" value="1" <?php 
                        echo $exclude;
                        ?>
 /></td>
						<?php 
                        break;
                    case 'tags':
                        $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names');
                        if (is_array($picture->tags)) {
                            $picture->tags = implode(', ', $picture->tags);
                        }
                        ?>
						<td class="tags column-tags" style="width:500px;"><textarea name="tags[<?php 
                        echo $pid;
                        ?>
]" style="width:95%;" rows="2"><?php 
                        echo $picture->tags;
                        ?>
</textarea></td>
						<?php 
                        break;
                    case 'action':
                        ?>
						<td><a href="<?php 
                        echo NGGALLERY_URLPATH . "admin/showmeta.php?id=" . $pid;
                        ?>
" class="thickbox" title="<?php 
                        _e("Show Meta data", 'nggallery');
                        ?>
" ><?php 
                        _e('Meta');
                        ?>
</a></td>
						<td><a href="<?php 
                        echo wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture');
                        ?>
" class="delete" onclick="javascript:check=confirm( '<?php 
                        _e("Delete this file ?", 'nggallery');
                        ?>
');if(check==false) return false;" ><?php 
                        _e('Delete');
                        ?>
</a></td>
						<?php 
                        break;
                    default:
                        ?>
						<td><?php 
                        do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="8" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" /></p>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="tags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    ?>
		<?php 
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
		<input type="hidden" id="tags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="tags_bulkaction" name="TB_bulkaction" value="" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th><?php 
    _e("Enter the tags", 'nggallery');
    ?>
 : <input name="taglist" type="text" style="width:90%" value="" /></th>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input class="button-primary" type="submit" name="TB_EditTags" value="<?php 
    _e("OK", 'nggallery');
    ?>
" onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
'); tb_remove(); return false } return confirm('<?php 
    echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
')" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#entertags -->

	<!-- #selectgallery -->
	<div id="selectgallery" style="display: none;" >
		<form id="form-select-gallery" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    ?>
		<?php 
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e("Select the destination gallery:", 'nggallery');
    ?>
&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 stripslashes($gallery->title);
            ?>
</option>
						<?php 
        }
    }
    ?>
		    		</select>
		    	</th>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php 
    _e("OK", 'nggallery');
    ?>
" onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
'); tb_remove(); return false } return confirm('<?php 
    echo sprintf(js_escape(__("You are about to copy or move %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
')" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->
	<?php 
}
Пример #9
0
$rss = '';
if ($mode == 'last_pictures') {
    // Get additional parameters
    $page = (int) $_GET["page"];
    if (!isset($page) || $page == '') {
        $page = 0;
    }
    $show = (int) $_GET["show"];
    if (!isset($show) || $show == '' || $show == 0) {
        $show = 10;
    }
    $rss = nggMediaRss::get_last_pictures_mrss($page, $show);
} else {
    if ($mode == 'gallery') {
        // Get all galleries
        $galleries = nggdb::find_all_galleries();
        if (count($galleries) == 0) {
            header('content-type:text/plain;charset=utf-8');
            echo sprintf(__("No galleries have been yet created.", "nggallery"), $gid);
            exit;
        }
        // Get additional parameters
        $gid = (int) $_GET['gid'];
        //if no gid is present, take the first gallery
        if (!isset($gid) || $gid == '' || $gid == 0) {
            $first = current($galleries);
            $gid = $first->gid;
        }
        // Set the main gallery object
        $gallery = $galleries[$gid];
        if (!isset($gallery) || $gallery == null) {