Changeset 465 for trunk/includes


Ignore:
Timestamp:
Apr 15, 2010, 6:45:17 AM (15 years ago)
Author:
george
Message:
  • Upraveno: V shoutboxu převádět textové html odkazy na aktivní.
Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/includes/global.php

    r462 r465  
    4848  $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');
    4949  while($Line = $DbResult->fetch_assoc())
    50     echo('<tr><td><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</td></tr>');
     50    echo('<tr><td><strong>'.$Line['User'].'</strong>: '.MakeActiveLinks(htmlspecialchars($Line['Text'])).'</td></tr>');
    5151  echo('</table></div>');
    5252}
  • TabularUnified trunk/includes/global_function.php

    r462 r465  
    557557}
    558558
     559function MakeActiveLinks($Content)
     560{
     561  $Result = ''; 
     562  $I = 0;
     563  while(strpos($Content, 'http://') !== false)
     564  {
     565    $I = strpos($Content, 'http://');
     566    $Result .= substr($Content, 0, $I);
     567    $Content = substr($Content, $I);
     568    if(strpos($Content, ' ') !== false)
     569      $URL = substr($Content, 0, strpos($Content, ' '));
     570      else $URL = substr($Content, 0);
     571    $Result .= '<a href="'.$URL.'">'.$URL.'</a>';
     572    $Content = substr($Content, strlen($URL));
     573  }
     574  $Result .= $Content;
     575  return($Result);
     576}
     577
    559578?>
Note: See TracChangeset for help on using the changeset viewer.