summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-09-06 20:12:04 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-09-06 20:12:04 +1000
commit7f0de936082fb35d4e18fbadfe9849acdfc03ab6 (patch)
tree37bc90513d794dbe804aae05837109af00e035be
parent8a244ab61e7e45f65667a8330b5d61fe918bffb2 (diff)
Cleaner check to make sure inc/ files aren't accessed directly.
-rw-r--r--inc/anti-bot.php5
-rw-r--r--inc/api.php1
-rw-r--r--inc/cache.php5
-rw-r--r--inc/database.php5
-rw-r--r--inc/events.php5
-rw-r--r--inc/filters.php5
-rw-r--r--inc/functions.php2
-rw-r--r--inc/image.php5
-rw-r--r--inc/mod/auth.php5
-rw-r--r--inc/mod/pages.php5
-rw-r--r--inc/remote.php5
-rw-r--r--inc/template.php5
12 files changed, 13 insertions, 40 deletions
diff --git a/inc/anti-bot.php b/inc/anti-bot.php
index 41e0a1d6..dbe87e2b 100644
--- a/inc/anti-bot.php
+++ b/inc/anti-bot.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
$hidden_inputs_twig = array();
diff --git a/inc/api.php b/inc/api.php
index a8331590..74043912 100644
--- a/inc/api.php
+++ b/inc/api.php
@@ -3,6 +3,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
+defined('TINYBOARD') or exit;
/**
* Class for generating json API compatible with 4chan API
diff --git a/inc/cache.php b/inc/cache.php
index 2f3c746c..95b1281f 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
class Cache {
private static $cache;
diff --git a/inc/database.php b/inc/database.php
index 55e1ff81..d2f1af04 100644
--- a/inc/database.php
+++ b/inc/database.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
class PreparedQueryDebug {
protected $query;
diff --git a/inc/events.php b/inc/events.php
index cc330dfb..e5a1e036 100644
--- a/inc/events.php
+++ b/inc/events.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
function event() {
global $events;
diff --git a/inc/filters.php b/inc/filters.php
index cd512821..253a86b6 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
class Filter {
private $condition;
diff --git a/inc/functions.php b/inc/functions.php
index 918a6ea9..9601c0f8 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -9,6 +9,8 @@ if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
exit;
}
+define('TINYBOARD', null);
+
$microtime_start = microtime(true);
require_once 'inc/display.php';
diff --git a/inc/image.php b/inc/image.php
index d3692a39..1d591c25 100644
--- a/inc/image.php
+++ b/inc/image.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
class Image {
public $src, $format, $image, $size;
diff --git a/inc/mod/auth.php b/inc/mod/auth.php
index 0733646f..f2003dfe 100644
--- a/inc/mod/auth.php
+++ b/inc/mod/auth.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
// create a hash/salt pair for validate logins
function mkhash($username, $password, $salt = false) {
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 99bfcf9d..5e45cdae 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
function mod_page($title, $template, $args, $subtitle = false) {
global $config, $mod;
diff --git a/inc/remote.php b/inc/remote.php
index fbce8dab..6a685e82 100644
--- a/inc/remote.php
+++ b/inc/remote.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
class Remote {
public function __construct($config) {
diff --git a/inc/template.php b/inc/template.php
index 378f36d0..c10ac454 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -4,10 +4,7 @@
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
-if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
- // You cannot request this file directly.
- exit;
-}
+defined('TINYBOARD') or exit;
$twig = false;