Changeset 466 for trunk/includes


Ignore:
Timestamp:
Apr 15, 2010, 8:20:31 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Zobrazopvání HTTP odkazů v kecátku.
  • Přidáno: Systémová hlášení se nyní zobrazují v barevných rámečcích s ikonou. Typy zpráv jsou informace, varování a kritická chyba.
Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/global.php

    r465 r466  
    1414foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    1515
    16 include_once(dirname(__FILE__).'/config.php');
     16include_once(dirname(__FILE__).'/global_function.php');
     17if(file_exists(dirname(__FILE__).'/config.php')) include_once(dirname(__FILE__).'/config.php');
     18  else die('Nenalezen konfigurační soubor config.php ve složce includes. Vytvořte jej zkopírováním vzoru config.sample.php.');
    1719include_once(dirname(__FILE__).'/Database.php');
    18 include_once(dirname(__FILE__).'/global_function.php');
    1920include_once(dirname(__FILE__).'/rss.php');
    2021include_once(dirname(__FILE__).'/system.php');
     
    4849  $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');
    4950  while($Line = $DbResult->fetch_assoc())
    50     echo('<tr><td><strong>'.$Line['User'].'</strong>: '.MakeActiveLinks(htmlspecialchars($Line['Text'])).'</td></tr>');
     51    echo('<tr><td><strong>'.$Line['User'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>');
    5152  echo('</table></div>');
    5253}
  • trunk/includes/global_function.php

    r465 r466  
    342342  if(isset($LanguageList[$LanguageId]) == false)
    343343  {
    344     echo('Jazyk dle zadaného Id neexistuje.');
     344    ShowMessage('Jazyk dle zadaného Id neexistuje.', MESSAGE_CRITICAL);
    345345    ShowFooter();
    346346    die();
     
    559559function MakeActiveLinks($Content)
    560560{
     561  $Content = htmlspecialchars($Content);
     562  $Content = str_replace("\n", ' <br/>', $Content);
     563  $Content = str_replace("\r", '', $Content);
     564 
    561565  $Result = ''; 
    562566  $I = 0;
     
    566570    $Result .= substr($Content, 0, $I);
    567571    $Content = substr($Content, $I);
    568     if(strpos($Content, ' ') !== false)
    569       $URL = substr($Content, 0, strpos($Content, ' '));
     572    $SpacePos = strpos($Content, ' ');
     573    if($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));
    570574      else $URL = substr($Content, 0);
     575   
    571576    $Result .= '<a href="'.$URL.'">'.$URL.'</a>';
    572577    $Content = substr($Content, strlen($URL));
     
    576581}
    577582
     583define('MESSAGE_WARNING', 0);
     584define('MESSAGE_CRITICAL', 1);
     585define('MESSAGE_INFORMATION', 2);
     586
     587function ShowMessage($Text, $Type = MESSAGE_INFORMATION)
     588{
     589  global $System;
     590 
     591  $IconName = array(MESSAGE_INFORMATION => 'information', MESSAGE_WARNING => 'warning', MESSAGE_CRITICAL => 'critical');
     592  $BackgroundColor = array(MESSAGE_INFORMATION => '#e0e0ff', MESSAGE_WARNING => '#ffffe0', MESSAGE_CRITICAL => '#ffe0e0');
     593 
     594  echo('<div class="message" style="background-color: '.$BackgroundColor[$Type].';"><table><tr><td class="icon"><img src="'.$System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'.$IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>');
     595}
     596
    578597?>
Note: See TracChangeset for help on using the changeset viewer.