Skip to content

Commit

Permalink
Expose theme::$is_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Nov 28, 2009
1 parent 22149b5 commit b677778
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/gallery/helpers/theme.php
Expand Up @@ -25,6 +25,7 @@
*/
class theme_Core {
public static $active_theme;
public static $is_admin;

/**
* Load the active theme. This is called at bootstrap time. We will only ever have one theme
Expand All @@ -37,14 +38,14 @@ static function load_themes() {
$path = "/" . $input->get("kohana_uri");
}

$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
$setting_name = $is_admin ? "active_admin_theme" : "active_site_theme";
self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
$setting_name = self::$is_admin ? "active_admin_theme" : "active_site_theme";
if (!(identity::active_user()->admin && $theme_name = $input->get("theme"))) {
$theme_name = module::get_var("gallery", $setting_name);

if (!file_exists(THEMEPATH . $theme_name)) {
Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme.");
$theme_name = $is_admin ? "admin_wind" : "wind";
$theme_name = self::$is_admin ? "admin_wind" : "wind";
module::set_var("gallery", $setting_name, $theme_name);
}
}
Expand Down

0 comments on commit b677778

Please sign in to comment.