Changeset 183 for trunk/aktuality/index.php
- Timestamp:
- Mar 26, 2009, 8:51:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/aktuality/index.php
r151 r183 31 31 { 32 32 if(array_key_exists('id', $_GET)) $Id = $_GET['id'] * 1; 33 $DbResult = $this->Database->query('SELECT `news`.*, `User`.`N ame` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `news`.`id`='.$Id);33 $DbResult = $this->Database->query('SELECT `news`.*, `User`.`Nick` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `news`.`id`='.$Id); 34 34 if($DbResult->num_rows > 0) 35 35 { 36 36 $Row = $DbResult->fetch_array(); 37 $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']).', '.$Row['Name'].$Row['author'].')</strong>'; 37 if($Row['Nick'] == '') $Author = $Row['author']; 38 else $Author = $Row['Nick']; 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>'; 38 40 if($this->System->Modules['User']->User['Id'] == $Row['User']) 39 41 { … … 56 58 break; 57 59 case 'add': 58 59 60 60 $Output .= '<strong>Vložení nové aktuality:</strong><br />'; 61 if($Category == 2) $Output .= 'U inzerátů uvádějte co nejvíce informací ať případný zájemce ví co kupuje. Uvádějte kontaktní údaje jako Jméno, email, tel. číslo, ICQ. Dále navrženou cenu, detajlní popis předmětu nejlépe s odkazem na stránky výrobce. Pokud váš inzerát již není platný, připište do něj např. "Prodáno" pomocí editace.'; 62 $Output .= '<form enctype="multipart/form-data" action="?action=add2" method="post">'. 61 63 'Kategorie: <select name="category">'; 62 $DbResult = $this->Database->select('news_category', '*');63 while($DbRow = $DbResult->fetch_array())64 {65 if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['id']))66 {67 if($DbRow['id'] == $Category) $Selected = ' selected="1"'; else $Selected = '';68 $Output .= '<option value="'.$DbRow['id'].'"'.$Selected.'>'.$DbRow['caption'].'</option>';69 }70 }71 $Output .= '</select><br />'.64 $DbResult = $this->Database->select('news_category', '*'); 65 while($DbRow = $DbResult->fetch_array()) 66 { 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>'; 71 } 72 } 73 $Output .= '</select><br />'. 72 74 'Nadpis:<br /><input type="text" size="54" name="title"><br /> 73 75 Obsah:<br /><textarea name="content" rows="20" cols="40"></textarea><br /> … … 103 105 104 106 $_POST['content'] = str_replace("\n",'<br />',$_POST['content']); 105 $this->Database->insert('news',array('category' => $Category, 'title' => $_POST['title'], 'content' => $_POST['content'], 'date' => 'NOW()', 'ip' => $RemoteAddr, 'enclosure' => $Enclosures, ' 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['Nick'], 'User' => $this->System->Modules['User']->User['Id'])); 106 108 $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 />'; 107 109 $Output .= '<a href="index.php?category='.$_POST['category'].'">Zpět na seznam aktualit</a>'; … … 150 152 $Output .= '<br />Přílohy: '; 151 153 $Enclosures = explode(';', $Row['enclosure']); 152 foreach($Enclosures as $Enclosure)153 {154 if(file_exists($this->UploadedFilesFolder.$Enclosure)) unlink($this->UploadedFilesFolder.$Enclosure);155 }154 foreach($Enclosures as $Enclosure) 155 { 156 if(file_exists($this->UploadedFilesFolder.$Enclosure)) unlink($this->UploadedFilesFolder.$Enclosure); 157 } 156 158 } 157 159 $this->Database->query('DELETE FROM news WHERE id='.$_GET['id']); … … 171 173 172 174 //echo(GetRemoteAddress().','.$_SERVER['HTTP_X_FORWARDED_FOR'].'<br />'); 173 $DbResult = $this->Database->query('SELECT `news`.*, `User`.`N ame` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `category`='.$Category.' ORDER BY `news`.`id` DESC LIMIT '.($Page * $PerPage).','.$PerPage);175 $DbResult = $this->Database->query('SELECT `news`.*, `User`.`Nick` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `category`='.$Category.' ORDER BY `news`.`id` DESC LIMIT '.($Page * $PerPage).','.$PerPage); 174 176 while($Row = $DbResult->fetch_array()) 175 177 { 176 $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']).', '.$Row['Name'].$Row['author'].')</strong>'; 178 if($Row['Nick'] == '') $Author = $Row['author']; 179 else $Author = $Row['Nick']; 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>'; 177 181 if($this->System->Modules['User']->User['Id'] == $Row['User']) 178 182 { … … 185 189 $Output .= '<br />Přílohy: '; 186 190 $Enclosures = explode(';', $Row['enclosure']); 187 foreach($Enclosures as $Enclosure)191 foreach($Enclosures as $Enclosure) 188 192 { 189 190 }193 if(file_exists($this->UploadedFilesFolder.$Enclosure)) $Output .= ' <a href="'.$this->UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>'; 194 } 191 195 } 192 196 $Output .= '</div>';
Note:
See TracChangeset
for help on using the changeset viewer.