示例#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);
 }
示例#2
0
/**
 * lg_swfupload()
 * 
 * used in async upload by flash uploader
 * @param string $path
 * @return string
 * @since 1.0
 */
function lg_swfupload()
{
    global $lg_gallery, $file;
    require_once dirname(__FILE__) . '/manager.php';
    header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
    wp_set_current_user($_REQUEST['uid']);
    check_ajax_referer();
    // set the gallery folder
    $file = stripslashes(utf8_decode(rawurldecode($_POST['file'])));
    if ($file == '') {
        esc_html_e('No folder to store the image', 'lazyest-gallery');
    }
    $folder = new LazyestAdminFolder($file);
    $message = $folder->swfuploadfiles();
    unset($folder);
    echo $message;
    die;
}