summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
authorGuy Brand <gb@unistra.fr>2015-08-10 10:03:27 +0200
committerGuy Brand <gb@unistra.fr>2015-08-10 10:03:27 +0200
commit53a57d16b9c741bb44099fd93bf79efa06796341 (patch)
tree24a90a50afe9325926c8ebaa2ed90f9fa093e5b9 /inc/init.php
parentcf6e6645c31a9f185cef3fb9452fb188882ede47 (diff)
parenta060d9973e7c1d5051f2cc426937881826e4972e (diff)
downloadrpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.gz
rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.bz2
Merge branch master into stable
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php47
1 files changed, 24 insertions, 23 deletions
diff --git a/inc/init.php b/inc/init.php
index 24920a17d..6d271dfb0 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -16,7 +16,7 @@ $config_cascade = array();
// if available load a preload config file
$preload = fullpath(dirname(__FILE__)).'/preload.php';
-if (@file_exists($preload)) include($preload);
+if (file_exists($preload)) include($preload);
// define the include path
if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/');
@@ -28,7 +28,7 @@ if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/');
// check for error reporting override or set error reporting to sane values
-if (!defined('DOKU_E_LEVEL') && @file_exists(DOKU_CONF.'report_e_all')) {
+if (!defined('DOKU_E_LEVEL') && file_exists(DOKU_CONF.'report_e_all')) {
define('DOKU_E_LEVEL', E_ALL);
}
if (!defined('DOKU_E_LEVEL')) {
@@ -65,7 +65,7 @@ $conf = array();
foreach (array('default','local','protected') as $config_group) {
if (empty($config_cascade['main'][$config_group])) continue;
foreach ($config_cascade['main'][$config_group] as $config_file) {
- if (@file_exists($config_file)) {
+ if (file_exists($config_file)) {
include($config_file);
}
}
@@ -79,7 +79,7 @@ $license = array();
foreach (array('default','local') as $config_group) {
if (empty($config_cascade['license'][$config_group])) continue;
foreach ($config_cascade['license'][$config_group] as $config_file) {
- if(@file_exists($config_file)){
+ if(file_exists($config_file)){
include($config_file);
}
}
@@ -178,14 +178,6 @@ $_REQUEST = array_merge($_GET,$_POST);
// we don't want a purge URL to be digged
if(isset($_REQUEST['purge']) && !empty($_SERVER['HTTP_REFERER'])) unset($_REQUEST['purge']);
-// disable gzip if not available
-if($conf['compression'] == 'bz2' && !function_exists('bzopen')){
- $conf['compression'] = 'gz';
-}
-if($conf['compression'] == 'gz' && !function_exists('gzopen')){
- $conf['compression'] = 0;
-}
-
// precalculate file creation modes
init_creationmodes();
@@ -199,8 +191,17 @@ global $plugin_controller_class, $plugin_controller;
if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller';
// load libraries
+require_once(DOKU_INC.'vendor/autoload.php');
require_once(DOKU_INC.'inc/load.php');
+// disable gzip if not available
+if($conf['compression'] == 'bz2' && !function_exists('bzopen')){
+ $conf['compression'] = 'gz';
+}
+if($conf['compression'] == 'gz' && !function_exists('gzopen')){
+ $conf['compression'] = 0;
+}
+
// input handle class
global $INPUT;
$INPUT = new Input();
@@ -272,7 +273,7 @@ function init_lang($langCode) {
//load the language files
require(DOKU_INC.'inc/lang/en/lang.php');
foreach ($config_cascade['lang']['core'] as $config_file) {
- if (@file_exists($config_file . 'en/lang.php')) {
+ if (file_exists($config_file . 'en/lang.php')) {
include($config_file . 'en/lang.php');
}
}
@@ -282,7 +283,7 @@ function init_lang($langCode) {
require(DOKU_INC."inc/lang/$langCode/lang.php");
}
foreach ($config_cascade['lang']['core'] as $config_file) {
- if (@file_exists($config_file . "$langCode/lang.php")) {
+ if (file_exists($config_file . "$langCode/lang.php")) {
include($config_file . "$langCode/lang.php");
}
}
@@ -298,7 +299,7 @@ function init_files(){
$files = array($conf['indexdir'].'/page.idx');
foreach($files as $file){
- if(!@file_exists($file)){
+ if(!file_exists($file)){
$fh = @fopen($file,'a');
if($fh){
fclose($fh);
@@ -312,7 +313,7 @@ function init_files(){
# create title index (needs to have same length as page.idx)
/*
$file = $conf['indexdir'].'/title.idx';
- if(!@file_exists($file)){
+ if(!file_exists($file)){
$pages = file($conf['indexdir'].'/page.idx');
$pages = count($pages);
$fh = @fopen($file,'a');
@@ -339,9 +340,9 @@ function init_files(){
function init_path($path){
// check existence
$p = fullpath($path);
- if(!@file_exists($p)){
+ if(!file_exists($p)){
$p = fullpath(DOKU_INC.$path);
- if(!@file_exists($p)){
+ if(!file_exists($p)){
return '';
}
}
@@ -352,7 +353,7 @@ function init_path($path){
}
// check accessability (execute bit) for directories
- if(@is_dir($p) && !@file_exists("$p/.")){
+ if(@is_dir($p) && !file_exists("$p/.")){
return '';
}
@@ -429,7 +430,7 @@ function getBaseURL($abs=null){
//if canonical url enabled always return absolute
if(is_null($abs)) $abs = $conf['canonical'];
- if($conf['basedir']){
+ if(!empty($conf['basedir'])){
$dir = $conf['basedir'];
}elseif(substr($_SERVER['SCRIPT_NAME'],-4) == '.php'){
$dir = dirname($_SERVER['SCRIPT_NAME']);
@@ -456,7 +457,7 @@ function getBaseURL($abs=null){
if(!$abs) return $dir;
//use config option if available, trim any slash from end of baseurl to avoid multiple consecutive slashes in the path
- if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir;
+ if(!empty($conf['baseurl'])) return rtrim($conf['baseurl'],'/').$dir;
//split hostheader into host and port
if(isset($_SERVER['HTTP_HOST'])){
@@ -535,7 +536,7 @@ function nice_die($msg){
</body>
</html>
EOT;
- exit;
+ exit(1);
}
/**
@@ -593,7 +594,7 @@ function fullpath($path,$exists=false){
$finalpath = $root.implode('/', $newpath);
// check for existence when needed (except when unit testing)
- if($exists && !defined('DOKU_UNITTEST') && !@file_exists($finalpath)) {
+ if($exists && !defined('DOKU_UNITTEST') && !file_exists($finalpath)) {
return false;
}
return $finalpath;