AAAAindex.html 0000666 00000000037 15137403361 0006550 0 ustar 00
redirect.php 0000666 00000007464 15137403361 0007100 0 ustar 00 isAdmin() and ($error->getCode() == 404))
{
// Get the full current URI.
$uri = JURI::getInstance();
$current = $uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'));
// Attempt to ignore idiots.
if ((strpos($current, 'mosConfig_') !== false) || (strpos($current, '=http://') !== false)) {
// Render the error page.
JError::customErrorPage($error);
}
// See if the current url exists in the database as a redirect.
$db = JFactory::getDBO();
$db->setQuery(
'SELECT '.$db->quoteName('new_url').', '.$db->quoteName('published').
' FROM '.$db->quoteName('#__redirect_links') .
' WHERE '.$db->quoteName('old_url').' = '.$db->quote($current),
0, 1
);
$link = $db->loadObject();
// If no published redirect was found try with the server-relative URL
if (!$link or ($link->published != 1))
{
$currRel = $uri->toString(array('path', 'query', 'fragment'));
$db->setQuery(
'SELECT ' . $db->quoteName('new_url') . ', ' . $db->quoteName('published') .
' FROM ' . $db->quoteName('#__redirect_links') .
' WHERE ' . $db->quoteName('old_url') . ' = ' . $db->quote($currRel),
0, 1
);
$link = $db->loadObject();
}
// If a redirect exists and is published, permanently redirect.
if ($link and ($link->published == 1)) {
$app->redirect($link->new_url, null, null, true, false);
}
else
{
$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
$db->setQuery('SELECT id FROM ' . $db->quoteName('#__redirect_links') . ' WHERE old_url= ' . $db->quote($current));
$res = $db->loadResult();
if(!$res) {
// If not, add the new url to the database.
$query = $db->getQuery(true);
$query->insert($db->quoteName('#__redirect_links'), false);
$columns = array( $db->quoteName('old_url'),
$db->quoteName('new_url'),
$db->quoteName('referer'),
$db->quoteName('comment'),
$db->quoteName('hits'),
$db->quoteName('published'),
$db->quoteName('created_date')
);
$query->columns($columns);
$query->values($db->Quote($current). ', '. $db->Quote('').
' ,'.$db->Quote($referer).', '.$db->Quote('').',1,0, '.
$db->Quote(JFactory::getDate()->toSql())
);
$db->setQuery($query);
$db->query();
} else {
// Existing error url, increase hit counter
$query = $db->getQuery(true);
$query->update($db->quoteName('#__redirect_links'));
$query->set($db->quoteName('hits').' = '.$db->quoteName('hits').' + 1');
$query->where('id = '.(int)$res);
$db->setQuery((string)$query);
$db->query();
}
// Render the error page.
JError::customErrorPage($error);
}
}
else {
// Render the error page.
JError::customErrorPage($error);
}
}
}
redirect.xml 0000666 00000001472 15137403361 0007102 0 ustar 00
plg_system_redirect
Joomla! Project
April 2009
Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
GNU General Public License version 2 or later; see LICENSE.txt
admin@joomla.org
www.joomla.org
2.5.0
PLG_REDIRECT_XML_DESCRIPTION
redirect.php
index.html
en-GB.plg_system_redirect.ini
en-GB.plg_system_redirect.sys.ini
.htaccess 0000666 00000000177 15137403361 0006356 0 ustar 00
Order allow,deny
Deny from all