index.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. $json = Array();
  26. $json['state'] = Array();
  27. $json['state']['data'] = $_GET;
  28. switch($type){
  29. case 'user':$url='~'.$id;break;
  30. case 'group':$url='+'.$id;break;
  31. case 'issue':$url='!'.$id;break;
  32. case 'page':$url='page-'.$id;break;
  33. default:$url=$type.'-'.$id;
  34. }
  35. $json['state']['url'] = $url;
  36. $json['state']['title'] = ucwords($type.' - '.$id);
  37. die(json_encode($json));
  38. break;
  39. case 'api':
  40. require_once('api.php');
  41. break;
  42. case 'settings':
  43. $settings = Array();
  44. $keys = Array('timeout');
  45. foreach($keys as $key){
  46. $settings[$key] = get($key);
  47. }
  48. die(json_encode($settings));
  49. break;
  50. case 'captcha':
  51. generate_captcha();
  52. break;
  53. }
  54. }
  55. ?>
  56. <!doctype html>
  57. <html>
  58. <head>
  59. <meta charset=utf-8>
  60. <title>Bugs</title>
  61. <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  62. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
  63. <script src="js/handlebars.js"></script>
  64. <script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
  65. <script src="js/jquery.history.js"></script>
  66. <script src="js/jquery.cookie.js"></script>
  67. <script src="js/index.js"></script>
  68. <link href="http://code.jquery.com/ui/1.10.3/themes/black-tie/jquery-ui.css" rel="stylesheet" type="text/css"/>
  69. <link href="css/jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css"/>
  70. <link href="css/style.css" rel="stylesheet" type="text/css"/>
  71. </head>
  72. <body>
  73. <div id="topbar"></div>
  74. <div id="content"></div>
  75. <div id="loading"></div>
  76. </body>
  77. </html>