diff options
author | Camil Staps | 2016-08-01 11:30:19 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-01 11:30:19 +0200 |
commit | 8ee4336d778b2bdc1b8ba522d9251a4f664fe664 (patch) | |
tree | d704f32ee80088ba639ab51e5011932f9d45c747 | |
parent | Braintree status history (diff) |
Require paths
37 files changed, 66 insertions, 66 deletions
@@ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?> <div class="col-lg-12"> 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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?> <div class="col-lg-6 col-md-6"> 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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?> <div class="col-lg-7 col-md-7"> 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 <http://www.gnu.org/licenses/>. */ -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'); ?> <div id="wrapper"> @@ -95,5 +95,5 @@ require('./header.php'); <!-- /#wrapper --> <?php -require('./footer.php'); +require(__DIR__ . '/../footer.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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?> <div class="col-lg-12"> 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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -require_once('./login.php'); +require_once(__DIR__ . '/../login.php'); ?> <div class="col-lg-12"> 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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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 <http://www.gnu.org/licenses/>. */ -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(); @@ -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 <http://www.gnu.org/licenses/>. */ -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.'])); @@ -27,7 +27,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -require_once('./conf.php'); +require_once(__DIR__ . '/conf.php'); if (isset($_GET['logout'])) { $_SESSION['login'] = false; @@ -32,10 +32,12 @@ <!-- /.navbar-header --> <ul class="nav navbar-top-links navbar-right"> - <span> - Logged in as <a href="<?=Constants::url_internal?>/settings"><?=$_user->username?></a> - (<a href="<?=Constants::url_internal?>/?logout">logout</a>) - </span> + <?php if (isset($_user)) : ?> + <span> + Logged in as <a href="<?=Constants::url_internal?>/settings"><?=$_user->username?></a> + (<a href="<?=Constants::url_internal?>/?logout">logout</a>) + </span> + <?php endif; ?> <!-- /.dropdown --> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> |