define('HEURIST_DOMAIN', $k > 0 ? substr($serverName, 0, $k - 1) : $serverName); } $isSecure = false; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $isSecure = true; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { $isSecure = true; } $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http'; define('HEURIST_SERVER_NAME', $serverName); // server host name for the configured name, eg. Heurist.sydney.edu.au $serverBaseURL = $REQUEST_PROTOCOL . "://" . HEURIST_SERVER_NAME; define('HEURIST_SERVER_URL', $serverBaseURL); //with protocol and port define('HEURIST_CURRENT_URL', $serverBaseURL . $_SERVER["REQUEST_URI"]); $installDir = getInstallationDirectory(@$_SERVER["SCRIPT_NAME"]); // This is only used in this file to set other values define('HEURIST_SITE_PATH', $installDir); // eg. /h4/ define('HEURIST_BASE_URL', HEURIST_SERVER_URL . HEURIST_SITE_PATH); // eg. http://heurist.sydney.edu.au/h4/ $documentRoot = @$_SERVER["DOCUMENT_ROOT"]; if ($documentRoot && substr($documentRoot, -1, 1) != '/') { $documentRoot = $documentRoot . '/'; } //define('HEURIST_SERVER_ROOT_DIR', $documentRoot); // eg. /var/www/html/ @todo - remove define('HEURIST_DIR', $documentRoot . HEURIST_SITE_PATH); // /var/www/html/h4/ // Heurist Installation which contains index of registered Heurist databases (registered DB # 1) // DO NOT CHANGE THIS URL define('HEURIST_INDEX_BASE_URL', "http://heurist.sydney.edu.au/heurist/");
/** * Downloads the latest Zibo version and unpacks it in the installation directory * @return null */ function downloadAndUnpack() { $installDirectory = getInstallationDirectory(); $lastSeparator = strrpos(PACKAGE, DIRECTORY_SEPARATOR); $package = $installDirectory . DIRECTORY_SEPARATOR . substr(PACKAGE, $lastSeparator + 1); file_put_contents($package, file_get_contents(PACKAGE)); $zip = new ZipArchive(); $zip->open($package); $zip->extractTo($installDirectory); $zip->close(); }