Ignore:
Timestamp:
Apr 27, 2009, 8:00:50 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Názvy tabulek a sloupců aktualit pozměněny na názvy se slovy začínající velkými písmeny.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/aktuality/index.php

    r189 r196  
    1616    if(array_key_exists('category', $_GET)) $Category = $_GET['category'] * 1;
    1717    if(array_key_exists('category', $_POST)) $Category = $_POST['category'] * 1;
    18     $DbResult = $this->Database->select('news_category', '*', 'id='.$Category);
     18    $DbResult = $this->Database->select('NewsCategory', '*', 'Id='.$Category);
    1919    if($DbResult->num_rows > 0)
    2020    {
    2121      $Row = $DbResult->fetch_array();
    22       $CategoryName = $Row['caption'];
     22      $CategoryName = $Row['Caption'];
    2323    }
    2424
     
    3131        {
    3232          if(array_key_exists('id', $_GET)) $Id = $_GET['id'] * 1;
    33           $DbResult = $this->Database->query('SELECT `news`.*, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE  `news`.`id`='.$Id);
     33          $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE  `News`.`Id`='.$Id);
    3434          if($DbResult->num_rows > 0)
    3535          {
    3636            $Row = $DbResult->fetch_array();
    37             if($Row['Name'] == '') $Author = $Row['author'];
     37            if($Row['Name'] == '') $Author = $Row['Author'];
    3838              else $Author = $Row['Name'];
    39             $Output .= '<div style="border: thin dotted #97ADFF;        background: #F6F7FF; margin-top: 5px; padding: 0px 5px 5px 5px;"><div style="padding-bottom: 1px; border-bottom-width: 1; border-bottom-style: solid; border-bottom-color: silver;"><strong>'.$Row['title'].' ('.HumanDate($Row['date']).', '.$Author.')</strong>';
     39            $Output .= '<div style="border: thin dotted #97ADFF;        background: #F6F7FF; margin-top: 5px; padding: 0px 5px 5px 5px;"><div style="padding-bottom: 1px; border-bottom-width: 1; border-bottom-style: solid; border-bottom-color: silver;"><strong>'.$Row['Title'].' ('.HumanDate($Row['Date']).', '.$Author.')</strong>';
    4040            if($this->System->Modules['User']->User['Id'] == $Row['User'])
    4141            {
    42               $Output .= '&nbsp;<a href="index.php?action=del&amp;category='.$Category.'&amp;id='.$Row['id'].'">Smazat</a>';
    43               $Output .= '&nbsp;<a href="index.php?action=edit&amp;category='.$Category.'&amp;id='.$Row['id'].'">Editovat</a>';
    44             }
    45             $Output .= '</div>'.$Row['content'].'<br />';
    46             if($Row['enclosure'] != '')
     42              $Output .= '&nbsp;<a href="index.php?action=del&amp;category='.$Category.'&amp;id='.$Row['Id'].'">Smazat</a>';
     43              $Output .= '&nbsp;<a href="index.php?action=edit&amp;category='.$Category.'&amp;id='.$Row['Id'].'">Editovat</a>';
     44            }
     45            $Output .= '</div>'.$Row['Content'].'<br />';
     46            if($Row['Enclosure'] != '')
    4747            {
    4848              $Output .= '<br />Přílohy: ';
    49               $Enclosures = explode(';', $Row['enclosure']);
     49              $Enclosures = explode(';', $Row['Enclosure']);
    5050              foreach($Enclosures as $Enclosure)
    5151              {
     
    6262        $Output .= '<form enctype="multipart/form-data" action="?action=add2" method="post">'.
    6363    'Kategorie: <select name="category">';
    64         $DbResult = $this->Database->select('news_category', '*');
     64        $DbResult = $this->Database->select('NewsCategory', '*');
    6565        while($DbRow = $DbResult->fetch_array())
    6666        {
    67           if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['id']))
    68           {
    69             if($DbRow['id'] == $Category) $Selected = ' selected="1"'; else $Selected = '';
    70             $Output .= '<option value="'.$DbRow['id'].'"'.$Selected.'>'.$DbRow['caption'].'</option>';
     67          if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['Id']))
     68          {
     69            if($DbRow['Id'] == $Category) $Selected = ' selected="1"'; else $Selected = '';
     70            $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Caption'].'</option>';
    7171          }
    7272        }
     
    105105
    106106          $_POST['content'] = str_replace("\n",'<br />',$_POST['content']);
    107           $this->Database->insert('news',array('category' => $Category, 'title' => $_POST['title'], 'content' => $_POST['content'], 'date' => 'NOW()', 'ip' => $RemoteAddr, 'enclosure' => $Enclosures, 'author' => $this->System->Modules['User']->User['Name'], 'User' => $this->System->Modules['User']->User['Id']));
     107          $this->Database->insert('News',array('Category' => $Category, 'Title' => $_POST['title'], 'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr, 'Enclosure' => $Enclosures, 'Author' => $this->System->Modules['User']->User['Name'], 'User' => $this->System->Modules['User']->User['Id']));
    108108          $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 />';
    109109          $Output .= '<a href="index.php?category='.$_POST['category'].'">Zpět na seznam aktualit</a>';
     
    112112        break;
    113113      case 'edit':
    114         $DbResult = $this->Database->query('SELECT * FROM news WHERE id='.$_GET['id']);
     114        $DbResult = $this->Database->query('SELECT * FROM News WHERE Id='.$_GET['id']);
    115115        $Row = $DbResult->fetch_array();
    116116        if($this->System->Modules['User']->User['Id'] == $Row['User'])
    117117        {
    118           $Row['content'] = str_replace('<br />', "", $Row['content']);
     118          $Row['Content'] = str_replace('<br />', '', $Row['Content']);
    119119          $Output .= '<strong>Editace aktuality v kategorii '.$CategoryName.':</strong><br />';
    120120          $Output .= '<form action="index.php?action=update" method="post">'.
    121121          '<input type="hidden" value="'.$_GET['id'].'" name="id">'.
    122           'Nadpis:<br /><input type="text" size="54" name="title" value="'.$Row['title'].'"><br />'.
    123           'Obsah:<br /><textarea name="content" rows="20" cols="40">'.$Row['content'].'</textarea><br />'.
     122          'Nadpis:<br /><input type="text" size="54" name="title" value="'.$Row['Title'].'"><br />'.
     123          'Obsah:<br /><textarea name="content" rows="20" cols="40">'.$Row['Content'].'</textarea><br />'.
    124124          '<input type="hidden" name="category" value="'.$Category.'"><br />'.
    125125          '<input type="submit" value="Uložit">'.
     
    130130        $RemoteAddr = GetRemoteAddress(); 
    131131        $_POST['id'] = $_POST['id'] * 1;
    132         $DbResult = $this->Database->select('news', '*', 'id='.$_POST['id']);
     132        $DbResult = $this->Database->select('News', '*', 'Id='.$_POST['id']);
    133133        if($DbResult->num_rows > 0)
    134134        {
     
    136136          if($this->System->Modules['User']->User['Id'] == $Row['User'])
    137137          {
    138             $_POST['content'] = str_replace("\n",'<br />',$_POST['content']);
    139             $this->Database->update('news', 'id='.$_POST['id'], array('title' => $_POST['title'], 'content' => $_POST['content']));
     138            $_POST['content'] = str_replace("\n", '<br />', $_POST['content']);
     139            $this->Database->update('News', 'Id='.$_POST['id'], array('Title' => $_POST['title'], 'Content' => $_POST['content']));
    140140            $Output .= 'Aktualita uložena!<br />';
    141141            $Output .= '<a href="index.php?category='.$Category.'">Zpět na seznam aktualit</a>';
     
    144144        break;
    145145      case 'del':
    146         $DbResult = $this->Database->query('SELECT * FROM news WHERE id='.$_GET['id']);
     146        $DbResult = $this->Database->query('SELECT * FROM News WHERE Id='.$_GET['id']);
    147147        $Row = $DbResult->fetch_array();
    148148        if($this->System->Modules['User']->User['Id'] == $Row['User'])
    149149        {
    150           if($Row['enclosure'] != '')
     150          if($Row['Enclosure'] != '')
    151151          {
    152152            $Output .= '<br />Přílohy: ';
    153             $Enclosures = explode(';', $Row['enclosure']);
     153            $Enclosures = explode(';', $Row['Enclosure']);
    154154                  foreach($Enclosures as $Enclosure)
    155155                  {
     
    157157                  }
    158158          }
    159           $this->Database->query('DELETE FROM news WHERE id='.$_GET['id']);
     159          $this->Database->query('DELETE FROM News WHERE Id='.$_GET['id']);
    160160          $Output .= 'Aktualita smazána!<br /><a href="index.php?category='.$Category.'">Zpět na seznam aktualit</a>';
    161161        } else $Output .= 'Nemáte oprávnění.';
     
    165165        {
    166166          $PerPage = 20;
    167           $DbResult = $this->Database->select('news', 'COUNT(*)', ' category='.$Category);
     167          $DbResult = $this->Database->select('News', 'COUNT(*)', ' Category='.$Category);
    168168          $RowTotal = $DbResult->fetch_array();
    169169          $PageMax = $RowTotal[0];
    170           if(array_key_exists('page', $_GET)) $Page = $_GET['page']; else $Page = 0; //round($PageMax/$PerPage);
     170          if(array_key_exists('page', $_GET)) $Page = $_GET['page'];
     171            else $Page = 0; //round($PageMax/$PerPage);
    171172          $Output .= '<strong>Seznam aktualit kategorie '.$CategoryName.':</strong><div style="font-size: small;">';
    172           $Output .= PagesList('?category='.$Category.'&amp;page=',$Page,$PageMax,$PerPage);
     173          $Output .= PagesList('?category='.$Category.'&amp;page=', $Page, $PageMax, $PerPage);
    173174
    174175          //echo(GetRemoteAddress().','.$_SERVER['HTTP_X_FORWARDED_FOR'].'<br />');
    175           $DbResult = $this->Database->query('SELECT `news`.*, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `category`='.$Category.' ORDER BY `news`.`id` DESC LIMIT '.($Page * $PerPage).','.$PerPage);
     176          $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `Category`='.$Category.' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage);
    176177          while($Row = $DbResult->fetch_array())
    177178          {
    178             if($Row['Name'] == '') $Author = $Row['author'];
     179            if($Row['Name'] == '') $Author = $Row['Author'];
    179180              else $Author = $Row['Name'];
    180             $Output .= '<div style="border: thin dotted #97ADFF; background: #F6F7FF; margin-top: 5px; padding: 0px 5px 5px 5px;"><div style="padding-bottom: 1px; border-bottom-width: 1; border-bottom-style: solid; border-bottom-color: silver;"><strong><a href="?action=view&id='.$Row['id'].'">'.$Row['title'].'</a> ('.HumanDate($Row['date']).', '.$Author.')</strong>';
     181            $Output .= '<div style="border: thin dotted #97ADFF; background: #F6F7FF; margin-top: 5px; padding: 0px 5px 5px 5px;"><div style="padding-bottom: 1px; border-bottom-width: 1; border-bottom-style: solid; border-bottom-color: silver;"><strong><a href="?action=view&id='.$Row['Id'].'">'.$Row['Title'].'</a> ('.HumanDate($Row['Date']).', '.$Author.')</strong>';
    181182            if($this->System->Modules['User']->User['Id'] == $Row['User'])
    182183            {
    183               $Output .= '&nbsp;<a href="index.php?action=del&amp;category='.$Category.'&amp;id='.$Row['id'].'">Smazat</a>';
    184               $Output .= '&nbsp;<a href="index.php?action=edit&amp;category='.$Category.'&amp;id='.$Row['id'].'">Editovat</a>';
    185             }
    186             $Output .= '</div>'.$Row['content'].'<br />';
    187             if($Row['enclosure'] != '')
     184              $Output .= '&nbsp;<a href="index.php?action=del&amp;category='.$Category.'&amp;id='.$Row['Id'].'">Smazat</a>';
     185              $Output .= '&nbsp;<a href="index.php?action=edit&amp;category='.$Category.'&amp;id='.$Row['Id'].'">Editovat</a>';
     186            }
     187            $Output .= '</div>'.$Row['Content'].'<br />';
     188            if($Row['Enclosure'] != '')
    188189            {
    189190              $Output .= '<br />Přílohy: ';
    190               $Enclosures = explode(';', $Row['enclosure']);
     191              $Enclosures = explode(';', $Row['Enclosure']);
    191192                    foreach($Enclosures as $Enclosure)
    192193              {
Note: See TracChangeset for help on using the changeset viewer.