error.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. $requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  3. if (isset($_GET['error'])) {
  4. $status = $_GET['error'];
  5. }else{
  6. $status = "";
  7. }
  8. $codes = array(
  9. 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
  10. 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
  11. 403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
  12. 404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
  13. 405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
  14. 408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
  15. 500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
  16. 502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
  17. 503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
  18. 504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
  19. 999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused'),
  20. );
  21. @$errorTitle = $codes[$status][0];
  22. @$message = $codes[$status][1];
  23. @$errorImage = $codes[$status][2];
  24. if ($errorTitle == false || strlen($status) != 3) {
  25. $message = 'Please supply a valid status code.';
  26. $errorTitle = "Error";
  27. $errorImage = "confused";
  28. }
  29. $data = false;
  30. ini_set("display_errors", 1);
  31. ini_set("error_reporting", E_ALL | E_STRICT);
  32. function registration_callback($username, $email, $userdir)
  33. {
  34. global $data;
  35. $data = array($username, $email, $userdir);
  36. }
  37. require_once("user.php");
  38. require_once("translate.php");
  39. $USER = new User("registration_callback");
  40. $dbfile = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db";
  41. $file_db = new PDO("sqlite:" . $dbfile);
  42. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  43. $dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"');
  44. $hasOptions = "No";
  45. foreach($dbOptions as $row) :
  46. if (in_array("options", $row)) :
  47. $hasOptions = "Yes";
  48. endif;
  49. endforeach;
  50. if($hasOptions == "No") :
  51. $title = "Organizr";
  52. $topbar = "#333333";
  53. $topbartext = "#66D9EF";
  54. $bottombar = "#333333";
  55. $sidebar = "#393939";
  56. $hoverbg = "#AD80FD";
  57. $activetabBG = "#F92671";
  58. $activetabicon = "#FFFFFF";
  59. $activetabtext = "#FFFFFF";
  60. $inactiveicon = "#66D9EF";
  61. $inactivetext = "#66D9EF";
  62. $loading = "#66D9EF";
  63. $hovertext = "#000000";
  64. endif;
  65. if($hasOptions == "Yes") :
  66. $resulto = $file_db->query('SELECT * FROM options');
  67. foreach($resulto as $row) :
  68. $title = isset($row['title']) ? $row['title'] : "Organizr";
  69. $topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF";
  70. $topbar = isset($row['topbar']) ? $row['topbar'] : "#333333";
  71. $bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333";
  72. $sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939";
  73. $hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD";
  74. $activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671";
  75. $activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF";
  76. $activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF";
  77. $inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF";
  78. $inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF";
  79. $loading = isset($row['loading']) ? $row['loading'] : "#66D9EF";
  80. $hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000";
  81. endforeach;
  82. endif;
  83. ?>
  84. <!DOCTYPE html>
  85. <html lang="en" class="no-js">
  86. <head>
  87. <meta charset="UTF-8">
  88. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  89. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  90. <meta name="msapplication-tap-highlight" content="no" />
  91. <title><?=$errorTitle;?></title>
  92. <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
  93. <link rel="stylesheet" href="/bower_components/Waves/dist/waves.min.css">
  94. <link rel="stylesheet" href="/css/style.css">
  95. </head>
  96. <body class="gray-bg" style="padding: 0;">
  97. <div class="main-wrapper" style="position: initial;">
  98. <div style="margin:0 20px; overflow:hidden">
  99. <div class="table-wrapper" style="background:<?=$sidebar;?>;">
  100. <div class="table-row">
  101. <div class="table-cell text-center">
  102. <div class="login i-block">
  103. <div class="content-box">
  104. <div class="biggest-box" style="background:<?=$topbar;?>;">
  105. <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
  106. </div>
  107. <div class="big-box text-left">
  108. <center><img src="/images/<?=$errorImage;?>.png" style="height: 200px;"></center>
  109. <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
  110. <button style="background:<?=$topbar;?>;" onclick="goBack()" 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>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <script>
  120. function goBack() {
  121. window.history.back();
  122. }
  123. </script>
  124. </body>
  125. </html>