included Niko's error page

This commit is contained in:
systopia 2015-02-20 16:22:34 +01:00
parent 7f7f355cc8
commit c2fdacdda5
3 changed files with 15 additions and 11 deletions

View File

@ -9,9 +9,6 @@
require_once "config.php"; require_once "config.php";
require_once "proxy.php"; require_once "proxy.php";
$error = "Please do not divide by zero."; //TODO: remove this and call the page properly
$display_version = FALSE; //TODO: "
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -120,15 +117,13 @@ $display_version = FALSE; //TODO: "
<div id="container"> <div id="container">
<div id="info" class="center-small"> <div id="info" class="center-small">
<a href="https://www.systopia.de/"><img src="static/images/proxy-logo.png" alt="SYSTOPIA Organisationsberatung"></img></a> <a href="https://www.systopia.de/"><img src="static/images/proxy-logo.png" alt="SYSTOPIA Organisationsberatung"></img></a>
<?php if($display_version): ?>
<p id="version">CiviProxy Version <?php echo $civiproxy_version;?></p> <p id="version">CiviProxy Version <?php echo $civiproxy_version;?></p>
<?php endif; ?>
</div> </div>
<div id="error-container" class="center"> <div id="error-container" class="center">
<?php if(isset($error)):?> <?php if(isset($civiproxy_error_message)):?>
<div class="bs-callout bs-callout-danger"> <div class="bs-callout bs-callout-danger">
<h4>An error has occurred while processing your request</h4> <h4>An error has occurred while processing your request:</h4>
<?php echo($error); ?> <?php echo($civiproxy_error_message); ?>
</div> </div>
<?php endif;?> <?php endif;?>
</div> </div>

View File

@ -19,4 +19,8 @@ civiproxy_security_check('viewmail');
// basic restraints // basic restraints
$valid_parameters = array( 'id' => 'int' ); $valid_parameters = array( 'id' => 'int' );
$parameters = civiproxy_get_parameters($valid_parameters); $parameters = civiproxy_get_parameters($valid_parameters);
// check if id specified
if (empty($parameters['id'])) civiproxy_http_error("Resource not found");
civiproxy_redirect($target_mail, $parameters); civiproxy_redirect($target_mail, $parameters);

View File

@ -182,7 +182,12 @@ function civiproxy_get_parameters($valid_parameters) {
*/ */
function civiproxy_http_error($message, $code = 404) { function civiproxy_http_error($message, $code = 404) {
global $civiproxy_version; global $civiproxy_version;
header("HTTP/1.1 $code $message (CiviProxy {$civiproxy_version})"); global $error_message;
// TODO: create error msg body
$civiproxy_error_message = $message;
header("HTTP/1.1 $code $civiproxy_error_message (CiviProxy {$civiproxy_version})");
require "error.php";
exit(); exit();
} }