Ignore:
Timestamp:
Jul 29, 2009, 7:22:20 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Při zobrazení aktualit automaticky měnit adresy URL začínající http:// na HTML odkazy.
  • Přidáno: SQL aktulizace nového IP rozsahu.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/aktuality/news.php

    r221 r236  
    1212  var $NewsCountPerCategory = 3;
    1313  var $UploadedFilesFolder = 'aktuality/uploads/';
     14 
     15  function ModifyContent($Content)
     16  {
     17    $Result = '';
     18   
     19    // Make HTML link from URL
     20    $I = 0;
     21    while(strpos($Content, 'http://') !== false)
     22    {
     23      $I = strpos($Content, 'http://');
     24      if($Content{$I - 1} != '"')
     25      {
     26        $Result .= substr($Content, 0, $I);
     27        $Content = substr($Content, $I);
     28        if(strpos($Content, ' ') !== false)
     29          $URL = substr($Content, 0, strpos($Content, ' '));
     30          else $URL = substr($Content, 0);
     31        $Result .= '<a href="'.$URL.'">'.$URL.'</a>';
     32        $Content = substr($Content, strlen($URL));
     33      } else
     34      {
     35        $Result .= substr($Content, 0, $I + 1);
     36        $Content = substr($Content, $I + 1);
     37      }     
     38    }
     39    $Result .= $Content;
     40    return($Result);
     41  }
    1442 
    1543  function ShowNews($Category, $ItemCount, $DaysAgo)
     
    4169          else $Author = $Row['Name'];
    4270        $Output .= '<tr><td onclick="window.location=\'aktuality/index.php?action=view&amp;id='.$Row['Id'].'\'" onmouseover="zobraz('."'new".$Category.$Index."'".')" style="cursor: pointer; margin: 0px;"><table class="NewsItemFrame"><tr><td style="font-size: '.$FontSize.'pt"><strong>'.$Row['Title'].'</strong></td><td align="right" style="font-size: '.$FontSize.'pt">'.$Author.' ('.HumanDate($Row['Date']).')</td></tr></table>';
    43         $Output .= '<div id="new'.$Category.$Index.'" class="NewsTableItem">'.$Row['Content'];
     71        $Output .= '<div id="new'.$Category.$Index.'" class="NewsTableItem">'.$this->ModifyContent($Row['Content']);
    4472
    4573        if($Row['Enclosure'] != '')
     
    4775          $Output .= '<br />Přílohy: ';
    4876          $Enclosures = explode(';', $Row['Enclosure']);
    49                 foreach($Enclosures as $Enclosure)
    50                 {
    51                   if(file_exists($UploadedFilesFolder.$Enclosure)) $Output .= ' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>';
    52               }
     77          foreach($Enclosures as $Enclosure)
     78          {
     79            if(file_exists($UploadedFilesFolder.$Enclosure)) $Output .= ' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>';
     80          }
    5381        }
    5482        $Output .= '</div></td></tr>';
     
    125153      '<td align="center"><input type="text" size="2" name="NewsCategoryCount'.$I.'" value="'.$SettingItem['ItemCount'].'" />'.
    126154      '<input type="hidden" name="NewsCategoryId'.$I.'" value="'.$SettingItem['CategoryId'].'" /></td>'.
    127           '<td align="center"><input type="text" size="3" name="NewsCategoryDaysAgo'.$I.'" value="'.$SettingItem['DaysAgo'].'" /></td></tr>';
     155    '<td align="center"><input type="text" size="3" name="NewsCategoryDaysAgo'.$I.'" value="'.$SettingItem['DaysAgo'].'" /></td></tr>';
    128156      $I++;
    129157    }
Note: See TracChangeset for help on using the changeset viewer.