get_var("show tables like ".$wpdb->prefix . "userfile_icons") != $wpdb->prefix . "userfile_icons") { $sql1 = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "userfile_icons( id int NOT NULL AUTO_INCREMENT PRIMARY KEY, extension varchar(10) NOT NULL UNIQUE, image varchar (500) NOT NULL );"; } if($wpdb->get_var("show tables like ".$wpdb->prefix . "userfile_category") != $wpdb->prefix . "userfile_category") { $sql2 = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "userfile_category( id int NOT NULL AUTO_INCREMENT PRIMARY KEY, category varchar(50) NOT NULL, UNIQUE (category) );"; } if($wpdb->get_var("show tables like ".$wpdb->prefix . "userfile_data") != $wpdb->prefix . "userfile_data") { $sql3 = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "userfile_data( id int NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id int NOT NULL, category varchar(50) NOT NULL, filename varchar (500) NOT NULL, description longtext NOT NULL );"; } require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql1); dbDelta($sql2); dbDelta($sql3); if($wpdb->get_var("show tables like ".$wpdb->prefix . "userfile_category") == $wpdb->prefix . "userfile_category") { $DumpFiles = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."userfile_category"); foreach ( $DumpFiles as $SaveFiles ) { $wpdb->insert($wpdb->prefix . "userfile_data", array( 'id'=>$SaveFiles->id,'user_id'=>$SaveFiles->user_id,'category'=>$SaveFiles->category,'filename'=>$SaveFiles->filename)); } $wpdb->query("DROP TABLE ".$wpdb->prefix . "userfile_category"); } $wpdb->query( "ALTER TABLE " . $wpdb->prefix . "userfile_category MODIFY category VARCHAR( 50 )" ); $wpdb->query( "ALTER TABLE " . $wpdb->prefix . "userfile_data MODIFY category VARCHAR( 50 )" ); $wpdb->insert($wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'pdf','image'=>plugins_url( '/user-files/img/pdf.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'doc','image'=>plugins_url( '/user-files/img/word.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'docx','image'=>plugins_url( '/user-files/img/word.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'txt','image'=>plugins_url( '/user-files/img/word.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'jpg','image'=>plugins_url( '/user-files/img/jpg.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'png','image'=>plugins_url( '/user-files/img/jpg.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'gif','image'=>plugins_url( '/user-files/img/jpg.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'jpeg','image'=>plugins_url( '/user-files/img/jpg.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'xls','image'=>plugins_url( '/user-files/img/excel.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'zip','image'=>plugins_url( '/user-files/img/zip.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_icons", array( 'id'=> '','extension'=>'rar','image'=>plugins_url( '/user-files/img/zip.jpg' , dirname(__FILE__) ))); $wpdb->insert( $wpdb->prefix . "userfile_category", array( 'id'=> '','category'=>'misc')); add_option('file_manger_show_dash', 'yes'); add_option('file_manger_show_menu', 'yes'); add_option('file_manger_allow_del', 'no'); add_option('file_manger_allow_up', 'no'); add_option('file_manger_notify', ''); add_option('file_manger_credit'); add_option('file_manger_defaultcat','misc'); add_option('file_manger_upgrade',''); update_option('file_manger_upgrade',$instalVersion); add_option('userfiles_email_subject','New File Upload'); add_option('userfiles_email_message','You have a new file upload. The file is %filename% and has been added to your %category% category.'); $wp_roles->add_cap( 'administrator', 'manage_userfiles' ); $wp_roles->add_cap( 'administrator', 'manage_userfiles_settings' ); } } function DectivateFileDir() { global $wpdb; global $wp_roles; $wp_roles->remove_cap( 'administrator', 'manage_userfiles' ); $wp_roles->remove_cap( 'administrator', 'manage_userfiles_settings' ); $upload_dir = wp_upload_dir(); $isFolder = file_exists ($upload_dir['basedir'].'/file_uploads/'); if ($isFolder) { if ($Subhandle = @opendir($isFolder)) { while (false !== ($subdirs = readdir($Subhandle))) { $files = glob( $subdirs . '*', GLOB_MARK ); foreach( $files as $file ){ if ($file != "." and $file !=".."){ unlink( $file ); } } rmdir( $subdirs ); } } $isitGone = rmdir( $isFolder ); $dir = file_exists ($upload_dir['basedir'].'/userfile_icons/'); $files = glob( $dir . '*', GLOB_MARK ); foreach( $files as $file ){ if ($file != "." and $file !=".."){ unlink( $file ); } } rmdir( $dir ); $wpdb->query('DROP TABLE '.$wpdb->prefix.'userfile_icons'); $wpdb->query('DROP TABLE '.$wpdb->prefix.'userfile_category'); $wpdb->query('DROP TABLE '.$wpdb->prefix.'userfile_data'); $wpdb->query('DROP TABLE '.$wpdb->prefix.'userfile_cats'); delete_option('file_manger_show_dash'); delete_option('file_manger_show_menu'); delete_option('file_manger_allow_up'); delete_option('file_manger_allow_del'); delete_option('file_manger_notify'); delete_option('file_manger_credit'); if ($isitGone) { echo '
'; echo __('The folder has been deleted','userfiles'); echo '
'; } else{ echo '
'; echo __('There was an error deleting the folder, please try again!','userfiles'); echo '
'; } } } function files_settings_page() { echo '

'. __('File Manager Options').'

'; set_abase(); ?>

'; echo __('This will delete all files, folders, categories, icons, etc. Are you sure you want to do this?','userfiles'); echo '
'.__('Yes','userfiles').' | '.__('No','userfiles').''; echo ''; } if ($_POST['update']) { $currOpts_dash = get_option('file_manger_show_dash'); $currOpts_menu = get_option('file_manger_show_menu'); $currOpts_up = get_option('file_manger_allow_up'); $currOpts_del = get_option('file_manger_allow_del'); $currOpts_notify = get_option('file_manger_notify'); $currOpts_credits=get_option('file_manger_credit'); if ($_POST['file_manger_show_dash'] != $currOpts_dash ) { if($_POST['file_manger_show_dash']=='yes') { update_option('file_manger_show_dash','yes' ); }else{ update_option('file_manger_show_dash','no' ); } } if ($_POST['file_manger_dashcats'] != $currOpts_dash ) { update_option('file_manger_dashcats',$_POST['file_manger_dashcats'] ); } if($_POST['file_manger_dashcount'] != $currOpts_menu ) { update_option('file_manger_dashcount',$_POST['file_manger_dashcount'] ); } if($_POST['file_manger_allow_del'] != $currOpts_del ) { if($_POST['file_manger_allow_del']=='yes') { update_option('file_manger_allow_del','yes' ); }else{ update_option('file_manger_allow_del','no' ); } } if($_POST['file_manger_allow_up'] != $currOpts_up ) { if($_POST['file_manger_allow_up']=='yes') { update_option('file_manger_allow_up','yes' ); }else{ update_option('file_manger_allow_up','no' ); } } if($_POST['file_manger_credit'] != $currOpts_credits ) { if($_POST['file_manger_credit']=='yes') { update_option('file_manger_credit','yes' ); }else{ update_option('file_manger_credit','no' ); } } if($_POST['file_manger_notify'] != $currOpts_notify ) { update_option('file_manger_notify',$_POST['file_manger_notify'] ); } if($_POST['userfiles_email_subject'] ) { update_option('userfiles_email_subject',$_POST['userfiles_email_subject'] ); } if($_POST['userfiles_email_message'] ) { update_option('userfiles_email_message',esc_attr($_POST['userfiles_email_message']) ); } echo '

'.__('Settings Saved','userfiles').'
'; } $currOpts_dash = get_option('file_manger_show_dash'); $currOpts_menu = get_option('file_manger_show_menu'); $currOpts_up = get_option('file_manger_allow_up'); $currOpts_del = get_option('file_manger_allow_del'); $currOpts_notify = get_option('file_manger_notify'); $currOpts_credits = get_option('file_manger_credit'); $currOpts_email_Sub=get_option('userfiles_email_subject'); $currOpts_email_mes=get_option('userfiles_email_message'); ?>
>
>
>
>
>




%user_first%,%user_last%,%user_login%,%filename%,%category%
:

 

 


This will completely uninstall User File Manager. All files, folders, and settings will be lost. You need to uninstall this before you deactivate the plugin if you wish to remove it completely.

 

'.__('User Files','userfiles').''; set_abase(); global $wpdb; $upload_dir = wp_upload_dir(); if (isset($_GET['deletefile'])){ $isitGone = unlink($upload_dir['basedir'].'/file_uploads/'.$_GET['deletefile']); $toUsFl=explode ( "/" , $_GET['deletefolder'] ); $wpdb->query("DELETE FROM ".$wpdb->prefix."userfile_data WHERE user_id ='" .$toUsFl[1]. "' AND filename ='".$toUsFl[2]."'"); if ($isitGone) { echo '
'; echo __('The file has been deleted','userfiles'); echo '
'; } else{ echo '
'; echo __('There was an error deleting the file, please try again!','userfiles'); echo '
'; } } if (isset($_GET['deletefolder'])){ $dir = $_GET['deletefolder'].'/'; $files = glob( $dir . '*', GLOB_MARK ); foreach( $files as $file ){ if ($file != "." and $file !=".."){ unlink( $file ); } } $cleanDB= $wpdb->query("DELETE FROM ".$wpdb->prefix."userfile_data WHERE user_id ='" .$_GET['deletefolder']. "'"); $isitGone = rmdir( $dir ); if ($isitGone) { echo '
'; echo __('The folder has been deleted','userfiles'); echo '
'; } else{ echo '
'; echo __('There was an error deleting the folder, please try again!','userfiles'); echo '
'; } } if(isset($_POST['change-em']) || isset($_POST['submit'])){ $step=1; unset($err); $CheckCount=$_POST['CheckedCount']; while($step<= $CheckCount) { $upCat=$_POST['change_cat'.$step]; $Set_user=$_POST['changecat_user'.$step]; $Set_file=$_POST['file'.$step]; $Set_cat=$_POST['newCat']; $isIn = $wpdb->get_var("SELECT id FROM ".$wpdb->prefix."userfile_data WHERE user_id='".$Set_user."' AND filename='".$Set_file."'"); if($upCat == "addit" && $Set_cat !='chge'){ if($isIn){ $stickit = $wpdb->update($wpdb->prefix . "userfile_data", array( 'category'=>$Set_cat),array( 'id'=>$isIn)); }else{ $stickit = $wpdb->insert($wpdb->prefix . "userfile_data", array( 'id'=>'','category'=> $Set_cat,'filename'=>$Set_file,'category'=> get_option('file_manger_defaultcat'),'user_id'=>$_POST['changecat_user'.$step])); } if (!$stickit){ $err .=$Set_file.', '; } } $Set_descr=$_POST['notes'.$step]; $isSaved = $_POST['fileid'.$step]; if (isset($Set_descr)){ $isIn = $wpdb->get_var("SELECT id FROM ".$wpdb->prefix."userfile_data WHERE user_id='".$Set_user."' AND filename='".$Set_file."'"); if($isIn){ $stickit = $wpdb->update($wpdb->prefix . "userfile_data", array( 'description'=>$Set_descr),array( 'id'=>$isIn)); }else{ $stickit = $wpdb->insert($wpdb->prefix . "userfile_data", array( 'id'=>'','description'=> $Set_descr,'filename'=>$Set_file,'user_id'=>$_POST['changecat_user'.$step])); } } $step++; } if (!$err) { echo '
'; echo __('Changes Saved','userfiles'); echo '
'; } else{ echo '
'; echo __('There was an error changing','userfiles'). ': ' .$err; echo '
'; } } if($_POST['file_search']) { $file_search_terms=$_POST['file_search']; } if($_POST['catsnuser']) { $SortByCat=$_POST['showcatsfilter']; if($SortByCat=='chge'){ unset($SortByCat); } $SortByUser=$_POST['foruser']; if($SortByUser=='chge'){ unset($SortByUser); } } ?>
---- ---- '; ?> '; ?>
'; ?>
0){ $foundOne = true; if($tp==1){ $endTable=true; echo ''; $userNum=(int)$file; $user_info = get_userdata($userNum); echo ''; echo ''; echo ''; } $ext = pathinfo($files, PATHINFO_EXTENSION); $tExt = SetIcon($ext); echo ''; echo ''; echo ''; echo ''; $tp++; } } } } echo ''; if($endTable){ echo '
'.__('User Login','userfiles').': '.$user_info->user_login.' | '.__('User Name','userfiles').': '.$user_info->first_name. ' '.$user_info->last_name .' ( '.__('Delete Folder','userfiles').')  DateCategory
'.pathinfo($files, PATHINFO_FILENAME).''. GetTimeStamp($files,$userNum) .''; $currOpts_defcat = get_option('file_manger_defaultcat'); $getCrntCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$files ."' and user_id='" .$userNum. "'"); if (!$getCrntCat) { echo $currOpts_defcat; }else{ echo $getCrntCat; } echo' |

 


'; } } } } } } if($foundOne!=true){ echo '

'; echo __('No Files Found','userfiles'); echo'

'; } //End Search }elseif($SortByCat || $SortByUser){ if($SortByUser){ //Begin sort by user only if(!$SortByCat){ $tp=1; echo ''; $userNum=(int)$SortByUser; $user_info = get_userdata($userNum); echo ''; echo ''; echo ''; ListAdminFiles($userNum); echo '
'.__('User Login','userfiles').': '.$user_info->user_login.' | '.__('User Name','userfiles').': '.$user_info->first_name. ' '.$user_info->last_name .' ( '.__('Delete Folder','userfiles').') DateCategory

 


'; echo ''; //End sort by user only }else{ //Sort by cat and user global $tp; $userNum=(int)$SortByUser; $user_info = get_userdata($userNum); echo ''; echo ''; echo ''; echo ''; unset($found); if ($Subhandle = @opendir($upload_dir['basedir'].'/file_uploads/'.$userNum)) { while (false !== ($files = readdir($Subhandle))) { echo ''; if ($files!=".") { if ($files!="..") { $isCat = CatFilter($files,$SortByCat,$userNum); if($isCat){ ListFilteredFiles($files,$userNum); $found=true; } } } echo ''; } }else{ echo ''; } if($found!=true){ echo ''; } echo ''; } echo '
'.__('User Login','userfiles').': '.$user_info->user_login.' | '.__('User Name','userfiles').': '.$user_info->first_name. ' '.$user_info->last_name .' ( '.__('Delete Folder','userfiles').') DateCategory

'.__('No Files','userfiles').'

'.__('No files found','userfiles').'

 


'; }else{ //Sort by cat only if ($handle = @opendir($upload_dir['basedir'].'/file_uploads')) { while ( ($file = readdir($handle))!== false) { $tp=1; if ($file!=".") { if ($file!="..") { unset($found); echo ''; $userNum=(int)$file; $user_info = get_userdata($userNum); echo ''; echo ''; echo ''; if ($Subhandle = @opendir($upload_dir['basedir'].'/file_uploads/'.$userNum)) { while (false !== ($files = readdir($Subhandle))) { echo ''; if ($files!=".") { if ($files!="..") { $isCat = CatFilter($files,$SortByCat,$userNum); if($isCat){ ListFilteredFiles($files,$userNum,$tp); $found=true; $tp++; } } } echo ''; } if($SortByCat && $found != true){ echo ''; } echo '
'.__('User Login','userfiles').': '.$user_info->user_login.' | '.__('User Name','userfiles').': '.$user_info->first_name. ' '.$user_info->last_name .' ( '.__('Delete Folder','userfiles').') DateCategory

'.__('No files found for this user in category','userfiles').' '.$SortByCat.'

 


'; } } } } echo ''; } } }else{ if ($handle = @opendir($upload_dir['basedir'].'/file_uploads')) { global $tp; $tp=1; while ( ($file = readdir($handle))!== false) { if ($file!=".") { if ($file!="..") { echo ''; $userNum=(int)$file; $user_info = get_userdata($userNum); echo ''; echo ''; echo ''; ListAdminFiles($userNum); echo '
'.__('User Login','userfiles').': '.$user_info->user_login.' | '.__('User Name','userfiles').': '.$user_info->first_name. ' '.$user_info->last_name .' ( '.__('Delete Folder','userfiles').') DateCategory

 


'; //End main page list } } } echo ''; } } //End IF ?>
query("DELETE FROM ". $wpdb->prefix . "userfile_category WHERE category='".$_GET['deletecat'] ."'"); $wpdb->query("UPDATE ".$wpdb->prefix."userfile_data set category='".$currOpts_defcat."' WHERE category='".$_GET['deletecat']."'"); }else{ echo '
'; echo $currOpts_defcat .' '. __('is the default category. You cannot delete this unless you change the default category.','userfiles'); echo '
'; } } $newCat = $_POST['addcat']; if (isset($newCat)){ $isCat = $wpdb->query( "SELECT * FROM ".$wpdb->prefix."userfile_category WHERE category='" .$newCat. "'"); if ($isCat){ $err=1; echo '
'; echo __('This is already a cataegory.','userfiles'); echo '
'; }else{ $dCat = $wpdb->insert( $wpdb->prefix . "userfile_category", array( 'id'=> '','category'=>$newCat)); } if ($dCat) { echo '
'; echo $newCat . __(' has been added','userfiles' ); echo '
'; } else{ echo '
'; echo __('There was an error adding the category','userfiles'); echo '
'; } } $newdefcat=$_GET['defcat']; if (isset($newdefcat)){ update_option('file_manger_defaultcat',$newdefcat); echo '
'; echo $newdefcat.' ' . __('is now default','userfiles' ); echo '
'; } ?>

Manage Catagories

get_results("SELECT * FROM ". $wpdb->prefix . "userfile_category"); echo ''; foreach ($getCats as $c) { echo ''; } echo '
'; echo $c->category.''; if($currOpts_defcat!=$c->category){echo '(Make Default) | ';} echo '(Delete)
'; ?>

'.__('Upload Files','userfiles') .'

'; set_abase(); global $wpdb; $upload_dir = wp_upload_dir(); if (isset($_POST['curr_user'])) { $subDir = $_POST['curr_user']; $usFolder = file_exists ( $upload_dir['basedir'].'/file_uploads/'.$subDir); if (!$usFolder) { mkdir ( $upload_dir['basedir'].'/file_uploads/'. $subDir, 0777 , true ); chmod($upload_dir['basedir'].'/file_uploads/'. $subDir,0777); } $target_path = $upload_dir['basedir'].'/file_uploads/'. $subDir.'/'; $target_path = $target_path . basename($_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $wpdb->insert( $wpdb->prefix . "userfile_data", array( 'user_id'=>$subDir,'category'=>$_POST['curr_cat'],'filename'=>basename( $_FILES['uploadedfile']['name'] ))); if ($_POST['notify_user'] == 'checked') { $user_info = get_userdata($subDir); $usermailsubject = get_option('userfiles_email_subject'); $usermail = get_option('userfiles_email_message'); $usermail = str_replace('%user_first%',$user_info->first_name,$usermail); $usermail = str_replace('%user_last%',$user_info->last_name,$usermail); $usermail = str_replace('%user_login%',$user_info->user_login,$usermail); $usermail = str_replace('%filename%',basename( $_FILES['uploadedfile']['name']),$usermail); $usermail = str_replace('%category%',$_POST['curr_cat'],$usermail); //$usermail = str_ireplace('%','',$usermail); $headers[] ='From:"'.get_option('blogname').'" <'.get_option('admin_email').'>'; wp_mail($user_info->user_email, $usermailsubject, $usermail, $headers); } echo '
'; echo __("The file ",'userfiles'). basename( $_FILES['uploadedfile']['name']).' '. __("has been uploaded to ",'userfiles').$_POST['curr_cat']; echo '
'; } else{ echo '
'; echo __("There was an error uploading the file, please try again!",'userfiles').'
'; echo '
'; } } ?>
get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); echo __('Files for user','userfiles').':

get_results("SELECT * FROM ". $wpdb->prefix."userfile_category" ); echo 'Category:
query("DELETE FROM ".$wpdb->prefix."userfile_data WHERE user_id ='" .$toUsFl[1]. "' AND filename ='".$toUsFl[2]."'"); if(!file_exists($upload_dir['basedir'].'/file_uploads/'.$theDel_file)){ echo '
'; echo __('The file has been deleted','userfiles'); echo '
'; } else{ echo '
'; echo __('There was an error deleting the file, please try again!','userfiles'); echo '
'; } } if($_POST['sorted']){ $user_file_search=$_POST['file_search']; $user_cat_sort= $_POST['showcatsfilter']; if(!$user_file_search){ unset($user_file_search); } if($user_cat_sort == 'chge'){ unset($user_cat_sort); } } echo $_POST['addfiles'].'

'; ?>

Search: ---- ---- '; ?>
'; echo'Your Files   Date Category   '; if ($handle = @opendir($upload_dir['basedir'].'/file_uploads/'.$current_user->ID)) { $rowClass='even_files'; unset($found); $count=1; while (false !== ($file = readdir($handle))) { if ($file!=".") { if ($file!="..") { if($user_file_search){ $searchMatch = strpos(strtolower($file),strtolower($user_file_search)); if($searchMatch === 0 || $searchMatch >0){ if ($rowClass == 'even_files'){ $rowClass='odd_files'; }else{ $rowClass='even_files'; } ListUserFiles($file,$rowClass,$current_user->ID,$count); $found=true; } }elseif($user_cat_sort){ $isCat = CatFilter($file,$user_cat_sort,$current_user->ID); if($isCat){ if ($rowClass == 'even_files'){ $rowClass='odd_files'; }else{ $rowClass='even_files'; } ListUserFiles($file,$rowClass,$current_user->ID,$count); $found=true; } }else{ if ($rowClass == 'even_files'){ $rowClass='odd_files'; }else{ $rowClass='even_files'; } ListUserFiles($file,$rowClass,$current_user->ID,$count); } } } $count++; } if($user_file_search && $found != true) { echo '
'.__('No files found for','userfiles').' '.$user_file_search.'
'; } if($user_cat_sort && $found != true) { echo '
'.__('Nothing found for category','userfiles').' '.$user_cat_sort .'
'; } }else{ echo '
'.__('You have no files','userfiles').'
'; } echo ''; $currOpts_up = get_option('file_manger_allow_up'); if ($currOpts_up=='yes'){ echo '
'; ?> '; } }else{ echo __('You must be logged in to view files','userfiles'); } if ($currOpts_credits =='yes'){ echo '

 

'.userfiles_credit().'

'; } $sFileManger = ob_get_clean(); return $sFileManger; } #################################### # DASHBOARD WIDGET # #################################### function file_manager_dashboard() { $currOpts_dash = get_option('file_manger_show_dash'); if($currOpts_dash=='yes') { wp_add_dashboard_widget( 'my_wp_file_manager', __( 'Your Files','userfiles'),'my_wp_file_manager' ); } } function my_wp_file_manager() { $upload_dir = wp_upload_dir(); global $current_user; get_currentuserinfo(); if ($handle = @opendir($upload_dir['basedir'].'/file_uploads/'.$current_user->ID)) { while (false !== ($file = readdir($handle))) { if ($file!=".") { if ($file!="..") { $ext = pathinfo($file, PATHINFO_EXTENSION); $tExt = SetIcon($ext); echo '

M

get_results("SELECT * FROM ". $wpdb->prefix."userfile_category" ); ?> Category:
'; echo '
'.pathinfo($file, PATHINFO_FILENAME).'
'; echo '
'; } } ?>

Help File

Quick Help

To allow users to upload files or delete files go to the options page and check the appropriate options.

The options to enable the File manager page and dashboard widgets are in the options. The File Manager users menu item is only available in the admin area. If you wish to show the user the file list in your page you can use the shortcode. If you have options selected for the user upload and/or delete files these options will be available on the page as well.

The sidebar widget can be placed in any area that supports widgets and will list all the files available to the logged in user. No options are available for the widget.
In the options section you can customize an email message to send to users to notify them of an uploaded file. When you upload a file there is a checkbox that controls wether or not the user is notfified of the file
More information and documentation can be found here.
Shortcode for use in template page: [user_file_manager]
ID .'/'; } else { if($current_user->ID == $theDLfile_array[0] || current_user_can('manage_userfiles') ){ $file = $theDLfile_array[1]; $url=$upload_dir['basedir'].'/file_uploads/'.$theDLfile_array[0] .'/'; }else{ ?> login to download this file.'; } } return; } /*DOWNLOAD FUNCTION */ function output_file($file, $name, $mime_type='') { if(!is_readable($file)) wp_die($name.' not found or inaccessible!
'); $size = filesize($file); $name = rawurldecode($name); $known_mime_types=array( "pdf" => "application/pdf", "txt" => "text/plain", "html" => "text/html", "htm" => "text/html", "exe" => "application/octet-stream", "zip" => "application/zip", "doc" => "application/msword", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "gif" => "image/gif", "png" => "image/png", "jpeg"=> "image/jpg", "jpg" => "image/jpg", "php" => "text/plain" ); if($mime_type==''){ $file_extension = strtolower(substr(strrchr($file,"."),1)); if(array_key_exists($file_extension, $known_mime_types)){ $mime_type=$known_mime_types[$file_extension]; } else { $mime_type="application/force-download"; }; }; @ob_end_clean(); //turn off output buffering to decrease cpu usage // required for IE, otherwise Content-Disposition may be ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header('Content-Type: ' . $mime_type); header('Content-Disposition: attachment; filename="'.$name.'"'); header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); /* The three lines below basically make the download non-cacheable */ header("Cache-control: private"); header('Pragma: private'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // multipart-download and download resuming support if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2); list($range) = explode(",",$range,2); list($range, $range_end) = explode("-", $range); $range=intval($range); if(!$range_end) { $range_end=$size-1; } else { $range_end=intval($range_end); } $new_length = $range_end-$range+1; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range-$range_end/$size"); } else { $new_length=$size; header("Content-Length: ".$size); } /* output the file itself */ $chunksize = 1*(1024*1024); //you may want to change this $bytes_send = 0; if ($file = fopen($file, 'r')) { if(isset($_SERVER['HTTP_RANGE'])) fseek($file, $range); while(!feof($file) && (!connection_aborted()) && ($bytes_send<$new_length) ) { $buffer = fread($file, $chunksize); print($buffer); //echo($buffer); // is also possible flush(); $bytes_send += strlen($buffer); } fclose($file); } else die('Error - can not open file.'); die(); } function set_abase(){ if(current_user_can('manage_userfiles_settings') || current_user_can('manage_userfiles')){ wp_register_script( 'widgetstuff', site_url().'/wp-admin/load-scripts.php' ); wp_enqueue_script( 'widgetstuff' ); wp_enqueue_style( 'rwefaervev',site_url().'/wp-admin/load-styles.php'); $upload_dir = wp_upload_dir(); ?>

User File Manager Extensions

Userfiles AddonsCustom Plugins and web/PC software

User Files Manager Front End Admin
Group Files
We offer custom wordpress plugins and modifications. Want something built on wordpress? We can help!

WP Support

Get sofware made specifically for your needs. If we can't create your software your consultation is free.
Innovative Solutions

Donate To Development

Donate for this plugin

You can help support our development of this and future free plugins.
get_row("SELECT * FROM ". $wpdb->prefix . "userfile_icons WHERE extension = '". $e ."'"); if ($GetIcon) { return $GetIcon->image; }else{ return plugins_url( '/user-files/img/unknown.jpg' , dirname(__FILE__) ); } } function Icon_management() { global $wpdb; $upload_dir = wp_upload_dir(); if (isset($_POST['submit'])){ unset($err1); unset($err2); if (isset($_POST['extension']) || isset($_FILES['uploadedicon'])) { $already = $wpdb->query("SELECT * FROM ".$wpdb->prefix."userfile_icons WHERE extension ='".$_POST['extension']."'"); if (empty($already)){ $target_path = $upload_dir['basedir'].'/userfile_icons/'; $target_path = $target_path . basename($_FILES['uploadedicon']['name']); if(move_uploaded_file($_FILES['uploadedicon']['tmp_name'], $target_path)) { echo '
'; echo __('The file','userfiles').' '. basename( $_FILES['uploadedicon']['name']).' '. __('has been uploaded','userfiles').'
'; $wpdb->insert($wpdb->prefix . "userfile_icons", array( 'id'=>'','image'=>$upload_dir['baseurl'].'/userfile_icons/'.basename( $_FILES['uploadedicon']['name']),'extension'=>str_replace('.','',$_POST['extension']) )); echo '
'; }else{ echo '
'; echo __('There was an error uploading the file, please try again!','userfiles') .'
'; echo '
'; if (isset($_POST['extension'])){ $err2=2; }else{ $err2=1; } if (isset($_FILE['uploadedicon'])){ $err1=2; }else{ $err1=1; } } }else{ echo '
'; echo __('Extension already exists, please delete the current extension set before uploading a new one.','userfiles') .'
'; echo '
'; if (isset($_POST['extension'])){ $err2=2; }else{ $err2=1; } if (isset($_FILE['uploadedicon'])){ $err1=2; }else{ $err1=1; } } }else{ if (isset($_POST['extension'])){ $err2=2; }else{ $err2=1; } if (isset($_FILE['uploadedicon'])){ $err1=2; }else{ $err1=1; } echo '
'; echo __('You must have both a file and extension','userfiles'); echo '
'; } } /*Delete Icon */ if (isset($_GET['deleteicon'])){ $goAwayIcon = $wpdb->query("DELETE FROM ".$wpdb->prefix."userfile_icons WHERE extension ='".$_GET['deleteicon']."'"); if ($goAwayIcon) { echo '
'; echo __('File Deleted','userfiles'); echo '
'; }else{ echo '
'; echo __('There was an error deleting this extension','userfiles'); echo '
'; } } set_abase(); $getIcons = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix . "userfile_icons ORDER BY image"); echo ''; foreach ($getIcons as $icon) { echo ''; } echo '
'.__('Icons','userfiles').'
' .$icon->extension.'(Delete)
'; ?>

 

/> : />

 

'; if (isset($_POST['createFolder'])){ mkdir ( $upload_dir['basedir'].'/file_uploads/'.$_POST['createFolder'], 0777 , true ); chmod($upload_dir['basedir'].'/file_uploads/'.$_POST['createFolder'], 0777); } echo ''; echo ''; $szSort = "user_login"; $aUsersID = $wpdb->get_col( $wpdb->prepare( "SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", $szSort )); foreach ( $aUsersID as $iUserID ) : $user_info = get_userdata( $iUserID ); echo ''; } $isFolder = file_exists ( $upload_dir['basedir'].'/file_uploads/'.$iUserID); if (!$isFolder) { echo ''; }else{ echo ''; } endforeach; echo '

'.__('User Paths for FTP upload','userfiles').'

'.__('User files folder is located','userfiles').' '.$upload_dir['basedir'].'/file_uploads/
'.__('Folder Number','userfiles').'
'.$user_info->user_login; if($user_info->first_name || $user_info->last_name ){ echo '('.$user_info->first_name. ' '.$user_info->last_name .')
'.$iUserID.'
'; } function userfiles_credit(){ return 'User File Manger created by Innovative Solutions'; } function getDeleted($aVars) { $aVars[] = "deletefile"; return $aVars; } ?>