From 34395b7a41e28c676367f003073e87825f9f1ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Thu, 24 Feb 2022 16:17:09 +0800 Subject: [PATCH] * adjust for set vision. --- framework/base/router.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index fc6d9824c7..25d3b37a8f 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -697,10 +697,17 @@ class baseRouter if(empty($account) and isset($_POST['account'])) $account = $_POST['account']; if(empty($account) and isset($_GET['account'])) $account = $_GET['account']; - $vision = ''; - if($this->config->installed) $vision = $this->dbh->query("SELECT * FROM " . TABLE_CONFIG . " WHERE owner = '$account' AND `key` = 'vision' LIMIT 1")->fetch(); - if($vision) $vision = $vision->value; - if(!empty($_SESSION['user']->visions) and empty($vision)) list($vision) = explode(',', $_SESSION['user']->visions); + $vision = ''; + if($this->config->installed) + { + $vision = $this->dbh->query("SELECT * FROM " . TABLE_CONFIG . " WHERE owner = '$account' AND `key` = 'vision' LIMIT 1")->fetch(); + if($vision) $vision = $vision->value; + if(empty($vision)) + { + $user = $this->dbh->query("SELECT * FROM " . TABLE_USER . " WHERE account = '$account' AND deleted = '0' LIMIT 1")->fetch(); + if(!empty($user->visions)) list($vision) = explode(',', $user->visions); + } + } list($defaultVision) = explode(',', trim($this->config->visions, ',')); if($vision and strpos($this->config->visions, ",{$vision},") === false) $vision = $defaultVision;