Exemplo n.º 1
0
// Searching controllers in Modules directory.
// Directory Scan function - script will include all .php files in the modules
// directory.
if (!is_dir(MODULE_PATH)) {
    die(_("ERROR: Modules directory not found!"));
}
$CurDir = dir(MODULE_PATH);
while (false !== ($entry = $CurDir->read())) {
    if ($entry != "." && $entry != "..") {
        if (substr($entry, strrpos($entry, '.')) == ".php") {
            require_once $CurDir->path . "/" . $entry;
        }
    }
}
try {
    // Validate and set the template of the site.
    gui::set_template_name(config::get("template_name", "gui"));
    // Looking for extra functions file in the template directory.
    if (is_file(TEMPLATE_PATH . config::get("template_name", "gui") . "/functions.php")) {
        include_once TEMPLATE_PATH . config::get("template_name", "gui") . "/functions.php";
    }
    // Find Controller name run it.
    gui::add_body(controller::set(uriparser::current()));
    // Validate and set the template filename with language settings.
    gui::set_template_file(config::get("controller"), config::get("lang"));
} catch (Exception $exc) {
    gui::add_body(gui::render_404($exc->getMessage()));
    //die(gui::render_404 ( _("Error. Page not found.")));
}
// Connecting of previosly finded template file.
include_once TEMPLATE_PATH . config::get("template_name", "gui") . "/" . config::get("template_file", "gui") . ".php";
Exemplo n.º 2
0
 */
// Include PHP Gettext Emulator class.
require_once KERNEL_PATH . 'gettext/gettext.inc';
// Check default locale and language settings.
if (!config::get("lang")) {
    die("Default locale and language are not set.");
}
if (!config::get("lang_array")) {
    die("Please, setup Language array in your \r\n    configuration. Array('ru' => 'ru_RU', ...)");
}
// Check status of the multi-lingual mode.
if (config::get("multilang") == true) {
    // If multi-lingual mode is on - we will check, if the first URL parameter
    // is currect language parameter. So it must match to "/^(ru|en)$/u".
    $URLangMatch = "/^(" . implode("|", array_keys(config::get("lang_array"))) . ")\$/u";
    $URLang = uriparser::current();
    // If no language in first URL parameter - do redirect to currect URL.
    if (!$URLang || !preg_match($URLangMatch, $URLang)) {
        header("Location: " . HTTP_HOST . config::get("lang") . '/');
    }
    // Overwrite default locale and language settings.
    config::set("lang", $URLang);
}
/**
* Root path to all HTTP links in the script, including the selected
* language URL parameter.
*/
define('HTTP_BASE', HTTP_HOST . config::get("lang") . '/');
// Setting up localization and translation.
$lang = config::get("lang");
$locale = config::get("lang_array");