Skip to content
Snippets Groups Projects
Select Git revision
  • 0ab377440d49c4839e83f63de72b2bcbfc2fb66c
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

robots.txt

Blame
  • Core.php 2.51 KiB
    <?php
    
    class Core {
        public static $breadcrumbs = array(
            array("href" => "http://www.unl.edu", "text" => 'UNL'),
            array("href" => '/', "text" => "UNL Lockup Factory")
        );
        const ROOT = __DIR__ . '/..';
        public static $absolute_base_url = 'http://lockups.unl.edu/';
    
        public static $siteNotice = NULL;
    
        public static function callController($controller, $action, $params = NULL) {
            $controller_name = 'Controllers\\' . ucfirst($controller) . 'Controller';
            $action_name = $action . 'Action';
            # if that controller exists and it has that method, call it
            $controller_filename = __DIR__ . '/' . str_replace(array('_', '\\'), '/', $controller_name) . '.php';
            if (file_exists($controller_filename) && is_callable($controller_name.'::'.$action_name)) {
                $controller_output = call_user_func($controller_name.'::'.$action_name, $params);
                self::renderPage($controller_output);
            } else {
                # need to 404
                echo 'not a thing';
            }
        }
    
        public static function renderPage(Controllers\ControllerOutput $controllerOutput) {
            include __DIR__ . '/Views/main_template.php';
        }
    
    
        # redirect to a URL
        public static function redirect($url, $exit = TRUE) {
            header('Location: ' . $url);
            if (!defined('CLI') && FALSE !== $exit) {
                exit($exit);
            }
        }
    
        public static function notFound($message = 'That content could not be found.') {
            http_response_code(404);
    
            $context = new \stdClass;
            $context->message = $message;
            self::renderPage(\Controllers\Controller::renderView('not_found', $context));
            exit();
        }
    
        # redirect back to where the user came from
        public static function redirectBack($exit = TRUE) {
            header('Location: ' . $_SERVER['HTTP_REFERER']);
            if (!defined('CLI') && FALSE !== $exit) {
                exit($exit);
            }
        }
    
        # get flash notice information
        public static function getNotice()
        {
            if (isset($_SESSION['flash_notice'])) {
                $notice = $_SESSION['flash_notice'];
                unset($_SESSION['flash_notice']);
                return $notice;
            } else {
                return NULL;
            }
        }
    
        public static function getGenerateOutput()
        {
            if (isset($_SESSION['generate_output'])) {
                $notice = $_SESSION['generate_output'];
                unset($_SESSION['generate_output']);
                return $notice;
            } else {
                return NULL;
            }
        }
    }