document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Attempt to ignore idiots.
  2. if ((strpos($current, \'mosConfig_\') !== false) || (strpos($current, \'=http://\') !== false)) {
  3.         // Render the error page.
  4.         JError::customErrorPage($error);
  5. }
  6.  
  7. // See if the current url exists in the database as a redirect.
  8. $db = JFactory::getDBO();
  9.         $db->setQuery(
  10.         \'SELECT \'.$db->quoteName(\'new_url\').\', \'.$db->quoteName(\'published\').
  11.         \' FROM \'.$db->quoteName(\'#__redirect_links\') .
  12.         \' WHERE \'.$db->quoteName(\'old_url\').\' = \'.$db->quote($current),
  13.         0, 1
  14. );
  15. $link = $db->loadObject();
  16.  
  17. // If a redirect exists and is published, permanently redirect.
  18. if ($link and ($link->published == 1)) {
  19.         $app->redirect($link->new_url, null, null, true, true);
  20. }
  21. else
  22. {
  23.         $referer = empty($_SERVER[\'HTTP_REFERER\']) ? \'\' : $_SERVER[\'HTTP_REFERER\'];
  24.         $db->setQuery(\'select id from \'.$db->quoteName(\'#__redirect_links\')."  where old_url=\'".$current."\'");
  25.         $res = $db->loadResult();
  26.         if(!$res) {
  27.                 // If not, add the new url to the database.
  28.                  $query = $db->getQuery(true);
  29.                  $query->insert($db->quoteName(\'#__redirect_links\'), false);
  30.                  $columns = array( $db->quoteName(\'old_url\'),
  31.                                                 $db->quoteName(\'new_url\'),
  32.                                                 $db->quoteName(\'referer\'),
  33.                                                 $db->quoteName(\'comment\'),
  34.                                                 $db->quoteName(\'published\'),
  35.                                                 $db->quoteName(\'created_date\')
  36.                                         );
  37.                 $query->columns($columns);
  38.             $query->values($db->Quote($current). \', \'. $db->Quote(\'\').
  39.                                         \' ,\'.$db->Quote($referer).\', \'.$db->Quote(\'\').\',0, \'.
  40.                                           $db->Quote(JFactory::getDate()->toSql())
  41.                                         );
  42.  
  43.                 $db->setQuery($query);
  44.                 $db->query();
  45.         }
');