PageRenderTime 52ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/inc/common.php

https://bitbucket.org/yoander/mtrack
PHP | 82 lines | 73 code | 8 blank | 1 comment | 7 complexity | 866eaba960da005c2ea0a82e681e02d3 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. <?php # vim:ts=2:sw=2:et:
  2. /* For licensing and copyright terms, see the file named LICENSE */
  3. define('MTRACK_INC_DIR', dirname(__FILE__));
  4. set_include_path(
  5. MTRACK_INC_DIR . DIRECTORY_SEPARATOR . 'lib' .
  6. PATH_SEPARATOR .
  7. get_include_path()
  8. );
  9. $MTRACK_INIT_LIST = array();
  10. function mtrack_init($func)
  11. {
  12. global $MTRACK_INIT_LIST;
  13. $MTRACK_INIT_LIST[] = $func;
  14. }
  15. include MTRACK_INC_DIR . '/configuration.php';
  16. include MTRACK_INC_DIR . '/link.php';
  17. include MTRACK_INC_DIR . '/rest.php';
  18. include MTRACK_INC_DIR . '/watch.php';
  19. include MTRACK_INC_DIR . '/cache.php';
  20. include MTRACK_INC_DIR . '/UUID.php';
  21. include MTRACK_INC_DIR . '/attachment.php';
  22. include MTRACK_INC_DIR . '/database.php';
  23. include MTRACK_INC_DIR . '/search.php';
  24. include MTRACK_INC_DIR . '/keywords.php';
  25. include MTRACK_INC_DIR . '/wiki.php';
  26. include MTRACK_INC_DIR . '/changeset.php';
  27. include MTRACK_INC_DIR . '/commit-hook.php';
  28. include MTRACK_INC_DIR . '/captcha.php';
  29. include MTRACK_INC_DIR . '/web.php';
  30. include MTRACK_INC_DIR . '/auth.php';
  31. include MTRACK_INC_DIR . '/user.php';
  32. include MTRACK_INC_DIR . '/acl.php';
  33. include MTRACK_INC_DIR . '/ebs.php';
  34. include MTRACK_INC_DIR . '/issue.php';
  35. include MTRACK_INC_DIR . '/report.php';
  36. include MTRACK_INC_DIR . '/milestone.php';
  37. include MTRACK_INC_DIR . '/wiki-item.php';
  38. include MTRACK_INC_DIR . '/scm.php';
  39. include MTRACK_INC_DIR . '/scm/hg.php';
  40. include MTRACK_INC_DIR . '/scm/git.php';
  41. include MTRACK_INC_DIR . '/scm/svn.php';
  42. include MTRACK_INC_DIR . '/timeline.php';
  43. include MTRACK_INC_DIR . '/customfield.php';
  44. include MTRACK_INC_DIR . '/syntax.php';
  45. include MTRACK_INC_DIR . '/snippet.php';
  46. include MTRACK_INC_DIR . '/a2s.php';
  47. foreach ($MTRACK_INIT_LIST as $func) {
  48. call_user_func($func);
  49. }
  50. MTrackConfig::boot();
  51. if (php_sapi_name() != 'cli') {
  52. $timezone = null;
  53. if (MTrackAuth::whoami() != 'anonymous') {
  54. foreach (MTrackDB::q('select timezone from userinfo where userid = ?',
  55. MTrackAuth::whoami())->fetchAll() as $row) {
  56. $timezone = $row[0];
  57. }
  58. }
  59. if (empty($timezone)) {
  60. $timezone = MTrackConfig::get('core', 'timezone');
  61. }
  62. if (!empty($timezone)) {
  63. $timezone_crutch = array(
  64. 'PST' => 'America/Los_Angeles',
  65. 'PDT' => 'America/Los_Angeles',
  66. 'EDT' => 'America/New_York',
  67. 'EST' => 'America/New_York',
  68. );
  69. if (isset($timezone_crutch[$timezone])) {
  70. $timezone = $timezone_crutch[$timezone];
  71. }
  72. date_default_timezone_set($timezone);
  73. }
  74. }