Beispiel #1
0
 /**
  * Will do necessary URL routing and clean-up;
  *
  * While most of the times we will relly on static URLs, generated by our URL mechanism, most of the times we will need to be
  * able to modify the URL or redirect an user to a proper URL, if he has gone haywire. This method does just that, manages
  * the URL of the current requested page;
  */
 public function doURLRoutingAndCLEANUp()
 {
     // Redirect to HOME, if nothing set;
     if ($_GET->doCount()->toInt() == 0) {
         // Set the header key and go home my man ...
         TPL::setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         TPL::setHeaderKey(URL::rewriteURL(new A(array(FRONTEND_SECTION_URL)), new A(array(FRONTEND_HOME))), new S('Location'));
     }
     // -- Fix the double www. and non-www;
     if (strpos(URL::rewriteURL(), '://www.') !== FALSE) {
         // Moved me permanently ...
         $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         $this->setHeaderKey(URL::rewriteURL()->doToken('://www.', '://'), new S('Location'));
     }
     // -- Fix the OLD to NEW moving of REWRITE_ENGINE;
     if (strpos($_SERVER['REQUEST_URI'], 'index.php/') !== FALSE && REWRITE_ENGINE == TRUE) {
         // Moved me permanently ...
         $this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
         $this->setHeaderKey(URL::rewriteURL()->doToken('index.php/', _NONE), new S('Location'));
     }
 }