A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Re: Untitled - Stikked
From Small Tern, 12 Years ago, written in PHP.
This paste is a reply to Untitled from Tiny Pig - view diff
Embed
  1. <?php
  2.    
  3. class Router {
  4.    
  5.     public function route () {
  6.         $controllerFound = false;
  7.        
  8.         // Deside the controller
  9.         if (key_exists('controller', $_GET) && !empty($_GET['controller'])) {
  10.             $controllerName = ucfirst(strtolower($_GET['controller']));
  11.             $fullControllerName = $controllerName . 'Controller';
  12.             $controllerNameAndPath = dirname(__FILE__) . '/../app/controller/' . $fullControllerName . '.php';
  13.             if (file_exists($controllerNameAndPath)) {
  14.                 include_once $controllerNameAndPath;
  15.                 $controller = new $fullControllerName();
  16.                 $controllerFound = true;
  17.             }
  18.         } else {
  19.             $controllerName = 'Index';
  20.             $controllerNameAndPath = dirname(__FILE__) . '/../app/controller/IndexController.php';
  21.             if (file_exists($controllerNameAndPath)) {
  22.                 include_once $controllerNameAndPath;
  23.                 $controller = new IndexController();
  24.                 $controllerFound = true;
  25.             }
  26.         }
  27.  
  28.         $actionFound = false;
  29.  
  30.         if ($controllerFound) {
  31.             // Deside the action
  32.             if (key_exists('action', $_GET) && !empty($_GET['action'])) {
  33.                 $actionName = $_GET['action'];
  34.                 $functionName = $actionName . 'Action';
  35.                 if (method_exists($controller, $functionName)) {
  36.                     $actionFound = true;
  37.                 }
  38.             } else {
  39.                 $actionName = 'index';
  40.                 $functionName = 'indexAction';
  41.                 if (method_exists($controller, $functionName)) {
  42.                     $actionFound = true;
  43.                 }
  44.             }
  45.         }
  46.        
  47.         if (!$controllerFound || !$actionFound) {
  48.             include_once dirname(__FILE__) . '/../app/controller/ErrorController.php';
  49.             $actionName = 'index';
  50.             $controllerName = 'Error';
  51.             $controller = new ErrorController();
  52.             $controller->setErrorCode('404');
  53.             $controller->setErrorMsg((!$controllerFound ? 'Controller Not Found' : 'Action Not Found'));
  54.         }
  55.        
  56.         $controller->setActionName($actionName);
  57.         $controller->setControllerName($controllerName);
  58.         $controller->setParams($_REQUEST);
  59.        
  60.         $controller->init();
  61.         $controller->runAction();
  62.     }
  63.    
  64. }

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Obese Sheep php 12 Years ago.