- Timestamp:
- Dec 22, 2019, 11:43:06 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config/Config.sample.php
r39 r48 14 14 $Config['Web']['AdminEmail'] = 'robie@centrum.cz'; 15 15 $Config['Web']['Title'] = 'Tanec'; 16 $Config['Web']['AdminPassword'] = rand(1, 10000000); -
trunk/Modules/Meet/MeetPage.php
r46 r48 59 59 60 60 $DbResult = $this->Database->query('SELECT COUNT(*) FROM (SELECT *, '. 61 '(SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName FROM `MeetItem`) AS T WHERE '.$Where);61 '(SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName FROM `MeetItem`) AS T WHERE (T.Hidden=0) AND '.$Where); 62 62 $DbRow = $DbResult->fetch_row(); 63 63 $PageList = GetPageList($DbRow[0]); … … 82 82 $Output .= $Order['Output']; 83 83 $DbResult = $this->Database->query('SELECT * FROM (SELECT *, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. 84 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE '.84 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE (T.Hidden=0) AND '. 85 85 $Where.$Order['SQL'].$PageList['SQLLimit']); 86 86 while($MeetItem = $DbResult->fetch_assoc()) … … 149 149 $id = $this->System->PathItems[2] * 1; 150 150 } else return 'Položka nenalezena'; 151 if ($this->System->IsAdmin()) 152 { 153 if (array_key_exists('hide', $_GET)) $this->Database->update('MeetItem', 'Id='.$id, array('Hidden' => 1)); 154 if (array_key_exists('unhide', $_GET)) $this->Database->update('MeetItem', 'Id='.$id, array('Hidden' => 0)); 155 } 156 151 157 $Output .= '<div class="title">Inzerát</div>'; 152 158 $Gender = array('', 'Muž', 'Žena'); … … 172 178 '<tr><th>Zdroj importu</th><td><a href="'.$MeetItem['SourceURL'].'">'.$MeetItem['SourceName'].'</a></td></tr>'; 173 179 $Output .= '</table>'; 180 if ($this->System->IsAdmin()) { 181 if ($MeetItem['Hidden'] == '1') 182 $Output .= '<div>Skrytá položka <a href="?unhide">Zviditelnit</a></div>'; 183 else $Output .= '<div>Viditelná položka <a href="?hide">Skrýt</a></div>'; 184 } 174 185 } else $Output .= 'Položka nenalezena'; 175 186 return $Output; … … 197 208 198 209 $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. 199 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', ' 1ORDER BY `Time` DESC LIMIT 30');210 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', '`Hidden`=0 ORDER BY `Time` DESC LIMIT 30'); 200 211 while($MeetItem = $DbResult->fetch_assoc()) 201 212 { -
trunk/SQL/Update.php
r44 r48 52 52 ALTER TABLE `MeetItem` 53 53 ADD COLUMN `RemoteId` VARCHAR(255) NULL DEFAULT NULL AFTER `TimeImport`; 54 55 -- rev 48 56 ALTER TABLE `MeetItem` 57 ADD COLUMN `Hidden` INT NULL DEFAULT '0' AFTER `RemoteId`; -
trunk/index.php
r39 r48 34 34 $this->PageHeaders = array(); 35 35 $this->Bars = array(); 36 } 37 38 function IsAdmin() 39 { 40 return ($_SESSION['IsAdmin'] == 1); 36 41 } 37 42 … … 70 75 return($PathItems); 71 76 } 72 77 73 78 function RegisterPage($Path, $Handler) 74 79 { … … 149 154 } 150 155 } 151 156 152 157 function RunCommon() 153 158 { … … 226 231 } 227 232 // MeetItems 228 $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` ');233 $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` WHERE (`Hidden`=0)'); 229 234 while ($DbRow = $DbResult->fetch_array()) 230 235 { … … 242 247 } 243 248 244 245 $Revision = 36; // Subversion revision 246 $DatabaseRevision = 36; // SQL structure revision 247 $ReleaseTime = strtotime('2019-05-05'); 249 class PageLogin extends Page 250 { 251 function Show() 252 { 253 global $Config; 254 255 $Output = ''; 256 if (array_key_exists('login', $_GET)) 257 { 258 if (array_key_exists('password', $_POST)) 259 { 260 if ($_POST['password'] == $Config['Web']['AdminPassword']) 261 { 262 $_SESSION['IsAdmin'] = 1; 263 $Output .= 'Úspěšně přihlášen jako správce.'; 264 } else { 265 $_SESSION['IsAdmin'] = 0; 266 $Output .= 'Heslo není správné.'; 267 $Output .= $this->ShowLoginForm(); 268 } 269 } else { 270 $Output .= 'Chybí heslo.'; 271 $Output .= $this->ShowLoginForm(); 272 } 273 } else 274 if (array_key_exists('logoff', $_GET)) 275 { 276 $_SESSION['IsAdmin'] = 0; 277 $Output .= 'Odhlášení úspěšné'; 278 $Output .= $this->ShowLoginForm(); 279 } else { 280 $Output .= $this->ShowLoginForm(); 281 } 282 if ($this->System->IsAdmin()) $Output .= '<div>Jsi přihlášen jako správce. <a href="?logoff">Odhlásit</a></div>'; 283 return $Output; 284 } 285 286 function ShowLoginForm() 287 { 288 return '<form method="post" action="?login">'. 289 'Heslo: <input type="password" name="password" value=""/><br/>'. 290 '<input type="submit" value="Přihlásit"/>'. 291 '</form>'; 292 } 293 } 294 295 $Revision = 48; // Subversion revision 296 $DatabaseRevision = 48; // SQL structure revision 297 $ReleaseTime = strtotime('2019-12-22'); 248 298 249 299 $Application = new ApplicationTanec(); … … 255 305 $Application->RegisterPage('robots.txt', 'PageRobots'); 256 306 $Application->RegisterPage('sitemap.xml', 'PageSiteMap'); 307 $Application->RegisterPage('admin', 'PageLogin'); 257 308 $Application->Run();
Note:
See TracChangeset
for help on using the changeset viewer.