'.pathinfo($Thefile, PATHINFO_FILENAME) .''; $getDescr= $wpdb->get_var("SELECT description FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile ."' and user_id='" .$userID. "'"); if(!empty($getDescr)){ //echo 'Show Notes'; echo ' Show Notes '; }else{ echo ' '; } echo ''. GetTimeStamp($Thefile,$userID) .''; echo ''; $currOpts_defcat = get_option('file_manger_defaultcat'); $getCrntCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile ."' and user_id='" .$userID. "'"); if (!$getCrntCat) { echo $currOpts_defcat; }else{ echo $getCrntCat; } echo''; if(is_admin() ){ echo ' '; }else{ echo ' '; } if(get_option('file_manger_allow_del')=='yes') { if(is_admin()){ echo ' | '; }else{ echo ' | '; } }else{ echo ''; }//end if } ################################### # List Filtered Admin Files # ################################### function ListFilteredFiles($Thefile,$userID,$tp) { global $wpdb; global $tp; global $post; global $wp_query; $upload_dir = wp_upload_dir(); $ext = pathinfo($Thefile, PATHINFO_EXTENSION); $tExt = SetIcon($ext); echo ' '.pathinfo($Thefile, PATHINFO_FILENAME) .''; $getDescr = $wpdb->get_var("SELECT description FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile ."' and user_id='" .$userID. "'"); echo ''; echo ''.GetTimeStamp($Thefile,$userNum) .''; echo ''; $currOpts_defcat = get_option('file_manger_defaultcat'); $getCrntCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile ."' and user_id='" .$userID. "'"); if (!$getCrntCat) { echo $currOpts_defcat; }else{ echo $getCrntCat; } echo''; echo ''; if (is_admin()){ echo ' '; }else{ echo ' '; } if(get_option('file_manger_allow_del')=='yes') { if(is_admin()){ echo ' | '; }else{ echo ' | '; } }else{ echo ''; }//end if $tp++; } ########################## # List Admin Files # ########################## function ListAdminFiles($userNum) { $upload_dir = wp_upload_dir(); global $wpdb; global $tp; global $post; if ($Subhandle = @opendir($upload_dir['basedir'].'/file_uploads/'.$userNum)) { while (false !== ($files = readdir($Subhandle))) { echo ''; if ($files!=".") { if ($files!="..") { $ext = pathinfo($files, PATHINFO_EXTENSION); $tExt = SetIcon($ext); echo ' '.pathinfo($files, PATHINFO_FILENAME).''; $getDescr = $wpdb->get_var("SELECT description FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$files ."' and user_id='" .$userNum. "'"); echo ''; echo ''. GetTimeStamp($files,$userNum) .''; echo ''; $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(is_admin()){ echo ' '; echo ' | Delete '; }else{ echo ' '; echo ' | Delete '; } $tp++; } } echo ''; } }else{ echo __('No Files','userfiles'); } } function show_FM_pages() { add_options_page(__('User Files Settings','userfiles'), __('User Files','userfiles'), 'manage_userfiles_settings', 'file_manager_options', 'files_settings_page' ); add_menu_page( __('Manage Files','userfiles'), __('Manage Files','userfiles'), 'manage_userfiles', 'manage-files-main', 'manage_files_mainpg'); add_submenu_page('manage-files-main', __('Add Files','userfiles'), __('Add Files','userfiles'), 'manage_userfiles','files-add-files', 'manage_files_upload'); add_submenu_page('manage-files-main', __('Categories','userfiles'), __('Categories','userfiles'), 'manage_userfiles','files-add-cats', 'ShowCategories'); add_submenu_page('manage-files-main', __('Manage Icons','userfiles'), __('Manage Icons','userfiles'), 'manage_userfiles','files-add-icons', 'Icon_management'); add_submenu_page('manage-files-main', __('FTP Paths','userfiles'), __('FTP Paths','userfiles'), 'manage_userfiles','files-see-ftp', 'FTP_Paths'); add_submenu_page('manage-files-main', __('Help','userfiles'), __('Help','userfiles'), 'manage_userfiles','files-help-files', 'file_uploader_help'); $currOpts_menu = get_option('file_manger_show_menu'); if (!current_user_can('manage_userfiles') and $currOpts_menu==yes) { add_menu_page( __('Manage Files','userfiles'), __('Manage Files','userfiles'), 'read', 'manage-files-user', 'manage_files_user'); } } function manage_files_user() { global $wpdb; global $post; global $id; wp_enqueue_script('jquery'); wp_register_script( 'notepop', plugins_url( '/user-files/includes/js/divtoggle.js') ); wp_enqueue_script( 'notepop' ); $currOpts_credits = get_option('file_manger_credit'); $upload_dir = wp_upload_dir(); global $current_user; get_currentuserinfo(); if (isset($_GET['deletefile']) && empty($_POST['addfiles'])){ $isitGone = unlink($upload_dir['basedir'].'/file_uploads/'.$_GET['deletefile']); $toUsFl=explode ( "/" , $_GET['deletefile'] ); $wpdb->query("DELETE FROM ".$wpdb->prefix."userfile_data WHERE user_id ='" .$toUsFl[1]. "' AND filename ='".$toUsFl[2]."'"); if(!file_exists($upload_dir['basedir'].'/file_uploads/'.$_GET['deletefile'] )){ 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($_POST['addfiles'])){ $subDir=$current_user->ID; $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)) { echo '
'; echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded
"; $wpdb->insert( $wpdb->prefix . "userfile_data", array( 'id'=> '','user_id'=>$subDir,'category'=>$_POST['curr_cat'],'filename'=>basename( $_FILES['uploadedfile']['name'] ))); $DoMails = get_option('file_manger_notify'); if (!empty($DoMails)){ wp_mail( $DoMails, 'New file at '. get_option('blogname'), $current_user->user_login.' has just uploaded '. basename( $_FILES['uploadedfile']['name']) .' at '. get_option('blogname')); echo __('An adminisrator has successfully been notified of your upload.','userfiles'); } echo '
'; } else{ echo '
'; echo __('There was an error uploading the file, please try again!','userfiles')."
"; echo '
'; } } if($_POST['sorted']){ $user_file_search=$_POST['file_search']; $user_cat_sort= $_POST['showcatsfilter']; if($user_cat_sort=='chge'){ unset($user_cat_sort); } } echo ' '; ?>
Search: ---- ---- '; ?>
'; echo''; echo __('Your Files','userfiles'); echo 'DateCategory'; if ($handle = @opendir($upload_dir['basedir'].'/file_uploads/'.$current_user->ID)) { $rowClass=''; unset($found); $i=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){ ListUserFiles($file,$rowClass,$current_user->ID,$i); $found=true; } }elseif($user_cat_sort){ $isCat = CatFilter($file,$user_cat_sort,$current_user->ID); if($isCat){ ListUserFiles($file,$rowClass,$current_user->ID,$i); $found=true; } }else{ ListUserFiles($file,$rowClass,$current_user->ID,$i); } } } $i++; } 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 '
'; ?> '; } if ($currOpts_credits =='yes'){ echo '

 

'.userfiles_credit().'

'; } } ##################### # Category Filter # ##################### function CatFilter($file,$cate,$tUserid){ global $wpdb; if ($cate=='chge'){ return true; }else{ $currOpts_defcat = get_option('file_manger_defaultcat'); $IsaCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$file ."' and user_id='" .$tUserid. "' and category='".$cate."'"); if ($IsaCat == $cate) { return true; }else{ $IsNoCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$file ."' and user_id='" .$tUserid. "'"); if(empty($IsNoCat) && $currOpts_defcat==$cate){ return true; }else{ return false; } } } } function uploadHelper(){ if (isset($_POST['addfiles'])){ global $wpdb; $upload_dir = wp_upload_dir(); $current_user = wp_get_current_user(); $subDir = $current_user->ID; if (!empty($_POST['curr_cat'])){ $SetCat=$_POST['curr_cat']; }else{ $SetCat=$_POST['widge_cat']; } $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'=>$SetCat, 'filename'=>basename($_FILES['uploadedfile']['name']) ) ); $messageGo ='
'; $messageGo .= "Your file has been uploaded
"; $DoMails = get_option('file_manger_notify'); if (!empty($DoMails) && $DoMails != ""){ $url = $_SERVER['SERVER_NAME']; $headers[] ='From:"'.get_option('blogname').'" '; wp_mail($DoMails, __('A new file at','userfiles').' '. get_option('blogname'), $current_user->user_login.' '.__('has just uploaded','userfiles').' '. basename( $_FILES['uploadedfile']['name']) .' '.__('to category','userfiles').' '. $SetCat,$headers); $messageGo .= __('An administrator has successfully been notified of your upload.','userfiles'); } $messageGo .= '
'; }else{ $messageGo = '
'; $messageGo .= __('Error with file upload','userfiles'); $messageGo .= '
'; } $_POST['addfiles'] = $messageGo; } } function verifyInstall(){ global $instalVersion; $isInstallOK=get_option('file_manger_upgrade'); if ($isInstallOK!=$instalVersion){ ActivateFileDir(); update_option('file_manger_upgrade',$instalVersion); } } /* function file( $file_id ) { global $wpdb; $GatherFileData = $wpdb->get_var("SELECT * FROM ". $wpdb->prefix . "userfile_meta WHERE file_id = '".$file_id ."' "); $file_array = array(); while($rows = mysql_fetch_array($result)){ $tFile=$rows['meta_key']; $pt=$rows['meta_value']; $file_array[] = $tFile; } return $file_array; } */ ?>

M

get_results("SELECT * FROM ". $wpdb->prefix."userfile_category" ); ?> Category: