Index: lib/tikiaccesslib.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/tikiaccesslib.php	(revision 48282)
+++ lib/tikiaccesslib.php	(revision )
@@ -3,7 +3,7 @@
 //
 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
-// $Id: tikiaccesslib.php 47522 2013-09-30 21:04:51Z lphuberdeau $
+// $Id: tikiaccesslib.php 47522 2013-09-17 13:54:52Z lphuberdeau $
 
 //this script may only be included - so its better to die if called directly.
 if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
@@ -384,13 +384,23 @@
 				$_SESSION['loginfrom'] = $_SERVER['REQUEST_URI'];
 			}
 
+
+			// including search form in error.tpl no longer works as of tiki 12 so redirect to search page here instead
+			if (!empty($detail['page']) && Perms::get()->search && ($prefs['feature_search'] === 'y' || $prefs['feature_search_fulltext'] === 'y') ) {
+				TikiLib::lib('errorreport')->report(tra($detail['errortitle']) . '<br>' . $detail['page']);
+				if ($prefs['feature_search_fulltext'] === 'y') {
+					$url = 'tiki-searchresults.php?highlight=' . $detail['page'];
+				} else {
+					$url = 'tiki-searchindex.php?filter~content=' . $detail['page'];
+				}
+				$this->redirect($url, '', $detail['code'], 'Not Found');
+			} else {
-			$smarty->assign('errortitle', $detail['errortitle']);
-			$smarty->assign('msg', $detail['message']);
-			$smarty->assign('errortype', $detail['code']);
+				$smarty->assign('errortitle', $detail['errortitle']);
+				$smarty->assign('msg', $detail['message']);
+				$smarty->assign('errortype', $detail['code']);
-			if ( isset( $detail['page'] ) )
-				$smarty->assign('page', $page);
-			$smarty->display("error.tpl");
-		}
+				$smarty->display("error.tpl");
+			}
+		}
 		die;
 	}
 
@@ -429,7 +439,7 @@
 	 * @param string The target web address
 	 * @param string an optional message to display
 	 */
-	function redirect( $url = '', $msg = '', $code = 302 )
+	function redirect( $url = '', $msg = '', $code = 302, $type = 'Found' )
 	{
 		global $prefs;
 
@@ -461,7 +471,7 @@
 			if ( $prefs['feature_obzip'] == 'y' ) {
 				@ob_start('ob_gzhandler');
 			}
-			header("HTTP/1.0 $code Found");
+			header("HTTP/1.0 $code $type");
 			header("Location: $url");
 		}
 		exit();
