Advertisement
motafoca

Untitled

Feb 11th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. <?php
  2. // Include the SSI file.
  3. require(dirname(__FILE__) . '/SSI.php');
  4.  
  5. loadLanguage('RedirectPage/');
  6.  
  7. @$link = urldecode(substr($_SERVER['QUERY_STRING'], 4));
  8. if($modSettings['RedirectPage_encode']) $link = html_entity_decode(base64_decode($link));
  9. @$site = parse_url($link, PHP_URL_HOST);
  10.  
  11. // if it is in settings - use instant redirect to target page
  12. if ($modSettings['RedirectPage_type'] == 'instant'){
  13. header('Location: ' . $link);
  14. exit;
  15. }
  16.  
  17. // if it is in settings - use automatic redirection after delay
  18. if ($modSettings['RedirectPage_type'] == 'delayed'){
  19. header('Refresh: ' . $modSettings['RedirectPage_delay'] . '; url=' . $link);
  20. }
  21.  
  22. $context['page_title'] = $context['page_title_html_safe'] = $txt['RedirectPage_title'];
  23. $context['linktree'][1] = Array( 'url' => $context['user']['is_guest']? $scripturl . '?action=register' : $link, 'name' => $txt['RedirectPage_title']);
  24.  
  25. $in = Array('{LINK}', '{link}', '{SITE}', '{DELAY}', '{LOGIN}');
  26. $out = Array('<a href="' . $link . '">' . $link . '</a>', $link, $site, $modSettings['RedirectPage_delay'], $txt['login_or_register']);
  27.  
  28. if ($context['user']['is_guest'] && !empty($modSettings['RedirectPage_guest_text']))
  29. $text = $modSettings['RedirectPage_guest_text'];
  30. elseif (!empty($modSettings['RedirectPage_text']))
  31. $text = $modSettings['RedirectPage_text'];
  32. else
  33. $text = $txt['RedirectPage_default_text'];
  34.  
  35. //$text = (empty($modSettings['RedirectPage_text']))? $txt['RedirectPage_default_text'] : $modSettings['RedirectPage_text'];
  36.  
  37. $text = str_replace($in, $out, $text);
  38.  
  39. if ($modSettings['RedirectPage_use_theme']){
  40. template_header();
  41. }
  42. else {
  43. echo '<html>
  44. <head>
  45. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '">
  46. <title>', $context['page_title_html_safe'], '</title>
  47. <style type="text/css">
  48. a:link,a:hover,a:visited {
  49. color: #338;
  50. text-decoration: none;
  51. border-bottom: dotted 1px;
  52. }
  53. a:hover {
  54. background-color: #eef;
  55. border-bottom: 0px;
  56. }
  57. div.main{
  58. padding: 2ex;
  59. margin: 50px auto;
  60. max-width: 650px;
  61. min-width: 350px;
  62. }
  63. div.copy{
  64. height: 50px;
  65. text-align: center;
  66. }
  67. </style>
  68. </head>
  69. <body>';
  70. }
  71.  
  72. // Show main block with redirection info (editable in admin panel)
  73. echo '
  74. <div class="main">
  75. ', $text, '
  76. </div>';
  77.  
  78. $forum_copyright = '<div class="copy"><a href="http://custom.simplemachines.org/mods/index.php?mod=2562" target="_blank">RedirectPage</a> &copy; BIOHAZARD | more mods on <a href="http://demoforum.ru/" target="_blank">demoforum.ru</a></div>';
  79. $forum_version = '';
  80.  
  81. if ($modSettings['RedirectPage_use_theme']){
  82. template_footer();
  83. }
  84. else {
  85. echo $forum_copyright, '
  86. </body>
  87. </html>';
  88. }
  89.  
  90. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement