AnkietyGO/user-files/functions.php

1 line
21 KiB
PHP
Raw Normal View History

<?php ################ # Timestamp # ################ function GetTimeStamp($tFilePath, $tUserID) { $upload_dir = wp_upload_dir(); $absPt=$upload_dir['basedir'].'/file_uploads/'.$tUserID; $FileForTime = pathinfo($tFilePath, PATHINFO_BASENAME); $retDate = date ("F d Y", filemtime($absPt.'/'.$FileForTime)); return $retDate; } ########################## # List User Files # ########################## function ListUserFiles($Thefile,$TheClass,$userID,$fl) { global $wpdb; global $post; $ext = pathinfo($Thefile, PATHINFO_EXTENSION); $tExt = SetIcon($ext); echo '<tr><td class="'.$TheClass.'"><img src="'. $tExt.'" width="20" > '.pathinfo($Thefile, PATHINFO_FILENAME) .'</td>'; $getDescr= $wpdb->get_var("SELECT description FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile ."' and user_id='" .$userID. "'"); if(!empty($getDescr)){ //echo '<td class="'.$TheClass.'" id="ShowUFnotes" ><a href="javascript:void(0);" onclick="javascript:shownotes(\''.$getDescr.'\');">Show Notes</a></td>'; echo '<td class="'.$TheClass.'"> <a id="dLink'.$fl.'" href="javascript:void(0);" onclick="javascript:toggle2(\'dNotes'.$fl.'\',\'dLink'.$fl.'\');" >Show Notes</a> <div id="dNotes'.$fl.'" style="display:none;">'. $getDescr.'</div> </td>'; }else{ echo '<td class="'.$TheClass.'" >&nbsp;</td>'; } echo '<td class="'.$TheClass.'" >'. GetTimeStamp($Thefile,$userID) .'</td>'; echo '<td class="'.$TheClass.'">'; $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'</td>'; if(is_admin() ){ echo '<td class="'.$TheClass.'"><a href="admin.php?page=manage-files-user&theDLfile='.$userID.'/'.$Thefile.'" ><img title="Download '.$Thefile.'" src="'.plugins_url( '/user-files/img/download.png' , dirname(__FILE__) ). '" alt="" width="20" height="20" /></a> '; }else{ echo '<td class="'.$TheClass.'"><a href="'.site_url().'?p='.$post->ID.'&theDLfile='.$userID.'/'.$Thefile.'" ><img title="Download '.$Thefile.'" src="'.plugins_url( '/user-files/img/download.png' , dirname(__FILE__) ). '" alt="" width="20" height="20" /></a> '; } if(get_option('file_manger_allow_del')=='yes') { if(is_admin()){ echo ' | <a href="admin.php?page=manage-files-user&deletefile='.$userID.'/'.$Thefile.'"><img title="Delete '.$Thefile.'" src="'.plugins_url( '/user-files/img/delete.png ' , dirname(__FILE__) ). '" alt="" width="20" height="20" /></a>'; }else{ echo ' | <a href="'.site_url().'?p='.$post->ID.'&deletefile='.$userID.'/'.$Thefile.'"><img title="Delete '.$Thefile.'" src="'.plugins_url( '/user-files/img/delete.png ' , dirname(__FILE__) ). '" alt="" width="20" height="20" /></a> </td></tr>'; } }else{ echo '</form></td></tr>'; }//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 '<tr><td width="60%" ><input type="checkbox" name="change_cat'.$tp .'" value="addit" /> <input type="hidden" name="file'.$tp.'" value="'.$Thefile.'" ><input type="hidden" name="changecat_user'.$tp.'" value="'.$userNum.'"><img src="'. $tExt.'" width="20" > '.pathinfo($Thefile, PATHINFO_FILENAME) .'</td>'; $getDescr = $wpdb->get_var("SELECT description FROM ". $wpdb->prefix . "userfile_data WH