X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=admin_files.php;h=56db7ca98ffc9cc2adf5ecd8675fd461cd53fd25;hb=be246293072b9e3b10aa10219dbfcb575cc955a8;hp=56a78ae84b9d5aa51fb99cf95204d95e59831738;hpb=e973f07f6b4a143c330884908082fdc1c7c4e32f;p=wfpl-cms.git diff --git a/admin_files.php b/admin_files.php index 56a78ae..56db7ca 100644 --- a/admin_files.php +++ b/admin_files.php @@ -21,9 +21,10 @@ define('ADMIN_FILES_DB_FIELDS', 'filename,description'); # Set this to the path to your uploads directory. It can be relative to the # location of this script. IT MUST END WITH A SLASH -$GLOBALS['upload_directory'] = 'uploads/'; +$GLOBALS['upload_directory'] = 'files/'; -$GLOBALS['filename_file_name'] = uniqid() . getmypid() . '.txt'; # comment this out to use uploader's filename +# emergency backup in case uploaders file name is blank somehow +$GLOBALS['filename_file_name'] = uniqid() . getmypid() . '.txt'; require_once('code/wfpl/format.php'); @@ -35,9 +36,12 @@ function admin_files_get_fields() { $data['description'] = format_oneline(_REQUEST_cut('description')); - $filename_filename_tmp = $GLOBALS['filename_file_name']; + #header('Content-Type: text/plain'); + #print_r(array($_REQUEST['filename'], $_FILES['filename'])); + #exit(); + $filename_filename_tmp = format_filename($_FILES['filename']['name']); if(!$filename_filename_tmp) { - $filename_filename_tmp = format_filename(_REQUEST_cut('filename')); + $filename_filename_tmp = $GLOBALS['filename_file_name']; } if($_FILES['filename'] && $_FILES['filename']['error'] == 0) { $data['filename'] = save_uploaded_file('filename', $GLOBALS['upload_directory'] . $filename_filename_tmp); @@ -95,7 +99,7 @@ function admin_files_main_delete($id) { } function admin_files_main_listing() { - $listing_rows = db_get_assocs('files', 'id,filename,description', 'order by description limit 100'); + $listing_rows = db_get_assocs('files', 'id,filename,description', 'order by coalesce(nullif(description, ""), substring(filename, 7)) limit 100'); tem_set('listings', $listing_rows); }