error.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. );
  20. @$errorTitle = $codes[$status][0];
  21. @$message = $codes[$status][1];
  22. if ($errorTitle == false || strlen($status) != 3) {
  23. $message = 'Please supply a valid status code.';
  24. $errorTitle = "Error";
  25. }
  26. $data = false;
  27. ini_set("display_errors", 1);
  28. ini_set("error_reporting", E_ALL | E_STRICT);
  29. function registration_callback($username, $email, $userdir)
  30. {
  31. global $data;
  32. $data = array($username, $email, $userdir);
  33. }
  34. require_once("user.php");
  35. require_once("translate.php");
  36. $USER = new User("registration_callback");
  37. $dbfile = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db";
  38. $file_db = new PDO("sqlite:" . $dbfile);
  39. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  40. $dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"');
  41. $hasOptions = "No";
  42. foreach($dbOptions as $row) :
  43. if (in_array("options", $row)) :
  44. $hasOptions = "Yes";
  45. endif;
  46. endforeach;
  47. if($hasOptions == "No") :
  48. $title = "Organizr";
  49. $topbar = "#333333";
  50. $topbartext = "#66D9EF";
  51. $bottombar = "#333333";
  52. $sidebar = "#393939";
  53. $hoverbg = "#AD80FD";
  54. $activetabBG = "#F92671";
  55. $activetabicon = "#FFFFFF";
  56. $activetabtext = "#FFFFFF";
  57. $inactiveicon = "#66D9EF";
  58. $inactivetext = "#66D9EF";
  59. $loading = "#66D9EF";
  60. $hovertext = "#000000";
  61. endif;
  62. if($hasOptions == "Yes") :
  63. $resulto = $file_db->query('SELECT * FROM options');
  64. foreach($resulto as $row) :
  65. $title = isset($row['title']) ? $row['title'] : "Organizr";
  66. $topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF";
  67. $topbar = isset($row['topbar']) ? $row['topbar'] : "#333333";
  68. $bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333";
  69. $sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939";
  70. $hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD";
  71. $activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671";
  72. $activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF";
  73. $activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF";
  74. $inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF";
  75. $inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF";
  76. $loading = isset($row['loading']) ? $row['loading'] : "#66D9EF";
  77. $hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000";
  78. endforeach;
  79. endif;
  80. ?>
  81. <!DOCTYPE html>
  82. <html lang="en" class="no-js">
  83. <head>
  84. <meta charset="UTF-8">
  85. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  86. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  87. <meta name="msapplication-tap-highlight" content="no" />
  88. <title><?=$errorTitle;?></title>
  89. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  90. <link rel="stylesheet" href="bower_components/Waves/dist/waves.min.css">
  91. <link rel="stylesheet" href="css/style.css">
  92. </head>
  93. <body class="gray-bg" style="padding: 0;">
  94. <div class="main-wrapper" style="position: initial;">
  95. <div style="margin:0 20px; overflow:hidden">
  96. <div class="table-wrapper" style="background:<?=$sidebar;?>;">
  97. <div class="table-row">
  98. <div class="table-cell text-center">
  99. <div class="login i-block">
  100. <div class="content-box">
  101. <div class="biggest-box" style="background:<?=$topbar;?>;">
  102. <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
  103. </div>
  104. <div class="big-box text-left">
  105. <center><img src="images/<?=$codes[$status][2];?>.png" style="height: 200px;"></center>
  106. <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
  107. <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>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <script>
  117. function goBack() {
  118. window.history.back();
  119. }
  120. </script>
  121. </body>
  122. </html>