index.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. if(!file_exists('config.default.json')){
  3. header('Location: install');
  4. die();
  5. }elseif(file_exists('install')){
  6. $files = scandir('install');
  7. if(empty($files)){
  8. @rmdir('install');
  9. }
  10. }
  11. require_once('php/include.php');
  12. $salt = salt();
  13. if(isset($_GET['get'])){
  14. $get = $_GET['get'];
  15. unset($_GET['get']);
  16. if(!isset($_GET['type']) || !isset($_GET['id'])){
  17. $type = 'page';
  18. $id = 'index';
  19. }else{
  20. $type = $_GET['type'];
  21. $id = $_GET['id'];
  22. }
  23. switch($get){
  24. case 'state':
  25. die(
  26. json_encode(
  27. Array(
  28. 'state'=>stateObj($type,$id)
  29. )
  30. )
  31. );
  32. break;
  33. case 'api':
  34. require_once('api.php');
  35. break;
  36. case 'settings':
  37. $settings = Array();
  38. $keys = Array('expire');
  39. foreach($keys as $key){
  40. $settings[$key] = get($key);
  41. }
  42. die(json_encode(Array(
  43. 'settings'=>$settings,
  44. 'version'=>file_get_contents(PATH_DATA.'version')
  45. )));
  46. break;
  47. case 'captcha':
  48. generate_captcha();
  49. break;
  50. case 'error':
  51. die(
  52. json_encode(
  53. Array(
  54. 'error'=>isset($_GET['error'])?$_GET['error']:'Error'
  55. )
  56. )
  57. );
  58. break;
  59. }
  60. }
  61. if(!isset($_GET['type'])||!isset($_GET['id'])){
  62. header('Location: page-index');
  63. die();
  64. }
  65. ?>
  66. <!doctype html>
  67. <html manifest="bugs.appcache">
  68. <head>
  69. <meta charset=utf-8>
  70. <meta name="viewport" content="width=device-width, user-scalable=false, initial-scale=1, maximum-scale=1.0, user-scalable=0, user-scalable=no">
  71. <meta name="apple-mobile-web-app-capable" content="yes" />
  72. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  73. <link rel="apple-touch-icon" sizes="128-128" href="img/favicon-128.png" />
  74. <link rel="apple-touch-icon" sizes="120x120" href="img/favicon-120.png" />
  75. <link rel="apple-touch-icon" sizes="90x90" href="img/favicon-90.png" />
  76. <link rel="apple-touch-icon" sizes="60x60" href="img/favicon-60.png" />
  77. <link rel="apple-touch-startup-image" href="img/startup.png">
  78. <link rel="shortcut icon" href="img/favicon.ico" />
  79. <link rel="icon" type="image/png" href="img/favicon-60.png" />
  80. <link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>
  81. <link href="css/ui.notify.css" rel="stylesheet" type="text/css"/>
  82. <link href="css/style.css" rel="stylesheet" type="text/css"/>
  83. <title>Bugs</title>
  84. <script src="js/modernizr.js"></script>
  85. <script>
  86. (function(window,Modernizr){
  87. Modernizr.mediaquery = Modernizr.mq('only all');
  88. var checks = [
  89. 'csscalc',
  90. 'cookies',
  91. 'localstorage',
  92. 'history',
  93. 'rgba',
  94. 'applicationcache',
  95. 'mediaquery',
  96. 'fontface'
  97. ],i,
  98. msg = '';
  99. for(i in checks){
  100. if(!Modernizr[checks[i]]){
  101. msg += (msg==''?'':', ')+checks[i];
  102. }
  103. }
  104. if(msg != ''){
  105. alert("Your browser is unable to support all the features this site needs.\nChecks failed: "+msg);
  106. }
  107. window.applicationCache.addEventListener('updateready',function(){
  108. location.reload();
  109. });
  110. if(typeof window.screen.lockOrientation != 'undefined'){
  111. window.screen.lockOrientation('portrait');
  112. }
  113. })(window,Modernizr);
  114. </script>
  115. <script src="js/jquery.min.js"></script>
  116. <script src="js/jquery-ui.min.js"></script>
  117. <script src="js/handlebars.js"></script>
  118. <script src="js/jquery.history.js"></script>
  119. <script src="js/jquery.storage.js"></script>
  120. <script src="js/jquery.cookie.js"></script>
  121. <script src="js/jquery.nicescroll.js"></script>
  122. <script src="js/jquery.timeago.js"></script>
  123. <script src="js/jquery.notify.js"></script>
  124. <script src="js/shortcut.js"></script>
  125. <script src="js/index.js"></script>
  126. </head>
  127. <body lang="en">
  128. <div id="topbar" class="overflow-hide"></div>
  129. <div id="content" class="container"></div>
  130. <div id="loading"></div>
  131. <div id="dialog"></div>
  132. <div id="comment" style="display:none;">
  133. <form>
  134. <input type="hidden" name="comment_type"/>
  135. <input type="hidden" name="comment_id"/>
  136. <textarea name="message"></textarea>
  137. </form>
  138. </div>
  139. <div id="notification-container" style="display:none;">
  140. <div id="basic-template">
  141. <a class="ui-notify-cross ui-notify-close" href="#">
  142. x
  143. </a>
  144. <h1>
  145. #{title}
  146. </h1>
  147. <p>
  148. #{text}
  149. </p>
  150. </div>
  151. </div>
  152. </body>
  153. </html>