Sindbad~EG File Manager
<?php
if (!defined('ABSPATH'))
die('Restricted Access');
class WPJOBPORTALCategoryController {
private $_msgkey;
function __construct() {
self::handleRequest();
$this->_msgkey = WPJOBPORTALincluder::getJSModel('category')->getMessagekey();
}
function handleRequest() {
$layout = WPJOBPORTALrequest::getLayout('wpjobportallt', null, 'categories');
if (self::canaddfile($layout)) {
switch ($layout) {
case 'admin_categories':
WPJOBPORTALincluder::getJSModel('category')->getAllCategories();
break;
case 'admin_formcategory':
$id = WPJOBPORTALrequest::getVar('wpjobportalid');
WPJOBPORTALincluder::getJSModel('category')->getCategorybyId($id);
break;
default:
return;
}
$module = (wpjobportal::$_common->wpjp_isadmin()) ? 'page' : 'wpjobportalme';
$module = WPJOBPORTALrequest::getVar($module, null, 'category');
$module = wpjobportalphplib::wpJP_str_replace('wpjobportal_', '', $module);
wpjobportal::$_data['sanitized_args']['wpjobportal_nonce'] = esc_html(wp_create_nonce('wpjobportal_nonce'));
WPJOBPORTALincluder::include_file($layout, $module);
}
}
function canaddfile($layout) {
$nonce_value = WPJOBPORTALrequest::getVar('wpjobportal_nonce');
if ( wp_verify_nonce( $nonce_value, 'wpjobportal_nonce') ) {
if (isset($_POST['form_request']) && $_POST['form_request'] == 'wpjobportal')
return false;
elseif (isset($_GET['action']) && $_GET['action'] == 'wpjobportaltask')
return false;
else{
if(!is_admin() && strpos($layout, 'admin_') === 0){
return false;
}
return true;
}
}
}
function savecategory() {
$nonce = WPJOBPORTALrequest::getVar('_wpnonce');
if (! wp_verify_nonce( $nonce, 'wpjobportal_category_nonce') ) {
die( 'Security check Failed' );
}
if (!current_user_can('manage_options')) { //only admin can DO it.
return false;
}
$data = WPJOBPORTALrequest::get('post');
$result = WPJOBPORTALincluder::getJSModel('category')->storeCategory($data);
$msg = WPJOBPORTALMessages::getMessage($result, 'category');
WPJOBPORTALMessages::setLayoutMessage($msg['message'], $msg['status'],$this->_msgkey);
$url = esc_url_raw(admin_url("admin.php?page=wpjobportal_category&wpjobportallt=categories"));
wp_redirect($url);
die();
}
function remove() {
$nonce = WPJOBPORTALrequest::getVar('_wpnonce');
if (! wp_verify_nonce( $nonce, 'wpjobportal_category_nonce') ) {
die( 'Security check Failed' );
}
if (!current_user_can('manage_options')) { //only admin can DO it.
return false;
}
$ids = WPJOBPORTALrequest::getVar('wpjobportal-cb');
$result = WPJOBPORTALincluder::getJSModel('category')->deleteCategories($ids);
$msg = WPJOBPORTALMessages::getMessage($result, 'category');
WPJOBPORTALMessages::setLayoutMessage($msg['message'], $msg['status'],$this->_msgkey);
$url = esc_url_raw(admin_url("admin.php?page=wpjobportal_category&wpjobportallt=categories"));
wp_redirect($url);
die();
}
function publish() {
$nonce = WPJOBPORTALrequest::getVar('_wpnonce');
if (! wp_verify_nonce( $nonce, 'wpjobportal_category_nonce') ) {
die( 'Security check Failed' );
}
if (!current_user_can('manage_options')) { //only admin can DO it.
return false;
}
$pagenum = WPJOBPORTALrequest::getVar('pagenum');
$ids = WPJOBPORTALrequest::getVar('wpjobportal-cb');
$result = WPJOBPORTALincluder::getJSModel('category')->publishUnpublish($ids, 1); // for publish
$msg = WPJOBPORTALMessages::getMessage($result, 'record');
WPJOBPORTALMessages::setLayoutMessage($msg['message'], $msg['status'],$this->_msgkey);
$url = esc_url_raw(admin_url("admin.php?page=wpjobportal_category&wpjobportallt=categories"));
if ($pagenum)
$url .= "&pagenum=" . $pagenum;
wp_redirect($url);
die();
}
function unpublish() {
$nonce = WPJOBPORTALrequest::getVar('_wpnonce');
if (! wp_verify_nonce( $nonce, 'wpjobportal_category_nonce') ) {
die( 'Security check Failed' );
}
if (!current_user_can('manage_options')) { //only admin can DO it.
return false;
}
$pagenum = WPJOBPORTALrequest::getVar('pagenum');
$ids = WPJOBPORTALrequest::getVar('wpjobportal-cb');
$result = WPJOBPORTALincluder::getJSModel('category')->publishUnpublish($ids, 0); // for unpublish
$msg = WPJOBPORTALMessages::getMessage($result, 'record');
WPJOBPORTALMessages::setLayoutMessage($msg['message'], $msg['status'],$this->_msgkey);
$url = esc_url_raw(admin_url("admin.php?page=wpjobportal_category&wpjobportallt=categories"));
if ($pagenum)
$url .= "&pagenum=" . $pagenum;
wp_redirect($url);
die();
}
// WE will Save the Ordering system in this Function
function saveordering(){
$nonce = WPJOBPORTALrequest::getVar('_wpnonce');
if (! wp_verify_nonce( $nonce, 'wpjobportal_category_nonce') ) {
die( 'Security check Failed' );
}
if (!current_user_can('manage_options')) { //only admin can DO it.
return false;
}
$post = WPJOBPORTALrequest::get('post');
if($post['task'] == 'unpublish'){
$this->unpublish();
exit();
}
if($post['task'] == 'publish'){
$this->publish();
exit();
}
if($post['task'] == 'remove'){
$this->remove();
exit();
}
WPJOBPORTALincluder::getJSModel('category')->storeOrderingFromPage($post);
$url = esc_url_raw(admin_url("admin.php?page=wpjobportal_category"));
wp_redirect($url);
exit;
}
}
$WPJOBPORTALCategoryController = new WPJOBPORTALCategoryController();
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists