Ejemplo n.º 1
0
 /**
  * flagGallery::get_thumbnail_folder()
  * 
  * @param mixed $gallerypath
  * @param bool $include_Abspath
  * @return string $foldername
  */
 static function create_thumbnail_folder($gallerypath, $include_Abspath = TRUE)
 {
     if (!$include_Abspath) {
         $gallerypath = WINABSPATH . $gallerypath;
     }
     if (!file_exists($gallerypath)) {
         return FALSE;
     }
     if (is_dir($gallerypath . '/thumbs/')) {
         return '/thumbs/';
     }
     if (is_admin()) {
         if (!is_dir($gallerypath . '/thumbs/')) {
             if (!wp_mkdir_p($gallerypath . '/thumbs/')) {
                 if (SAFE_MODE) {
                     flagAdmin::check_safemode($gallerypath . '/thumbs/');
                 } else {
                     flagGallery::show_error(__('Unable to create directory ', 'flag') . $gallerypath . '/thumbs !');
                 }
                 return FALSE;
             }
             return '/thumbs/';
         }
     }
     return FALSE;
 }
Ejemplo n.º 2
0
 function post_processor_images()
 {
     global $wpdb, $flag, $flagdb;
     do_action('flag_manage_post_processor_images');
     // bulk update in a single gallery
     if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) {
         check_admin_referer('flag_updategallery');
         switch ($_POST['bulkaction']) {
             case 'no_action':
                 break;
             case 'delete_images':
                 if (is_array($_POST['doaction'])) {
                     $delete_pic = false;
                     foreach ($_POST['doaction'] as $imageID) {
                         $image = $flagdb->find_image($imageID);
                         if ($image) {
                             if ($flag->options['deleteImg']) {
                                 @unlink($image->imagePath);
                                 @unlink($image->webimagePath);
                                 @unlink($image->thumbPath);
                             }
                             $delete_pic = flagdb::delete_image($image->pid);
                         }
                     }
                     if ($delete_pic) {
                         flagGallery::show_message(__('Pictures deleted successfully ', 'flash-album-gallery'));
                     }
                 }
                 break;
             case 'import_meta':
                 flagAdmin::do_ajax_operation('import_metadata', $_POST['doaction'], __('Import metadata', 'flash-album-gallery'));
                 break;
             case 'copy_meta':
                 flagAdmin::do_ajax_operation('copy_metadata', $_POST['doaction'], __('Copy metadata to image Description', 'flash-album-gallery'));
                 break;
             case 'webview_images':
                 flagAdmin::do_ajax_operation('webview_image', $_POST['doaction'], __('Creating images optimized for web', 'flash-album-gallery'));
                 break;
             case 'reset_counters':
                 if (is_array($_POST['doaction'])) {
                     $images = $flagdb->find_images_in_list($_POST['doaction']);
                     foreach ($images as $image) {
                         $img_id = $image->pid;
                         $wpdb->query("UPDATE {$wpdb->flagpictures} SET hitcounter = '0', total_votes = '0' WHERE pid = {$img_id}");
                     }
                 }
                 break;
         }
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) {
         check_admin_referer('flag_thickbox_form');
         //save the new values for the next operation
         $flag->options['imgWidth'] = (int) $_POST['imgWidth'];
         $flag->options['imgHeight'] = (int) $_POST['imgHeight'];
         update_option('flag_options', $flag->options);
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         flagAdmin::do_ajax_operation('resize_image', $pic_ids, __('Resize images', 'flash-album-gallery'));
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) {
         check_admin_referer('flag_thickbox_form');
         //save the new values for the next operation
         $flag->options['thumbWidth'] = (int) $_POST['thumbWidth'];
         $flag->options['thumbHeight'] = (int) $_POST['thumbHeight'];
         $flag->options['thumbFix'] = (bool) $_POST['thumbFix'];
         update_option('flag_options', $flag->options);
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         flagAdmin::do_ajax_operation('create_thumbnail', $pic_ids, __('Create new thumbnails', 'flash-album-gallery'));
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_SelectGallery'])) {
         check_admin_referer('flag_thickbox_form');
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         $pic_ids = array_filter($pic_ids, 'intval');
         $dest_gid = (int) $_POST['dest_gid'];
         switch ($_POST['TB_bulkaction']) {
             case 'copy_to':
                 // Copy images
                 flagAdmin::copy_images($pic_ids, $dest_gid);
                 break;
             case 'move_to':
                 // Move images
                 flagAdmin::move_images($pic_ids, $dest_gid);
                 break;
         }
     }
     if (isset($_POST['updatepictures'])) {
         // Update pictures
         check_admin_referer('flag_updategallery');
         $gallery_title = esc_html($_POST['title']);
         $gallery_path = esc_attr(str_replace('..', '', $_POST['path']));
         $gallery_desc = esc_html($_POST['gallerydesc']);
         $gallery_preview = (int) $_POST['previewpic'];
         $wpdb->query("UPDATE {$wpdb->flaggallery} SET title= '{$gallery_title}', path= '{$gallery_path}', galdesc = '{$gallery_desc}', previewpic = '{$gallery_preview}' WHERE gid = '{$this->gid}'");
         if (isset($_POST['author'])) {
             $gallery_author = (int) $_POST['author'];
             $wpdb->query("UPDATE {$wpdb->flaggallery} SET author = '{$gallery_author}' WHERE gid = '{$this->gid}'");
         }
         $this->update_pictures();
         //hook for other plugin to update the fields
         do_action('flag_update_gallery', $this->gid, $_POST);
         flagGallery::show_message(__('Update successful', "flash-album-gallery"));
     }
     if (isset($_POST['scanfolder'])) {
         // Rescan folder
         check_admin_referer('flag_updategallery');
         $gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->flaggallery} WHERE gid = '{$this->gid}' ");
         flagAdmin::import_gallery($gallerypath);
     }
 }
Ejemplo n.º 3
0
function flag_banner_crunch()
{
    global $wpdb;
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct FlAG capability
    if (!current_user_can('FlAG Manage gallery')) {
        die('-1');
    }
    if (isset($_POST['path'])) {
        include_once dirname(__FILE__) . '/functions.php';
        $id = flagAdmin::handle_import_file($_POST['path']);
        $file = basename($_POST['path']);
        if (is_wp_error($id)) {
            echo '<p class="error">' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flag'), $file, $id->get_error_message()) . '</p>';
        } else {
            echo '<p class="success">' . sprintf(__('<em>%s</em> has been added to Media library', 'flag'), $file) . '</p>';
        }
    }
    exit;
}
Ejemplo n.º 4
0
function flag_picturelist()
{
    // *** show picture list
    global $wpdb, $flagdb, $user_ID, $flag;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $flag->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 = $flag->manage_page->gid;
        // Load the gallery metadata
        $gallery = $flagdb->find_gallery($act_gid);
        if (!$gallery) {
            flagGallery::show_error(__('Gallery not found.', 'flash-album-gallery'));
            return;
        }
        // Check if you have the correct capability
        if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
            flagGallery::show_error(__('Sorry, you have no access here', 'flash-album-gallery'));
            return;
        }
        // look for pagination
        if (!isset($_GET['paged']) || intval($_GET['paged']) < 1) {
            $_GET['paged'] = 1;
        }
        $_GET['paged'] = intval($_GET['paged']);
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $flagdb->get_gallery($act_gid, $flag->options['galSort'], $flag->options['galSortDir'], false, 50, $start);
        // build pagination
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $flagdb->find_all_galleries();
    //get the columns
    $gallery_columns = flag_manage_gallery_columns();
    $hidden_columns = get_hidden_columns('flag-manage-images');
    $hidden_columns = array_filter($hidden_columns);
    if ($picturelist) {
        $a_hits = array();
        foreach ($picturelist as $p) {
            $a_hits[] = $p->hitcounter;
        }
        if (!array_sum($a_hits)) {
            $hidden_columns[] = 'views_likes';
            $hidden_columns[] = 'rating';
        }
    } else {
        $hidden_columns[] = 'views_likes';
        $hidden_columns[] = 'rating';
    }
    $num_columns = count($gallery_columns) - count($hidden_columns);
    ?>
<!--[if lt IE 8]>
	<style type="text/css">
		.custom_thumb {
			display : none;
		}
	</style>
<![endif]-->

<script type="text/javascript"> 
//<![CDATA[
function showDialog( windowId, height ) {
	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=" + height + "&inlineId=" + windowId + "&modal=true", 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(numchecked < 1) { 
		alert('<?php 
    echo esc_js(__("No images selected", "flash-album-gallery"));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "copy_to":
		case "move_to":
			showDialog('selectgallery', 120);
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', 120);
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', 160);
			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.", 'flash-album-gallery')), "' + numchecked + '");
    ?>
');
}

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

});
//]]>
</script>

<div class="flag-wrap">

<?php 
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'flash-album-gallery'), esc_html(stripslashes(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', 'flash-album-gallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="flag-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'flash-album-gallery');
        ?>
" class="button" />
</p>
</form>

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

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

<?php 
    } else {
        ?>

<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'flash-album-gallery');
        ?>
 : <?php 
        echo esc_html($gallery->title);
        ?>
</h2>
<select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value">
	<option selected="selected"><?php 
        _e('Choose another gallery', 'flash-album-gallery');
        ?>
</option>
<?php 
        foreach ($gallerylist as $gal) {
            if ($gal->gid != $act_gid) {
                ?>
	<option value="<?php 
                echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gal->gid, 'flag_editgallery');
                ?>
" ><?php 
                if ($flag->options['albSort'] == 'gid') {
                    echo $gal->gid . ' - ';
                }
                echo esc_html(stripslashes($gal->title));
                if ($flag->options['albSort'] == 'title') {
                    echo ' (' . $gal->gid . ')';
                }
                ?>
</option>
<?php 
            }
        }
        ?>
</select>

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

<div id="poststuff" class="metabox-holder">
	<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
<div id="post-body"><div id="post-body-content"><div id="normal-sortables" class="meta-box-sortables ui-sortable" style="position: relative;">
	<div id="flagalleryset" class="postbox <?php 
        echo postbox_classes('flagalleryset', 'flag-manage-gallery');
        ?>
" >
		<div class="handlediv" title="Click to toggle"><br/></div>
		<h3 class="hndle"><span><?php 
        _e('Gallery settings', 'flash-album-gallery');
        ?>
</span></h3>
		<div class="inside">
			<table class="flag-form-table" >
				<tr>
					<th align="right" scope="row"><?php 
        _e('Title', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input type="text" size="50" name="title" value="<?php 
        echo esc_html($gallery->title);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" valign="top" scope="row"><?php 
        _e('Description', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
        echo esc_html($gallery->galdesc);
        ?>
</textarea></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Path', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input <?php 
        if (IS_WPMU) {
            echo 'readonly = "readonly"';
        }
        ?>
 type="text" size="50" name="path" value="<?php 
        echo esc_attr($gallery->path);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Author', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left">
					<?php 
        $editable_ids = $flag->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;
        }
        ?>
						<input type="hidden" name="previewpic" value="<?php 
        if (is_array($picturelist)) {
            echo $picturelist[0]->pid;
        }
        ?>
" />
					</td>
				</tr>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
        _e("Scan Folder for new images", 'flash-album-gallery');
        ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
        _e("Save Changes", 'flash-album-gallery');
        ?>
" />
			</div>
			<div class="clear"></div>
		</div>
	</div>
</div></div></div>
</div> <!-- poststuff -->
<?php 
    }
    ?>

<div class="tablenav flag-tablenav">
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $flagdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $flagdb->paged['objects_per_page'], $flagdb->paged['total_objects'])), number_format_i18n($flagdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
	<?php 
    }
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction" class="alignleft">
		<option value="no_action" ><?php 
    _e("No action", 'flash-album-gallery');
    ?>
</option>
		<option value="webview_images" ><?php 
    _e("Create images optimized for web", 'flash-album-gallery');
    ?>
</option>
		<option value="new_thumbnail" ><?php 
    _e("Create new thumbnails", 'flash-album-gallery');
    ?>
</option>
		<option value="resize_images" ><?php 
    _e("Resize images", 'flash-album-gallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'flash-album-gallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_meta" ><?php 
    _e("Metadata to description", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'flash-album-gallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'flash-album-gallery');
    ?>
</option>
		<option value="reset_counters"><?php 
    _e("Reset Views & Likes counters", 'flash-album-gallery');
    ?>
</option>
		<?php 
    do_action('flag_manage_images_bulkaction');
    ?>
	</select>
	<input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php 
    _e("OK", 'flash-album-gallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />
	
<?php 
    if ($flag->options['galSort'] == "sortorder" && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=sort&amp;gid=" . $act_gid, 'flag_sortgallery');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Sort gallery", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    if (current_user_can('FlAG Upload images') && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;gid=" . $act_gid . "&amp;tabs=1", 'flag_addimages');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Add Images", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    ?>
	<input type="submit" name="updatepictures" class="button-primary action alignleft"  value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" />
	</div>
</div>

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

	<thead>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        if ($key == 'cb') {
            $value = '';
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $counter = 0;
    if ($picturelist) {
        $rt = array(24.5, 45.7, 54.8, 59.3, 64.7, 68.90000000000001, 71.5, 73.7, 75.90000000000001, 77.09999999999999);
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!flagAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $hits = intval($picture->hitcounter);
            $votes = intval($picture->total_votes);
            $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 ($gallery_columns as $gallery_column_key => $column_display_name) {
                $class = "class=\"{$gallery_column_key} column-{$gallery_column_key}\"";
                $style = '';
                if (in_array($gallery_column_key, $hidden_columns)) {
                    continue;
                }
                $attributes = "{$class}{$style}";
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
 
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        ?>
" id="thumb-<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo $picture->filename;
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data['width'])) {
                            echo '<br />' . __('Image size: ', 'flash-album-gallery') . $picture->meta_data['width'] . 'x' . $picture->meta_data['height'];
                        } else {
                            $imgpath = WINABSPATH . $picture->path . "/" . $picture->filename;
                            $img = @getimagesize($imgpath);
                            if ($img) {
                                echo '<br />' . __('Image size: ', 'flash-album-gallery') . $img[0] . 'x' . $img[1];
                            }
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['thumbnail'])) {
                            echo '<br />' . __('Thumbnail size: ', 'flash-album-gallery') . $picture->meta_data['thumbnail']['width'] . 'x' . $picture->meta_data['thumbnail']['height'];
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['webview'])) {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . $picture->meta_data['webview'][0] . 'x' . $picture->meta_data['webview'][1];
                        } else {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . __('not optimized ', 'flash-album-gallery');
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flash-album-gallery') . '</a>';
                        $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'flash-album-gallery') . '">' . __('Meta', 'flash-album-gallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'flash-album-gallery') . '">' . __('Edit thumb', 'flash-album-gallery') . '</a>';
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'flag_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s"', 'flash-album-gallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete', 'flash-album-gallery') . '</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 'views_likes':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="hitcounter[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->hitcounter);
                        ?>
" /> /
							<input name="total_votes[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->total_votes);
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'rating':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<?php 
                        if ($votes == 0) {
                            $like = '0.0';
                        } else {
                            if ($votes < 11) {
                                $like = $rt[$votes - 1];
                            } else {
                                $like = round((100 - $rt[count($rt) - 1]) / ($hits > 0 ? $hits : 1) * ($votes <= $hits ? $votes : $hits), 1) + $rt[count($rt) - 1];
                            }
                        }
                        echo $like . '%';
                        ?>
						</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_html(stripslashes($picture->alttext));
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo esc_html(stripslashes($picture->description));
                        ?>
</textarea>
							<input name="link[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_attr(stripslashes($picture->link));
                        ?>
" placeholder="(optional for skin) URL for linked button" /><br/>
						</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 'views' :
                        						?>
                        						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                        						<?php						
                        					break;
                        */
                    /* 
                    case 'views' :
                    						?>
                    						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                    						<?php						
                    					break;
                    */
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('flag_manage_gallery_custom_column', $gallery_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', 'flash-album-gallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" /></p>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #selectgallery -->
	<div id="selectgallery" style="display: none;" >
		<form id="form-select-gallery" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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:', 'flash-album-gallery');
    ?>
&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_html($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", 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="<?php 
    _e("Cancel", 'flash-album-gallery');
    ?>
" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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', 'flash-album-gallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $flag->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $flag->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). Grand Flagallery will keep ratio size', 'flash-album-gallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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)', 'flash-album-gallery');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbWidth" value="<?php 
    echo $flag->options['thumbWidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbHeight" value="<?php 
    echo $flag->options['thumbHeight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'flash-album-gallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbFix" value="1" <?php 
    checked('1', $flag->options['thumbFix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('flag-manage-images');});	
	/* ]]> */
	</script>
	<?php 
}
Ejemplo n.º 5
0
     @(require_once dirname(dirname(__FILE__)) . '/admin/functions.php');
     $defaultpath = $flag_options['galleryPath'];
     if (isset($args['id'])) {
         $gid = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->flaggallery} WHERE gid = %d", $args['id']));
         if ($gid) {
             $gallerytitle = $args['title'];
             $description = $args['description'];
             $status = intval($args['status']);
             $wpdb->query($wpdb->prepare("UPDATE {$wpdb->flaggallery} SET title = %s, galdesc = %s, status = %d WHERE gid = %d", $gallerytitle, $description, $status, $gid));
         } else {
             if (!flagAdmin::create_gallery($args, $defaultpath, $output = false)) {
                 die('{"status":"gallery_error"}');
             }
         }
     } else {
         if (!flagAdmin::create_gallery($args, $defaultpath, $output = false)) {
             die('{"status":"gallery_error"}');
         }
     }
 }
 $gallerylist = $wpdb->get_results("SELECT * FROM {$wpdb->flaggallery} ORDER BY gid DESC", ARRAY_A);
 if (count($gallerylist)) {
     foreach ($gallerylist as $gallery) {
         $gid = (int) $gallery['gid'];
         $gallery['title'] = htmlspecialchars_decode($gallery['title'], ENT_QUOTES);
         $gallery['galdesc'] = htmlspecialchars_decode($gallery['galdesc'], ENT_QUOTES);
         $wp_site_url = explode('//', site_url(), 2);
         $wp_site_url = explode('/', $wp_site_url[1], 2);
         $wp_folder = isset($wp_site_url[1]) && !empty($wp_site_url[1]) ? trailingslashit($wp_site_url[1]) : '';
         $gallery['path'] = $wp_folder . $gallery['path'];
         $preview = $wpdb->get_var("SELECT filename FROM {$wpdb->flagpictures} WHERE galleryid = '{$gid}' ORDER BY pid DESC");
Ejemplo n.º 6
0
function flag_banner_controler()
{
    $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'main';
    if (isset($_POST['importfolder']) && $_POST['importfolder']) {
        check_admin_referer('flag_addbanner');
        $bannerfolder = $_POST['bannerfolder'];
        if (!empty($bannerfolder) and false === strpos($bannerfolder, '..')) {
            $crunch_list = flagAdmin::import_banner($bannerfolder);
            $mode = 'import';
        }
    }
    $action = isset($_REQUEST['bulkaction']) ? $_REQUEST['bulkaction'] : false;
    if ($action == 'no_action') {
        $action = false;
    }
    switch ($mode) {
        case 'sort':
            check_admin_referer('flag_sort');
            include_once dirname(__FILE__) . '/banner-sort.php';
            flag_b_playlist_order();
            break;
        case 'edit':
            $file = sanitize_flagname($_GET['playlist']);
            if (isset($_POST['updatePlaylist'])) {
                check_admin_referer('flag_update');
                $title = esc_html($_POST['playlist_title']);
                $descr = esc_html($_POST['playlist_descr']);
                $data = array();
                foreach ($_POST['item_a'] as $item_id => $item) {
                    if ($action == 'delete_items' && in_array($item_id, $_POST['doaction'])) {
                        continue;
                    }
                    $data[] = $item_id;
                }
                flagGallery::flagSaveWpMedia();
                flagSave_bPlaylist($title, $descr, $data, $file);
            }
            if (isset($_POST['updatePlaylistSkin'])) {
                check_admin_referer('flag_update');
                flagSave_bPlaylistSkin($file);
            }
            include_once dirname(__FILE__) . '/manage-banner.php';
            flag_b_playlist_edit($file);
            break;
        case 'save':
            if (isset($_POST['items_array'])) {
                check_admin_referer('flag_update');
                $title = esc_html($_POST['playlist_title']);
                $descr = esc_html($_POST['playlist_descr']);
                $data = $_POST['items_array'];
                $file = isset($_REQUEST['playlist']) ? sanitize_flagname($_REQUEST['playlist']) : false;
                flagGallery::flagSaveWpMedia();
                flagSave_bPlaylist($title, $descr, $data, $file);
            }
            if (isset($_GET['playlist'])) {
                include_once dirname(__FILE__) . '/manage-banner.php';
                flag_b_playlist_edit();
            } else {
                flag_created_b_playlists();
                flag_banner_wp_media_lib();
            }
            break;
        case 'add':
            check_admin_referer('flag_add');
            if (isset($_POST['items']) && isset($_GET['playlist'])) {
                $added = $_POST['items'];
            } elseif (isset($_GET['playlist'])) {
                $added = $_COOKIE['bannerboxplaylist_' . sanitize_flagname($_GET['playlist'])];
            } else {
                $added = false;
            }
            flag_banner_wp_media_lib($added);
            break;
        case 'delete':
            check_admin_referer('flag_delete');
            flag_b_playlist_delete(sanitize_flagname($_GET['playlist']));
        case 'import':
            flag_crunch($crunch_list);
        case 'main':
            if (isset($_POST['updateMedia'])) {
                check_admin_referer('flag_update');
                flagGallery::flagSaveWpMedia();
                flagGallery::show_message(__('Media updated', 'flag'));
            }
        default:
            flag_created_b_playlists();
            flag_banner_wp_media_lib();
            break;
    }
}
Ejemplo n.º 7
0
 /**
  * Copy images to another gallery
  * 
  * @class flagAdmin
  * @param array|int $pic_ids ID's of the images
  * @param int $dest_gid destination gallery
  * @return void
  */
 static function copy_images($pic_ids, $dest_gid)
 {
     $errors = $messages = '';
     if (!is_array($pic_ids)) {
         $pic_ids = array($pic_ids);
     }
     // Get destination gallery
     $destination = flagdb::find_gallery($dest_gid);
     if ($destination == null) {
         flagGallery::show_error(__('The destination gallery does not exist', 'flag'));
         return;
     }
     // Check for folder permission
     if (!is_writeable(WINABSPATH . $destination->path)) {
         $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flag'), WINABSPATH . $destination->path);
         flagGallery::show_error($message);
         return;
     }
     // Get pictures
     $images = flagdb::find_images_in_list($pic_ids);
     $destination_path = WINABSPATH . $destination->path;
     foreach ($images as $image) {
         // WPMU action
         if (flagAdmin::check_quota()) {
             return;
         }
         $i = 0;
         $tmp_prefix = '';
         $destination_file_name = $image->filename;
         while (file_exists($destination_path . '/' . $destination_file_name)) {
             $tmp_prefix = 'copy_' . $i++ . '_';
             $destination_file_name = $tmp_prefix . $image->filename;
         }
         $destination_file_path = $destination_path . '/' . $destination_file_name;
         $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;
         // Copy files
         if (!@copy($image->imagePath, $destination_file_path)) {
             $errors .= sprintf(__('Failed to copy image %1$s to %2$s', 'flag'), $image->filename, $destination_file_path) . '<br />';
             continue;
         }
         // Copy the thumbnail if possible
         @copy($image->thumbPath, $destination_thumb_file_path);
         // Create new database entry for the image
         $new_pid = flagdb::insert_image($destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
         if (!isset($new_pid)) {
             $errors .= sprintf(__('Failed to copy database row for picture %s', 'flag'), $image->pid) . '<br />';
             continue;
         }
         if ($tmp_prefix != '') {
             $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) &raquo; The file already existed in the destination gallery.', 'flag'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
         } else {
             $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)', 'flag'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
         }
     }
     // Finish by showing errors or success
     if ($errors == '') {
         $link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>';
         $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .', 'flag'), count($images), $link);
     }
     if ($messages != '') {
         flagGallery::show_message($messages);
     }
     if ($errors != '') {
         flagGallery::show_error($errors);
     }
     return;
 }
Ejemplo n.º 8
0
    $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
} elseif (empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie'])) {
    $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
}
if (empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie'])) {
    $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
}
// don't ask me why, sometimes needed, taken from wp core
unset($current_user);
// admin.php require a proper login cookie
require_once ABSPATH . '/wp-admin/admin.php';
//header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
//check for correct capability
if (!is_user_logged_in()) {
    die('Login failure. -1');
}
//check for correct capability
if (!current_user_can('FlAG Upload images')) {
    die('You do not have permission to upload files. -2');
}
//check for correct nonce
check_admin_referer('flag_upload');
//check for flag
if (!defined('FLAG_ABSPATH')) {
    die('FlAGallery not available. -3');
}
include_once FLAG_ABSPATH . 'admin/functions.php';
// get the gallery
$galleryID = (int) $_POST['galleryselect'];
echo flagAdmin::swfupload_image($galleryID);
Ejemplo n.º 9
0
function flag_manage_gallery_main()
{
    global $flag, $flagdb, $wp_query;
    //Build the pagination for more than 25 galleries
    if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
        $_GET['paged'] = 1;
    }
    $sort_gall_by = isset($_GET['galsort']) ? $_GET['galsort'] : $flag->options['albSort'];
    $sort_gall_dir = isset($_GET['sortdir']) ? $_GET['sortdir'] : $flag->options['albSortDir'];
    $ascdesc = $sort_gall_dir == 'DESC' ? 'ASC' : 'DESC';
    $_GET['paged'] = intval($_GET['paged']);
    $perpage = intval($flag->options['albPerPage']) ? intval($flag->options['albPerPage']) : 50;
    $start = ($_GET['paged'] - 1) * $perpage;
    $gallerylist = $flagdb->find_all_galleries($sort_gall_by, $sort_gall_dir, $counter = true, $perpage, $start, $exclude = false, $draft = true);
    $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
    ?>
	<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('editgalleries'));
		 
		if(numchecked < 1) { 
			alert('<?php 
    echo esc_js(__('No images selected', 'flag'));
    ?>
');
			return false; 
		} 
		
		actionId = jQuery('#bulkaction').val();
		
		switch (actionId) {
			case "resize_images":
				showDialog('resize_images', 120);
				return false;
				break;
			case "new_thumbnail":
				showDialog('new_thumbnail', 160);
				return false;
				break;
		}
		
		return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.", 'flag')), "' + numchecked + '");
    ?>
');
	}

	function showDialog( windowId, height ) {
		var form = document.getElementById('editgalleries');
		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=" + height + "&inlineId=" + windowId + "&modal=true", false);
	}
	
	//-->
	</script>
	<div class="flag-wrap" style="margin-top:40px;">
		<h2><?php 
    _e('Gallery Overview', 'flag');
    ?>
</h2>
		<form class="search-form" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="media-search-input"><?php 
    _e('Search Images', 'flag');
    ?>
:</label>
			<input type="hidden" id="page-name" name="page" value="flag-manage-gallery" />
			<input type="text" id="media-search-input" name="s" value="<?php 
    the_search_query();
    ?>
" />
			<input type="submit" value="<?php 
    _e('Search Images', 'flag');
    ?>
" class="button" />
		</p>
		</form>
		<form id="editgalleries" class="flagform" method="POST" action="<?php 
    echo $flag->manage_page->base_page . '&amp;paged=' . $_GET['paged'];
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_bulkgallery');
    ?>
		<input type="hidden" name="page" value="manage-galleries" />
		
		<div class="tablenav">
			
			<div class="alignleft actions">
				<?php 
    if (function_exists('json_encode')) {
        ?>
				<select name="bulkaction" id="bulkaction">
					<option value="no_action" ><?php 
        _e("No action", 'flag');
        ?>
</option>
					<option value="webview_images" ><?php 
        _e("Create images optimized for web", 'flag');
        ?>
</option>
					<option value="new_thumbnail" ><?php 
        _e("Create new thumbnails", 'flag');
        ?>
</option>
					<option value="resize_images" ><?php 
        _e("Resize images", 'flag');
        ?>
</option>
					<option value="import_meta" ><?php 
        _e("Import metadata", 'flag');
        ?>
</option>
					<option value="copy_meta" ><?php 
        _e("Metadata to description", 'flag');
        ?>
</option>
					<?php 
        do_action('flag_manage_galleries_bulkaction');
        ?>
				</select>
				<input name="showThickbox" class="button-secondary" type="submit" value="<?php 
        _e('Apply', 'flag');
        ?>
" onclick="if ( !checkSelected() ) return false;" />
				<?php 
    }
    ?>
			</div>
			
		<?php 
    if ($page_links) {
        ?>
			<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $perpage + 1), number_format_i18n(min($_GET['paged'] * $perpage, $flagdb->paged['total_objects'])), number_format_i18n($flagdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
			<br class="clear" />
		<?php 
    }
    ?>
		
		</div>
		<table class="widefat flag-table" cellspacing="0">
			<thead>
			<tr>
				<th scope="col" class="cb column-cb" >
					<input type="checkbox" onclick="checkAll(document.getElementById('editgalleries'));" name="checkall"/>
				</th>
				<th scope="col"><a href="<?php 
    echo $flag->manage_page->base_page . "&galsort=gid&sortdir={$ascdesc}&paged=" . $_GET['paged'];
    ?>
"><?php 
    _e('ID');
    ?>
</a></th>
				<th scope="col"><a href="<?php 
    echo $flag->manage_page->base_page . "&galsort=title&sortdir={$ascdesc}&paged=" . $_GET['paged'];
    ?>
"><?php 
    _e('Title', 'flag');
    ?>
</a></th>
				<th scope="col"><?php 
    _e('Description', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Author', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Quantity', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Action', 'flag');
    ?>
</th>
			</tr>
			</thead>
			<tbody>
<?php 
    if ($gallerylist) {
        foreach ($gallerylist as $gallery) {
            $class = !isset($class) || $class == 'alt ' ? '' : 'alt ';
            $gid = $gallery->gid;
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            $author_user = get_userdata((int) $gallery->author);
            ?>
		<tr id="gallery-<?php 
            echo $gid;
            ?>
" class="<?php 
            echo $class;
            echo $gallery->status ? 'flag_draft' : 'flag_public';
            ?>
" >
			<th scope="row" class="cb column-cb">
				<?php 
            if (flagAdmin::can_manage_this_gallery($gallery->author)) {
                ?>
					<input name="doaction[]" type="checkbox" value="<?php 
                echo $gid;
                ?>
" />
				<?php 
            }
            ?>
			</th>
			<td scope="row"><?php 
            echo $gid;
            ?>
</td>
			<td style="width:30%">
				<?php 
            if (flagAdmin::can_manage_this_gallery($gallery->author)) {
                ?>
					<a href="<?php 
                echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gid, 'flag_editgallery');
                ?>
" class='edit' title="<?php 
                _e('Edit');
                ?>
" >
						<?php 
                echo esc_html(flagGallery::i18n($name));
                ?>
					</a>
				<?php 
            } else {
                ?>
					<?php 
                echo esc_html(flagGallery::i18n($gallery->title));
                ?>
				<?php 
            }
            if ($gallery->status) {
                echo ' <b>- ' . __('Draft', 'flag') . '</b>';
            }
            ?>
			</td>
			<td style="width:30%"><?php 
            echo esc_html(flagGallery::i18n($gallery->galdesc));
            ?>
&nbsp;</td>
			<td><?php 
            echo $author_user->display_name;
            ?>
</td>
			<td><?php 
            echo $gallery->counter;
            ?>
</td>
			<td style="white-space:nowrap;">
				<?php 
            if (flagAdmin::can_manage_this_gallery($gallery->author)) {
                ?>
					<a href="<?php 
                echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=delete&amp;gid=" . $gid, 'flag_editgallery');
                ?>
" class="delete" onclick="javascript:check=confirm( '<?php 
                _e("Delete this gallery ?", 'flag');
                ?>
');if(check==false) return false;"><?php 
                _e('Delete', 'flag');
                ?>
</a>
					<?php 
                if ($gallery->status) {
                    ?>
					| <a href="<?php 
                    echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=publish&amp;gid=" . $gid, 'flag_editgallery');
                    ?>
" class="status" onclick="javascript:check=confirm( '<?php 
                    _e("Publish this gallery?", 'flag');
                    ?>
');if(check==false) return false;"><?php 
                    _e('Publish', 'flag');
                    ?>
</a>
					<?php 
                } else {
                    ?>
					| <a href="<?php 
                    echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=draft&amp;gid=" . $gid, 'flag_editgallery');
                    ?>
" class="status" onclick="javascript:check=confirm( '<?php 
                    _e("Make this gallery draft?", 'flag');
                    ?>
');if(check==false) return false;"><?php 
                    _e('Draft', 'flag');
                    ?>
</a>
					<?php 
                }
                ?>
				<?php 
            }
            ?>
			</td>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'flag') . '</strong></td></tr>';
    }
    ?>
			
			</tbody>
		</table>
		</form>
	</div>
<?php 
    if (current_user_can('FlAG Manage others gallery')) {
        ?>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(document).ready(function(){
	jQuery(".album_categoties").sortable({ opacity: 0.6, cursor: 'move', connectWith: ".album_categoties", update: function() {}}).disableSelection();
	jQuery( "#draggable .acat" ).draggable({
		connectToSortable: ".album_categoties",
		helper: "clone",
		revert: "invalid"
	}).disableSelection();
	jQuery( ".album_categoties" ).droppable({
		accept: ".acat",
		hoverClass: "active",
		drop: function( event, ui ) {
			jQuery( this ).find(jQuery(ui.draggable)).addClass( "highlight_new" ).attr("id", "g_"+jQuery(ui.draggable).attr('rel')).removeAttr('style');
			jQuery( this ).find( "p" ).hide();
		}
	});
	jQuery( ".album_categoties .drop" ).live('click',function(){
		var acat_parent = jQuery(this).parent().parent();
		jQuery(this).parent().remove();
		if(!acat_parent.find('.acat').length){
			acat_parent.find('p').show();
		}
	});
	jQuery('.flag-ajax-post').click(function(e){
		var form = jQuery(this).attr('data-form');
		var edata = jQuery(this).dataset();
		edata.form = jQuery('#'+form).serialize()+'&'+jQuery(this).parents('.album').find('.album_categoties').sortable("serialize"); 
		jQuery.post( ajaxurl, edata,
			function( response ) {
				jQuery(e.target).parent().find('.alb_msg').show().html(response).fadeOut(1200);
				if(jQuery(e.target).hasClass('del')) {
					jQuery(e.target).parent().parent().parent().remove();
				}
				if(response == 'Success'){
					jQuery(e.target).parents('div.album:first').find('.acat').removeClass('highlight_new');
					jQuery(e.target).parents('span.album_actions').find('.alb_msg').show().text('OK').fadeOut(1200);
				}
			}
		);
		return false;
	});
});
/*]]>*/
</script>
	<div class="flag-wrap">
		<h2><?php 
        _e('Albums', 'flag');
        ?>
</h2>
		<form method="post" style="width: 658px; float: left;" action="<?php 
        echo admin_url('admin.php?page=flag-manage-gallery');
        ?>
"><?php 
        wp_nonce_field('flag_album');
        ?>
		<p><input type="text" id="album_name" name="album_name" value="" /> &nbsp; <input type="submit" value="<?php 
        _e('Create New Album', 'flag');
        ?>
" class="button-primary" /></p></form>
		<h2><?php 
        _e('Categories', 'flag');
        ?>
</h2>
		<div class="clear"></div>
		<div class="floatholder">
			<div class="albums_table">
<?php 
        $albumlist = $flagdb->find_all_albums();
        $nonce = wp_create_nonce('wpMediaLib');
        if ($albumlist) {
            foreach ($albumlist as $album) {
                ?>
				<div class="album">
					<div class="album_name"><span class="albID"><?php 
                echo $album->id;
                ?>
.</span> <form method="post" id="albName_<?php 
                echo $album->id;
                ?>
" name="albName_<?php 
                echo $album->id;
                ?>
"><input type="text" name="album_name" value="<?php 
                echo esc_html($album->name);
                ?>
" /><input type="hidden" name="album_id" value="<?php 
                echo $album->id;
                ?>
" /></form> <span class="album_actions"><span class="alb_msg"></span>&nbsp;&nbsp;&nbsp;<span class="button del flag-ajax-post" data-action="flag_delete_album" data-_ajax_nonce="<?php 
                echo $nonce;
                ?>
" data-post="<?php 
                echo $album->id;
                ?>
"><?php 
                _e('Delete', 'flag');
                ?>
</span>&nbsp;&nbsp;<span class="album_save flag-ajax-post button-primary" data-action="flag_save_album" data-_ajax_nonce="<?php 
                echo $nonce;
                ?>
" data-form="albName_<?php 
                echo $album->id;
                ?>
"><strong><?php 
                _e('Save', 'flag');
                ?>
</strong></span></span></div>
					<div class="album_categoties">
					<?php 
                $galids = explode(',', $album->categories);
                if ($album->categories) {
                    foreach ($galids as $galid) {
                        $acat = $flagdb->find_gallery($galid);
                        ?>
								
						<div class="acat" id="g_<?php 
                        echo $acat->gid;
                        ?>
"><?php 
                        echo esc_html($acat->title);
                        ?>
<span class="drop">x</span></div>
						<?php 
                    }
                } else {
                    echo '<p style="text-align:center; padding: 7px 0; margin: 0;">' . __('Drag&Drop Categories Here', 'flag') . '</p>';
                }
                ?>
					</div>
				</div>
<?php 
            }
        } else {
            echo '<p style="text-align:center; padding: 20px 0; margin: 0;">' . __('No Albums', 'flag') . '</p>';
        }
        ?>
			</div>
			<div class="all_galleries" id="draggable">
<?php 
        if ($gallerylist) {
            foreach ($gallerylist as $gallery) {
                $gid = $gallery->gid;
                $name = empty($gallery->title) ? $gallery->name : esc_html($gallery->title);
                $author_user = get_userdata((int) $gallery->author);
                if (flagAdmin::can_manage_this_gallery($gallery->author)) {
                    ?>
				<div class="acat" rel="<?php 
                    echo $gid;
                    ?>
"><?php 
                    echo $name;
                    ?>
<span class="drop">x</span></div>
<?php 
                }
            }
        }
        ?>
				
			</div>
		</div>
	</div>
<?php 
    }
    ?>
	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form_resize_images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'flag');
    ?>
:</strong> 
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $flag->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $flag->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). FlAGallery will keep ratio size', 'flag');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'flag');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flag');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</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('flag_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-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'flag');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbWidth" value="<?php 
    echo $flag->options['thumbWidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbHeight" value="<?php 
    echo $flag->options['thumbHeight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'flag');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'flag');
    ?>
</th>
				<td><input type="checkbox" name="thumbFix" value="1" <?php 
    checked('1', $flag->options['thumbFix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'flag');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'flag');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flag');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

<?php 
}
Ejemplo n.º 10
0
function flag_ajax_plupload_uploader()
{
    global $flag;
    //check for correct capability
    if (!is_user_logged_in()) {
        die('Login failure. -1');
    }
    //check for correct capability
    if (!current_user_can('FlAG Upload images')) {
        die('You do not have permission to upload files. -2');
    }
    //check for correct nonce
    check_ajax_referer('flag_upload');
    include_once FLAG_ABSPATH . 'admin/functions.php';
    // get the gallery
    $galleryID = (int) $_POST['galleryselect'];
    echo flagAdmin::swfupload_image($galleryID);
    die;
}
Ejemplo n.º 11
0
function flag_admin_add_gallery()
{
    global $wpdb, $flagdb, $flag;
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    // check for the max image size
    $maxsize = flagGallery::check_memory_limit();
    $defaultpath = $flag->options['galleryPath'];
    if ($_POST['addgallery']) {
        check_admin_referer('flag_addgallery');
        $newgallery = trim($_POST['galleryname']);
        if (!empty($newgallery)) {
            flagAdmin::create_gallery($newgallery, $defaultpath);
        }
    }
    if ($_POST['uploadimage']) {
        check_admin_referer('flag_upload');
        $flag->options['thumbWidth'] = intval($_POST['thumbWidth']) ? intval($_POST['thumbWidth']) : 100;
        $flag->options['thumbHeight'] = intval($_POST['thumbHeight']) ? intval($_POST['thumbHeight']) : 100;
        $flag->options['thumbFix'] = isset($_POST['thumbFix']) ? 1 : 0;
        update_option('flag_options', $flag->options);
        if ($_FILES['MF__F_0_0']['error'] == 0) {
            flagAdmin::upload_images();
        } else {
            flagGallery::show_error(__('Upload failed!', 'flag'));
        }
    }
    if ($_POST['importfolder']) {
        check_admin_referer('flag_addgallery');
        $galleryfolder = $_POST['galleryfolder'];
        if (!empty($galleryfolder) and $defaultpath != $galleryfolder and false === strpos($galleryfolder, '..')) {
            flagAdmin::import_gallery($galleryfolder);
        }
    }
    if (isset($_POST['disable_flash'])) {
        check_admin_referer('flag_upload');
        $flag->options['swfUpload'] = false;
        update_option('flag_options', $flag->options);
    }
    if (isset($_POST['enable_flash'])) {
        check_admin_referer('flag_upload');
        $flag->options['swfUpload'] = true;
        update_option('flag_options', $flag->options);
    }
    //get all galleries (after we added new ones)
    $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true);
    ?>

	<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>
		<link rel="stylesheet" type="text/css" href="<?php 
        echo FLAG_URLPATH;
        ?>
admin/js/jqueryFileTree/jqueryFileTree.css"/>
		<script type="text/javascript" src="<?php 
        echo FLAG_URLPATH;
        ?>
admin/js/jqueryFileTree/jqueryFileTree.js"></script>
		<script type="text/javascript">
			/* <![CDATA[ */
			jQuery(function(){
				jQuery("span.browsefiles").show().click(function(){
					jQuery("#file_browser").fileTree({
						script: "admin-ajax.php?action=flag_file_browser&nonce=<?php 
        echo wp_create_nonce('flag-ajax');
        ?>
",
						root: jQuery("#galleryfolder").val()
					}, function(file){
						//var path = file.replace("<?php 
        echo WINABSPATH;
        ?>
", "");
						jQuery("#galleryfolder").val(file);
					});

					jQuery("#file_browser").show("slide");
				});
			});
			/* ]]> */
		</script>
	<?php 
    }
    ?>
	<div id="slider" class="flag-wrap">

		<ul id="tabs" class="tabs">
			<li class="selected"><a href="#" rel="addgallery"><?php 
    _e('Add new gallery', 'flag');
    ?>
</a></li>
			<li><a href="#" rel="uploadimage"><?php 
    _e('Upload Images', 'flag');
    ?>
</a></li>
			<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>
				<li><a href="#" rel="importfolder"><?php 
        _e('Import image folder', 'flag');
        ?>
</a></li>
			<?php 
    }
    ?>
		</ul>

		<!-- create gallery -->
		<div id="addgallery" class="cptab">
			<h2><?php 
    _e('Create a new gallery', 'flag');
    ?>
</h2>

			<form name="addgallery" id="addgallery_form" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
				<?php 
    wp_nonce_field('flag_addgallery');
    ?>
				<table class="form-table" style="width: auto;">
					<tr>
						<th scope="col" colspan="2" style="padding-bottom: 0;">
							<strong><?php 
    _e('New Gallery', 'flag');
    ?>
</strong></th>
					</tr>
					<tr valign="top">
						<td><input type="text" size="65" name="galleryname" value=""/><br/>
							<?php 
    if (!IS_WPMU) {
        ?>
								<?php 
        _e('Create a new , empty gallery below the folder', 'flag');
        ?>
								<strong><?php 
        echo $defaultpath;
        ?>
</strong><br/>
							<?php 
    }
    ?>
							<i>( <?php 
    _e('Allowed characters for file and folder names are', 'flag');
    ?>
: a-z, A-Z, 0-9, -, _ )</i>
						</td>
						<?php 
    do_action('flag_add_new_gallery_form');
    ?>
						<td>
							<div class="submit" style="margin: 0; padding: 0;">
								<input class="button-primary" type="submit" name="addgallery" value="<?php 
    _e('Add gallery', 'flag');
    ?>
"/>
							</div>
						</td>
					</tr>
				</table>
				<p>&nbsp;</p>
			</form>
		</div>
		<!-- upload images -->
		<div id="uploadimage" class="cptab">
			<h2><?php 
    _e('Upload images', 'flag');
    ?>
</h2>

			<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
				<?php 
    wp_nonce_field('flag_upload');
    ?>
				<table class="flag-form-table">
					<tr valign="top">
						<td style="width: 216px;">
							<label for="galleryselect"><?php 
    _e('Upload images in', 'flag');
    ?>
 *</label>
							<select name="galleryselect" id="galleryselect" style="width: 200px">
								<option value="0"><?php 
    _e('Choose gallery', 'flag');
    ?>
</option>
								<?php 
    $ingallery = isset($_GET['gid']) ? (int) $_GET['gid'] : '';
    foreach ($gallerylist as $gallery) {
        if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
            continue;
        }
        $name = empty($gallery->title) ? $gallery->name : esc_html(stripslashes($gallery->title));
        if ($flag->options['albSort'] == 'gid') {
            $name = '#' . $gallery->gid . ' - ' . $name;
        }
        if ($flag->options['albSort'] == 'title') {
            $name = $name . ' (#' . $gallery->gid . ')';
        }
        $sel = $ingallery == $gallery->gid ? 'selected="selected" ' : '';
        echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
    }
    ?>
							</select>
							<?php 
    echo $maxsize;
    ?>
							<br/><?php 
    if (IS_WPMU && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) {
        display_space_usage();
    }
    ?>
							<br/>

							<p><?php 
    _e('Thumbnail WIDTH x HEIGHT (in pixel)', 'flag');
    ?>
 *
								<br/><input type="text" size="5" maxlength="5" name="thumbWidth" id="thumbWidth" value="<?php 
    echo $flag->options['thumbWidth'];
    ?>
"/> x
								<input type="text" size="5" maxlength="5" name="thumbHeight" id="thumbHeight" value="<?php 
    echo $flag->options['thumbHeight'];
    ?>
"/>
								<br/>
								<small><?php 
    _e('These values are maximum values ', 'flag');
    ?>
</small>
							</p>
							<p>
								<label><input type="checkbox" name="thumbFix" id="thumbFix" value="1" <?php 
    checked('1', $flag->options['thumbFix']);
    ?>
 /> <?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'flag');
    ?>
								</label></p>

							<div class="submit">
					<span class="useflashupload">
					<?php 
    if ($flag->options['swfUpload']) {
        ?>
						<input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php 
        _e('The batch upload via Plupload, disable it if you have problems', 'flag');
        ?>
" value="<?php 
        _e('Switch to Browser Upload', 'flag');
        ?>
"/>
					<?php 
    } else {
        ?>
						<input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php 
        _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag');
        ?>
" value="<?php 
        _e('Switch to Plupload based Upload', 'flag');
        ?>
"/>
					<?php 
    }
    ?>
					</span>

								<div class="clear"></div>
							</div>

						</td>

						<td>
							<div id="pluploadUploader">
								<?php 
    if (!$flag->options['swfUpload']) {
        ?>
								<strong><?php 
        _e('Upload image(s):', 'flag');
        ?>
</strong><br>
								<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/>
							</div>
						<span id="choosegalfirst">
							<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
        _e('Upload images', 'flag');
        ?>
"/>
							<span class="disabledbut" style="display: none;"></span>
						</span>
							<?php 
    }
    ?>
						</td>
					</tr>
				</table>
				<div id="pl-message"></div>
			</form>
			<?php 
    if ($flag->options['swfUpload']) {
        $nonce = wp_create_nonce('flag_upload');
        ?>
				<script type="text/javascript">
					// Convert divs to queue widgets when the DOM is ready
					jQuery(function($){
						var files_remaining = 0;
						$("#pluploadUploader").plupload({
							runtimes: 'html5,flash,html4',
							url: '<?php 
        echo str_replace('&#038;', '&', wp_nonce_url(admin_url('admin-ajax.php?action=plupload_uploader'), 'flag_upload'));
        ?>
',
							multipart: true,
							multipart_params: {postData: '', pluploadimage: 1},
							max_file_size: '<?php 
        echo floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1;
        ?>
Mb',
							unique_names: false,
							rename: true,
							chunk_size: '<?php 
        echo min(floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1, 6);
        ?>
Mb',
							max_retries: 2,
							sortable: true,
							dragdrop: true,
							views: {
								list: true,
								thumbs: true,
								active: 'thumbs'
							},
							filters: [{title: "Images", extensions: "jpg,gif,png"}],
							flash_swf_url: '<?php 
        echo plugins_url(FLAGFOLDER . '/admin/js/plupload/plupload.flash.swf');
        ?>
'

						});

						var uploader = $("#pluploadUploader").plupload('getUploader');
						uploader.bind('QueueChanged StateChanged', function(up){
							if(up.state == plupload.QUEUED){
								files_remaining = up.files.length;
							}
							if(up.state == plupload.STARTED){
								up.settings.multipart_params = {
									galleryselect: jQuery('#galleryselect').val(),
									thumbw: jQuery('#thumbWidth').val(),
									thumbh: jQuery('#thumbHeight').val(),
									thumbf: jQuery('#thumbFix').prop("checked"),
									last: files_remaining,
									action: 'flag_plupload_uploader',
									_wpnonce: '<?php 
        echo $nonce;
        ?>
'
								};
							}
							if($("#galleryselect").val() == 0){
								$("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled');
							}
							console.log('[StateChanged]', up.state, up.settings.multipart_params);
						});
						uploader.bind('ChunkUploaded', function(up, file, info){
							console.log('[ChunkUploaded] File:', file, "Info:", info);
							var response = jQuery.parseJSON(info.response);
							if(response && response.error){
								up.stop();
								file.status = plupload.FAILED;
								console.log(response.error);
								up.trigger('QueueChanged StateChanged');
								up.trigger('UploadProgress', file);
								up.start();
							}
						});
						uploader.bind('FileUploaded', function(up, file, info){
							console.log('[FileUploaded] File:', file, "Info:", info);
							files_remaining--;
							if(info.response){
								file.status = plupload.FAILED;
								jQuery('<div/>').addClass('error').html('<span><u><em>' + file.name + ':</em></u> ' + info.response + '</span>').appendTo('#pl-message');
							}
						});
						uploader.bind('UploadProgress', function(up, file){
							var percent = uploader.total.percent;
							$('#total-progress-info .progress-bar').css('width', percent + "%").attr('aria-valuenow', percent);
						});
						uploader.bind('Error', function(up, args){
							jQuery('<div/>').addClass('error').html('<span><u><em>' + args.file.name + ':</em></u> ' + args.message + ' ' + args.status + '</span>').appendTo('#pl-message');
							console.log('[error] ', args);
						});
						uploader.bind('UploadComplete', function(up, files){
							console.log('[UploadComplete]', files);
							jQuery('<div/>').addClass('success').html('<?php 
        _e('Done!', 'flag');
        ?>
 <a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&mode=edit", 'flag_editgallery');
        ?>
&gid=' + jQuery("#galleryselect").val() + '">Open Gallery</a>').appendTo('#pl-message');
						});

						jQuery("#gmUpload").on('click', '.ui-button-disabled', function(){
							if(files_remaining){
								alert("Choose gallery, please.")
							}
						});
						jQuery("#galleryselect").change(function(){
							if(jQuery(this).val() == 0){
								jQuery("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled');
							} else{
								if(files_remaining){
									jQuery("#pluploadUploader_start").removeClass('ui-button-disabled ui-state-disabled');
								}
							}
						});

					});
				</script>
			<?php 
    } else {
        ?>
				<!-- MultiFile script -->
				<script type="text/javascript">
					/* <![CDATA[ */
					jQuery(document).ready(function(){
						jQuery('#imagefiles').MultiFile({
							STRING: {
								remove: '<?php 
        _e('remove', 'flag');
        ?>
'
							}
						});

						if(jQuery("#galleryselect").val() == 0){
							jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
							jQuery("#choosegalfirst .disabledbut").show();
						}
						jQuery("#choosegalfirst .disabledbut").click(function(){
							alert("Choose gallery, please.")
						});
						jQuery("#galleryselect").change(function(){
							if(jQuery(this).val() == 0){
								jQuery("#choosegalfirst .disabledbut").show();
								jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
							} else{
								jQuery("#choosegalfirst .disabledbut").hide();
								jQuery("#choosegalfirst").animate({opacity: "1"}, 600);
							}
						});
					});
					/* ]]> */
				</script>

			<?php 
    }
    ?>
		</div>
		<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>
			<!-- import folder -->
			<div id="importfolder" class="cptab">
				<h2><?php 
        _e('Import image folder', 'flag');
        ?>
</h2>

				<form name="importfolder" id="importfolder_form" method="POST" action="<?php 
        echo $filepath;
        ?>
" accept-charset="utf-8">
					<?php 
        wp_nonce_field('flag_addgallery');
        ?>
					<table class="form-table">
						<tr valign="top">
							<th scope="row"><?php 
        _e('Import from Server path:', 'flag');
        ?>
</th>
							<td>
								<input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php 
        echo $defaultpath;
        ?>
"/><span class="browsefiles button" style="display:none"><?php 
        _e('Browse...', "flag");
        ?>
</span>

								<div id="file_browser"></div>
								<div><?php 
        echo $maxsize;
        ?>
									<?php 
        if (SAFE_MODE) {
            ?>
										<br/><?php 
            _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag');
        }
        ?>
								</div>
							</td>
						</tr>
					</table>
					<div class="submit">
						<input class="button-primary" type="submit" name="importfolder" value="<?php 
        _e('Import folder', 'flag');
        ?>
"/>
					</div>
				</form>
			</div>
		<?php 
    }
    ?>

		<script type="text/javascript">
			var cptabs = new ddtabcontent("tabs");
			cptabs.setpersist(true);
			cptabs.setselectedClassTarget("linkparent");
			cptabs.init();
		</script>
	</div>
<?php 
}
Ejemplo n.º 12
0
function flag_admin_add_gallery()
{
    global $wpdb, $flagdb, $flag;
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    // check for the max image size
    $maxsize = flagGallery::check_memory_limit();
    $defaultpath = $flag->options['galleryPath'];
    if ($_POST['addgallery']) {
        check_admin_referer('flag_addgallery');
        $newgallery = trim($_POST['galleryname']);
        if (!empty($newgallery)) {
            flagAdmin::create_gallery($newgallery, $defaultpath);
        }
    }
    if ($_POST['uploadimage']) {
        check_admin_referer('flag_upload');
        if ($_FILES['MF__F_0_0']['error'] == 0) {
            flagAdmin::upload_images();
        } else {
            flagGallery::show_error(__('Upload failed!', 'flag'));
        }
    }
    if ($_POST['importfolder']) {
        check_admin_referer('flag_addgallery');
        $galleryfolder = $_POST['galleryfolder'];
        if (!empty($galleryfolder) and $defaultpath != $galleryfolder and false === strpos($galleryfolder, '..')) {
            flagAdmin::import_gallery($galleryfolder);
        }
    }
    if (isset($_POST['disable_flash'])) {
        check_admin_referer('flag_upload');
        $flag->options['swfUpload'] = false;
        update_option('flag_options', $flag->options);
    }
    if (isset($_POST['enable_flash'])) {
        check_admin_referer('flag_upload');
        $flag->options['swfUpload'] = true;
        update_option('flag_options', $flag->options);
    }
    //get all galleries (after we added new ones)
    $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']);
    ?>

	
<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>

	<link rel="stylesheet" type="text/css" href="<?php 
        echo FLAG_URLPATH;
        ?>
admin/js/jqueryFileTree/jqueryFileTree.css" />
	<script type="text/javascript" src="<?php 
        echo FLAG_URLPATH;
        ?>
admin/js/jqueryFileTree/jqueryFileTree.js"></script>
	<script type="text/javascript">
	/* <![CDATA[ */
		  jQuery(function() {
		    jQuery("span.browsefiles").show().click(function(){
			    jQuery("#file_browser").fileTree({
			      script: "admin-ajax.php?action=flag_file_browser&nonce=<?php 
        echo wp_create_nonce('flag-ajax');
        ?>
",
			      root: jQuery("#galleryfolder").val()
			    }, function(file) {
			        //var path = file.replace("<?php 
        echo WINABSPATH;
        ?>
", "");
			        jQuery("#galleryfolder").val(file);
			    });

		    	jQuery("#file_browser").show("slide");
		    });
		  });
	/* ]]> */
	</script>
<?php 
    }
    ?>

	<div id="slider" class="wrap">
	
		<ul id="tabs" class="tabs">
			<li class="selected"><a href="#" rel="addgallery"><?php 
    _e('Add new gallery', 'flag');
    ?>
</a></li>
			<li><a href="#" rel="uploadimage"><?php 
    _e('Upload Images', 'flag');
    ?>
</a></li>
<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>

			<li><a href="#" rel="importfolder"><?php 
        _e('Import image folder', 'flag');
        ?>
</a></li>
<?php 
    }
    ?>

		</ul>

		<!-- create gallery -->
		<div id="addgallery" class="cptab">
			<h2><?php 
    _e('Create a new gallery', 'flag');
    ?>
</h2>
			<form name="addgallery" id="addgallery_form" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8" >
			<?php 
    wp_nonce_field('flag_addgallery');
    ?>

				<table class="form-table" style="width: auto;"> 
				<tr>
					<th scope="col" colspan="2" style="padding-bottom: 0;"><strong><?php 
    _e('New Gallery', 'flag');
    ?>
</strong></th> 
				</tr>
				<tr valign="top"> 
					<td><input type="text" size="65" name="galleryname" value="" /><br />
					<?php 
    if (!IS_WPMU) {
        ?>

						<?php 
        _e('Create a new , empty gallery below the folder', 'flag');
        ?>
  <strong><?php 
        echo $defaultpath;
        ?>
</strong><br />
					<?php 
    }
    ?>

						<i>( <?php 
    _e('Allowed characters for file and folder names are', 'flag');
    ?>
: a-z, A-Z, 0-9, -, _ )</i></td>
					<?php 
    do_action('flag_add_new_gallery_form');
    ?>

					<td><div class="submit" style="margin: 0; padding: 0;"><input class="button-primary" type="submit" name= "addgallery" value="<?php 
    _e('Add gallery', 'flag');
    ?>
"/></div></td>
				</tr>
				</table>
				<p>&nbsp;</p>
			</form>
		</div>
		<!-- upload images -->
		<div id="uploadimage" class="cptab">
			<h2><?php 
    _e('Upload images', 'flag');
    ?>
</h2>
			<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8" >
				<?php 
    wp_nonce_field('flag_upload');
    ?>

				<table class="form-table">
				<tr valign="top">
					<td style="width: 216px;"><label for="galleryselect"><?php 
    _e('in to', 'flag');
    ?>
</label>
						<select name="galleryselect" id="galleryselect" style="width: 200px">
							<option value="0" ><?php 
    _e('Choose gallery', 'flag');
    ?>
</option>
							<?php 
    $ingallery = isset($_GET['gid']) ? (int) $_GET['gid'] : '';
    foreach ($gallerylist as $gallery) {
        if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
            continue;
        }
        $name = empty($gallery->title) ? $gallery->name : esc_html(stripslashes($gallery->title));
        if ($flag->options['albSort'] == 'gid') {
            $name = $gallery->gid . ' - ' . $name;
        }
        if ($flag->options['albSort'] == 'title') {
            $name = $name . ' (' . $gallery->gid . ')';
        }
        $sel = $ingallery == $gallery->gid ? 'selected="selected" ' : '';
        echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
    }
    ?>

						</select>
						<?php 
    echo $maxsize;
    ?>

						<br /><?php 
    if (IS_WPMU && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) {
        display_space_usage();
    }
    ?>


						<div class="submit">
					<span class="useflashupload">
					<?php 
    if ($flag->options['swfUpload']) {
        ?>

						<input type="submit" name="disable_flash" id="disable_flash" title="<?php 
        _e('The batch upload via Plupload, disable it if you have problems', 'flag');
        ?>
" value="<?php 
        _e('Switch to Browser Upload', 'flag');
        ?>
" />
					<?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', 'flag');
        ?>
" value="<?php 
        _e('Switch to Plupload based Upload', 'flag');
        ?>
" />
					<?php 
    }
    ?>

					</span>
							<div class="clear"></div>
						</div>

					</td>

					<td><div id="pluploadUploader">
					<?php 
    if (!$flag->options['swfUpload']) {
        ?>

						<strong><?php 
        _e('Upload image(s):', 'flag');
        ?>
</strong><br>
						<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></div>
						<span id="choosegalfirst">
							<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php 
        _e('Upload images', 'flag');
        ?>
" />
							<span class="disabledbut" style="display: none;"></span>
						</span>
					<?php 
    }
    ?>

					</td>
				</tr>
				</table>
				<div id="pl-message"></div>
			</form>
<?php 
    if ($flag->options['swfUpload']) {
        ?>

	<script type="text/javascript">
		// Convert divs to queue widgets when the DOM is ready
		jQuery(function () {
			var files_remaining = 0;
			jQuery("#pluploadUploader").pluploadQueue({
				// General settings
				runtimes        		: 'flash,html5,html4',
				url             		: '<?php 
        echo str_replace('&#038;', '&', wp_nonce_url(plugins_url(FLAGFOLDER . '/admin/upload.php'), 'flag_upload'));
        ?>
',
				multipart       		: true,
				multipart_params		: { postData: ''},
				max_file_size					: '<?php 
        echo min(floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1, 8);
        ?>
Mb',
				unique_names    		: false,
				rename          		: true,
				urlstream_upload	: true,

				// Resize images on clientside if we can
				//resize 						: {width : 150, height : 150, quality : 90},

				// Specify what files to browse for
				filters         		: [{title: "Images", extensions: "jpg,gif,png"}],

				// Flash settings
				flash_swf_url   		: '<?php 
        echo plugins_url(FLAGFOLDER . '/admin/js/plupload/plupload.flash.swf');
        ?>
',

				// PreInit events, bound before any internal events
				preinit : {
					Init: function(up, info) {
						console.log('[Init]', 'Info:', info, 'Features:', up.features);
					},

					UploadFile: function(up, file) {
						console.log('[UploadFile]', file);
						up.settings.multipart_params = { galleryselect: jQuery('#galleryselect').val(), last: files_remaining };
						files_remaining--;
						// You can override settings before the file is uploaded
						// up.settings.url = 'upload.php?id=' + file.id;
						// up.settings.multipart_params = {param1 : 'value1', param2 : 'value2'};
					}
				},

				// Post init events, bound after the internal events
				init : {
					Refresh: function(up) {
						// Called when upload shim is moved
						console.log('[Refresh]');
						files_remaining = up.files.length;
						if(jQuery("#galleryselect").val() == 0) {
							jQuery(".plupload_start").addClass("plupload_disabled");
						}
					},

					StateChanged: function(up) {
						// Called when the state of the queue is changed
						console.log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED");
					},

					QueueChanged: function(up) {
						// Called when the files in queue are changed by adding/removing files
						console.log('[QueueChanged]');
					},

					UploadProgress: function(up, file) {
						// Called while a file is being uploaded
						console.log('[UploadProgress]', 'File:', file, "Total:", up.total);
					},

					FileUploaded: function(up, file, info) {
						// Called when a file has finished uploading
						console.log('[FileUploaded] File:', file, "Info:", info);
						if (info.response){
							file.status = plupload.FAILED;
							jQuery('<div/>').addClass('error').html('<span><u><em>'+file.name+':</em></u> '+info.response+'</span>').appendTo('#pl-message');
						}
					},

					Error: function(up, args) {
						// Called when a error has occured
						jQuery('<div/>').addClass('error').html('<span><u><em>'+args.file.name+':</em></u> '+args.message+' '+args.status+'</span>').appendTo('#pl-message');
						console.log('[error] ', args);
					},

					UploadComplete: function(up, file) {
						console.log('[UploadComplete]');
						jQuery(".plupload_buttons").css("display", "inline");
						jQuery(".plupload_upload_status").css("display", "inline");
						jQuery(".plupload_start").addClass("plupload_disabled");
						jQuery("#gmUpload").one("mousedown", ".plupload_add", function () {
							up.splice();
							up.trigger('Refresh');
							//up.refresh();
						});
						jQuery('<div/>').addClass('success').html('<?php 
        _e('Done!', 'flag');
        ?>
 <a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&mode=edit", 'flag_editgallery');
        ?>
&gid=' + jQuery("#galleryselect").val() + '">Open Gallery</a>').appendTo('#pl-message');
					}
				}
			});
			jQuery("#gmUpload").on('click','.plupload_disabled',function(){
				if(files_remaining){
					alert("Choose gallery, please.")
				}
			});
			jQuery("#galleryselect").change(function () {
				if(jQuery(this).val() == 0) {
					jQuery(".plupload_start").addClass('plupload_disabled');
				} else {
					if(files_remaining){
						jQuery(".plupload_start").removeClass('plupload_disabled');
					}
				}
			});

		});
	</script>
<?php 
    } else {
        ?>

	<!-- MultiFile script -->
	<script type="text/javascript">
		/* <![CDATA[ */
		jQuery(document).ready(function(){
			jQuery('#imagefiles').MultiFile({
				STRING: {
					remove:'<?php 
        _e('remove', 'flag');
        ?>
'
				}
			});

			if(jQuery("#galleryselect").val() == 0) {
				jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
				jQuery("#choosegalfirst .disabledbut").show();
			}
			jQuery("#choosegalfirst .disabledbut").click(function () {
				alert("Choose gallery, please.")
			});
			jQuery("#galleryselect").change(function () {
				if(jQuery(this).val() == 0) {
					jQuery("#choosegalfirst .disabledbut").show();
					jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
				} else {
					jQuery("#choosegalfirst .disabledbut").hide();
					jQuery("#choosegalfirst").animate({opacity: "1"}, 600);
				}
			});
		});
		/* ]]> */
	</script>

<?php 
    }
    ?>

		</div>
<?php 
    if (!IS_WPMU || current_user_can('FlAG Import folder')) {
        ?>

		<!-- import folder -->
		<div id="importfolder" class="cptab">
		<h2><?php 
        _e('Import image folder', 'flag');
        ?>
</h2>
			<form name="importfolder" id="importfolder_form" method="POST" action="<?php 
        echo $filepath;
        ?>
" accept-charset="utf-8" >
			<?php 
        wp_nonce_field('flag_addgallery');
        ?>

				<table class="form-table">
				<tr valign="top"> 
					<th scope="row"><?php 
        _e('Import from Server path:', 'flag');
        ?>
</th> 
					<td><input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php 
        echo $defaultpath;
        ?>
" /><span class="browsefiles button" style="display:none"><?php 
        _e('Browse...', "flag");
        ?>
</span>
					<div id="file_browser"></div>
					<div><?php 
        echo $maxsize;
        ?>

					<?php 
        if (SAFE_MODE) {
            ?>
<br /><?php 
            _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag');
        }
        ?>
</div></td> 
				</tr>
				</table>
				<div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php 
        _e('Import folder', 'flag');
        ?>
"/></div>
			</form>
		</div>
<?php 
    }
    ?>


<script type="text/javascript">
	var cptabs=new ddtabcontent("tabs");
	cptabs.setpersist(true);
	cptabs.setselectedClassTarget("linkparent");
	cptabs.init();
</script>
</div>
<?php 
}