Ejemplo n.º 1
0
function handle_get($conversation)
{
    $fresh = $_GET['fresh'] == 'true';
    $max_timestamp = NULL;
    $board_list = array();
    $connection = get_connection($fresh);
    try {
        $boards = get_boards($connection);
        if (!is_null($boards)) {
            foreach ($boards as $board) {
                $board_list[] = $board['id'];
                $timestamp = $board['timestamp'];
                if (is_null($max_timestamp) || $timestamp > $max_timestamp) {
                    $max_timestamp = $timestamp;
                }
            }
        } else {
            $connection->close();
            return null;
        }
        $notes = get_notes($connection);
    } catch (Exception $x) {
        $connection->close();
        throw $x;
    }
    $connection->close();
    if (!is_null($max_timestamp)) {
        $conversation->modificationTimestamp = $max_timestamp;
    }
    return json_encode(array('boards' => $board_list, 'notes' => $notes));
}
Ejemplo n.º 2
0
function do_news($tpsub = 'overview')
{
    global $context, $txt, $scripturl;
    get_boards();
    $context['TPortal']['SSI_boards'] = explode(',', $context['TPortal']['SSI_board']);
    if ($tpsub == 'overview') {
        if (!TPcheckAdminAreas()) {
            fatal_error($txt['tp-notallowed']);
        }
    } elseif ($tpsub == 'permissions') {
        TPadd_linktree($scripturl . '?action=tpadmin;sa=permissions', $txt['tp-permissions']);
        $context['TPortal']['perm_all_groups'] = get_grps(true, true);
        $context['TPortal']['perm_groups'] = tp_fetchpermissions($context['TPortal']['modulepermissions']);
    } else {
        if ($tpsub == 'news') {
            TPadd_linktree($scripturl . '?action=tpadmin;sa=news', $txt['news']);
        } elseif ($tpsub == 'settings') {
            TPadd_linktree($scripturl . '?action=tpadmin;sa=settings', $txt['tp-settings']);
        } elseif ($tpsub == 'frontpage') {
            TPadd_linktree($scripturl . '?action=tpadmin;sa=frontpage', $txt['tp-frontpage']);
        }
        isAllowedTo('tp_settings');
    }
}