------------------------------------------------------------
revno: 1131
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Thu 2012-03-08 22:03:55 +0100
message:
  addslashes added before sql insert
modified:
  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 'libs/Errors.php'
--- libs/Errors.php	2012-01-06 23:39:08 +0000
+++ libs/Errors.php	2012-03-08 21:03:55 +0000
@@ -45,12 +45,12 @@
 	 * @param   array   $config global config instance
 	 * @return  mixed
 	 */
-	public function pageNotFound() {
-		global $db, $aiki, $config;
+	public function pageNotFound($showPage=false) {
+		global $db, $aiki; 
 
-		if (isset($config["register_errors"])) {
+		if (config("register_errors",false) ) {
 			
-			$request = urldecode ($_SERVER['REQUEST_URI']);
+			$request = addslashes(urldecode ($_SERVER['REQUEST_URI']));
 			
 			$check_request =  $db->get_row(
 				"SELECT * FROM aiki_redirects WHERE url='$request'");
@@ -61,20 +61,21 @@
 					Header("Location: ". $check_request->redirect, false, 301);
 					die();
 				}
-
 			} else {
 				$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'];
+			
+		if ( $showPage ) {
+			$aiki->Output->set_title("404 Page Not Found1");			
+			$language = $aiki->site->language();
+			$error = config("error_404_$language", false );
+			//  error_404 can't be traslated by t() because is a text, not a short string.
+			return ($error ? $error : 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