summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-02-19 11:20:55 +0100
committerandi <andi@splitbrain.org>2005-02-19 11:20:55 +0100
commited7b5f0908941f1bacef7e7c3a02c106a42cd5cc (patch)
tree6582419f82a87837adaefee934e1cb2a5316d8cb /inc
parentf840b65d632cd5e155f4d6e39c8a42ae9fd5f566 (diff)
downloadrpg-ed7b5f0908941f1bacef7e7c3a02c106a42cd5cc.tar.gz
rpg-ed7b5f0908941f1bacef7e7c3a02c106a42cd5cc.tar.bz2
added init.php - may have broken something! (related to #153)
darcs-hash:20050219102055-9977f-575d654e742934c911ffab855d82aa91f198b5cf.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/auth.php15
-rw-r--r--inc/common.php128
-rw-r--r--inc/format.php15
-rw-r--r--inc/html.php47
-rw-r--r--inc/init.php110
-rw-r--r--inc/io.php7
-rw-r--r--inc/mail.php7
-rw-r--r--inc/parser.php15
-rw-r--r--inc/search.php5
-rw-r--r--inc/utf8.php2
10 files changed, 193 insertions, 158 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 0266899a8..094319377 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* Authentication library
*
@@ -9,12 +9,13 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- require_once("inc/common.php");
- require_once("inc/io.php");
- require_once("inc/blowfish.php");
- require_once("inc/mail.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/common.php');
+ require_once(DOKU_INC.'inc/io.php');
+ require_once(DOKU_INC.'inc/blowfish.php');
+ require_once(DOKU_INC.'inc/mail.php');
// load the the auth functions
- require_once('inc/auth_'.$conf['authtype'].'.php');
+ require_once(DOKU_INC.'inc/auth_'.$conf['authtype'].'.php');
// some ACL level defines
define('AUTH_NONE',0);
@@ -324,7 +325,7 @@ function auth_sendPassword($user,$password){
if(!$userinfo['mail']) return false;
$text = rawLocale('password');
- $text = str_replace('@DOKUWIKIURL@',getBaseURL(true),$text);
+ $text = str_replace('@DOKUWIKIURL@',DOKU_URL,$text);
$text = str_replace('@FULLNAME@',$userinfo['name'],$text);
$text = str_replace('@LOGIN@',$user,$text);
$text = str_replace('@PASSWORD@',$password,$text);
diff --git a/inc/common.php b/inc/common.php
index 2e146d485..24e9583f3 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* Common DokuWiki functions
*
@@ -6,100 +6,11 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- require_once("conf/dokuwiki.php");
- require_once("inc/io.php");
- require_once('inc/utf8.php');
- require_once('inc/mail.php');
-
- //set up error reporting to sane values
- error_reporting(E_ALL ^ E_NOTICE);
-
- //make session rewrites XHTML compliant
- ini_set('arg_separator.output', '&amp;');
-
- //init session
- session_name("DokuWiki");
- session_start();
-
- //kill magic quotes
- if (get_magic_quotes_gpc()) {
- if (!empty($_GET)) remove_magic_quotes($_GET);
- if (!empty($_POST)) remove_magic_quotes($_POST);
- if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
- if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
- if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
- ini_set('magic_quotes_gpc', 0);
- }
- set_magic_quotes_runtime(0);
- ini_set('magic_quotes_sybase',0);
-
- //disable gzip if not available
- if($conf['usegzip'] && !function_exists('gzopen')){
- $conf['usegzip'] = 0;
- }
-
- //remember original umask
- $conf['oldumask'] = umask();
-
- //make absolute mediaweb
- if(!preg_match('#^(https?://|/)#i',$conf['mediaweb'])){
- $conf['mediaweb'] = getBaseURL().$conf['mediaweb'];
- }
-
-/**
- * remove magic quotes recursivly
- *
- * @author Andreas Gohr <andi@splitbrain.org>
- */
-function remove_magic_quotes(&$array) {
- foreach (array_keys($array) as $key) {
- if (is_array($array[$key])) {
- remove_magic_quotes($array[$key]);
- }else {
- $array[$key] = stripslashes($array[$key]);
- }
- }
-}
-
-/**
- * Returns the full absolute URL to the directory where
- * DokuWiki is installed in (includes a trailing slash)
- *
- * @author Andreas Gohr <andi@splitbrain.org>
- */
-function getBaseURL($abs=false){
- global $conf;
- //if canonical url enabled always return absolute
- if($conf['canonical']) $abs = true;
-
- $dir = dirname($_SERVER['PHP_SELF']).'/';
-
- $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour
- $dir = preg_replace('#//+#','/',$dir);
-
- //finish here for relative URLs
- if(!$abs) return $dir;
-
- $port = ':'.$_SERVER['SERVER_PORT'];
- //remove port from hostheader as sent by IE
- $host = preg_replace('/:.*$/','',$_SERVER['HTTP_HOST']);
-
- // see if HTTPS is enabled - apache leaves this empty when not available,
- // IIS sets it to 'off', 'false' and 'disabled' are just guessing
- if (preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){
- $proto = 'http://';
- if ($_SERVER['SERVER_PORT'] == '80') {
- $port='';
- }
- }else{
- $proto = 'https://';
- if ($_SERVER['SERVER_PORT'] == '443') {
- $port='';
- }
- }
-
- return $proto.$host.$port.$dir;
-}
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'conf/dokuwiki.php');
+ require_once(DOKU_INC.'inc/io.php');
+ require_once(DOKU_INC.'inc/utf8.php');
+ require_once(DOKU_INC.'inc/mail.php');
/**
* Return info about the current document as associative
@@ -257,20 +168,23 @@ function idfilter($id,$ue=true){
}
/**
- * This builds a link to a wikipage (using getBaseURL)
+ * This builds a link to a wikipage
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function wl($id='',$more='',$script='doku.php',$canonical=false){
+function wl($id='',$more='',$abs=false){
global $conf;
$more = str_replace(',','&amp;',$more);
$id = idfilter($id);
- $xlink = getBaseURL($canonical);
+ if($abs){
+ $xlink = DOKU_URL;
+ }else{
+ $xlink = DOKU_BASE;
+ }
if(!$conf['userewrite']){
- $xlink .= $script;
- $xlink .= '?id='.$id;
+ $xlink .= DOKU_SCRIPT.'?id='.$id;
if($more) $xlink .= '&amp;'.$more;
}else{
$xlink .= $id;
@@ -283,12 +197,14 @@ function wl($id='',$more='',$script='doku.php',$canonical=false){
/**
* Just builds a link to a script
*
+ * @todo maybe obsolete
* @author Andreas Gohr <andi@splitbrain.org>
*/
function script($script='doku.php'){
- $link = getBaseURL();
- $link .= $script;
- return $link;
+# $link = getBaseURL();
+# $link .= $script;
+# return $link;
+ return DOKU_BASE.DOKU_SCRIPT;
}
/**
@@ -825,14 +741,14 @@ function notify($id,$rev="",$summary=""){
$text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text);
$text = str_replace('@IPADDRESS@',$_SERVER['REMOTE_ADDR'],$text);
$text = str_replace('@HOSTNAME@',gethostbyaddr($_SERVER['REMOTE_ADDR']),$text);
- $text = str_replace('@NEWPAGE@',wl($id,'','doku.php',true),$text);
- $text = str_replace('@DOKUWIKIURL@',getBaseURL(true),$text);
+ $text = str_replace('@NEWPAGE@',wl($id,'',true),$text);
+ $text = str_replace('@DOKUWIKIURL@',DOKU_URL,$text);
$text = str_replace('@SUMMARY@',$summary,$text);
$text = str_replace('@USER@',$_SERVER['REMOTE_USER'],$text);
if($rev){
$subject = $lang['mail_changed'].' '.$id;
- $text = str_replace('@OLDPAGE@',wl($id,"rev=$rev",'doku.php',true),$text);
+ $text = str_replace('@OLDPAGE@',wl($id,"rev=$rev",true),$text);
require_once("inc/DifferenceEngine.php");
$df = new Diff(split("\n",rawWiki($id,$rev)),
split("\n",rawWiki($id)));
diff --git a/inc/format.php b/inc/format.php
index 44d39e22f..4a5415ab4 100644
--- a/inc/format.php
+++ b/inc/format.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* link format functions
*
@@ -6,8 +6,9 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- require_once("conf/dokuwiki.php");
- require_once("inc/common.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'conf/dokuwiki.php');
+ require_once(DOKU_INC.'inc/common.php');
/**
@@ -248,7 +249,7 @@ function format_link_interwiki($link){
$iwlinks = file('conf/interwiki.conf');
//add special case 'this'
- $iwlinks[] = 'this '.getBaseURL(true).'{NAME}';
+ $iwlinks[] = 'this '.DOKU_URL.'{NAME}';
//go through iwlinks and find URL for wiki
foreach ($iwlinks as $line){
@@ -266,13 +267,13 @@ function format_link_interwiki($link){
//if ico exists set additonal style
if(@file_exists('interwiki/'.$ico.'.png')){
- $link['style']='background: transparent url('.getBaseURL().'interwiki/'.$ico.'.png) 0px 1px no-repeat;';
+ $link['style']='background: transparent url('.DOKU_BASE.'interwiki/'.$ico.'.png) 0px 1px no-repeat;';
}elseif(@file_exists('interwiki/'.$ico.'.gif')){
- $link['style']='background: transparent url('.getBaseURL().'interwiki/'.$ico.'.gif) 0px 1px no-repeat;';
+ $link['style']='background: transparent url('.DOKU_BASE.'interwiki/'.$ico.'.gif) 0px 1px no-repeat;';
}
//do we stay at the same server? Use local target
- if( strpos($url,getBaseURL(true)) === 0 ){
+ if( strpos($url,DOKU_URL) === 0 ){
$link['target'] = $conf['target']['wiki'];
}
diff --git a/inc/html.php b/inc/html.php
index b21ab4e57..d848f89b4 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* HTML output functions
*
@@ -6,7 +6,8 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- include_once("inc/format.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/format.php');
/**
* Convenience function to quickly build a wikilink
@@ -188,13 +189,13 @@ function html_head(){
<title><?=$ID?> [<?=$conf['title']?>]</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$lang['encoding']?>" />
<meta name="generator" content="DokuWiki <?=getVersion()?>" />
- <link rel="stylesheet" media="screen" type="text/css" href="<?=getBaseURL()?>style.css" />
- <link rel="stylesheet" media="print" type="text/css" href="<?=getBaseURL()?>print.css" />
- <link rel="shortcut icon" href="<?=getBaseURL()?>images/favicon.ico" />
+ <link rel="stylesheet" media="screen" type="text/css" href="<?=DOKU_BASE?>style.css" />
+ <link rel="stylesheet" media="print" type="text/css" href="<?=DOKU_BASE?>print.css" />
+ <link rel="shortcut icon" href="<?=DOKU_BASE?>images/favicon.ico" />
<link rel="start" href="<?=wl()?>" />
<link rel="contents" href="<?=wl($ID,'do=index')?>" title="<?=$lang['index']?>" />
- <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="<?=getBaseURL()?>feed.php" />
- <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="<?=getBaseURL()?>feed.php?mode=list&amp;ns=<?=$INFO['namespace']?>" />
+ <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="<?=DOKU_BASE?>feed.php" />
+ <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="<?=DOKU_BASE?>feed.php?mode=list&amp;ns=<?=$INFO['namespace']?>" />
<link rel="alternate" type="text/html" title="Plain HTML" href="<?=wl($ID,'do=export_html')?>" />
<link rel="alternate" type="text/plain" title="Wiki Markup" href="<?=wl($ID, 'do=export_raw')?>" />
<?
@@ -213,14 +214,14 @@ function html_head(){
<script language="JavaScript" type="text/javascript">
var alertText = '<?=$lang['qb_alert']?>';
var notSavedYet = '<?=$lang['notsavedyet']?>';
- var baseURL = '<?=getBaseURL()?>';
+ var DOKU_BASE = '<?=DOKU_BASE?>';
</script>
- <script language="JavaScript" type="text/javascript" src="<?=getBaseURL()?>script.js"></script>
+ <script language="JavaScript" type="text/javascript" src="<?=DOKU_BASE?>script.js"></script>
<!--[if gte IE 5]>
<style type="text/css">
/* that IE 5+ conditional comment makes this only visible in IE 5+ */
- img { behavior: url("<?=getBaseURL()?>pngbehavior.htc"); } /* IE bugfix for transparent PNGs */
+ img { behavior: url("<?=DOKU_BASE?>pngbehavior.htc"); } /* IE bugfix for transparent PNGs */
</style>
<![endif]-->
@@ -246,13 +247,11 @@ function html_btn($name,$id,$akey,$params,$method='get'){
$id = idfilter($id,false);
//make nice URLs even for buttons
- $link = getBaseURL().'/';
- $link = preg_replace('#//$#','/',$link);
if(!$conf['userewrite']){
- $script = $link.'doku.php';
+ $script = DOKU_BASE.DOKUSCRIPT;
$params['id'] = $id;
}else{
- $script = $link.$id;
+ $script = DOKU_BASE.$id;
}
$ret .= '<form class="button" method="'.$method.'" action="'.$script.'" onsubmit="return svchk()">';
@@ -529,7 +528,7 @@ function html_hilight($html,$query){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_search(){
- require_once("inc/search.php");
+ require_once(DOKU_INC.'inc/search.php');
global $conf;
global $QUERY;
global $ID;
@@ -648,7 +647,7 @@ function html_revisions(){
print ')</span> ';
print '<a href="'.wl($ID,"rev=$rev,do=diff").'">';
- print '<img src="'.getBaseURL().'images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />';
+ print '<img src="'.DOKU_BASE.'images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />';
print '</a>';
print '</li>';
}
@@ -686,7 +685,7 @@ function html_recent(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_index($ns){
- require_once("inc/search.php");
+ require_once(DOKU_INC.'inc/search.php');
global $conf;
global $ID;
$dir = $conf['datadir'];
@@ -814,7 +813,7 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_backlinks(){
- require_once("inc/search.php");
+ require_once(DOKU_INC.'inc/search.php');
global $ID;
global $conf;
@@ -847,7 +846,7 @@ function html_backlinks(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_diff($text='',$intro=true){
- require_once("inc/DifferenceEngine.php");
+ require_once(DOKU_INC.'inc/DifferenceEngine.php');
global $ID;
global $REV;
global $lang;
@@ -1136,11 +1135,15 @@ function html_debug(){
print_r($cnf);
print '</pre>';
- print '<b>abs baseURL:</b><pre>';
- print getBaseURL(true);
+ print '<b>DOKU_BASE:</b><pre>';
+ print DOKU_BASE;
+ print '</pre>';
+
+ print '<b>abs DOKU_BASE:</b><pre>';
+ print DOKU_URL;
print '</pre>';
- print '<b>rel baseURL:</b><pre>';
+ print '<b>rel DOKU_BASE:</b><pre>';
print dirname($_SERVER['PHP_SELF']).'/';
print '</pre>';
diff --git a/inc/init.php b/inc/init.php
new file mode 100644
index 000000000..9314008e1
--- /dev/null
+++ b/inc/init.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Initialize some defaults needed for DokuWiki
+ */
+
+ // define the include path
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'conf/dokuwiki.php');
+
+ // define baseURL
+ if(!defined('DOKU_BASE')) define('DOKU_BASE',getBaseURL());
+ if(!defined('DOKU_URL')) define('DOKU_URL',getBaseURL(true));
+
+ // define main script
+ if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php');
+
+ // set up error reporting to sane values
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ // make session rewrites XHTML compliant
+ ini_set('arg_separator.output', '&amp;');
+
+ // init session
+ session_name("DokuWiki");
+ session_start();
+
+ // kill magic quotes
+ if (get_magic_quotes_gpc()) {
+ if (!empty($_GET)) remove_magic_quotes($_GET);
+ if (!empty($_POST)) remove_magic_quotes($_POST);
+ if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
+ if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
+ if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
+ ini_set('magic_quotes_gpc', 0);
+ }
+ set_magic_quotes_runtime(0);
+ ini_set('magic_quotes_sybase',0);
+
+ // disable gzip if not available
+ if($conf['usegzip'] && !function_exists('gzopen')){
+ $conf['usegzip'] = 0;
+ }
+
+ // remember original umask
+ $conf['oldumask'] = umask();
+
+ // make absolute mediaweb
+ if(!preg_match('#^(https?://|/)#i',$conf['mediaweb'])){
+ $conf['mediaweb'] = getBaseURL().$conf['mediaweb'];
+ }
+
+
+
+/**
+ * remove magic quotes recursivly
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function remove_magic_quotes(&$array) {
+ foreach (array_keys($array) as $key) {
+ if (is_array($array[$key])) {
+ remove_magic_quotes($array[$key]);
+ }else {
+ $array[$key] = stripslashes($array[$key]);
+ }
+ }
+}
+
+/**
+ * Returns the full absolute URL to the directory where
+ * DokuWiki is installed in (includes a trailing slash)
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function getBaseURL($abs=false){
+ global $conf;
+ //if canonical url enabled always return absolute
+ if($conf['canonical']) $abs = true;
+
+ $dir = dirname($_SERVER['PHP_SELF']).'/';
+
+ $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour
+ $dir = preg_replace('#//+#','/',$dir);
+
+ //finish here for relative URLs
+ if(!$abs) return $dir;
+
+ $port = ':'.$_SERVER['SERVER_PORT'];
+ //remove port from hostheader as sent by IE
+ $host = preg_replace('/:.*$/','',$_SERVER['HTTP_HOST']);
+
+ // see if HTTPS is enabled - apache leaves this empty when not available,
+ // IIS sets it to 'off', 'false' and 'disabled' are just guessing
+ if (preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){
+ $proto = 'http://';
+ if ($_SERVER['SERVER_PORT'] == '80') {
+ $port='';
+ }
+ }else{
+ $proto = 'https://';
+ if ($_SERVER['SERVER_PORT'] == '443') {
+ $port='';
+ }
+ }
+
+ return $proto.$host.$port.$dir;
+}
+
+
+?>
diff --git a/inc/io.php b/inc/io.php
index dfdbc4e1c..6586a554e 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* File IO functions
*
@@ -6,8 +6,9 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- require_once("inc/common.php");
- require_once("inc/parser.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/common.php');
+ require_once(DOKU_INC.'inc/parser.php');
/**
* Returns the parsed text from the given sourcefile. Uses cache
diff --git a/inc/mail.php b/inc/mail.php
index b66678b02..451fa6cb6 100644
--- a/inc/mail.php
+++ b/inc/mail.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* Mail functions
*
@@ -6,9 +6,10 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
-require_once('inc/utf8.php');
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/utf8.php');
-define('MAILHEADER_EOL',"\n"); //end of line for mail headers
+ define('MAILHEADER_EOL',"\n"); //end of line for mail headers
/**
* UTF-8 autoencoding replacement for PHPs mail function
diff --git a/inc/parser.php b/inc/parser.php
index 73bbee765..5c3c78851 100644
--- a/inc/parser.php
+++ b/inc/parser.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* The DokuWiki parser
*
@@ -6,11 +6,12 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- include_once("inc/common.php");
- include_once("inc/html.php");
- include_once("inc/format.php");
- require_once("lang/en/lang.php");
- require_once("lang/".$conf['lang']."/lang.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ include_once(DOKU_INC.'inc/common.php');
+ include_once(DOKU_INC.'inc/html.php');
+ include_once(DOKU_INC.'inc/format.php');
+ require_once(DOKU_INC.'lang/en/lang.php');
+ require_once(DOKU_INC.'lang/'.$conf['lang'].'/lang.php');
/**
* The main parser function.
@@ -469,7 +470,7 @@ function smileys(&$table,&$text){
$smiley = trim($smiley);
if(empty($smiley)) continue;
$sm = preg_split('/\s+/',$smiley,2);
- $sm[1] = '<img src="'.getBaseURL().'smileys/'.$sm[1].'" align="middle" alt="'.$sm[0].'" />';
+ $sm[1] = '<img src="'.DOKU_BASE.'smileys/'.$sm[1].'" align="middle" alt="'.$sm[0].'" />';
$sm[0] = preg_quote($sm[0],'/');
firstpass($table,$text,'/(\W)'.$sm[0].'(\W)/s',$sm[1],"\\1","\\2");
}
diff --git a/inc/search.php b/inc/search.php
index 725cd22c9..d66d51af3 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* DokuWiki search functions
*
@@ -6,7 +6,8 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
- require_once("inc/common.php");
+ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+ require_once(DOKU_INC.'inc/common.php');
/**
* recurse direcory
diff --git a/inc/utf8.php b/inc/utf8.php
index bb9b15799..222f40261 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -1,4 +1,4 @@
-<?
+<?php
/**
* UTF8 helper functions
*