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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace common\helpers;
  8. use yii ;
  9. class Url
  10. {
  11. public static function frontend($action = '')
  12. {
  13. $server_name = Yii::$app->getRequest()->serverName ;
  14. $address = '' ;
  15. if($server_name == 'localhost')
  16. {
  17. $address = 'http://localhost/reservation_pain/frontend/web/' ;
  18. }
  19. elseif($server_name == 'www.laboiteapain.net' ||
  20. $server_name == 'boulanger.laboiteapain.net')
  21. {
  22. $address = 'http://www.laboiteapain.net/' ;
  23. }
  24. elseif($server_name == 'dev.laboiteapain.net' ||
  25. $server_name == 'boulanger-dev.laboiteapain.net')
  26. {
  27. $address = 'http://dev.laboiteapain.net/' ;
  28. }
  29. elseif($server_name == 'demo.laboiteapain.net' ||
  30. $server_name == 'boulanger-demo.laboiteapain.net')
  31. {
  32. $address = 'http://demo.laboiteapain.net/' ;
  33. }
  34. if(strlen($action))
  35. {
  36. $address .= 'index.php?r='.$action ;
  37. }
  38. return $address ;
  39. }
  40. public static function backend($action = '')
  41. {
  42. $server_name = Yii::$app->getRequest()->serverName ;
  43. $address = '' ;
  44. if($server_name == 'localhost')
  45. {
  46. $address = 'http://localhost/reservation_pain/backend/web/' ;
  47. }
  48. elseif($server_name == 'www.laboiteapain.net' ||
  49. $server_name == 'boulanger.laboiteapain.net')
  50. {
  51. $address = 'http://boulanger.laboiteapain.net/' ;
  52. }
  53. elseif($server_name == 'dev.laboiteapain.net' ||
  54. $server_name == 'boulanger-dev.laboiteapain.net')
  55. {
  56. $address = 'http://boulanger-dev.laboiteapain.net/' ;
  57. }
  58. elseif($server_name == 'demo.laboiteapain.net' ||
  59. $server_name == 'boulanger-demo.laboiteapain.net')
  60. {
  61. $address = 'http://boulanger-demo.laboiteapain.net/' ;
  62. }
  63. if(strlen($action))
  64. {
  65. $address .= 'index.php?r='.$action ;
  66. }
  67. return $address ;
  68. }
  69. public static function env($env, $section)
  70. {
  71. $server_name = Yii::$app->getRequest()->serverName ;
  72. if($section == 'backend')
  73. {
  74. if($server_name == 'localhost')
  75. {
  76. return 'http://localhost/reservation_pain/backend/web/' ;
  77. }
  78. else {
  79. if($env == 'prod')
  80. {
  81. return 'http://boulanger.laboiteapain.net/' ;
  82. }
  83. else {
  84. return 'http://boulanger-'.$env.'.laboiteapain.net/' ;
  85. }
  86. }
  87. }
  88. else {
  89. if($server_name == 'localhost')
  90. {
  91. return 'http://localhost/reservation_pain/frontend/web/' ;
  92. }
  93. else {
  94. if($env == 'prod')
  95. {
  96. return 'http://www.laboiteapain.net/' ;
  97. }
  98. else {
  99. return 'http://'.$env.'.laboiteapain.net/' ;
  100. }
  101. }
  102. }
  103. }
  104. }