C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\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()
{
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\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()
{
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\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);
}
}
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Models\shop\Route.php
<?php
namespace App\Models\Shop;
use DB;
use Session;
use Settings;
class Route
{
public function list()
{
$lang_id = Session::has('lang') ? Session::get('lang') : Settings::get('config_language_id');
return DB::table('routes')
->where("language_id","=","$lang_id")
->getAll();
}
}
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Config\Routes.php
<?php
use System\Libs\Router\Router as Route;
use System\Facades\Model as Model;
use System\Facades\View as View;
use System\Facades\DB as DB;
Route::namespace('shop')->group(function(){
Route::get('/','Home@index')->name('shop_home');
$routes = Model::namespace("Shop")->run("route")->list();
foreach ($routes as $key => $route) {
if ($route->path_id) {
Route::get('/'.$route->slug,$route->module.'@index');
}
Route::get('/'.$route->slug,$route->module.'@index')->parameters([$route->path_id]);
}
Route::get('/quickview/{id}','Product@quickView')->where(['id' => '(\d+)'])->name('quickview');
});
Route::namespace('panel')->prefix('panel')->middleware(['Login'])->group(function(){
Route::get('/','Home@index')->name('panel_home');
Route::prefix('product')->group(function(){
Route::get('/','Product@index')->name('product');
Route::get('/create','Product@create')->name('product_create');
Route::post('/delete','Product@delete')->name('product_delete');
Route::get('/edit/{id}','Product@edit')->name('product_edit')->where(['id' => '(\d+)']);
Route::post('/update/{id}','Product@update')->name('product_update')->where(['id' => '(\d+)']);
Route::post('/save','Product@save')->name('product_save');
Route::post('/list','Product@list')->name('product_list');
Route::post('/deleteimage/{image_id}','Product@deleteimage')->name('product_deleteimage')->where(['image_id' => '(\d+)']);
Route::post('/sortimages','Product@sortimages')->name('product_sortimages');
Route::post('/stepValidation/{step}','Product@stepValidation')->name('product_stepValidation')->where(['step' => '(\d+)']);
});
Route::prefix('category')->group(function(){
Route::get('/','Category@index')->name('category');
Route::get('/create','Category@create')->name('category_create');
Route::post('/delete/{id}','Category@delete')->name('category_delete')->where(['id' => '(\d+)']);
Route::get('/edit/{id}','Category@edit')->name('category_edit')->where(['id' => '(\d+)']);
Route::post('/list','Category@list')->name('category_list');
Route::post('/save','Category@save')->name('category_save');
Route::post('/save/{id}','Category@save')->name('category_update')->where(['id' => '(\d+)']);
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Libs\Router\Router.php
* Routing Groups
*
* @param callable $callback
*/
public static function group($callback)
{
self::$groupped++;
self::$groups[] = [
'baseRoute' => self::$baseRoute,
'middlewares' => self::$middlewares,
'namespace' => self::$namespace,
'domain' => self::$domain,
'ip' => self::$ip,
'ssl' => self::$ssl,
'prefix' => self::$prefix
];
// Call the Callable
call_user_func($callback);
if (self::$groupped > 0) {
self::$baseRoute = self::$groups[self::$groupped-1]['baseRoute'];
self::$middlewares = self::$groups[self::$groupped-1]['middlewares'];
self::$namespace = self::$groups[self::$groupped-1]['namespace'];
self::$domain = self::$groups[self::$groupped-1]['domain'];
self::$ip = self::$groups[self::$groupped-1]['ip'];
self::$ssl = self::$groups[self::$groupped-1]['ssl'];
self::$prefix = self::$groups[self::$groupped-1]['prefix'];
}
self::$groupped--;
if (self::$groupped <= 0) {
// Reset Base Route
self::$baseRoute = '/';
// Reset Middlewares
self::$middlewares = [];
// Reset Namespace
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Libs\Router\Router.php
* Routing Groups
*
* @param callable $callback
*/
public static function group($callback)
{
self::$groupped++;
self::$groups[] = [
'baseRoute' => self::$baseRoute,
'middlewares' => self::$middlewares,
'namespace' => self::$namespace,
'domain' => self::$domain,
'ip' => self::$ip,
'ssl' => self::$ssl,
'prefix' => self::$prefix
];
// Call the Callable
call_user_func($callback);
if (self::$groupped > 0) {
self::$baseRoute = self::$groups[self::$groupped-1]['baseRoute'];
self::$middlewares = self::$groups[self::$groupped-1]['middlewares'];
self::$namespace = self::$groups[self::$groupped-1]['namespace'];
self::$domain = self::$groups[self::$groupped-1]['domain'];
self::$ip = self::$groups[self::$groupped-1]['ip'];
self::$ssl = self::$groups[self::$groupped-1]['ssl'];
self::$prefix = self::$groups[self::$groupped-1]['prefix'];
}
self::$groupped--;
if (self::$groupped <= 0) {
// Reset Base Route
self::$baseRoute = '/';
// Reset Middlewares
self::$middlewares = [];
// Reset Namespace
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Config\Routes.php
<?php
use System\Libs\Router\Router as Route;
use System\Facades\Model as Model;
use System\Facades\View as View;
use System\Facades\DB as DB;
Route::namespace('shop')->group(function(){
Route::get('/','Home@index')->name('shop_home');
$routes = Model::namespace("Shop")->run("route")->list();
foreach ($routes as $key => $route) {
if ($route->path_id) {
Route::get('/'.$route->slug,$route->module.'@index');
}
Route::get('/'.$route->slug,$route->module.'@index')->parameters([$route->path_id]);
}
Route::get('/quickview/{id}','Product@quickView')->where(['id' => '(\d+)'])->name('quickview');
});
Route::namespace('panel')->prefix('panel')->middleware(['Login'])->group(function(){
Route::get('/','Home@index')->name('panel_home');
Route::prefix('product')->group(function(){
Route::get('/','Product@index')->name('product');
Route::get('/create','Product@create')->name('product_create');
Route::post('/delete','Product@delete')->name('product_delete');
Route::get('/edit/{id}','Product@edit')->name('product_edit')->where(['id' => '(\d+)']);
Route::post('/update/{id}','Product@update')->name('product_update')->where(['id' => '(\d+)']);
Route::post('/save','Product@save')->name('product_save');
Route::post('/list','Product@list')->name('product_list');
Route::post('/deleteimage/{image_id}','Product@deleteimage')->name('product_deleteimage')->where(['image_id' => '(\d+)']);
Route::post('/sortimages','Product@sortimages')->name('product_sortimages');
Route::post('/stepValidation/{step}','Product@stepValidation')->name('product_stepValidation')->where(['step' => '(\d+)']);
});
Route::prefix('category')->group(function(){
Route::get('/','Category@index')->name('category');
Route::get('/create','Category@create')->name('category_create');
Route::post('/delete/{id}','Category@delete')->name('category_delete')->where(['id' => '(\d+)']);
Route::get('/edit/{id}','Category@edit')->name('category_edit')->where(['id' => '(\d+)']);
Route::post('/list','Category@list')->name('category_list');
Route::post('/save','Category@save')->name('category_save');
Route::post('/save/{id}','Category@save')->name('category_update')->where(['id' => '(\d+)']);
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Kernel\Import.php
if (!file_exists($file . '.php')) {
throw new ExceptionHandler('Dosya bulunamadı.', '<b>File : </b>' . $file . '.php');
}
return require $file . '.php';
}
/**
* Include config file
*
* @param string $file
* @return mixed
*/
public static function config($file)
{
if (!file_exists(APP_DIR . 'Config/' . ucwords($file) . '.php')) {
throw new ExceptionHandler('Dosya bulunamadı.', '<b>Config : </b>' . APP_DIR . 'Config/' . ucfirst($file) . '.php');
}
return require APP_DIR . 'Config/' . ucwords($file) . '.php';
}
}
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Kernel\Kernel.php
namespace System\Kernel;
use System\Libs\Router\Router;
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;
}
/**
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\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.2.0
* 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();