Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Wiki/Wiki.php

    r825 r873  
    6060  {
    6161    $DbResult = $this->Database->select('WikiPage', '*', 'VisibleInMenu=1');
    62     while($DbRow = $DbResult->fetch_assoc())
     62    while ($DbRow = $DbResult->fetch_assoc())
    6363    {
    6464      $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki');
     
    8282  function Show()
    8383  {
    84     if(array_key_exists('Action', $_GET))
    85     {
    86       if($_GET['Action'] == 'Edit') $Output = $this->EditContent();
    87       else if($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
    88       else if($_GET['Action'] == 'History') $Output = $this->ShowHistory();
     84    if (array_key_exists('Action', $_GET))
     85    {
     86      if ($_GET['Action'] == 'Edit') $Output = $this->EditContent();
     87      else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
     88      else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory();
    8989      else $Output = $this->ShowContent();
    9090    } else $Output = $this->ShowContent();
    91     return($Output);
     91    return ($Output);
    9292  }
    9393
     
    9696    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    9797    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    98     if($DbResult->num_rows > 0)
     98    if ($DbResult->num_rows > 0)
    9999    {
    100100      $DbRow = $DbResult->fetch_assoc();
    101       if(array_key_exists('ver', $_GET))
     101      if (array_key_exists('ver', $_GET))
    102102      {
    103103        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1);
    104         if($DbResult2->num_rows > 0)
     104        if ($DbResult2->num_rows > 0)
    105105        {
    106106          $DbRow2 = $DbResult2->fetch_assoc();
    107107          $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>';
    108108          $Output .= $DbRow2['Content'];
    109           if($this->System->User->Licence(LICENCE_MODERATOR))
     109          if ($this->System->User->Licence(LICENCE_MODERATOR))
    110110            $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>';
    111111        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     
    113113      {
    114114        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    115         if($DbResult2->num_rows > 0)
     115        if ($DbResult2->num_rows > 0)
    116116        {
    117117          $DbRow2 = $DbResult2->fetch_assoc();
    118118          $Output = '<h3>'.$DbRow['Name'].'</h3>';
    119119          $Output .= $DbRow2['Content'];
    120           if($this->System->User->Licence(LICENCE_MODERATOR))
     120          if ($this->System->User->Licence(LICENCE_MODERATOR))
    121121            $Output .= '<div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>';
    122122        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    123123      }
    124124    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    125     return($Output);
     125    return ($Output);
    126126  }
    127127
    128128  function EditContent()
    129129  {
    130     if($this->System->User->Licence(LICENCE_MODERATOR))
     130    if ($this->System->User->Licence(LICENCE_MODERATOR))
    131131    {
    132132    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    133133    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    134     if($DbResult->num_rows > 0)
     134    if ($DbResult->num_rows > 0)
    135135    {
    136136      $DbRow = $DbResult->fetch_assoc();
    137137      $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>';
    138138      $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    139       if($DbResult2->num_rows > 0)
     139      if ($DbResult2->num_rows > 0)
    140140      {
    141141        $DbRow2 = $DbResult2->fetch_assoc();
     
    148148    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    149149    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    150     return($Output);
     150    return ($Output);
    151151  }
    152152
    153153  function SaveContent()
    154154  {
    155     if($this->System->User->Licence(LICENCE_MODERATOR))
     155    if ($this->System->User->Licence(LICENCE_MODERATOR))
    156156    {
    157157    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    158158    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    159     if($DbResult->num_rows > 0)
     159    if ($DbResult->num_rows > 0)
    160160    {
    161161      $DbRow = $DbResult->fetch_assoc();
    162       if(array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
     162      if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
    163163      {
    164164        $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']),
     
    169169    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    170170    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    171     return($Output);
     171    return ($Output);
    172172  }
    173173
    174174  function ShowHistory()
    175175  {
    176     if($this->System->User->Licence(LICENCE_MODERATOR))
     176    if ($this->System->User->Licence(LICENCE_MODERATOR))
    177177    {
    178178      $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    179179      $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    180       if($DbResult->num_rows > 0)
     180      if ($DbResult->num_rows > 0)
    181181      {
    182182        $DbRow = $DbResult->fetch_assoc();
     
    202202          ' FROM `WikiPageContent` WHERE Page='.
    203203          $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']);
    204         while($PageContent = $DbResult2->fetch_assoc())
     204        while ($PageContent = $DbResult2->fetch_assoc())
    205205        {
    206206          $Output .= '<tr>'.
     
    215215      } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    216216    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    217     return($Output);
     217    return ($Output);
    218218  }
    219219
     
    242242    $text = str_replace("\r\n", '<br/>', $text);
    243243    $text = '<p>'.$text.'</p>';
    244     return($text);
     244    return ($text);
    245245  }
    246246}
Note: See TracChangeset for help on using the changeset viewer.