/home/ygtwebcom/kristal.ygtweb.com.tr/System/Libs/Session/Session.php
* Docs : http://kilavuz.titanphp.com
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
namespace System\Libs\Session;
class Session
{
// Session config items
private $config;
public function __construct()
{
// Getting session config items
$this->config = config('app.session');
// Checking cookie_httponly setting
if ($this->config['cookie_httponly'] === true)
ini_set('session.cookie_httponly', 1);
// Checking use_only_cookies setting
if ($this->config['use_only_cookies'] === true)
ini_set('session.use_only_cookies', 1);
// Setting max. lifetime
ini_set('session.gc_maxlifetime', $this->config['lifetime']);
session_set_cookie_params($this->config['lifetime']);
// Initializing
$this->init();
}
/**
* Initialize Session
*
* @return void
*/
private function init()
{
/home/ygtwebcom/kristal.ygtweb.com.tr/System/Libs/Session/Session.php
* Docs : http://kilavuz.titanphp.com
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
namespace System\Libs\Session;
class Session
{
// Session config items
private $config;
public function __construct()
{
// Getting session config items
$this->config = config('app.session');
// Checking cookie_httponly setting
if ($this->config['cookie_httponly'] === true)
ini_set('session.cookie_httponly', 1);
// Checking use_only_cookies setting
if ($this->config['use_only_cookies'] === true)
ini_set('session.use_only_cookies', 1);
// Setting max. lifetime
ini_set('session.gc_maxlifetime', $this->config['lifetime']);
session_set_cookie_params($this->config['lifetime']);
// Initializing
$this->init();
}
/**
* Initialize Session
*
* @return void
*/
private function init()
{
/home/ygtwebcom/kristal.ygtweb.com.tr/System/Facades/Facade.php
}
/**
* Call Methods in Application Object
*
* @param string $method
* @param array $args
* @return mixed
*/
public static function __callStatic($method, $args)
{
// Get Facade Accessor
$accessor = static::getFacadeAccessor();
// Get Service Provider
$provider = static::resolveInstance($accessor);
// Get Instance of Service Provider If it doesn't exist
if (!array_key_exists($accessor, static::$createdInstances)) {
static::$createdInstances[$accessor] = new $provider;
}
return call_user_func_array([static::$createdInstances[$accessor], $method], $args);
}
}
/home/ygtwebcom/kristal.ygtweb.com.tr/App/Middlewares/Auth.php
<?php
namespace App\Middlewares;
use System\Facades\Session;
class Auth
{
public static function handle()
{
if(Session::has('isLogin') && Session::has('user')){
}else{
redirect(route('adminLogin'));
}
}
}
/home/ygtwebcom/kristal.ygtweb.com.tr/System/Libs/Router/Router.php
$ipCheck = self::checkIp($val);
// Checking SSL
$sslCheck = self::checkSSL($val);
// Checking request method
$methodCheck = self::checkMethod($val);
if ($domainCheck && $methodCheck && $ipCheck && $sslCheck) {
$matched++;
array_shift($params);
// Checking middlewares
if (array_key_exists('middlewares', $val)) {
foreach ($val['middlewares'] as $midKey => $midVal) {
list($controller, $method) = explode('@', $midVal['callback']);
if (class_exists($controller)) {
call_user_func_array([new $controller, $method], []);
}
}
}
if (is_callable($val['callback'])) {
call_user_func_array($val['callback'], array_values($params));
} else if (stripos($val['callback'], '@') !== false) {
list($controller, $method) = explode('@', $val['callback']);
if (class_exists($controller)) {
call_user_func_array([new $controller, $method], array_values($params));
} else {
self::pageNotFound();
}
}
break;
}
}
/home/ygtwebcom/kristal.ygtweb.com.tr/System/Libs/Router/Router.php
$ipCheck = self::checkIp($val);
// Checking SSL
$sslCheck = self::checkSSL($val);
// Checking request method
$methodCheck = self::checkMethod($val);
if ($domainCheck && $methodCheck && $ipCheck && $sslCheck) {
$matched++;
array_shift($params);
// Checking middlewares
if (array_key_exists('middlewares', $val)) {
foreach ($val['middlewares'] as $midKey => $midVal) {
list($controller, $method) = explode('@', $midVal['callback']);
if (class_exists($controller)) {
call_user_func_array([new $controller, $method], []);
}
}
}
if (is_callable($val['callback'])) {
call_user_func_array($val['callback'], array_values($params));
} else if (stripos($val['callback'], '@') !== false) {
list($controller, $method) = explode('@', $val['callback']);
if (class_exists($controller)) {
call_user_func_array([new $controller, $method], array_values($params));
} else {
self::pageNotFound();
}
}
break;
}
}
/home/ygtwebcom/kristal.ygtweb.com.tr/System/Kernel/Kernel.php
use System\Facades\Facade;
use Whoops\Run as WhoopsRun;
use Whoops\Handler\PrettyPageHandler as WhoopsPrettyPageHandler;
class Kernel
{
public function __construct()
{
// Initialize Whoops Error Handler
$this->initWhoops();
// Initialize Config
$this->initApplications();
// Getting Routes
Import::config('routes');
// Starting Router
Router::run();
}
/**
* Whoops Initializer
*
* @return object
*/
private function initWhoops()
{
$whoops = new WhoopsRun;
$whoops->pushHandler(new WhoopsPrettyPageHandler);
$whoops->register();
return $this;
}
/**
* Application Initializer
*
* @return void
/home/ygtwebcom/kristal.ygtweb.com.tr/index.php
* Titan-2 Mini Framework
* Simple and Modern Web Application Framework
*
* Author : Turan Karatuğ
* Web : http://www.titanphp.com
* Docs : http://kilavuz.titanphp.com
* Version : 2.4.1
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
// Require Composer Autoload
require_once __DIR__ . '/vendor/autoload.php';
// Require Starter
require_once __DIR__ . '/System/Kernel/Starter.php';
// Run Kernel
new System\Kernel\Kernel();