Пример #1
0
function at_loginpage($vars)
{
    extract($vars);
    $template = $loginpage['template'];
    session_start();
    if (!atIsLoggedIn()) {
        $_SESSION['loggedin'] = 0;
        $_SESSION['login_entered'] = 0;
        return;
    }
    if ($_SESSION['loggedin'] == 1) {
        $_SESSION['login_entered'] = 1;
        return;
    }
    $_SESSION['loggedin'] = 1;
    $_SESSION['login_entered'] = 1;
    if (!$template) {
        $template = "loginpage.html";
    }
    if (@file_exists($themepath . $template)) {
        $file = $themepath . $template;
    } elseif (@file_exists($atdir . "templates/{$template}")) {
        $file = $atdir . "templates/{$template}";
    } else {
        return;
    }
    $HTML = atTemplatePrep($file, 1);
    $output = atCommandReplace($HTML, $command);
    atTemplateDisplay($output);
    atThemeExit();
}
Пример #2
0
function atThemeExit()
{
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    $display = ob_get_contents();
    list($junk, $display) = atTemplateSplit($display, "#AUTOTHEME_START#");
    $display = atThemeAddHeader() . $display;
    $display = str_replace('$', '\\$', $display);
    //atRunningSetVar('display', $display);
    //atCommandAdd('display', 'echo $display;');
    $template = $template['dtd'];
    if (!$template) {
        $template = "HTML401_Transitional.html";
    }
    if (@file_exists($themepath . $template)) {
        $file = $themepath . $template;
    } elseif (@file_exists($atdir . "templates/{$platform}/{$template}")) {
        $file = $atdir . "templates/{$platform}/{$template}";
    } else {
        $file = $atdir . "templates/HTML.html";
    }
    $HTML = atTemplateRead($file);
    $HTML = eregi_replace('\\<\\/head\\>', '', $HTML);
    $HTML = preg_replace('/(\\<\\!--[ ]*\\[|{)display(}|\\][ ]*--\\>)/', $display, $HTML);
    $output = atCommandReplace($HTML);
    ob_end_clean();
    atTemplateDisplay($output);
    return die;
}
Пример #3
0
function at_entrypage($vars)
{
    session_start();
    if (isset($_SESSION['entered'])) {
        return;
    } else {
        $_SESSION['entered'] = 1;
    }
    extract($vars);
    $entrypage = atAutoGetVar("entrypage");
    $template = $entrypage['template'];
    $type = $entrypage['type'];
    switch ($type) {
        case "admin":
            if (!atIsAdminUser()) {
                return;
            }
            break;
        case "anonymous":
            if (atIsLoggedin()) {
                return;
            }
            break;
        case "loggedin":
            if (!atIsLoggedin()) {
                return;
            }
            break;
    }
    if (!$template) {
        $template = "entrypage.html";
    }
    if (@file_exists($themepath . $template)) {
        $file = $themepath . $template;
    } elseif (@file_exists($atdir . "templates/{$template}")) {
        $file = $atdir . "templates/{$template}";
    } else {
        return;
    }
    $HTML = atTemplatePrep($file, 1);
    $output = atCommandReplace($HTML, $command);
    atTemplateDisplay($output);
    atThemeExit();
}
Пример #4
0
function at_maintenance($vars)
{
    extract($vars);
    $maintenance = atAutoGetVar("maintenance");
    $template = $maintenance['template'];
    if (atISAdminUser() || eregi($GLOBALS['admin_file'], $_SERVER['PHP_SELF'])) {
        return;
    }
    if (!$template) {
        $template = "maintenance.html";
    }
    if (@file_exists($themepath . "extras/{$template}")) {
        $file = $themepath . "extras/{$template}";
    } elseif (@file_exists($atdir . "templates/{$template}")) {
        $file = $atdir . "templates/{$template}";
    } else {
        return;
    }
    $HTML = atTemplatePrep($file, 1);
    $output = atCommandReplace($HTML, $command);
    atTemplateDisplay($output);
    atThemeExit();
}
Пример #5
0
function atTemplateCompile($file, $striphead = 1)
{
    $globalconfig = atGetGlobalConfig();
    extract($globalconfig);
    if (!($output = atCompileRead($file))) {
        $HTML = atTemplatePrep($file, $striphead);
        $output = atCommandReplace($HTML, $command);
        atCompileWrite($file, $output);
    }
    return $output;
}
Пример #6
0
function at_transitionpages($transitionpages)
{
    atCommandAdd("page-url", 'echo $_SERVER["REQUEST_URI"];');
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    if (is_array($transitionpages)) {
        if ($transitionpages[$modtemplate][$modops]) {
            $vars = $transitionpages[$modtemplate][$modops];
        } else {
            $vars = array_merge((array) $transitionpages['default'], (array) $transitionpages[$modtemplate][$modops]);
        }
        extract($vars);
    } else {
        return;
    }
    session_start();
    $module = atGetModName();
    if (!isset($_SESSION[$module . '_entered'])) {
        $_SESSION[$module . '_entered'] = 1;
    } else {
        $_SESSION[$module . '_entered']++;
    }
    if ($visits == 0 || $visits == 1 || $_SESSION[$module . '_entered'] % $visits) {
        return;
    }
    switch ($type) {
        case "admin":
            if (!atIsAdminUser()) {
                return;
            }
            break;
        case "anonymous":
            if (atIsLoggedin()) {
                return;
            }
            break;
        case "loggedin":
            if (!atIsLoggedin()) {
                return;
            }
            break;
    }
    if ($rotate) {
        $c = $_SESSION[$module . '_count'];
        $template = $template[$c];
        if (!isset($_SESSION[$module . '_count']) || $_SESSION[$module . '_count'] > count($template) - 1) {
            $_SESSION[$module . '_count'] = 0;
        } else {
            $_SESSION[$module . '_count']++;
        }
    } else {
        $template = $template[0];
    }
    if (!$template) {
        $template = "transitionpages.html";
    }
    if (@file_exists($themepath . $template)) {
        $file = $themepath . $template;
    } elseif (@file_exists($atdir . "templates/{$template}")) {
        $file = $atdir . "templates/{$template}";
    } else {
        return;
    }
    $HTML = atTemplatePrep($file, 1);
    $output = atCommandReplace($HTML, $command);
    atTemplateDisplay($output);
    atThemeExit();
}