Пример #1
0
function AutoTheme_admin_cmsblocks($var)
{
    $var = atExportVar($var);
    extract($var);
    $themepath = at_gettheme_path($themedir);
    $themeconfig = atLoadThemeConfig($themepath);
    extract($themeconfig);
    if ($modops) {
        $themeblocks = $blockcontrol[$thememod][$modops];
    } else {
        $themeblocks = $blockcontrol['default'];
    }
    atAdminThemeLinks($themedir, _AT_BLOCKCONTROL, $var, 1);
    atAdminOpenTable();
    echo "<form method=\"POST\" action=\"" . AT_ADMINPAGE . "\">\n" . "  <input type=\"hidden\" name=\"op\" value=\"updatecmsblocks\">\n" . "  <input type=\"hidden\" name=\"module\" value=\"AutoTheme\">\n" . "  <input type=\"hidden\" name=\"themedir\" value=\"{$themedir}\">\n" . "  <input type=\"hidden\" name=\"thememod\" value=\"{$thememod}\">\n" . "  <input type=\"hidden\" name=\"modops\" value=\"{$modops}\">\n" . "<b>" . _AT_BLOCK . "</b></td><td><b>" . _AT_AUTOBLOCK . "</b></td><td><b>" . _AT_ORDER . "</b></td><td><b>" . _AT_ENABLE . "</b></td></tr><tr><td>\n";
    $autoblock['l'] = _AT_LEFT;
    $autoblock['c'] = _AT_CENTER;
    $autoblock['r'] = _AT_RIGHT;
    $boxes = atGetBlockConfig($themeblocks);
    if ($boxes) {
        foreach ($boxes as $t => $themebox) {
            $abselect = "<select name=\"boxes[{$t}][position]\">";
            foreach ($autoblock as $k => $v) {
                if ($themebox['position'] == $k) {
                    $sel = " selected";
                } else {
                    $sel = "";
                }
                $abselect .= "<option{$sel} value=\"{$k}\">{$v}</option>";
            }
            $abselect .= "</select>";
            $pos = $themebox['position'];
            switch ($pos) {
                case "l":
                    $pos = _AT_LEFT;
                    break;
                case "c":
                    $pos = _AT_CENTER;
                    break;
                case "r":
                    $pos = _AT_RIGHT;
                    break;
                default:
                    $pos = "none";
                    break;
            }
            $yes = $no = "";
            if ($themebox['active']) {
                $yes = " checked";
            } else {
                $no = " checked";
            }
            if ($themebox['position'] == $lastpos) {
                $uplink = "<a href=\"" . AT_ADMINPAGE . "?module=AutoTheme&op=updatecmsblocks&themedir={$themedir}&thememod={$thememod}&modops={$modops}&box={$t}&order=up\">" . _AT_UP . "</a>";
            } else {
                $uplink = _AT_UP;
            }
            $lastpos = $themebox['position'];
            $next = next($boxes);
            if ($themebox['position'] == $next['position']) {
                $downlink = "<a href=\"" . AT_ADMINPAGE . "?module=AutoTheme&op=updatecmsblocks&themedir={$themedir}&thememod={$thememod}&modops={$modops}&box={$t}&order=down\">" . _AT_DOWN . "</a>";
            } else {
                $downlink = _AT_DOWN;
            }
            echo $t . "</td>\n" . "<input type=\"hidden\" name=\"boxes[{$t}][title]\" value=\"{$t}\">\n" . "<td>" . $abselect . $themebox['weight'] . "</td>\n" . "<td>[ {$uplink} | {$downlink} ]</td>\n" . "<td>" . "<input type=\"hidden\" name=\"boxes[{$t}][weight]\" value=\"" . $themebox['weight'] . "\">\n" . "<input type=\"radio\" name=\"boxes[{$t}][active]\" value=\"1\"{$yes}>" . _AT_YES . "\n" . "<input type=\"radio\" name=\"boxes[{$t}][active]\" value=\"0\"{$no}>" . _AT_NO . "</td><td>" . "</td>\n" . "</tr><tr><td>\n";
        }
        echo "<input type=\"submit\" value=\"" . _AT_SAVE . "\" name=\"save\">\n" . "<input type=\"submit\" value=\"" . _AT_RESETTODEFAULTS . "\" name=\"reset\">\n" . "</form></td><td>\n";
    } else {
        echo _AT_NOBOXES;
    }
    atAdminCloseTable();
    if ($modops) {
        $blockcontrol[$thememod][$modops] = $boxes;
    } else {
        $blockcontrol['default'] = $boxes;
    }
    atAdminFooter();
}
Пример #2
0
function at_display_error($message)
{
    atAdminHeader();
    echo $message;
    atAdminFooter();
    die;
}