JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix require_once() paths
authorJason Woofenden <jason@jasonwoof.com>
Mon, 16 Feb 2015 19:17:10 +0000 (14:17 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Mon, 16 Feb 2015 19:18:11 +0000 (14:18 -0500)
23 files changed:
calendar.php
db.php
dwt.php
examples/db_connect.php
fdb.php
format.php
messages.php
metaform.php
metaform/template.php
run.php
run2.php
session_messages.php
template.php
test/session_test.php
test/session_test_db_connect.php
test/tar_test.php
test/tem_test.php
unit_tests.php
unit_tests/db.php
unit_tests/encode.php
unit_tests/format.php
unit_tests/misc.php
uploader.php

index 0cdeab8..4966abb 100644 (file)
@@ -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 (file)
--- a/db.php
+++ b/db.php
@@ -16,8 +16,8 @@
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-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 (file)
--- 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 <http://www.gnu.org/licenses/>.
 
-require_once(__DIR__ . '/file.php');
+require_once(__DIR__.'/'.'file.php');
 
 function dwt_reset() {
        $GLOBALS['_dwt_keys'] = array('<!-- TemplateEndEditable -->');
index ab5b597..655e9b9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once('code/wfpl/db.php');
+require_once(__DIR__.'/'.'code/wfpl/db.php');
 
 # fill in whatever database credentials you need here:
 db_connect('database_name', 'username', 'password', 'host');
diff --git a/fdb.php b/fdb.php
index d008cec..c36c712 100644 (file)
--- a/fdb.php
+++ b/fdb.php
@@ -29,8 +29,8 @@
 # fdb_set_dir() passing the path to that directory.
 
 
-require_once(__DIR__ . '/file.php');
-require_once(__DIR__ . '/binary.php');
+require_once(__DIR__.'/'.'file.php');
+require_once(__DIR__.'/'.'binary.php');
 
 # call this to set what directory is used to store the files
 function fdb_set_dir($dir) {
index 28c555d..c913864 100644 (file)
@@ -302,13 +302,13 @@ function format_dollars($str) {
 # date is edited as mm/dd/yyyy but stored as yyyy-mm-dd
 function format_mdy_to_ymd($str) {
        if($str == '') return '';
-       require_once(__DIR__ . '/time.php');
+       require_once(__DIR__.'/'.'time.php');
        return mdy_to_ymd(format_oneline($str));
 }
 
 # date is yyyy-mm-dd
 function format_ymd($str) {
-       require_once(__DIR__ . '/time.php');
+       require_once(__DIR__.'/'.'time.php');
        list($year, $month, $day) = ymd_clean($str);
        return sprintf('%04u-%02u-%02u', $year, $month, $day);
 }
index 98ada56..41d4a56 100644 (file)
@@ -27,7 +27,7 @@
 # display_messages() for you automaticallly after your main function returns
 # (so long as you require_once this file.) If you want these messages to
 # persist accross browser redirects, then you should
-# require_once("code/wfpl/session_messages.php")
+# require_once(__DIR__.'/'.'code/wfpl/session_messages.php')
 #
 # Just make sure your template has a <!--~$messages {~--> section with a
 # ~message html~ tag in it.
@@ -51,7 +51,7 @@
 #       </div>
 #    <!--~}~-->
 
-require_once(__DIR__ . '/template.php');
+require_once(__DIR__.'/'.'template.php');
 
 # call this to display a message
 function message($msg) {
index b2944f2..2be93ea 100644 (file)
 
 # 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(
index 041b857..759adb9 100644 (file)
@@ -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 (file)
--- a/run.php
+++ b/run.php
 # 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();
index 5e23216..abe0dfa 100644 (file)
--- 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');
index d2e57b6..cefe24f 100644 (file)
@@ -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'])) {
index 5d35ff7..06d02f5 100644 (file)
@@ -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
index 8defd9e..dea3291 100644 (file)
@@ -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');
index 71090a2..54e10f4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once('code/wfpl/db.php');
+require_once(__DIR__.'/'.'code/wfpl/db.php');
 
 db_connect('DATABASE_NAME', 'USERNAME', 'PASSWORD');
 
index 59cdf99..3c28d40 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once('code/wfpl/tar.php');
+require_once(__DIR__.'/'.'code/wfpl/tar.php');
 
 # Unfortunately, I don't know how to set the suggested filename for downloads,
 # so you'll have to deal with that yourself.
index f036c87..2a8ef27 100644 (file)
@@ -7,7 +7,7 @@
 # the template system.
 
 # First we'll need the functions in wfpl/template.php:
-require_once('code/wfpl/template.php');
+require_once(__DIR__.'/'.'code/wfpl/template.php');
 # Always use the exact require_once statement above to get access to these
 # functions. You should have in each directory of your projects a copy of wfpl
 # or a symbolic link to it. This allows there to be different versions of wfpl
index ee62e20..3577664 100644 (file)
@@ -18,8 +18,8 @@
 
 # This file is for running unit tests. Either on wfpl or your own code.
 
-require_once('code/wfpl/template.php');
-require_once('code/wfpl/messages.php');
+require_once(__DIR__.'/'.'code/wfpl/template.php');
+require_once(__DIR__.'/'.'code/wfpl/messages.php');
 
 # call this to declare that a unit test has passed
 function unit_test_passed($msg) {
index 569ed0e..5fd4a49 100644 (file)
@@ -21,7 +21,7 @@
 # See code/wfpl/test.php for details on how to run or create tests
 
 
-require_once('code/wfpl/db.php');
+require_once(__DIR__.'/'.'code/wfpl/db.php');
 
 function test_db_reposition($table = 'reposition') {
        db_delete($table);
index 3703c3e..911a8af 100644 (file)
@@ -21,7 +21,7 @@
 # See code/wfpl/test.php for details on how to run or create tests
 
 
-require_once('code/wfpl/encode.php');
+require_once(__DIR__.'/'.'code/wfpl/encode.php');
 
 function _test_encode_pulled($field, $value, $correct) {
        unit_test_func('enc_pulled', $value, $field, $correct);
index 2e6ecb6..5ccb154 100644 (file)
@@ -21,7 +21,7 @@
 # See code/wfpl/test.php for details on how to run or create tests
 
 
-require_once('code/wfpl/format.php');
+require_once(__DIR__.'/'.'code/wfpl/format.php');
 
 function _test_format_money($arg, $dollars_correct, $money_correct) {
        unit_test_func('format_dollars', $arg, $dollars_correct);
index 1125ed1..71fa7f9 100644 (file)
@@ -21,7 +21,7 @@
 # See code/wfpl/unit_tests.php for details on how to run or create tests
 
 
-require_once('code/wfpl/misc.php');
+require_once(__DIR__.'/'.'code/wfpl/misc.php');
 
 function test_ordinalize() {
        $tests = array(
index 5672936..a793385 100644 (file)
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-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.
 #