Esempio n. 1
0
function translate_tpl($tpl, $data, $as_text = false)
{
    if ($as_text) {
        $data['text'] = paragraphs($data['text']);
    }
    $replace = $find = array();
    foreach ($data as $key => $val) {
        $find[] = strtoupper($key);
        $replace[] = $val;
    }
    $html = str_replace($find, $replace, $tpl);
    return $html;
}
Esempio n. 2
0
    $search = array('<p></p>', '<p><ul></p>', '<p><ol></p>', '<p><li>', '</li></p>', '<p></ul></p>', '<p></ol></p>');
    $replace = array('', '<ul>', '<ol>', '<li>', '</li>', '</ul>', '</ol>');
    $text = str_replace($search, $replace, $text);
    return $text;
}
if (CACHE && !isset($action) && file_exists('./pages/' . $request . '.html')) {
    $html = file_get_contents('./pages/' . $request . '.html');
} else {
    require_once './db.php';
    if (DB == false) {
        // sorry, no db and no cache
        $log .= '[ no db ]';
        require_once './sorry.php';
    } else {
        $page = mysql_select_row("SELECT * FROM `pages` WHERE `title` = '" . mysql_rescue($request) . "'");
        $page['text'] = paragraphs($page['text']);
        if (empty($page)) {
            // sorry, not found
            require_once './sorry.php';
        } elseif ($page['type'] == 'special') {
            if (file_exists('./specials/' . $page['author'] . '.php')) {
                require_once './specials/' . $page['author'] . '.php';
            }
        } elseif ($page['type'] == 'event') {
            require_once './specials/event.php';
        } elseif ($page['type'] == 'person') {
            require_once './specials/person.php';
        } elseif ($page['title'] == 'Welkom!') {
            // add list of events
            require_once './specials/events.php';
            // don't use cache for event type pages
Esempio n. 3
0
<?php

$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)];
});
$factory->define(App\Flyer::class, function (Faker\Generator $faker) {
    return ['street' => $faker->streetAddress, 'city' => $faker->city, 'zip' => $faker->postcode, 'state' => $faker->state, 'country' => $faker->country, 'price' => $faker->numberBetween(10000 - 5000000), 'description' => paragraphs(3)];
});