session_start(); error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); include_once ('/var/www/saleskitproduction/db_fns.php'); include_once ('/var/www/saleskitproduction/admin/classes/ksadmin.php'); require_once '/var/www/saleskitproduction/vendor/autoload.php'; $loader = new \Twig\Loader\FilesystemLoader('/var/www/saleskitproduction/templates'); $twig = new \Twig\Environment($loader); $REQUEST_URI = preg_replace("/;.*/" ,"" ,$_SERVER['REQUEST_URI'] ); $REQUEST_URI = preg_replace("/'.*/" ,"" ,$REQUEST_URI ); $REQUEST_URI = explode('/', $REQUEST_URI); $url_array = array($REQUEST_URI[1], $REQUEST_URI[2] ?? ''); if(isset($REQUEST_URI[3]) && $REQUEST_URI[3] != ''){ $url_array[] = $REQUEST_URI[3]; } $session = ksSession::globalSession(true, 0); $admin = new ksAdmin(); $admin = $admin->currentAdmin(); //pre($admin); if( $admin->id <= 0 ) { $url_array[0] = 'login'; } elseif ( isset($url_array[0]) && $url_array[0] == '' ) { $url_array[0] = 'home'; } $template = array( 'user' => $admin, 'url' => $url_array[0], 'path' => '', 'view' => $bndl, ); if( $url_array[0] == 'login' ) { $file = '/var/www/saleskitproduction/admin/login/index.php'; include($file); } else if( $url_array[0] == 'home' ) { $file = '/var/www/saleskitproduction/admin/home/index.php'; include($file); } else if( $url_array[0] == 'logout' ) { $file = '/var/www/saleskitproduction/admin/logout/logout.php'; include($file); } else if( is_array($url_array) && count($url_array) >= 0 ) { if( count($url_array) == 1 ) { $url_array[1] = $url_array[0]; $url_array[0] = ''; } else if( isset($url_array[1]) && $url_array[1] == '' ) { $url_array[1] = 'index'; } // pre($url_array); $file = '/var/www/saleskitproduction/admin/'.$url_array[0].'/'.$url_array[1].'.php'; if( file_exists($file) ) { include($file); } }