Changeset 659


Ignore:
Timestamp:
May 29, 2014, 11:59:39 PM (10 years ago)
Author:
chronos
Message:
  • Opraveno: Zobrazení hodnoty času trvání změn stavu rozhraní.
  • Upraveno: Vzdálenou IP klienta nezjišťovat z proxy adres. Tyto adresy se dají falšovat a tedy nejsou spolehlivé.
Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r658 r659  
    11<?php
    22
    3 $Revision = 658; // Subversion revision
     3$Revision = 659; // Subversion revision
    44$DatabaseRevision = 657; // SQL structure revision
    55$ReleaseTime = strtotime('2014-05-25');
  • trunk/Common/Database.php

    r634 r659  
    88  var $PDOStatement;
    99  var $num_rows = 0;
    10  
     10
    1111  function fetch_assoc()
    1212  {
    1313    return($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
    1414  }
    15  
     15
    1616  function fetch_array()
    1717  {
     
    3636  var $ShowSQLError;
    3737  var $ShowSQLQuery;
    38  
     38
    3939  function __construct()
    40   { 
     40  {
    4141    $this->Type = 'mysql';  // mysql, pgsql
    4242    $this->ShowSQLError = false;
     
    4444    $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
    4545  }
    46  
     46
    4747  function Connect($Host, $User, $Password, $Database)
    48   {   
     48  {
    4949    if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
    5050      else if($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
     
    5959    }
    6060  }
    61  
     61
    6262  function Disconnect()
    6363  {
    6464    unset($this->PDO);
    6565  }
    66  
     66
    6767  function Connected()
    6868  {
    6969    return(isset($this->PDO));
    7070  }
    71  
     71
    7272  function select_db($Database)
    7373  {
    7474    $this->query('USE `'.$Database.'`');
    7575  }
    76  
     76
    7777  function query($Query)
    7878  {
    7979    if(!$this->Connected()) throw new Exception('Not connected to database');
    8080    $this->LastQuery = $Query;
    81     if($this->ShowSQLQuery == true) 
     81    if($this->ShowSQLQuery == true)
    8282      echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>'."\n");
    8383    $Result = new DatabaseResult();
     
    9191      $this->Error = $this->PDO->errorInfo();
    9292      $this->Error = $this->Error[2];
    93       if(($this->Error != '') and ($this->ShowSQLError == true)) 
     93      if(($this->Error != '') and ($this->ShowSQLError == true))
    9494        echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>');
    9595        throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query);
    9696    }
    97     return($Result); 
     97    return($Result);
    9898  }
    9999
    100100  function select($Table, $What = '*', $Condition = 1)
    101   {   
    102     return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition)); 
     101  {
     102    return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
    103103  }
    104104
    105105  function delete($Table, $Condition)
    106106  {
    107     $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 
    108   }
    109  
     107    $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
     108  }
     109
    110110  function insert($Table, $Data)
    111111  {
     
    115115    {
    116116      $Name .= ',`'.$Key.'`';
    117       if(!in_array($Value, $this->Functions)) 
     117      if(!in_array($Value, $this->Functions))
    118118      {
    119119        if(is_null($Value)) $Value = 'NULL';
     
    124124    $Name = substr($Name, 1);
    125125    $Values = substr($Values, 1);
    126     $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 
     126    $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
    127127    $this->insert_id = $this->PDO->lastInsertId();
    128128  }
    129  
     129
    130130  function update($Table, $Condition, $Data)
    131131  {
     
    133133    foreach($Data as $Key => $Value)
    134134    {
    135       if(!in_array($Value, $this->Functions)) 
     135      if(!in_array($Value, $this->Functions))
    136136      {
    137137        if(is_null($Value)) $Value = 'NULL';
     
    140140      $Values .= ', `'.$Key.'`='.$Value;
    141141    }
    142     $Values = substr($Values, 2); 
     142    $Values = substr($Values, 2);
    143143    $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
    144144  }
    145  
     145
    146146  function replace($Table, $Data)
    147147  {
     
    150150    foreach($Data as $Key => $Value)
    151151    {
    152       if(!in_array($Value, $this->Functions)) 
     152      if(!in_array($Value, $this->Functions))
    153153      {
    154154        if(is_null($Value)) $Value = 'NULL';
     
    164164    //echo($this->error().'<br>');
    165165  }
    166  
     166
    167167  function charset($Charset)
    168168  {
    169169    $this->query('SET NAMES "'.$Charset.'"');
    170170  }
    171  
     171
    172172  function real_escape_string($Text)
    173173  {
    174174    return(addslashes($Text));
    175175  }
    176  
     176
    177177  public function __sleep()
    178178  {
     
    188188{
    189189  if($Time == NULL) return(NULL);
    190     else return(date('Y-m-d H:i:s', $Time)); 
     190    else return(date('Y-m-d H:i:s', $Time));
    191191}
    192192
     
    194194{
    195195  if($Time == NULL) return(NULL);
    196     else return(date('Y-m-d', $Time)); 
     196    else return(date('Y-m-d', $Time));
    197197}
    198198
     
    200200{
    201201  if($Time == NULL) return(NULL);
    202     else return(date('H:i:s', $Time)); 
     202    else return(date('H:i:s', $Time));
    203203}
    204204
    205205function MysqlDateTimeToTime($DateTime)
    206206{
    207   if($DateTime == '') return(NULL);     
     207  if($DateTime == '') return(NULL);
    208208  $Parts = explode(' ', $DateTime);
    209   $DateParts = explode('-', $Parts[0]); 
     209  $DateParts = explode('-', $Parts[0]);
    210210  $TimeParts = explode(':', $Parts[1]);
    211   $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 
    212   return($Result); 
     211  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
     212  return($Result);
    213213}
    214214
     
    216216{
    217217  if($Date == '') return(NULL);
    218   return(MysqlDateTimeToTime($Date.' 0:0:0')); 
     218  return(MysqlDateTimeToTime($Date.' 0:0:0'));
    219219}
    220220
     
    222222{
    223223  if($Time == '') return(NULL);
    224   return(MysqlDateTimeToTime('0000-00-00 '.$Time)); 
    225 }
     224  return(MysqlDateTimeToTime('0000-00-00 '.$Time));
     225}
  • trunk/Common/Form/Types/DateTime.php

    r616 r659  
    1010  {
    1111    global $MonthNames;
    12    
     12
    1313    if($Item['Value'] == 0) return('');
    1414    if((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
    1515    $Parts = getdate($Item['Value']);
    1616    $Output = $Parts['mday'].'.'.$Parts['mon'].'.'.$Parts['year'].' '.
    17       $Parts['hours'].':'.$Parts['minutes'].':'.$Parts['seconds'];
     17      sprintf('%02d', $Parts['hours']).':'.sprintf('%02d', $Parts['minutes']).':'.sprintf('%02d', $Parts['seconds']);
    1818    return($Output);
    1919  }
     
    2525    if(($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))) $Item['Value'] = time();
    2626    $Parts = getdate($Item['Value']);
    27    
     27
    2828    $Output = '';
    2929    $Style = '';
     
    4343          $Item['Name'].'-day\');toggle(\''.$Item['Name'].'-month\');toggle(\''.$Item['Name'].'-year\');"/>';
    4444    }
    45    
     45
    4646    // Hour
    4747    $Output .= '<select name="'.$Item['Name'].'-hour" id="'.$Item['Name'].'-hour" '.$Style.'>';
     
    106106    return(MysqlDateTimeToTime($Item['Value']));
    107107  }
    108  
     108
    109109  function OnSaveDb($Item)
    110   {   
     110  {
    111111    if($Item['Value'] == null) return(null);
    112112      else return(date('Y-m-d H:i:s', $Item['Value']));
  • trunk/Common/Form/Types/File.php

    r577 r659  
    99  var $DirectoryId;
    1010  var $TempName;
    11  
     11
    1212  function DetectMimeType()
    1313  {
     
    1818    return($Result);
    1919  }
    20  
     20
    2121  function GetSize($Item)
    2222  {
     
    2424    if(file_exists($FileName)) $Result = filesize($FileName);
    2525      else $Result = 0;
    26     return($Result); 
     26    return($Result);
    2727  }
    28  
     28
    2929  function GetFullName()
    3030  {
    3131    $ParentId = $this->Directory;
    32     while($ParenId != null)
     32    while($ParentId != null)
    3333    {
    3434      $DbResult = $this->Database->select('FileDirectory', '*', 'Id='.$ParentId);
     
    3636      $Path .= $DbRow['Name'].'/';
    3737      $ParentId = $DbRow['Parent'];
    38     }     
     38    }
    3939    $Result = $this->UploadFileFolder.'/'.$Path.$File->Name;
    4040    return($Result);
    4141  }
    42  
     42
    4343  function GetExt()
    4444  {
    4545    return(substr($this->Name, 0, strpos($this->Name, '.') - 1));
    4646  }
    47  
     47
    4848  function Delete()
    4949  {
    5050    if(file_exists($this->GetFullName())) unlink($this->GetFullName());
    5151  }
    52  
     52
    5353  function GetContent()
    5454  {
     
    6464  var $FileDownloadURL;
    6565  var $DirectoryId;
    66  
     66
    6767  function __construct($FormManager)
    6868  {
     
    7171    $this->DirectoryId = null;
    7272  }
    73  
     73
    7474  function OnView($Item)
    7575  {
     
    9999      {
    100100        $File->Name = $UploadFile['name'];
    101         $File->Size = $UploadFile['size']; 
     101        $File->Size = $UploadFile['size'];
    102102        $File->TempName = $UploadFile['tmp_name'];
    103103      }
     
    105105    return($File);
    106106  }
    107  
     107
    108108  function OnLoadDb($Item)
    109109  {
     
    120120    return($File);
    121121  }
    122  
     122
    123123  function OnSaveDb($Item)
    124124  {
    125125    if(!is_object($Item['Value'])) $Item['Value'] = new DbFile();
    126126    $File = &$Item['Value'];
    127     $Properties = array('Name' => $File->Name, 
     127    $Properties = array('Name' => $File->Name,
    128128      'Size' => $File->GetSize(), 'Directory' => $File->Directory);
    129129    $DbResult = $this->Database->select('File', '*', 'Id='.$File->Id);
     
    131131    {
    132132      $DbRow = $DbResult->fetch_assoc();
    133       if($File->TempName != '') 
     133      if($File->TempName != '')
    134134      {
    135135        $FileName = $File->GetFullName();
     
    137137      }
    138138      $this->Database->update('File', 'Id='.$File->Id, $Properties);
    139     } else 
     139    } else
    140140    {
    141141      $this->Database->insert('File', $Properties);
     
    145145      SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!');
    146146  }
    147  
     147
    148148}
  • trunk/Common/Form/Types/Time.php

    r616 r659  
    1313    $TimeParts = getdate($Item['Value']);
    1414
    15     $Output = $TimeParts['hours'].':'.$TimeParts['minutes'].':'.$TimeParts['seconds'];
     15    $Output = sprintf('%02d', $TimeParts['hours']).':'.sprintf('%02d', $TimeParts['minutes']).':'.sprintf('%02d', $TimeParts['seconds']);
    1616    return($Output);
    1717  }
     
    2424    $Output = '';
    2525    $Style = '';
    26     if(array_key_exists('Null', $Item) and $Item['Null']) 
     26    if(array_key_exists('Null', $Item) and $Item['Null'])
    2727    {
    28       if($Item['Value'] != null) 
     28      if($Item['Value'] != null)
    2929      {
    3030        $Checked = ' checked="1"';
    3131        $Style = 'style="display:inline;"';
    32       } else 
     32      } else
    3333      {
    3434        $Checked = '';
    35         $Style = 'style="display:none;"';       
     35        $Style = 'style="display:none;"';
    3636      }
    3737      $Output .= '<input type="checkbox" name="'.$Item['Name'].'-null"'.$Checked.' onclick="toggle(\''.
    38         $Item['Name'].'-hour\');toggle(\''.$Item['Name'].'-minute\');toggle(\''.$Item['Name'].'-second\');"/>';     
     38        $Item['Name'].'-hour\');toggle(\''.$Item['Name'].'-minute\');toggle(\''.$Item['Name'].'-second\');"/>';
    3939    }
    40    
     40
    4141    // Hour
    4242    $Output .= '<select name="'.$Item['Name'].'-hour" id="'.$Item['Name'].'-hour" '.$Style.'>';
     
    6868  function OnLoad($Item)
    6969  {
    70     if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null); 
     70    if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null);
    7171      return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second']));
    7272  }
  • trunk/Common/Form/Types/Type.php

    r623 r659  
    2424include(dirname(__FILE__).'/MacAddress.php');
    2525include(dirname(__FILE__).'/Image.php');
     26include(dirname(__FILE__).'/TimeDiff.php');
    2627
    2728class Type
     
    5859      'IPv6Address' => array('Name' => 'IPv6Address', 'Class' => 'IPv6Address', 'ParentType' => '', 'Parameters' => array()),
    5960      'Image' => array('Name' => 'Image', 'Class' => 'Image', 'ParentType' => '', 'Parameters' => array()),
     61      'TimeDiff' => array('Name' => 'TimeDiff', 'Class' => 'TimeDiff', 'ParentType' => 'Integer', 'Parameters' => array()),
    6062    );
    6163  }
     
    7274    } else return($TypeName);
    7375  }
    74  
     76
    7577  function IsHidden($TypeName)
    7678  {
     
    9092      $Type = $this->TypeDefinitionList[$ParentType];
    9193    } else $Type = array();
    92  
     94
    9395    $Type['Name'] = $Name;
    9496    $Type['Class'] = $Name;
     
    104106    // TODO: remove dependent types
    105107  }
    106  
     108
    107109  function GetTypeDefinition($TypeName)
    108110  {
  • trunk/Common/Global.php

    r655 r659  
    346346function GetRemoteAddress()
    347347{
    348   if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'] ;
    349   else if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
     348  if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
    350349  else $IP = '0.0.0.0';
    351350  return($IP);
  • trunk/Modules/NetworkConfigLinux/Generators/DNS.php

    r618 r659  
    99$BaseDomain = 'zdechov.net';
    1010$Now = getdate();
    11 $I = floor(($Now['hours'] * 60 * 60 + $Now['minutes'] * 60 + $Now['seconds']) / (24 * 60 * 60) * 100); 
     11$I = floor(($Now['hours'] * 60 * 60 + $Now['minutes'] * 60 + $Now['seconds']) / (24 * 60 * 60) * 100);
    1212$Serial = date('Ymd', time()).$I;
    1313$MinimumTime = 7200;
     
    192192
    193193// Domain alias
    194 $DbResult = $System->Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`'); 
     194$DbResult = $System->Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
    195195// JOIN `NetworkDevice` ON NetworkDomainAlias.Target LIKE NetworkDevice.Name AND NetworkInterface.ExternalIP != ""');
    196196while($Alias = $DbResult->fetch_assoc())
  • trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php

    r658 r659  
    3434        'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),
    3535        'State' => array('Type' => 'Boolean', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
    36         'Duration' => array('Type' => 'Time', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true,
    37           'SQL' => 'TIMEDIFF(`Time`,'.
     36        'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true,
     37          'SQL' => 'TIMESTAMPDIFF(SECOND, `Time`, '.
    3838            '(SELECT `Time` FROM `NetworkInterfaceUpDown` AS `TA` WHERE (`TA`.`Time` > `TX`.`Time`) '.
    3939                        'AND (`TA`.`Interface`=`TX`.`Interface`) ORDER BY `TA`.`Time` LIMIT 1))'),
  • trunk/Modules/News/NewsPage.php

    r614 r659  
    1414    $this->UploadedFilesFolder = $this->System->ModuleManager->Modules['News']->UploadedFilesFolder;
    1515    if(count($this->System->PathItems) > 1)
    16     { 
     16    {
    1717      if($this->System->PathItems[1] == 'subscription') return($this->ShowSubscription());
    1818        else if($this->System->PathItems[1] == 'rss') return($this->ShowRSS());
     
    2020    } else return($this->ShowMain());
    2121  }
    22  
     22
    2323  function ShowView()
    2424  {
     
    5252          foreach($Enclosures as $Enclosure)
    5353          {
    54             if(file_exists($this->UploadedFilesFolder.$Enclosure)) 
     54            if(file_exists($this->UploadedFilesFolder.$Enclosure))
    5555              $Output .= ' <a href="'.$this->System->Link('/'.$this->UploadedFilesFolder.$Enclosure).'">'.$Enclosure.'</a>';
    5656          }
     
    6161    return($Output);
    6262  }
    63  
     63
    6464  function ShowAdd()
    6565  {
     
    7878        if($this->System->User->CheckPermission('News', 'Insert', 'Group', $DbRow['Id']))
    7979        {
    80           if($DbRow['Id'] == $Category['Id']) $Selected = ' selected="1"'; 
     80          if($DbRow['Id'] == $Category['Id']) $Selected = ' selected="1"';
    8181            else $Selected = '';
    8282          $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Caption'].'</option>';
     
    9696    return($Output);
    9797  }
    98  
     98
    9999  function ShowAdd2()
    100100  {
     
    122122        }
    123123        $Enclosures = substr($Enclosures, 1);
    124    
     124
    125125        $_POST['content'] = str_replace("\n",'<br />',$_POST['content']);
    126126        $this->Database->insert('News', array('Category' => $Category['Id'], 'Title' => $_POST['title'],
    127127          'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr,
    128           'Enclosure' => $Enclosures, 'Author' => $this->System->User->User['Name'], 
     128          'Enclosure' => $Enclosures, 'Author' => $this->System->User->User['Name'],
    129129          'User' => $this->System->User->User['Id'], 'Link' => $_POST['link']));
    130130        $Output .= 'Aktualita přidána!<br />Pokud budete chtít vaši aktualitu smazat, klikněte na odkaz Smazat v seznamu všech aktualit v kategorii.<br /><br />';
     
    134134    return($Output);
    135135  }
    136  
     136
    137137  function ShowEdit()
    138138  {
     
    159159    return($Output);
    160160  }
    161  
     161
    162162  function ShowUpdate()
    163163  {
    164164    $Output = '';
    165     $RemoteAddr = GetRemoteAddress(); 
     165    $RemoteAddr = GetRemoteAddress();
    166166    $Category = $this->GetCategory();
    167167    if($this->System->User->CheckPermission('News', 'Insert', 'Group', $Category['Id']))
     
    175175        {
    176176          $_POST['content'] = str_replace("\n", '<br />', $_POST['content']);
    177           $this->Database->update('News', 'Id='.$_POST['id'], array('Title' => $_POST['title'], 
     177          $this->Database->update('News', 'Id='.$_POST['id'], array('Title' => $_POST['title'],
    178178            'Content' => $_POST['content'], 'Link' => $_POST['link']));
    179179          $Output .= 'Aktualita uložena!<br />';
     
    184184    return($Output);
    185185  }
    186  
     186
    187187  function ShowDelete()
    188188  {
     
    197197        // TODO: Make upload using general File class
    198198        if($Row['Enclosure'] != '')
    199         { 
     199        {
    200200          $Output .= '<br />Přílohy: ';
    201201          $Enclosures = explode(';', $Row['Enclosure']);
     
    211211    return($Output);
    212212  }
    213  
     213
    214214  function ShowList()
    215215  {
     
    226226      $Output .= '<strong>Seznam aktualit kategorie '.$Category['Caption'].':</strong><div style="font-size: small;">';
    227227      $Output .= PagesList('?category='.$Category['Id'].'&amp;page=', $Page, $PageMax, $PerPage);
    228    
     228
    229229      $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '.
    230230        'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `Category`='.$Category['Id'].' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage);
     
    249249          foreach($Enclosures as $Enclosure)
    250250          {
    251             if(file_exists($this->UploadedFilesFolder.$Enclosure)) 
     251            if(file_exists($this->UploadedFilesFolder.$Enclosure))
    252252              $Output .= ' <a href="'.$this->System->Link('/'.$this->UploadedFilesFolder.$Enclosure).'">'.$Enclosure.'</a>';
    253253          }
     
    260260    return($Output);
    261261  }
    262  
     262
    263263  function GetCategory()
    264264  {
     
    267267    if(array_key_exists('category', $_POST)) $Category['Id'] = $_POST['category'] * 1;
    268268    //if(is_null($Category)) throw new Exception('Kategorie neurčena');
    269     else 
     269    else
    270270    {
    271271      $DbResult = $this->Database->select('NewsCategory', '*', '`Id`='.$Category['Id'].' ORDER BY `Sequence`');
     
    275275    return($Category);
    276276  }
    277  
     277
    278278  function ShowMain()
    279279  {
    280     $Output = '';   
     280    $Output = '';
    281281    if(array_key_exists('action',$_GET)) $Action = $_GET['action'];
    282282      else $Action = '';
     
    290290    return($Output);
    291291  }
    292  
     292
    293293  function ShowSubscription()
    294   {     
     294  {
    295295    if(array_key_exists('build', $_GET))
    296296    {
     
    302302      $Select = $this->System->Config['Web']['RootFolder'].'/aktuality/rss/?select='.substr($Select, 1);
    303303      $Output = 'Výsledný RSS kanál: <a href="'.$Select.'">'.$Select.'</a>';
    304     } else 
     304    } else
    305305    {
    306306      $Output = 'Vytvořte si vlastní RSS kanál, díky kterému budete moci automaticky sledovat novinky pomocí vaší RSS čtečky. Informace o technologii RSS a programech pro čtení kanálů najdete např. <a href="http://www.lupa.cz/clanky/prehled-rss-ctecek/">zde</a><br />'.
     
    314314      $Output.= '<input type="submit" value="Sestavit"/>'.
    315315        '</form>';
    316     } 
    317     return($Output);
    318   }
    319  
     316    }
     317    return($Output);
     318  }
     319
    320320  function ShowRSS()
    321321  {
     
    332332    $CategoryName = '';
    333333
    334     // Prepare WHERE condition 
    335     if(array_key_exists('select', $_GET)) 
     334    // Prepare WHERE condition
     335    if(array_key_exists('select', $_GET))
    336336    {
    337337      $Where = '';
     
    339339      foreach($Parts as $Part)
    340340      {
    341         $Where .= 'OR (`Category`='.($Part * 1).')'; 
     341        $Where .= 'OR (`Category`='.($Part * 1).')';
    342342      }
    343343      $Where = substr($Where, 2);
     
    354354    // Update news from discussion forum
    355355    /*
    356     $ForumCategory = 4;   
     356    $ForumCategory = 4;
    357357    $Database->select_db('forum');
    358358    $DbResult = $Database->query('SELECT posts.post_time, posts_text.post_subject, posts_text.post_text, users.username, topics.topic_title FROM posts JOIN posts_text ON posts.post_id = posts_text.post_id JOIN users ON users.user_id = posts.poster_id JOIN topics ON topics.topic_id= posts.topic_id ORDER BY post_time DESC LIMIT '.$NewsCount);
     
    361361    while($Row = $DbResult->fetch_array())
    362362    {
    363       $Row['post_text'] = StrTr($Row['post_text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    364       $Row['post_text'] = str_replace("\n","<br>", $Row['post_text']); 
    365       $Row['post_subject'] = StrTr($Row['post_subject'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    366       $Row['topic_title'] = StrTr($Row['topic_title'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    367       $Index = $Index + 1;   
    368      
     363      $Row['post_text'] = StrTr($Row['post_text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     364      $Row['post_text'] = str_replace("\n","<br>", $Row['post_text']);
     365      $Row['post_subject'] = StrTr($Row['post_subject'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     366      $Row['topic_title'] = StrTr($Row['topic_title'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     367      $Index = $Index + 1;
     368
    369369      $Title = $Row['topic_title'].'-'.$Row['post_subject'];
    370370      $Content = $Row['post_text'];
     
    374374      //echo('category='.$ForumCategory.' AND title="'.addslashes($Title).'" AND content="'.addslashes($Content).'" AND author="'.addslashes($Author).'" AND date="'.$Date.'"');
    375375      $DbResult2 = $Database->select('news', '*', 'category='.$ForumCategory.' AND title="'.addslashes($Title).'" AND content="'.addslashes($Content).'" AND author="'.addslashes($Author).'" AND date="'.$Date.'"');
    376       if($DbResult2->num_rows == 0) //echo('.'); else echo('x'); 
     376      if($DbResult2->num_rows == 0) //echo('.'); else echo('x');
    377377        $Database->insert('news', array('category' => $ForumCategory, 'title' => $Title, 'content' => $Content, 'author' => $Author, 'date' => $Date));
    378         //echo($Date); 
     378        //echo($Date);
    379379      $Database->select_db('forum');
    380380    }
     
    388388      $EnclosuresText = '';
    389389      if($Row['Enclosure'] != '')
    390       { 
     390      {
    391391        $EnclosuresText .= '<br />Přílohy: ';
    392392        $Enclosures = explode(';', $Row['Enclosure']);
    393393        foreach($Enclosures as $Enclosure)
    394394        {
    395           if(file_exists($this->UploadedFilesFolder.$Enclosure)) 
    396             $EnclosuresText .= ' <a href="'.$this->System->Link('/aktuality/'.$UploadedFilesFolder.$Enclosure).'">'.$Enclosure.'</a>';
     395          if(file_exists($this->UploadedFilesFolder.$Enclosure))
     396            $EnclosuresText .= ' <a href="'.$this->System->Link('/aktuality/'.$this->UploadedFilesFolder.$Enclosure).'">'.$Enclosure.'</a>';
    397397        }
    398398      }
     
    409409    $RSS = new RSS();
    410410    $RSS->Title = $this->System->Config['Web']['Title'].' - Aktuality';
    411     $RSS->Link = 'http://'.$this->System->Config['Web']['Host'].'/'; 
    412     $RSS->Description = 'Aktuality '.$this->System->Config['Web']['Description']; 
    413     $RSS->WebmasterEmail = $this->System->Config['Web']['AdminEmail']; 
     411    $RSS->Link = 'http://'.$this->System->Config['Web']['Host'].'/';
     412    $RSS->Description = 'Aktuality '.$this->System->Config['Web']['Description'];
     413    $RSS->WebmasterEmail = $this->System->Config['Web']['AdminEmail'];
    414414    $RSS->Items = $Items;
    415     return($RSS->Generate());     
    416   } 
     415    return($RSS->Generate());
     416  }
    417417}
  • trunk/block/index.php

    r578 r659  
    11<?php
    22
    3 include_once('../Common/System.php');
     3include_once('../Application/System.php');
    44
    55class BlockPage extends Page
     
    2929      $DbResult = $this->Database->select('Member', '*', 'Id='.$Device['Member']);
    3030      $Member = $DbResult->fetch_array();
    31      
     31
    3232      if($Member['Blocked'] == 1)
    3333      {
     
    3535      } else $Output .= $this->Reasons[0];
    3636    } else $Output .= $this->Reasons[4];
    37  
     37
    3838    $Output .= '<br/><br/>V případě problémů kontaktujte technickou podporu na telefonu 737785792<br/><br/>';
    3939    $Output .= '</body></html>';
Note: See TracChangeset for help on using the changeset viewer.