コード例 #1
0
ファイル: admin.php プロジェクト: rotvulpix/php-nuke
function AutoTheme_admin_updatecmsblocks($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'];
    }
    if (isset($order)) {
        $boxes = atGetBlockConfig($themeblocks);
        switch ($order) {
            case "up":
                $boxes[$box]['weight']--;
                break;
            case "down":
                $boxes[$box]['weight']++;
                break;
        }
        if ($boxes[$box]['weight'] <= 0) {
            $boxes[$box]['weight'] = 1;
        }
        foreach ($boxes as $bkey => $b) {
            if ($bkey != $box && $b['position'] == $boxes[$box]['position']) {
                $result[$bkey] = $b;
                switch ($order) {
                    case "up":
                        if ($b['weight'] == $boxes[$box]['weight']) {
                            $result[$bkey]['weight']++;
                        }
                        break;
                    case "down":
                        if ($b['weight'] == $boxes[$box]['weight']) {
                            $result[$bkey]['weight']--;
                        }
                        break;
                }
            }
        }
        $boxes = array_merge((array) $boxes, (array) $result);
    }
    if (isset($reset) && !$modops) {
        $boxes = atGetBlocks();
    } elseif (isset($reset) && $modops) {
        $boxes = array();
    }
    uasort($boxes, 'at_block_sort');
    $weight = 0;
    foreach ($boxes as $k => $v) {
        $result[$k]['position'] = $boxes[$k]['position'];
        $result[$k]['active'] = $boxes[$k]['active'];
        if ($boxes[$k]['position'] == $lastpos) {
            $weight++;
        } else {
            $weight = 1;
        }
        $result[$k]['weight'] = $weight;
        $lastpos = $boxes[$k]['position'];
    }
    $boxes = $result;
    if ($modops) {
        $blockcontrol[$thememod][$modops] = $boxes;
    } else {
        $blockcontrol['default'] = $boxes;
    }
    $var = compact("blockcontrol");
    atSaveThemeConfig($themedir, $var);
    Header("Location: " . AT_ADMINPAGE . "?module=AutoTheme&op=cmsblocks&themedir=" . htmlentities(urlencode($themedir)) . "&thememod={$thememod}&modops={$modops}");
    exit;
}
コード例 #2
0
ファイル: atAPI.php プロジェクト: rotvulpix/php-nuke
function atLoadRunningConfig()
{
    $globalconfig = atGetGlobalConfig();
    extract($globalconfig);
    atRunningMultiSetVars($globalconfig);
    $modname = atGetModName();
    $modtemplate = atTemplateGetType($template);
    atLoadCommands();
    atRunningSetVar("command", atGetCommands());
    atRunningSetVar("atdir", $atdir);
    atRunningSetVar("incdir", $incdir);
    atRunningSetVar("extradir", $extradir);
    atRunningSetVar("compiledir", $compiledir);
    atRunningSetVar("platform", $platform);
    atRunningSetVar("platformdir", $platformdir);
    atRunningSetVar("thename", $thename);
    atRunningSetVar("themepath", $themepath);
    atRunningSetVar("imagepath", $imagepath);
    atRunningSetVar("imagelangpath", $imagelangpath);
    atRunningSetVar("imgpath", $imagepath);
    atRunningSetVar("multipath", $multipath);
    atRunningSetVar("modname", $modname);
    atRunningSetVar("modtemplate", $modtemplate);
    atRunningSetVar("language", atGetLang());
    atRunningSetVar("modtype", atGetModType());
    atRunningSetVar("username", atGetUserName());
    atRunningSetVar("is_loggedin", atIsLoggedIn());
    atRunningSetVar("is_admin", atIsAdminUser());
    atRunningSetVar("is_home", atIsHomePage());
    /* 1.7 cfg */
    if (isset($template[$modtemplate]['default'])) {
        $modops = "default";
        $matchlen = 0;
        if ($_SERVER['QUERY_STRING']) {
            foreach ($template[$modtemplate] as $ops => $vals) {
                if (strlen($ops) > $matchlen && eregi($ops, $_SERVER['QUERY_STRING'])) {
                    $modops = $ops;
                    $matchlen = strlen($modops);
                }
            }
        }
        $template = array_merge((array) $template['default'], (array) $template[$modtemplate][$modops]);
        $blockdisplay = array_merge((array) $blockdisplay['default'], (array) $blockdisplay[$modtemplate][$modops]);
        $style = array_merge((array) $style['default'], (array) $style[$modtemplate][$modops]);
        $blocktemplate = array_merge((array) $blocktemplate['default'], (array) $blocktemplate[$modtemplate][$modops]);
        $blockcontrol = array_merge((array) $blockcontrol['default'], (array) $blockcontrol[$modtemplate][$modops]);
    } elseif (isset($template[$modtemplate])) {
        $template = array_merge((array) $template['default'], (array) $template[$modtemplate]);
        $blockdisplay = array_merge((array) $blockdisplay['default'], (array) $blockdisplay[$modtemplate]);
        $style = array_merge((array) $style['default'], (array) $style[$modtemplate]);
    } elseif (!isset($template[$modtemplate])) {
        $template = $template['default'];
        $blockdisplay = $blockdisplay['default'];
        $style = $style['default'];
        if ($blocktemplate['default']) {
            $blocktemplate = $blocktemplate['default'];
        }
        if ($blockcontrol['default']) {
            $blockcontrol = $blockcontrol['default'];
        }
    }
    if (!$modops) {
        $modops = "default";
    }
    atRunningSetVar("modops", $modops);
    if (eregi("xhtml", $template['dtd'])) {
        $xhtml = 1;
    } else {
        $xhtml = 0;
    }
    atRunningSetVar("xhtml", $xhtml);
    extract($style);
    atRunningSetVar("logoimg", $logoimg);
    atRunningSetVar("bgcolor1", $color1);
    atRunningSetVar("bgcolor2", $color2);
    atRunningSetVar("bgcolor3", $color3);
    atRunningSetVar("bgcolor4", $color4);
    atRunningSetVar("textcolor1", $color5);
    atRunningSetVar("textcolor2", $color6);
    atRunningSetVar("tblcolor1", $color7);
    atRunningSetVar("tblcolor2", $color8);
    atRunningSetVar("tblcolor3", $color9);
    atRunningSetVar("tblcolor4", $color10);
    atRunningSetVar("striphead", $striphead);
    $runningconfig = compact("template", "blockdisplay", "style", "blocktemplate", "blockcontrol", "themeversion", "autoblock", "autolang");
    atRunningMultiSetVars($runningconfig);
    atRunningMultiSetVars(atGetLangVars());
    atRunningSetVar("blocklist", atGetBlockConfig());
    return atGetRunningConfig();
}