Esempio n. 1
0
 /**
  * LazyestAdmin::filemanager_page()
  * Create the Lazyest Gallery Management pages
  * 
  * @return
  */
 function filemanager_page()
 {
     if (!$this->user_can_browse()) {
         wp_die(esc_html__('You do not have permission to browse the gallery.', 'lazyest-gallery'));
     }
     if (isset($_GET['edit']) && $_GET['edit'] == 'comments') {
         $this->commentor->edit_comments_form();
         return;
     }
     $folderdir = '';
     if (isset($_GET['folder'])) {
         $folderdir = utf8_decode(stripslashes(rawurldecode($_GET['folder'])));
     }
     if ('' == $folderdir) {
         if (isset($_GET['delete_folder'])) {
             $this->delete_folder();
         }
         if (isset($_POST['create_new_folder'])) {
             $foldername = $_POST['new_folder_name'];
             $this->new_gallery_folder($foldername);
         }
         if (isset($_POST['add-author']) || isset($_POST['add-editor'])) {
             $this->add_users();
         }
         if (isset($_POST['remove-author']) || isset($_POST['remove-editor'])) {
             $this->remove_users();
         }
         if (isset($_POST['set_viewer_level'])) {
             $this->set_viewer_level();
         }
         $this->manage();
         return;
     }
     include_once $this->plugin_dir . '/inc/manager.php';
     $folder = new LazyestAdminFolder($folderdir);
     if ($folder->valid() && $folder->user_can('viewer')) {
         $folder->manage();
     } else {
         /* translators: %1s: <strong>, %2s: folder %3s: </strong> */
         $this->message = sprintf(esc_html__('Lazyest Gallery cannot open folder %1s%2s%3s', 'lazyest-gallery'), '<strong>', esc_html($_GET['folder']), '</strong>');
         $this->success = false;
         $_SERVER['REQUEST_URI'] = remove_query_arg('folder', $_SERVER['REQUEST_URI']);
         $this->manage();
     }
     unset($folder);
 }
Esempio n. 2
0
/**
 * lg_media_upload()
 * Show lazyest-gallery upload window
 * 
 * @return void
 * @since 1.1.3
 */
function lg_media()
{
    global $lg_gallery;
    check_ajax_referer();
    $folder = isset($_REQUEST['folder']) ? utf8_decode(stripslashes(rawurldecode($_GET['folder']))) : '';
    if ('' == $folder) {
        die(__('Cannot upload images to no folder', 'lazyest-gallery'));
    }
    require_once $lg_gallery->plugin_dir . '/inc/manager.php';
    $lazyest_admin_folder = new LazyestAdminFolder($folder);
    $lazyest_admin_folder->open();
    if ('TRUE' == $lg_gallery->get_option('flash_upload')) {
        $j = defined('WP_DEBUG') && WP_DEBUG ? 'dev.js' : 'js';
        wp_register_script('lg_swfupload-handlers', $lg_gallery->plugin_url . "/js/lazyest-swf-handler.{$j}", array('jquery'), '1.1', false);
        wp_enqueue_script('swfupload-all');
        wp_enqueue_script('lg_swfupload-handlers');
        wp_localize_script('lg_swfupload-handlers', 'lg_swfuploadL10n', $lg_gallery->localize_swf());
        $c = defined('WP_DEBUG') && WP_DEBUG ? 'dev.css' : 'ccs';
        wp_register_style('lg_admin_style', $lg_gallery->plugin_url . "/css/_admin.{$c}");
        $lg_gallery->update_option('flash_upload', 'TRUE');
    }
    if (isset($_GET['flash'])) {
        if ('0' == $_GET['flash']) {
            $lg_gallery->update_option('flash_upload', 'FALSE');
        }
    }
    ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" <?php 
    do_action('admin_xml_ns');
    ?>
 <?php 
    language_attributes();
    ?>
>
	<head>
	<meta http-equiv="Content-Type" content="<?php 
    bloginfo('html_type');
    ?>
; charset=<?php 
    echo get_option('blog_charset');
    ?>
" />
	<meta http-equiv="X-UA-Compatible" content="IE=8" />
	<title><?php 
    bloginfo('name');
    ?>
 &rsaquo; <?php 
    esc_html_e('Uploads');
    ?>
 &#8212; <?php 
    esc_html_e('Lazyest Gallery', 'lazyest-gallery');
    ?>
</title>
	<?php 
    wp_enqueue_style('global');
    wp_enqueue_style('wp-admin');
    wp_enqueue_style('colors');
    wp_enqueue_style('media');
    wp_enqueue_style('ie');
    wp_enqueue_style('lg_admin_style');
    ?>
	<script type="text/javascript">
	//<![CDATA[
	addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
	var userSettings = {'url':'<?php 
    echo SITECOOKIEPATH;
    ?>
','uid':'<?php 
    if (!isset($current_user)) {
        $current_user = wp_get_current_user();
    }
    echo $current_user->ID;
    ?>
','time':'<?php 
    echo time();
    ?>
'};
	var ajaxurl = '<?php 
    echo admin_url('admin-ajax.php');
    ?>
', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
	isRtl = <?php 
    echo (int) is_rtl();
    ?>
;
	//]]>
	</script>
	<?php 
    do_action('admin_print_styles-media-upload-popup');
    do_action('admin_print_styles');
    do_action('admin_print_scripts');
    do_action('admin_head-media-upload-popup');
    do_action('admin_head');
    ?>
	</head>
	<body id="media-upload" class="wp-core-ui no-js">
	<script type="text/javascript">
	//<![CDATA[
	(function(){
	var c = document.body.className;
	c = c.replace(/no-js/, 'js');
	document.body.className = c;
	})();
	
	
	//]]>
	</script>
	<div id="media-upload-header">
		<ul id="sidemenu">
		<li id="tab-type"><a href="#" class="current"><?php 
    esc_html_e('From Computer', 'lazyest-gallery');
    ?>
</a></li>	
		</ul>
	</div>
	<?php 
    if (isset($_REQUEST['html-upload'])) {
        $lazyest_admin_folder->uploadfiles();
    }
    ?>
	<?php 
    if ($lazyest_admin_folder->user_can('editor')) {
        $lazyest_admin_folder->uploadbox();
    }
    ?>
	<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>	
	</body>
	</html>
<?php 
    die;
}