10a7415d3SAndreas Gohr<?php 20a7415d3SAndreas Gohr/** 3af1904f9SAndreas Gohr * Translation Plugin: Simple multilanguage plugin 40a7415d3SAndreas Gohr * 50a7415d3SAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 60a7415d3SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 70a7415d3SAndreas Gohr * @author Guy Brand <gb@isis.u-strasbg.fr> 80a7415d3SAndreas Gohr */ 90a7415d3SAndreas Gohr 100a7415d3SAndreas Gohr// must be run within Dokuwiki 110a7415d3SAndreas Gohrif(!defined('DOKU_INC')) die(); 120a7415d3SAndreas Gohr 130a7415d3SAndreas Gohrif(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 140a7415d3SAndreas Gohrrequire_once(DOKU_PLUGIN . 'action.php'); 150a7415d3SAndreas Gohr 160a7415d3SAndreas Gohrclass action_plugin_translation extends DokuWiki_Action_Plugin { 170a7415d3SAndreas Gohr 180a7415d3SAndreas Gohr /** 19c54240efSGuillaume Turri * For the helper plugin 20cabcc95dSDominik Eckelmann * @var helper_plugin_translation 21af1904f9SAndreas Gohr */ 22c54240efSGuillaume Turri var $helper = null; 23af1904f9SAndreas Gohr 24ec6cbde6SDominik Eckelmann var $locale; 25ec6cbde6SDominik Eckelmann 26af1904f9SAndreas Gohr /** 27af1904f9SAndreas Gohr * Constructor. Load helper plugin 28af1904f9SAndreas Gohr */ 29af1904f9SAndreas Gohr function action_plugin_translation() { 30c54240efSGuillaume Turri $this->helper =& plugin_load('helper', 'translation'); 31af1904f9SAndreas Gohr } 32af1904f9SAndreas Gohr 33af1904f9SAndreas Gohr /** 34c54240efSGuillaume Turri * Register the events 350a7415d3SAndreas Gohr */ 3643ffc77dSGerry Weißbach function register(Doku_Event_Handler $controller) { 370a7415d3SAndreas Gohr // should the lang be applied to UI? 38ec6cbde6SDominik Eckelmann $scriptName = basename($_SERVER['PHP_SELF']); 39e5e7e41dSAndreas Gohr 40c54240efSGuillaume Turri // should the lang be applied to UI? 4134591120SDominik Eckelmann if($this->getConf('translateui')) { 42ec6cbde6SDominik Eckelmann switch($scriptName) { 43ec6cbde6SDominik Eckelmann case 'js.php': 44ec6cbde6SDominik Eckelmann $controller->register_hook('INIT_LANG_LOAD', 'BEFORE', $this, 'translation_js'); 45db7c51b4SAndreas Gohr $controller->register_hook('JS_CACHE_USE', 'BEFORE', $this, 'translation_jscache'); 46ec6cbde6SDominik Eckelmann break; 47ec6cbde6SDominik Eckelmann 48ec6cbde6SDominik Eckelmann case 'ajax.php': 49ec6cbde6SDominik Eckelmann $controller->register_hook('INIT_LANG_LOAD', 'BEFORE', $this, 'translate_media_manager'); 50ec6cbde6SDominik Eckelmann break; 51ec6cbde6SDominik Eckelmann 52ec6cbde6SDominik Eckelmann case 'mediamanager.php': 53ec6cbde6SDominik Eckelmann $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'setJsCacheKey'); 54ec6cbde6SDominik Eckelmann break; 55ec6cbde6SDominik Eckelmann 56ec6cbde6SDominik Eckelmann default: 57ec6cbde6SDominik Eckelmann $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'setJsCacheKey'); 58ec6cbde6SDominik Eckelmann } 590a7415d3SAndreas Gohr } 6034591120SDominik Eckelmann 6134591120SDominik Eckelmann if($scriptName !== 'js.php' && $scriptName !== 'ajax.php') { 6234591120SDominik Eckelmann $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'translation_hook'); 6334591120SDominik Eckelmann $controller->register_hook('MEDIAMANAGER_STARTED', 'BEFORE', $this, 'translation_hook'); 6434591120SDominik Eckelmann } 6534591120SDominik Eckelmann 66af1904f9SAndreas Gohr $controller->register_hook('SEARCH_QUERY_PAGELOOKUP', 'AFTER', $this, 'translation_search'); 67cabcc95dSDominik Eckelmann $controller->register_hook('COMMON_PAGETPL_LOAD', 'AFTER', $this, 'page_template_replacement'); 68cabcc95dSDominik Eckelmann } 69cabcc95dSDominik Eckelmann 70bbe70520SAndreas Gohr /** 71bbe70520SAndreas Gohr * Hook Callback. Make current language available as page template placeholder and handle 72bbe70520SAndreas Gohr * original language copying 73bbe70520SAndreas Gohr * 74bbe70520SAndreas Gohr * @param $event 75bbe70520SAndreas Gohr * @param $args 76bbe70520SAndreas Gohr */ 77cabcc95dSDominik Eckelmann function page_template_replacement(&$event, $args) { 78cabcc95dSDominik Eckelmann global $ID; 79bbe70520SAndreas Gohr 80bbe70520SAndreas Gohr // load orginal content as template? 81c54240efSGuillaume Turri if($this->getConf('copytrans') && $this->helper->istranslatable($ID, false)) { 82bbe70520SAndreas Gohr // look for existing translations 83c54240efSGuillaume Turri $translations = $this->helper->getAvailableTranslations($ID); 84bbe70520SAndreas Gohr if($translations) { 85bbe70520SAndreas Gohr // find original language (might've been provided via parameter or use first translation) 86bbe70520SAndreas Gohr $orig = (string) $_REQUEST['fromlang']; 87bbe70520SAndreas Gohr if(!$orig) $orig = array_shift(array_keys($translations)); 88bbe70520SAndreas Gohr 89bbe70520SAndreas Gohr // load file 90bbe70520SAndreas Gohr $origfile = $translations[$orig]; 91bbe70520SAndreas Gohr $event->data['tpl'] = io_readFile(wikiFN($origfile)); 92bbe70520SAndreas Gohr 93bbe70520SAndreas Gohr // prefix with warning 94bbe70520SAndreas Gohr $warn = io_readFile($this->localFN('totranslate')); 95bbe70520SAndreas Gohr if($warn) $warn .= "\n\n"; 96bbe70520SAndreas Gohr $event->data['tpl'] = $warn . $event->data['tpl']; 97bbe70520SAndreas Gohr 98bbe70520SAndreas Gohr // show user a choice of translations if any 99bbe70520SAndreas Gohr if(count($translations) > 1) { 100bbe70520SAndreas Gohr $links = array(); 101bbe70520SAndreas Gohr foreach($translations as $t => $l) { 102c54240efSGuillaume Turri $links[] = '<a href="' . wl($ID, array('do' => 'edit', 'fromlang' => $t)) . '">' . $this->helper->getLocalName($t) . '</a>'; 103bbe70520SAndreas Gohr } 104bbe70520SAndreas Gohr 1055fd0d0d1SAndreas Gohr msg( 1065fd0d0d1SAndreas Gohr sprintf( 107bbe70520SAndreas Gohr $this->getLang('transloaded'), 108c54240efSGuillaume Turri $this->helper->getLocalName($orig), 109bbe70520SAndreas Gohr join(', ', $links) 110bbe70520SAndreas Gohr ) 111bbe70520SAndreas Gohr ); 112bbe70520SAndreas Gohr } 113bbe70520SAndreas Gohr 114bbe70520SAndreas Gohr } 115bbe70520SAndreas Gohr } 116bbe70520SAndreas Gohr 117bbe70520SAndreas Gohr // apply placeholders 118c54240efSGuillaume Turri $event->data['tpl'] = str_replace('@LANG@', $this->helper->realLC(''), $event->data['tpl']); 119c54240efSGuillaume Turri $event->data['tpl'] = str_replace('@TRANS@', $this->helper->getLangPart($ID), $event->data['tpl']); 1200a7415d3SAndreas Gohr } 1210a7415d3SAndreas Gohr 122bbe70520SAndreas Gohr /** 123bbe70520SAndreas Gohr * Hook Callback. Load correct translation when loading JavaScript 124bbe70520SAndreas Gohr * 125bbe70520SAndreas Gohr * @param $event 126bbe70520SAndreas Gohr * @param $args 127bbe70520SAndreas Gohr */ 128bbe70520SAndreas Gohr function translation_js(&$event, $args) { 129bbe70520SAndreas Gohr global $conf; 130bbe70520SAndreas Gohr if(!isset($_GET['lang'])) return; 1315e1f71acSGuillaume Turri if(!in_array($_GET['lang'], $this->helper->translations)) return; 132bbe70520SAndreas Gohr $lang = $_GET['lang']; 133bbe70520SAndreas Gohr $event->data = $lang; 134bbe70520SAndreas Gohr $conf['lang'] = $lang; 135bbe70520SAndreas Gohr } 136bbe70520SAndreas Gohr 137bbe70520SAndreas Gohr /** 138bbe70520SAndreas Gohr * Hook Callback. Pass language code to JavaScript dispatcher 139bbe70520SAndreas Gohr * 140bbe70520SAndreas Gohr * @param $event 141bbe70520SAndreas Gohr * @param $args 142bbe70520SAndreas Gohr * @return bool 143bbe70520SAndreas Gohr */ 144ec6cbde6SDominik Eckelmann function setJsCacheKey(&$event, $args) { 145ec6cbde6SDominik Eckelmann if(!isset($this->locale)) return false; 146ec6cbde6SDominik Eckelmann $count = count($event->data['script']); 147ec6cbde6SDominik Eckelmann for($i = 0; $i < $count; $i++) { 14843ffc77dSGerry Weißbach if(!empty($event->data['script'][$i]['src']) && strpos($event->data['script'][$i]['src'], '/lib/exe/js.php') !== false) { 149db7c51b4SAndreas Gohr $event->data['script'][$i]['src'] .= '&lang=' . hsc($this->locale); 150ec6cbde6SDominik Eckelmann } 151ec6cbde6SDominik Eckelmann } 152ec6cbde6SDominik Eckelmann 153ec6cbde6SDominik Eckelmann return false; 154ec6cbde6SDominik Eckelmann } 155ec6cbde6SDominik Eckelmann 156bbe70520SAndreas Gohr /** 157bbe70520SAndreas Gohr * Hook Callback. Make sure the JavaScript is translation dependent 158bbe70520SAndreas Gohr * 159bbe70520SAndreas Gohr * @param $event 160bbe70520SAndreas Gohr * @param $args 161bbe70520SAndreas Gohr */ 162db7c51b4SAndreas Gohr function translation_jscache(&$event, $args) { 163db7c51b4SAndreas Gohr if(!isset($_GET['lang'])) return; 1645e1f71acSGuillaume Turri if(!in_array($_GET['lang'], $this->helper->translations)) return; 165db7c51b4SAndreas Gohr 166db7c51b4SAndreas Gohr $lang = $_GET['lang']; 167db7c51b4SAndreas Gohr // reuse the constructor to reinitialize the cache key 16800e50232SAndreas Gohr $event->data->__construct ( 169db7c51b4SAndreas Gohr $event->data->key . $lang, 170db7c51b4SAndreas Gohr $event->data->ext 171db7c51b4SAndreas Gohr ); 172ec6cbde6SDominik Eckelmann } 173ec6cbde6SDominik Eckelmann 174bbe70520SAndreas Gohr /** 175bbe70520SAndreas Gohr * Hook Callback. Translate the AJAX loaded media manager 176bbe70520SAndreas Gohr * 177bbe70520SAndreas Gohr * @param $event 178bbe70520SAndreas Gohr * @param $args 179bbe70520SAndreas Gohr */ 180ec6cbde6SDominik Eckelmann function translate_media_manager(&$event, $args) { 181ec6cbde6SDominik Eckelmann global $conf; 182ec6cbde6SDominik Eckelmann if(isset($_REQUEST['ID'])) { 183ec6cbde6SDominik Eckelmann $id = getID(); 184c54240efSGuillaume Turri $lc = $this->helper->getLangPart($id); 185ec6cbde6SDominik Eckelmann } elseif(isset($_SESSION[DOKU_COOKIE]['translationlc'])) { 186ec6cbde6SDominik Eckelmann $lc = $_SESSION[DOKU_COOKIE]['translationlc']; 187ec6cbde6SDominik Eckelmann } else { 188db7c51b4SAndreas Gohr return; 189ec6cbde6SDominik Eckelmann } 190e5e7e41dSAndreas Gohr if(!$lc) return; 191e5e7e41dSAndreas Gohr 192ec6cbde6SDominik Eckelmann $conf['lang'] = $lc; 193ec6cbde6SDominik Eckelmann $event->data = $lc; 194ec6cbde6SDominik Eckelmann } 195ec6cbde6SDominik Eckelmann 1960a7415d3SAndreas Gohr /** 197bbe70520SAndreas Gohr * Hook Callback. Change the UI language in foreign language namespaces 1980a7415d3SAndreas Gohr */ 1990a7415d3SAndreas Gohr function translation_hook(&$event, $args) { 2000a7415d3SAndreas Gohr global $ID; 2010a7415d3SAndreas Gohr global $lang; 2020a7415d3SAndreas Gohr global $conf; 2037053cd66SAndreas Gohr global $ACT; 2047053cd66SAndreas Gohr // redirect away from start page? 2057053cd66SAndreas Gohr if($this->conf['redirectstart'] && $ID == $conf['start'] && $ACT == 'show') { 206c54240efSGuillaume Turri $lc = $this->helper->getBrowserLang(); 2077053cd66SAndreas Gohr if(!$lc) $lc = $conf['lang']; 208a4491becSGerry Weißbach $this->_redirect($lc.':'.$conf['start']); 2097053cd66SAndreas Gohr exit; 2107053cd66SAndreas Gohr } 2110a7415d3SAndreas Gohr 212a4491becSGerry Weißbach // Check if we can redirect 213a4491becSGerry Weißbach if($this->getConf('redirectlocalized')){ 214a4491becSGerry Weißbach $this->translation_redirect_localized(); 215a4491becSGerry Weißbach } 216a4491becSGerry Weißbach 2170a7415d3SAndreas Gohr // check if we are in a foreign language namespace 218c54240efSGuillaume Turri $lc = $this->helper->getLangPart($ID); 219a526927fSAndreas Gohr 220f2279247SAndreas Gohr // store language in session (for page related views only) 221f2279247SAndreas Gohr if(in_array($ACT, array('show', 'recent', 'diff', 'edit', 'preview', 'source', 'subscribe'))) { 222f2279247SAndreas Gohr $_SESSION[DOKU_COOKIE]['translationlc'] = $lc; 223f2279247SAndreas Gohr } 224a526927fSAndreas Gohr if(!$lc) $lc = $_SESSION[DOKU_COOKIE]['translationlc']; 225a526927fSAndreas Gohr if(!$lc) return; 22634591120SDominik Eckelmann $this->locale = $lc; 22734591120SDominik Eckelmann 22834591120SDominik Eckelmann if(!$this->getConf('translateui')) { 22934591120SDominik Eckelmann return true; 23034591120SDominik Eckelmann } 2310a7415d3SAndreas Gohr 2320a7415d3SAndreas Gohr if(file_exists(DOKU_INC . 'inc/lang/' . $lc . '/lang.php')) { 2330a7415d3SAndreas Gohr require(DOKU_INC . 'inc/lang/' . $lc . '/lang.php'); 2340a7415d3SAndreas Gohr } 2350a7415d3SAndreas Gohr $conf['lang_before_translation'] = $conf['lang']; //store for later access in syntax plugin 2360a7415d3SAndreas Gohr $conf['lang'] = $lc; 2370a7415d3SAndreas Gohr 2380a7415d3SAndreas Gohr return true; 2390a7415d3SAndreas Gohr } 240af1904f9SAndreas Gohr 241af1904f9SAndreas Gohr /** 242bbe70520SAndreas Gohr * Hook Callback. Resort page match results so that results are ordered by translation, having the 243af1904f9SAndreas Gohr * default language first 244af1904f9SAndreas Gohr */ 245af1904f9SAndreas Gohr function translation_search(&$event, $args) { 246d75e50bcSAndreas Gohr 247d75e50bcSAndreas Gohr if($event->data['has_titles']) { 248d75e50bcSAndreas Gohr // sort into translation slots 249d75e50bcSAndreas Gohr $res = array(); 250d75e50bcSAndreas Gohr foreach($event->result as $r => $t) { 251c54240efSGuillaume Turri $tr = $this->helper->getLangPart($r); 252d75e50bcSAndreas Gohr if(!is_array($res["x$tr"])) $res["x$tr"] = array(); 253d75e50bcSAndreas Gohr $res["x$tr"][] = array($r, $t); 254d75e50bcSAndreas Gohr } 255d75e50bcSAndreas Gohr // sort by translations 256d75e50bcSAndreas Gohr ksort($res); 257d75e50bcSAndreas Gohr // combine 258d75e50bcSAndreas Gohr $event->result = array(); 259d75e50bcSAndreas Gohr foreach($res as $r) { 260d75e50bcSAndreas Gohr foreach($r as $l) { 261d75e50bcSAndreas Gohr $event->result[$l[0]] = $l[1]; 262d75e50bcSAndreas Gohr } 263d75e50bcSAndreas Gohr } 264d75e50bcSAndreas Gohr } else { 265d75e50bcSAndreas Gohr # legacy support for old DokuWiki hooks 266d75e50bcSAndreas Gohr 267af1904f9SAndreas Gohr // sort into translation slots 268af1904f9SAndreas Gohr $res = array(); 269af1904f9SAndreas Gohr foreach($event->result as $r) { 270c54240efSGuillaume Turri $tr = $this->helper->getLangPart($r); 271af1904f9SAndreas Gohr if(!is_array($res["x$tr"])) $res["x$tr"] = array(); 272af1904f9SAndreas Gohr $res["x$tr"][] = $r; 273af1904f9SAndreas Gohr } 274af1904f9SAndreas Gohr // sort by translations 275af1904f9SAndreas Gohr ksort($res); 276af1904f9SAndreas Gohr // combine 277af1904f9SAndreas Gohr $event->result = array(); 278af1904f9SAndreas Gohr foreach($res as $r) { 279af1904f9SAndreas Gohr $event->result = array_merge($event->result, $r); 280af1904f9SAndreas Gohr } 281af1904f9SAndreas Gohr } 282d75e50bcSAndreas Gohr } 283af1904f9SAndreas Gohr 284a4491becSGerry Weißbach /** 285a4491becSGerry Weißbach * Redirects to the localized version of the page when showing and browser says so and translation was explicitly requested 286a4491becSGerry Weißbach **/ 287a4491becSGerry Weißbach function translation_redirect_localized() { 288a4491becSGerry Weißbach global $ID; 289a4491becSGerry Weißbach global $conf; 290a4491becSGerry Weißbach global $ACT; 291a4491becSGerry Weißbach 292a4491becSGerry Weißbach // redirect to localized page? 293a4491becSGerry Weißbach if( $ACT != 'show' ) { return; } 294a4491becSGerry Weißbach 295a4491becSGerry Weißbach $override = isset($_REQUEST['tns']); // override enabled - comes from the bottom bar. 29643ffc77dSGerry Weißbach $lang = !empty($conf['lang_before_translation']) ? $conf['lang_before_translation'] : $conf['lang']; // Check for original language 297a4491becSGerry Weißbach 298a4491becSGerry Weißbach // get current page language - if empty then default; 299a4491becSGerry Weißbach $currentSessionLanguage = $_SESSION[DOKU_COOKIE]['translationcur']; 300*4e6ef383SGerry Weißbach $pageLang = $this->helper->getLangPart($ID); 301a4491becSGerry Weißbach 302a4491becSGerry Weißbach if ( empty($pageLang) ) { 303a4491becSGerry Weißbach $pageLang = $lang; 304a4491becSGerry Weißbach } 305a4491becSGerry Weißbach 306a4491becSGerry Weißbach // If both match, we're fine. 307a4491becSGerry Weißbach if ( $currentSessionLanguage == $pageLang ) { 308a4491becSGerry Weißbach return; 309a4491becSGerry Weißbach } 310a4491becSGerry Weißbach 311a4491becSGerry Weißbach // check current translation 312a4491becSGerry Weißbach if ( empty( $currentSessionLanguage ) && !$override ) { 313a4491becSGerry Weißbach 314a4491becSGerry Weißbach // If not set - we must just have entered - set the browser language 315*4e6ef383SGerry Weißbach $currentSessionLanguage = $this->helper->getBrowserLang(); 316a4491becSGerry Weißbach 317a4491becSGerry Weißbach // if no browser Language set, take entered namespace language - empty for default. 318a4491becSGerry Weißbach if ( !$currentSessionLanguage ) { 319a4491becSGerry Weißbach $currentSessionLanguage = $pageLang; 320a4491becSGerry Weißbach } 321a4491becSGerry Weißbach 322a4491becSGerry Weißbach // Set new Language 323a4491becSGerry Weißbach $_SESSION[DOKU_COOKIE]['translationcur'] = $currentSessionLanguage; 324a4491becSGerry Weißbach 325a4491becSGerry Weißbach // Write Language back 326a4491becSGerry Weißbach $pageLang = $currentSessionLanguage; 327a4491becSGerry Weißbach } 328a4491becSGerry Weißbach 329a4491becSGerry Weißbach 330a4491becSGerry Weißbach if ( $override && $pageLang != $currentSessionLanguage ) { 331a4491becSGerry Weißbach // Set new Language 332a4491becSGerry Weißbach $currentSessionLanguage = $pageLang; 333a4491becSGerry Weißbach $_SESSION[DOKU_COOKIE]['translationcur'] = $currentSessionLanguage; 334a4491becSGerry Weißbach } else if ( !$override ) { 335a4491becSGerry Weißbach // Write Language back 336a4491becSGerry Weißbach $pageLang = $currentSessionLanguage; 337a4491becSGerry Weißbach } 338a4491becSGerry Weißbach 339a4491becSGerry Weißbach // If this is the default language, make empty 340a4491becSGerry Weißbach if ( $pageLang == $lang ) { 341a4491becSGerry Weißbach $pageLang = ''; 342a4491becSGerry Weißbach } 343a4491becSGerry Weißbach 344a4491becSGerry Weißbach // Generate new Page ID 345*4e6ef383SGerry Weißbach list($newPage,$name) = $this->helper->buildTransID($pageLang,$this->helper->getIDPart($ID)); 346a4491becSGerry Weißbach $newPage = cleanID($newPage); 347a4491becSGerry Weißbach 348a4491becSGerry Weißbach // Check if Page exists 349a4491becSGerry Weißbach if ( $newPage != $ID && page_exists($newPage, '', false) ) { 350a4491becSGerry Weißbach // $newPage redirect 351a4491becSGerry Weißbach 352a4491becSGerry Weißbach if ( auth_quickaclcheck($newPage) < AUTH_READ ) { return; } 353a4491becSGerry Weißbach 354a4491becSGerry Weißbach session_write_close(); 355a4491becSGerry Weißbach $this->_redirect($newPage); 356a4491becSGerry Weißbach } 357a4491becSGerry Weißbach else 358a4491becSGerry Weißbach if ( $override ) { 359a4491becSGerry Weißbach // cleanup redirect 360a4491becSGerry Weißbach session_write_close(); 361a4491becSGerry Weißbach 362a4491becSGerry Weißbach if ( auth_quickaclcheck($newPage) < AUTH_READ ) { return; } 363a4491becSGerry Weißbach 364a4491becSGerry Weißbach $this->_redirect($ID); 365a4491becSGerry Weißbach } 366a4491becSGerry Weißbach 367a4491becSGerry Weißbach // no redirect; 368a4491becSGerry Weißbach } 369a4491becSGerry Weißbach 370a4491becSGerry Weißbach 371a4491becSGerry Weißbach function _redirect($url) 372a4491becSGerry Weißbach { 373a4491becSGerry Weißbach unset($_GET['id']); 374a4491becSGerry Weißbach $more = array(); 375a4491becSGerry Weißbach 376a4491becSGerry Weißbach if ( !empty($_GET) ) { 377a4491becSGerry Weißbach $params = ''; 378a4491becSGerry Weißbach foreach( $_GET as $key => $value ) { 379a4491becSGerry Weißbach // Possible multiple encodings. 380a4491becSGerry Weißbach $more[$key] = $value; 381a4491becSGerry Weißbach } 382a4491becSGerry Weißbach } 383a4491becSGerry Weißbach 384a4491becSGerry Weißbach if ( wl( $url, $more, true, '&') != DOKU_URL . substr($_SERVER['REQUEST_URI'], 1) ) { 385a4491becSGerry Weißbach header('Location: ' . wl( $url, $more, true, '&'), 302); 386a4491becSGerry Weißbach exit; 387a4491becSGerry Weißbach } 388a4491becSGerry Weißbach } 3890a7415d3SAndreas Gohr} 3900a7415d3SAndreas Gohr 391ec6cbde6SDominik Eckelmann//Setup VIM: ex: et ts=4 : 392