forked from Apps/WebAppTemplate
Remove is_empty()
This commit is contained in:
parent
32cd18933d
commit
13b60de915
42
required.php
42
required.php
@ -132,16 +132,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
define("GET", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Checks if a string or whatever is empty.
|
||||
* @param $str The thingy to check
|
||||
* @return boolean True if it's empty or whatever.
|
||||
*/
|
||||
function is_empty($str) {
|
||||
return (is_null($str) || !isset($str) || $str == '');
|
||||
}
|
||||
|
||||
|
||||
function dieifnotloggedin() {
|
||||
if ($_SESSION['loggedin'] != true) {
|
||||
@ -166,38 +156,6 @@ function checkDBError($specials = []) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* http://stackoverflow.com/a/20075147
|
||||
*/
|
||||
if (!function_exists('base_url')) {
|
||||
|
||||
function base_url($atRoot = FALSE, $atCore = FALSE, $parse = FALSE) {
|
||||
if (isset($_SERVER['HTTP_HOST'])) {
|
||||
$http = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
|
||||
$hostname = $_SERVER['HTTP_HOST'];
|
||||
$dir = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
|
||||
|
||||
$core = preg_split('@/@', str_replace($_SERVER['DOCUMENT_ROOT'], '', realpath(dirname(__FILE__))), NULL, PREG_SPLIT_NO_EMPTY);
|
||||
$core = $core[0];
|
||||
|
||||
$tmplt = $atRoot ? ($atCore ? "%s://%s/%s/" : "%s://%s/") : ($atCore ? "%s://%s/%s/" : "%s://%s%s");
|
||||
$end = $atRoot ? ($atCore ? $core : $hostname) : ($atCore ? $core : $dir);
|
||||
$base_url = sprintf($tmplt, $http, $hostname, $end);
|
||||
} else
|
||||
$base_url = 'http://localhost/';
|
||||
|
||||
if ($parse) {
|
||||
$base_url = parse_url($base_url);
|
||||
if (isset($base_url['path']))
|
||||
if ($base_url['path'] == '/')
|
||||
$base_url['path'] = '';
|
||||
}
|
||||
|
||||
return $base_url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function redirectIfNotLoggedIn() {
|
||||
if ($_SESSION['loggedin'] !== TRUE) {
|
||||
header('Location: ' . URL . '/index.php');
|
||||
|
Loading…
x
Reference in New Issue
Block a user