JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
first stab at paypal_ipn framework
[wfpl-cms.git] / admin_files.php
index 034cfdf..1531d9f 100644 (file)
@@ -1,21 +1,6 @@
 <?php
 
-# This form requires wfpl. See: http://jasonwoof.org/wfpl
-
-# This form was initially auto-generated. If you would like to alter the
-# parameters and generate a new one try this URL:
-#
-# http://metaform.l/?file_name=admin_files&table_name=files&singular=file&plural=files&opt_email=No&opt_db=Yes&opt_listing=Yes&opt_display=No&opt_pass=Yes&opt_public_form=No&opt_public_display=No&fields=filename+file%0D%0Adescription+textbox&edit=yes
-
-
-# SETUP
-
-# To save results to a database, you'll need to create the files table
-# (the file admin_files.sql should help with this), and create the file
-# 'code/db_connect.php' which calls db_connect() see:
-# code/wfpl/examples/db_connect.php
-#
-# if you rename any of the database fields, you'll need to update this:
+# This form requires wfpl. See: http://sametwice.com/wfpl
 
 define('ADMIN_FILES_DB_FIELDS', 'filename,description');
 
@@ -27,9 +12,9 @@ $GLOBALS['upload_directory'] = 'files/';
 $GLOBALS['filename_file_name'] = uniqid() . getmypid() . '.txt';
 
 
-require_once('code/wfpl/format.php');
-require_once('code/wfpl/email.php');
-require_once('code/wfpl/upload.php');
+require_once(DOCROOT . 'inc/wfpl/format.php');
+require_once(DOCROOT . 'inc/wfpl/email.php');
+require_once(DOCROOT . 'inc/wfpl/upload.php');
 
 function admin_files_get_fields() {
        $data = array();
@@ -59,12 +44,7 @@ function admin_files_get_fields() {
 
 
 function admin_files_main() {
-       if(logged_in_as_admin()) {
-               tem_set('admin_privs');
-       } else {
-               $_REQUEST['url'] = this_url();
-               return 'admin_login';
-       }
+       session_auth_must('manage_files');
 
        $id = _REQUEST_cut('edit_id');
        if($id) {