Example #1
0
function session_dump($message)
{
    $ses = db_get_rows('wfpl_sessions', 'id,session_key,length,expires');
    if ($ses) {
        foreach ($ses as $row) {
            list($id, $session_key, $length, $expires) = $row;
            tem_set('id', $id);
            tem_set('session_key', $session_key);
            tem_set('length', $length);
            tem_set('expires', $expires);
            tem_sub('wfpl_sessions_row');
        }
    }
    $data = db_get_rows('wfpl_session_data', 'id,session_id,name,value');
    if ($data) {
        foreach ($data as $row) {
            list($id, $session_id, $name, $value) = $row;
            tem_set('id', $id);
            tem_set('session_id', $session_id);
            tem_set('name', $name);
            tem_set('value', $value);
            tem_sub('wfpl_session_data_row');
        }
    }
    tem_set('message', $message);
    tem_sub('block');
}
Example #2
0
function index_main()
{
    if ($_REQUEST['z']) {
        $url = ereg_replace('[^a-zA-Z0-9_-]', '', $_REQUEST['z']);
        $dots = ereg_replace('[^.]', '', $_REQUEST['z']);
        if (strlen($dots) < 3) {
            $url .= $dots;
        }
    } else {
        $url = '';
    }
    tem_set('starting_url', $url);
}
Example #3
0
function db_browse_main()
{
    if (isset($_REQUEST['url'])) {
        $url = ereg_replace('[^a-zA-Z0-9_-]', '', $_REQUEST['url']);
    } else {
        $url = '';
    }
    tem_set('url', $url);
    $row = db_get_column('tiles', 'url', 'where url like "%s_"', $url);
    if ($row) {
        foreach ($row as $sub_url) {
            tem_set('child_url', $sub_url);
            tem_set('child_name', substr($sub_url, -1));
            tem_show('child_link');
        }
    }
    if ($url != '') {
        tem_set('back_url', substr($url, 0, -1));
        tem_show('back_link');
    }
    $GLOBALS['debug_tiles'] = true;
    ob_start();
    create_random_square();
    create_random_square();
    create_random_square();
    create_random_square();
    ob_clean();
    ob_start();
    create_random_square();
    tem_set('pixels', ob_get_clean());
    ob_start();
    tile_get_128($url);
    # because it prints now
    tem_set('t128', ob_get_clean());
    ob_start();
    tile_get_64($url);
    # because it prints now
    tem_set('t64', ob_get_clean());
    ob_start();
    tile_get_32($url);
    # because it prints now
    tem_set('t32', ob_get_clean());
}
function test_get_initial_toggle_main()
{
    if (ENABLE_TEST_GET_INITIAL_TOGGLE !== true) {
        message('This page is disabled to prevent DOS attacks or accidental resource hogging. If you are the administratior you can follow the instructions at the top of the source file to enable this page.');
        return;
    }
    if (isset($_REQUEST['url'])) {
        $url = ereg_replace('[^a-zA-Z0-9._-]', '', $_REQUEST['url']);
        $pos = strpos($url, '.');
        if ($pos !== false) {
            $dots = substr($url, $pos);
            $url = substr($url, 0, $pos);
        } else {
            $dots = '';
        }
    } else {
        $url = '';
        $dots = '';
    }
    message("url: {$url}, dots: {$dots}");
    $t128 = tile_get_128($url);
    if ($t128 === false) {
        message("No tile at {$url}");
        return;
    }
    $shadows = make_t128_from_initial_toggles($url, $dots);
    if ($t128 == $shadows) {
        message('They Match!');
    } else {
        message("FAILED. They don't match.");
    }
    $shadows = t128_to_dotspace($shadows);
    tem_set('shadows', $shadows);
    $t128 = t128_to_dotspace($t128);
    tem_set('t128', $t128);
}
Example #5
0
function preview()
{
    tem_load('code/wfpl/metaform/preview.html');
    tem_set('form_name', $GLOBALS['form_name']);
    tem_set('fields', $_REQUEST['fields']);
    $preview_tem = new tem();
    $preview_tem->load_str(make_html(false));
    if ($GLOBALS['opt_db'] == 'Yes') {
        $preview_tem->show('new_msg');
    }
    $fields = get_fields();
    foreach ($fields as $field) {
        list($name, $type, $input, $format, $sql) = $field;
        if ($type == 'pulldown') {
            pulldown($name, array('option 1', 'option 2', 'option 3'));
        }
    }
    $preview = $preview_tem->run();
    unset($preview_tem);
    $preview = ereg_replace('type="submit"', 'type="submit" disabled="disabled"', $preview);
    tem_set('preview', $preview);
    tem_show('hiddens');
    set_form_action();
    tem_output();
}
Example #6
0
<?php

tem_set('filename', $_SERVER['REDIRECT_URL']);
Example #7
0
    # call tem_sub()
    tem_sub('login');
    # This runs the template and prints the output. Running the template is
    # simply replacing all ~key~ tags with the associated value. The values are
    # set with tem_set() and tem_sub().
    tem_output();
    exit(0);
}
# Below is an example of using a sub-sub-template many times
# first set some values to be displayed in the row:
tem_set('foo', '*&^@$<>"');
tem_set('bar', 'one*&^@$<>"');
# Now run the row. This runs the sub-template for the row, and appends the data
# for the 'foobar_row' entry in the main key/value list.
tem_sub('foobar_row');
# and a couple more times:
tem_set('foo', '"""""****"""""');
tem_set('bar', 'two*&^"');
tem_sub('foobar_row');
tem_set('foo', '<<<<<<&&&&&&&&amp;>>>>>');
tem_set('bar', 'threeeeeeee*&^@$<>"eeeeeeeeeeee');
tem_sub('foobar_row');
# Now we have a 'foobar_row' in the main keyval array with three rows of html in it.
# in the template foobar_row is within a bigger sub-template called
# 'foobar_table'. The only reason for this is so that we can have that table
# not display at all when we're displaying the login. This is a silly use of
# the templates, but I wanted to demonstrate and test a simple use of a
# sub-template within a sub-template.
tem_sub('foobar_table');
# Now run the main template (the body of the template file)
tem_output();