index.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * Copyright (C) 2022 Echedey López Romero <elr@disroot.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // Show errors in screen
  19. ini_set('display_errors', '1');
  20. ini_set('display_startup_errors', '1');
  21. error_reporting(E_ALL);
  22. // Repair output with Tidy
  23. ini_set('tidy.clean_output', '1');
  24. // Empty web browser cache
  25. header('Cache-Control: no-cache');
  26. header('Pragma: no-cache');
  27. // Load dependencies paths
  28. require './vendor/autoload.php';
  29. // Load classes
  30. require './connections/FirebaseCon.php';
  31. require './models/User.php';
  32. require './models/Comment.php';
  33. require './models/Post.php';
  34. require './controllers/ManageUsers.php';
  35. require './controllers/ManageComments.php';
  36. require './controllers/ManagePosts.php';
  37. require './controllers/ManageBlog.php';
  38. // Load variables
  39. require './variables.php';
  40. // Main functionality
  41. if ((isset($_GET) && count($_GET) === 0) || !isset($_GET) || isset($_GET['XDEBUG_SESSION_START'])) {
  42. $Page = $ManageBlog->ShowPosts();
  43. } else if (isset($_GET) && count($_GET) > 1) {
  44. header('Location:.');
  45. } else {
  46. if (isset($_GET['post'])) {
  47. $PostId = $_GET['post'];
  48. $Page = $ManageBlog->ShowPost($PostId);
  49. } else if (isset($_GET['user'])) {
  50. $UserId = $_GET['user'];
  51. $Page = $ManageBlog->ShowUser($UserId);
  52. } else {
  53. header('Location:.');
  54. }
  55. }
  56. // Load view
  57. require './view.php';