Esempio n. 1
0
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;
}
Esempio n. 2
0
function atThemeInit($thename, $force = FALSE)
{
    atErrorCheck();
    if (defined('AUTOTHEME_THEME_INITIALIZED') && !$force) {
        return atGetRunningConfig();
    }
    define('AUTOTHEME_THEME_INITIALIZED', TRUE);
    $globalconfig = atAPIInit();
    extract($globalconfig);
    $platformconfig = atPlatformThemeInit($thename);
    extract($platformconfig);
    $lang = atGetLang();
    $themepath = $multipath . "themes/{$thename}/";
    $imagepath = $themepath . "images/";
    $imagelangpath = $imagepath . "{$lang}/";
    atThemeSetVar("lang", $lang);
    atThemeSetVar("thename", $thename);
    atThemeSetVar("themepath", $themepath);
    atThemeSetVar("imagepath", $imagepath);
    atThemeSetVar("imagelangpath", $imagelangpath);
    atThemeSetVar("multipath", $multipath);
    include_secure($platformdir . "atFuncs.php");
    atLoadThemeConfig($themepath);
    atThemeLangLoad($themepath);
    $runningconfig = atLoadRunningConfig();
    $extra = $runningconfig['extra'];
    if (isset($extra)) {
        ob_start();
        foreach ($extra as $name) {
            if (isset($name['themeinit'])) {
                $func = $name['themeinit'];
                if (function_exists("{$func}")) {
                    $func($runningconfig);
                }
            }
        }
        ob_end_clean();
    }
    include_secure($incdir . "atExtended.php");
    atExtendedInit();
    ob_start();
    return $runningconfig;
}