Skip to content

Commit

Permalink
Replaced almost all Common::DEFAULT_THEME constant with $_CONF['theme…
Browse files Browse the repository at this point in the history
…_geeklog_default'] by using COM_validateTheme where possible
  • Loading branch information
mystralkk committed Apr 9, 2022
1 parent 06ab368 commit 49de585
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
31 changes: 13 additions & 18 deletions public_html/admin/install/classes/Migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,24 +777,6 @@ public function step4()
$_CONF['cookiesecure'] = 0;
}

// check the default theme
if (empty($_CONF['theme'])) {
// try old conf value
$theme = $_OLD_CONF['theme'];
} else {
$theme = $_CONF['theme'];
}

// All themes require a functions.php (ie child themes don't require any template files) so check for that
// At some point could actually check for min geeklog version of theme theme_gl_version which was introduced in Geeklog v2.2.1
if (!file_exists($_CONF['path_themes'] . $theme . '/functions.php')) {
// make sure default theme exists before setting config
if (file_exists($_CONF['path_themes'] . self::DEFAULT_THEME . '/index.thtml')) {
$config->set('theme', self::DEFAULT_THEME);
$_CONF['theme'] = self::DEFAULT_THEME;
}
}

// set noreply_mail when updating from an old version
if (empty($_CONF['noreply_mail']) && !empty($_CONF['site_mail'])) {
$_CONF['noreply_mail'] = $_CONF['site_mail'];
Expand Down Expand Up @@ -921,6 +903,19 @@ public function step4()
self::updateSiteUrl($_OLD_CONF['site_url'], $_CONF['site_url']);
}

// check the default theme
if (empty($_CONF['theme'])) {
// try old conf value
$theme = $_OLD_CONF['theme'];
} else {
$theme = $_CONF['theme'];
}

if (!COM_validateTheme($theme)) {
$_CONF['theme'] = $_CONF['theme_geeklog_default'];
$config->set('theme', $_CONF['theme_geeklog_default']);
}

/**
* Import complete.
*/
Expand Down
16 changes: 6 additions & 10 deletions public_html/admin/install/classes/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,13 @@ private function fixPathsAndUrls($path, $path_html, $site_url, $site_admin_url)
$config->set('path_html', $path_html);
}

// Functions.php is the only file required for a theme
if (!file_exists($_CONF['path_themes'] . $_CONF['theme']
. '/functions.php')
) {
$config->set('path_themes', $path_html . 'layout/');
$config->set('path_themes', $path_html . 'layout/');

if (!file_exists($path_html . 'layout/' . $_CONF['theme']
. '/functions.php')
) {
$config->set('theme', self::DEFAULT_THEME);
}
// Check if the theme is valid
require_once $path_html . 'lib-common.php';

if (!COM_validateTheme($_CONF['theme'])) {
$config->set('theme', $_CONF['theme_geeklog_default']);
}

if (!file_exists($_CONF['path_images'] . 'articles')) {
Expand Down

0 comments on commit 49de585

Please sign in to comment.