error)); return !empty($json) && empty($json->error); } function loadStandaloneConfiguration() { global $global, $doNotIncludeConfig, $streamerURL; global $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase, $mysqlPort, $mysql_connect_was_closed, $mysql_connect_is_persistent; $configFile = __DIR__ . "/../videos/configuration.php"; $global['systemRootPath'] = realpath(__DIR__ . '/../') . '/'; $global['systemRootPath'] = str_replace('\\', '/', $global['systemRootPath']); $configFileStandAlone = "{$global['systemRootPath']}videos/standalone.configuration.php"; error_log("loadStandaloneConfiguration: systemRootPath set to {$global['systemRootPath']}"); error_log("loadStandaloneConfiguration: Checking for configuration files."); if (file_exists($configFile)) { error_log("loadStandaloneConfiguration: Found configuration.php, loading it."); require_once $configFile; $streamerURL = $global['webSiteRootURL']; error_log("loadStandaloneConfiguration: Streamer URL set to {$streamerURL}"); if ($isStandAlone) { error_log("loadStandaloneConfiguration: Running in standalone mode. Validating API key."); if (!isAPIKeyValid()) { error_log("loadStandaloneConfiguration: Invalid API Key."); die(json_encode(array('error' => true, 'msg' => 'Invalid API Key'))); } } return true; } if (file_exists($configFileStandAlone)) { error_log("loadStandaloneConfiguration: Found standalone.configuration.php, loading it."); $doNotIncludeConfig = 1; require_once $configFileStandAlone; $configFile = "{$global['systemRootPath']}videos/configuration.php"; if (!file_exists($configFile)) { error_log("loadStandaloneConfiguration: configuration.php not found. Creating it."); $content = "Standalone Configuration File Missing"; echo "
You need to manually create a file named {$global['systemRootPath']}videos/standalone.configuration.php
in the videos
directory.
Include the following content in the file:
"; echo ""; echo htmlspecialchars(""); echo ""; exit; } // Call the function to load configuration loadStandaloneConfiguration();