summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-08-04 16:22:43 +0200
committerchris <chris@jalakai.co.uk>2006-08-04 16:22:43 +0200
commit03c4aec3c817c51eda2cf5c241f76e3bef585799 (patch)
treedf6e92a9b73f0ff360fc3c44c0e0c8426809ee97 /inc
parentac900efc10a9139823163ed90870a7595d726f9f (diff)
downloadrpg-03c4aec3c817c51eda2cf5c241f76e3bef585799.tar.gz
rpg-03c4aec3c817c51eda2cf5c241f76e3bef585799.tar.bz2
unittest fixes
darcs-hash:20060804142243-9b6ab-d208f7f1a67a9958fda05c519c8407ad5e733cea.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/auth.php8
-rw-r--r--inc/events.php1
-rw-r--r--inc/init.php12
-rw-r--r--inc/pageutils.php8
-rw-r--r--inc/parser/handler.php2
-rw-r--r--inc/pluginutils.php3
6 files changed, 24 insertions, 10 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 467f4b0cd..8043feb45 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -17,6 +17,8 @@
require_once(DOKU_INC.'inc/blowfish.php');
require_once(DOKU_INC.'inc/mail.php');
+ global $auth;
+
// load the the backend auth functions and instantiate the auth object
if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) {
require_once(DOKU_INC.'inc/auth/basic.class.php');
@@ -54,11 +56,15 @@
// do the login either by cookie or provided credentials
if($conf['useacl']){
// if no credentials were given try to use HTTP auth (for SSO)
- if(!$_REQUEST['u'] && !$_COOKIE[DOKU_COOKIE] && $_SERVER['PHP_AUTH_USER']){
+ if(empty($_REQUEST['u']) && !$_COOKIE[DOKU_COOKIE] && $_SERVER['PHP_AUTH_USER']){
$_REQUEST['u'] = $_SERVER['PHP_AUTH_USER'];
$_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];
}
+ if (!isset($_REQUEST['u'])) $_REQUEST['u'] = '';
+ if (!isset($_REQUEST['p'])) $_REQUEST['p'] = '';
+ if (!isset($_REQUEST['r'])) $_REQUEST['r'] = '';
+
// external trust mechanism in place?
if(!is_null($auth) && $auth->canDo('external')){
$auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
diff --git a/inc/events.php b/inc/events.php
index cb3f52143..ddb0eb277 100644
--- a/inc/events.php
+++ b/inc/events.php
@@ -198,4 +198,5 @@ function trigger_event($name, &$data, $action=NULL, $canPreventDefault=true) {
}
// create the event handler
+global $EVENT_HANDLER;
$EVENT_HANDLER = new Doku_Event_Handler();
diff --git a/inc/init.php b/inc/init.php
index 934b14dd7..783d3d9c4 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -25,12 +25,14 @@
//prepare config array()
global $conf;
- $conf = array();
+ if (!defined('DOKU_UNITTEST')) {
+ $conf = array();
- // load the config file(s)
- require_once(DOKU_CONF.'dokuwiki.php');
- if(@file_exists(DOKU_CONF.'local.php')){
- require_once(DOKU_CONF.'local.php');
+ // load the config file(s)
+ require_once(DOKU_CONF.'dokuwiki.php');
+ if(@file_exists(DOKU_CONF.'local.php')){
+ require_once(DOKU_CONF.'local.php');
+ }
}
//prepare language array
diff --git a/inc/pageutils.php b/inc/pageutils.php
index a478ecd3a..aacee1b13 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -21,7 +21,7 @@
function getID($param='id',$clean=true){
global $conf;
- $id = $_REQUEST[$param];
+ $id = isset($_REQUEST[$param]) ? $_REQUEST[$param] : null;
//construct page id from request URI
if(empty($id) && $conf['userewrite'] == 2){
@@ -301,7 +301,11 @@ function resolve_pageid($ns,&$page,&$exists){
$exists = false;
//keep hashlink if exists then clean both parts
- list($page,$hash) = split('#',$page,2);
+ if (strpos($page,'#')) {
+ list($page,$hash) = split('#',$page,2);
+ } else {
+ $hash = '';
+ }
$hash = cleanID($hash);
$page = resolve_id($ns,$page,false); // resolve but don't clean, yet
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 519336caa..602ef1b6d 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1341,7 +1341,7 @@ class Doku_Handler_Block {
function Doku_Handler_Block(){
global $DOKU_PLUGINS;
//check if syntax plugins were loaded
- if(!is_array($DOKU_PLUGINS['syntax'])) return;
+ if(empty($DOKU_PLUGINS['syntax'])) return;
foreach($DOKU_PLUGINS['syntax'] as $n => $p){
$ptype = $p->getPType();
if($ptype == 'block'){
diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 4d3b5cbd6..a93cca936 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -7,6 +7,7 @@
*/
// plugin related constants
+if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
$plugin_types = array('admin','syntax','action');
/**
@@ -67,7 +68,7 @@ function &plugin_load($type,$name){
//plugin already loaded?
- if($DOKU_PLUGINS[$type][$name] != null){
+ if(!empty($DOKU_PLUGINS[$type][$name])){
return $DOKU_PLUGINS[$type][$name];
}