diff --git a/class2.php b/class2.php index 078813545..f6f3c5101 100644 --- a/class2.php +++ b/class2.php @@ -630,8 +630,11 @@ if (!function_exists('checkvalidtheme')) function checkvalidtheme($theme_check) { // arg1 = theme to check - global $ADMIN_DIRECTORY, $tp, $e107; - + //global $ADMIN_DIRECTORY, $tp, $e107; + $e107 = e107::getInstance(); + $tp = e107::getParser(); + $ADMIN_DIRECTORY = $e107->getFolder('admin'); + if (ADMIN && strpos(e_QUERY, 'themepreview') !== false) { list($action, $id) = explode('.', e_QUERY); @@ -659,7 +662,7 @@ if (!function_exists('checkvalidtheme')) { function search_validtheme() { - global $e107; + $e107 = e107::getInstance(); $th = substr(e_THEME, 0, -1); $handle = opendir($th); while ($file = readdir($handle)) @@ -681,7 +684,7 @@ if (!function_exists('checkvalidtheme')) echo ''; } } - $themes_dir = $e107->e107_dirs['THEMES_DIRECTORY']; + $themes_dir = $e107->getFolder('themes'); $e107->http_theme_dir = "{$e107->server_path}{$themes_dir}{$e107->site_theme}/"; } } diff --git a/e107_core/shortcodes/single/nextprev.php b/e107_core/shortcodes/single/nextprev.php index 6a4bac06f..5ce49ca75 100644 --- a/e107_core/shortcodes/single/nextprev.php +++ b/e107_core/shortcodes/single/nextprev.php @@ -40,7 +40,7 @@ * - caption (rawurlencode'd string) [optional]: Label, rawurldecode'd after parameters are parsed to array, language constants are supported * - pagetitle (rawurlencode'd string) [optional]: Page labels, rawurldecode'd after parameters are parsed to array, * separated by '|', if present they will be used as lablels instead page numbers; language constants are supported - * - plugins (string) [optional]: plugin name used for template loading + * - plugin (string) [optional]: plugin name used for template loading * - tmpl_prefix (string) [optional]: template keys prefix; core supported are 'default' and 'dropdown', default depends on 'old_np' pref * - navcount (integer) [optional]: number of navigation items to be shown, minimal allowed value is 4, default is 10 * @@ -55,7 +55,7 @@ function nextprev_shortcode($parm = '') $e107 = e107::getInstance(); $pref = e107::getPref(); - include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_np.php'); + e107::coreLan('np'); /** * The NEW way. diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 20eaf39ae..0633e9e82 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -49,7 +49,8 @@ class e107 public $_ip_cache; public $_host_name_cache; - public $site_theme; + public $site_theme; // class2 -> check valid theme + public $http_theme_dir; // class2 -> check valid theme /** * Contains reference to global $_E107 array diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index ed48b38d6..b870afab5 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1813,7 +1813,7 @@ class e_parse /** * Replace e107 path constants * Note: only an ADMIN user can convert {e_ADMIN} - * + * TODO - runtime cache of search/replace arrays (object property) when $mode !== '' * @param string $text * @param string $mode [optional] abs|full "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc * TRUE = produce truncated URL path, e.g. e107plugins/etc @@ -1839,8 +1839,8 @@ class e_parse $e107->getFolder('web_css'), $e107->getFolder('web_image'), $e107->getFolder('web_pack'), - SITEURL.$e107->getFolder('images'), - SITEURL.$e107->getFolder('themes'), + e_IMAGE_ABS, + e_THEME_ABS, $e107->getFolder('images'), $e107->getFolder('plugins'), $e107->getFolder('files'), @@ -1849,7 +1849,10 @@ class e_parse $e107->getFolder('handlers'), $e107->getFolder('media'), $e107->getFolder('web'), - '', + $e107->site_theme ? $e107->getFolder('themes').$e107->site_theme.'/' : '', + defset('THEME_ABS'), + (ADMIN ? $e107->getFolder('admin') : ''), + '' ); switch ($mode) @@ -1875,7 +1878,10 @@ class e_parse '', //no ABS path available e_MEDIA_ABS, e_WEB_ABS, - $e107->server_path, + defset('THEME_ABS'), + defset('THEME_ABS'), + (ADMIN ? e_ADMIN_ABS : ''), + $e107->server_path ); break; @@ -1900,7 +1906,10 @@ class e_parse '', //no ABS path available SITEURLBASE.e_MEDIA_ABS, SITEURLBASE.e_WEB_ABS, - SITEURL, + defset('THEME_ABS') ? SITEURLBASE.THEME_ABS : '', + defset('THEME_ABS') ? SITEURLBASE.THEME_ABS : '', + (ADMIN ? SITEURLBASE.e_ADMIN_ABS : ''), + SITEURL ); break; } @@ -1925,15 +1934,18 @@ class e_parse "{e_HANDLER}", "{e_MEDIA}", "{e_WEB}", + "{THEME}", + "{THEME_ABS}", + "{e_ADMIN}", "{e_BASE}", ); - if (ADMIN) + /*if (ADMIN) { $replace_relative[] = $e107->getFolder('admin'); $replace_absolute[] = SITEURL.$e107->getFolder('admin'); $search[] = "{e_ADMIN}"; - } + }*/ if ($all) { @@ -1949,6 +1961,22 @@ class e_parse } $search[] = "{USERID}"; } + + // current THEME + /*if(!defined('THEME')) + { + //if not already parsed by doReplace + $text = str_replace(array('{THEME}', '{THEME_ABS}'), '', $text); + } + else + { + $replace_relative[] = THEME; + $replace_absolute[] = THEME_ABS; + $search[] = "{THEME}"; + $replace_relative[] = THEME; + $replace_absolute[] = THEME_ABS; + $search[] = "{THEME_ABS}"; + }*/ $replace = ((string)$mode == "full" || (string)$mode=='abs' ) ? $replace_absolute : $replace_relative; return str_replace($search,$replace,$text); @@ -1976,7 +2004,7 @@ class e_parse function doReplace($matches) { - if(defined($matches[1]) && ($matches[1] != 'e_ADMIN' || ADMIN)) + if(defined($matches[1]) && (ADMIN || strpos($matches[1], 'ADMIN') === FALSE)) { return constant($matches[1]); }