Example #1
0
 public static function getHTMLBase()
 {
     $base = Config::getBaseUrl();
     $folder = Config::getBaseFolder();
     if (!empty($folder)) {
         $base .= '/' . $folder;
     }
     $base .= '/';
     return $base;
 }
Example #2
0
 public static function route()
 {
     $prefix = '/' . Config::getBaseFolder();
     $requesturi = $_SERVER['REQUEST_URI'];
     if (substr($requesturi, 0, strlen($prefix)) == $prefix) {
         $requesturi = substr($requesturi, strlen($prefix));
     }
     $requesturi = trim($requesturi, '/');
     $requestSegments = explode('?', $requesturi);
     $segments = explode('/', $requestSegments[0]);
     if ($segments[0] !== 'index.php') {
         Lib::load('router');
         foreach (Router::getRouters() as $router) {
             if (is_string($router->allowedRoute) && $segments[0] !== $router->allowedRoute) {
                 continue;
             }
             if (is_array($router->allowedRoute) && !in_array($segments[0], $router->allowedRoute)) {
                 continue;
             }
             $router->decode($segments);
         }
     }
     // Check for API call
     if (Req::hasget('api')) {
         $apiName = Req::get('api');
         $action = Req::get('action');
         $api = Lib::api($apiName);
         if (!is_callable(array($api, $action))) {
             return Lib::api()->fail();
         }
         return $api->{$action}();
     }
     // Check for controller
     if (Req::hasget('controller')) {
         $controllerName = Req::get('controller');
         $action = Req::get('action');
         $controller = Lib::controller($controllerName);
         if (!is_callable(array($controller, $action))) {
             return $controller->execute();
         }
         return $controller->{$action}();
     }
     $viewname = Req::get('view');
     if (empty($viewname)) {
         $viewname = 'error';
     }
     return Lib::view($viewname)->display();
 }
Example #3
0
 public static function url($target, $options = array(), $external = false)
 {
     $values = array();
     $router = Config::$sef ? Lib::router($target) : false;
     $base = $external ? Config::getBaseUrl() . '/' . Config::getBaseFolder() . '/' : '';
     if (!$router) {
         foreach ($options as $k => $v) {
             $values[] = $k . '=' . $v;
         }
         $queries = implode('&', $values);
         if (!empty($queries)) {
             $queries = '?' . $queries;
         }
         return $base . $target . '.php' . $queries;
     }
     $link = $base . $router->build($options);
     return $link;
 }
Example #4
0
<?php

!defined('SERVER_EXEC') && die('No access.');
?>
<!DOCTYPE html>
<html>
<head>
	<base href="/<?php 
echo !empty($base = Config::getBaseFolder()) ? $base . '/' : '';
?>
" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no, minimal-ui" />

	<link href="assets/css/fonticon.mod.css" media="all" rel="stylesheet" type="text/css" />

	<?php 
if (false) {
    ?>
	<link href="assets/css/rainbow-github.css" rel="stylesheet" type="text/css" />
	<script src="assets/js/rainbow.min.js" type="text/javascript"></script>
	<?php 
}
?>

	<link href="assets/css/highlight-github.css" rel="stylesheet" type="text/css" />
	<script src="assets/js/highlight.min.js" type="text/javascript"></script>

	<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,100' rel='stylesheet' type='text/css' />
Example #5
0
 public function delete($key)
 {
     unset($_COOKIE[$key]);
     setcookie($key, null, time() - 60 * 60 * 24, '/' . Config::getBaseFolder(), '', false, true);
 }