Пример #1
0
} else {
    $IconRarrow = 'icon-larrow';
    $IconLarrow = 'icon-rarrow';
    $IconRDarrow = 'icon-ldarrow';
    $IconLDarrow = 'icon-rdarrow';
}
$all_blocks = array();
foreach (WT_Module::getActiveBlocks() as $name => $block) {
    if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) {
        $all_blocks[$name] = $block;
    }
}
if ($user_id) {
    $blocks = get_user_blocks($user_id);
} elseif ($gedcom_id) {
    $blocks = get_gedcom_blocks($gedcom_id);
}
if ($action == 'update') {
    Zend_Session::writeClose();
    foreach (array('main', 'side') as $location) {
        if ($location == 'main') {
            $new_blocks = $main;
        } else {
            $new_blocks = $right;
        }
        foreach ($new_blocks as $order => $block_name) {
            if (is_numeric($block_name)) {
                // existing block
                WT_DB::prepare("UPDATE `##block` SET block_order=? WHERE block_id=?")->execute(array($order, $block_name));
                // existing block moved location
                WT_DB::prepare("UPDATE `##block` SET location=? WHERE block_id=?")->execute(array($location, $block_name));
Пример #2
0
use WT\Auth;
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
    // RFC2616 requires an absolute URL, but we don’t have it here.
    header('Location: site-php-version.php');
}
define('WT_SCRIPT_NAME', 'index.php');
require './includes/session.php';
// The only option for action is "ajax"
$action = WT_Filter::get('action');
// The default view depends on whether we are logged in
$ctype = WT_Filter::get('ctype', 'gedcom|user', WT_USER_ID ? 'user' : 'gedcom');
// Get the blocks list
if (WT_USER_ID && $ctype == 'user') {
    $blocks = get_user_blocks(WT_USER_ID);
} else {
    $blocks = get_gedcom_blocks(WT_GED_ID);
}
$all_blocks = WT_Module::getActiveBlocks();
// The latest version is shown on the administration page.  This updates it every day.
// TODO: send an email notification to the admin when new versions are available.
fetch_latest_version();
// We generate individual blocks using AJAX
if ($action == 'ajax') {
    $controller = new WT_Controller_Ajax();
    $controller->pageHeader();
    // Check we’re displaying an allowable block.
    $block_id = WT_Filter::getInteger('block_id');
    if (array_key_exists($block_id, $blocks['main'])) {
        $module_name = $blocks['main'][$block_id];
    } elseif (array_key_exists($block_id, $blocks['side'])) {
        $module_name = $blocks['side'][$block_id];