Main.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php namespace Place\Lib;
  2. use Dever;
  3. use Place;
  4. use Dever\Helper\Secure;
  5. use Dever\Route;
  6. class Main
  7. {
  8. protected $login = false;
  9. protected $entry = false;
  10. public function __construct()
  11. {
  12. Place::init();
  13. $t = Dever::input('t');
  14. if ($this->login && !$t) {
  15. $this->showLogin();
  16. }
  17. if ($t) {
  18. if ($t = Secure::checkLogin($t)) {
  19. if ($t['uid'] && $t['uid'] > 0) {
  20. Place::user($t['uid']);
  21. }
  22. if ($this->login && !Place::$uid) {
  23. $this->showLogin();
  24. }
  25. }
  26. }
  27. if ($this->entry) {
  28. if (Place::$info['type'] >= 2 && !Place::$uid) {
  29. Dever::error('您没有权限');
  30. }
  31. /*
  32. if (Place::$member && Place::$user['Main_type'] <= 2) {
  33. Dever::error('您没有权限');
  34. }*/
  35. }
  36. }
  37. protected function showLogin()
  38. {
  39. Dever::error('请先登录', 300);
  40. }
  41. }