1199 'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$local_namespace] . $local_page_id ) . '" />' : ''), |
1199 'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$local_namespace] . $local_page_id ) . '" />' : ''), |
1200 'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : ''), |
1200 'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : ''), |
1201 'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme, |
1201 'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme, |
1202 'THEME_ID'=>$this->theme, |
1202 'THEME_ID'=>$this->theme, |
1203 'STYLE_ID'=>$this->style, |
1203 'STYLE_ID'=>$this->style, |
|
1204 'MAIN_PAGE' => getConfig('main_page'), |
1204 'JS_HEADER' => $js_head, |
1205 'JS_HEADER' => $js_head, |
1205 'JS_FOOTER' => $js_foot, |
1206 'JS_FOOTER' => $js_foot, |
1206 'JS_DYNAMIC_VARS'=>$js_dynamic, |
1207 'JS_DYNAMIC_VARS'=>$js_dynamic, |
1207 'UNREAD_PMS'=>$session->unread_pms, |
1208 'UNREAD_PMS'=>$session->unread_pms, |
1208 'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true), |
1209 'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true), |
1943 */ |
1945 */ |
1944 |
1946 |
1945 function username_field($name, $value = false) |
1947 function username_field($name, $value = false) |
1946 { |
1948 { |
1947 $randomid = md5( time() . microtime() . mt_rand() ); |
1949 $randomid = md5( time() . microtime() . mt_rand() ); |
1948 $text = '<input name="'.$name.'" class="autofill username" type="text" size="30" id="userfield_'.$randomid.'"'; |
1950 $text = '<input name="'.$name.'" onkeyup="new AutofillUsername(this);" type="text" size="30" id="userfield_'.$randomid.'" autocomplete="off"'; |
1949 if($value) $text .= ' value="'.$value.'"'; |
1951 if($value) $text .= ' value="'.$value.'"'; |
1950 $text .= ' />'; |
1952 $text .= ' />'; |
1951 return $text; |
1953 return $text; |
1952 } |
1954 } |
1953 |
1955 |
1958 */ |
1960 */ |
1959 |
1961 |
1960 function pagename_field($name, $value = false) |
1962 function pagename_field($name, $value = false) |
1961 { |
1963 { |
1962 $randomid = md5( time() . microtime() . mt_rand() ); |
1964 $randomid = md5( time() . microtime() . mt_rand() ); |
1963 $text = '<input name="'.$name.'" class="autofill page" type="text" size="30" id="pagefield_'.$randomid.'"'; |
1965 $text = '<input name="'.$name.'" onkeyup="new AutofillPage(this);" type="text" size="30" id="pagefield_'.$randomid.'" autocomplete="off"'; |
1964 if($value) $text .= ' value="'.$value.'"'; |
1966 if($value) $text .= ' value="'.$value.'"'; |
1965 $text .= ' />'; |
1967 $text .= ' />'; |
1966 return $text; |
1968 return $text; |
1967 } |
1969 } |
1968 |
1970 |
2050 /** |
2052 /** |
2051 * Fetches the contents of both sidebars. |
2053 * Fetches the contents of both sidebars. |
2052 * @return array - key 0 is left, key 1 is right |
2054 * @return array - key 0 is left, key 1 is right |
2053 * @example list($left, $right) = $template->fetch_sidebar(); |
2055 * @example list($left, $right) = $template->fetch_sidebar(); |
2054 */ |
2056 */ |
2055 |
2057 |
2056 function fetch_sidebar() |
2058 function fetch_sidebar() |
2057 { |
2059 { |
2058 global $db, $session, $paths, $template, $plugins; // Common objects |
2060 global $db, $session, $paths, $template, $plugins; // Common objects |
2059 global $cache; |
2061 global $cache; |
2060 |
2062 |
2069 unset($data['_theme_']); |
2071 unset($data['_theme_']); |
2070 foreach ( $data as &$md ) |
2072 foreach ( $data as &$md ) |
2071 { |
2073 { |
2072 $md = str_replace('$USERNAME$', $session->username, $md); |
2074 $md = str_replace('$USERNAME$', $session->username, $md); |
2073 $md = str_replace('$PAGEID$', $paths->page, $md); |
2075 $md = str_replace('$PAGEID$', $paths->page, $md); |
|
2076 $md = str_replace('$MAIN_PAGE$', getConfig('main_page'), $md); |
2074 } |
2077 } |
2075 return $data; |
2078 return $data; |
2076 } |
2079 } |
2077 } |
2080 } |
2078 |
2081 |
2116 $c = ob_get_contents(); |
2119 $c = ob_get_contents(); |
2117 ob_end_clean(); |
2120 ob_end_clean(); |
2118 break; |
2121 break; |
2119 case BLOCK_PLUGIN: |
2122 case BLOCK_PLUGIN: |
2120 $parser = $this->makeParserText('{CONTENT}'); |
2123 $parser = $this->makeParserText('{CONTENT}'); |
2121 $c = '<!-- PLUGIN -->' . (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. */ ''; |
2124 $c = '<!-- PLUGIN -->' . (gettype($this->fetch_block($row['block_content'])) == 'string') ? |
|
2125 $this->fetch_block($row['block_content']) : |
|
2126 // This used to say "can't find plugin block" but I think it's more friendly to just silently hide it. |
|
2127 ''; |
2122 break; |
2128 break; |
2123 } |
2129 } |
2124 // is there a {restrict} or {hideif} block? |
2130 // is there a {restrict} or {hideif} block? |
2125 if ( preg_match('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', $c, $match) ) |
2131 if ( preg_match('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', $c, $match) ) |
2126 { |
2132 { |
2167 if ( getConfig('cache_thumbs') == '1' && !$session->user_logged_in ) |
2173 if ( getConfig('cache_thumbs') == '1' && !$session->user_logged_in ) |
2168 { |
2174 { |
2169 $cachestore = enano_json_encode($return); |
2175 $cachestore = enano_json_encode($return); |
2170 $cachestore = str_replace($session->username, '$USERNAME$', $cachestore); |
2176 $cachestore = str_replace($session->username, '$USERNAME$', $cachestore); |
2171 $cachestore = str_replace($paths->page, '$PAGEID$', $cachestore); |
2177 $cachestore = str_replace($paths->page, '$PAGEID$', $cachestore); |
|
2178 $cachestore = str_replace('__STATICLINK__', $paths->page, $cachestore); |
|
2179 $cachestore = str_replace('__MAINPAGELINK__', '$MAIN_PAGE$', $cachestore); |
2172 $cachestore = enano_json_decode($cachestore); |
2180 $cachestore = enano_json_decode($cachestore); |
2173 $cachestore['_theme_'] = $this->theme; |
2181 $cachestore['_theme_'] = $this->theme; |
2174 $cache->store('anon_sidebar', $cachestore, 10); |
2182 $cache->store('anon_sidebar', $cachestore, 10); |
|
2183 |
|
2184 foreach ( $return as &$el ) |
|
2185 { |
|
2186 $el = str_replace('__STATICLINK__', $paths->page, $el); |
|
2187 } |
2175 } |
2188 } |
2176 return $return; |
2189 return $return; |
2177 } |
2190 } |
2178 |
2191 |
2179 function initLinksWidget() |
2192 function initLinksWidget() |