Ejemplo n.º 1
0
function run_template($request, $page)
{
    $tpl_main = get_tpl('main');
    $tpl = $page['type'] == 'event' ? 'event' : 'info';
    $tpl_page = get_tpl($tpl);
    /*--- globals ---*/
    $translate = array('[title]' => TITLE, '[base_url]' => BASE_URL, '{title}' => $page['title']);
    $tpl_main = translate_tpl($tpl_main, $translate);
    /*--- page ---*/
    $translate = array('{event_join}' => $page['event_join'], '{event_people}' => $page['event_people'], '{event_author}' => $page['author'], '{after_text}' => $page['after_text']);
    $tpl_page = translate_tpl($tpl_page, $translate);
    $translate = array('{title}' => $page['title'], '{text}' => $page['text']);
    $tpl_page = translate_tpl($tpl_page, $translate, true);
    /*--- place page in main ---*/
    $translate = array('@before_page' => $page['before_text'], '@page' => $tpl_page, '@after_page' => $page['after_text']);
    $html = translate_tpl($tpl_main, $translate);
    /*--- save html as cache ---*/
    if (CACHE && !isset($page['no_cache'])) {
        $cachefile = './pages/' . $request . '.html';
        if (file_exists($cachefile) == false) {
            file_put_contents($cachefile, $html);
        }
    }
    return $html;
}
Ejemplo n.º 2
0
    $log .= '[ show user form ]';
    // check for error
    $error = $user->read_cookie('login', 'show') == 2 ? 'Deze naam bestaat al, kies een andere.' : '';
    // show login form
    $user->set_cookie('login', 'show');
    $page['before_text'] = get_tpl('userpass-form');
    $translate = array('{title}' => $page['title'], '{error}' => $error);
    $page['before_text'] = translate_tpl($page['before_text'], $translate);
}
// check for register teaser
if ((isset($show_teaser) || $user->read_cookie('login', 'show') == 3) && $user->login == true) {
    $log .= '[ show register teaser ]';
    // show login form
    $page['before_text'] = get_tpl('register-teaser');
    $translate = array('{title}' => $page['title']);
    $page['before_text'] = translate_tpl($page['before_text'], $translate);
}
// show current join status
if (!isset($status)) {
    $status = $user->joined($page['title']) ? 'joined' : 'join';
}
require_once './template.php';
$page['event_join'] = get_tpl('event-' . $status);
$log .= '[ join-status is ' . $status . ' ]';
// show others comming
require_once './db.php';
$people = mysql_select_array("SELECT `username` FROM `joined` WHERE `event_title` = '" . mysql_rescue($page['title']) . "'");
if (!empty($people)) {
    $page['event_people'] = '';
    foreach ($people as $person) {
        $page['event_people'] .= '<a href="./index.php?p=' . $person['username'] . '" class="person">' . $person['username'] . '</a>, ';
Ejemplo n.º 3
0
    $page['text'] .= 'We hebben je aanmelding ontvangen, dankjewel!' . NLtxt;
    $strict = true;
    $costs = payment_costs($payment_info['ticket'], $strict);
    $page['text'] .= 'Je kunt de betaling van &euro; <strong>' . $costs . '</strong> overmaken naar girorekening <strong>' . PAYMENT_BANK . '</strong> t.a.v. <strong>' . PAYMENT_NAME . '</strong>. Zet in de beschrijving <strong>' . PAYMENT_DESCRIPTION . '</strong> en je <strong>volledige naam</strong>. Als je betaling binnen is ontvang je van ons bericht.';
    $page['text'] .= NLtxt . 'Dat was het! Geef in het <a href="index.php?p=Programma">programma</a> wat je interessant vind als je dat nog niet gedaan had.' . NLtxt . 'Tot zaterdag de 3e!';
    $page['text'] = paragraphs($page['text']);
    // go next
    set_register_state($user, $register_state, 3);
    # temporary delete the registration to test
    #mysql_delete("DELETE FROM `registers` WHERE `payment_code` = '".mysql_rescue($payment_info['payment_code'])."'");
}
if ($register_state == 1) {
    require_once './template.php';
    $tpl = get_tpl('register');
    $translate = array('{TICKET_DAG}' => payment_costs('dag'), '{TICKET_OVERNACHT}' => payment_costs('overnacht'), '{TICKET_DAG_OVERNACHT}' => payment_costs('dag_overnacht'));
    $tpl = translate_tpl($tpl, $translate);
    $page['text'] = 'Leuk dat je komt! Om je aan te melden kun je simpel de volgende stappen doorlopen.' . NLtxt . '<ol>' . NLtxt . '<li><strong>Aanmeldformulier invullen.</strong></li>' . NLtxt . '<li>Bevestiging en betaling.</li>' . NLtxt . '<li>.. Geen stap 3, je bent klaar!</li>' . NLtxt . '</ol>' . NLtxt;
    // error message
    if (!empty($errors)) {
        $errors_text = '';
        foreach ($errors as $k => $v) {
            $errors_text .= $k . '=' . $v . ',';
        }
        log_write('user sees errors: "' . $errors_text . '"' . NLtxt);
        $page['text'] .= '<div style="margin: 0 1em; padding: 0.5em; border: 2px solid #A00;"><span style="font-weight: bold; color: #A00;">Bijna goed</span>, nog even wat corrigeren:' . NLtxt . '<ul>' . NLtxt;
        foreach ($errors as $field => $error) {
            if ($error == 'non-empty') {
                $msg = '<strong>' . $fieldnames[$field] . '</strong> mag niet leeg zijn.';
            }
            if ($error == 'used') {
                $msg = '<strong>' . $fieldnames[$field] . '</strong> bestaat al, kies een andere.';