Exemplo 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);
 }