C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Libs\Cart\Cart.php
use Settings;
use Tax;
use Weight;
class Cart
{
private $data = array();
private $model;
protected $session_id;
public function __construct()
{
$this->model = Model::namespace("Panel")->run("Cart");
// Remove all the expired carts with no customer ID
$this->model->expiredClear();
if (isset($_COOKIE[config('app.session.name')])) {
$session_id = $_COOKIE[config('app.session.name')];
} else {
$session_id = '';
setcookie(config('app.session.name'), $this->getSessionId(),time() + (ini_get('session.cookie_lifetime')*60*60), ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
}
$this->start($session_id);
dd($_COOKIE);
dd(time() + (ini_get('session.cookie_lifetime')*60*60));
dd(ini_get('session.cookie_path'));
dd(var_dump(ini_get('session.cookie_domain')));
var_dump($this->session_id);
dd(strtotime('+1 hours'),true);
if (Customer::getUserId()) {
// We want to change the session ID on all the old items in the customers cart
$where = [
'customer_id' => (int) Customer::getUserId()
];
$data = ['session_id' => $this->getSessionId()];
$this->model->update($where,$data);
// Once the customer is logged in we want to update the customers cart
$where = [
'api_id' => 0,
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Libs\Cart\Cart.php
use Settings;
use Tax;
use Weight;
class Cart
{
private $data = array();
private $model;
protected $session_id;
public function __construct()
{
$this->model = Model::namespace("Panel")->run("Cart");
// Remove all the expired carts with no customer ID
$this->model->expiredClear();
if (isset($_COOKIE[config('app.session.name')])) {
$session_id = $_COOKIE[config('app.session.name')];
} else {
$session_id = '';
setcookie(config('app.session.name'), $this->getSessionId(),time() + (ini_get('session.cookie_lifetime')*60*60), ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
}
$this->start($session_id);
dd($_COOKIE);
dd(time() + (ini_get('session.cookie_lifetime')*60*60));
dd(ini_get('session.cookie_path'));
dd(var_dump(ini_get('session.cookie_domain')));
var_dump($this->session_id);
dd(strtotime('+1 hours'),true);
if (Customer::getUserId()) {
// We want to change the session ID on all the old items in the customers cart
$where = [
'customer_id' => (int) Customer::getUserId()
];
$data = ['session_id' => $this->getSessionId()];
$this->model->update($where,$data);
// Once the customer is logged in we want to update the customers cart
$where = [
'api_id' => 0,
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\Controllers\Shop\Basket.php
}
}
public function remove($cart_id)
{
if (Request::isMethod('POST') && Request::isAjax()) {
$remove = Cart::remove($cart_id);
$message["code"] = false;
if ($remove) {
$message["code"] = true;
}
echo json_encode($message);
}
}
public function getProducts()
{
$data['error'] = [];
$data['products'] = [];
$data['totals'] = [];
if (Cart::hasProducts() || !empty($_SESSION['vouchers'])) {
if (!Cart::hasStock() && (!Settings::get('config_stock_checkout') || Settings::get('config_stock_warning'))) {
$data['error'][] = lang('general','error_stock');
}
if (Settings::get('config_customer_price') && !Customer::isLoggedIn()) {
$data['error'][] = 'login';
}
if (Settings::get('config_cart_weight')) {
$data['weight'] = Weight::format(Cart::getWeight(), Settings::get('config_weight_class_id'),lang('general','decimal_point'),lang('general','thousand_point'));
} else {
$data['weight'] = '';
}
$products = Cart::getProducts();
foreach ($products as $product) {
$product_total = 0;
foreach ($products as $product_2) {
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\App\Controllers\Shop\Basket.php
use Settings;
use Customer;
use Import;
use Language;
use Image;
use Currency;
use Tax;
use Weight;
use Session;
use DB;
class Basket extends BaseController
{
public function __construct()
{
parent::__construct();
Language::setLanguageId(3);
}
public function index()
{
$this->data = array_merge($this->data,$this->getProducts());
View::render('basket.index',$this->data);
}
public function addProduct($product_id)
{
if (Request::isAjax() && Request::isMethod('POST')) {
$product_info =Model::namespace("Shop")->run("Product")->getProduct($product_id);
$quantity = Request::post('quantity');
if ($product_info) {
if (Request::post('option')) {
$option = array_filter(Request::post('option'));
} else {
$option = array();
}
$product_options = Model::namespace("Shop")->run("Product")->getProductOptions($product_id);
foreach ($product_options as $product_option) {
if ($product_option['required'] && empty($option[$product_option['product_option_id']])) {
$json["code"] = false;
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Libs\Router\Router.php
$params = array_merge($params, $val["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));
} elseif (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;
}
}
}
if ($matched === 0) {
self::pageNotFound();
}
}
/**
* Check Domain
*
* @param array $params
* @return bool
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\System\Libs\Router\Router.php
$params = array_merge($params, $val["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));
} elseif (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;
}
}
}
if ($matched === 0) {
self::pageNotFound();
}
}
/**
* Check Domain
*
* @param array $params
* @return bool
C:\inetpub\vhosts\ecom.teknolobi.com\httpdocs\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
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();