error.php 4.9 KB

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