Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
Pages : 1
Bonjour, je suis entrain de créer un site attaché à un forum fluxbb (utilisant donc les memes fonctions ) et j'aurais aimé savoir comment crée une deuxième page de redirection, qui utiliserait le style css du site et pas celui du forum,
j'ai pris la fonction redirect que j'ai copié et modifier, ce qui me donne ceci :
function redirect_site($destination_url, $message)
{
global $db, $pun_config, $lang_common, $pun_user;
// Prefix with base_url (unless there's already a valid URI)
if (strpos($destination_url, 'http://') !== 0 && strpos($destination_url, 'https://') !== 0 && strpos($destination_url, '/') !== 0)
$destination_url = get_base_url(true).'/'.$destination_url;
// Do a little spring cleaning
$destination_url = preg_replace('/([\r\n])|(%0[ad])|(;\s*data\s*:)/i', '', $destination_url);
// If the delay is 0 seconds, we might as well skip the redirect all together
if ($pun_config['o_redirect_delay'] == '0')
header('Location: '.str_replace('&', '&', $destination_url));
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // For HTTP/1.0 compatibility
// Send the Content-type header in case the web server is setup to send something else
header('Content-type: text/html; charset=utf-8');
if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl'))
{
$tpl_file = PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl';
$tpl_inc_dir = PUN_ROOT.'style/'.$pun_user['style'].'/';
}
else
{
$tpl_file = PUN_ROOT.'include/template/redirect.tpl';
$tpl_inc_dir = PUN_ROOT.'include/user/';
}
$tpl_redir = file_get_contents($tpl_file);
// START SUBST - <pun_include "*">
preg_match_all('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_redir, $pun_includes, PREG_SET_ORDER);
foreach ($pun_includes as $cur_include)
{
ob_start();
// Allow for overriding user includes, too.
if (file_exists($tpl_inc_dir.$cur_include[1].'.'.$cur_include[2]))
require $tpl_inc_dir.$cur_include[1].'.'.$cur_include[2];
else if (file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
require PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
else
error(sprintf($lang_common['Pun include error'], htmlspecialchars($cur_include[0]), basename($tpl_file)));
$tpl_temp = ob_get_contents();
$tpl_redir = str_replace($cur_include[0], $tpl_temp, $tpl_redir);
ob_end_clean();
}
// END SUBST - <pun_include "*">
// START SUBST - <pun_language>
$tpl_redir = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_redir);
// END SUBST - <pun_language>
// START SUBST - <pun_content_direction>
$tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir);
// END SUBST - <pun_content_direction>
// START SUBST - <pun_head>
ob_start();
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Redirecting']);
?>
<meta http-equiv="refresh" content="<?php echo $pun_config['o_redirect_delay'] ?>;URL=<?php echo str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url) ?>" />
<title><?php echo generate_page_title($page_title) ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_redir = str_replace('<pun_head>', $tpl_temp, $tpl_redir);
ob_end_clean();
// END SUBST - <pun_head>
// START SUBST - <pun_redir_main>
ob_start();
?>
<div class="block">
<h2><?php echo $lang_common['Redirecting'] ?></h2>
<div class="box">
<div class="inbox">
<p><?php echo $message.'<br /><br /><a href="'.$destination_url.'">'.$lang_common['Click redirect'].'</a>' ?></p>
</div>
</div>
</div>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_redir = str_replace('<pun_redir_main>', $tpl_temp, $tpl_redir);
ob_end_clean();
// END SUBST - <pun_redir_main>
// START SUBST - <pun_footer>
ob_start();
// End the transaction
$db->end_transaction();
// Display executed queries (if enabled)
if (defined('PUN_SHOW_QUERIES'))
display_saved_queries();
$tpl_temp = trim(ob_get_contents());
$tpl_redir = str_replace('<pun_footer>', $tpl_temp, $tpl_redir);
ob_end_clean();
// END SUBST - <pun_footer>
// Close the db connection (and free up any result data)
$db->close();
exit($tpl_redir);
}mais cela ne s'affiche pas comme je le voudrais, lorsque j'éxécute la redirection, le header de ma page s'éxécute tout de meme ce qui me donne :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Site</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="fr" />
<link href="style/site/blue.css" title="Défaut" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery-1.6.2.js"></script>
<script type="text/javascript" src="js/jquery.preloadcssimages.js"></script>
<script type="text/javascript" src="js/site.js"></script>
<link rel="alternate" type="application/rss+xml" title="Flux Rss" href="fluxrss.xml"/>
<script type="text/javascript" src="js/tripleflap.js"></script>
</head>
<body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;URL=http://mangasworld.eu/XXX/XXXX/XXX.php" />
<title>Redirection / site</title>
<link rel="stylesheet" type="text/css" href="style/Kiwi.css" />
</head>
<body>
<div id="punredirect" class="pun">
<div class="top-box"><div><!-- Top Corners --></div></div>
<div class="punwrap">
<div id="brdmain">
<div class="block">
<h2>Redirection</h2>
<div class="box">
<div class="inbox">
<p>Le post à bien était remis à sa place.post_id : 23 ; last_type :video<br /><br /><a href="http://mangasworld.eu/XXX/XXXX/XXX.php">Cliquez ici si vous ne voulez pas attendre (ou si votre navigateur ne vous redirige pas automatiquement).</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="end-box"><div><!-- Bottom Corners --></div></div>
</div>
</body>
</html>Dernière modification par thib3113 (04-09-2011 18:33:12)
Hors ligne
Pages : 1