-
Notifications
You must be signed in to change notification settings - Fork 3
/
common.php
36 lines (28 loc) · 955 Bytes
/
common.php
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
33
34
35
<?php
// OTAgo
// - OTA App Distribution System
// - https://github.com/DaveWoodCom/OTAgo
// - Copyright 2020 Dave Wood, Cerebral Gardens Inc.
$includePort = $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443;
$baseURL = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . ($includePort ? ':' . $_SERVER['SERVER_PORT'] : '') . '/';
function preventCaching() {
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
}
function requestBasicAuthentication($realm) {
header('WWW-Authenticate: Basic realm="' . $realm . '"');
http_response_code(401);
exit;
}
function returnInvalidConfiguration() {
http_response_code(501);
exit;
}
function makeURLQueryString($parameters, $joinString) {
$pairs = array();
foreach ($parameters as $name => $value) {
$pairs[] = urlencode($name) . '=' . urlencode($value);
}
return implode($joinString, $pairs);
}