Subversion Repositories ALCASAR

Rev

Rev 779 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 779 Rev 780
Line 86... Line 86...
86
					if (count($tmp) == 2){
86
					if (count($tmp) == 2){
87
						$this->_items['protocol'] = $tmp[0];
87
						$this->_items['protocol'] = $tmp[0];
88
						$this->_items['host'] 	= $tmp[1];
88
						$this->_items['host'] 	= $tmp[1];
89
					} else {
89
					} else {
90
						$this->_items['protocol'] = 'ldap';
90
						$this->_items['protocol'] = 'ldap';
91
						$this->_items['host'] 	= $tmp[1];
91
						$this->_items['host'] 	= $tmp[0];
92
					}
92
					}
93
					$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
93
					$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
94
					break;
94
					break;
95
				case "uid":
95
				case "uid":
96
					$this->_items['uid']		= $value;
96
					$this->_items['uid']		= $value;
97
					$this->_items['filter']		= "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
97
					$this->_items['filter']		= "(".$this->_items['uid']."=%{Stripped-User-Name:-%{User-Name}})";
98
					break;
98
					break;
99
				case "filter":
99
				case "filter":
100
					// extract uid
100
					// extract uid
101
					if (preg_match('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`',$value)){
101
					if (preg_match('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`',$value)){
102
						$this->_items['uid'] = preg_replace('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`','$1',$value);
102
						$this->_items['uid'] = preg_replace('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`','$1',$value);
Line 113... Line 113...
113
		}
113
		}
114
	}
114
	}
115
	public function load($confFile){
115
	public function load($confFile){
116
		// use here the parsing class
116
		// use here the parsing class
117
		require_once("configreader.php");
117
		require_once("configreader.php");
118
		
-
 
119
		$r = new configReader($confFile);
118
		$r = new configReader($confFile);
120
		
-
 
121
		/*
119
		/*
122
		loading only if the file containt only one ldap instance.
120
		loading only if the file containt only one ldap instance.
123
		If more instance are found, we use the default values instead.
121
		If more instance are found, we use the default values instead.
124
		*/
122
		*/
125
		if (is_object($r->ldap)){
123
		if (is_object($r->ldap)){
126
			$this->instanceName = $r->ldap->getInstanceName();
124
			$this->instanceName = $r->ldap->getInstanceName();
127
			$items = $r->ldap->getpair();
125
			$items = $r->ldap->getpair();
-
 
126
 
128
			foreach ($this->_items as $key => $value){
127
			foreach ($items as $pair){
-
 
128
				$pairName = $pair->getName();
-
 
129
				$pairValue = $pair->getPair($pairName);
129
				if (array_key_exists($key, $items))
130
				if (array_key_exists($pairName , $this->_items))
130
					$this->_items[$key] = $items[$key];
131
					$this->$pairName = $pairValue; // we use __set() function to have all exceptions!
131
			}
132
			}
132
			if (is_object($r->ldap->tls)){
133
			if (is_object($r->ldap->tls)){
133
				$tls = $r->ldap->tls->getpair();
134
				$tls = $r->ldap->tls->getpair();
-
 
135
				
134
				foreach ($this->_tls as $key => $value){
136
				foreach ($tls as $pair){
-
 
137
					$tlsPairName = $pair->getName();
-
 
138
					$tlsPairValue = $pair->getPair($tlsPairName);
135
					if (array_key_exists($key, $tls))
139
					if (array_key_exists($tlsPairName , $this->_tls))
136
						$this->_tls[$key] = $tls[$key];
140
						$this->$tlsPairName = $pairValue; // we use __set() function to have all exceptions!
137
				}
141
				}
138
			}
142
			}
139
		}
143
		}
140
	}
144
	}
141
	public function __toString() {
145
	public function __toString() {