diff options
Diffstat (limited to 'inc')
48 files changed, 201 insertions, 162 deletions
diff --git a/inc/.htaccess b/inc/.htaccess index aebb21cd2..68ae43e72 100644 --- a/inc/.htaccess +++ b/inc/.htaccess @@ -1,3 +1,4 @@ -## no access to the inc directory
-order allow,deny
-deny from all
+## no access to the inc directory +order allow,deny +deny from all +Satisfy All diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 906a17b2d..6e1d07382 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -29,8 +29,8 @@ class _DiffOp { class _DiffOp_Copy extends _DiffOp { var $type = 'copy'; - - function _DiffOp_Copy($orig, $closing = false) { + + function __construct($orig, $closing = false) { if (!is_array($closing)) $closing = $orig; $this->orig = $orig; @@ -44,8 +44,8 @@ class _DiffOp_Copy extends _DiffOp { class _DiffOp_Delete extends _DiffOp { var $type = 'delete'; - - function _DiffOp_Delete($lines) { + + function __construct($lines) { $this->orig = $lines; $this->closing = false; } @@ -57,8 +57,8 @@ class _DiffOp_Delete extends _DiffOp { class _DiffOp_Add extends _DiffOp { var $type = 'add'; - - function _DiffOp_Add($lines) { + + function __construct($lines) { $this->closing = $lines; $this->orig = false; } @@ -70,8 +70,8 @@ class _DiffOp_Add extends _DiffOp { class _DiffOp_Change extends _DiffOp { var $type = 'change'; - - function _DiffOp_Change($orig, $closing) { + + function __construct($orig, $closing) { $this->orig = $orig; $this->closing = $closing; } @@ -499,7 +499,7 @@ class Diff { * (Typically these are lines from a file.) * @param $to_lines array An array of strings. */ - function Diff($from_lines, $to_lines) { + function __construct($from_lines, $to_lines) { $eng = new _DiffEngine; $this->edits = $eng->diff($from_lines, $to_lines); //$this->_check($from_lines, $to_lines); @@ -645,12 +645,12 @@ class MappedDiff extends Diff { * @param $mapped_to_lines array This array should * have the same number of elements as $to_lines. */ - function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { + function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { assert(count($from_lines) == count($mapped_from_lines)); assert(count($to_lines) == count($mapped_to_lines)); - $this->Diff($mapped_from_lines, $mapped_to_lines); + parent::__construct($mapped_from_lines, $mapped_to_lines); $xi = $yi = 0; $ecnt = count($this->edits); @@ -827,7 +827,8 @@ class DiffFormatter { define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space. class _HWLDF_WordAccumulator { - function _HWLDF_WordAccumulator() { + + function __construct() { $this->_lines = array(); $this->_line = ''; $this->_group = ''; @@ -882,11 +883,11 @@ class _HWLDF_WordAccumulator { class WordLevelDiff extends MappedDiff { - function WordLevelDiff($orig_lines, $closing_lines) { + function __construct($orig_lines, $closing_lines) { list ($orig_words, $orig_stripped) = $this->_split($orig_lines); list ($closing_words, $closing_stripped) = $this->_split($closing_lines); - $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); + parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped); } function _split($lines) { @@ -923,12 +924,12 @@ class WordLevelDiff extends MappedDiff { } class InlineWordLevelDiff extends MappedDiff { - - function InlineWordLevelDiff($orig_lines, $closing_lines) { + + function __construct($orig_lines, $closing_lines) { list ($orig_words, $orig_stripped) = $this->_split($orig_lines); list ($closing_words, $closing_stripped) = $this->_split($closing_lines); - $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); + parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped); } function _split($lines) { @@ -965,7 +966,7 @@ class InlineWordLevelDiff extends MappedDiff { */ class UnifiedDiffFormatter extends DiffFormatter { - function UnifiedDiffFormatter($context_lines = 4) { + function __construct($context_lines = 4) { $this->leading_context_lines = $context_lines; $this->trailing_context_lines = $context_lines; } @@ -996,7 +997,7 @@ class UnifiedDiffFormatter extends DiffFormatter { */ class TableDiffFormatter extends DiffFormatter { - function TableDiffFormatter() { + function __construct() { $this->leading_context_lines = 2; $this->trailing_context_lines = 2; } @@ -1020,7 +1021,7 @@ class TableDiffFormatter extends DiffFormatter { $l1 = $lang['line'].' '.$xbeg; $l2 = $lang['line'].' '.$ybeg; $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n". - ' <td class="diff-blockheader" colspan="2">'.$l2.":</td>\n". + '<td class="diff-blockheader" colspan="2">'.$l2.":</td>\n". "</tr>\n"; return $r; } @@ -1089,7 +1090,7 @@ class TableDiffFormatter extends DiffFormatter { class InlineDiffFormatter extends DiffFormatter { var $colspan = 4; - function InlineDiffFormatter() { + function __construct() { $this->leading_context_lines = 2; $this->trailing_context_lines = 2; } diff --git a/inc/SafeFN.class.php b/inc/SafeFN.class.php index ac6698a63..43b19e9ab 100644 --- a/inc/SafeFN.class.php +++ b/inc/SafeFN.class.php @@ -16,9 +16,9 @@ class SafeFN { // 'safe' characters are a superset of $plain, $pre_indicator and $post_indicator - private static $plain = '-/_0123456789abcdefghijklmnopqrstuvwxyz'; // these characters aren't converted + private static $plain = '-./[_0123456789abcdefghijklmnopqrstuvwxyz'; // these characters aren't converted private static $pre_indicator = '%'; - private static $post_indicator = '.'; + private static $post_indicator = ']'; /** * Convert an UTF-8 string to a safe ASCII String @@ -37,7 +37,7 @@ class SafeFN { * - reduce codepoint value for non-printable ASCII characters (0x00 - 0x1f). Space becomes our zero. * - convert reduced value to base36 (0-9a-z) * - append $pre_indicator characater followed by base36 string to output, set converted flag - * continue to next character) + * (continue to next character) * * @param string $filename a utf8 string, should only include printable characters - not 0x00-0x1f * @return string an encoded representation of $filename using only 'safe' ASCII characters diff --git a/inc/auth.php b/inc/auth.php index 53376be34..a480a4a8a 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -189,8 +189,7 @@ function auth_login($user,$pass,$sticky=false,$silent=false){ if ($auth->checkPass($user,$pass)){ // make logininfo globally available $_SERVER['REMOTE_USER'] = $user; - $secret = auth_cookiesalt(); - if(!$sticky) $secret .= session_id; //bind non-sticky to session + $secret = auth_cookiesalt(!$sticky); //bind non-sticky to session auth_setCookie($user,PMA_blowfish_encrypt($pass,$secret),$sticky); return true; }else{ @@ -220,8 +219,7 @@ function auth_login($user,$pass,$sticky=false,$silent=false){ return true; } // no we don't trust it yet - recheck pass but silent - $secret = auth_cookiesalt(); - if(!$sticky) $secret .= session_id(); //bind non-sticky to session + $secret = auth_cookiesalt(!$sticky); //bind non-sticky to session $pass = PMA_blowfish_decrypt($pass,$secret); return auth_login($user,$pass,$sticky,true); } @@ -303,10 +301,10 @@ function auth_browseruid(){ * and stored in this file. * * @author Andreas Gohr <andi@splitbrain.org> - * + * @param bool $addsession if true, the sessionid is added to the salt * @return string */ -function auth_cookiesalt(){ +function auth_cookiesalt($addsession=false){ global $conf; $file = $conf['metadir'].'/_htcookiesalt'; $salt = io_readFile($file); @@ -314,6 +312,9 @@ function auth_cookiesalt(){ $salt = uniqid(rand(),true); io_saveFile($file,$salt); } + if($addsession){ + $salt .= session_id(); + } return $salt; } @@ -814,11 +815,11 @@ function updateprofile() { if ($result = $auth->triggerUserMod('modify', array($_SERVER['REMOTE_USER'], $changes))) { // update cookie and session with the changed data - $cookie = base64_decode($_COOKIE[DOKU_COOKIE]); - list($user,$sticky,$pass) = explode('|',$cookie,3); - if ($changes['pass']) $pass = PMA_blowfish_encrypt($changes['pass'],auth_cookiesalt()); - - auth_setCookie($_SERVER['REMOTE_USER'],$pass,(bool)$sticky); + if ($changes['pass']){ + list($user,$sticky,$pass) = auth_getCookie(); + $pass = PMA_blowfish_encrypt($changes['pass'],auth_cookiesalt(!$sticky)); + auth_setCookie($_SERVER['REMOTE_USER'],$pass,(bool)$sticky); + } return true; } } diff --git a/inc/form.php b/inc/form.php index 30e16b626..e74c52c5d 100644 --- a/inc/form.php +++ b/inc/form.php @@ -252,7 +252,7 @@ class Doku_Form { global $lang; $form = ''; $this->params['accept-charset'] = $lang['encoding']; - $form .= '<form ' . buildAttributes($this->params,true) . '><div class="no">' . DOKU_LF; + $form .= '<form ' . buildAttributes($this->params,false) . '><div class="no">' . DOKU_LF; if (!empty($this->_hidden)) { foreach ($this->_hidden as $name=>$value) $form .= form_hidden(array('name'=>$name, 'value'=>$value)); diff --git a/inc/html.php b/inc/html.php index fcfa54b6c..6e187ebe1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -355,7 +355,7 @@ function html_search(){ } print '</ul> '; //clear float (see http://www.complexspiral.com/publications/containing-floats/) - print '<div class="clearer"> </div>'; + print '<div class="clearer"></div>'; print '</div>'; } flush(); @@ -457,11 +457,7 @@ function html_revisions($first=0){ $form->addElement($date); $form->addElement(form_makeCloseTag('span')); - $form->addElement(form_makeTag('img', array( - 'src' => DOKU_BASE.'lib/images/blank.gif', - 'width' => '15', - 'height' => '11', - 'alt' => ''))); + $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); $form->addElement(form_makeOpenTag('a', array( 'class' => 'wikilink1', @@ -499,11 +495,7 @@ function html_revisions($first=0){ 'name' => 'rev2[]', 'value' => $rev))); }else{ - $form->addElement(form_makeTag('img', array( - 'src' => DOKU_BASE.'lib/images/blank.gif', - 'width' => 14, - 'height' => 11, - 'alt' => ''))); + $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); } $form->addElement(form_makeOpenTag('span', array('class' => 'date'))); @@ -524,11 +516,7 @@ function html_revisions($first=0){ $form->addElement($ID); $form->addElement(form_makeCloseTag('a')); }else{ - $form->addElement(form_makeTag('img', array( - 'src' => DOKU_BASE.'lib/images/blank.gif', - 'width' => '15', - 'height' => '11', - 'alt' => ''))); + $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); $form->addElement($ID); } @@ -1004,7 +992,7 @@ function html_diff($text='',$intro=true,$type=null){ if($intro) print p_locale_xhtml('diff'); if (!$text) { - ptln('<p class="difflink">'); + ptln('<div class="diffoptions">'); $form = new Doku_Form(array('action'=>wl())); $form->addHidden('id',$ID); @@ -1030,8 +1018,8 @@ function html_diff($text='',$intro=true,$type=null){ 'rev2[1]' => $r_rev, 'difftype' => $type, )); - ptln('<br /><a class="wikilink1" href="'.$diffurl.'">'.$lang['difflink'].'</a>'); - ptln('</p>'); + ptln('<p><a class="wikilink1" href="'.$diffurl.'">'.$lang['difflink'].'</a></p>'); + ptln('</div>'); } ?> <table class="diff diff_<?php echo $type?>"> @@ -1109,7 +1097,7 @@ function html_register(){ $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); - $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block', array('size'=>'50'))); if (!$conf['autopasswd']) { $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); @@ -1436,7 +1424,7 @@ function html_admin(){ // data security check // @todo: could be checked and only displayed if $conf['savedir'] is under the web root - echo '<a style="border:none; float:right;" target="_blank" + echo '<a style="border:none; float:right;" href="http://www.dokuwiki.org/security#web_access_security"> <img src="data/security.png" alt="Your data directory seems to be protected properly." onerror="this.parentNode.style.display=\'none\'" /></a>'; diff --git a/inc/indexer.php b/inc/indexer.php index b42c092fa..1db966656 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -117,41 +117,41 @@ class Doku_Indexer { * @author Andreas Gohr <andi@splitbrain.org> */ public function addPageWords($page, $text) { - if (!$this->_lock()) + if (!$this->lock()) return "locked"; // load known documents - $pid = $this->_addIndexKey('page', '', $page); + $pid = $this->addIndexKey('page', '', $page); if ($pid === false) { - $this->_unlock(); + $this->unlock(); return false; } $pagewords = array(); // get word usage in page - $words = $this->_getPageWords($text); + $words = $this->getPageWords($text); if ($words === false) { - $this->_unlock(); + $this->unlock(); return false; } if (!empty($words)) { foreach (array_keys($words) as $wlen) { - $index = $this->_getIndex('i', $wlen); + $index = $this->getIndex('i', $wlen); foreach ($words[$wlen] as $wid => $freq) { $idx = ($wid<count($index)) ? $index[$wid] : ''; - $index[$wid] = $this->_updateTuple($idx, $pid, $freq); + $index[$wid] = $this->updateTuple($idx, $pid, $freq); $pagewords[] = "$wlen*$wid"; } - if (!$this->_saveIndex('i', $wlen, $index)) { - $this->_unlock(); + if (!$this->saveIndex('i', $wlen, $index)) { + $this->unlock(); return false; } } } // Remove obsolete index entries - $pageword_idx = $this->_getIndexKey('pageword', '', $pid); + $pageword_idx = $this->getIndexKey('pageword', '', $pid); if ($pageword_idx !== '') { $oldwords = explode(':',$pageword_idx); $delwords = array_diff($oldwords, $pagewords); @@ -164,32 +164,34 @@ class Doku_Indexer { } } foreach ($upwords as $wlen => $widx) { - $index = $this->_getIndex('i', $wlen); + $index = $this->getIndex('i', $wlen); foreach ($widx as $wid) { - $index[$wid] = $this->_updateTuple($index[$wid], $pid, 0); + $index[$wid] = $this->updateTuple($index[$wid], $pid, 0); } - $this->_saveIndex('i', $wlen, $index); + $this->saveIndex('i', $wlen, $index); } } // Save the reverse index $pageword_idx = join(':', $pagewords); - if (!$this->_saveIndexKey('pageword', '', $pid, $pageword_idx)) { - $this->_unlock(); + if (!$this->saveIndexKey('pageword', '', $pid, $pageword_idx)) { + $this->unlock(); return false; } - $this->_unlock(); + $this->unlock(); return true; } /** * Split the words in a page and add them to the index. * + * @param string $text content of the page + * @return array list of word IDs and number of times used * @author Andreas Gohr <andi@splitbrain.org> * @author Christopher Smith <chris@jalakai.co.uk> * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _getPageWords($text) { + protected function getPageWords($text) { global $conf; $tokens = $this->tokenizer($text); @@ -209,7 +211,7 @@ class Doku_Indexer { $word_idx_modified = false; $index = array(); //resulting index foreach (array_keys($words) as $wlen) { - $word_idx = $this->_getIndex('w', $wlen); + $word_idx = $this->getIndex('w', $wlen); foreach ($words[$wlen] as $word => $freq) { $wid = array_search($word, $word_idx); if ($wid === false) { @@ -222,7 +224,7 @@ class Doku_Indexer { $index[$wlen][$wid] = $freq; } // save back the word index - if ($word_idx_modified && !$this->_saveIndex('w', $wlen, $word_idx)) + if ($word_idx_modified && !$this->saveIndex('w', $wlen, $word_idx)) return false; } @@ -252,13 +254,13 @@ class Doku_Indexer { trigger_error("array passed to addMetaKeys but value is not null", E_USER_WARNING); } - if (!$this->_lock()) + if (!$this->lock()) return "locked"; // load known documents - $pid = $this->_addIndexKey('page', '', $page); + $pid = $this->addIndexKey('page', '', $page); if ($pid === false) { - $this->_unlock(); + $this->unlock(); return false; } @@ -267,20 +269,20 @@ class Doku_Indexer { $value = $key['title']; if (is_array($value)) $value = $value[0]; - $this->_saveIndexKey('title', '', $pid, $value); + $this->saveIndexKey('title', '', $pid, $value); unset($key['title']); } foreach ($key as $name => $values) { $metaname = idx_cleanName($name); - $this->_addIndexKey('metadata', '', $metaname); - $metaidx = $this->_getIndex($metaname, '_i'); - $metawords = $this->_getIndex($metaname, '_w'); + $this->addIndexKey('metadata', '', $metaname); + $metaidx = $this->getIndex($metaname.'_i', ''); + $metawords = $this->getIndex($metaname.'_w', ''); $addwords = false; if (!is_array($values)) $values = array($values); - $val_idx = $this->_getIndexKey($metaname, '_p', $pid); + $val_idx = $this->getIndexKey($metaname.'_p', '', $pid); if ($val_idx != '') { $val_idx = explode(':', $val_idx); // -1 means remove, 0 keep, 1 add @@ -308,30 +310,30 @@ class Doku_Indexer { } if ($addwords) - $this->_saveIndex($metaname.'_w', '', $metawords); + $this->saveIndex($metaname.'_w', '', $metawords); $vals_changed = false; foreach ($val_idx as $id => $action) { if ($action == -1) { - $metaidx[$id] = $this->_updateTuple($metaidx[$id], $pid, 0); + $metaidx[$id] = $this->updateTuple($metaidx[$id], $pid, 0); $vals_changed = true; unset($val_idx[$id]); } elseif ($action == 1) { - $metaidx[$id] = $this->_updateTuple($metaidx[$id], $pid, 1); + $metaidx[$id] = $this->updateTuple($metaidx[$id], $pid, 1); $vals_changed = true; } } if ($vals_changed) { - $this->_saveIndex($metaname.'_i', '', $metaidx); + $this->saveIndex($metaname.'_i', '', $metaidx); $val_idx = implode(':', array_keys($val_idx)); - $this->_saveIndexKey($metaname.'_p', '', $pid, $val_idx); + $this->saveIndexKey($metaname.'_p', '', $pid, $val_idx); } unset($metaidx); unset($metawords); } - $this->_unlock(); + $this->unlock(); return true; } @@ -345,18 +347,18 @@ class Doku_Indexer { * @author Tom N Harris <tnharris@whoopdedo.org> */ public function deletePage($page) { - if (!$this->_lock()) + if (!$this->lock()) return "locked"; // load known documents - $pid = $this->_getIndexKey('page', '', $page); + $pid = $this->getIndexKey('page', '', $page); if ($pid === false) { - $this->_unlock(); + $this->unlock(); return false; } // Remove obsolete index entries - $pageword_idx = $this->_getIndexKey('pageword', '', $pid); + $pageword_idx = $this->getIndexKey('pageword', '', $pid); if ($pageword_idx !== '') { $delwords = explode(':',$pageword_idx); $upwords = array(); @@ -368,32 +370,32 @@ class Doku_Indexer { } } foreach ($upwords as $wlen => $widx) { - $index = $this->_getIndex('i', $wlen); + $index = $this->getIndex('i', $wlen); foreach ($widx as $wid) { - $index[$wid] = $this->_updateTuple($index[$wid], $pid, 0); + $index[$wid] = $this->updateTuple($index[$wid], $pid, 0); } - $this->_saveIndex('i', $wlen, $index); + $this->saveIndex('i', $wlen, $index); } } // Save the reverse index - if (!$this->_saveIndexKey('pageword', '', $pid, "")) { - $this->_unlock(); + if (!$this->saveIndexKey('pageword', '', $pid, "")) { + $this->unlock(); return false; } - $this->_saveIndexKey('title', '', $pid, ""); - $keyidx = $this->_getIndex('metadata', ''); + $this->saveIndexKey('title', '', $pid, ""); + $keyidx = $this->getIndex('metadata', ''); foreach ($keyidx as $metaname) { - $val_idx = explode(':', $this->_getIndexKey($metaname.'_p', '', $pid)); - $meta_idx = $this->_getIndex($metaname.'_i', ''); + $val_idx = explode(':', $this->getIndexKey($metaname.'_p', '', $pid)); + $meta_idx = $this->getIndex($metaname.'_i', ''); foreach ($val_idx as $id) { - $meta_idx[$id] = $this->_updateTuple($meta_idx[$id], $pid, 0); + $meta_idx[$id] = $this->updateTuple($meta_idx[$id], $pid, 0); } - $this->_saveIndex($metaname.'_i', '', $meta_idx); - $this->_saveIndexKey($metaname.'_p', '', $pid, ''); + $this->saveIndex($metaname.'_i', '', $meta_idx); + $this->saveIndexKey($metaname.'_p', '', $pid, ''); } - $this->_unlock(); + $this->unlock(); return true; } @@ -469,17 +471,17 @@ class Doku_Indexer { */ public function lookup(&$tokens) { $result = array(); - $wids = $this->_getIndexWords($tokens, $result); + $wids = $this->getIndexWords($tokens, $result); if (empty($wids)) return array(); // load known words and documents - $page_idx = $this->_getIndex('page', ''); + $page_idx = $this->getIndex('page', ''); $docs = array(); foreach (array_keys($wids) as $wlen) { $wids[$wlen] = array_unique($wids[$wlen]); - $index = $this->_getIndex('i', $wlen); + $index = $this->getIndex('i', $wlen); foreach($wids[$wlen] as $ixid) { if ($ixid < count($index)) - $docs["$wlen*$ixid"] = $this->_parseTuples($page_idx, $index[$ixid]); + $docs["$wlen*$ixid"] = $this->parseTuples($page_idx, $index[$ixid]); } } // merge found pages into final result array @@ -531,9 +533,9 @@ class Doku_Indexer { // get all words in order to search the matching ids if ($key == 'title') { - $words = $this->_getIndex('title', ''); + $words = $this->getIndex('title', ''); } else { - $words = $this->_getIndex($metaname, '_w'); + $words = $this->getIndex($metaname.'_w', ''); } if (!is_null($func)) { @@ -576,7 +578,7 @@ class Doku_Indexer { $result[$val] = array(); } - $page_idx = $this->_getIndex('page', ''); + $page_idx = $this->getIndex('page', ''); // Special handling for titles if ($key == 'title') { @@ -588,12 +590,12 @@ class Doku_Indexer { } } else { // load all lines and pages so the used lines can be taken and matched with the pages - $lines = $this->_getIndex($metaname, '_i'); + $lines = $this->getIndex($metaname.'_i', ''); foreach ($value_ids as $value_id => $val_list) { // parse the tuples of the form page_id*1:page2_id*1 and so on, return value // is an array with page_id => 1, page2_id => 1 etc. so take the keys only - $pages = array_keys($this->_parseTuples($page_idx, $lines[$value_id])); + $pages = array_keys($this->parseTuples($page_idx, $lines[$value_id])); foreach ($val_list as $val) { $result[$val] = array_merge($result[$val], $pages); } @@ -616,7 +618,7 @@ class Doku_Indexer { * @return array Set to length => array(id ...) * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _getIndexWords(&$words, &$result) { + protected function getIndexWords(&$words, &$result) { $tokens = array(); $tokenlength = array(); $tokenwild = array(); @@ -656,12 +658,12 @@ class Doku_Indexer { // $tokenlength = array( base word length => base word ... ) // $tokenwild = array( base word => base word length ... ) $length_filter = empty($tokenwild) ? $tokenlength : min(array_keys($tokenlength)); - $indexes_known = $this->_indexLengths($length_filter); + $indexes_known = $this->indexLengths($length_filter); if (!empty($tokenwild)) sort($indexes_known); // get word IDs $wids = array(); foreach ($indexes_known as $ixlen) { - $word_idx = $this->_getIndex('w', $ixlen); + $word_idx = $this->getIndex('w', $ixlen); // handle exact search if (isset($tokenlength[$ixlen])) { foreach ($tokenlength[$ixlen] as $xword) { @@ -697,14 +699,14 @@ class Doku_Indexer { * @author Tom N Harris <tnharris@whoopdedo.org> */ public function getPages($key=null) { - $page_idx = $this->_getIndex('page', ''); + $page_idx = $this->getIndex('page', ''); if (is_null($key)) return $page_idx; $metaname = idx_cleanName($key); // Special handling for titles if ($key == 'title') { - $title_idx = $this->_getIndex('title', ''); + $title_idx = $this->getIndex('title', ''); array_splice($page_idx, count($title_idx)); foreach ($title_idx as $i => $title) if ($title === "") unset($page_idx[$i]); @@ -712,9 +714,9 @@ class Doku_Indexer { } $pages = array(); - $lines = $this->_getIndex($metaname, '_i'); + $lines = $this->getIndex($metaname.'_i', ''); foreach ($lines as $line) { - $pages = array_merge($pages, $this->_parseTuples($page_idx, $line)); + $pages = array_merge($pages, $this->parseTuples($page_idx, $line)); } return array_keys($pages); } @@ -738,7 +740,7 @@ class Doku_Indexer { $result = array(); if ($key == 'title') { - $index = $this->_getIndex('title', ''); + $index = $this->getIndex('title', ''); $index = array_count_values($index); foreach ($index as $val => $cnt) { if ($cnt >= $min && (!$max || $cnt <= $max) && strlen($val) >= $minlen) @@ -747,15 +749,15 @@ class Doku_Indexer { } elseif (!is_null($key)) { $metaname = idx_cleanName($key); - $index = $this->_getIndex($metaname.'_i', ''); + $index = $this->getIndex($metaname.'_i', ''); $val_idx = array(); foreach ($index as $wid => $line) { - $freq = $this->_countTuples($line); + $freq = $this->countTuples($line); if ($freq >= $min && (!$max || $freq <= $max) && strlen($val) >= $minlen) $val_idx[$wid] = $freq; } if (!empty($val_idx)) { - $words = $this->_getIndex($metaname.'_w', ''); + $words = $this->getIndex($metaname.'_w', ''); foreach ($val_idx as $wid => $freq) $result[$words[$wid]] = $freq; } @@ -764,13 +766,13 @@ class Doku_Indexer { $lengths = idx_listIndexLengths(); foreach ($lengths as $length) { if ($length < $minlen) continue; - $index = $this->_getIndex('i', $length); + $index = $this->getIndex('i', $length); $words = null; foreach ($index as $wid => $line) { - $freq = $this->_countTuples($line); + $freq = $this->countTuples($line); if ($freq >= $min && (!$max || $freq <= $max)) { if ($words === null) - $words = $this->_getIndex('w', $length); + $words = $this->getIndex('w', $length); $result[$words[$wid]] = $freq; } } @@ -786,7 +788,7 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _lock() { + protected function lock() { global $conf; $status = true; $run = 0; @@ -816,7 +818,7 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _unlock() { + protected function unlock() { global $conf; @rmdir($conf['lockdir'].'/_indexer.lock'); return true; @@ -825,9 +827,16 @@ class Doku_Indexer { /** * Retrieve the entire index. * + * The $suffix argument is for an index that is split into + * multiple parts. Different index files should use different + * base names. + * + * @param string $idx name of the index + * @param string $suffix subpart identifier + * @return array list of lines without CR or LF * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _getIndex($idx, $suffix) { + protected function getIndex($idx, $suffix) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix.'.idx'; if (!@file_exists($fn)) return array(); @@ -837,9 +846,12 @@ class Doku_Indexer { /** * Replace the contents of the index with an array. * + * @param string $idx name of the index + * @param string $suffix subpart identifier + * @param arrayref $linex list of lines without LF * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _saveIndex($idx, $suffix, &$lines) { + protected function saveIndex($idx, $suffix, &$lines) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix; $fh = @fopen($fn.'.tmp', 'w'); @@ -850,16 +862,20 @@ class Doku_Indexer { chmod($fn.'.tmp', $conf['fperm']); io_rename($fn.'.tmp', $fn.'.idx'); if ($suffix !== '') - $this->_cacheIndexDir($idx, $suffix, empty($lines)); + $this->cacheIndexDir($idx, $suffix, empty($lines)); return true; } /** * Retrieve a line from the index. * + * @param string $idx name of the index + * @param string $suffix subpart identifier + * @param int $id the line number + * @return string a line with trailing whitespace removed * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _getIndexKey($idx, $suffix, $id) { + protected function getIndexKey($idx, $suffix, $id) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix.'.idx'; if (!@file_exists($fn)) return ''; @@ -876,9 +892,13 @@ class Doku_Indexer { /** * Write a line into the index. * + * @param string $idx name of the index + * @param string $suffix subpart identifier + * @param int $id the line number + * @param string $line line to write * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _saveIndexKey($idx, $suffix, $id, $line) { + protected function saveIndexKey($idx, $suffix, $id, $line) { global $conf; if (substr($line, -1) != "\n") $line .= "\n"; @@ -908,22 +928,26 @@ class Doku_Indexer { chmod($fn.'.tmp', $conf['fperm']); io_rename($fn.'.tmp', $fn.'.idx'); if ($suffix !== '') - $this->_cacheIndexDir($idx, $suffix); + $this->cacheIndexDir($idx, $suffix); return true; } /** * Retrieve or insert a value in the index. * + * @param string $idx name of the index + * @param string $suffix subpart identifier + * @param string $value line to find in the index + * @return int line number of the value in the index * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _addIndexKey($idx, $suffix, $value) { - $index = $this->_getIndex($idx, $suffix); + protected function addIndexKey($idx, $suffix, $value) { + $index = $this->getIndex($idx, $suffix); $id = array_search($value, $index); if ($id === false) { $id = count($index); $index[$id] = $value; - if (!$this->_saveIndex($idx, $suffix, $index)) { + if (!$this->saveIndex($idx, $suffix, $index)) { trigger_error("Failed to write $idx index", E_USER_ERROR); return false; } @@ -931,7 +955,7 @@ class Doku_Indexer { return $id; } - private function _cacheIndexDir($idx, $suffix, $delete=false) { + protected function cacheIndexDir($idx, $suffix, $delete=false) { global $conf; if ($idx == 'i') $cachename = $conf['indexdir'].'/lengths'; @@ -968,7 +992,7 @@ class Doku_Indexer { * * @author YoBoY <yoboy.leguesh@gmail.com> */ - private function _listIndexLengths() { + protected function listIndexLengths() { global $conf; $cachename = $conf['indexdir'].'/lengths'; clearstatcache(); @@ -1018,7 +1042,7 @@ class Doku_Indexer { * * @author YoBoY <yoboy.leguesh@gmail.com> */ - private function _indexLengths($filter) { + protected function indexLengths($filter) { global $conf; $idx = array(); if (is_array($filter)) { @@ -1044,7 +1068,7 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _updateTuple($line, $id, $count) { + protected function updateTuple($line, $id, $count) { $newLine = $line; if ($newLine !== '') $newLine = preg_replace('/(^|:)'.preg_quote($id,'/').'\*\d*/', '', $newLine); @@ -1064,7 +1088,7 @@ class Doku_Indexer { * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ - private function _parseTuples(&$keys, $line) { + protected function parseTuples(&$keys, $line) { $result = array(); if ($line == '') return $result; $parts = explode(':', $line); @@ -1084,7 +1108,7 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> */ - private function _countTuples($line) { + protected function countTuples($line) { $freq = 0; $parts = explode(':', $line); foreach ($parts as $tuple) { diff --git a/inc/lang/.htaccess b/inc/lang/.htaccess index 2ca129b12..572f5156f 100644 --- a/inc/lang/.htaccess +++ b/inc/lang/.htaccess @@ -1,3 +1,4 @@ -## no access to the lang directory
-order allow,deny
-deny from all
+## no access to the lang directory +order allow,deny +deny from all +Satisfy All diff --git a/inc/lang/az/admin.txt b/inc/lang/az/admin.txt index 000caa06d..000caa06d 100755..100644 --- a/inc/lang/az/admin.txt +++ b/inc/lang/az/admin.txt diff --git a/inc/lang/az/adminplugins.txt b/inc/lang/az/adminplugins.txt index 62b1f8793..62b1f8793 100755..100644 --- a/inc/lang/az/adminplugins.txt +++ b/inc/lang/az/adminplugins.txt diff --git a/inc/lang/az/backlinks.txt b/inc/lang/az/backlinks.txt index 72a7c858d..72a7c858d 100755..100644 --- a/inc/lang/az/backlinks.txt +++ b/inc/lang/az/backlinks.txt diff --git a/inc/lang/az/conflict.txt b/inc/lang/az/conflict.txt index 908be09f1..908be09f1 100755..100644 --- a/inc/lang/az/conflict.txt +++ b/inc/lang/az/conflict.txt diff --git a/inc/lang/az/denied.txt b/inc/lang/az/denied.txt index a68b08c8c..a68b08c8c 100755..100644 --- a/inc/lang/az/denied.txt +++ b/inc/lang/az/denied.txt diff --git a/inc/lang/az/diff.txt b/inc/lang/az/diff.txt index a944f84f4..a944f84f4 100755..100644 --- a/inc/lang/az/diff.txt +++ b/inc/lang/az/diff.txt diff --git a/inc/lang/az/draft.txt b/inc/lang/az/draft.txt index 65c743de3..65c743de3 100755..100644 --- a/inc/lang/az/draft.txt +++ b/inc/lang/az/draft.txt diff --git a/inc/lang/az/edit.txt b/inc/lang/az/edit.txt index 7ce66307e..7ce66307e 100755..100644 --- a/inc/lang/az/edit.txt +++ b/inc/lang/az/edit.txt diff --git a/inc/lang/az/editrev.txt b/inc/lang/az/editrev.txt index 8e98d2ff3..8e98d2ff3 100755..100644 --- a/inc/lang/az/editrev.txt +++ b/inc/lang/az/editrev.txt diff --git a/inc/lang/az/index.txt b/inc/lang/az/index.txt index dc3ffa3b0..dc3ffa3b0 100755..100644 --- a/inc/lang/az/index.txt +++ b/inc/lang/az/index.txt diff --git a/inc/lang/az/install.html b/inc/lang/az/install.html index d41511438..d41511438 100755..100644 --- a/inc/lang/az/install.html +++ b/inc/lang/az/install.html diff --git a/inc/lang/az/locked.txt b/inc/lang/az/locked.txt index 8ab934443..8ab934443 100755..100644 --- a/inc/lang/az/locked.txt +++ b/inc/lang/az/locked.txt diff --git a/inc/lang/az/login.txt b/inc/lang/az/login.txt index e0a559bc1..e0a559bc1 100755..100644 --- a/inc/lang/az/login.txt +++ b/inc/lang/az/login.txt diff --git a/inc/lang/az/mailtext.txt b/inc/lang/az/mailtext.txt index 439458658..439458658 100755..100644 --- a/inc/lang/az/mailtext.txt +++ b/inc/lang/az/mailtext.txt diff --git a/inc/lang/az/newpage.txt b/inc/lang/az/newpage.txt index c749f20af..c749f20af 100755..100644 --- a/inc/lang/az/newpage.txt +++ b/inc/lang/az/newpage.txt diff --git a/inc/lang/az/norev.txt b/inc/lang/az/norev.txt index 453dad56b..453dad56b 100755..100644 --- a/inc/lang/az/norev.txt +++ b/inc/lang/az/norev.txt diff --git a/inc/lang/az/password.txt b/inc/lang/az/password.txt index 31bf387da..31bf387da 100755..100644 --- a/inc/lang/az/password.txt +++ b/inc/lang/az/password.txt diff --git a/inc/lang/az/preview.txt b/inc/lang/az/preview.txt index dbeaa44f5..dbeaa44f5 100755..100644 --- a/inc/lang/az/preview.txt +++ b/inc/lang/az/preview.txt diff --git a/inc/lang/az/pwconfirm.txt b/inc/lang/az/pwconfirm.txt index 177e5a1fa..177e5a1fa 100755..100644 --- a/inc/lang/az/pwconfirm.txt +++ b/inc/lang/az/pwconfirm.txt diff --git a/inc/lang/az/read.txt b/inc/lang/az/read.txt index 39b31f108..39b31f108 100755..100644 --- a/inc/lang/az/read.txt +++ b/inc/lang/az/read.txt diff --git a/inc/lang/az/recent.txt b/inc/lang/az/recent.txt index 8766d9953..8766d9953 100755..100644 --- a/inc/lang/az/recent.txt +++ b/inc/lang/az/recent.txt diff --git a/inc/lang/az/register.txt b/inc/lang/az/register.txt index eb6386f72..eb6386f72 100755..100644 --- a/inc/lang/az/register.txt +++ b/inc/lang/az/register.txt diff --git a/inc/lang/az/registermail.txt b/inc/lang/az/registermail.txt index 51919756f..51919756f 100755..100644 --- a/inc/lang/az/registermail.txt +++ b/inc/lang/az/registermail.txt diff --git a/inc/lang/az/resendpwd.txt b/inc/lang/az/resendpwd.txt index cc286174a..cc286174a 100755..100644 --- a/inc/lang/az/resendpwd.txt +++ b/inc/lang/az/resendpwd.txt diff --git a/inc/lang/az/revisions.txt b/inc/lang/az/revisions.txt index 7164a9959..7164a9959 100755..100644 --- a/inc/lang/az/revisions.txt +++ b/inc/lang/az/revisions.txt diff --git a/inc/lang/az/searchpage.txt b/inc/lang/az/searchpage.txt index 4f8efe007..4f8efe007 100755..100644 --- a/inc/lang/az/searchpage.txt +++ b/inc/lang/az/searchpage.txt diff --git a/inc/lang/az/showrev.txt b/inc/lang/az/showrev.txt index dd398704b..dd398704b 100755..100644 --- a/inc/lang/az/showrev.txt +++ b/inc/lang/az/showrev.txt diff --git a/inc/lang/az/stopwords.txt b/inc/lang/az/stopwords.txt index 04eb312eb..04eb312eb 100755..100644 --- a/inc/lang/az/stopwords.txt +++ b/inc/lang/az/stopwords.txt diff --git a/inc/lang/az/updateprofile.txt b/inc/lang/az/updateprofile.txt index 569e425d4..569e425d4 100755..100644 --- a/inc/lang/az/updateprofile.txt +++ b/inc/lang/az/updateprofile.txt diff --git a/inc/lang/az/uploadmail.txt b/inc/lang/az/uploadmail.txt index d538f8258..d538f8258 100755..100644 --- a/inc/lang/az/uploadmail.txt +++ b/inc/lang/az/uploadmail.txt diff --git a/inc/lang/az/wordblock.txt b/inc/lang/az/wordblock.txt index ec8b102af..ec8b102af 100755..100644 --- a/inc/lang/az/wordblock.txt +++ b/inc/lang/az/wordblock.txt diff --git a/inc/lang/bg/install.html b/inc/lang/bg/install.html index 6dde7e4ce..9d275d82a 100644 --- a/inc/lang/bg/install.html +++ b/inc/lang/bg/install.html @@ -7,12 +7,11 @@ За да функционира нормално DokuWiki <strong>трябва</strong> да има право за писане в директориите, които съдържат тези файлове. Инсталаторът не може да настройва правата на директориите. -Обикновено трябва да направите това директно от командният ред или ако -ползвате хостинг - през FTP или контролния панела на хоста (примерно cPanel).</p> +Вие трябва да направите това директно от командният ред или ако ползвате хостинг през FTP или контролния панела на хоста (примерно cPanel).</p> <p>Инсталаторът ще настрои вашата DokuWiki конфигурация на <acronym title="списъка за достъп">ACL</acronym>, което ще позволи на администратора да се впише и ползва администраторското меню в DokuWiki за инсталиране на приставки, контрол -на потребители, управление на достъпа до страниците и промяна на останалите настройки. Това не е необходимо за функционирането на DokuWiki, но направи администрирането на DokuWiki по-лесно.</p> +на потребители, управление на достъпа до страниците и промяна на останалите настройки. Това не е необходимо за функционирането на DokuWiki, но направи администрирането по-лесно.</p> -<p>Опитните потребители или потребителите със специални изисквания към настройките имат на разположение информация относно <a href="http://dokuwiki.org/install"> инсталацията</a> -и <a href="http://dokuwiki.org/config">настройките</a>.</p> +<p>Опитните потребители и потребителите със специални изисквания към настройките имат на разположение допълнителна информация относно <a href="http://dokuwiki.org/install">инсталирането</a> +и <a href="http://dokuwiki.org/config">настройването</a>.</p> diff --git a/inc/lang/bg/lang.php b/inc/lang/bg/lang.php index c7c52b70f..1acf39acb 100644 --- a/inc/lang/bg/lang.php +++ b/inc/lang/bg/lang.php @@ -134,7 +134,7 @@ $lang['uploadexist'] = 'Файлът вече съществува. Н $lang['uploadbadcontent'] = 'Каченото съдържание не съответства на файлово разширение %s .'; $lang['uploadspam'] = 'Качването е блокирано от SPAM списъка.'; $lang['uploadxss'] = 'Качването е блокирано, поради възможно зловредно съдържание.'; -$lang['uploadsize'] = 'Файльт за качване е прекалено голям. (макс. %s)'; +$lang['uploadsize'] = 'Файлът за качване е прекалено голям. (макс. %s)'; $lang['deletesucc'] = 'Файлът "%s" бе изтрит.'; $lang['deletefail'] = '"%s" не може да бъде изтрит - проверете правата.'; $lang['mediainuse'] = 'Файлът "%s" не бе изтрит - все още се ползва.'; @@ -241,7 +241,7 @@ $lang['i_wikiname'] = 'Име на Wiki-то'; $lang['i_enableacl'] = 'Ползване на списък за достъп (ACL) [препоръчително]'; $lang['i_superuser'] = 'Супер потребител'; $lang['i_problems'] = 'Открити са проблеми, които възпрепятстват инсталирането. Ще можете да продължите след като отстраните долуизброените проблеми.'; -$lang['i_modified'] = 'Поради мерки за сигурност скрипта ще работи само с нова и непроменена инсталация на Dokuwiki. Трябва да разархивирате отново файловете от сваления архив или да се посъветвате с <a href="http://dokuwiki.org/install">Инструкциите за инсталация на Dokuwiki</a>.'; +$lang['i_modified'] = 'Поради мерки за сигурност инсталатора работи само с нова и непроменена инсталация на Dokuwiki. Трябва да разархивирате отново файловете от сваления архив или да се посъветвате с <a href="http://dokuwiki.org/install">Инструкциите за инсталиране на Dokuwiki</a>.'; $lang['i_funcna'] = 'PHP функцията <code>%s</code> не е достъпна. Може би е забранена от доставчика на хостинг.'; $lang['i_phpver'] = 'Инсталираната версия <code>%s</code> на PHP е по-стара от необходимата <code>%s</code>. Актуализирайте PHP инсталацията.'; $lang['i_permfail'] = '<code>%s</code> не е достъпна за писане от DokuWiki. Трябва да промените правата за достъп до директорията!'; diff --git a/inc/lang/bg/pwconfirm.txt b/inc/lang/bg/pwconfirm.txt index 2c4252e15..802153fd4 100644 --- a/inc/lang/bg/pwconfirm.txt +++ b/inc/lang/bg/pwconfirm.txt @@ -3,7 +3,7 @@ Някой е поискал нова парола за потребител @TITLE@ на @DOKUWIKIURL@ -Ако не сте поискали нова парола, товава просто игнорирайте това писмо. +Ако не сте поискали нова парола, тогава просто игнорирайте това писмо. За да потвърдите, че искането е наистина от вас, моля ползвайте следния линк: diff --git a/inc/lang/eo/lang.php b/inc/lang/eo/lang.php index 305c080f1..4bb1c005d 100644 --- a/inc/lang/eo/lang.php +++ b/inc/lang/eo/lang.php @@ -161,6 +161,9 @@ $lang['yours'] = 'Via Versio'; $lang['diff'] = 'Montri diferencojn el la aktuala versio'; $lang['diff2'] = 'Montri diferencojn inter la elektitaj revizioj'; $lang['difflink'] = 'Ligilo al kompara rigardo'; +$lang['diff_type'] = 'Rigardi malsamojn:'; +$lang['diff_inline'] = 'Samlinie'; +$lang['diff_side'] = 'Apude'; $lang['line'] = 'Linio'; $lang['breadcrumb'] = 'Paŝoj'; $lang['youarehere'] = 'Vi estas ĉi tie'; diff --git a/inc/lang/fi/lang.php b/inc/lang/fi/lang.php index bc52625e0..35f7b3c09 100644 --- a/inc/lang/fi/lang.php +++ b/inc/lang/fi/lang.php @@ -159,6 +159,9 @@ $lang['yours'] = 'Sinun versiosi'; $lang['diff'] = 'Näytä eroavaisuudet nykyiseen versioon'; $lang['diff2'] = 'Näytä eroavaisuudet valittuun versioon'; $lang['difflink'] = 'Linkki vertailunäkymään'; +$lang['diff_type'] = 'Näytä eroavaisuudet:'; +$lang['diff_inline'] = 'Sisäkkäin'; +$lang['diff_side'] = 'Vierekkäin'; $lang['line'] = 'Rivi'; $lang['breadcrumb'] = 'Jäljet'; $lang['youarehere'] = 'Olet täällä'; diff --git a/inc/lang/ja/lang.php b/inc/lang/ja/lang.php index d503bae31..e8999e05b 100644 --- a/inc/lang/ja/lang.php +++ b/inc/lang/ja/lang.php @@ -158,6 +158,9 @@ $lang['yours'] = 'あなたのバージョン'; $lang['diff'] = '現在のリビジョンとの差分を表示'; $lang['diff2'] = '選択したリビジョン間の差分を表示'; $lang['difflink'] = 'この比較画面にリンクする'; +$lang['diff_type'] = '差分の表示方法:'; +$lang['diff_inline'] = 'インライン'; +$lang['diff_side'] = '横に並べる'; $lang['line'] = 'ライン'; $lang['breadcrumb'] = 'トレース'; $lang['youarehere'] = '現在位置'; diff --git a/inc/pageutils.php b/inc/pageutils.php index cd01dcae7..c9bf60135 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -423,8 +423,14 @@ function resolve_mediaid($ns,&$page,&$exists){ */ function resolve_pageid($ns,&$page,&$exists){ global $conf; + global $ID; $exists = false; + //empty address should point to current page + if ($page === "") { + $page = $ID; + } + //keep hashlink if exists then clean both parts if (strpos($page,'#')) { list($page,$hash) = explode('#',$page,2); diff --git a/inc/parser/parser.php b/inc/parser/parser.php index e47ce56fa..68d4e4569 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -828,7 +828,7 @@ class Doku_Parser_Mode_internallink extends Doku_Parser_Mode { function connectTo($mode) { // Word boundaries? - $this->Lexer->addSpecialPattern("\[\[(?:(?:[^[\]]*?\[.*?\])|.+?)\]\]",$mode,'internallink'); + $this->Lexer->addSpecialPattern("\[\[(?:(?:[^[\]]*?\[.*?\])|.*?)\]\]",$mode,'internallink'); } function getSort() { diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 9405d9420..ab295dd01 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -574,11 +574,20 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $params = $parts[1]; } + // For empty $id we need to know the current $ID + // We need this check because _simpleTitle needs + // correct $id and resolve_pageid() use cleanID($id) + // (some things could be lost) + if ($id === '') { + $id = $ID; + } + // default name is based on $id as given $default = $this->_simpleTitle($id); // now first resolve and clean up the $id resolve_pageid(getNS($ID),$id,$exists); + $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); if ( !$isImage ) { if ( $exists ) { |