------------------------------------------------------------
revno: 885
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Thu 2011-07-14 22:44:44 +0200
message:
  corrections in errors.php
modified:
  src/libs/errors.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/errors.php'
--- src/libs/errors.php	2011-06-19 20:30:20 +0000
+++ src/libs/errors.php	2011-07-14 20:44:44 +0000
@@ -48,50 +48,32 @@
     {
 		global $db, $aiki, $config;
 
-		Header("HTTP/1.1 404 Not Found");
-
-        /**
-         * @todo actually handle translating the page name
-         */
-		$aiki->output->set_title("404 Page Not Found");
-
-		if (isset($config["register_errors"]))
+		if (isset($config["register_errors"]) )
         {
-			$request = $_SERVER['REQUEST_URI'];
-			$request = urldecode($request);
-
-			$check_request = 
-            $db->get_row("SELECT * FROM aiki_redirects where url='$request'");
-
-			if (isset($check_request->url))
-            {
-				$update_hits = 
-                $db->query(
-                "update aiki_redirects set hits=hits+1 where url='$request'");
-
-				if ($check_request->redirect)
-                {
-					$catch_patterns[$check_request->url] = 
-                        $check_request->redirect;
-					$catch_regex = 
-                    '#((' . implode('|', array_keys($catch_patterns)) . '))#i';
-
-					if ( preg_match($catch_regex, 
-                                    urldecode($_SERVER['REQUEST_URI']), 
-                                    $caught) ) 
-					{
-						$redir = $catch_patterns[$caught[1]];
-
-						Header("Location: $redir", false, 301);
-						exit;
-					}
+            
+			$request = urldecode ($_SERVER['REQUEST_URI']);
+			
+			$check_request =  $db->get_row(
+                "SELECT * FROM aiki_redirects where url='$request'");
+
+			if (isset($check_request->url))  {				
+                $db->query("update aiki_redirects set hits=hits+1 where url='$request'");
+				if ($check_request->redirect) {					
+					Header("Location: ". $check_request->redirect, false, 301);
+					die();
 				}
 
 			} else {
-				$add_e = $db->query(
-					"insert into aiki_redirects values ('$request', '', '1')");
+				$db->query(	"insert into aiki_redirects values ('$request', '', '1')");
 			}
 		}
+                
+        Header("HTTP/1.1 404 Not Found");
+        /**
+         * @todo actually handle translating the page name
+         */
+		$aiki->output->set_title("404 Page Not Found");
+        // return page because it would be handle by cache..
 		return $config['error_404'];
 
 	} // end of page_not_found function

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to