Beispiel #1
0
 /**
 		Load appropriate dictionary files
 			@public
 	**/
 static function load()
 {
     if (!self::$vars['LANGUAGE']) {
         // Auto-detect
         if (extension_loaded('intl')) {
             $def = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? Locale::acceptFromHTTP($_SERVER['HTTP_ACCEPT_LANGUAGE']) : Locale::getDefault();
         } else {
             if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                 $def = preg_replace('/^(\\w{2}(?:-\\w{2})?).*/', '\\1', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
             } else {
                 $def = setlocale(LC_ALL, NULL);
                 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
                     $def = key(preg_grep('/' . strstr($def, '_', TRUE) . '/', self::$languages));
                 } elseif (preg_match('/^\\w{2}/', $def, $match)) {
                     $def = $match[0];
                 } else {
                     // Environment points to invalid language
                     $def = 'en';
                 }
             }
         }
         self::$vars['LANGUAGE'] = $def;
     }
     $def = self::$vars['LANGUAGE'];
     $list = array($def);
     if (preg_match('/^\\w{2}/', $def, $match)) {
         array_unshift($list, $match[0]);
         if (extension_loaded('intl')) {
             Locale::setDefault($match[0]);
         } elseif (isset(self::$languages[$match[0]])) {
             self::$locale = setlocale(LC_ALL, NULL);
             setlocale(LC_ALL, self::$languages[$match[0]]);
         }
     }
     // Add English as fallback
     array_unshift($list, 'en');
     foreach (array_unique($list) as $language) {
         $file = self::fixslashes(self::$vars['LOCALES']) . $language . '.php';
         if (is_file($file) && ($trans = (require $file)) && is_array($trans)) {
             // Combine dictionaries and assign key/value pairs
             F3::mset($trans, '', FALSE);
         }
     }
     if (!extension_loaded('intl') && !isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         setlocale(LC_ALL, NULL);
     }
 }
Beispiel #2
0
<?php

//APP ROUTER a.k.a VIEWER
\F3::mset(array("UI" => __DIR__ . "/View/", "DEBUG" => 2, "UPLOADS" => __DIR__ . "/uploaded/", "AUTOLOAD" => __DIR__ . "/;" . __DIR__ . "/f3/burger/", "TEMP" => __DIR__ . "/tmp/", "CACHE" => __DIR__ . "/cachez/", "kekesed.sitename" => "Kambeng blog", "kekesed.copyright.text" => "Kekesed Asmasta. All Right Reserved.", "kekesed.copyright.year_start" => "2014", "kekesed.system.version" => "0.1.17"));
if (!isset($_SESSION)) {
    session_start();
}
\kksd\Sesi::$DB = new \DB\SQL("mysql:host=127.0.0.1;port=3306;dbname=kambeng_blog", "kambeng_blog", "kambeng");
\F3::set('db', \kksd\Sesi::$DB);
/* 
	PUBLIC SETTINGS~ :* :*
*/
\F3::route("GET /", 'Control\\App->indexer');
\F3::route("GET @blogread:     /baca/@id-xyml", "Control\\Blog->Tampil");
\F3::route("GET @virtualasset: /img/@link/@size-@id-@type", "Control\\Imager->akses", 3600 * 24 * 7);
// cache seminggu :3
/*
	ADMIN PANEL SETTINGS~ :* :*
*/
\Middleware::instance()->before('GET|POST|PUT|DELETE /admin*', function (\Base $f3, $param) {
    //cek apa dia login apa kagak, dan layak apa kagak. lel
    $access = \Access::instance();
    $access->policy('deny');
    $access->allow('/admin/*', 'admin');
    $access->allow('GET|POST /admin/Auth*');
    $access->allow('GET|POST /admin/auth*');
    if (!$f3->exists('SESSION.user_type') && !$f3->exists('COOKIE.user')) {
        $f3->set('SESSION.user_type', 'guest');
    }
    $access->authorize($f3->get('SESSION.user_type'), function ($route, $subject) {
        \F3::reroute('@admin_pack(@pack=Auth)');
Beispiel #3
0
<?php

// Use the Fat-Free Framework
require_once 'lib/F3.php';
require_once 'inc/ldap_fun.php';
F3::set('RELEASE', FALSE);
// Use custom 404 page
F3::set('E404', 'layout.htm');
// Path to our Fat-Free import files
F3::set('IMPORTS', 'inc/');
// Path to our CAPTCHA font file
F3::set('FONTS', 'fonts/');
// Path to our templates
F3::set('GUI', 'gui/');
// Another way of assigning values to framework variables
F3::mset(array('site' => 'Kullanıcı Veritabanı'));
// Common inline Javascript
F3::set('extlink', 'window.open(this.href); return false;');
F3::set('LDAP', array('host' => '192.168.56.102', 'port' => 389, 'base' => 'dc=debuntu,dc=local', 'admin' => 'cn=admin,dc=debuntu,dc=local', 'passw' => 'secret', 'ou' => 'ou=moodleusers,dc=debuntu,dc=local', 'conn' => '', 'bind' => ''));
/* LDAP ozelinde
F3::call(':db'); ile de (F3::set yoluyla) ds,r degiskenlerini.
*/
// Define our main menu; this appears in all our pages
F3::set('menu', array_merge(array('Ana sayfa' => '/'), F3::get('SESSION.user') ? array('Hakkında' => '/about', 'Çıkış' => '/logout') : array('Giriş' => '/login')));
F3::route('GET /', ':showhome');
F3::route('GET /search', ':sorgu');
F3::route('GET /search_cn', ':todo');
// Minify CSS; and cache page for 60 minutes
F3::route('GET /min', ':minified', 3600);
// Cache the "about" page for 60 minutes; read the full documentation to
// understand the possible unwanted side-effects of the cache at the
Beispiel #4
0
	If you're writing your own application and still debugging it, you might
	want to set this Fat-Free variable to FALSE. The stack trace can help
	a lot in program testing.
**/
F3::set('RELEASE', FALSE);
// Use custom 404 page
F3::set('E404', 'layout.htm');
// Path to our Fat-Free import files
F3::set('IMPORTS', 'inc/');
// Path to our CAPTCHA font file
F3::set('FONTS', 'fonts/');
// Path to our templates
F3::set('GUI', 'gui/');
// Another way of assigning values to framework variables
F3::mset(array('site' => 'Kullanıcı Veritabanı', 'data' => 'db/demo.db'));
// Common inline Javascript
F3::set('extlink', 'window.open(this.href); return false;');
/**
	Create database connection; The demo database is within our Web
	directory but for production use, a non-Web accessible path is highly
	recommended for better security.

	Fat-Free allows you to use any database engine - you just need the DSN
	so the framework knows how to communicate with it. Migrating to another
	engine should be next to easy. If you stick to the standard SQL92
	command set (no engine-specific extensions), you just have to change the
	next line. For this demo, we'll use the SQLite engine, so there's no
	need to install MySQL on your server.
**/
/*F3::set('DB',