From 8ee4336d778b2bdc1b8ba522d9251a4f664fe664 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 1 Aug 2016 11:30:19 +0200 Subject: Require paths --- conf.php | 10 ++++------ include/404.php | 2 +- include/about.php | 4 ++-- include/ajax-email-offer.php | 2 +- include/assignments-edit.php | 4 ++-- include/assignments-new.php | 4 ++-- include/assignments-overview.php | 2 +- include/assignments-view.php | 2 +- include/assignments.php | 4 ++-- include/clients-edit.php | 4 ++-- include/clients-new.php | 4 ++-- include/clients-overview.php | 2 +- include/clients-view.php | 2 +- include/clients.php | 4 ++-- include/contacts-edit.php | 4 ++-- include/contacts-new.php | 4 ++-- include/contacts-overview.php | 2 +- include/contacts.php | 8 ++++---- include/discounts-edit.php | 4 ++-- include/discounts-new.php | 4 ++-- include/discounts-overview.php | 2 +- include/discounts.php | 4 ++-- include/file-get.php | 2 +- include/home.php | 4 ++-- include/offers-edit.php | 4 ++-- include/offers-new.php | 4 ++-- include/offers-overview.php | 2 +- include/offers-view.php | 2 +- include/offers.php | 4 ++-- include/pay.php | 2 +- include/settings.php | 4 ++-- include/users-new.php | 4 ++-- index.php | 2 +- install/upgrade.php | 2 +- login-ajax.php | 2 +- login.php | 2 +- nav.php | 10 ++++++---- 37 files changed, 66 insertions(+), 66 deletions(-) diff --git a/conf.php b/conf.php index 4754a6d..66e366d 100644 --- a/conf.php +++ b/conf.php @@ -33,10 +33,10 @@ ini_set('display_errors', 0); set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); -require_once('conf.private.php'); +require_once(__DIR__ . '/conf.private.php'); spl_autoload_register(function ($pClass) { - $path = dirname(__FILE__) . "/classes/$pClass.php"; + $path = __DIR__ . "/classes/$pClass.php"; if (file_exists($path)) { require_once($path); } @@ -52,14 +52,12 @@ try { } if (BRAINTREE_ENABLED) { - require_once('modules/braintree/lib/Braintree.php'); + require_once(__DIR__ . '/modules/braintree/lib/Braintree.php'); Braintree_Configuration::environment(BRAINTREE_ENVIRONMENT); Braintree_Configuration::merchantId(BRAINTREE_MERCHANT); Braintree_Configuration::publicKey(BRAINTREE_KEY_PUBLIC); Braintree_Configuration::privateKey(BRAINTREE_KEY_PRIVATE); - - require_once('modules/PHPMailer/PHPMailerAutoload.php'); } -require_once('classes/Calculatable.php'); // Some definitions that are required +require_once(__DIR__ . '/modules/PHPMailer/PHPMailerAutoload.php'); diff --git a/include/404.php b/include/404.php index dc0cff0..9ac783f 100644 --- a/include/404.php +++ b/include/404.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./index.php'); +require_once(__DIR__ . '/../index.php'); require('./header.php'); ?> diff --git a/include/about.php b/include/about.php index c2eb179..733bf5d 100644 --- a/include/about.php +++ b/include/about.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/ajax-email-offer.php b/include/ajax-email-offer.php index 3960d37..c8a09c0 100644 --- a/include/ajax-email-offer.php +++ b/include/ajax-email-offer.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../login-ajax.php'); $_offer = new Offer($_pdo, $_REQUEST['id']); $_mailer = $_offer->mailer(); diff --git a/include/assignments-edit.php b/include/assignments-edit.php index b51eab6..44c71c0 100644 --- a/include/assignments-edit.php +++ b/include/assignments-edit.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); $response->success = true; diff --git a/include/assignments-new.php b/include/assignments-new.php index 932e200..42a69b5 100644 --- a/include/assignments-new.php +++ b/include/assignments-new.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/assignments-overview.php b/include/assignments-overview.php index a558062..2c2c115 100644 --- a/include/assignments-overview.php +++ b/include/assignments-overview.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?>
diff --git a/include/assignments-view.php b/include/assignments-view.php index 434a2f0..9233f4c 100644 --- a/include/assignments-view.php +++ b/include/assignments-view.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); $_assignment = new Assignment($_pdo, $_id); ?> diff --git a/include/assignments.php b/include/assignments.php index 32e0c20..9f5526f 100644 --- a/include/assignments.php +++ b/include/assignments.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/clients-edit.php b/include/clients-edit.php index ded72d2..a0b164b 100644 --- a/include/clients-edit.php +++ b/include/clients-edit.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/clients-new.php b/include/clients-new.php index fcb619e..5032982 100644 --- a/include/clients-new.php +++ b/include/clients-new.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/clients-overview.php b/include/clients-overview.php index e714304..ce23058 100644 --- a/include/clients-overview.php +++ b/include/clients-overview.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?>
diff --git a/include/clients-view.php b/include/clients-view.php index 4f27046..cdd2c4d 100644 --- a/include/clients-view.php +++ b/include/clients-view.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); $_client = new Client($_pdo, $_id); ?> diff --git a/include/clients.php b/include/clients.php index 1e7110b..1823bde 100644 --- a/include/clients.php +++ b/include/clients.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/contacts-edit.php b/include/contacts-edit.php index a0ffdee..b5237b8 100644 --- a/include/contacts-edit.php +++ b/include/contacts-edit.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); $response->success = true; diff --git a/include/contacts-new.php b/include/contacts-new.php index b671be4..30fe5b2 100644 --- a/include/contacts-new.php +++ b/include/contacts-new.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/contacts-overview.php b/include/contacts-overview.php index 5f08bf2..73cd5cd 100644 --- a/include/contacts-overview.php +++ b/include/contacts-overview.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?>
diff --git a/include/contacts.php b/include/contacts.php index 28656c9..2c9ba2f 100644 --- a/include/contacts.php +++ b/include/contacts.php @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); -require('./header.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); +require(__DIR__ . '/../header.php'); ?>
@@ -95,5 +95,5 @@ require('./header.php'); diff --git a/include/discounts-edit.php b/include/discounts-edit.php index 94f4c29..5c3ce8f 100644 --- a/include/discounts-edit.php +++ b/include/discounts-edit.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); $response->success = true; diff --git a/include/discounts-new.php b/include/discounts-new.php index 2d7fca5..fd30215 100644 --- a/include/discounts-new.php +++ b/include/discounts-new.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/discounts-overview.php b/include/discounts-overview.php index 34f5016..c6c3421 100644 --- a/include/discounts-overview.php +++ b/include/discounts-overview.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?>
diff --git a/include/discounts.php b/include/discounts.php index 5da2dc4..1dae146 100644 --- a/include/discounts.php +++ b/include/discounts.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/file-get.php b/include/file-get.php index b3f575d..c04b378 100644 --- a/include/file-get.php +++ b/include/file-get.php @@ -24,7 +24,7 @@ * along with this program. If not, see . */ -require_once('./conf.php'); +require_once(__DIR__ . '/../conf.php'); $filename = $_REQUEST['name']; $filepath = Constants::files_folder . $filename; diff --git a/include/home.php b/include/home.php index 9fac972..2b64290 100644 --- a/include/home.php +++ b/include/home.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/offers-edit.php b/include/offers-edit.php index 761b3ee..7a42f2f 100644 --- a/include/offers-edit.php +++ b/include/offers-edit.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); $response->success = true; diff --git a/include/offers-new.php b/include/offers-new.php index e93d01f..259509d 100644 --- a/include/offers-new.php +++ b/include/offers-new.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/include/offers-overview.php b/include/offers-overview.php index 29b52b3..65aea29 100644 --- a/include/offers-overview.php +++ b/include/offers-overview.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?>
diff --git a/include/offers-view.php b/include/offers-view.php index 5dee452..ec7acf9 100644 --- a/include/offers-view.php +++ b/include/offers-view.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); $_offer = new Offer($_pdo, $_id); ?> diff --git a/include/offers.php b/include/offers.php index 22bd332..6379f62 100644 --- a/include/offers.php +++ b/include/offers.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/pay.php b/include/pay.php index 69626ea..a30c67a 100644 --- a/include/pay.php +++ b/include/pay.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -require_once('./index.php'); +require_once(__DIR__ . '/../index.php'); require('./header.php'); ?> diff --git a/include/settings.php b/include/settings.php index 23d6371..865229d 100644 --- a/include/settings.php +++ b/include/settings.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -require_once('./index.php'); -require_once('./login.php'); +require_once(__DIR__ . '/../index.php'); +require_once(__DIR__ . '/../login.php'); require('./header.php'); ?> diff --git a/include/users-new.php b/include/users-new.php index cc01af8..a3bc3e2 100644 --- a/include/users-new.php +++ b/include/users-new.php @@ -19,8 +19,8 @@ define('REQUIRE_ADMIN', true); -require_once('./conf.php'); -require_once('./login-ajax.php'); +require_once(__DIR__ . '/../conf.php'); +require_once(__DIR__ . '/../login-ajax.php'); $response = new Response(); diff --git a/index.php b/index.php index 4467853..0a27ed1 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ /** * Load the basic configuration (sessions, database, class autoloading, etc.) */ -require_once('./conf.php'); +require_once(__DIR__ . '/conf.php'); // Fetch information from the REQUEST_URI. $_request = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); diff --git a/install/upgrade.php b/install/upgrade.php index c759df0..7caf46e 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -20,7 +20,7 @@ error_reporting(E_ALL); ini_set('display_errors', 1); -require('../conf.php'); +require(__DIR__ . '/../conf.php'); function lower_version($that, $new) { $that = explode('.', $that); diff --git a/login-ajax.php b/login-ajax.php index baab859..8b4f4cb 100644 --- a/login-ajax.php +++ b/login-ajax.php @@ -27,7 +27,7 @@ * along with this program. If not, see . */ -require_once('./conf.php'); +require_once(__DIR__ . '/conf.php'); if (!isset($_SESSION['login']) || $_SESSION['login'] === false) { print(json_encode(['success' => false, 'message' => 'You need to be logged in.'])); diff --git a/login.php b/login.php index c902b10..ec223a5 100644 --- a/login.php +++ b/login.php @@ -27,7 +27,7 @@ * along with this program. If not, see . */ -require_once('./conf.php'); +require_once(__DIR__ . '/conf.php'); if (isset($_GET['logout'])) { $_SESSION['login'] = false; diff --git a/nav.php b/nav.php index 22875cb..d5995fc 100644 --- a/nav.php +++ b/nav.php @@ -32,10 +32,12 @@