functions.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. // Set UTC timeone
  3. date_default_timezone_set("UTC");
  4. // Autoload frameworks
  5. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
  6. // Include all function files
  7. foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'functions' . DIRECTORY_SEPARATOR . '*.php') as $filename) {
  8. require_once $filename;
  9. }
  10. // Set Root Directory
  11. $GLOBALS['root'] = dirname(__DIR__, 1);
  12. // Add in default and custom settings
  13. configLazy();
  14. // Define Logs and files after db location is set
  15. if (isset($GLOBALS['dbLocation'])) {
  16. $GLOBALS['organizrLog'] = $GLOBALS['dbLocation'] . 'organizrLog.json';
  17. $GLOBALS['organizrLoginLog'] = $GLOBALS['dbLocation'] . 'organizrLoginLog.json';
  18. //Upgrade Check
  19. if (qualifyRequest(1)) {
  20. upgradeCheck();
  21. }
  22. }
  23. // Cookie name
  24. $GLOBALS['cookieName'] = isset($GLOBALS['organizrAPI']) ? 'organizr_token_' . hash('sha256', $GLOBALS['organizrAPI']) : 'organizr_token_temp';
  25. // Validate Token if set and set guest if not - sets GLOBALS
  26. getOrganizrUserToken();
  27. // Include all pages files
  28. foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . "*.php") as $filename) {
  29. require_once $filename;
  30. }
  31. // Include all plugin files
  32. foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . "*.php") as $filename) {
  33. require_once $filename;
  34. }