// Display debugging information
'debug' => false,
- // Complete URL to your directory (including tracing slash)
- 'url' => 'http://strace.club/',
+ // Complete URL to your directory (including tracing slash, leave for auto-detection)
+ 'url' => detectServerUrl(),
// Amount of seconds that each file should be stored for (0 for no limit)
// Default 30 days
$data = array();
// Name of this file
- $data['scriptname'] = $settings['url'] . '/' . pathinfo(__FILE__, PATHINFO_BASENAME);
+ $data['scriptname'] = $settings['url'] . pathinfo(__FILE__, PATHINFO_BASENAME);
// Adding current script name to ignore list
$data['ignores'] = $settings['ignores'];
return (is_file($file) && is_readable($file));
}
+ // Detects full URL of installation
+ function detectServerUrl () {
+ // Is "cache" there?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Default protocol is HTTP
+ $protocol = 'http';
+
+ // Is SSL given?
+ if (((isset($_SERVER['HTTPS'])) && (strtolower($_SERVER['HTTPS']) == 'on')) || ((isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) && (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https'))) {
+ // Protocol is HTTPS
+ $protocol = 'https';
+ } // END - if
+
+ // Construct full URL
+ $GLOBALS[__FUNCTION__] = str_replace("\\", '', sprintf('%s://%s%s/', $protocol, $_SERVER['SERVER_NAME'], dirname($_SERVER['SCRIPT_NAME'])));
+ } // END - if
+
+ // Return cached value
+ return $GLOBALS[__FUNCTION__];
+ }
+
// Files are being POSEed. Uploading them one by one.
if (isset($_FILES['file'])) {
header('Content-type: text/plain');