Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * GitList 0.3
  4. * https://github.com/klaussilveira/gitlist
  5. */
  6. // Set the default timezone for systems without date.timezone set in php.ini
  7. if (!ini_get('date.timezone')) {
  8. date_default_timezone_set('UTC');
  9. }
  10. require_once('../includes/config.php');
  11. $url = curPageURL();
  12. $pattern = "/^(.*)((\/zipball\/)|(\/tarball\/)|(\/raw\/))(.*)$/";
  13. if(!preg_match($pattern, $url))
  14. {
  15. include('../templates/'.$CONF['template'].'/header.php');
  16. set_page_title("Teknik Git");
  17. ?>
  18. <script src="<?php echo get_subdomain_full_url($CONF['sub'], $CONF); ?>/templates/<?php echo $CONF['template']; ?>/js/codemirror/codemirror.js"></script>
  19. <?php
  20. }
  21. if (php_sapi_name() == 'cli-server' && file_exists(substr($_SERVER['REQUEST_URI'], 1))) {
  22. return false;
  23. }
  24. if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
  25. die(sprintf('The "%s" folder must be writable for GitList to run.', __DIR__ . DIRECTORY_SEPARATOR . 'cache'));
  26. }
  27. require 'vendor/autoload.php';
  28. $config = GitList\Config::fromFile('config.ini');
  29. $config->set('app', 'clone_url', 'ssh://git@teknik.io:');
  30. if ($_GET['user'])
  31. {
  32. if ($userTools->checkUsernameExists($_GET['user']))
  33. {
  34. if (is_dir("G:\\Repositories\\u\\".$_GET['user']))
  35. {
  36. $_SERVER['HTTP_X_ORIGINAL_URL'] = str_replace("/u/".$_GET['user'], "", $_SERVER['HTTP_X_ORIGINAL_URL']);
  37. $config->set('git', 'repositories', array('G:\\Repositories\\u\\'.$_GET['user']));
  38. $config->set('git', 'hidden', array(''));
  39. $config->set('app', 'path_prefix', 'u/'.$_GET['user']);
  40. $config->set('app', 'clone_url', 'ssh://git@teknik.io:u/'.$_GET['user'].'/');
  41. $app = require 'boot.php';
  42. $app->run();
  43. }
  44. else
  45. {
  46. ?>
  47. <div class="row">
  48. <div class="col-sm-12 text-center">
  49. <h2>That user has no repositories</h2>
  50. </div>
  51. </div>
  52. <?php
  53. }
  54. }
  55. else
  56. {
  57. ?>
  58. <div class="row">
  59. <div class="col-sm-12 text-center">
  60. <h2>That user doesn't exist</h2>
  61. </div>
  62. </div>
  63. <?php
  64. }
  65. }
  66. else
  67. {
  68. $app = require 'boot.php';
  69. $app->run();
  70. }
  71. if(!preg_match($pattern, $url))
  72. {
  73. include('../templates/'.$CONF['template'].'/footer.php');
  74. }
  75. ?>