/**
 * Trim file path to hide document root
 * @var string $file the file path
 * @var int $maxLength the max number of chars, or 0 for no limit (optional)
 * @return string the path without the document root
 */
function trimDocumentRoot($file, $maxLength = 0)
{
    // Windows systems
    $file = str_replace('\\', '/', $file);
    if (isset($_SERVER['DOCUMENT_ROOT'])) {
        if (strpos($file, $_SERVER['DOCUMENT_ROOT']) === 0) {
            $file = substr($file, strlen($_SERVER['DOCUMENT_ROOT']));
        }
    }
    if ($maxLength > 0) {
        $file = shortenFilePath($file, $maxLength);
    }
    return $file;
}
示例#2
0
		<div class="block-border"><div class="block-content">
				
			<h1>Admin</h1>
			<div class="block-header">System error</div>
			
			<h2>Error description</h2>
			
			<h5>Message</h5>
			<p>An error occurred while processing your request. Please return to the previous page and check everything before trying again. If the same error occurs again, please contact your system administrator or report error (see below).</p>
			
			<p><b>Event type:</b> <?php 
echo $exception ? 'exception' : 'error';
?>
<br>
			<b>Page:</b> <?php 
echo isset($_SERVER['REQUEST_URI']) ? htmlspecialchars(shortenFilePath($_SERVER['REQUEST_URI'], 40)) : '(undefined)';
?>
</p>
			
			<form class="form" id="send-report" method="post" action="_errors/sendReport.php">
				<input type="hidden" name="report" id="report" value="<?php 
echo htmlspecialchars($encodedReport);
?>
">
				<fieldset class="grey-bg no-margin collapse">
					<legend><a href="#">Report error</a></legend>
					
					<p>
						<label for="description" class="light float-left">To report this error, please explain how it happened and click below:</label>
						<textarea name="description" id="description" class="full-width" rows="4"></textarea>
					</p>