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.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. if (php_sapi_name() == 'cli-server' && file_exists(substr($_SERVER['REQUEST_URI'], 1))) {
  19. return false;
  20. }
  21. if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
  22. die(sprintf('The "%s" folder must be writable for GitList to run.', __DIR__ . DIRECTORY_SEPARATOR . 'cache'));
  23. }
  24. require 'vendor/autoload.php';
  25. $config = GitList\Config::fromFile('config.ini');
  26. $config->set('app', 'clone_url', 'git://teknik.io/');
  27. if ($_GET['user'])
  28. {
  29. if ($userTools->checkUsernameExists($_GET['user']))
  30. {
  31. if (is_dir("G:\\Repositories\\u\\".$_GET['user']) && !is_dir_empty("G:\\Repositories\\u\\".$_GET['user']))
  32. {
  33. $_SERVER['HTTP_X_ORIGINAL_URL'] = str_replace("/u/".$_GET['user'], "", $_SERVER['HTTP_X_ORIGINAL_URL']);
  34. $config->set('git', 'repositories', array('G:\\Repositories\\u\\'.$_GET['user']));
  35. $config->set('git', 'hidden', array(''));
  36. $config->set('app', 'path_prefix', '/u/'.$_GET['user']);
  37. $config->set('app', 'clone_url', 'git://teknik.io/u/'.$_GET['user'].'/');
  38. $app = require 'boot.php';
  39. $app->run();
  40. }
  41. else
  42. {
  43. ?>
  44. <div class="row">
  45. <div class="col-sm-12 text-center">
  46. <h2>That user has no repositories</h2>
  47. </div>
  48. </div>
  49. <?php
  50. }
  51. }
  52. else
  53. {
  54. ?>
  55. <div class="row">
  56. <div class="col-sm-12 text-center">
  57. <h2>That user doesn't exist</h2>
  58. </div>
  59. </div>
  60. <?php
  61. }
  62. }
  63. else
  64. {
  65. $app = require 'boot.php';
  66. $app->run();
  67. }
  68. if(!preg_match($pattern, $url))
  69. {
  70. include('../templates/'.$CONF['template'].'/footer.php');
  71. }
  72. ?>