function show_main_page($dbconn, $diary_login)
{
    $sql = "SELECT u.uid, s.page_main, s.format_note FROM " . TABLE_SETTINGS . " AS s, " . TABLE_USERS . " AS u WHERE u.login='******' AND s.uid=u.uid LIMIT 1";
    $result = pg_query($dbconn, $sql) or die(pg_last_error($dbconn));
    $data = pg_fetch_object($result, NULL);
    echo assign_vars($data->page_main, array('{login}' => $diary_login, '{diary}' => get_last_notes($dbconn, $diary_login, $data->format_note), '{hrefguestbook}' => 'http://' . $_SERVER['SERVER_NAME'] . '/' . PAGE_GUESTBOOK, '{archive}' => get_archive($dbconn, $diary_login), '{links}' => get_links($dbconn, $diary_login)));
}
Esempio n. 2
0
    $ttag->title = tag_i18n($tag);
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    render('main', array('title' => 'Posts tagged: ' . tag_i18n($tag) . ' - ' . blog_title(), 'description' => 'All posts tagged: ' . tag_i18n($tag) . ' on ' . blog_title() . '.', 'canonical' => site_url() . 'tag/' . strtolower($tag), 'page' => $page, 'posts' => $posts, 'tag' => $ttag, 'bodyclass' => 'intag', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Posts tagged: ' . tag_i18n($tag), 'pagination' => has_pagination($total, $perpage, $page), 'is_tag' => true));
});
// Show the archive page
get('/archive/:req', function ($req) {
    if (!login()) {
        file_cache($_SERVER['REQUEST_URI']);
    }
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('archive.perpage');
    $posts = get_archive($req, $page, $perpage);
    $total = get_count($req, 'basename');
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    $time = explode('-', $req);
    $date = strtotime($req);
    if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
        $timestamp = date('d F Y', $date);
    } elseif (isset($time[0]) && isset($time[1])) {
        $timestamp = date('F Y', $date);
    } else {
        $timestamp = $req;
    }
    $tarchive = new stdClass();
        }
        if (!check_logged_in()) {
            display_login_form($action);
        }
        break;
    case 'log-in':
    case '':
        if (!check_logged_in()) {
            display_login_form($action);
        }
        break;
    case 'show-all-lists':
        display_items('All Lists', get_all_lists(), 'information', 'show-archive', '');
        break;
    case 'show-archive':
        display_items('Archive For ' . get_list_name($_GET['id']), get_archive($_GET['id']), 'view-html', 'view-text', '');
        break;
    case 'information':
        display_information($_GET['id']);
        break;
    default:
        if (!check_logged_in()) {
            display_login_form($action);
        }
        break;
}
//all other actions require user to be logged in
if (check_logged_in()) {
    switch ($action) {
        case 'account-settings':
            display_account_form(get_email(), get_real_name(get_email()), get_mimetype(get_email()));