-----
voilà le nouveau concept de site : page de garde :
<?php
$config['URL'] = 'http://www.nofrag.com/';
$config['IMAGES'] = 'images/';
$config['TOP_DIR'] = '../';
$config['HTML_DIR'] = $config['TOP_DIR'] . 'public_html/';
$config['SITE_DIR'] = $config['TOP_DIR'] . 'site/';
$config['SITE_GLOBAL_DIR'] = '/home/nofrag/site/';
$_SERVER['REQUEST_URI'] = $_ENV["REQUEST_URI"];
$config['PATH'] = trim($_SERVER['REQUEST_URI']);
$config['PATH'] = preg_replace( array( '/\/index$/',
'/(.+\/)(index|index\.([a-zA-Z0-9\.]*))$/',
'/\/(.+)$/'),
array(
'/',
'\\1',
'\\1'), $config['PATH']);
$config['REQUEST'] = explode('/', $config['PATH']);
$config['TEMPLATES'] = $config['TOP_DIR'] . 'templates/';
require_once $config['SITE_DIR'] . 'sql.php';
require_once $config['SITE_DIR'] . 'error.php';
function forums_old_news_redirect()
{
global $config;
$id_n_more = $config['REQUEST'][3];
if(strstr($id_n_more, '-')) {
$pos_tirait = strpos($id_n_more, '-')+1;
$pos_html = strpos($id_n_more, '.html');
$page = substr($id_n_more, $pos_tirait, $pos_html-$pos_tirait);
$news_id = substr($id_n_more, 0, strpos($id_n_more, '-' . $page . '.html'));
sql_connect() or error_sql();
$query = 'SELECT date FROM news WHERE news_id=\'' . $news_id . '\' LIMIT 0,1';
$result = @mysql_query($query) or error_sql();
if (mysql_num_rows($result) == 0) {
$year = substr($config['REQUEST'][1], -4);
$month = substr($config['REQUEST'][1], 0, -4);
$day = $config['REQUEST'][2];
error_movedpermanently($config['URL'] . $year . '/' . $month . '/' . $day . '/');
}
$row = mysql_fetch_assoc($result);
$date = strtotime($row['date']);
$months = num_to_month();
$monthname = $months[date('m', $date)];
error_movedpermanently($config['URL'] . date('Y', $date) . '/' . $monthname . '/' . date('d', $date) . '/' . $news_id . '/');
} else {
$news_id = substr($id_n_more, 0, strpos($id_n_more, '.html'));
if (empty($news_id))
$news_id = $id_n_more;
sql_connect() or error_sql();
$query = 'SELECT date FROM news WHERE news_id=\'' . $news_id . '\' LIMIT 0,1';
$result = @mysql_query($query) or error_sql();
if (mysql_num_rows($result) == 0) {
$year = substr($config['REQUEST'][1], -4);
$month = substr($config['REQUEST'][1], 0, -4);
$day = $config['REQUEST'][2];
error_movedpermanently($config['URL'] . $year . '/' . $month . '/' . $day . '/');
}
$row = mysql_fetch_assoc($result);
$date = strtotime($row['date']);
$months = num_to_month();
$monthname = $months[date('m', $date)];
error_movedpermanently($config['URL'] . date('Y', $date) . '/' . $monthname . '/' . date('d', $date) . '/' . $news_id . '/');
}
}
if (preg_match('|^news/([a-z]{3})([0-9]{4})/([0-9]{2})/(.*)$|', $config['PATH'])) {
forums_old_news_redirect();
}
error_notfound();
?>