Example #1
0
<?php

//charge et initiale les bibliotheques globales
include 'setting.inc.php';
$command = get_command();
$routes = get_routes($command);
if ($routes[0] == '') {
    // lire le code de langue
    $the_lang = get_lang();
    redirect($the_lang . '/home');
} elseif ($routes[0] == 'fr') {
    switch_lang('fr');
    display_text();
    site_routing($routes);
} elseif ($routes[0] == 'en') {
    switch_lang('en');
    display_text();
    site_routing($routes);
} elseif ($routes[0] == 'es') {
    switch_lang('es');
    display_text();
    site_routing($routes);
} else {
    header('Status: 404 Not Found');
    error404_action();
}
Example #2
0
 public function getRoutes()
 {
     return json_decode(file_get_contents(get_routes()));
 }
Example #3
0
function get_routes()
{
    $actual_link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    return explode(" ", trim(str_replace("/", " ", explode('index.php', $actual_link)[1])));
}
function get_main()
{
    $actual_link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    return explode('index.php', $actual_link)[0] . "index.php/";
}
function Redirect($url, $permanent = false)
{
    header('Location: ' . $url, true, $permanent ? 301 : 302);
    exit;
}
switch (get_routes()[0]) {
    case "":
        Redirect(get_main() . "posts");
        break;
    case "login":
        if ($users->logedIn()) {
            Redirect(get_main() . "posts");
        }
        include 'view/loginform.php';
        break;
    case "register":
        if ($users->logedIn()) {
            Redirect(get_main() . "posts");
        }
        include 'view/registerform.php';
        break;
Example #4
0
<?php

require_once '../model/model.php';
require_once '../includes/helper.php';
// get the routes
$routes = get_routes();
render('home', array('routes' => $routes));