diff -r bd5069e1f19a -r c7d737202d59 includes/template.php --- a/includes/template.php Sun Aug 17 23:24:41 2008 -0400 +++ b/includes/template.php Thu Aug 21 08:24:04 2008 -0400 @@ -1201,6 +1201,7 @@ 'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme, 'THEME_ID'=>$this->theme, 'STYLE_ID'=>$this->style, + 'MAIN_PAGE' => getConfig('main_page'), 'JS_HEADER' => $js_head, 'JS_FOOTER' => $js_foot, 'JS_DYNAMIC_VARS'=>$js_dynamic, @@ -1247,6 +1248,7 @@ /** * Performs var init that is common to all pages (IOW, called only once) + * Not used yet because most stuff is either theme-dependent or page-dependent. * @access private */ @@ -1945,7 +1947,7 @@ function username_field($name, $value = false) { $randomid = md5( time() . microtime() . mt_rand() ); - $text = 'fetch_sidebar(); */ - + function fetch_sidebar() { global $db, $session, $paths, $template, $plugins; // Common objects @@ -2071,6 +2073,7 @@ { $md = str_replace('$USERNAME$', $session->username, $md); $md = str_replace('$PAGEID$', $paths->page, $md); + $md = str_replace('$MAIN_PAGE$', getConfig('main_page'), $md); } return $data; } @@ -2118,7 +2121,10 @@ break; case BLOCK_PLUGIN: $parser = $this->makeParserText('{CONTENT}'); - $c = '' . (gettype($this->fetch_block($row['block_content'])) == 'string') ? $this->fetch_block($row['block_content']) : /* This used to say "can't find plugin block" but I think it's more friendly to just silently hide it. */ ''; + $c = '' . (gettype($this->fetch_block($row['block_content'])) == 'string') ? + $this->fetch_block($row['block_content']) : + // This used to say "can't find plugin block" but I think it's more friendly to just silently hide it. + ''; break; } // is there a {restrict} or {hideif} block? @@ -2169,9 +2175,16 @@ $cachestore = enano_json_encode($return); $cachestore = str_replace($session->username, '$USERNAME$', $cachestore); $cachestore = str_replace($paths->page, '$PAGEID$', $cachestore); + $cachestore = str_replace('__STATICLINK__', $paths->page, $cachestore); + $cachestore = str_replace('__MAINPAGELINK__', '$MAIN_PAGE$', $cachestore); $cachestore = enano_json_decode($cachestore); $cachestore['_theme_'] = $this->theme; $cache->store('anon_sidebar', $cachestore, 10); + + foreach ( $return as &$el ) + { + $el = str_replace('__STATICLINK__', $paths->page, $el); + } } return $return; }