예제 #1
0
function at_block_titles()
{
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    $blocktitle = trim(strip_tags($block['title'], ""));
    // Check if title is a language define
    if ($blocktitle[0] == "_" && defined($blocktitle)) {
        $blocktitle = constant($blocktitle);
    }
    // Look for image in themes/thename/images/lang/ then themes/thename/images/
    $titleimage = strtolower(preg_replace("^\\W|_^", "", $blocktitle));
    if (@file_exists($imagepath . "{$language}/{$titleimage}.gif")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$language}/{$titleimage}.gif\" border=\"0\" alt=\"{$blocktitle}\" />";
    } elseif (@file_exists($imagepath . "{$titleimage}.gif")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$titleimage}.gif\" border=\"0\" alt=\"{$blocktitle}\" />";
    } elseif (@file_exists($imagepath . "{$language}/{$titleimage}.jpg")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$language}/{$titleimage}.jpg\" border=\"0\" alt=\"{$blocktitle}\" />";
    } elseif (@file_exists($imagepath . "{$titleimage}.jpg")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$titleimage}.jpg\" border=\"0\" alt=\"{$blocktitle}\" />";
    } elseif (@file_exists($imagepath . "{$language}/{$titleimage}.png")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$language}/{$titleimage}.png\" border=\"0\" alt=\"{$blocktitle}\" />";
    } elseif (@file_exists($imagepath . "{$titleimage}.png")) {
        $block['title'] = "<img src=\"{$imagepath}" . "{$titleimage}.png\" border=\"0\" alt=\"{$blocktitle}\" />";
    }
    atCommandBuild($block, "block");
}
예제 #2
0
function atThemeAddHeader()
{
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    $stylesheet = $style['stylesheet'];
    $head = "\n<!--\n************************ AutoTheme 0.87 *************************\n-->\n";
    if (atGetModName() == "AutoTheme") {
        $head .= "<script type=\"text/javascript\" src=\"modules/AutoTheme/javascript/picker.js\"></script>\n" . "<script type=\"text/javascript\">\n" . "  var JS_PATH = \"modules/AutoTheme/javascript/\";\n" . "  var PU_PATH = JS_PATH + \"popups/\";\n" . "</script>\n";
    }
    if (isset($stylesheet)) {
        if (@file_exists($themepath . $stylesheet) && !@is_dir($themepath . $stylesheet)) {
            $head .= "\n<!-- Custom Page stylesheet -->\n";
            $head .= "<link rel=\"stylesheet\" href=\"" . $themepath . $stylesheet . "\" type=\"text/css\"" . ($xhtml ? " />" : ">") . "\n";
        }
    }
    if ($system = atPlatformHeader($xhtml)) {
        $head .= "\n<!-- Head from system -->\n";
        $head .= "{$system}\n";
    }
    if ($style['head']) {
        $head .= "\n<!-- Head from config -->\n";
        $head .= trim($style['head']) . "\n";
    }
    return $head;
}
예제 #3
0
function at_autoimages($display)
{
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    //preg_match_all("|\<img src=\"([^\"]+)\"|", $display, $images);
    preg_match_all("|\\<img src=[\\'\"]([^\\'\"]+)[\\'\"]|", $display, $images);
    foreach ($images[1] as $key => $path) {
        $parts = explode("/", $path);
        $last = count($parts) - 1;
        switch ($parts[0]) {
            case "modules":
                $new = atImageSearch($parts[$last], $parts[1]);
                break;
            case "images":
                $new = atImageSearch($parts[1] . "/" . $parts[$last]);
                break;
        }
        if ($new) {
            $old[$key] = $path;
            $new[$key] = $new;
        }
    }
    $display = str_replace($old, $new, $display);
    return $display;
}
예제 #4
0
 function CloseTable2()
 {
     $runningconfig = atGetRunningConfig();
     extract($runningconfig);
     if ($template['table2']) {
         $file = $template['table2'];
         $template = atTemplateCompile($themepath . $file);
         list($open, $output) = atTemplateSplit($template, "table-content");
         atTemplateDisplay($output);
     } else {
         echo "</td></tr></table></td></tr></table>\n";
     }
 }
예제 #5
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);
                    }
                }
            }
        }
    }
}
예제 #6
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;
    }
}
예제 #7
0
function atImageSearch($path, $module = null)
{
    $runningconfig = atGetRunningConfig();
    extract($runningconfig);
    $path = explode(".", $path);
    $types = array("jpg", "gif", "png");
    if (isset($module)) {
        $paths[] = $imagepath . "modules/{$module}/" . $path[0];
    }
    $paths = array($imagelangpath . $path[0], $imagepath . $path[0], $atpath . "images/" . $path[0]);
    foreach ($types as $type) {
        foreach ($paths as $file) {
            echo "{$file}.{$type}<br>";
            if (file_exists("{$file}.{$type}")) {
                return "{$file}.{$type}";
            }
        }
    }
    return FALSE;
}
예제 #8
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();
}