From: Jason Woofenden Date: Fri, 14 Oct 2011 00:14:32 +0000 (-0400) Subject: added admin_files, s/this_host/$host/, etc X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl-cms.git;a=commitdiff_plain;h=be246293072b9e3b10aa10219dbfcb575cc955a8 added admin_files, s/this_host/$host/, etc --- diff --git a/Makefile b/Makefile index 9eeb0f4..11039bc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ all: style.css tags +init: files cms_images all + +files: + mkdir -m 777 $@ + +cms_images: + mkdir -m 777 $@ + tags: *.php code/*.php code/wfpl/*.php exuberant-ctags *.php code/*.php code/wfpl/*.php diff --git a/admin.html b/admin.html index cf25af3..c89654e 100644 --- a/admin.html +++ b/admin.html @@ -2,17 +2,19 @@ - <!--~$title show {~-->~this_host~ Administration<!--~}~--> + <!--~$title show {~-->~$host~ Administration<!--~}~--> -

~this_host~ Administration

+

~$host~ Administration

-

Upload/edit images

+

Manage images

-

Add/edit pages

+

Manage pages

+ +

Manage (downloadable) files

Log out

diff --git a/admin.php b/admin.php index 8c115ce..8442e97 100644 --- a/admin.php +++ b/admin.php @@ -7,5 +7,4 @@ function admin_main() { $_REQUEST['url'] = this_url(); return 'admin_login'; } - tem_set('this_host', this_host()); } diff --git a/admin_files.html b/admin_files.html index 180d515..172ad09 100644 --- a/admin_files.html +++ b/admin_files.html @@ -15,10 +15,11 @@
-
Filename
+
File
-
Description
+
Description (optional)
+
The files admin page sorts by this, so you can find your files.
 
@@ -34,12 +35,14 @@

Files Listing

+

The value in the "Path" column below can be pasted into the "URL" field of the link dialog on the page editor. Be sure to set the "protocol" pulldown there to "other". To link to a file from any other website (or e-mail, etc) create the full address by prefixing it with "http://~$host~"

+

[Add a new file]

- + - + 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); } diff --git a/admin_login.html b/admin_login.html index 1cb44ce..4dc10b7 100644 --- a/admin_login.html +++ b/admin_login.html @@ -2,13 +2,13 @@ - <!--~$title show {~-->~this_host~ Admin Login<!--~}~--> + <!--~$title show {~-->~$host~ Admin Login<!--~}~--> -

~this_host~ Admin Login

+

~$host~ Admin Login

Username (case sensitive)
diff --git a/admin_login.php b/admin_login.php index a3d47ce..92d3ab6 100644 --- a/admin_login.php +++ b/admin_login.php @@ -40,9 +40,6 @@ function admin_login_main() { # Don't put (even failed) password back into the form $data['password'] = ''; - # include domain name in title (especially for bookmarks) and header - tem_set('this_host', this_host()); - # display the form [again] tem_set('form', $data); } diff --git a/admin_pages.html b/admin_pages.html index 9f769b3..f72d501 100644 --- a/admin_pages.html +++ b/admin_pages.html @@ -3,7 +3,7 @@ - <!--~$title show {~-->~this_host~ Admin: <!--~listings {~-->Pages Listing<!--~}~--><!--~form {~--><!--~id {~-->Add a new page<!--~}~--><!--~id unset {~-->Edit page "~title html~"<!--~}~--><!--~}~--><!--~}~--> + <!--~$title show {~-->~$host~ Admin: <!--~listings {~-->Pages Listing<!--~}~--><!--~form {~--><!--~id {~-->Add a new page<!--~}~--><!--~id unset {~-->Edit page "~title html~"<!--~}~--><!--~}~--><!--~}~-->
FilenameDescription 
PathDescription 
~filename html~(blank)/~filename html~(blank) ~description html~(blank) [delete this file]