error.php 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. // Include functions if not already included
  3. require_once('functions.php');
  4. // Upgrade environment
  5. upgradeCheck();
  6. // Lazyload settings
  7. $databaseConfig = configLazy('config/config.php');
  8. // Load USER
  9. require_once("user.php");
  10. $USER = new User("registration_callback");
  11. // Create Database Connection
  12. $file_db = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
  13. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  14. // Some PHP config stuff
  15. ini_set("display_errors", 1);
  16. ini_set("error_reporting", E_ALL | E_STRICT);
  17. foreach(loadAppearance() as $key => $value) {
  18. $$key = $value;
  19. }
  20. $requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  21. $status = (isset($_GET['error'])?$_GET['error']:404);
  22. $codes = array(
  23. 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
  24. 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
  25. 403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
  26. 404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
  27. 405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
  28. 408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
  29. 500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
  30. 502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
  31. 503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
  32. 504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
  33. 999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused'),
  34. );
  35. $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";
  36. $message = ($codes[$status][1]) ? $codes[$status][1] : "An Error Occured";
  37. $errorImage = ($codes[$status][2]) ? $codes[$status][2] : "confused";
  38. ?>
  39. <!DOCTYPE html>
  40. <html lang="en" class="no-js">
  41. <head>
  42. <meta charset="UTF-8">
  43. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  44. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  45. <meta name="msapplication-tap-highlight" content="no" />
  46. <title><?=$errorTitle;?></title>
  47. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/bootstrap/dist/css/bootstrap.min.css">
  48. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/Waves/dist/waves.min.css">
  49. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>css/style.css">
  50. <style><?php customCSS(); ?></style>
  51. </head>
  52. <body id="body-error" class="gray-bg" style="padding: 0;">
  53. <div class="main-wrapper" style="position: initial;">
  54. <div style="margin:0 20px; overflow:hidden">
  55. <div class="table-wrapper" style="background:<?=$sidebar;?>;">
  56. <div class="table-row">
  57. <div class="table-cell text-center">
  58. <div class="login i-block">
  59. <div class="content-box">
  60. <div class="biggest-box" style="background:<?=$topbar;?>;">
  61. <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
  62. </div>
  63. <div class="big-box text-left">
  64. <center><img src="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>images/<?=$errorImage;?>.png" style="height: 200px;"></center>
  65. <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
  66. <button style="background:<?=$topbar;?>;" onclick="parent.location='../'" type="button" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("GO_BACK");?></text></button>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </body>
  76. </html>