예제 #1
0
    }
    $_SESSION['prefs']['PREF_THEME'] = $addslashes($_POST['theme']);
    $_SESSION['prefs']['PREF_MOBILE_THEME'] = $addslashes($_POST['mobile_theme']);
} else {
    if (isset($_POST['set_default'])) {
        // Once users select to reset theme to the default theme in user perference popup window,
        // apply the default theme immediate. See users/pref_wizard/index.php for
        // resetting other prefs.
        $_SESSION['prefs']['PREF_THEME'] = 'default';
        $_SESSION['prefs']['PREF_MOBILE_THEME'] = 'mobile';
    }
}
// Reset PREF_THEME when:
// 1. If PREF_THEME is not set
// 2. The request is from the mobile device but PREF_THEME is not a mobile theme
if (!isset($_SESSION['prefs']['PREF_THEME']) || $_SESSION['prefs']['PREF_THEME'] == "" || is_mobile_device() && !is_mobile_theme($_SESSION['prefs']['PREF_THEME'])) {
    // 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)) {
예제 #2
0
	    exit;
    }
    
    $_SESSION['prefs']['PREF_THEME'] = $addslashes($_POST['theme']);
    $_SESSION['prefs']['PREF_MOBILE_THEME'] = $addslashes($_POST['mobile_theme']);
} else if ($_POST['set_default']) {
    $_SESSION['prefs']['PREF_THEME'] = 'default';
    $_SESSION['prefs']['PREF_MOBILE_THEME'] = 'mobile';
}

// Reset PREF_THEME when:
// 1. If PREF_THEME is not set 
// 2. The request is from the mobile device but PREF_THEME is not a mobile theme 
if (!isset($_SESSION['prefs']['PREF_THEME']) ||
    $_SESSION['prefs']['PREF_THEME'] == "" ||
    (is_mobile_device() && !is_mobile_theme($_SESSION['prefs']['PREF_THEME']))) {
	// get default
	$default_theme = get_default_theme();
	
	$_SESSION['prefs']['PREF_THEME'] = $default_theme['dir_name'];
}

if (!is_dir(AT_INCLUDE_PATH . '../themes/' . $_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']) && 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'])) {