Advertisement
motafoca

Untitled

Feb 11th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 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. function show_prog_bar($width, $percent, $type = 'green', $color = '#000') {
  40. $font = 'Tahoma';
  41. $font_size = '8px';
  42. $font_weight = 'bold'; // bold, normal
  43. $imgs_folder = 'images/';
  44.  
  45. // == Don't edit below ==
  46. $percent = min($percent, 100);
  47. $width -= 2;
  48. $result = (($percent*$width) / 100);
  49. $return = '';
  50. $return .= '<div name="progress">';
  51. $return .= '<div style="background: url(\''.$imgs_folder.'/progress.gif\') no-repeat; height: 13px; width: 1px; display: block; float: left"><!-- --></div>';
  52. $return .= '<div style="background: url(\''.$imgs_folder.'/bg.gif\'); height: 13px; width: '.$width.'px; display: block; float: left">';
  53.  
  54. $return .= '<span style="background: url(\''.$imgs_folder.'/on_'.strtolower($type).'.gif\'); display: block; float: left; width: '.$result.'px; height: 11px; margin: 1px 0; font-size: '.$font_size.'; font-family: \''.$font.'\'; line-height: 11px; font-weight: '.$font_weight.'; text-align: right; color: '.$color.'; letter-spacing: 1px;">&nbsp;'.$percent.'%&nbsp;</span>';
  55.  
  56. $return .= '</div>';
  57. $return .= '<div style="background: url(\''.$imgs_folder.'/progress.gif\') no-repeat; height: 13px; width: 1px; display: block; float: left"><!-- --></div>';
  58. $return .= '</div>';
  59. return $return;
  60. }
  61.  
  62. if ($modSettings['RedirectPage_use_theme']){
  63. template_header();
  64. }
  65. else {
  66. echo '<html>
  67. <head>
  68. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '">
  69. <title>', $context['page_title_html_safe'], '</title>
  70. <style type="text/css">
  71. a:link,a:hover,a:visited {
  72. color: #338;
  73. text-decoration: none;
  74. border-bottom: dotted 1px;
  75. }
  76. a:hover {
  77. background-color: #eef;
  78. border-bottom: 0px;
  79. }
  80. div.main{
  81. padding: 2ex;
  82. margin: 50px auto;
  83. max-width: 650px;
  84. min-width: 350px;
  85. }
  86. div.copy{
  87. height: 50px;
  88. text-align: center;
  89. }
  90. </style>
  91. </head>
  92. <body>';
  93. }
  94.  
  95. // Show main block with redirection info (editable in admin panel)
  96. echo '
  97. <div class="main">
  98. ', $text, '
  99. </div>';
  100.  
  101. $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>';
  102. $forum_version = '';
  103.  
  104. if ($modSettings['RedirectPage_use_theme']){
  105. template_footer();
  106. }
  107. else {
  108. echo $forum_copyright, '
  109. </body>
  110. </html>';
  111. }
  112.  
  113. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement