Linki HTTPS w SMFPack shoutbox

Zaczęty przez Stanley, 9 Wrzesień 2013, 20:12

0 użytkowników i 1 Gość przegląda ten wątek.

Stanley

Hej właśnie znalazłem mały trick z linkami https do SMFPack shoutbox po instalacji shoutboxa jest możliwość tylko wklejania linków z http ktoś wpadł jak zrobić aby i linki z https też chodziły:

autor: josem

w /Source/shoutbox.php

Znajdź:

   $length = 7;
   $string = 'http://';
   if (strstr($msg, 'http://') !== false)
   {
      if (strstr($msg, 'https://') !== false)
      {
         $string = 'https://';
         $length = 8;
      }
         
      $links = array();
      foreach (explode(' ', $msg) as $w)
         if (substr($w, 0, $length) == $string && $smcFunc['strlen']($w) > $length)
            $links[] = '<a href="' . $w . '" target="_blank">' . ($smcFunc['strlen']($w) > $shoutbox['maxLinkLenght'] ? substr($w, 0, $shoutbox['maxLinkLenght'] - ($length - 1)) . '...' . substr($w, -($length - 1)) : $w) . '</a>';
         else
            $links[] = $w;
      $msg = implode(' ', $links);
   }


Zmień na:

   if (strstr($msg, 'http://') !== false || strstr($msg, 'https://') !== false)
   {
      $links = array();
      foreach (explode(' ', $msg) as $w)
      {
         if (strstr($w, 'http://') !== false || !isset($string))
         {
            $string = 'http://';
            $length = 7;
         }
         if (strstr($w, 'https://') !== false)
         {
            $string = 'https://';
            $length = 8;
         }

         if (substr($w, 0, $length) == $string && $smcFunc['strlen']($w) > $length)
            $links[] = '<a href="' . $w . '" target="_blank">' . ($smcFunc['strlen']($w) > $shoutbox['maxLinkLenght'] ? substr($w, 0, $shoutbox['maxLinkLenght'] - ($length - 1)) . '...' . substr($w, -($length - 1)) : $w) . '</a>';
         else
            $links[] = $w;
      }
      $msg = implode(' ', $links);
   }
Moje fora: pesnext.pl, appgroup.org.pl

Specjalista od niczego.

Pomogłem?, - [Pomógł]