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