Changeset 828 for trunk/Modules/News/News.php
- Timestamp:
- Mar 20, 2015, 10:22:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/News.php
r816 r828 28 28 function ShowBox() 29 29 { 30 $Output = '<strong> '.T('System changes').':</strong><div class="NewsBox">';31 $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title` '.30 $Output = '<strong><a href="'.$this->System->Link('/news/').'">'.T('News').':</a></strong><div class="NewsBox">'; 31 $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title`, `News`.`Id` '. 32 32 ' FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10'); 33 33 while($DbRow = $DbResult->fetch_assoc()) 34 $Output .= '<div><strong>'.$DbRow['Title'].' ('.HumanDate($DbRow['Time']).')</strong> <br />'.$DbRow['Text'].' ('.$DbRow['Name'].')</div>'; 35 $Output .= '<a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 34 { 35 $Output .= '<h4><a href="'.$this->System->Link('/news/?a=item&i='.$DbRow['Id']).'">'.$DbRow['Title'].'</a> ('.HumanDate($DbRow['Time']).')</h4>'. 36 ' <div>'.$DbRow['Text'].' ('.$DbRow['Name'].')</div>'; 37 } 36 38 $Output .= '</div>'; 37 39 return($Output); … … 70 72 else $Action = ''; 71 73 if($Action == 'add2') $Output = $this->SaveNew(); 72 if($Action == 'add') $Output = $this->ShowAddForm(); 74 else if($Action == 'add') $Output = $this->ShowAddForm(); 75 else if($Action == 'item') $Output = $this->ShowItem(); 73 76 else $Output = $this->ShowList(); 74 77 return($Output); … … 85 88 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 86 89 $Output .= '<div class="shoutbox">'; 87 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '.90 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 88 91 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']); 89 92 while($Line = $DbResult->fetch_assoc()) 90 $Output .= '<div><strong>'.$Line['Title'].' ('.HumanDate($Line['Time']).')</strong><br/> '.$Line['Text'].' ('.$Line['User'].')</div>'; 93 { 94 $Output .= '<h4><a href="?a=item&i='.$Line['Id'].'">'.$Line['Title'].'</a> ('.HumanDate($Line['Time']).')</h4><div>'.$Line['Text'].' ('.$Line['User'].')</div>'; 95 } 91 96 $Output .= '</div>'.$PageList['Output']; 97 return($Output); 98 } 99 100 function ShowItem() 101 { 102 if(array_key_exists('i', $_GET)) 103 { 104 $Output = '<h3>'.T('News').'</h3>'; 105 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 106 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `News`.`Id` = '.($_GET['i'] * 1)); 107 if($DbResult->num_rows == 1) 108 { 109 $Line = $DbResult->fetch_assoc(); 110 $Output .= '<h4>'.$Line['Title'].' ('.HumanDate($Line['Time']).')</h4><div>'.$Line['Text'].' ('.$Line['User'].')</div>'; 111 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 112 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 113 $Output .= '<br/><a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 92 114 return($Output); 93 115 } … … 129 151 $Items = array(); 130 152 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, '. 131 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text` '.153 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text`, `News`.`Id` '. 132 154 'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10'); 133 155 while($DbRow = $DbResult->fetch_assoc()) … … 136 158 ( 137 159 'Title' => $DbRow['Title'], 138 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/ '),160 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/?a=item&i='.$DbRow['Id']), 139 161 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')', 140 162 'Time' => $DbRow['UnixTime'],
Note:
See TracChangeset
for help on using the changeset viewer.