Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for SourceGuardian Encoder)
  6. *
  7. * @ Version : 4.0.9.0
  8. * @ Author : DeZender
  9. * @ Release on : 08.08.2019
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace app\index\controller;
  15.  
  16. class Common extends \think\Controller
  17. {
  18. protected $site;
  19. protected $siteId = 0;
  20. protected $user;
  21. protected $info;
  22. protected $theme;
  23. protected $url = 'http://usbyun.cn';
  24.  
  25. public function initialize()
  26. {
  27. $site = \app\admin\model\Site::where('rootDomain', 'like', '%' . $this->request->rootDomain() . '%')->where('state', 1)->find();
  28. $mainSite = \app\admin\model\Site::where('id', 0)->find();
  29.  
  30. if (!empty($site)) {
  31. $this->site = $site;
  32. }
  33. else {
  34. $this->checkExpire();
  35. $subDomain = $this->request->subDomain();
  36. if (empty($subDomain) || (strtolower($subDomain) == 'www')) {
  37. $this->site = $mainSite;
  38. }
  39. else {
  40. $this->site = \app\admin\model\Site::where('subDomain', $subDomain)->where('state', 1)->find();
  41.  
  42. if (empty($this->site)) {
  43. abort(404, '分站不存在,或分站已被停用');
  44. }
  45. }
  46. }
  47.  
  48. if (empty($this->site['notice'])) {
  49. $this->site['notice'] = $mainSite['notice'];
  50. }
  51.  
  52. if (empty($this->site['img1'])) {
  53. $this->site['img1'] = $mainSite['img1'];
  54. }
  55.  
  56. if (empty($this->site['img2'])) {
  57. $this->site['img2'] = $mainSite['img2'];
  58. }
  59.  
  60. if (empty($this->site['img3'])) {
  61. $this->site['img3'] = $mainSite['img3'];
  62. }
  63.  
  64. $this->siteId = $this->site['id'];
  65. $notice = explode("\n", $this->site['notice']);
  66. $noticeStr = '';
  67.  
  68. foreach ($notice as $key => $value) {
  69. $noticeStr .= '<p>' . $value . '</p>';
  70. }
  71.  
  72. $alert = explode("\n", $this->site['alert']);
  73. $alertStr = '';
  74.  
  75. if (!empty($alert)) {
  76. foreach ($alert as $key => $value) {
  77. $alertStr .= '<p>' . $value . '</p>';
  78. }
  79. }
  80.  
  81. $alertStr = str_replace('<p></p>', '', $alertStr);
  82. $this->site['notice'] = $noticeStr;
  83. $this->site['alert'] = $alertStr;
  84. $user = \think\facade\Cookie::get($this->site['subDomain']);
  85.  
  86. if (!empty($user)) {
  87. $map = [
  88. ['substation_id', '=', $this->siteId],
  89. ['nickname', '=', $user['nickname']],
  90. ['password', '=', $user['password']]
  91. ];
  92. $this->user = \think\Db::name('user')->where($map)->find();
  93.  
  94. if ($user) {
  95. $this->assign('user', $this->user);
  96. }
  97. }
  98.  
  99. $this->assign('siteId', $this->siteId);
  100. $this->info = \app\admin\model\SiteSetting::get(1);
  101. $this->assign('info', $this->info);
  102. $this->assign('site', $this->site);
  103. $this->assign('sys', $mainSite);
  104. $this->theme = strtolower($this->site['theme'] . '/' . $this->request->controller() . '/' . $this->request->action());
  105. }
  106.  
  107. protected function sendEmail($orderId)
  108. {
  109. $order = \app\admin\model\Order::where('id|orderid', '=', $orderId)->find();
  110. $order->kami = nl2br($order->kami);
  111. ........................................................................
  112. ............................................
  113. .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement