Exemplo n.º 1
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();
}
Exemplo n.º 2
0
function atBlockLoad($location = "", $title = "")
{
    if (!defined('BLOCK_FILE')) {
        define('BLOCK_FILE', true);
    }
    $runningconfig = atGetRunningConfig();
    $blocklist = $runningconfig['blocklist'];
    if ($location) {
        foreach ($blocklist as $block) {
            if ($block['position'] == $location && $block['active'] == 1) {
                $blocks[] = $block;
            }
        }
    } elseif ($title) {
        if ($blocklist[$title]['active'] == 1) {
            $blocks[] = $blocklist[$title];
        }
    }
    if (is_array($blocks)) {
        foreach ($blocks as $theblock) {
            atRunningSetVar("block", $theblock);
            extract($theblock);
            if ($bkey == "admin") {
                adminblock();
            } elseif ($bkey == "userbox") {
                userblock();
            } elseif ($bkey == "") {
                $displaythis = 0;
                if ($view == 0) {
                    $displaythis = 1;
                } elseif ($view == 1 && atIsLoggedIn() || atIsAdminUser()) {
                    $displaythis = 1;
                } elseif ($view == 2 && atIsAdminUser()) {
                    $displaythis = 1;
                } elseif ($view == 3 && !atIsLoggedIn() || atIsAdminUser()) {
                    $displaythis = 1;
                }
                if ($displaythis) {
                    if ($url == "") {
                        if ($blockfile == "") {
                            themesidebox($title, $content);
                        } else {
                            blockfileinc($title, $blockfile);
                        }
                    } else {
                        headlines($bid);
                    }
                }
            }
        }
    }
}
Exemplo n.º 3
0
function at_config_display()
{
    if (!atIsAdminUser()) {
        return;
    }
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    if (isset($_GET['at_admin'])) {
        ob_end_clean();
        OpenTable();
        eval($command['print-link']);
        echo "<h1>AutoTheme</h1><br />";
        switch ($_GET['at_admin']) {
            case "cmds":
                echo "<h2>" . _AT_LOADEDCOMMANDS . "</h2>";
                $commands = atRunningGetVar("command");
                foreach ($runningconfig as $cmd => $action) {
                    $vars = " echo \${$cmd};";
                }
                $commands = array_merge((array) $commands, (array) $vars);
                echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_COMMAND . "</b></td><td width=\"50%\"><b>" . _AT_ACTION . "</b></td><td width=\"50%\"><b>" . _AT_RESULT . "</b></td></tr>";
                foreach ($commands as $cmd => $action) {
                    ob_start();
                    eval($action);
                    $result = ob_get_contents();
                    ob_end_clean();
                    echo "<tr><td valign=\"top\">{$cmd}</td><td valign=\"top\">" . htmlentities($action) . "</td><td valign=\"top\">&nbsp;{$result}</td></tr>";
                }
                echo "</table>";
                break;
            case "at":
                //
                echo "<h2>" . _AT_CONFIG . "</h2>";
                echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>";
                $atconfig = atGetAutoConfig();
                foreach ($atconfig as $name => $val) {
                    if (is_array($val)) {
                        ob_start();
                        at_array_display($val);
                        $result = ob_get_contents();
                        ob_end_clean();
                    } else {
                        $result = $val;
                    }
                    echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>";
                }
                echo "</table>";
                break;
            case "theme":
                echo "<h2>" . _AT_THEMECONFIG . "</h2>";
                echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>";
                $themeconfig = atGetThemeConfig();
                foreach ($themeconfig as $name => $val) {
                    if (is_array($val)) {
                        ob_start();
                        at_array_display($val);
                        $result = ob_get_contents();
                        ob_end_clean();
                    } else {
                        $result = $val;
                    }
                    echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>";
                }
                echo "</table>";
                break;
            case "running":
                echo "<h2>" . _AT_RUNNINGCONFIG . "</h2>";
                echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>";
                $runningconfig = atGetRunningConfig();
                foreach ($runningconfig as $name => $val) {
                    if (is_array($val)) {
                        ob_start();
                        at_array_display($val);
                        $result = ob_get_contents();
                        ob_end_clean();
                    } else {
                        $result = $val;
                    }
                    echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>";
                }
                echo "</table>";
                break;
        }
        CloseTable();
        die;
    }
}
Exemplo n.º 4
0
function atGetCompileFilename($filename, $modifier = "")
{
    $thename = atRunningGetVar('thename');
    if (atIsLoggedIn()) {
        $user = 1;
    } else {
        $user = 0;
    }
    if (atIsAdminUser()) {
        $admin = 1;
    } else {
        $admin = 0;
    }
    $temp = $user . $admin . $thename . $filename . $modifier;
    $filepre = md5($temp);
    return $filepre;
}
Exemplo n.º 5
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();
}