if (!class_exists('SugarThemeRegistry')) { require_once 'include/SugarTheme/SugarTheme.php'; } $themeObject = SugarThemeRegistry::current(); $styleJSFilePath = sugar_cached($themeObject->getJSPath() . DIRECTORY_SEPARATOR . 'style-min.js'); if (file_exists($styleJSFilePath)) { logThis("Rebuilding style js file: {$styleJSFilePath}"); unlink($styleJSFilePath); SugarThemeRegistry::current()->clearJSCache(); SugarThemeRegistry::current()->getJS(); } SugarThemeRegistry::buildRegistry(); SugarThemeRegistry::clearAllCaches(); //Clean out the language files logThis("Rebuilding language cache"); sugar_cache_reset_full(); LanguageManager::clearLanguageCache(); //pause tracking again so as to not call newly copied tracker code which may contain calls to new methods not currently loaded $trackerManager = TrackerManager::getInstance(); $trackerManager->pause(); $trackerManager->unsetMonitors(); // re-minify the JS source files $_REQUEST['root_directory'] = getcwd(); $_REQUEST['js_rebuild_concat'] = 'rebuild'; require_once 'jssource/minify.php'; //The buld registry call above will reload the default theme for what was written to the config file during flav conversions //which we don't want to happen until after this request as we have already started rendering with a specific theme. $themeName = (string) $themeObject; if ($themeName != $GLOBALS['sugar_config']['default_theme']) { SugarThemeRegistry::set($themeName); }
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not * reasonably feasible for technical reasons, the Appropriate Legal Notices must * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". ********************************************************************************/ // Bug 57062 /////////////////////////////// if (!empty($_REQUEST['spriteNamespace']) && substr_count($_REQUEST['spriteNamespace'], '..') > 0 || !empty($_REQUEST['imageName']) && substr_count($_REQUEST['imageName'], '..') > 0) { die; } // End Bug 57062 /////////////////////////////// // try to use the user's theme if we can figure it out if (isset($_REQUEST['themeName']) && SugarThemeRegistry::current()->name != $_REQUEST['themeName']) { SugarThemeRegistry::set($_REQUEST['themeName']); } elseif (isset($_SESSION['authenticated_user_theme'])) { SugarThemeRegistry::set($_SESSION['authenticated_user_theme']); } while (substr_count($_REQUEST['imageName'], '..') > 0) { $_REQUEST['imageName'] = str_replace('..', '.', $_REQUEST['imageName']); } if (isset($_REQUEST['spriteNamespace'])) { $filename = "cache/sprites/{$_REQUEST['spriteNamespace']}/{$_REQUEST['imageName']}"; if (!file_exists($filename)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); die; } } else { $filename = SugarThemeRegistry::current()->getImageURL($_REQUEST['imageName']); if (empty($filename)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); die;
/** * Load the themes/images. */ function loadDisplaySettings() { global $theme; $theme = $GLOBALS['current_user']->getBWCTheme(); SugarThemeRegistry::set($theme); require_once 'include/utils/layout_utils.php'; $GLOBALS['image_path'] = SugarThemeRegistry::current()->getImagePath() . '/'; if (defined('TEMPLATE_URL')) { $GLOBALS['image_path'] = TEMPLATE_URL . '/' . $GLOBALS['image_path']; } if (isset($GLOBALS['current_user'])) { $GLOBALS['gridline'] = (int) ($GLOBALS['current_user']->getPreference('gridline') == 'on'); } }
/** * Load the themes/images. */ function loadDisplaySettings() { global $theme; // load the user's default theme $theme = $GLOBALS['current_user']->getPreference('user_theme'); if (is_null($theme)) { $theme = $GLOBALS['sugar_config']['default_theme']; if (!empty($_SESSION['authenticated_user_theme'])) { $theme = $_SESSION['authenticated_user_theme']; } else { if (!empty($_COOKIE['sugar_user_theme'])) { $theme = $_COOKIE['sugar_user_theme']; } } if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') { $_SESSION['theme_changed'] = false; } } $available_themes = SugarThemeRegistry::availableThemes(); if (!isset($available_themes[$theme])) { $theme = $GLOBALS['sugar_config']['default_theme']; } if (!is_null($theme) && !headers_sent()) { setcookie('sugar_user_theme', $theme, time() + 31536000, null, null, false, true); // expires in a year } SugarThemeRegistry::set($theme); require_once 'include/utils/layout_utils.php'; $GLOBALS['image_path'] = SugarThemeRegistry::current()->getImagePath() . '/'; if (defined('TEMPLATE_URL')) { $GLOBALS['image_path'] = TEMPLATE_URL . '/' . $GLOBALS['image_path']; } if (isset($GLOBALS['current_user'])) { $GLOBALS['gridline'] = (int) ($GLOBALS['current_user']->getPreference('gridline') == 'on'); $GLOBALS['current_user']->setPreference('user_theme', $theme, 0, 'global'); } }
public function testSetCurrentTheme() { SugarThemeRegistry::set($this->_themeName); $this->assertInstanceOf('SugarTheme', SugarThemeRegistry::current()); $this->assertEquals(SugarThemeRegistry::current()->__toString(), $this->_themeName); }
/** * Clean up all registered variables and restore $initVars and $systemVars * @static * @return bool status of tearDown */ public static function tearDown() { self::init(); foreach (self::$registeredVars as $varName => $isCalled) { if ($isCalled) { unset(self::$registeredVars[$varName]); if (method_exists(__CLASS__, 'tearDown_' . $varName)) { call_user_func(__CLASS__ . '::tearDown_' . $varName, array()); } elseif (isset($GLOBALS[$varName])) { unset($GLOBALS[$varName]); } } } // Restoring of system variables foreach (self::$initVars as $scope => $vars) { foreach ($vars as $name => $value) { $GLOBALS[$scope][$name] = $value; } } // Restoring of theme SugarThemeRegistry::set(self::$systemVars['SugarThemeRegistry']->dirName); SugarCache::$isCacheReset = false; return true; }
/** * Load the themes/images. */ function loadDisplaySettings() { global $theme; if (isset($_REQUEST['usertheme'])) { $theme = clean_string($_REQUEST['usertheme']); if (!isset($_REQUEST['noThemeSave'])) { $_SESSION['theme_changed'] = true; $_SESSION['authenticated_user_theme'] = $theme; } } else { $theme = !empty($_SESSION['authenticated_user_theme']) ? $_SESSION['authenticated_user_theme'] : $GLOBALS['sugar_config']['default_theme']; if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') { $_SESSION['theme_changed'] = false; } } if (isset($_REQUEST['usercolor'])) { $_SESSION['authenticated_user_theme_color'] = clean_string($_REQUEST['usercolor']); } if (isset($_REQUEST['userfont'])) { $_SESSION['authenticated_user_theme_font'] = clean_string($_REQUEST['userfont']); } SugarThemeRegistry::set($theme); require_once 'include/utils/layout_utils.php'; $GLOBALS['image_path'] = SugarThemeRegistry::current()->getImagePath() . '/'; if (defined('TEMPLATE_URL')) { $GLOBALS['image_path'] = TEMPLATE_URL . '/' . $GLOBALS['image_path']; } if (isset($GLOBALS['current_user'])) { $GLOBALS['gridline'] = (int) ($GLOBALS['current_user']->getPreference('gridline') == 'on'); } }
public function testGetBreadCrumbSymbolForRTLTheme() { $theme = SugarTestThemeUtilities::createAnonymousRTLTheme(); SugarThemeRegistry::set($theme); $this->assertEquals("<span class='pointer'>«</span>", $this->_view->getBreadCrumbSymbol()); }
/** * Load the themes/images. */ function loadDisplaySettings() { global $theme; if (isset($_REQUEST['usertheme'])) { $theme = clean_string($_REQUEST['usertheme']); if (!isset($_REQUEST['noThemeSave'])) { $_SESSION['theme_changed'] = true; $_SESSION['authenticated_user_theme'] = $theme; } } else { $theme = !empty($_SESSION['authenticated_user_theme']) ? $_SESSION['authenticated_user_theme'] : $GLOBALS['sugar_config']['default_theme']; if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') { $_SESSION['theme_changed'] = false; } } if (!empty($_REQUEST['usercolor'])) { $_SESSION['authenticated_user_theme_color'] = clean_string($_REQUEST['usercolor']); self::setCookie('ck_login_theme_color_20', $_REQUEST['usercolor'], time() + 86400 * 90); } elseif (!empty($_COOKIE['ck_login_theme_color_20'])) { $_SESSION['authenticated_user_theme_color'] = clean_string($_COOKIE['ck_login_theme_color_20']); } if (!empty($_REQUEST['userfont'])) { $_SESSION['authenticated_user_theme_font'] = clean_string($_REQUEST['userfont']); self::setCookie('ck_login_theme_font_20', $_REQUEST['userfont'], time() + 86400 * 90); } elseif (!empty($_COOKIE['ck_login_theme_font_20'])) { $_SESSION['authenticated_user_theme_font'] = clean_string($_COOKIE['ck_login_theme_font_20']); } if (isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceof User) { if (isset($_REQUEST['userthemegrouptabs'])) { $GLOBALS['current_user']->setPreference('navigation_paradigm', $_REQUEST['userthemegrouptabs'], 0, 'global', $GLOBALS['current_user']); } } SugarThemeRegistry::set($theme); require_once 'include/utils/layout_utils.php'; $GLOBALS['image_path'] = SugarThemeRegistry::current()->getImagePath() . '/'; if (defined('TEMPLATE_URL')) { $GLOBALS['image_path'] = TEMPLATE_URL . '/' . $GLOBALS['image_path']; } if (isset($GLOBALS['current_user'])) { $GLOBALS['gridline'] = (int) ($GLOBALS['current_user']->getPreference('gridline') == 'on'); } }