aliroPage404 Class Reference

List of all members.

Public Member Functions

 __construct ()

Private Member Functions

 record404 ()
 searchuri ()


Detailed Description

Definition at line 43 of file aliroPage404.php.


Constructor & Destructor Documentation

aliroPage404::__construct (  ) 

Definition at line 45 of file aliroPage404.php.

References aliroRequest::getInstance(), aliroMenuHandler::getInstance(), aliroComponentHandler::getInstance(), menu, record404(), searchuri(), system, and T_().

00045                                    {
00046         if (aliroComponentHandler::getInstance()->componentCount() AND aliroMenuHandler::getInstance()->getMenuCount('mainmenu')) {
00047             header ('HTTP/1.1 404 Not Found');
00048             $this->record404();
00049             $searchtext = $this->searchuri();
00050             aliroRequest::getInstance()->setPageTitle(T_('404 Error - page not found'));
00051             echo <<<PAGE_404
00052             <h3>Sorry! Page not found</h3>
00053             <p>
00054             This may be a problem with our system, and the issue 
00055             has been logged for investigation. Or it could be that 
00056             you have an outdated link.
00057             </p>
00058             <p>
00059             This page is also presented for an item that exists 
00060             but is not available to you.  If you are not logged in, 
00061             you might like to log in and try again.
00062             </p>
00063             <p>
00064             If you have any query you would like us to deal with, 
00065             please use the CONTACT US facility from the main menu.  
00066             </p>
00067             <p>
00068             The following items have some connection with the URI 
00069             you used to come here, so maybe they are what you were 
00070             looking for?
00071             </p>
00072 PAGE_404;
00073 
00074             echo $searchtext;
00075         }
00076         else echo T_('This Aliro based web site is not yet configured with user data, please call back later');
00077     }


Member Function Documentation

aliroPage404::record404 (  )  [private]

Definition at line 79 of file aliroPage404.php.

References aliroCoreDatabase::getInstance(), and aliroRequest::trace().

Referenced by __construct().

00079                                   {
00080         $uri = $_SERVER['REQUEST_URI'];
00081         $timestamp = date ('Y-m-d H:i:s');
00082         $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
00083         $post = base64_encode(serialize($_POST));
00084         $trace = aliroRequest::trace();
00085         aliroCoreDatabase::getInstance()->doSQL("INSERT INTO #__error_404 (uri, timestamp, referer, post, trace) VALUES ('$uri', '$timestamp', '$referer', '$post', '$trace') ON DUPLICATE KEY UPDATE timestamp = '$timestamp', referer='$referer', post='$post', trace='$trace'");
00086     }

aliroPage404::searchuri (  )  [private]

Definition at line 88 of file aliroPage404.php.

References $sef, aliroSEF::getInstance(), and aliroMambotHandler::getInstance().

Referenced by __construct().

00088                                   {
00089         $uri = $_SERVER['REQUEST_URI'];
00090         $bits = explode ('/', $uri);
00091         for ($i=count($bits); $i>0; $i--) {
00092             $bit = $bits[$i-1];
00093             if ($bit) break;
00094         }
00095         $bit = str_replace(array('!', '%21'), array('',''), $bit);
00096         $searchword = preg_replace('/[^A-Za-z]/', ' ', $bit);
00097         $results = aliroMambotHandler::getInstance()->trigger('onSearch', array($searchword, 'all', 'popular'));
00098         $lines = array();
00099         $purifier = new HTMLPurifier;
00100         foreach ($results as $result) {
00101             if ($result) foreach ($result as $item) {
00102                 if (empty($item->text)) continue;
00103                 $item->text = $purifier->purify($item->text);
00104                 $item->text = strip_tags($item->text);
00105                 if (strlen($item->text) > 200) $item->text = substr($item->text,0,200).'...';
00106                 if (!isset($item->section)) $item->section = '';
00107                 $lines[] = $item;
00108             }
00109         }
00110         $html = '';
00111         $sef = aliroSEF::getInstance();
00112         if (count($lines)) foreach ($lines as $line) {
00113             $section = isset($line->section) ? $line->section : '';
00114             $html .= <<<SEARCH_LINE
00115 
00116             <p>
00117             <a href="{$sef->sefRelToAbs($line->href)}">$line->title</a>
00118             $section
00119             $line->text
00120             </p>
00121 
00122 SEARCH_LINE;
00123 
00124         }
00125         else $html = '<p>'.T_('Sorry, none found').'</p>';
00126         return $html;
00127     }


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:01:59 2008 for ALIRO by  doxygen 1.5.5