예제 #1
0
// Redirects to the index if the URL is invalid (eg. file.php/folder/)
if ($_SERVER['SCRIPT_NAME'] != $_SERVER['PHP_SELF']) {
    redirect($settings['siteurl']);
}
// Load the Global language file
include LOCALE . LOCALESET . "global.php";
if (iADMIN) {
    define("iAUTH", substr(md5($userdata['user_password'] . USER_IP), 16, 16));
    $aidlink = "?aid=" . iAUTH;
}
// PHP-Fusion user cookie functions
if (!isset($_COOKIE[COOKIE_PREFIX . 'visited'])) {
    $result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value=settings_value+1 WHERE settings_name='counter'");
    setcookie(COOKIE_PREFIX . "visited", "yes", time() + 31536000, "/", "", "0");
}
$lastvisited = Authenticate::setLastVisitCookie();
// Set theme
set_theme($userdata['user_theme']);
// Check if a given theme exists and is valid
function theme_exists($theme)
{
    global $settings;
    if ($theme == "Default") {
        $theme = $settings['theme'];
    }
    if (!file_exists(THEMES) || !is_dir(THEMES) || !is_string($theme) || !preg_match("/^([a-z0-9_-]){2,50}\$/i", $theme) || !file_exists(THEMES . $theme)) {
        return FALSE;
    } elseif (file_exists(THEMES . $theme . "/theme.php") && file_exists(THEMES . $theme . "/styles.css")) {
        return TRUE;
    } else {
        return FALSE;