Bläddra i källkod

update functions file to new format

CauseFX 5 år sedan
förälder
incheckning
3e66a26ead
1 ändrade filer med 6 tillägg och 44 borttagningar
  1. 6 44
      api/functions.php

+ 6 - 44
api/functions.php

@@ -3,54 +3,16 @@
 date_default_timezone_set("UTC");
 // Autoload frameworks
 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
-// Include all function files
+// Include all function and class files
 foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'functions' . DIRECTORY_SEPARATOR . '*.php') as $filename) {
 	require_once $filename;
 }
-// Set Root Directory
-$GLOBALS['root'] = dirname(__DIR__, 1);
-$GLOBALS['uuid'] = '';
-$GLOBALS['rememberMeDays'] = '99';
-$GLOBALS['timeExecution'] = timeExecution();
-// Add in default and custom settings
-configLazy();
-// Define Logs and files after db location is set
-if (isset($GLOBALS['dbLocation'])) {
-	$GLOBALS['organizrLog'] = $GLOBALS['dbLocation'] . 'organizrLog.json';
-	$GLOBALS['organizrLoginLog'] = $GLOBALS['dbLocation'] . 'organizrLoginLog.json';
-	$GLOBALS['paths'] = array(
-		'Root Folder' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
-		'API Folder' => dirname(__DIR__, 1) . DIRECTORY_SEPARATOR,
-		'DB Folder' => $GLOBALS['dbLocation']
-	);
-	if (($GLOBALS['uuid'] == '')) {
-		$uuid = gen_uuid();
-		$GLOBALS['uuid'] = $uuid;
-		updateConfig(array('uuid' => $uuid));
-	}
-	if ($GLOBALS['docker'] && !$GLOBALS['dev']) {
-		$getBranch = file_get_contents(dirname(__DIR__, 1) . DIRECTORY_SEPARATOR . 'Docker.txt');
-		$getBranch = (empty($getBranch)) ? 'v2-master' : trim($getBranch);
-		$GLOBALS['branch'] = $getBranch;
-		if (!isset($GLOBALS['commit']) || $GLOBALS['commit'] == 'n/a') {
-			$GLOBALS['commit'] = $GLOBALS['quickCommit'];
-		}
-	}
-	// Oauth?
-	if ($GLOBALS['authProxyEnabled'] && $GLOBALS['authProxyHeaderName'] !== '' && $GLOBALS['authProxyWhitelist'] !== '') {
-		if (isset(getallheaders()[$GLOBALS['authProxyHeaderName']])) {
-			coookieSeconds('set', 'organizrOAuth', 'true', 20000, false);
-		}
-	}
-	//Upgrade Check
-	upgradeCheck();
+foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'homepage' . DIRECTORY_SEPARATOR . '*.php') as $filename) {
+	require_once $filename;
+}
+foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . '*.php') as $filename) {
+	require_once $filename;
 }
-// Reset RememberMe if zero
-$GLOBALS['rememberMeDays'] = ($GLOBALS['rememberMeDays'] == '0') ? '99' : $GLOBALS['rememberMeDays'];
-// Cookie name
-$GLOBALS['cookieName'] = $GLOBALS['uuid'] !== '' ? 'organizr_token_' . $GLOBALS['uuid'] : 'organizr_token_temp';
-// Validate Token if set and set guest if not - sets GLOBALS
-getOrganizrUserToken();
 // Include all pages files
 foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . "*.php") as $filename) {
 	require_once $filename;