- Timestamp:
- Aug 11, 2023, 11:17:28 AM (17 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r948 r953 2232 2232 { 2233 2233 $Manager->Execute('ALTER TABLE `News` CHANGE `IP` `IP` VARCHAR(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;'); 2234 } 2235 2236 function UpdateTo953(UpdateManager $Manager): void 2237 { 2238 $Manager->Execute('ALTER TABLE `News` ADD `Intranet` INT NOT NULL DEFAULT "0" AFTER `Link`;'); 2234 2239 } 2235 2240 … … 2343 2348 911 => array('Revision' => 921, 'Function' => 'UpdateTo921'), 2344 2349 921 => array('Revision' => 933, 'Function' => 'UpdateTo933'), 2345 933 => array('Revision' => 939, 'Function' => 'UpdateTo939'), 2350 933 => array('Revision' => 939, 'Function' => 'UpdateTo939'), 2346 2351 939 => array('Revision' => 948, 'Function' => 'UpdateTo948'), 2352 948 => array('Revision' => 953, 'Function' => 'UpdateTo953'), 2347 2353 ); 2348 2354 } -
trunk/Application/Version.php
r948 r953 1 1 <?php 2 2 3 $Revision = 9 48; // Subversion revision4 $DatabaseRevision = 9 48; // SQL structure revision5 $ReleaseTime = strtotime('202 2-12-06');3 $Revision = 953; // Subversion revision 4 $DatabaseRevision = 953; // SQL structure revision 5 $ReleaseTime = strtotime('2023-08-11'); -
trunk/Common/Global.php
r942 r953 275 275 $Result = true; 276 276 $RemoteAddr = GetRemoteAddress(); 277 foreach ( array_merge($Config['Web']['IntranetSubnets'])as $Subnet)277 foreach ($Config['Web']['IntranetSubnets'] as $Subnet) 278 278 { 279 279 if (substr($RemoteAddr, 0, strlen($Subnet)) == $Subnet) -
trunk/Modules/News/News.php
r938 r953 16 16 public int $NewsCountPerCategory = 3; 17 17 public string $UploadedFilesFolder = 'files/news/'; 18 public array $NewsSetting; 18 19 19 20 function __construct(System $System) … … 86 87 } 87 88 89 function GetIntranetCondition(): string 90 { 91 if (IsInternetAddr()) return ' AND (`Intranet`=0)'; 92 else return ''; 93 } 94 88 95 function ShowNews(string $Category, int $ItemCount, int $DaysAgo): string 89 96 { … … 97 104 $Output .= ' <a href="aktuality/?action=add&category='.$Category.'">Přidat</a>'; 98 105 $Output .= '</div></div><div class="Content">'; 99 $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); 106 $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User`'. 107 ' WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`)'.$this->GetIntranetCondition(). 108 ' ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); 100 109 101 110 $Index = 0; … … 162 171 { 163 172 $Output = ''; 164 173 165 174 $this->LoadSettingsFromCookies(); 166 175 -
trunk/Modules/News/NewsPage.php
r929 r953 11 11 } 12 12 13 function GetIntranetCondition(): string 14 { 15 if (IsInternetAddr()) return ' AND (`Intranet`=0)'; 16 else return ''; 17 } 18 13 19 function ShowView(): string 14 20 { … … 20 26 if (array_key_exists('id', $_GET)) $Id = $_GET['id'] * 1; 21 27 $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '. 22 'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `News`.`Id`='.$Id);28 'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Id`='.$Id.')'.$this->GetIntranetCondition()); 23 29 if ($DbResult->num_rows > 0) 24 30 { … … 80 86 'Obsah:<br /><textarea name="content" rows="20" cols="40"></textarea><br />'. 81 87 'Odkaz:<br /><input type="text" size="54" name="link"><br />'. 88 'Viditelné jen z vnitřní sítě: <input type="checkbox" name="intranet"/><br />'. 82 89 'Přílohy (Max. velikost souboru 1 MB):<br /><input type="hidden" name="MAX_FILE_SIZE" value="1000000">'. 83 90 '<input name="enclosure1" size="38" type="file"><br />'. … … 116 123 } 117 124 $Enclosures = substr($Enclosures, 1); 125 if (array_key_exists('intranet', $_POST)) $Intranet = 1; 126 else $Intranet = 0; 118 127 119 128 $this->Database->insert('News', array('Category' => $Category['Id'], 'Title' => $_POST['title'], 120 129 'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr, 121 130 'Enclosure' => $Enclosures, 'Author' => $User->User['Name'], 122 'User' => $User->User['Id'], 'Link' => $_POST['link'] ));131 'User' => $User->User['Id'], 'Link' => $_POST['link'], 'Intranet' => $Intranet)); 123 132 $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 />'; 124 133 $Output .= '<a href="?category='.$_POST['category'].'">Zpět na seznam aktualit</a>'; … … 154 163 if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id'])) 155 164 { 156 $DbResult = $this->Database->query('SELECT * FROM `News` WHERE `Id`='.$_GET['id']);165 $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.$this->GetIntranetCondition()); 157 166 $Row = $DbResult->fetch_assoc(); 158 167 if (($User->User['Id'] == $Row['User'])) 159 168 { 169 if ($Row['Intranet'] == 1) $IntranetChecked = ' checked="1"'; 170 else $IntranetChecked = 0; 160 171 $this->System->PageHeaders[] = array($this, 'GetPageHeader'); 161 172 $Output .= '<strong>Editace aktuality v kategorii '.$Category['Caption'].':</strong><br />'; … … 165 176 'Obsah:<br /><textarea name="content" rows="20" cols="40" style="width: 50%">'.$Row['Content'].'</textarea><br />'. 166 177 'Odkaz:<br /><input type="text" size="54" name="link" value="'.$Row['Link'].'"><br />'. 178 'Viditelné jen z vnitřní sítě: <input type="checkbox" name="intranet" '.$IntranetChecked.'/><br />'. 167 179 '<input type="hidden" name="category" value="'.$Category['Id'].'"><br />'. 168 180 '<input type="submit" value="Uložit">'. … … 182 194 { 183 195 $_POST['id'] = $_POST['id'] * 1; 184 $DbResult = $this->Database->select('News', '*', ' `Id`='.$_POST['id']);196 $DbResult = $this->Database->select('News', '*', '(`Id`='.$_POST['id'].')'.$this->GetIntranetCondition()); 185 197 if ($DbResult->num_rows > 0) 186 198 { … … 188 200 if ($User->User['Id'] == $Row['User']) 189 201 { 202 if (array_key_exists('intranet', $_POST)) $Intranet = 1; 203 else $Intranet = 0; 204 190 205 $this->Database->update('News', 'Id='.$_POST['id'], array('Title' => $_POST['title'], 191 'Content' => $_POST['content'], 'Link' => $_POST['link'] ));206 'Content' => $_POST['content'], 'Link' => $_POST['link'], 'Intranet' => $Intranet)); 192 207 $Output .= 'Aktualita uložena!<br />'; 193 208 $Output .= '<a href="?category='.$Category['Id'].'">Zpět na seznam aktualit</a>'; … … 205 220 if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id'])) 206 221 { 207 $DbResult = $this->Database->query('SELECT * FROM `News` WHERE `Id`='.$_GET['id']);222 $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.$this->GetIntranetCondition()); 208 223 $Row = $DbResult->fetch_assoc(); 209 224 if ($User->User['Id'] == $Row['User']) … … 234 249 { 235 250 $PerPage = 20; 236 $DbResult = $this->Database->select('News', 'COUNT(*)', ' `Category`='.$Category['Id']);251 $DbResult = $this->Database->select('News', 'COUNT(*)', '(`Category`='.$Category['Id'].')'.$this->GetIntranetCondition()); 237 252 $RowTotal = $DbResult->fetch_array(); 238 253 $PageMax = $RowTotal[0]; … … 243 258 244 259 $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '. 245 'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `Category`='.$Category['Id'].' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage); 260 'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`Category`='.$Category['Id'].')'.$this->GetIntranetCondition(). 261 ' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage); 246 262 while ($Row = $DbResult->fetch_assoc()) 247 263 { -
trunk/Modules/News/NewsSource.php
r938 r953 64 64 { 65 65 public Database $Database; 66 public array $Items; 66 67 67 68 function Parse($Id = null)
Note:
See TracChangeset
for help on using the changeset viewer.