Редирект на внешние сайты

Редирект на внешние сайты 1.1.0

Compatibility
not tested for compatibility
Database changes
not required
Author
_Xz_
Public domain
yes
Описание: добавляет страницу-редирект на внешние сайты.
Installation instructions
PHP:
найти функцию function make_url_clickable_callback ($m) в bbcode.php и заменить на

function make_url_clickable_callback ($m)
{
global $bb_cfg;
    $max_len = 70;
    $href    = $m[1];
    $scheme  = strtolower(@$m[2]);
    $name    = $href;

    if (strlen($name) > $max_len)
    {
        $name = substr($name, 0, $max_len - 19) .'...'. substr($name, -16);
    }
    if (strpos($scheme, '://') === false)
    {
        $href = (strpos($scheme, 'www') !== false) ? "http://$href" : "$href";
    }

        if(!preg_match("#{$bb_cfg['server_name']}#", $href))
         {
             require_once(INC_DIR . 'class.idna_convert.php');
             $IDN = new idna_convert();
             return '<a href="'. make_url('/go.php?url=') . $href .'" class="postLink" target="_blank">'. $name .'</a>';
         }
         else
         {
             return "<a href=\"$href\" class=\"postLink\">$name</a>";
         }
}

==================================================================================

в page_header.tpl перед </head> добавить

<script type="text/javascript">
  function initExternalLinks(context)
  {
    var context = context || 'body';
    if (ExternalLinks_InNewWindow) {
      $("a.postLink:not([href*='"+ window.location.hostname +"/'])", context).attr({
        href: function(){ return '/go.php?url='+ this.href; },
        target: '_blank' });
    }
  }
</script>
=================================================================================
все ссылки которые через редирект нужно сделать так /go.php?url=http://ссылка.ru
Author
Exile
Downloads
234
Views
399
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Exile

Latest updates

  1. Обновление 1.1.0

    Обновлено описание ресурса
Back
Top