예제 #1
0
<?php

error_reporting(E_ALL);
require_once dirname(__FILE__, 3) . '/src/config.php';
global $url_string, $controller, $action;
try {
    // make sure url string is canonical, including explicit index.php dy default
    if (strpos($url_string, '/index.php') !== 0) {
        $url_string = '/index.php' . $url_string;
    }
    list($controller, $action, $type) = controller_action($url_string);
    // make sure url string is canonical, including explicit index controller and action
    $url_string = merge_params($url_string, ['controller' => $controller, 'action' => $action]);
} catch (Exception $e) {
    die(d_($e));
    redirect_to('no-access.html');
}
// d_([CONFIG::$ENV, $controller, $action, $type]);
// check_login($type);
unset($type);
// include CONFIG::get('ABSPATH') . 'app/c/init.php';
forward_to($controller, $action);
예제 #2
0
<?php

require_once CONFIG::get('ABSPATH') . '/src/models/person.php';
require_once CONFIG::get('ABSPATH') . '/src/models/storage.php';
$display['page_title'] = 'People';
list($display['page_error'], $errors) = post_errors();
if ($display['page_error']) {
    d_($display['page_error']);
}
if ($errors) {
    d_($errors);
}
$stored_people = Storage::read() ?? [];
if (count($stored_people)) {
    $display['stored_people'] = array_map(function ($item) {
        return htmlspecialchars("{$item}");
    }, $stored_people);
    $display['people'] = array_map(function ($item) {
        return $item->toHash();
    }, $stored_people);
} else {
    $display['stored_people'] = [];
    $display['people'][] = array('firstname' => 'Jeff', 'surname' => 'Stelling');
    $display['people'][] = array('firstname' => 'Chris', 'surname' => 'Kamara');
    $display['people'][] = array('firstname' => 'Alex', 'surname' => 'Hammond');
    $display['people'][] = array('firstname' => 'Jim', 'surname' => 'White');
    $display['people'][] = array('firstname' => 'Natalie', 'surname' => 'Sawyer');
}
$display['button_OK'] = merge_params($url_string, array('action' => 'save'));
render(CONFIG::get('ABSPATH') . '/src/views/templates/people/list.php', CONFIG::get('ABSPATH') . '/src/views/layouts/flat.php');
예제 #3
0
function makeFree($href)
{
    $free = str_replace('/download.php?', '/freeaccess.php?', $href);
    $freepath = get_freepath();
    $tmp1 = params2hash($free);
    $file1 = $tmp1['path'] . '/' . $tmp1['file'];
    $new_file1 = $freepath . basename($file1);
    //echo "$file1 | $new_file1";
    copy($file1, $new_file1);
    $freepath = preg_replace('@^' . CONFIG::get('FREEPATH') . '@', '', $freepath);
    $freepath = substr($freepath, 0, strlen($freepath) - 1);
    $free = merge_params($free, array('path' => $freepath));
    $free_parsed = parse_url($free);
    if (!$free_parsed['host']) {
        $free = CONFIG::get('APPHOST') . $free;
    }
    return $free;
}