static function DisplayInstallPlugins() { if (!current_user_can('install_plugins')) { wp_die(__('You do not have sufficient permissions to install plugins on this site.')); } global $tab; $tab = $_GET['tab'] = 'new'; // required for list table (in 3.5.1) $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->orderby = 'order'; $wp_list_table->prepare_items(); $total_pages = $wp_list_table->get_pagination_arg('total_pages'); if ($pagenum > $total_pages && $total_pages > 0) { WPFB_AdminLite::JsRedirect(add_query_arg('paged', $total_pages)); exit; } $title = __('Extensions', 'wp-filebase'); wp_print_scripts('plugin-install'); ?> <style type="text/css" media="screen"> .vers.column-rating, .column-downloaded { display: none; } #TB_ajaxWindowTitle { display: none; } </style> <div class="wrap"> <h3><?php echo esc_html($title); ?> </h3> <p>Each extensions is an additional plugin. You can test all extensions in the <a href="http://demo.wpfilebase.com/wp-admin/admin.php?page=wpfilebase_manage" target="_blank">Live Demo Sandbox</a>.</p> <?php //$wp_list_table->views(); //echo '<br class="clear" />'; ?> <form id="plugin-filter" action="" method="post"> <?php $wp_list_table->display(); ?> </form> </div> <script> jQuery('a.buy-now').click(function (e) { if (jQuery(this).text() === 'Refresh') { if(window.location.search.indexOf('&no_api_cache=1') > 0) window.location.reload(); else window.location.search += '&no_api_cache=1'; return false; } jQuery(this).text('Refresh'); return true; }); </script> <?php }
static function DisplayInstallPlugins() { if (!current_user_can('install_plugins')) { wp_die(__('You do not have sufficient permissions to install plugins on this site.')); } global $tab; $tab = $_GET['tab'] = 'new'; // required for list table (in 3.5.1) $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->orderby = 'order'; $wp_list_table->prepare_items(); $total_pages = $wp_list_table->get_pagination_arg('total_pages'); if ($pagenum > $total_pages && $total_pages > 0) { WPFB_AdminLite::JsRedirect(add_query_arg('paged', $total_pages)); exit; } $title = __('Add Extensions'); wp_print_scripts('plugin-install'); ?> <style type="text/css" media="screen"> .vers.column-rating, .column-downloaded { display: none; } #TB_ajaxWindowTitle { display: none; } </style> <div class="wrap"> <h2><?php echo esc_html($title); ?> </h2> <?php //$wp_list_table->views(); //echo '<br class="clear" />'; ?> <form id="plugin-filter" action="" method="post"> <?php $wp_list_table->display(); ?> </form> </div> <script> jQuery('a.buy-now').click(function(e) { if(jQuery(this).text() === 'Refresh') { window.location.reload(); return false; } jQuery(this).text('Refresh'); return true; }); </script> <?php }
static function Display() { global $wpdb, $user_ID; wpfb_loadclass('File', 'Category', 'Admin', 'Output'); $_POST = stripslashes_deep($_POST); $_GET = stripslashes_deep($_GET); $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : ''; $clean_uri = remove_query_arg(array('message', 'action', 'file_id', 'cat_id', 'deltpl', 'hash_sync')); // keep search keyword // nonce/referer check (security) if ($action == 'updatefile' || $action == 'addfile') { $nonce_action = WPFB . "-" . $action; if ($action == 'updatefile') { $nonce_action .= $_POST['file_id']; } if (!check_admin_referer($nonce_action, 'wpfb-file-nonce')) { wp_die(__('Cheatin’ uh?')); } } // switch simple/extended form if (isset($_GET['exform'])) { $exform = !empty($_GET['exform']) && $_GET['exform'] == 1; update_user_option($user_ID, WPFB_OPT_NAME . '_exform', $exform, true); } else { $exform = (bool) get_user_option(WPFB_OPT_NAME . '_exform'); } ?> <div class="wrap"> <?php switch ($action) { case 'editfile': if (!current_user_can('upload_files')) { wp_die(__('Cheatin’ uh?')); } if (!empty($_POST['files'])) { if (!is_array($_POST['files'])) { $_POST['files'] = explode(',', $_POST['files']); } $files = array(); foreach ($_POST['files'] as $file_id) { $file = WPFB_File::GetFile($file_id); if (!is_null($file) && $file->CurUserCanEdit()) { $files[] = $file; } } if (count($files) > 0) { WPFB_Admin::PrintForm('file', $files, array('multi_edit' => true)); } else { wp_die('No files to edit.'); } } else { $file = WPFB_File::GetFile($_GET['file_id']); if (is_null($file) || !$file->CurUserCanEdit()) { wp_die(__('You do not have the permission to edit this file!', 'wp-filebase')); } WPFB_Admin::PrintForm('file', $file); } break; case 'updatefile': $file_id = (int) $_POST['file_id']; $update = true; $file = WPFB_File::GetFile($file_id); if (is_null($file) || !$file->CurUserCanEdit()) { wp_die(__('Cheatin’ uh?')); } case 'addfile': $update = !empty($update); if (!WPFB_Core::CurUserCanUpload()) { wp_die(__('Cheatin’ uh?')); } extract($_POST); if (isset($jj) && isset($ss)) { $jj = $jj > 31 ? 31 : $jj; $hh = $hh > 23 ? $hh - 24 : $hh; $mn = $mn > 59 ? $mn - 60 : $mn; $ss = $ss > 59 ? $ss - 60 : $ss; $_POST['file_date'] = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss); } $result = WPFB_Admin::InsertFile(stripslashes_deep(array_merge($_POST, $_FILES)), true); if (isset($result['error']) && $result['error']) { $message = $result['error'] . '<br /><a href="javascript:history.back()">' . __("Go back") . '</a>'; } else { $message = $update ? __('File updated.', 'wp-filebase') : __('File added.', 'wp-filebase'); } default: if (!current_user_can('upload_files')) { wp_die(__('Cheatin’ uh?')); } if (!empty($_REQUEST['redirect']) && !empty($_REQUEST['redirect_to'])) { WPFB_AdminLite::JsRedirect($_REQUEST['redirect_to']); exit; } if (!empty($_POST['deleteit'])) { foreach ((array) $_POST['delete'] as $file_id) { if (is_object($file = WPFB_File::GetFile($file_id)) && $file->CurUserCanDelete()) { $file->Remove(true); } } WPFB_File::UpdateTags(); } ?> <h2><?php echo str_replace(array('(<', '>)'), array('<', '>'), sprintf(__('Manage Files (<a href="%s">add new</a>)', 'wp-filebase'), '#addfile" class="add-new-h2')); echo '<a href="' . admin_url('admin.php?page=wpfilebase_manage&action=batch-upload') . '" class="add-new-h2">' . __('Batch Upload', 'wp-filebase') . '</a>'; if (isset($_GET['s']) && $_GET['s']) { printf('<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html(stripslashes($_GET['s']))); } ?> </h2> <?php if (!empty($message)) { ?> <div id="message" class="updated fade"><p><?php echo $message; ?> </p></div><?php } if (WPFB_Core::CurUserCanUpload() && ($action == 'addfile' || $action == 'updatefile')) { unset($file); WPFB_Admin::PrintForm('file', null, array('exform' => $exform, 'item' => new WPFB_File(isset($result['error']) && $result['error'] ? $_POST : null))); } wpfb_loadclass('FileListTable'); $file_table = new WPFB_FileListTable(); $file_table->prepare_items(); ?> <form class="search-form topmargin" action="" method="get"> <input type="hidden" value="<?php echo esc_attr($_GET['page']); ?> " name="page" /> <input type="hidden" value="<?php echo empty($_GET['view']) ? '' : esc_attr(@$_GET['view']); ?> " name="view" /> <?php $file_table->search_box(__('Search Files', 'wp-filebase'), 's'); ?> </form> <?php $file_table->views(); ?> <form id="posts-filter" action="" method="post"> <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?> " /> <?php $file_table->display(); ?> </form> <br class="clear" /> <?php if ($action != 'addfile' && $action != 'updatefile' && WPFB_Core::CurUserCanUpload()) { unset($file); WPFB_Admin::PrintForm('file', null, array('exform' => $exform)); } break; // default } /* $file_list_table = new WPFB_File_List_Table(); $pagenum = $file_list_table->get_pagenum(); $doaction = $file_list_table->current_action(); $file_list_table->prepare_items(); $file_list_table->views(); $file_list_table->search_box( "asdf", 'post' ); $file_list_table->display(); */ ?> </div> <!-- wrap --> <?php }
static function Display() { global $wpdb, $user_ID; if (!WPFB_Core::CurUserCanCreateCat()) { wp_die(__('Cheatin’ uh?')); } wpfb_loadclass('Category', 'File', 'Admin', 'Output'); $_POST = stripslashes_deep($_POST); $_GET = stripslashes_deep($_GET); $action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : ''); $clean_uri = remove_query_arg(array('message', 'action', 'file_id', 'cat_id', 'deltpl', 'hash_sync')); // keep search keyword // switch simple/extended form if (isset($_GET['exform'])) { $exform = !empty($_GET['exform']) && $_GET['exform'] == 1; update_user_option($user_ID, WPFB_OPT_NAME . '_exform', $exform, true); } else { $exform = (bool) get_user_option(WPFB_OPT_NAME . '_exform'); } ?> <div class="wrap"> <?php switch ($action) { case 'editcat': $cat_id = (int) $_GET['cat_id']; $file_category = WPFB_Category::GetCat($cat_id); if (is_null($file_category) || !$file_category->CurUserCanEdit()) { wp_die(__('Cheatin’ uh?')); } WPFB_Admin::PrintForm('cat', $file_category); break; case 'updatecat': $cat_id = (int) $_POST['cat_id']; $update = true; $file_category = WPFB_Category::GetCat($cat_id); if (is_null($file_category) || !$file_category->CurUserCanEdit()) { wp_die(__('Cheatin’ uh?')); } case 'addcat': $update = !empty($update); if (!$update && !WPFB_Core::CurUserCanCreateCat()) { wp_die(__('Cheatin’ uh?')); } $result = WPFB_Admin::InsertCategory(array_merge(stripslashes_deep($_POST), $_FILES)); if (isset($result['error']) && $result['error']) { $message = $result['error']; } else { $message = $update ? __('Category updated.') : __('Category added.'); /* def */ } //wp_redirect($clean_uri . '&action=manage_cats&message=' . urlencode($message)); //wp_redirect($clean_uri . '&action=manage_cats&message=' . urlencode($message)); default: if (!empty($_POST['deleteit'])) { foreach ((array) $_POST['delete'] as $cat_id) { if (is_object($cat = WPFB_Category::GetCat($cat_id)) && $cat->CurUserCanEdit()) { $cat->Delete(); } } } if (!empty($_REQUEST['redirect']) && !empty($_REQUEST['redirect_to'])) { WPFB_AdminLite::JsRedirect($_REQUEST['redirect_to']); exit; } ?> <h2><?php echo str_replace(array('(<', '>)'), array('<', '>'), sprintf(__('Manage Categories (<a href="%s">add new</a>)', 'wp-filebase'), '#addcat" class="add-new-h2')); if (isset($_GET['s']) && $_GET['s']) { printf('<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html(stripslashes($_GET['s']))); } ?> </h2> <?php if (!empty($message)) { ?> <div id="message" class="updated fade"><p><?php echo $message; ?> </p></div><?php } ?> <form class="search-form topmargin" action="" method="get"><p class="search-box"> <input type="hidden" value="<?php echo esc_attr($_GET['page']); ?> " name="page" /> <label class="hidden" for="category-search-input"><?php _e('Search Categories'); ?> :</label> <input type="text" class="search-input" id="category-search-input" name="s" value="<?php echo isset($_GET['s']) ? esc_attr($_GET['s']) : ''; ?> " /> <input type="submit" value="<?php _e('Search Categories'); ?> " class="button" /> </p></form> <br class="clear" /> <form id="posts-filter" action="" method="post"> <div class="tablenav"> <?php $pagenum = max(isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 0, 1); if (!isset($catsperpage) || $catsperpage < 0) { $catsperpage = 20; } $pagestart = ($pagenum - 1) * $catsperpage; $extra_sql = ''; if (!empty($_GET['s'])) { $s = esc_sql(trim($_GET['s'])); $extra_sql .= "WHERE cat_name LIKE '%{$s}%' OR cat_description LIKE '%{$s}%' OR cat_folder LIKE '%{$s}%' "; } if (!empty($_GET['order']) && in_array($_GET['order'], array_keys(get_class_vars('WPFB_Category')))) { $extra_sql .= "ORDER BY " . $_GET['order'] . " " . (!empty($_GET['desc']) ? "DESC" : "ASC"); } $cats = WPFB_Category::GetCats($extra_sql . " LIMIT {$pagestart}, {$catsperpage}"); $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'total' => ceil(count(WPFB_Category::GetCats($extra_sql)) / $catsperpage), 'current' => $pagenum, 'add_args' => array())); if ($page_links) { echo "<div class='tablenav-pages'>{$page_links}</div>"; } ?> <div class="alignleft"><input type="submit" value="<?php _e('Delete'); ?> " name="deleteit" class="button delete" /><?php wp_nonce_field('bulk-categories'); ?> </div> </div> <br class="clear" /> <table class="widefat"> <thead> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_name'); ?> "><?php _e('Name'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_description'); ?> "><?php _e('Description'); ?> </a></th> <th scope="col" class="num"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_num_files'); ?> "><?php _e('Files', 'wp-filebase'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_parent'); ?> "><?php _e('Parent Category'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_path'); ?> "><?php _e('Path'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_user_roles'); ?> "><?php _e('Access Permission', 'wp-filebase'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_owner'); ?> "><?php _e('Owner', 'wp-filebase'); ?> </a></th> <th scope="col"><a href="<?php echo WPFB_Admin::AdminTableSortLink('cat_order'); ?> "><?php _e('Custom Sort Order', 'wp-filebase'); ?> </a></th> </tr> </thead> <tbody id="the-list" class="list:cat"> <?php foreach ($cats as $cat_id => &$cat) { if ($cat->CurUserCanEdit()) { self::CatRow($cat); } } ?> </tbody> </table> <div class="tablenav"><?php if ($page_links) { echo "<div class='tablenav-pages'>{$page_links}</div>"; } ?> </div> </form> <br class="clear" /> <?php if (WPFB_Core::CurUserCanCreateCat()) { ?> <p><?php _e('<strong>Note:</strong><br />Deleting a category does not delete the files in that category. Instead, files that were assigned to the deleted category are set to the parent category.', 'wp-filebase'); ?> </p><?php WPFB_Admin::PrintForm('cat'); } break; } ?> </div> <!-- wrap --> <?php }