예제 #1
0
    // get default
    $_SESSION['prefs']['PREF_THEME'] = get_default_theme();
}
if (!is_dir(AT_SYSTEM_THEME_DIR . $_SESSION['prefs']['PREF_THEME']) && !is_dir(AT_SUBSITE_THEME_DIR . $_SESSION['prefs']['PREF_THEME']) || $_SESSION['prefs']['PREF_THEME'] == '') {
    $_SESSION['prefs']['PREF_THEME'] = get_system_default_theme();
}
// use "mobile" theme for mobile devices. For now, there's only one mobile theme and it's hardcoded.
// When more mobile themes come in, this should be changed.
if (isset($_SESSION['prefs']['PREF_THEME']) && isset($_SESSION['valid_user']) && $_SESSION['valid_user'] === true) {
    //check if the theme is enabled
    $row = queryDB("SELECT status FROM %sthemes WHERE dir_name='%s'", array(TABLE_PREFIX, $_SESSION['prefs']['PREF_THEME']), true);
    if ($row['status'] == 0) {
        // get user defined default theme if the preference theme is disabled
        $default_theme = get_default_theme();
        if (!is_dir(AT_SYSTEM_THEME_DIR . $default_theme) && !is_dir(AT_SUBSITE_THEME_DIR . $default_theme)) {
            $default_theme = get_system_default_theme();
        }
        $_SESSION['prefs']['PREF_THEME'] = $default_theme;
        $msg->addError('THEME_PREVIEW_DISABLED');
    }
}
// find out where PREF_THEME is located
$main_theme_folder = get_main_theme_dir(is_customized_theme($_SESSION['prefs']['PREF_THEME']));
$savant->addPath('template', $main_theme_folder . $_SESSION['prefs']['PREF_THEME'] . '/');
require $main_theme_folder . '../themes/' . $_SESSION['prefs']['PREF_THEME'] . '/theme.cfg.php';
// Define the directory where the customized data lives (used by multi sites):
// Main site: [ATutor-root]
// Subsites: [ATutor-root]/sites/[Subsite-URL]/
$theme_path = "";
if (is_customized_theme($_SESSION['prefs']['PREF_THEME'])) {
    $theme_path = AT_SITES_DIR . $_SERVER['HTTP_HOST'] . '/';
예제 #2
0
if (isset($_SESSION['prefs']['PREF_THEME']) && file_exists(AT_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME']) && isset($_SESSION['valid_user']) && $_SESSION['valid_user']) {
	if ($_SESSION['course_id'] == -1) {
		if ($_SESSION['prefs']['PREF_THEME'] == '' || !is_dir(AT_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME'])) {
			$_SESSION['prefs']['PREF_THEME'] = get_system_default_theme();
		}
	} else {
		//check if enabled
		$sql    = "SELECT status FROM ".TABLE_PREFIX."themes WHERE dir_name = '".$_SESSION['prefs']['PREF_THEME']."'";
		$result = mysql_query($sql, $db);
		$row = mysql_fetch_assoc($result);
		if ($row['status'] > 0) {
		} else {
			// get default
			$default_theme = get_default_theme();
			if (!is_dir(AT_INCLUDE_PATH . '../themes/' . $default_theme['dir_name'])) {
				$default_theme = array('dir_name' => get_system_default_theme());
			}
			$_SESSION['prefs']['PREF_THEME'] = $default_theme['dir_name'];
		}
	}
}

$savant->addPath('template', AT_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME'] . '/');
require(AT_INCLUDE_PATH . '../themes/' . $_SESSION['prefs']['PREF_THEME'] . '/theme.cfg.php');

require(AT_INCLUDE_PATH.'classes/Message/Message.class.php');
$msg = new Message($savant);

$contentManager = new ContentManager($db, isset($_SESSION['course_id']) ? $_SESSION['course_id'] : $_GET['p_course']);
$contentManager->initContent();