From e057305351d93155bf9f0d2c664b6eb859d83bf4 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Mon, 16 Feb 2015 14:17:10 -0500 Subject: [PATCH] fix require_once() paths --- calendar.php | 2 +- db.php | 4 ++-- dwt.php | 2 +- examples/db_connect.php | 2 +- fdb.php | 4 ++-- format.php | 4 ++-- messages.php | 4 ++-- metaform.php | 8 ++++---- metaform/template.php | 8 ++++---- run.php | 14 +++++++------- run2.php | 6 +++--- session_messages.php | 6 +++--- template.php | 6 +++--- test/session_test.php | 4 ++-- test/session_test_db_connect.php | 2 +- test/tar_test.php | 2 +- test/tem_test.php | 2 +- unit_tests.php | 4 ++-- unit_tests/db.php | 2 +- unit_tests/encode.php | 2 +- unit_tests/format.php | 2 +- unit_tests/misc.php | 2 +- uploader.php | 8 ++++---- 23 files changed, 50 insertions(+), 50 deletions(-) diff --git a/calendar.php b/calendar.php index 0cdeab8..4966abb 100644 --- a/calendar.php +++ b/calendar.php @@ -35,7 +35,7 @@ -require_once(__DIR__ . '/template.php'); +require_once(__DIR__.'/'.'template.php'); function calendar_week(&$template) { $template->sub('week'); diff --git a/db.php b/db.php index 84b23aa..efefbda 100644 --- a/db.php +++ b/db.php @@ -16,8 +16,8 @@ # along with this program. If not, see . -require_once(__DIR__ . '/encode.php'); -require_once(__DIR__ . '/format.php'); +require_once(__DIR__.'/'.'encode.php'); +require_once(__DIR__.'/'.'format.php'); # db_connect() -- connect to a mysql database # diff --git a/dwt.php b/dwt.php index 9bdc5c6..44e0a63 100644 --- a/dwt.php +++ b/dwt.php @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -require_once(__DIR__ . '/file.php'); +require_once(__DIR__.'/'.'file.php'); function dwt_reset() { $GLOBALS['_dwt_keys'] = array(''); diff --git a/examples/db_connect.php b/examples/db_connect.php index ab5b597..655e9b9 100644 --- a/examples/db_connect.php +++ b/examples/db_connect.php @@ -1,6 +1,6 @@ section with a # ~message html~ tag in it. @@ -51,7 +51,7 @@ # # -require_once(__DIR__ . '/template.php'); +require_once(__DIR__.'/'.'template.php'); # call this to display a message function message($msg) { diff --git a/metaform.php b/metaform.php index b2944f2..2be93ea 100644 --- a/metaform.php +++ b/metaform.php @@ -18,10 +18,10 @@ # This file writes the code for you (sql, php, html, email) to handle a form. -require_once(__DIR__ . '/template.php'); -require_once(__DIR__ . '/http.php'); -require_once(__DIR__ . '/tar.php'); -require_once(__DIR__ . '/format.php'); +require_once(__DIR__.'/'.'template.php'); +require_once(__DIR__.'/'.'http.php'); +require_once(__DIR__.'/'.'tar.php'); +require_once(__DIR__.'/'.'format.php'); # see code/wfpl/metaform/template.html for the html templates for these elements $GLOBALS['types'] = array( diff --git a/metaform/template.php b/metaform/template.php index 041b857..759adb9 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -32,9 +32,9 @@ $GLOBALS['~name~_thumb_max_height'] = '70'; $GLOBALS['~name~_file_name'] = uniqid() . getmypid() . '.jpg'; # comment this out to use uploader's filename ~}~~}~ -require_once('code/wfpl/format.php'); -require_once('code/wfpl/email.php');~uploads_include {~ -require_once('code/wfpl/upload.php');~}~ +require_once(__DIR__.'/'.'code/wfpl/format.php'); +require_once(__DIR__.'/'.'code/wfpl/email.php');~uploads_include {~ +require_once(__DIR__.'/'.'code/wfpl/upload.php');~}~ $GLOBALS['~file_name~_field_to_caption'] = array(~name_to_caption {~ '~name~' => '~caption phpsq~'~ sep {~,~}~~}~ @@ -148,7 +148,7 @@ function ~file_name~_main_delete($id) { }~}~~opt_listing {~ function ~file_name~_csv_download() { - require_once('code/wfpl/csv.php'); + require_once(__DIR__.'/'.'code/wfpl/csv.php'); $rows = db_get_rows('~table_name~', 'id,'.~file_name upper~_DB_FIELDS, 'order by id'); $fields = explode(',', 'id,'.~file_name upper~_DB_FIELDS); $header = array(); diff --git a/run.php b/run.php index a310e3f..8cf9d4d 100644 --- a/run.php +++ b/run.php @@ -41,12 +41,12 @@ # RewriteRule ^$ /foo/run.php # RewriteRule ^foo/[^/]*\.html$ /foo/run.php -require_once('code/wfpl/file_run.php'); -require_once('code/wfpl/http.php'); -require_once('code/wfpl/template.php'); +require_once(__DIR__.'/'.'code/wfpl/file_run.php'); +require_once(__DIR__.'/'.'code/wfpl/http.php'); +require_once(__DIR__.'/'.'code/wfpl/template.php'); -if(file_exists('code/config.php')) { - file_run('code/config.php'); +if(file_exists(__DIR__.'/'.'code/config.php')) { + file_run(__DIR__.'/'.'code/config.php'); } # pass the basename of the page you want for normal execution @@ -156,8 +156,8 @@ function run_php($dest = false) { } - # You'll probably want to require_once('code/wfpl/messages.php') or - # require_once('code/wfpl/session_messages.php') in code/config.php + # You'll probably want to require_once(__DIR__.'/'.'code/wfpl/messages.php') or + # require_once(__DIR__.'/'.'code/wfpl/session_messages.php') in code/config.php if(function_exists('display_messages')) { if(function_exists('atexit_now')) { atexit_now(); diff --git a/run2.php b/run2.php index 5e23216..abe0dfa 100644 --- a/run2.php +++ b/run2.php @@ -41,9 +41,9 @@ # RewriteRule ^$ /foo/run.php # RewriteRule ^foo/[^/]*\.html$ /foo/run.php -require_once('code/wfpl/file_run.php'); -require_once('code/wfpl/http.php'); -require_once('code/wfpl/template.php'); +require_once(__DIR__.'/'.'code/wfpl/file_run.php'); +require_once(__DIR__.'/'.'code/wfpl/http.php'); +require_once(__DIR__.'/'.'code/wfpl/template.php'); if(file_exists('code/config.php')) { file_run('code/config.php'); diff --git a/session_messages.php b/session_messages.php index d2e57b6..cefe24f 100644 --- a/session_messages.php +++ b/session_messages.php @@ -23,9 +23,9 @@ # see messages.php for documentation on how to use it. -require_once(__DIR__ . '/session.php'); -require_once(__DIR__ . '/string_array.php'); -require_once(__DIR__ . '/messages.php'); +require_once(__DIR__.'/'.'session.php'); +require_once(__DIR__.'/'.'string_array.php'); +require_once(__DIR__.'/'.'messages.php'); function session_save_messages() { if(!isset($GLOBALS['wfpl_messages'])) { diff --git a/template.php b/template.php index 5d35ff7..06d02f5 100644 --- a/template.php +++ b/template.php @@ -37,9 +37,9 @@ # tem_auto_* function to munge the data, automating certain common use # cases. See the comments on the tem_auto functions for more details. -require_once(__DIR__ . '/encode.php'); -require_once(__DIR__ . '/file.php'); -require_once(__DIR__ . '/misc.php'); +require_once(__DIR__.'/'.'encode.php'); +require_once(__DIR__.'/'.'file.php'); +require_once(__DIR__.'/'.'misc.php'); # Top-Level Functions diff --git a/test/session_test.php b/test/session_test.php index 8defd9e..dea3291 100644 --- a/test/session_test.php +++ b/test/session_test.php @@ -18,8 +18,8 @@ # WARNING: this code deletes all wfpl sessions. Do not use on a live site's database ############## -require_once('code/wfpl/test/session_test_db_connect.php'); -require_once('code/wfpl/session.php'); +require_once(__DIR__.'/'.'code/wfpl/test/session_test_db_connect.php'); +require_once(__DIR__.'/'.'code/wfpl/session.php'); function session_dump($message) { $ses = db_get_rows('wfpl_sessions', 'id,session_key,length,expires'); diff --git a/test/session_test_db_connect.php b/test/session_test_db_connect.php index 71090a2..54e10f4 100644 --- a/test/session_test_db_connect.php +++ b/test/session_test_db_connect.php @@ -1,6 +1,6 @@ . -require_once(__DIR__ . '/template.php'); -require_once(__DIR__ . '/encode.php'); -require_once(__DIR__ . '/session.php'); -require_once(__DIR__ . '/upload.php'); # FIXME for path_to() which should be somewhere else +require_once(__DIR__.'/'.'template.php'); +require_once(__DIR__.'/'.'encode.php'); +require_once(__DIR__.'/'.'session.php'); +require_once(__DIR__.'/'.'upload.php'); # FIXME for path_to() which should be somewhere else # This function is for making an uploader with a progress bar. # -- 1.7.10.4