forked from AcuityScheduling/acuity-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.php
More file actions
32 lines (25 loc) · 677 Bytes
/
Copy pathutils.php
File metadata and controls
32 lines (25 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
function loadConfig ($file) {
$file = $file ? $file : __DIR__.DIRECTORY_SEPARATOR.'config.json';
if (!file_exists($file)) {
throw new Exception("Please add the config file {$file}");
}
$contents = file_get_contents($file);
$config = json_decode($contents, true);
if ($config === null) {
throw new Exception("The config file {$file} doesn't appear to be valid JSON!");
}
return $config;
}
function handle404 () {
header("HTTP/1.0 404 Not Found");
}
function getRouteInfo () {
return array(
$_SERVER['REQUEST_METHOD'],
$_SERVER['PATH_INFO'] ? $_SERVER['PATH_INFO'] : '/'
);
}
// Start a session:
ini_set('session.save_path', '');
session_start();