소스 검색

Refine the authentication ldap class

FusionPBX 2 년 전
부모
커밋
f64cbd63f0
1개의 변경된 파일11개의 추가작업 그리고 32개의 파일을 삭제
  1. 11 32
      core/authentication/resources/classes/plugins/ldap.php

+ 11 - 32
core/authentication/resources/classes/plugins/ldap.php

@@ -27,33 +27,12 @@ class plugin_ldap {
 			if ($_REQUEST["username"]) {
 
 				//pre-process some settings
-					$settings['theme']['favicon'] = !empty($settings['theme']['favicon']) ? $settings['theme']['favicon'] : PROJECT_PATH.'/themes/default/favicon.ico';
-					$settings['login']['destination'] = !empty($settings['login']['destination']) ? $settings['login']['destination'] : '';
-
-				//login logo source
-					if (isset($_SESSION['theme']['logo_login']['text']) && $_SESSION['theme']['logo_login']['text'] != '') {
-						$login_logo_source = $_SESSION['theme']['logo_login']['text'];
-					}
-					else if (isset($_SESSION['theme']['logo']['text']) && $_SESSION['theme']['logo']['text'] != '') {
-						$login_logo_source = $_SESSION['theme']['logo']['text'];
-					}
-					else {
-						$login_logo_source = PROJECT_PATH.'/themes/default/images/logo_login.png';
-					}
-
-				//login logo dimensions
-					if (isset($_SESSION['theme']['login_logo_width']['text']) && $_SESSION['theme']['login_logo_width']['text'] != '') {
-						$login_logo_width = $_SESSION['theme']['login_logo_width']['text'];
-					}
-					else {
-						$login_logo_width = 'auto; max-width: 300px';
-					}
-					if (isset($_SESSION['theme']['login_logo_height']['text']) && $_SESSION['theme']['login_logo_height']['text'] != '') {
-						$login_logo_height = $_SESSION['theme']['login_logo_height']['text'];
-					}
-					else {
-						$login_logo_height = 'auto; max-height: 300px';
-					}
+					$settings['theme']['favicon'] = !empty($_SESSION['theme']['favicon']['text']) ? $_SESSION['theme']['favicon']['text'] : PROJECT_PATH.'/themes/default/favicon.ico';
+					$settings['login']['destination'] = !empty($_SESSION['login']['destination']['text']) ? $_SESSION['login']['destination']['text'] : '';
+					$settings['users']['unique'] = !empty($_SESSION['users']['unique']['text']) ? $_SESSION['users']['unique']['text'] : '';
+					$settings['theme']['logo'] = !empty($_SESSION['theme']['logo']['text']) ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH.'/themes/default/images/logo_login.png';
+					$settings['theme']['login_logo_width'] = !empty($_SESSION['theme']['login_logo_width']['text']) ? $_SESSION['theme']['login_logo_width']['text'] : 'auto; max-width: 300px';
+					$settings['theme']['login_logo_height'] = !empty($_SESSION['theme']['login_logo_height']['text']) ? $_SESSION['theme']['login_logo_height']['text'] : 'auto; max-height: 300px';
 
 				//get the domain
 					$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
@@ -87,9 +66,9 @@ class plugin_ldap {
 					$view->assign("project_path", PROJECT_PATH);
 					$view->assign("login_destination_url", $settings['login']['destination']);
 					$view->assign("favicon", $settings['theme']['favicon']);
-					$view->assign("login_logo_width", $login_logo_width);
-					$view->assign("login_logo_height", $login_logo_height);
-					$view->assign("login_logo_source", $login_logo_source);
+					$view->assign("login_logo_width", $settings['theme']['login_logo_width']);
+					$view->assign("login_logo_height", $settings['theme']['login_logo_height']);
+					$view->assign("login_logo_source", $settings['theme']['logo']);
 
 				//add the token name and hash to the view
 					//$view->assign("token_name", $token['name']);
@@ -147,7 +126,7 @@ class plugin_ldap {
 			 if ($user_authorized) {
 				$sql = "select * from v_users ";
 				$sql .= "where username = :username ";
-				if ($_SESSION["users"]["unique"]["text"] != "global") {
+				if ($settings['users']['unique'] != "global") {
 					//unique username per domain (not globally unique across system - example: email address)
 					$sql .= "and domain_uuid = :domain_uuid ";
 					$parameters['domain_uuid'] = $this->domain_uuid;
@@ -156,7 +135,7 @@ class plugin_ldap {
 				$database = new database;
 				$row = $database->select($sql, $parameters, 'row');
 				if (is_array($row) && @sizeof($row) != 0) {
-					if ($_SESSION["users"]["unique"]["text"] == "global" && $row["domain_uuid"] != $this->domain_uuid) {
+					if ($settings['users']['unique'] == "global" && $row["domain_uuid"] != $this->domain_uuid) {
 						//get the domain uuid
 							$this->domain_uuid = $row["domain_uuid"];
 							$this->domain_name = $_SESSION['domains'][$this->domain_uuid]['domain_name'];