variables.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. $DefaultConfig = [
  19. 'url' => '',
  20. 'token' => '',
  21. 'path' => '/Blog',
  22. 'title' => 'My Blog',
  23. 'users_path' => '/users',
  24. 'comments_path' => '/comments',
  25. 'posts_path' => '/posts'
  26. ];
  27. $Config = json_decode(file_get_contents('./data/config.json'), true);
  28. $URL = isset($Config['url']) ? $Config['url'] : $DefaultConfig['url'];
  29. $Token = isset($Config['token']) ? $Config['token'] : $DefaultConfig['token'];
  30. $Path = isset($Config['path']) ? $Config['path'] : $DefaultConfig['path'];
  31. $Title = isset($Config['title']) ? $Config['title'] : $DefaultConfig['title'];
  32. $UsersPath = isset($Config['users_path']) ? $Config['users_path'] : $DefaultConfig['users_path'];
  33. $CommentsPath = isset($Config['comments_path']) ? $Config['comments_path'] : $DefaultConfig['comments_path'];
  34. $PostsPath = isset($Config['posts_path']) ? $Config['posts_path'] : $DefaultConfig['posts_path'];
  35. $Connection = FirebaseCon::GetInstance($URL, $Token, $Path);
  36. $ManageUsers = ManageUsers::GetInstance($Connection, $UsersPath);
  37. $ManageComments = ManageComments::GetInstance($Connection, $CommentsPath);
  38. $ManagePosts = ManagePosts::GetInstance($Connection, $PostsPath);
  39. $ManageBlog = ManageBlog::GetInstance($Title, $ManageUsers, $ManageComments, $ManagePosts);
  40. $Page = 'No content here';