Coding Standard Cleanup
Ignore-this: 259cb5773c3144c6c706d87298dcf674 darcs-hash:20091020212338-7ad00-6bf1c5c403491f136a1c02af5ecd9f84d7227107.gz
This commit is contained in:
parent
8ec3f7bdbf
commit
db959ae307
98
doku.php
98
doku.php
|
@ -8,74 +8,74 @@
|
|||
|
||||
// xdebug_start_profiling();
|
||||
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
|
||||
require_once(DOKU_INC.'inc/init.php');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/events.php');
|
||||
require_once(DOKU_INC.'inc/pageutils.php');
|
||||
require_once(DOKU_INC.'inc/html.php');
|
||||
require_once(DOKU_INC.'inc/auth.php');
|
||||
require_once(DOKU_INC.'inc/actions.php');
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
|
||||
require_once(DOKU_INC.'inc/init.php');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/events.php');
|
||||
require_once(DOKU_INC.'inc/pageutils.php');
|
||||
require_once(DOKU_INC.'inc/html.php');
|
||||
require_once(DOKU_INC.'inc/auth.php');
|
||||
require_once(DOKU_INC.'inc/actions.php');
|
||||
|
||||
//import variables
|
||||
$QUERY = trim($_REQUEST['id']);
|
||||
$ID = getID();
|
||||
$NS = getNS($ID);
|
||||
$REV = $_REQUEST['rev'];
|
||||
$ACT = $_REQUEST['do'];
|
||||
$IDX = $_REQUEST['idx'];
|
||||
$DATE = $_REQUEST['date'];
|
||||
$RANGE = $_REQUEST['lines'];
|
||||
$HIGH = $_REQUEST['s'];
|
||||
if(empty($HIGH)) $HIGH = getGoogleQuery();
|
||||
//import variables
|
||||
$QUERY = trim($_REQUEST['id']);
|
||||
$ID = getID();
|
||||
$NS = getNS($ID);
|
||||
$REV = $_REQUEST['rev'];
|
||||
$ACT = $_REQUEST['do'];
|
||||
$IDX = $_REQUEST['idx'];
|
||||
$DATE = $_REQUEST['date'];
|
||||
$RANGE = $_REQUEST['lines'];
|
||||
$HIGH = $_REQUEST['s'];
|
||||
if(empty($HIGH)) $HIGH = getGoogleQuery();
|
||||
|
||||
$TEXT = cleanText($_POST['wikitext']);
|
||||
$PRE = cleanText($_POST['prefix']);
|
||||
$SUF = cleanText($_POST['suffix']);
|
||||
$SUM = $_REQUEST['summary'];
|
||||
$TEXT = cleanText($_POST['wikitext']);
|
||||
$PRE = cleanText($_POST['prefix']);
|
||||
$SUF = cleanText($_POST['suffix']);
|
||||
$SUM = $_REQUEST['summary'];
|
||||
|
||||
//sanitize revision
|
||||
$REV = preg_replace('/[^0-9]/','',$REV);
|
||||
//sanitize revision
|
||||
$REV = preg_replace('/[^0-9]/','',$REV);
|
||||
|
||||
//we accept the do param as HTTP header, too:
|
||||
if(!empty($_SERVER['HTTP_X_DOKUWIKI_DO'])){
|
||||
//we accept the do param as HTTP header, too:
|
||||
if(!empty($_SERVER['HTTP_X_DOKUWIKI_DO'])){
|
||||
$ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($IDX)) $ACT='index';
|
||||
//set default #FIXME not needed here? done in actions?
|
||||
if(empty($ACT)) $ACT = 'show';
|
||||
if(!empty($IDX)) $ACT='index';
|
||||
//set default #FIXME not needed here? done in actions?
|
||||
if(empty($ACT)) $ACT = 'show';
|
||||
|
||||
//make infos about the selected page available
|
||||
$INFO = pageinfo();
|
||||
//make infos about the selected page available
|
||||
$INFO = pageinfo();
|
||||
|
||||
// handle debugging
|
||||
if($conf['allowdebug'] && $ACT == 'debug'){
|
||||
// handle debugging
|
||||
if($conf['allowdebug'] && $ACT == 'debug'){
|
||||
html_debug();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//send 404 for missing pages if configured or ID has special meaning to bots
|
||||
if(!$INFO['exists'] &&
|
||||
//send 404 for missing pages if configured or ID has special meaning to bots
|
||||
if(!$INFO['exists'] &&
|
||||
($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) &&
|
||||
($ACT == 'show' || substr($ACT,0,7) == 'export_') ){
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
}
|
||||
}
|
||||
|
||||
//prepare breadcrumbs (initialize a static var)
|
||||
if ($conf['breadcrumbs']) breadcrumbs();
|
||||
//prepare breadcrumbs (initialize a static var)
|
||||
if ($conf['breadcrumbs']) breadcrumbs();
|
||||
|
||||
// check upstream
|
||||
checkUpdateMessages();
|
||||
// check upstream
|
||||
checkUpdateMessages();
|
||||
|
||||
trigger_event('DOKUWIKI_STARTED',$tmp=array());
|
||||
trigger_event('DOKUWIKI_STARTED',$tmp=array());
|
||||
|
||||
//close session
|
||||
session_write_close();
|
||||
//close session
|
||||
session_write_close();
|
||||
|
||||
//do the work
|
||||
act_dispatch($ACT);
|
||||
//do the work
|
||||
act_dispatch($ACT);
|
||||
|
||||
trigger_event('DOKUWIKI_DONE', $tmp=array());
|
||||
trigger_event('DOKUWIKI_DONE', $tmp=array());
|
||||
|
||||
// xdebug_dump_function_profile(1);
|
||||
|
|
95
feed.php
95
feed.php
|
@ -6,74 +6,74 @@
|
|||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
|
||||
require_once(DOKU_INC.'inc/init.php');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/events.php');
|
||||
require_once(DOKU_INC.'inc/parserutils.php');
|
||||
require_once(DOKU_INC.'inc/feedcreator.class.php');
|
||||
require_once(DOKU_INC.'inc/auth.php');
|
||||
require_once(DOKU_INC.'inc/pageutils.php');
|
||||
require_once(DOKU_INC.'inc/httputils.php');
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
|
||||
require_once(DOKU_INC.'inc/init.php');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/events.php');
|
||||
require_once(DOKU_INC.'inc/parserutils.php');
|
||||
require_once(DOKU_INC.'inc/feedcreator.class.php');
|
||||
require_once(DOKU_INC.'inc/auth.php');
|
||||
require_once(DOKU_INC.'inc/pageutils.php');
|
||||
require_once(DOKU_INC.'inc/httputils.php');
|
||||
|
||||
//close session
|
||||
session_write_close();
|
||||
//close session
|
||||
session_write_close();
|
||||
|
||||
// get params
|
||||
$opt = rss_parseOptions();
|
||||
// get params
|
||||
$opt = rss_parseOptions();
|
||||
|
||||
// the feed is dynamic - we need a cache for each combo
|
||||
// (but most people just use the default feed so it's still effective)
|
||||
$cache = getCacheName(join('',array_values($opt)).$_SERVER['REMOTE_USER'],'.feed');
|
||||
$cmod = @filemtime($cache); // 0 if not exists
|
||||
if ($cmod && (@filemtime(DOKU_CONF.'local.php')>$cmod || @filemtime(DOKU_CONF.'dokuwiki.php')>$cmod)) {
|
||||
// the feed is dynamic - we need a cache for each combo
|
||||
// (but most people just use the default feed so it's still effective)
|
||||
$cache = getCacheName(join('',array_values($opt)).$_SERVER['REMOTE_USER'],'.feed');
|
||||
$cmod = @filemtime($cache); // 0 if not exists
|
||||
if ($cmod && (@filemtime(DOKU_CONF.'local.php')>$cmod || @filemtime(DOKU_CONF.'dokuwiki.php')>$cmod)) {
|
||||
// ignore cache if feed prefs may have changed
|
||||
$cmod = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check cacheage and deliver if nothing has changed since last
|
||||
// time or the update interval has not passed, also handles conditional requests
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
header('X-Robots-Tag: noindex');
|
||||
if($cmod && (($cmod+$conf['rss_update']>time()) || ($cmod>@filemtime($conf['changelog'])))){
|
||||
// check cacheage and deliver if nothing has changed since last
|
||||
// time or the update interval has not passed, also handles conditional requests
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
header('X-Robots-Tag: noindex');
|
||||
if($cmod && (($cmod+$conf['rss_update']>time()) || ($cmod>@filemtime($conf['changelog'])))){
|
||||
http_conditionalRequest($cmod);
|
||||
if($conf['allowdebug']) header("X-CacheUsed: $cache");
|
||||
print io_readFile($cache);
|
||||
exit;
|
||||
} else {
|
||||
} else {
|
||||
http_conditionalRequest(time());
|
||||
}
|
||||
|
||||
// create new feed
|
||||
$rss = new DokuWikiFeedCreator();
|
||||
$rss->title = $conf['title'].(($opt['namespace']) ? ' '.$opt['namespace'] : '');
|
||||
$rss->link = DOKU_URL;
|
||||
$rss->syndicationURL = DOKU_URL.'feed.php';
|
||||
$rss->cssStyleSheet = DOKU_URL.'lib/exe/css.php?s=feed';
|
||||
// create new feed
|
||||
$rss = new DokuWikiFeedCreator();
|
||||
$rss->title = $conf['title'].(($opt['namespace']) ? ' '.$opt['namespace'] : '');
|
||||
$rss->link = DOKU_URL;
|
||||
$rss->syndicationURL = DOKU_URL.'feed.php';
|
||||
$rss->cssStyleSheet = DOKU_URL.'lib/exe/css.php?s=feed';
|
||||
|
||||
$image = new FeedImage();
|
||||
$image->title = $conf['title'];
|
||||
$image->url = DOKU_URL."lib/images/favicon.ico";
|
||||
$image->link = DOKU_URL;
|
||||
$rss->image = $image;
|
||||
$image = new FeedImage();
|
||||
$image->title = $conf['title'];
|
||||
$image->url = DOKU_URL."lib/images/favicon.ico";
|
||||
$image->link = DOKU_URL;
|
||||
$rss->image = $image;
|
||||
|
||||
if($opt['feed_mode'] == 'list'){
|
||||
if($opt['feed_mode'] == 'list'){
|
||||
rssListNamespace($rss,$opt);
|
||||
}elseif($opt['feed_mode'] == 'search'){
|
||||
}elseif($opt['feed_mode'] == 'search'){
|
||||
rssSearch($rss,$opt);
|
||||
}else{
|
||||
}else{
|
||||
rssRecentChanges($rss,$opt);
|
||||
}
|
||||
}
|
||||
|
||||
$feed = $rss->createFeed($opt['feed_type'],'utf-8');
|
||||
$feed = $rss->createFeed($opt['feed_type'],'utf-8');
|
||||
|
||||
// save cachefile
|
||||
io_saveFile($cache,$feed);
|
||||
// save cachefile
|
||||
io_saveFile($cache,$feed);
|
||||
|
||||
// finally deliver
|
||||
print $feed;
|
||||
// finally deliver
|
||||
print $feed;
|
||||
|
||||
// ---------------------------------------------------------------- //
|
||||
|
||||
|
@ -229,7 +229,6 @@ function rss_buildItems(&$rss,&$data,$opt){
|
|||
}
|
||||
$item->description = $content; //FIXME a plugin hook here could be senseful
|
||||
|
||||
|
||||
// add user
|
||||
# FIXME should the user be pulled from metadata as well?
|
||||
$user = null;
|
||||
|
|
47
inc/auth.php
47
inc/auth.php
|
@ -9,22 +9,22 @@
|
|||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
if(!defined('DOKU_INC')) die('meh.');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/io.php');
|
||||
if(!defined('DOKU_INC')) die('meh.');
|
||||
require_once(DOKU_INC.'inc/common.php');
|
||||
require_once(DOKU_INC.'inc/io.php');
|
||||
|
||||
// some ACL level defines
|
||||
define('AUTH_NONE',0);
|
||||
define('AUTH_READ',1);
|
||||
define('AUTH_EDIT',2);
|
||||
define('AUTH_CREATE',4);
|
||||
define('AUTH_UPLOAD',8);
|
||||
define('AUTH_DELETE',16);
|
||||
define('AUTH_ADMIN',255);
|
||||
// some ACL level defines
|
||||
define('AUTH_NONE',0);
|
||||
define('AUTH_READ',1);
|
||||
define('AUTH_EDIT',2);
|
||||
define('AUTH_CREATE',4);
|
||||
define('AUTH_UPLOAD',8);
|
||||
define('AUTH_DELETE',16);
|
||||
define('AUTH_ADMIN',255);
|
||||
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
if($conf['useacl']){
|
||||
if($conf['useacl']){
|
||||
require_once(DOKU_INC.'inc/blowfish.php');
|
||||
require_once(DOKU_INC.'inc/mail.php');
|
||||
|
||||
|
@ -50,10 +50,10 @@
|
|||
} else {
|
||||
nice_die($lang['authmodfailed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do the login either by cookie or provided credentials
|
||||
if($conf['useacl']){
|
||||
// do the login either by cookie or provided credentials
|
||||
if($conf['useacl']){
|
||||
if($auth){
|
||||
if (!isset($_REQUEST['u'])) $_REQUEST['u'] = '';
|
||||
if (!isset($_REQUEST['p'])) $_REQUEST['p'] = '';
|
||||
|
@ -112,7 +112,7 @@
|
|||
}else{
|
||||
$AUTH_ACL = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This tries to login the user based on the sent auth credentials
|
||||
|
@ -142,7 +142,7 @@
|
|||
* @param bool $sticky Cookie should not expire
|
||||
* @param bool $silent Don't show error on bad auth
|
||||
* @return bool true on successful auth
|
||||
*/
|
||||
*/
|
||||
function auth_login($user,$pass,$sticky=false,$silent=false){
|
||||
global $USERINFO;
|
||||
global $conf;
|
||||
|
@ -727,7 +727,6 @@ function updateprofile() {
|
|||
if ($_POST['email'] != $INFO['userinfo']['mail'] && $auth->canDo('modMail')) $changes['mail'] = $_POST['email'];
|
||||
if (!empty($_POST['newpass']) && $auth->canDo('modPass')) $changes['pass'] = $_POST['newpass'];
|
||||
|
||||
|
||||
if (!count($changes)) {
|
||||
msg($lang['profnochange'], -1);
|
||||
return false;
|
||||
|
@ -764,7 +763,7 @@ function updateprofile() {
|
|||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*
|
||||
* @return bool true on success, false on any error
|
||||
*/
|
||||
*/
|
||||
function act_resendpwd(){
|
||||
global $lang;
|
||||
global $conf;
|
||||
|
@ -896,8 +895,12 @@ function auth_cryptPassword($clear,$method='',$salt=null){
|
|||
$len = strlen($clear);
|
||||
$text = $clear.'$'.$magic.'$'.$salt;
|
||||
$bin = pack("H32", md5($clear.$salt.$clear));
|
||||
for($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); }
|
||||
for($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $clear{0}; }
|
||||
for($i = $len; $i > 0; $i -= 16) {
|
||||
$text .= substr($bin, 0, min(16, $i));
|
||||
}
|
||||
for($i = $len; $i > 0; $i >>= 1) {
|
||||
$text .= ($i & 1) ? chr(0) : $clear{0};
|
||||
}
|
||||
$bin = pack("H32", md5($text));
|
||||
for($i = 0; $i < 1000; $i++) {
|
||||
$new = ($i & 1) ? $clear : $bin;
|
||||
|
|
47
inc/html.php
47
inc/html.php
|
@ -16,8 +16,8 @@ require_once(DOKU_INC.'inc/form.php');
|
|||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function html_wikilink($id,$name=NULL,$search=''){
|
||||
static $xhtml_renderer = NULL;
|
||||
function html_wikilink($id,$name=null,$search=''){
|
||||
static $xhtml_renderer = null;
|
||||
if(is_null($xhtml_renderer)){
|
||||
$xhtml_renderer = p_get_renderer('xhtml');
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ function html_search(){
|
|||
$num = 1;
|
||||
foreach($data as $id => $cnt){
|
||||
print '<div class="search_result">';
|
||||
print html_wikilink(':'.$id,useHeading('navigation')?NULL:$id,$regex);
|
||||
print html_wikilink(':'.$id,useHeading('navigation')?null:$id,$regex);
|
||||
if($cnt !== 0){
|
||||
print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
|
||||
if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ?
|
||||
|
@ -625,7 +625,7 @@ function html_recent($first=0){
|
|||
)));
|
||||
$form->addElement(form_makeCloseTag('a'));
|
||||
|
||||
$form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?NULL:$recent['id']));
|
||||
$form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id']));
|
||||
|
||||
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
|
||||
$form->addElement(' – '.htmlspecialchars($recent['sum']));
|
||||
|
@ -836,7 +836,7 @@ function html_backlinks(){
|
|||
print '<ul class="idx">';
|
||||
foreach($data as $blink){
|
||||
print '<li><div class="li">';
|
||||
print html_wikilink(':'.$blink,useHeading('navigation')?NULL:$blink);
|
||||
print html_wikilink(':'.$blink,useHeading('navigation')?null:$blink);
|
||||
print '</div></li>';
|
||||
}
|
||||
print '</ul>';
|
||||
|
@ -912,14 +912,16 @@ function html_diff($text='',$intro=true){
|
|||
}
|
||||
$r_text = rawWiki($ID,$r_rev);
|
||||
|
||||
|
||||
if(!$l_rev){
|
||||
$l_head = '—';
|
||||
}else{
|
||||
$l_info = getRevisionInfo($ID,$l_rev,true);
|
||||
if($l_info['user']){ $l_user = editorinfo($l_info['user']);
|
||||
if($l_info['user']){
|
||||
$l_user = editorinfo($l_info['user']);
|
||||
if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
|
||||
} else { $l_user = $l_info['ip']; }
|
||||
} else {
|
||||
$l_user = $l_info['ip'];
|
||||
}
|
||||
$l_user = '<span class="user">'.$l_user.'</span>';
|
||||
$l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
|
||||
if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
|
||||
|
@ -931,9 +933,12 @@ function html_diff($text='',$intro=true){
|
|||
|
||||
if($r_rev){
|
||||
$r_info = getRevisionInfo($ID,$r_rev,true);
|
||||
if($r_info['user']){ $r_user = editorinfo($r_info['user']);
|
||||
if($r_info['user']){
|
||||
$r_user = editorinfo($r_info['user']);
|
||||
if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
|
||||
} else { $r_user = $r_info['ip']; }
|
||||
} else {
|
||||
$r_user = $r_info['ip'];
|
||||
}
|
||||
$r_user = '<span class="user">'.$r_user.'</span>';
|
||||
$r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
|
||||
if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
|
||||
|
@ -943,9 +948,12 @@ function html_diff($text='',$intro=true){
|
|||
'<br />'.$r_user.' '.$r_sum;
|
||||
}elseif($_rev = @filemtime(wikiFN($ID))){
|
||||
$_info = getRevisionInfo($ID,$_rev,true);
|
||||
if($_info['user']){ $_user = editorinfo($_info['user']);
|
||||
if($_info['user']){
|
||||
$_user = editorinfo($_info['user']);
|
||||
if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
|
||||
} else { $_user = $_info['ip']; }
|
||||
} else {
|
||||
$_user = $_info['ip'];
|
||||
}
|
||||
$_user = '<span class="user">'.$_user.'</span>';
|
||||
$_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
|
||||
if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
|
||||
|
@ -1167,9 +1175,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
|
|||
print p_locale_xhtml('read');
|
||||
}
|
||||
if(!$DATE) $DATE = $INFO['lastmod'];
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
<div style="width:99%;">
|
||||
|
||||
<div class="toolbar">
|
||||
|
@ -1183,11 +1189,9 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
|
|||
textChanged = <?php ($mod) ? print 'true' : print 'false' ?>;
|
||||
//--><!]]></script>
|
||||
<span id="spell__action"></span>
|
||||
<div id="spell__suggest"></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div id="spell__result"></div>
|
||||
<?php
|
||||
<?php
|
||||
$form = new Doku_Form('dw__editform');
|
||||
$form->addHidden('id', $ID);
|
||||
$form->addHidden('rev', $REV);
|
||||
|
@ -1346,7 +1350,7 @@ function html_admin(){
|
|||
$pluginlist = plugin_list('admin');
|
||||
$menu = array();
|
||||
foreach ($pluginlist as $p) {
|
||||
if($obj =& plugin_load('admin',$p) === NULL) continue;
|
||||
if($obj =& plugin_load('admin',$p) === null) continue;
|
||||
|
||||
// check permissions
|
||||
if($obj->forAdminOnly() && !$INFO['isadmin']) continue;
|
||||
|
@ -1412,7 +1416,6 @@ function html_admin(){
|
|||
|
||||
ptln('</ul>');
|
||||
|
||||
|
||||
// print the rest as sorted list
|
||||
if(count($menu)){
|
||||
usort($menu, 'p_sort_modes');
|
||||
|
@ -1471,7 +1474,8 @@ function html_TOC($toc){
|
|||
$out .= html_buildlist($toc,'toc','html_list_toc');
|
||||
$out .= '</div>'.DOKU_LF.'</div>'.DOKU_LF;
|
||||
$out .= '<!-- TOC END -->'.DOKU_LF;
|
||||
return $out; }
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for html_buildlist
|
||||
|
@ -1602,4 +1606,3 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts
|
|||
return $out;
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
|
@ -664,7 +664,9 @@ function idx_upgradePageWords(){
|
|||
if (empty($page_idx)) return;
|
||||
$pagewords = array();
|
||||
$len = count($page_idx);
|
||||
for ($n=0;$n<$len;$n++) $pagewords[] = array();
|
||||
for ($n=0;$n<$len;$n++){
|
||||
$pagewords[] = array();
|
||||
}
|
||||
unset($page_idx);
|
||||
|
||||
$n=0;
|
||||
|
|
|
@ -100,7 +100,6 @@ function check(){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if(is_writable($conf['changelog'])){
|
||||
msg('Changelog is writable',1);
|
||||
}else{
|
||||
|
|
224
inc/init.php
224
inc/init.php
|
@ -3,49 +3,54 @@
|
|||
* Initialize some defaults needed for DokuWiki
|
||||
*/
|
||||
|
||||
// start timing Dokuwiki execution
|
||||
function delta_time($start=0) {
|
||||
// start timing Dokuwiki execution
|
||||
function delta_time($start=0) {
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ((float)$usec+(float)$sec)-((float)$start);
|
||||
}
|
||||
define('DOKU_START_TIME', delta_time());
|
||||
}
|
||||
define('DOKU_START_TIME', delta_time());
|
||||
|
||||
global $config_cascade;
|
||||
$config_cascade = '';
|
||||
global $config_cascade;
|
||||
$config_cascade = '';
|
||||
|
||||
// if available load a preload config file
|
||||
$preload = fullpath(dirname(__FILE__)).'/preload.php';
|
||||
if (@file_exists($preload)) include($preload);
|
||||
// if available load a preload config file
|
||||
$preload = fullpath(dirname(__FILE__)).'/preload.php';
|
||||
if (@file_exists($preload)) include($preload);
|
||||
|
||||
// define the include path
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/');
|
||||
// define the include path
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/');
|
||||
|
||||
// define config path (packagers may want to change this to /etc/dokuwiki/)
|
||||
if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/');
|
||||
// define config path (packagers may want to change this to /etc/dokuwiki/)
|
||||
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')) {
|
||||
// check for error reporting override or set error reporting to sane values
|
||||
if (!defined('DOKU_E_LEVEL') && @file_exists(DOKU_CONF.'report_e_all')) {
|
||||
define('DOKU_E_LEVEL', E_ALL);
|
||||
}
|
||||
if (!defined('DOKU_E_LEVEL')) {
|
||||
}
|
||||
if (!defined('DOKU_E_LEVEL')) {
|
||||
if(defined('E_DEPRECATED')){ // since php 5.3
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
||||
}else{
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
error_reporting(DOKU_E_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
// init memory caches
|
||||
global $cache_revinfo; $cache_revinfo = array();
|
||||
global $cache_wikifn; $cache_wikifn = array();
|
||||
global $cache_cleanid; $cache_cleanid = array();
|
||||
global $cache_authname; $cache_authname = array();
|
||||
global $cache_metadata; $cache_metadata = array();
|
||||
// init memory caches
|
||||
global $cache_revinfo;
|
||||
$cache_revinfo = array();
|
||||
global $cache_wikifn;
|
||||
$cache_wikifn = array();
|
||||
global $cache_cleanid;
|
||||
$cache_cleanid = array();
|
||||
global $cache_authname;
|
||||
$cache_authname = array();
|
||||
global $cache_metadata;
|
||||
$cache_metadata = array();
|
||||
|
||||
//set the configuration cascade - but only if its not already been set in preload.php
|
||||
if (empty($config_cascade)) {
|
||||
//set the configuration cascade - but only if its not already been set in preload.php
|
||||
if (empty($config_cascade)) {
|
||||
$config_cascade = array(
|
||||
'main' => array(
|
||||
'default' => array(DOKU_CONF.'dokuwiki.php'),
|
||||
|
@ -89,97 +94,97 @@
|
|||
'local' => array(DOKU_CONF.'wordblock.local.conf'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//prepare config array()
|
||||
global $conf;
|
||||
$conf = array();
|
||||
//prepare config array()
|
||||
global $conf;
|
||||
$conf = array();
|
||||
|
||||
// load the global config file(s)
|
||||
foreach (array('default','local','protected') as $config_group) {
|
||||
// load the global config file(s)
|
||||
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)) {
|
||||
include($config_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//prepare language array
|
||||
global $lang;
|
||||
$lang = array();
|
||||
//prepare language array
|
||||
global $lang;
|
||||
$lang = array();
|
||||
|
||||
//load the language files
|
||||
require_once(DOKU_INC.'inc/lang/en/lang.php');
|
||||
if ( $conf['lang'] && $conf['lang'] != 'en' ) {
|
||||
//load the language files
|
||||
require_once(DOKU_INC.'inc/lang/en/lang.php');
|
||||
if ( $conf['lang'] && $conf['lang'] != 'en' ) {
|
||||
require_once(DOKU_INC.'inc/lang/'.$conf['lang'].'/lang.php');
|
||||
}
|
||||
}
|
||||
|
||||
//prepare license array()
|
||||
global $license;
|
||||
$license = array();
|
||||
//prepare license array()
|
||||
global $license;
|
||||
$license = array();
|
||||
|
||||
// load the license file(s)
|
||||
foreach (array('default','local') as $config_group) {
|
||||
// load the license file(s)
|
||||
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)){
|
||||
include($config_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// define baseURL
|
||||
if(!defined('DOKU_REL')) define('DOKU_REL',getBaseURL(false));
|
||||
if(!defined('DOKU_URL')) define('DOKU_URL',getBaseURL(true));
|
||||
if(!defined('DOKU_BASE')){
|
||||
// define baseURL
|
||||
if(!defined('DOKU_REL')) define('DOKU_REL',getBaseURL(false));
|
||||
if(!defined('DOKU_URL')) define('DOKU_URL',getBaseURL(true));
|
||||
if(!defined('DOKU_BASE')){
|
||||
if($conf['canonical']){
|
||||
define('DOKU_BASE',DOKU_URL);
|
||||
}else{
|
||||
define('DOKU_BASE',DOKU_REL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// define whitespace
|
||||
if(!defined('DOKU_LF')) define ('DOKU_LF',"\n");
|
||||
if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t");
|
||||
// define whitespace
|
||||
if(!defined('DOKU_LF')) define ('DOKU_LF',"\n");
|
||||
if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t");
|
||||
|
||||
// define cookie and session id, append server port when securecookie is configured FS#1664
|
||||
if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:'')));
|
||||
// define cookie and session id, append server port when securecookie is configured FS#1664
|
||||
if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:'')));
|
||||
|
||||
// define Plugin dir
|
||||
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
|
||||
// define Plugin dir
|
||||
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
|
||||
|
||||
// define main script
|
||||
if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php');
|
||||
// define main script
|
||||
if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php');
|
||||
|
||||
// define Template baseURL
|
||||
if(!defined('DOKU_TPL')) define('DOKU_TPL',
|
||||
// define Template baseURL
|
||||
if(!defined('DOKU_TPL')) define('DOKU_TPL',
|
||||
DOKU_BASE.'lib/tpl/'.$conf['template'].'/');
|
||||
|
||||
// define real Template directory
|
||||
if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC',
|
||||
// define real Template directory
|
||||
if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC',
|
||||
DOKU_INC.'lib/tpl/'.$conf['template'].'/');
|
||||
|
||||
// make session rewrites XHTML compliant
|
||||
@ini_set('arg_separator.output', '&');
|
||||
// make session rewrites XHTML compliant
|
||||
@ini_set('arg_separator.output', '&');
|
||||
|
||||
// make sure global zlib does not interfere FS#1132
|
||||
@ini_set('zlib.output_compression', 'off');
|
||||
// make sure global zlib does not interfere FS#1132
|
||||
@ini_set('zlib.output_compression', 'off');
|
||||
|
||||
// increase PCRE backtrack limit
|
||||
@ini_set('pcre.backtrack_limit', '20971520');
|
||||
// increase PCRE backtrack limit
|
||||
@ini_set('pcre.backtrack_limit', '20971520');
|
||||
|
||||
// enable gzip compression if supported
|
||||
$conf['gzip_output'] &= (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false);
|
||||
if ($conf['gzip_output'] &&
|
||||
// enable gzip compression if supported
|
||||
$conf['gzip_output'] &= (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false);
|
||||
if ($conf['gzip_output'] &&
|
||||
!defined('DOKU_DISABLE_GZIP_OUTPUT') &&
|
||||
function_exists('ob_gzhandler')) {
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
}
|
||||
|
||||
// init session
|
||||
if (!headers_sent() && !defined('NOSESSION')){
|
||||
// init session
|
||||
if (!headers_sent() && !defined('NOSESSION')){
|
||||
session_name("DokuWiki");
|
||||
if (version_compare(PHP_VERSION, '5.2.0', '>')) {
|
||||
session_set_cookie_params(0,DOKU_REL,'',($conf['securecookie'] && is_ssl()),true);
|
||||
|
@ -193,49 +198,49 @@
|
|||
$MSG = $_SESSION[DOKU_COOKIE]['msg'];
|
||||
unset($_SESSION[DOKU_COOKIE]['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// kill magic quotes
|
||||
if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
|
||||
// kill magic quotes
|
||||
if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
|
||||
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);
|
||||
@ini_set('magic_quotes_gpc', 0);
|
||||
define('MAGIC_QUOTES_STRIPPED',1);
|
||||
}
|
||||
@set_magic_quotes_runtime(0);
|
||||
@ini_set('magic_quotes_sybase',0);
|
||||
}
|
||||
@set_magic_quotes_runtime(0);
|
||||
@ini_set('magic_quotes_sybase',0);
|
||||
|
||||
// don't let cookies ever interfere with request vars
|
||||
$_REQUEST = array_merge($_GET,$_POST);
|
||||
// don't let cookies ever interfere with request vars
|
||||
$_REQUEST = array_merge($_GET,$_POST);
|
||||
|
||||
// we don't want a purge URL to be digged
|
||||
if($_REQUEST['purge'] && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']);
|
||||
// we don't want a purge URL to be digged
|
||||
if($_REQUEST['purge'] && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']);
|
||||
|
||||
// disable gzip if not available
|
||||
if($conf['compression'] == 'bz2' && !function_exists('bzopen')){
|
||||
// disable gzip if not available
|
||||
if($conf['compression'] == 'bz2' && !function_exists('bzopen')){
|
||||
$conf['compression'] = 'gz';
|
||||
}
|
||||
if($conf['compression'] == 'gz' && !function_exists('gzopen')){
|
||||
}
|
||||
if($conf['compression'] == 'gz' && !function_exists('gzopen')){
|
||||
$conf['compression'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// fix dateformat for upgraders
|
||||
if(strpos($conf['dformat'],'%') === false){
|
||||
// fix dateformat for upgraders
|
||||
if(strpos($conf['dformat'],'%') === false){
|
||||
$conf['dformat'] = '%Y/%m/%d %H:%M';
|
||||
}
|
||||
}
|
||||
|
||||
// precalculate file creation modes
|
||||
init_creationmodes();
|
||||
// precalculate file creation modes
|
||||
init_creationmodes();
|
||||
|
||||
// make real paths and check them
|
||||
init_paths();
|
||||
init_files();
|
||||
// make real paths and check them
|
||||
init_paths();
|
||||
init_files();
|
||||
|
||||
// automatic upgrade to script versions of certain files
|
||||
scriptify(DOKU_CONF.'users.auth');
|
||||
scriptify(DOKU_CONF.'acl.auth');
|
||||
// automatic upgrade to script versions of certain files
|
||||
scriptify(DOKU_CONF.'users.auth');
|
||||
scriptify(DOKU_CONF.'acl.auth');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -497,18 +502,18 @@ function scriptify($file) {
|
|||
*/
|
||||
function nice_die($msg){
|
||||
echo<<<EOT
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head><title>DokuWiki Setup Error</title></head>
|
||||
<body style="font-family: Arial, sans-serif">
|
||||
<html>
|
||||
<head><title>DokuWiki Setup Error</title></head>
|
||||
<body style="font-family: Arial, sans-serif">
|
||||
<div style="width:60%; margin: auto; background-color: #fcc;
|
||||
border: 1px solid #faa; padding: 0.5em 1em;">
|
||||
<h1 style="font-size: 120%">DokuWiki Setup Error</h1>
|
||||
<p>$msg</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
exit;
|
||||
}
|
||||
|
@ -577,4 +582,3 @@ function fullpath($path,$exists=false){
|
|||
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
|
@ -111,9 +111,9 @@ function io_readFile($file,$clean=true){
|
|||
}
|
||||
}
|
||||
/**
|
||||
* Returns the content of a .bz2 compressed file as string
|
||||
* @author marcel senf <marcel@rucksackreinigung.de>
|
||||
*/
|
||||
* Returns the content of a .bz2 compressed file as string
|
||||
* @author marcel senf <marcel@rucksackreinigung.de>
|
||||
*/
|
||||
|
||||
function bzfile($file){
|
||||
$bz = bzopen($file,"r");
|
||||
|
@ -464,7 +464,7 @@ function io_mktmpdir() {
|
|||
* if $useAttachment is false,
|
||||
* - $file is the full filename to save the file, incl. path
|
||||
* - if successful will return true, false otherwise
|
||||
|
||||
*
|
||||
* if $useAttachment is true,
|
||||
* - $file is the directory where the file should be saved
|
||||
* - if successful will return the name used for the saved file, false otherwise
|
||||
|
@ -591,4 +591,3 @@ function io_grep($file,$pattern,$max=0,$backref=false){
|
|||
return $matches;
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
11
inc/mail.php
11
inc/mail.php
|
@ -27,7 +27,7 @@ if(!defined('MAILHEADER_EOL')) define('MAILHEADER_EOL',"\n");
|
|||
*
|
||||
* @author Chris Smith <chris@jalakai.co.uk>
|
||||
* Check if a given mail address is valid
|
||||
*/
|
||||
*/
|
||||
if (!defined('RFC2822_ATEXT')) define('RFC2822_ATEXT',"0-9a-zA-Z!#$%&'*+/=?^_`{|}~-");
|
||||
if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['.RFC2822_ATEXT.']+(?:\.['.RFC2822_ATEXT.']+)*@(?i:[0-9a-z][0-9a-z-]*\.)+(?i:[a-z]{2,4}|museum|travel)');
|
||||
|
||||
|
@ -206,8 +206,9 @@ function mail_isvalid($email){
|
|||
function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true) {
|
||||
// split text into lines
|
||||
$aLines= preg_split("/(?:\r\n|\r|\n)/", $sText);
|
||||
$cnt = count($aLines);
|
||||
|
||||
for ($i=0;$i<count($aLines);$i++) {
|
||||
for ($i=0;$i<$cnt;$i++) {
|
||||
$sLine =& $aLines[$i];
|
||||
if (strlen($sLine)===0) continue; // do nothing, if empty
|
||||
|
||||
|
@ -232,12 +233,12 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
|
|||
// here is, where I don't agree with imap_8_bit,
|
||||
// please correct me, if I'm wrong,
|
||||
// or comment next line for RFC2045 conformance, if you like
|
||||
if (!($bEmulate_imap_8bit && ($i==count($aLines)-1)))
|
||||
|
||||
if (!($bEmulate_imap_8bit && ($i==count($aLines)-1))){
|
||||
if (($iLastChar==0x09)||($iLastChar==0x20)) {
|
||||
$sLine{$iLength-1}='=';
|
||||
$sLine .= ($iLastChar==0x09)?'09':'20';
|
||||
}
|
||||
}
|
||||
} // imap_8bit encodes x20 before chr(13), too
|
||||
// although IMHO not requested by RFC2045, why not do it safer :)
|
||||
// and why not encode any x20 around chr(10) or chr(13)
|
||||
|
@ -263,5 +264,3 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
|
|||
return implode(MAILHEADER_EOL,$aLines);
|
||||
}
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
|
@ -502,8 +502,6 @@ function media_searchlist($query,$ns,$auth=null){
|
|||
/**
|
||||
* Print action links for a file depending on filetype
|
||||
* and available permissions
|
||||
*
|
||||
* @todo contains inline javascript
|
||||
*/
|
||||
function media_fileactions($item,$auth){
|
||||
global $lang;
|
||||
|
@ -513,7 +511,6 @@ function media_fileactions($item,$auth){
|
|||
echo ' <a href="'.$link.'" target="_blank"><img src="'.DOKU_BASE.'lib/images/magnifier.png" '.
|
||||
'alt="'.$lang['mediaview'].'" title="'.$lang['mediaview'].'" class="btn" /></a>';
|
||||
|
||||
|
||||
// no further actions if not writable
|
||||
if(!$item['writable']) return;
|
||||
|
||||
|
|
|
@ -535,4 +535,3 @@ function isVisiblePage($id){
|
|||
}
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
|
@ -217,7 +217,7 @@ function p_get_instructions($text){
|
|||
// Do the parsing
|
||||
trigger_event('PARSER_WIKITEXT_PREPROCESS', $text);
|
||||
$p = $Parser->parse($text);
|
||||
// dbg($p);
|
||||
// dbg($p);
|
||||
return $p;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,6 @@ function p_render_metadata($id, $orig){
|
|||
$keep = $ID;
|
||||
$ID = $id;
|
||||
|
||||
|
||||
// add an extra key for the event - to tell event handlers the page whose metadata this is
|
||||
$orig['page'] = $id;
|
||||
$evt = new Doku_Event('PARSER_METADATA_RENDER', $orig);
|
||||
|
@ -514,7 +513,6 @@ function p_get_parsermodes(){
|
|||
$obj = new Doku_Parser_Mode_entity(array_keys(getEntities()));
|
||||
$modes[] = array('sort' => $obj->getSort(), 'mode' => 'entity','obj' => $obj );
|
||||
|
||||
|
||||
// add optional camelcase mode
|
||||
if($conf['camelcase']){
|
||||
$obj = new Doku_Parser_Mode_camelcaselink();
|
||||
|
@ -557,7 +555,6 @@ function p_render($mode,$instructions,&$info){
|
|||
$Renderer->entities = getEntities();
|
||||
$Renderer->acronyms = getAcronyms();
|
||||
$Renderer->interwiki = getInterwiki();
|
||||
#$Renderer->badwords = getBadWords();
|
||||
|
||||
// Loop through the instructions
|
||||
foreach ( $instructions as $instruction ) {
|
||||
|
@ -672,4 +669,3 @@ function p_xhtml_cached_geshi($code, $language, $wrapper='pre') {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
|
|
@ -35,9 +35,18 @@ class DokuWiki_Plugin {
|
|||
|
||||
// plugin introspection methods
|
||||
// extract from class name, format = <plugin type>_plugin_<name>[_<component name>]
|
||||
function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; }
|
||||
function getPluginName() { list($t, $p, $n) = explode('_', get_class($this), 4); return $n; }
|
||||
function getPluginComponent() { list($t, $p, $n, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); }
|
||||
function getPluginType() {
|
||||
list($t) = explode('_', get_class($this), 2);
|
||||
return $t;
|
||||
}
|
||||
function getPluginName() {
|
||||
list($t, $p, $n) = explode('_', get_class($this), 4);
|
||||
return $n;
|
||||
}
|
||||
function getPluginComponent() {
|
||||
list($t, $p, $n, $c) = explode('_', get_class($this), 4);
|
||||
return (isset($c)?$c:'');
|
||||
}
|
||||
|
||||
// localisation methods
|
||||
/**
|
||||
|
@ -167,8 +176,11 @@ class DokuWiki_Plugin {
|
|||
* @return object helper plugin object
|
||||
*/
|
||||
function loadHelper($name, $msg){
|
||||
if (!plugin_isdisabled($name)) $obj =& plugin_load('helper',$name);
|
||||
else $obj = NULL;
|
||||
if (!plugin_isdisabled($name)){
|
||||
$obj =& plugin_load('helper',$name);
|
||||
}else{
|
||||
$obj = null;
|
||||
}
|
||||
if (is_null($obj) && $msg) msg("Helper plugin $name is not available or invalid.",-1);
|
||||
return $obj;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,28 @@ $plugin_controller = new $plugin_controller_class();
|
|||
/**
|
||||
* Original plugin functions, remain for backwards compatibility
|
||||
*/
|
||||
function plugin_list($type='',$all=false) { global $plugin_controller; return $plugin_controller->getList($type,$all); }
|
||||
function &plugin_load($type,$name,$new=false) { global $plugin_controller; return $plugin_controller->load($type,$name,$new); }
|
||||
function plugin_isdisabled($plugin) { global $plugin_controller; return $plugin_controller->isdisabled($plugin); }
|
||||
function plugin_enable($plugin) { global $plugin_controller; return $plugin_controller->enable($plugin); }
|
||||
function plugin_disable($plugin) { global $plugin_controller; return $plugin_controller->disable($plugin); }
|
||||
function plugin_directory($plugin) { global $plugin_controller; return $plugin_controller->get_directory($plugin); }
|
||||
function plugin_list($type='',$all=false) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->getList($type,$all);
|
||||
}
|
||||
function &plugin_load($type,$name,$new=false) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->load($type,$name,$new);
|
||||
}
|
||||
function plugin_isdisabled($plugin) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->isdisabled($plugin);
|
||||
}
|
||||
function plugin_enable($plugin) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->enable($plugin);
|
||||
}
|
||||
function plugin_disable($plugin) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->disable($plugin);
|
||||
}
|
||||
function plugin_directory($plugin) {
|
||||
global $plugin_controller;
|
||||
return $plugin_controller->get_directory($plugin);
|
||||
}
|
||||
|
||||
|
|
|
@ -391,9 +391,9 @@ function search_fulltext(&$data,$base,$file,$type,$lvl,$opts){
|
|||
$reg .= count($negwords) ? '((?!'.join('|',$negwords).').)*$' : '.*$';
|
||||
search_regex($data,$base,$file,$reg,$poswords);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reference search
|
||||
* This fuction searches for existing references to a given media file
|
||||
* and returns an array with the found pages. It doesn't pay any
|
||||
|
|
|
@ -13,7 +13,7 @@ require_once(DOKU_INC.'inc/JSON.php');
|
|||
/**
|
||||
* Prepares and prints an JavaScript array with all toolbar buttons
|
||||
*
|
||||
* @todo add toolbar plugins
|
||||
* @emits TOOLBAR_DEFINE
|
||||
* @param string $varname Name of the JS variable to fill
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
@ -209,9 +209,6 @@ function toolbar_JSdefines($varname){
|
|||
'icon' => 'sig.png',
|
||||
'key' => 'y',
|
||||
),
|
||||
|
||||
|
||||
|
||||
));
|
||||
} // end event TOOLBAR_DEFINE default action
|
||||
$evt->advise_after();
|
||||
|
|
13
inc/utf8.php
13
inc/utf8.php
|
@ -789,24 +789,24 @@ if(!function_exists('unicode_to_utf8')){
|
|||
|
||||
foreach (array_keys($arr) as $k) {
|
||||
|
||||
# ASCII range (including control chars)
|
||||
if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) {
|
||||
# ASCII range (including control chars)
|
||||
|
||||
echo chr($arr[$k]);
|
||||
|
||||
# 2 byte sequence
|
||||
} else if ($arr[$k] <= 0x07ff) {
|
||||
# 2 byte sequence
|
||||
|
||||
echo chr(0xc0 | ($arr[$k] >> 6));
|
||||
echo chr(0x80 | ($arr[$k] & 0x003f));
|
||||
|
||||
# Byte order mark (skip)
|
||||
} else if($arr[$k] == 0xFEFF) {
|
||||
# Byte order mark (skip)
|
||||
|
||||
// nop -- zap the BOM
|
||||
|
||||
# Test for illegal surrogates
|
||||
} else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) {
|
||||
# Test for illegal surrogates
|
||||
|
||||
// found a surrogate
|
||||
if($strict){
|
||||
|
@ -818,15 +818,15 @@ if(!function_exists('unicode_to_utf8')){
|
|||
return false;
|
||||
}
|
||||
|
||||
# 3 byte sequence
|
||||
} else if ($arr[$k] <= 0xffff) {
|
||||
# 3 byte sequence
|
||||
|
||||
echo chr(0xe0 | ($arr[$k] >> 12));
|
||||
echo chr(0x80 | (($arr[$k] >> 6) & 0x003f));
|
||||
echo chr(0x80 | ($arr[$k] & 0x003f));
|
||||
|
||||
# 4 byte sequence
|
||||
} else if ($arr[$k] <= 0x10ffff) {
|
||||
# 4 byte sequence
|
||||
|
||||
echo chr(0xf0 | ($arr[$k] >> 18));
|
||||
echo chr(0x80 | (($arr[$k] >> 12) & 0x3f));
|
||||
|
@ -1654,5 +1654,4 @@ if(empty($UTF8_ROMANIZATION)) $UTF8_ROMANIZATION = array(
|
|||
'ㅠ'=>'yu','ㅒ'=>'yay','ㅖ'=>'yey',
|
||||
);
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
|
||||
|
|
|
@ -286,7 +286,6 @@ EOT;
|
|||
}
|
||||
$ok = $ok && fileWrite(DOKU_LOCAL.'local.php',$output);
|
||||
|
||||
|
||||
if ($d['acl']) {
|
||||
// create users.auth.php
|
||||
// --- user:MD5password:Real Name:email:groups,comma,seperated
|
||||
|
@ -473,7 +472,6 @@ function langsel(){
|
|||
closedir($dh);
|
||||
sort($langs);
|
||||
|
||||
|
||||
echo '<form action="">';
|
||||
echo $lang['i_chooselang'];
|
||||
echo ': <select name="l" onchange="submit()">';
|
||||
|
|
Loading…
Reference in New Issue