@@ -12,13 +12,13 @@ |
||
12 | 12 | /** |
13 | 13 | * a phpCAS string index |
14 | 14 | */ |
15 | -define("CAS_STR_USING_SERVER", 1); |
|
16 | -define("CAS_STR_AUTHENTICATION_WANTED", 2); |
|
17 | -define("CAS_STR_LOGOUT", 3); |
|
15 | +define("CAS_STR_USING_SERVER", 1); |
|
16 | +define("CAS_STR_AUTHENTICATION_WANTED", 2); |
|
17 | +define("CAS_STR_LOGOUT", 3); |
|
18 | 18 | define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4); |
19 | -define("CAS_STR_AUTHENTICATION_FAILED", 5); |
|
20 | -define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); |
|
21 | -define("CAS_STR_SERVICE_UNAVAILABLE", 7); |
|
19 | +define("CAS_STR_AUTHENTICATION_FAILED", 5); |
|
20 | +define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); |
|
21 | +define("CAS_STR_SERVICE_UNAVAILABLE", 7); |
|
22 | 22 | //@} |
23 | 23 | |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -42,178 +42,178 @@ discard block |
||
42 | 42 | http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/ |
43 | 43 | */ |
44 | 44 | |
45 | -define('DOMXML_LOAD_PARSING',0); |
|
46 | -define('DOMXML_LOAD_VALIDATING',1); |
|
47 | -define('DOMXML_LOAD_RECOVERING',2); |
|
48 | -define('DOMXML_LOAD_SUBSTITUTE_ENTITIES',4); |
|
45 | +define('DOMXML_LOAD_PARSING', 0); |
|
46 | +define('DOMXML_LOAD_VALIDATING', 1); |
|
47 | +define('DOMXML_LOAD_RECOVERING', 2); |
|
48 | +define('DOMXML_LOAD_SUBSTITUTE_ENTITIES', 4); |
|
49 | 49 | //define('DOMXML_LOAD_COMPLETE_ATTRS',8); |
50 | -define('DOMXML_LOAD_DONT_KEEP_BLANKS',16); |
|
50 | +define('DOMXML_LOAD_DONT_KEEP_BLANKS', 16); |
|
51 | 51 | |
52 | -function domxml_new_doc($version) {return new php4DOMDocument();} |
|
53 | -function domxml_new_xmldoc($version) {return new php4DOMDocument();} |
|
54 | -function domxml_open_file($filename,$mode=DOMXML_LOAD_PARSING,&$error=null) |
|
52 | +function domxml_new_doc($version) {return new php4DOMDocument(); } |
|
53 | +function domxml_new_xmldoc($version) {return new php4DOMDocument(); } |
|
54 | +function domxml_open_file($filename, $mode = DOMXML_LOAD_PARSING, &$error = null) |
|
55 | 55 | { |
56 | - $dom=new php4DOMDocument($mode); |
|
57 | - $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
56 | + $dom = new php4DOMDocument($mode); |
|
57 | + $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
58 | 58 | if ($errorMode) libxml_use_internal_errors(true); |
59 | - if (!$dom->myDOMNode->load($filename)) $dom=null; |
|
59 | + if (!$dom->myDOMNode->load($filename)) $dom = null; |
|
60 | 60 | if ($errorMode) |
61 | 61 | { |
62 | - $error=array_map('_error_report',libxml_get_errors()); |
|
62 | + $error = array_map('_error_report', libxml_get_errors()); |
|
63 | 63 | libxml_clear_errors(); |
64 | 64 | } |
65 | 65 | return $dom; |
66 | 66 | } |
67 | -function domxml_open_mem($str,$mode=DOMXML_LOAD_PARSING,&$error=null) |
|
67 | +function domxml_open_mem($str, $mode = DOMXML_LOAD_PARSING, &$error = null) |
|
68 | 68 | { |
69 | - $dom=new php4DOMDocument($mode); |
|
70 | - $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
69 | + $dom = new php4DOMDocument($mode); |
|
70 | + $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
71 | 71 | if ($errorMode) libxml_use_internal_errors(true); |
72 | - if (!$dom->myDOMNode->loadXML($str)) $dom=null; |
|
72 | + if (!$dom->myDOMNode->loadXML($str)) $dom = null; |
|
73 | 73 | if ($errorMode) |
74 | 74 | { |
75 | - $error=array_map('_error_report',libxml_get_errors()); |
|
75 | + $error = array_map('_error_report', libxml_get_errors()); |
|
76 | 76 | libxml_clear_errors(); |
77 | 77 | } |
78 | 78 | return $dom; |
79 | 79 | } |
80 | -function html_doc($html_doc,$from_file=false) |
|
80 | +function html_doc($html_doc, $from_file = false) |
|
81 | 81 | { |
82 | - $dom=new php4DOMDocument(); |
|
83 | - if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | - else $result=$dom->myDOMNode->loadHTML($html_doc); |
|
82 | + $dom = new php4DOMDocument(); |
|
83 | + if ($from_file) $result = $dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | + else $result = $dom->myDOMNode->loadHTML($html_doc); |
|
85 | 85 | return $result ? $dom : null; |
86 | 86 | } |
87 | -function html_doc_file($filename) {return html_doc($filename,true);} |
|
88 | -function xmldoc($str) {return domxml_open_mem($str);} |
|
89 | -function xmldocfile($filename) {return domxml_open_file($filename);} |
|
90 | -function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->xpath_eval($eval_str,$contextnode);} |
|
91 | -function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);} |
|
92 | -function xpath_register_ns($xpath_context,$prefix,$namespaceURI) {return $xpath_context->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
93 | -function _entityDecode($text) {return html_entity_decode(strtr($text,array('''=>'\'')),ENT_QUOTES,'UTF-8');} |
|
94 | -function _error_report($error) {return array('errormessage'=>$error->message,'nodename'=>'','line'=>$error->line,'col'=>$error->column)+($error->file==''?array():array('directory'=>dirname($error->file),'file'=>basename($error->file)));} |
|
87 | +function html_doc_file($filename) {return html_doc($filename, true); } |
|
88 | +function xmldoc($str) {return domxml_open_mem($str); } |
|
89 | +function xmldocfile($filename) {return domxml_open_file($filename); } |
|
90 | +function xpath_eval($xpath_context, $eval_str, $contextnode = null) {return $xpath_context->xpath_eval($eval_str, $contextnode); } |
|
91 | +function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document); } |
|
92 | +function xpath_register_ns($xpath_context, $prefix, $namespaceURI) {return $xpath_context->myDOMXPath->registerNamespace($prefix, $namespaceURI); } |
|
93 | +function _entityDecode($text) {return html_entity_decode(strtr($text, array('''=>'\'')), ENT_QUOTES, 'UTF-8'); } |
|
94 | +function _error_report($error) {return array('errormessage'=>$error->message, 'nodename'=>'', 'line'=>$error->line, 'col'=>$error->column) + ($error->file == '' ? array() : array('directory'=>dirname($error->file), 'file'=>basename($error->file))); } |
|
95 | 95 | |
96 | 96 | class php4DOMAttr extends php4DOMNode |
97 | 97 | { |
98 | 98 | function __get($name) |
99 | 99 | { |
100 | - if ($name==='name') return $this->myDOMNode->name; |
|
100 | + if ($name === 'name') return $this->myDOMNode->name; |
|
101 | 101 | else return parent::__get($name); |
102 | 102 | } |
103 | - function name() {return $this->myDOMNode->name;} |
|
103 | + function name() {return $this->myDOMNode->name; } |
|
104 | 104 | function set_content($text) {} |
105 | 105 | //function set_value($content) {return $this->myDOMNode->value=htmlspecialchars($content,ENT_QUOTES);} |
106 | - function specified() {return $this->myDOMNode->specified;} |
|
107 | - function value() {return $this->myDOMNode->value;} |
|
106 | + function specified() {return $this->myDOMNode->specified; } |
|
107 | + function value() {return $this->myDOMNode->value; } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | class php4DOMDocument extends php4DOMNode |
111 | 111 | { |
112 | - function php4DOMDocument($mode=DOMXML_LOAD_PARSING) |
|
112 | + function php4DOMDocument($mode = DOMXML_LOAD_PARSING) |
|
113 | 113 | { |
114 | - $this->myDOMNode=new DOMDocument(); |
|
115 | - $this->myOwnerDocument=$this; |
|
116 | - if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true; |
|
117 | - if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true; |
|
118 | - if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true; |
|
119 | - if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false; |
|
114 | + $this->myDOMNode = new DOMDocument(); |
|
115 | + $this->myOwnerDocument = $this; |
|
116 | + if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse = true; |
|
117 | + if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover = true; |
|
118 | + if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities = true; |
|
119 | + if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace = false; |
|
120 | 120 | } |
121 | 121 | function add_root($name) |
122 | 122 | { |
123 | 123 | if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
124 | - return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument); |
|
124 | + return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)), $this->myOwnerDocument); |
|
125 | 125 | } |
126 | - function create_attribute($name,$value) |
|
126 | + function create_attribute($name, $value) |
|
127 | 127 | { |
128 | - $myAttr=$this->myDOMNode->createAttribute($name); |
|
129 | - $myAttr->value=htmlspecialchars($value,ENT_QUOTES); |
|
130 | - return new php4DOMAttr($myAttr,$this); |
|
128 | + $myAttr = $this->myDOMNode->createAttribute($name); |
|
129 | + $myAttr->value = htmlspecialchars($value, ENT_QUOTES); |
|
130 | + return new php4DOMAttr($myAttr, $this); |
|
131 | 131 | } |
132 | - function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);} |
|
133 | - function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);} |
|
134 | - function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);} |
|
135 | - function create_element_ns($uri,$name,$prefix=null) |
|
132 | + function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content), $this); } |
|
133 | + function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data), $this); } |
|
134 | + function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name), $this); } |
|
135 | + function create_element_ns($uri, $name, $prefix = null) |
|
136 | 136 | { |
137 | - if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri); |
|
138 | - if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri)); |
|
139 | - return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this); |
|
137 | + if ($prefix == null) $prefix = $this->myDOMNode->lookupPrefix($uri); |
|
138 | + if (($prefix == null) && (($this->myDOMNode->documentElement == null) || (!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix = 'a'.sprintf('%u', crc32($uri)); |
|
139 | + return new php4DOMElement($this->myDOMNode->createElementNS($uri, $prefix == null ? $name : $prefix.':'.$name), $this); |
|
140 | 140 | } |
141 | - function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22 |
|
142 | - function create_processing_instruction($target,$data=''){return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target,$data),$this);} |
|
143 | - function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content),$this);} |
|
144 | - function document_element() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
145 | - function dump_file($filename,$compressionmode=false,$format=false) |
|
141 | + function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content), $this); } //By Walter Ebert 2007-01-22 |
|
142 | + function create_processing_instruction($target, $data = '') {return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target, $data), $this); } |
|
143 | + function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content), $this); } |
|
144 | + function document_element() {return parent::_newDOMElement($this->myDOMNode->documentElement, $this); } |
|
145 | + function dump_file($filename, $compressionmode = false, $format = false) |
|
146 | 146 | { |
147 | - $format0=$this->myDOMNode->formatOutput; |
|
148 | - $this->myDOMNode->formatOutput=$format; |
|
149 | - $res=$this->myDOMNode->save($filename); |
|
150 | - $this->myDOMNode->formatOutput=$format0; |
|
147 | + $format0 = $this->myDOMNode->formatOutput; |
|
148 | + $this->myDOMNode->formatOutput = $format; |
|
149 | + $res = $this->myDOMNode->save($filename); |
|
150 | + $this->myDOMNode->formatOutput = $format0; |
|
151 | 151 | return $res; |
152 | 152 | } |
153 | - function dump_mem($format=false,$encoding=false) |
|
153 | + function dump_mem($format = false, $encoding = false) |
|
154 | 154 | { |
155 | - $format0=$this->myDOMNode->formatOutput; |
|
156 | - $this->myDOMNode->formatOutput=$format; |
|
157 | - $encoding0=$this->myDOMNode->encoding; |
|
158 | - if ($encoding) $this->myDOMNode->encoding=$encoding; |
|
159 | - $dump=$this->myDOMNode->saveXML(); |
|
160 | - $this->myDOMNode->formatOutput=$format0; |
|
161 | - if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding |
|
155 | + $format0 = $this->myDOMNode->formatOutput; |
|
156 | + $this->myDOMNode->formatOutput = $format; |
|
157 | + $encoding0 = $this->myDOMNode->encoding; |
|
158 | + if ($encoding) $this->myDOMNode->encoding = $encoding; |
|
159 | + $dump = $this->myDOMNode->saveXML(); |
|
160 | + $this->myDOMNode->formatOutput = $format0; |
|
161 | + if ($encoding) $this->myDOMNode->encoding = $encoding0 == '' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding |
|
162 | 162 | return $dump; |
163 | 163 | } |
164 | 164 | function free() |
165 | 165 | { |
166 | 166 | if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
167 | - $this->myDOMNode=null; |
|
168 | - $this->myOwnerDocument=null; |
|
167 | + $this->myDOMNode = null; |
|
168 | + $this->myOwnerDocument = null; |
|
169 | 169 | } |
170 | - function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);} |
|
170 | + function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id), $this); } |
|
171 | 171 | function get_elements_by_tagname($name) |
172 | 172 | { |
173 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
174 | - $nodeSet=array(); |
|
175 | - $i=0; |
|
173 | + $myDOMNodeList = $this->myDOMNode->getElementsByTagName($name); |
|
174 | + $nodeSet = array(); |
|
175 | + $i = 0; |
|
176 | 176 | if (isset($myDOMNodeList)) |
177 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
177 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = new php4DOMElement($node, $this); |
|
178 | 178 | return $nodeSet; |
179 | 179 | } |
180 | - function html_dump_mem() {return $this->myDOMNode->saveHTML();} |
|
181 | - function root() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
182 | - function xinclude() {return $this->myDOMNode->xinclude();} |
|
183 | - function xpath_new_context() {return new php4DOMXPath($this);} |
|
180 | + function html_dump_mem() {return $this->myDOMNode->saveHTML(); } |
|
181 | + function root() {return parent::_newDOMElement($this->myDOMNode->documentElement, $this); } |
|
182 | + function xinclude() {return $this->myDOMNode->xinclude(); } |
|
183 | + function xpath_new_context() {return new php4DOMXPath($this); } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | class php4DOMElement extends php4DOMNode |
187 | 187 | { |
188 | - function add_namespace($uri,$prefix) |
|
188 | + function add_namespace($uri, $prefix) |
|
189 | 189 | { |
190 | - if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false; |
|
190 | + if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/', $prefix)) return false; |
|
191 | 191 | else |
192 | 192 | { |
193 | - $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08 |
|
193 | + $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:'.$prefix, $uri); //By Daniel Walker 2006-09-08 |
|
194 | 194 | return true; |
195 | 195 | } |
196 | 196 | } |
197 | - function get_attribute($name) {return $this->myDOMNode->getAttribute($name);} |
|
198 | - function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name),$this->myOwnerDocument);} |
|
197 | + function get_attribute($name) {return $this->myDOMNode->getAttribute($name); } |
|
198 | + function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name), $this->myOwnerDocument); } |
|
199 | 199 | function get_elements_by_tagname($name) |
200 | 200 | { |
201 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
202 | - $nodeSet=array(); |
|
203 | - $i=0; |
|
201 | + $myDOMNodeList = $this->myDOMNode->getElementsByTagName($name); |
|
202 | + $nodeSet = array(); |
|
203 | + $i = 0; |
|
204 | 204 | if (isset($myDOMNodeList)) |
205 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
205 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = new php4DOMElement($node, $this->myOwnerDocument); |
|
206 | 206 | return $nodeSet; |
207 | 207 | } |
208 | - function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);} |
|
209 | - function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);} |
|
210 | - function set_attribute($name,$value) |
|
208 | + function has_attribute($name) {return $this->myDOMNode->hasAttribute($name); } |
|
209 | + function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name); } |
|
210 | + function set_attribute($name, $value) |
|
211 | 211 | { |
212 | 212 | //return $this->myDOMNode->setAttribute($name,$value); //Does not return a DomAttr |
213 | - $myAttr=$this->myDOMNode->ownerDocument->createAttribute($name); |
|
214 | - $myAttr->value=htmlspecialchars($value,ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
213 | + $myAttr = $this->myDOMNode->ownerDocument->createAttribute($name); |
|
214 | + $myAttr->value = htmlspecialchars($value, ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
215 | 215 | $this->myDOMNode->setAttributeNode($myAttr); |
216 | - return new php4DOMAttr($myAttr,$this->myOwnerDocument); |
|
216 | + return new php4DOMAttr($myAttr, $this->myOwnerDocument); |
|
217 | 217 | } |
218 | 218 | /*function set_attribute_node($attr) |
219 | 219 | { |
@@ -222,186 +222,186 @@ discard block |
||
222 | 222 | }*/ |
223 | 223 | function set_name($name) |
224 | 224 | { |
225 | - if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
226 | - else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name); |
|
227 | - $myDOMNodeList=$this->myDOMNode->attributes; |
|
228 | - $i=0; |
|
225 | + if ($this->myDOMNode->prefix == '') $newNode = $this->myDOMNode->ownerDocument->createElement($name); |
|
226 | + else $newNode = $this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI, $this->myDOMNode->prefix.':'.$name); |
|
227 | + $myDOMNodeList = $this->myDOMNode->attributes; |
|
228 | + $i = 0; |
|
229 | 229 | if (isset($myDOMNodeList)) |
230 | - while ($node=$myDOMNodeList->item($i++)) |
|
231 | - if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value); |
|
232 | - else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value); |
|
233 | - $myDOMNodeList=$this->myDOMNode->childNodes; |
|
230 | + while ($node = $myDOMNodeList->item($i++)) |
|
231 | + if ($node->namespaceURI == '') $newNode->setAttribute($node->name, $node->value); |
|
232 | + else $newNode->setAttributeNS($node->namespaceURI, $node->nodeName, $node->value); |
|
233 | + $myDOMNodeList = $this->myDOMNode->childNodes; |
|
234 | 234 | if (isset($myDOMNodeList)) |
235 | - while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
236 | - $this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode); |
|
237 | - $this->myDOMNode=$newNode; |
|
235 | + while ($node = $myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
236 | + $this->myDOMNode->parentNode->replaceChild($newNode, $this->myDOMNode); |
|
237 | + $this->myDOMNode = $newNode; |
|
238 | 238 | return true; |
239 | 239 | } |
240 | - function tagname() {return $this->tagname;} |
|
240 | + function tagname() {return $this->tagname; } |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | class php4DOMNode |
244 | 244 | { |
245 | 245 | public $myDOMNode; |
246 | 246 | public $myOwnerDocument; |
247 | - function php4DOMNode($aDomNode,$aOwnerDocument) |
|
247 | + function php4DOMNode($aDomNode, $aOwnerDocument) |
|
248 | 248 | { |
249 | - $this->myDOMNode=$aDomNode; |
|
250 | - $this->myOwnerDocument=$aOwnerDocument; |
|
249 | + $this->myDOMNode = $aDomNode; |
|
250 | + $this->myOwnerDocument = $aOwnerDocument; |
|
251 | 251 | } |
252 | 252 | function __get($name) |
253 | 253 | { |
254 | 254 | switch ($name) |
255 | 255 | { |
256 | 256 | case 'type': return $this->myDOMNode->nodeType; |
257 | - case 'tagname': return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement |
|
257 | + case 'tagname': return ($this->myDOMNode->nodeType === XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement |
|
258 | 258 | case 'content': return $this->myDOMNode->textContent; |
259 | 259 | case 'value': return $this->myDOMNode->value; |
260 | 260 | default: |
261 | - $myErrors=debug_backtrace(); |
|
262 | - trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE); |
|
261 | + $myErrors = debug_backtrace(); |
|
262 | + trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']', E_USER_NOTICE); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | } |
266 | - function add_child($newnode) {return append_child($newnode);} |
|
267 | - function add_namespace($uri,$prefix) {return false;} |
|
268 | - function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
269 | - function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
266 | + function add_child($newnode) {return append_child($newnode); } |
|
267 | + function add_namespace($uri, $prefix) {return false; } |
|
268 | + function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)), $this->myOwnerDocument); } |
|
269 | + function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)), $this->myOwnerDocument); } |
|
270 | 270 | function attributes() |
271 | 271 | { |
272 | - $myDOMNodeList=$this->myDOMNode->attributes; |
|
273 | - if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null; |
|
274 | - $nodeSet=array(); |
|
275 | - $i=0; |
|
276 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); |
|
272 | + $myDOMNodeList = $this->myDOMNode->attributes; |
|
273 | + if (!(isset($myDOMNodeList) && $this->myDOMNode->hasAttributes())) return null; |
|
274 | + $nodeSet = array(); |
|
275 | + $i = 0; |
|
276 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = new php4DOMAttr($node, $this->myOwnerDocument); |
|
277 | 277 | return $nodeSet; |
278 | 278 | } |
279 | 279 | function child_nodes() |
280 | 280 | { |
281 | - $myDOMNodeList=$this->myDOMNode->childNodes; |
|
282 | - $nodeSet=array(); |
|
283 | - $i=0; |
|
281 | + $myDOMNodeList = $this->myDOMNode->childNodes; |
|
282 | + $nodeSet = array(); |
|
283 | + $i = 0; |
|
284 | 284 | if (isset($myDOMNodeList)) |
285 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
285 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = self::_newDOMElement($node, $this->myOwnerDocument); |
|
286 | 286 | return $nodeSet; |
287 | 287 | } |
288 | - function children() {return $this->child_nodes();} |
|
289 | - function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);} |
|
288 | + function children() {return $this->child_nodes(); } |
|
289 | + function clone_node($deep = false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep), $this->myOwnerDocument); } |
|
290 | 290 | //dump_node($node) should only be called on php4DOMDocument |
291 | - function dump_node($node=null) {return $node==null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode);} |
|
292 | - function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);} |
|
293 | - function get_content() {return $this->myDOMNode->textContent;} |
|
294 | - function has_attributes() {return $this->myDOMNode->hasAttributes();} |
|
295 | - function has_child_nodes() {return $this->myDOMNode->hasChildNodes();} |
|
296 | - function insert_before($newnode,$refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode),$refnode==null?null:$refnode->myDOMNode),$this->myOwnerDocument);} |
|
297 | - function is_blank_node() {return ($this->myDOMNode->nodeType===XML_TEXT_NODE)&&preg_match('%^\s*$%',$this->myDOMNode->nodeValue);} |
|
298 | - function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);} |
|
299 | - function new_child($name,$content) |
|
291 | + function dump_node($node = null) {return $node == null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode); } |
|
292 | + function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild, $this->myOwnerDocument); } |
|
293 | + function get_content() {return $this->myDOMNode->textContent; } |
|
294 | + function has_attributes() {return $this->myDOMNode->hasAttributes(); } |
|
295 | + function has_child_nodes() {return $this->myDOMNode->hasChildNodes(); } |
|
296 | + function insert_before($newnode, $refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode), $refnode == null ? null : $refnode->myDOMNode), $this->myOwnerDocument); } |
|
297 | + function is_blank_node() {return ($this->myDOMNode->nodeType === XML_TEXT_NODE) && preg_match('%^\s*$%', $this->myDOMNode->nodeValue); } |
|
298 | + function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild, $this->myOwnerDocument); } |
|
299 | + function new_child($name, $content) |
|
300 | 300 | { |
301 | - $mySubNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
301 | + $mySubNode = $this->myDOMNode->ownerDocument->createElement($name); |
|
302 | 302 | $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content))); |
303 | 303 | $this->myDOMNode->appendChild($mySubNode); |
304 | - return new php4DOMElement($mySubNode,$this->myOwnerDocument); |
|
304 | + return new php4DOMElement($mySubNode, $this->myOwnerDocument); |
|
305 | 305 | } |
306 | - function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);} |
|
307 | - function node_name() {return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName;} //Avoid namespace prefix for DOMElement |
|
308 | - function node_type() {return $this->myDOMNode->nodeType;} |
|
309 | - function node_value() {return $this->myDOMNode->nodeValue;} |
|
310 | - function owner_document() {return $this->myOwnerDocument;} |
|
311 | - function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);} |
|
312 | - function prefix() {return $this->myDOMNode->prefix;} |
|
313 | - function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);} |
|
314 | - function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);} |
|
315 | - function replace_child($newnode,$oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode),$oldnode->myDOMNode),$this->myOwnerDocument);} |
|
316 | - function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode),$this->myDOMNode),$this->myOwnerDocument);} |
|
317 | - function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text)));} //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
306 | + function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling, $this->myOwnerDocument); } |
|
307 | + function node_name() {return ($this->myDOMNode->nodeType === XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName; } //Avoid namespace prefix for DOMElement |
|
308 | + function node_type() {return $this->myDOMNode->nodeType; } |
|
309 | + function node_value() {return $this->myDOMNode->nodeValue; } |
|
310 | + function owner_document() {return $this->myOwnerDocument; } |
|
311 | + function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode, $this->myOwnerDocument); } |
|
312 | + function prefix() {return $this->myDOMNode->prefix; } |
|
313 | + function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling, $this->myOwnerDocument); } |
|
314 | + function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode), $this->myOwnerDocument); } |
|
315 | + function replace_child($newnode, $oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode), $oldnode->myDOMNode), $this->myOwnerDocument); } |
|
316 | + function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode), $this->myDOMNode), $this->myOwnerDocument); } |
|
317 | + function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text))); } //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
318 | 318 | //function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);} |
319 | - function set_namespace($uri,$prefix=null) |
|
319 | + function set_namespace($uri, $prefix = null) |
|
320 | 320 | {//Contributions by Daniel Walker 2006-09-08 |
321 | - $nsprefix=$this->myDOMNode->lookupPrefix($uri); |
|
322 | - if ($nsprefix==null) |
|
321 | + $nsprefix = $this->myDOMNode->lookupPrefix($uri); |
|
322 | + if ($nsprefix == null) |
|
323 | 323 | { |
324 | - $nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix; |
|
325 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
324 | + $nsprefix = $prefix == null ? $nsprefix = 'a'.sprintf('%u', crc32($uri)) : $prefix; |
|
325 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) |
|
326 | 326 | { |
327 | - if (($prefix!=null)&&$this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)&& |
|
328 | - ($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)!=$uri)) |
|
327 | + if (($prefix != null) && $this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/', $nsprefix) && |
|
328 | + ($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/', $nsprefix) != $uri)) |
|
329 | 329 | {//Remove namespace |
330 | - $parent=$this->myDOMNode->ownerElement; |
|
330 | + $parent = $this->myDOMNode->ownerElement; |
|
331 | 331 | $parent->removeAttributeNode($this->myDOMNode); |
332 | - $parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
333 | - $this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName); |
|
332 | + $parent->setAttribute($this->myDOMNode->localName, $this->myDOMNode->nodeValue); |
|
333 | + $this->myDOMNode = $parent->getAttributeNode($this->myDOMNode->localName); |
|
334 | 334 | return; |
335 | 335 | } |
336 | - $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri); |
|
336 | + $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:'.$nsprefix, $uri); |
|
337 | 337 | } |
338 | 338 | } |
339 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
339 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) |
|
340 | 340 | { |
341 | - $parent=$this->myDOMNode->ownerElement; |
|
341 | + $parent = $this->myDOMNode->ownerElement; |
|
342 | 342 | $parent->removeAttributeNode($this->myDOMNode); |
343 | - $parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
344 | - $this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName); |
|
343 | + $parent->setAttributeNS($uri, $nsprefix.':'.$this->myDOMNode->localName, $this->myDOMNode->nodeValue); |
|
344 | + $this->myDOMNode = $parent->getAttributeNodeNS($uri, $this->myDOMNode->localName); |
|
345 | 345 | } |
346 | - elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
346 | + elseif ($this->myDOMNode->nodeType === XML_ELEMENT_NODE) |
|
347 | 347 | { |
348 | - $NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName); |
|
348 | + $NewNode = $this->myDOMNode->ownerDocument->createElementNS($uri, $nsprefix.':'.$this->myDOMNode->localName); |
|
349 | 349 | foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true)); |
350 | 350 | foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true)); |
351 | - $xpath=new DOMXPath($this->myDOMNode->ownerDocument); |
|
352 | - $myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces |
|
353 | - foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue); |
|
354 | - $this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode); |
|
355 | - $this->myDOMNode=$NewNode; |
|
351 | + $xpath = new DOMXPath($this->myDOMNode->ownerDocument); |
|
352 | + $myDOMNodeList = $xpath->query('namespace::*[name()!="xml"]', $this->myDOMNode); //Add old namespaces |
|
353 | + foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/', $n->nodeName, $n->nodeValue); |
|
354 | + $this->myDOMNode->parentNode->replaceChild($NewNode, $this->myDOMNode); |
|
355 | + $this->myDOMNode = $NewNode; |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | function unlink_node() |
359 | 359 | { |
360 | - if ($this->myDOMNode->parentNode!=null) |
|
360 | + if ($this->myDOMNode->parentNode != null) |
|
361 | 361 | { |
362 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
362 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
363 | 363 | else $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
364 | 364 | } |
365 | 365 | } |
366 | - protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument |
|
367 | - static function _newDOMElement($aDOMNode,$aOwnerDocument) |
|
366 | + protected function _importNode($newnode) {return $this->myOwnerDocument === $newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode, true); } //To import DOMNode from another DOMDocument |
|
367 | + static function _newDOMElement($aDOMNode, $aOwnerDocument) |
|
368 | 368 | {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper |
369 | - if ($aDOMNode==null) return null; |
|
369 | + if ($aDOMNode == null) return null; |
|
370 | 370 | switch ($aDOMNode->nodeType) |
371 | 371 | { |
372 | - case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument); |
|
373 | - case XML_TEXT_NODE: return new php4DOMText($aDOMNode,$aOwnerDocument); |
|
374 | - case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode,$aOwnerDocument); |
|
375 | - case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode,$aOwnerDocument); |
|
376 | - default: return new php4DOMNode($aDOMNode,$aOwnerDocument); |
|
372 | + case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode, $aOwnerDocument); |
|
373 | + case XML_TEXT_NODE: return new php4DOMText($aDOMNode, $aOwnerDocument); |
|
374 | + case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode, $aOwnerDocument); |
|
375 | + case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode, $aOwnerDocument); |
|
376 | + default: return new php4DOMNode($aDOMNode, $aOwnerDocument); |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | class php4DomProcessingInstruction extends php4DOMNode |
382 | 382 | { |
383 | - function data() {return $this->myDOMNode->data;} |
|
384 | - function target() {return $this->myDOMNode->target;} |
|
383 | + function data() {return $this->myDOMNode->data; } |
|
384 | + function target() {return $this->myDOMNode->target; } |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | class php4DOMText extends php4DOMNode |
388 | 388 | { |
389 | 389 | function __get($name) |
390 | 390 | { |
391 | - if ($name==='tagname') return '#text'; |
|
391 | + if ($name === 'tagname') return '#text'; |
|
392 | 392 | else return parent::__get($name); |
393 | 393 | } |
394 | - function tagname() {return '#text';} |
|
395 | - function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;} |
|
394 | + function tagname() {return '#text'; } |
|
395 | + function set_content($text) {$this->myDOMNode->nodeValue = $text; return true; } |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if (!defined('XPATH_NODESET')) |
399 | 399 | { |
400 | - define('XPATH_UNDEFINED',0); |
|
401 | - define('XPATH_NODESET',1); |
|
402 | - define('XPATH_BOOLEAN',2); |
|
403 | - define('XPATH_NUMBER',3); |
|
404 | - define('XPATH_STRING',4); |
|
400 | + define('XPATH_UNDEFINED', 0); |
|
401 | + define('XPATH_NODESET', 1); |
|
402 | + define('XPATH_BOOLEAN', 2); |
|
403 | + define('XPATH_NUMBER', 3); |
|
404 | + define('XPATH_STRING', 4); |
|
405 | 405 | /*define('XPATH_POINT',5); |
406 | 406 | define('XPATH_RANGE',6); |
407 | 407 | define('XPATH_LOCATIONSET',7); |
@@ -413,36 +413,36 @@ discard block |
||
413 | 413 | { |
414 | 414 | private $myDOMNodelist; |
415 | 415 | public $nodeset; |
416 | - public $type=XPATH_UNDEFINED; |
|
416 | + public $type = XPATH_UNDEFINED; |
|
417 | 417 | public $value; |
418 | - function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) |
|
418 | + function php4DOMNodelist($aDOMNodelist, $aOwnerDocument) |
|
419 | 419 | { |
420 | 420 | if (!isset($aDOMNodelist)) return; |
421 | - elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
421 | + elseif (is_object($aDOMNodelist) || is_array($aDOMNodelist)) |
|
422 | 422 | { |
423 | - if ($aDOMNodelist->length>0) |
|
423 | + if ($aDOMNodelist->length > 0) |
|
424 | 424 | { |
425 | - $this->myDOMNodelist=$aDOMNodelist; |
|
426 | - $this->nodeset=array(); |
|
427 | - $this->type=XPATH_NODESET; |
|
428 | - $i=0; |
|
429 | - while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument); |
|
425 | + $this->myDOMNodelist = $aDOMNodelist; |
|
426 | + $this->nodeset = array(); |
|
427 | + $this->type = XPATH_NODESET; |
|
428 | + $i = 0; |
|
429 | + while ($node = $this->myDOMNodelist->item($i++)) $this->nodeset[] = php4DOMNode::_newDOMElement($node, $aOwnerDocument); |
|
430 | 430 | } |
431 | 431 | } |
432 | - elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
432 | + elseif (is_int($aDOMNodelist) || is_float($aDOMNodelist)) |
|
433 | 433 | { |
434 | - $this->type=XPATH_NUMBER; |
|
435 | - $this->value=$aDOMNodelist; |
|
434 | + $this->type = XPATH_NUMBER; |
|
435 | + $this->value = $aDOMNodelist; |
|
436 | 436 | } |
437 | 437 | elseif (is_bool($aDOMNodelist)) |
438 | 438 | { |
439 | - $this->type=XPATH_BOOLEAN; |
|
440 | - $this->value=$aDOMNodelist; |
|
439 | + $this->type = XPATH_BOOLEAN; |
|
440 | + $this->value = $aDOMNodelist; |
|
441 | 441 | } |
442 | 442 | elseif (is_string($aDOMNodelist)) |
443 | 443 | { |
444 | - $this->type=XPATH_STRING; |
|
445 | - $this->value=$aDOMNodelist; |
|
444 | + $this->type = XPATH_STRING; |
|
445 | + $this->value = $aDOMNodelist; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -454,46 +454,46 @@ discard block |
||
454 | 454 | function php4DOMXPath($dom_document) |
455 | 455 | { |
456 | 456 | //TODO: If $dom_document is a DomElement, make that default $contextnode and modify XPath. Ex: '/test' |
457 | - $this->myOwnerDocument=$dom_document->myOwnerDocument; |
|
458 | - $this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode); |
|
457 | + $this->myOwnerDocument = $dom_document->myOwnerDocument; |
|
458 | + $this->myDOMXPath = new DOMXPath($this->myOwnerDocument->myDOMNode); |
|
459 | 459 | } |
460 | - function xpath_eval($eval_str,$contextnode=null) |
|
460 | + function xpath_eval($eval_str, $contextnode = null) |
|
461 | 461 | { |
462 | - if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
|
463 | - else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str); |
|
464 | - $xp=new php4DOMNodelist($xp,$this->myOwnerDocument); |
|
465 | - return ($xp->type===XPATH_UNDEFINED) ? false : $xp; |
|
462 | + if (method_exists($this->myDOMXPath, 'evaluate')) $xp = isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str, $contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
|
463 | + else $xp = isset($contextnode) ? $this->myDOMXPath->query($eval_str, $contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str); |
|
464 | + $xp = new php4DOMNodelist($xp, $this->myOwnerDocument); |
|
465 | + return ($xp->type === XPATH_UNDEFINED) ? false : $xp; |
|
466 | 466 | } |
467 | - function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
467 | + function xpath_register_ns($prefix, $namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix, $namespaceURI); } |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | if (extension_loaded('xsl')) |
471 | 471 | {//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/ |
472 | - function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));} |
|
473 | - function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);} |
|
474 | - function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));} |
|
472 | + function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring)); } |
|
473 | + function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document); } |
|
474 | + function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile)); } |
|
475 | 475 | class php4DomXsltStylesheet |
476 | 476 | { |
477 | 477 | private $myxsltProcessor; |
478 | 478 | function php4DomXsltStylesheet($dom_document) |
479 | 479 | { |
480 | - $this->myxsltProcessor=new xsltProcessor(); |
|
480 | + $this->myxsltProcessor = new xsltProcessor(); |
|
481 | 481 | $this->myxsltProcessor->importStyleSheet($dom_document); |
482 | 482 | } |
483 | - function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) |
|
483 | + function process($dom_document, $xslt_parameters = array(), $param_is_xpath = false) |
|
484 | 484 | { |
485 | - foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value); |
|
486 | - $myphp4DOMDocument=new php4DOMDocument(); |
|
487 | - $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); |
|
485 | + foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('', $param, $value); |
|
486 | + $myphp4DOMDocument = new php4DOMDocument(); |
|
487 | + $myphp4DOMDocument->myDOMNode = $this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); |
|
488 | 488 | return $myphp4DOMDocument; |
489 | 489 | } |
490 | - function result_dump_file($dom_document,$filename) |
|
490 | + function result_dump_file($dom_document, $filename) |
|
491 | 491 | { |
492 | - $html=$dom_document->myDOMNode->saveHTML(); |
|
493 | - file_put_contents($filename,$html); |
|
492 | + $html = $dom_document->myDOMNode->saveHTML(); |
|
493 | + file_put_contents($filename, $html); |
|
494 | 494 | return $html; |
495 | 495 | } |
496 | - function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();} |
|
496 | + function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML(); } |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | ?> |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function HTMLFilterOutput($str) |
82 | 82 | { |
83 | - $str = str_replace('__CAS_VERSION__',$this->getServerVersion(),$str); |
|
84 | - $str = str_replace('__PHPCAS_VERSION__',phpCAS::getVersion(),$str); |
|
85 | - $str = str_replace('__SERVER_BASE_URL__',$this->getServerBaseURL(),$str); |
|
83 | + $str = str_replace('__CAS_VERSION__', $this->getServerVersion(), $str); |
|
84 | + $str = str_replace('__PHPCAS_VERSION__', phpCAS::getVersion(), $str); |
|
85 | + $str = str_replace('__SERVER_BASE_URL__', $this->getServerBaseURL(), $str); |
|
86 | 86 | echo $str; |
87 | 87 | } |
88 | 88 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function printHTMLFooter() |
137 | 137 | { |
138 | 138 | $this->HTMLFilterOutput(empty($this->_output_footer) |
139 | - ?('<hr><address>phpCAS __PHPCAS_VERSION__ '.$this->getString(CAS_STR_USING_SERVER).' <a href="__SERVER_BASE_URL__">__SERVER_BASE_URL__</a> (CAS __CAS_VERSION__)</a></address></body></html>') |
|
139 | + ? ('<hr><address>phpCAS __PHPCAS_VERSION__ '.$this->getString(CAS_STR_USING_SERVER).' <a href="__SERVER_BASE_URL__">__SERVER_BASE_URL__</a> (CAS __CAS_VERSION__)</a></address></body></html>') |
|
140 | 140 | :$this->_output_footer); |
141 | 141 | } |
142 | 142 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function getLang() |
195 | 195 | { |
196 | - if ( empty($this->_lang) ) |
|
196 | + if (empty($this->_lang)) |
|
197 | 197 | $this->setLang(PHPCAS_LANG_DEFAULT); |
198 | 198 | return $this->_lang; |
199 | 199 | } |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | // call CASclient::getLang() to be sure the language is initialized |
224 | 224 | $this->getLang(); |
225 | 225 | |
226 | - if ( !isset($this->_strings[$str]) ) { |
|
227 | - trigger_error('string `'.$str.'\' not defined for language `'.$this->getLang().'\'',E_USER_ERROR); |
|
226 | + if (!isset($this->_strings[$str])) { |
|
227 | + trigger_error('string `'.$str.'\' not defined for language `'.$this->getLang().'\'', E_USER_ERROR); |
|
228 | 228 | } |
229 | 229 | return $this->_strings[$str]; |
230 | 230 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | // include the corresponding language file |
244 | 244 | include_once(dirname(__FILE__).'/languages/'.$lang.'.php'); |
245 | 245 | |
246 | - if ( !is_array($this->_strings) ) { |
|
247 | - trigger_error('language `'.$lang.'\' is not implemented',E_USER_ERROR); |
|
246 | + if (!is_array($this->_strings)) { |
|
247 | + trigger_error('language `'.$lang.'\' is not implemented', E_USER_ERROR); |
|
248 | 248 | } |
249 | 249 | $this->_lang = $lang; |
250 | 250 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | function getServerBaseURL() |
332 | 332 | { |
333 | 333 | // the URL is build only when needed |
334 | - if ( empty($this->_server['base_url']) ) { |
|
334 | + if (empty($this->_server['base_url'])) { |
|
335 | 335 | $this->_server['base_url'] = 'https://' |
336 | 336 | .$this->getServerHostname() |
337 | 337 | .':' |
@@ -350,15 +350,15 @@ discard block |
||
350 | 350 | * @return a URL. |
351 | 351 | * @private |
352 | 352 | */ |
353 | - function getServerLoginURL($gateway=false,$renew=false) { |
|
353 | + function getServerLoginURL($gateway = false, $renew = false) { |
|
354 | 354 | phpCAS::traceBegin(); |
355 | 355 | // the URL is build only when needed |
356 | - if ( empty($this->_server['login_url']) ) { |
|
356 | + if (empty($this->_server['login_url'])) { |
|
357 | 357 | $this->_server['login_url'] = $this->getServerBaseURL(); |
358 | 358 | $this->_server['login_url'] .= 'login?service='; |
359 | 359 | // $this->_server['login_url'] .= preg_replace('/&/','%26',$this->getURL()); |
360 | 360 | $this->_server['login_url'] .= urlencode($this->getURL()); |
361 | - if($renew) { |
|
361 | + if ($renew) { |
|
362 | 362 | // It is recommended that when the "renew" parameter is set, its value be "true" |
363 | 363 | $this->_server['login_url'] .= '&renew=true'; |
364 | 364 | } elseif ($gateway) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | function getServerServiceValidateURL() |
427 | 427 | { |
428 | 428 | // the URL is build only when needed |
429 | - if ( empty($this->_server['service_validate_url']) ) { |
|
429 | + if (empty($this->_server['service_validate_url'])) { |
|
430 | 430 | switch ($this->getServerVersion()) { |
431 | 431 | case CAS_VERSION_1_0: |
432 | 432 | $this->_server['service_validate_url'] = $this->getServerBaseURL().'validate'; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | { |
449 | 449 | phpCAS::traceBegin(); |
450 | 450 | // the URL is build only when needed |
451 | - if ( empty($this->_server['saml_validate_url']) ) { |
|
451 | + if (empty($this->_server['saml_validate_url'])) { |
|
452 | 452 | switch ($this->getServerVersion()) { |
453 | 453 | case SAML_VERSION_1_1: |
454 | 454 | $this->_server['saml_validate_url'] = $this->getServerBaseURL().'samlValidate'; |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | function getServerProxyValidateURL() |
467 | 467 | { |
468 | 468 | // the URL is build only when needed |
469 | - if ( empty($this->_server['proxy_validate_url']) ) { |
|
469 | + if (empty($this->_server['proxy_validate_url'])) { |
|
470 | 470 | switch ($this->getServerVersion()) { |
471 | 471 | case CAS_VERSION_1_0: |
472 | 472 | $this->_server['proxy_validate_url'] = ''; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | function getServerProxyURL() |
489 | 489 | { |
490 | 490 | // the URL is build only when needed |
491 | - if ( empty($this->_server['proxy_url']) ) { |
|
491 | + if (empty($this->_server['proxy_url'])) { |
|
492 | 492 | switch ($this->getServerVersion()) { |
493 | 493 | case CAS_VERSION_1_0: |
494 | 494 | $this->_server['proxy_url'] = ''; |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | function getServerLogoutURL() |
510 | 510 | { |
511 | 511 | // the URL is build only when needed |
512 | - if ( empty($this->_server['logout_url']) ) { |
|
512 | + if (empty($this->_server['logout_url'])) { |
|
513 | 513 | $this->_server['logout_url'] = $this->getServerBaseURL().'logout'; |
514 | 514 | } |
515 | 515 | return $this->_server['logout_url']; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | function isHttps() { |
548 | 548 | //if ( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ) { |
549 | 549 | //0.4.24 by Hinnack |
550 | - if ( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
550 | + if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
551 | 551 | return true; |
552 | 552 | } else { |
553 | 553 | return false; |
@@ -582,45 +582,45 @@ discard block |
||
582 | 582 | phpCAS::traceBegin(); |
583 | 583 | |
584 | 584 | // the redirect header() call and DOM parsing code from domxml-php4-php5.php won't work in PHP4 compatibility mode |
585 | - if (version_compare(PHP_VERSION,'5','>=') && ini_get('zend.ze1_compatibility_mode')) { |
|
585 | + if (version_compare(PHP_VERSION, '5', '>=') && ini_get('zend.ze1_compatibility_mode')) { |
|
586 | 586 | phpCAS::error('phpCAS cannot support zend.ze1_compatibility_mode. Sorry.'); |
587 | 587 | } |
588 | 588 | // skip Session Handling for logout requests and if don't want it' |
589 | 589 | if ($start_session && !$this->isLogoutRequest()) { |
590 | 590 | phpCAS::trace("Starting session handling"); |
591 | 591 | // Check for Tickets from the CAS server |
592 | - if (empty($_GET['ticket'])){ |
|
592 | + if (empty($_GET['ticket'])) { |
|
593 | 593 | phpCAS::trace("No ticket found"); |
594 | 594 | // only create a session if necessary |
595 | 595 | if (!session_id()) { |
596 | 596 | phpCAS::trace("No session found, creating new session"); |
597 | 597 | session_start(); |
598 | 598 | } |
599 | - }else{ |
|
599 | + } else { |
|
600 | 600 | phpCAS::trace("Ticket found"); |
601 | 601 | // We have to copy any old data before renaming the session |
602 | 602 | if (session_id()) { |
603 | 603 | phpCAS::trace("Old active session found, saving old data and destroying session"); |
604 | 604 | $old_session = $_SESSION; |
605 | 605 | session_destroy(); |
606 | - }else{ |
|
606 | + } else { |
|
607 | 607 | session_start(); |
608 | 608 | phpCAS::trace("Starting possible old session to copy variables"); |
609 | 609 | $old_session = $_SESSION; |
610 | 610 | session_destroy(); |
611 | 611 | } |
612 | 612 | // set up a new session, of name based on the ticket |
613 | - $session_id = preg_replace('/[^\w]/','',$_GET['ticket']); |
|
614 | - phpCAS::LOG("Session ID: " . $session_id); |
|
613 | + $session_id = preg_replace('/[^\w]/', '', $_GET['ticket']); |
|
614 | + phpCAS::LOG("Session ID: ".$session_id); |
|
615 | 615 | session_id($session_id); |
616 | 616 | session_start(); |
617 | 617 | // restore old session vars |
618 | - if(isset($old_session)){ |
|
618 | + if (isset($old_session)) { |
|
619 | 619 | phpCAS::trace("Restoring old session vars"); |
620 | 620 | $_SESSION = $old_session; |
621 | 621 | } |
622 | 622 | } |
623 | - }else{ |
|
623 | + } else { |
|
624 | 624 | phpCAS::trace("Skipping session creation"); |
625 | 625 | } |
626 | 626 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | //check version |
632 | 632 | switch ($server_version) { |
633 | 633 | case CAS_VERSION_1_0: |
634 | - if ( $this->isProxy() ) |
|
634 | + if ($this->isProxy()) |
|
635 | 635 | phpCAS::error('CAS proxies are not supported in CAS ' |
636 | 636 | .$server_version); |
637 | 637 | break; |
@@ -648,35 +648,35 @@ discard block |
||
648 | 648 | $this->_server['version'] = $server_version; |
649 | 649 | |
650 | 650 | // check hostname |
651 | - if ( empty($server_hostname) |
|
652 | - || !preg_match('/[\.\d\-abcdefghijklmnopqrstuvwxyz]*/',$server_hostname) ) { |
|
651 | + if (empty($server_hostname) |
|
652 | + || !preg_match('/[\.\d\-abcdefghijklmnopqrstuvwxyz]*/', $server_hostname)) { |
|
653 | 653 | phpCAS::error('bad CAS server hostname (`'.$server_hostname.'\')'); |
654 | 654 | } |
655 | 655 | $this->_server['hostname'] = $server_hostname; |
656 | 656 | |
657 | 657 | // check port |
658 | - if ( $server_port == 0 |
|
659 | - || !is_int($server_port) ) { |
|
658 | + if ($server_port == 0 |
|
659 | + || !is_int($server_port)) { |
|
660 | 660 | phpCAS::error('bad CAS server port (`'.$server_hostname.'\')'); |
661 | 661 | } |
662 | 662 | $this->_server['port'] = $server_port; |
663 | 663 | |
664 | 664 | // check URI |
665 | - if ( !preg_match('/[\.\d\-_abcdefghijklmnopqrstuvwxyz\/]*/',$server_uri) ) { |
|
665 | + if (!preg_match('/[\.\d\-_abcdefghijklmnopqrstuvwxyz\/]*/', $server_uri)) { |
|
666 | 666 | phpCAS::error('bad CAS server URI (`'.$server_uri.'\')'); |
667 | 667 | } |
668 | 668 | // add leading and trailing `/' and remove doubles |
669 | - $server_uri = preg_replace('/\/\//','/','/'.$server_uri.'/'); |
|
669 | + $server_uri = preg_replace('/\/\//', '/', '/'.$server_uri.'/'); |
|
670 | 670 | $this->_server['uri'] = $server_uri; |
671 | 671 | |
672 | 672 | // set to callback mode if PgtIou and PgtId CGI GET parameters are provided |
673 | - if ( $this->isProxy() ) { |
|
674 | - $this->setCallbackMode(!empty($_GET['pgtIou'])&&!empty($_GET['pgtId'])); |
|
673 | + if ($this->isProxy()) { |
|
674 | + $this->setCallbackMode(!empty($_GET['pgtIou']) && !empty($_GET['pgtId'])); |
|
675 | 675 | } |
676 | 676 | |
677 | - if ( $this->isCallbackMode() ) { |
|
677 | + if ($this->isCallbackMode()) { |
|
678 | 678 | //callback mode: check that phpCAS is secured |
679 | - if ( !$this->isHttps() ) { |
|
679 | + if (!$this->isHttps()) { |
|
680 | 680 | phpCAS::error('CAS proxies must be secured to use phpCAS; PGT\'s will not be received from the CAS server'); |
681 | 681 | } |
682 | 682 | } else { |
@@ -684,33 +684,33 @@ discard block |
||
684 | 684 | $ticket = (isset($_GET['ticket']) ? $_GET['ticket'] : null); |
685 | 685 | switch ($this->getServerVersion()) { |
686 | 686 | case CAS_VERSION_1_0: // check for a Service Ticket |
687 | - if( preg_match('/^ST-/',$ticket) ) { |
|
687 | + if (preg_match('/^ST-/', $ticket)) { |
|
688 | 688 | phpCAS::trace('ST \''.$ticket.'\' found'); |
689 | 689 | //ST present |
690 | 690 | $this->setST($ticket); |
691 | 691 | //ticket has been taken into account, unset it to hide it to applications |
692 | 692 | unset($_GET['ticket']); |
693 | - } else if ( !empty($ticket) ) { |
|
693 | + } else if (!empty($ticket)) { |
|
694 | 694 | //ill-formed ticket, halt |
695 | 695 | phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')'); |
696 | 696 | } |
697 | 697 | break; |
698 | 698 | case CAS_VERSION_2_0: // check for a Service or Proxy Ticket |
699 | - if( preg_match('/^[SP]T-/',$ticket) ) { |
|
699 | + if (preg_match('/^[SP]T-/', $ticket)) { |
|
700 | 700 | phpCAS::trace('ST or PT \''.$ticket.'\' found'); |
701 | 701 | $this->setPT($ticket); |
702 | 702 | unset($_GET['ticket']); |
703 | - } else if ( !empty($ticket) ) { |
|
703 | + } else if (!empty($ticket)) { |
|
704 | 704 | //ill-formed ticket, halt |
705 | 705 | phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')'); |
706 | 706 | } |
707 | 707 | break; |
708 | 708 | case SAML_VERSION_1_1: // SAML just does Service Tickets |
709 | - if( preg_match('/^[SP]T-/',$ticket) ) { |
|
709 | + if (preg_match('/^[SP]T-/', $ticket)) { |
|
710 | 710 | phpCAS::trace('SA \''.$ticket.'\' found'); |
711 | 711 | $this->setSA($ticket); |
712 | 712 | unset($_GET['ticket']); |
713 | - } else if ( !empty($ticket) ) { |
|
713 | + } else if (!empty($ticket)) { |
|
714 | 714 | //ill-formed ticket, halt |
715 | 715 | phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')'); |
716 | 716 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | */ |
764 | 764 | function getUser() |
765 | 765 | { |
766 | - if ( empty($this->_user) ) { |
|
766 | + if (empty($this->_user)) { |
|
767 | 767 | phpCAS::error('this method should be used only after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
768 | 768 | } |
769 | 769 | return $this->_user; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | { $this->_attributes = $attributes; } |
791 | 791 | |
792 | 792 | function getAttributes() { |
793 | - if ( empty($this->_user) ) { // if no user is set, there shouldn't be any attributes also... |
|
793 | + if (empty($this->_user)) { // if no user is set, there shouldn't be any attributes also... |
|
794 | 794 | phpCAS::error('this method should be used only after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
795 | 795 | } |
796 | 796 | return $this->_attributes; |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | function hasAttribute($key) |
803 | 803 | { return (is_array($this->_attributes) && array_key_exists($key, $this->_attributes)); } |
804 | 804 | |
805 | - function getAttribute($key) { |
|
806 | - if($this->hasAttribute($key)) { |
|
805 | + function getAttribute($key) { |
|
806 | + if ($this->hasAttribute($key)) { |
|
807 | 807 | return $this->_attributes[$key]; |
808 | 808 | } |
809 | 809 | } |
@@ -814,14 +814,14 @@ discard block |
||
814 | 814 | * If not, redirect to CAS |
815 | 815 | * @public |
816 | 816 | */ |
817 | - function renewAuthentication(){ |
|
817 | + function renewAuthentication() { |
|
818 | 818 | phpCAS::traceBegin(); |
819 | 819 | // Either way, the user is authenticated by CAS |
820 | - if( isset( $_SESSION['phpCAS']['auth_checked'] ) ) |
|
820 | + if (isset($_SESSION['phpCAS']['auth_checked'])) |
|
821 | 821 | unset($_SESSION['phpCAS']['auth_checked']); |
822 | - if ( $this->isAuthenticated() ) { |
|
822 | + if ($this->isAuthenticated()) { |
|
823 | 823 | phpCAS::trace('user already authenticated; renew'); |
824 | - $this->redirectToCas(false,true); |
|
824 | + $this->redirectToCas(false, true); |
|
825 | 825 | } else { |
826 | 826 | $this->redirectToCas(); |
827 | 827 | } |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | { |
839 | 839 | phpCAS::traceBegin(); |
840 | 840 | |
841 | - if ( $this->isAuthenticated() ) { |
|
841 | + if ($this->isAuthenticated()) { |
|
842 | 842 | // the user is authenticated, nothing to be done. |
843 | 843 | phpCAS::trace('no need to authenticate'); |
844 | 844 | $res = TRUE; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | function checkAuthentication() |
884 | 884 | { |
885 | 885 | phpCAS::traceBegin(); |
886 | - if ( $this->isAuthenticated() ) { |
|
886 | + if ($this->isAuthenticated()) { |
|
887 | 887 | phpCAS::trace('user is authenticated'); |
888 | 888 | $res = TRUE; |
889 | 889 | } else if (isset($_SESSION['phpCAS']['auth_checked'])) { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | // // never reached |
898 | 898 | // $res = FALSE; |
899 | 899 | // avoid a check against CAS on every request |
900 | - if (! isset($_SESSION['phpCAS']['unauth_count']) ) |
|
900 | + if (!isset($_SESSION['phpCAS']['unauth_count'])) |
|
901 | 901 | $_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized |
902 | 902 | |
903 | 903 | if (($_SESSION['phpCAS']['unauth_count'] != -2 && $this->_cache_times_for_auth_recheck == -1) |
@@ -943,43 +943,43 @@ discard block |
||
943 | 943 | $res = FALSE; |
944 | 944 | $validate_url = ''; |
945 | 945 | |
946 | - if ( $this->wasPreviouslyAuthenticated() ) { |
|
946 | + if ($this->wasPreviouslyAuthenticated()) { |
|
947 | 947 | // the user has already (previously during the session) been |
948 | 948 | // authenticated, nothing to be done. |
949 | 949 | phpCAS::trace('user was already authenticated, no need to look for tickets'); |
950 | 950 | $res = TRUE; |
951 | 951 | } |
952 | 952 | else { |
953 | - if ( $this->hasST() ) { |
|
953 | + if ($this->hasST()) { |
|
954 | 954 | // if a Service Ticket was given, validate it |
955 | 955 | phpCAS::trace('ST `'.$this->getST().'\' is present'); |
956 | - $this->validateST($validate_url,$text_response,$tree_response); // if it fails, it halts |
|
956 | + $this->validateST($validate_url, $text_response, $tree_response); // if it fails, it halts |
|
957 | 957 | phpCAS::trace('ST `'.$this->getST().'\' was validated'); |
958 | - if ( $this->isProxy() ) { |
|
959 | - $this->validatePGT($validate_url,$text_response,$tree_response); // idem |
|
958 | + if ($this->isProxy()) { |
|
959 | + $this->validatePGT($validate_url, $text_response, $tree_response); // idem |
|
960 | 960 | phpCAS::trace('PGT `'.$this->getPGT().'\' was validated'); |
961 | 961 | $_SESSION['phpCAS']['pgt'] = $this->getPGT(); |
962 | 962 | } |
963 | 963 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
964 | 964 | $res = TRUE; |
965 | 965 | } |
966 | - elseif ( $this->hasPT() ) { |
|
966 | + elseif ($this->hasPT()) { |
|
967 | 967 | // if a Proxy Ticket was given, validate it |
968 | 968 | phpCAS::trace('PT `'.$this->getPT().'\' is present'); |
969 | - $this->validatePT($validate_url,$text_response,$tree_response); // note: if it fails, it halts |
|
969 | + $this->validatePT($validate_url, $text_response, $tree_response); // note: if it fails, it halts |
|
970 | 970 | phpCAS::trace('PT `'.$this->getPT().'\' was validated'); |
971 | - if ( $this->isProxy() ) { |
|
972 | - $this->validatePGT($validate_url,$text_response,$tree_response); // idem |
|
971 | + if ($this->isProxy()) { |
|
972 | + $this->validatePGT($validate_url, $text_response, $tree_response); // idem |
|
973 | 973 | phpCAS::trace('PGT `'.$this->getPGT().'\' was validated'); |
974 | 974 | $_SESSION['phpCAS']['pgt'] = $this->getPGT(); |
975 | 975 | } |
976 | 976 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
977 | 977 | $res = TRUE; |
978 | 978 | } |
979 | - elseif ( $this->hasSA() ) { |
|
979 | + elseif ($this->hasSA()) { |
|
980 | 980 | // if we have a SAML ticket, validate it. |
981 | 981 | phpCAS::trace('SA `'.$this->getSA().'\' is present'); |
982 | - $this->validateSA($validate_url,$text_response,$tree_response); // if it fails, it halts |
|
982 | + $this->validateSA($validate_url, $text_response, $tree_response); // if it fails, it halts |
|
983 | 983 | phpCAS::trace('SA `'.$this->getSA().'\' was validated'); |
984 | 984 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
985 | 985 | $_SESSION['phpCAS']['attributes'] = $this->getAttributes(); |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | // if called with a ticket parameter, we need to redirect to the app without the ticket so that CAS-ification is transparent to the browser (for later POSTS) |
994 | 994 | // most of the checks and errors should have been made now, so we're safe for redirect without masking error messages. |
995 | 995 | header('Location: '.$this->getURL()); |
996 | - phpCAS::log( "Prepare redirect to : ".$this->getURL() ); |
|
996 | + phpCAS::log("Prepare redirect to : ".$this->getURL()); |
|
997 | 997 | } |
998 | 998 | } |
999 | 999 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | * @return true if authenticated based soley on $_SESSION variable |
1007 | 1007 | * @since 0.4.22 by Brendan Arnold |
1008 | 1008 | */ |
1009 | - function isSessionAuthenticated () |
|
1009 | + function isSessionAuthenticated() |
|
1010 | 1010 | { |
1011 | 1011 | return !empty($_SESSION['phpCAS']['user']); |
1012 | 1012 | } |
@@ -1025,28 +1025,28 @@ discard block |
||
1025 | 1025 | { |
1026 | 1026 | phpCAS::traceBegin(); |
1027 | 1027 | |
1028 | - if ( $this->isCallbackMode() ) { |
|
1028 | + if ($this->isCallbackMode()) { |
|
1029 | 1029 | $this->callback(); |
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | $auth = FALSE; |
1033 | 1033 | |
1034 | - if ( $this->isProxy() ) { |
|
1034 | + if ($this->isProxy()) { |
|
1035 | 1035 | // CAS proxy: username and PGT must be present |
1036 | - if ( $this->isSessionAuthenticated() && !empty($_SESSION['phpCAS']['pgt']) ) { |
|
1036 | + if ($this->isSessionAuthenticated() && !empty($_SESSION['phpCAS']['pgt'])) { |
|
1037 | 1037 | // authentication already done |
1038 | 1038 | $this->setUser($_SESSION['phpCAS']['user']); |
1039 | 1039 | $this->setPGT($_SESSION['phpCAS']['pgt']); |
1040 | 1040 | phpCAS::trace('user = `'.$_SESSION['phpCAS']['user'].'\', PGT = `'.$_SESSION['phpCAS']['pgt'].'\''); |
1041 | 1041 | $auth = TRUE; |
1042 | - } elseif ( $this->isSessionAuthenticated() && empty($_SESSION['phpCAS']['pgt']) ) { |
|
1042 | + } elseif ($this->isSessionAuthenticated() && empty($_SESSION['phpCAS']['pgt'])) { |
|
1043 | 1043 | // these two variables should be empty or not empty at the same time |
1044 | 1044 | phpCAS::trace('username found (`'.$_SESSION['phpCAS']['user'].'\') but PGT is empty'); |
1045 | 1045 | // unset all tickets to enforce authentication |
1046 | 1046 | unset($_SESSION['phpCAS']); |
1047 | 1047 | $this->setST(''); |
1048 | 1048 | $this->setPT(''); |
1049 | - } elseif ( !$this->isSessionAuthenticated() && !empty($_SESSION['phpCAS']['pgt']) ) { |
|
1049 | + } elseif (!$this->isSessionAuthenticated() && !empty($_SESSION['phpCAS']['pgt'])) { |
|
1050 | 1050 | // these two variables should be empty or not empty at the same time |
1051 | 1051 | phpCAS::trace('PGT found (`'.$_SESSION['phpCAS']['pgt'].'\') but username is empty'); |
1052 | 1052 | // unset all tickets to enforce authentication |
@@ -1058,10 +1058,10 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | } else { |
1060 | 1060 | // `simple' CAS client (not a proxy): username must be present |
1061 | - if ( $this->isSessionAuthenticated() ) { |
|
1061 | + if ($this->isSessionAuthenticated()) { |
|
1062 | 1062 | // authentication already done |
1063 | 1063 | $this->setUser($_SESSION['phpCAS']['user']); |
1064 | - if(isset($_SESSION['phpCAS']['attributes'])){ |
|
1064 | + if (isset($_SESSION['phpCAS']['attributes'])) { |
|
1065 | 1065 | $this->setAttributes($_SESSION['phpCAS']['attributes']); |
1066 | 1066 | } |
1067 | 1067 | phpCAS::trace('user = `'.$_SESSION['phpCAS']['user'].'\''); |
@@ -1082,15 +1082,15 @@ discard block |
||
1082 | 1082 | * @param $renew true to force the authentication with the CAS server |
1083 | 1083 | * @public |
1084 | 1084 | */ |
1085 | - function redirectToCas($gateway=false,$renew=false){ |
|
1085 | + function redirectToCas($gateway = false, $renew = false) { |
|
1086 | 1086 | phpCAS::traceBegin(); |
1087 | - $cas_url = $this->getServerLoginURL($gateway,$renew); |
|
1087 | + $cas_url = $this->getServerLoginURL($gateway, $renew); |
|
1088 | 1088 | header('Location: '.$cas_url); |
1089 | - phpCAS::log( "Redirect to : ".$cas_url ); |
|
1089 | + phpCAS::log("Redirect to : ".$cas_url); |
|
1090 | 1090 | |
1091 | 1091 | $this->printHTMLHeader($this->getString(CAS_STR_AUTHENTICATION_WANTED)); |
1092 | 1092 | |
1093 | - printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>',$cas_url); |
|
1093 | + printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>', $cas_url); |
|
1094 | 1094 | $this->printHTMLFooter(); |
1095 | 1095 | |
1096 | 1096 | phpCAS::traceExit(); |
@@ -1108,20 +1108,20 @@ discard block |
||
1108 | 1108 | $cas_url = $this->getServerLogoutURL(); |
1109 | 1109 | $paramSeparator = '?'; |
1110 | 1110 | if (isset($params['url'])) { |
1111 | - $cas_url = $cas_url . $paramSeparator . "url=" . urlencode($params['url']); |
|
1111 | + $cas_url = $cas_url.$paramSeparator."url=".urlencode($params['url']); |
|
1112 | 1112 | $paramSeparator = '&'; |
1113 | 1113 | } |
1114 | 1114 | if (isset($params['service'])) { |
1115 | - $cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']); |
|
1115 | + $cas_url = $cas_url.$paramSeparator."service=".urlencode($params['service']); |
|
1116 | 1116 | } |
1117 | 1117 | header('Location: '.$cas_url); |
1118 | - phpCAS::log( "Prepare redirect to : ".$cas_url ); |
|
1118 | + phpCAS::log("Prepare redirect to : ".$cas_url); |
|
1119 | 1119 | |
1120 | 1120 | session_unset(); |
1121 | 1121 | session_destroy(); |
1122 | 1122 | |
1123 | 1123 | $this->printHTMLHeader($this->getString(CAS_STR_LOGOUT)); |
1124 | - printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>',$cas_url); |
|
1124 | + printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>', $cas_url); |
|
1125 | 1125 | $this->printHTMLFooter(); |
1126 | 1126 | |
1127 | 1127 | phpCAS::traceExit(); |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | * By default, only the CAs server (declared in the constructor) will be allowed. |
1152 | 1152 | * @public |
1153 | 1153 | */ |
1154 | - function handleLogoutRequests($check_client=true, $allowed_clients=false) { |
|
1154 | + function handleLogoutRequests($check_client = true, $allowed_clients = false) { |
|
1155 | 1155 | phpCAS::traceBegin(); |
1156 | 1156 | if (!$this->isLogoutRequest()) { |
1157 | 1157 | phpCAS::log("Not a logout request"); |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | phpCAS::log("SAML REQUEST: ".$_POST['logoutRequest']); |
1163 | 1163 | if ($check_client) { |
1164 | 1164 | if (!$allowed_clients) { |
1165 | - $allowed_clients = array( $this->getServerHostname() ); |
|
1165 | + $allowed_clients = array($this->getServerHostname()); |
|
1166 | 1166 | } |
1167 | 1167 | $client_ip = $_SERVER['REMOTE_ADDR']; |
1168 | 1168 | $client = gethostbyaddr($client_ip); |
@@ -1188,21 +1188,21 @@ discard block |
||
1188 | 1188 | } |
1189 | 1189 | // Extract the ticket from the SAML Request |
1190 | 1190 | preg_match("|<samlp:SessionIndex>(.*)</samlp:SessionIndex>|", $_POST['logoutRequest'], $tick, PREG_OFFSET_CAPTURE, 3); |
1191 | - $wrappedSamlSessionIndex = preg_replace('|<samlp:SessionIndex>|','',$tick[0][0]); |
|
1192 | - $ticket2logout = preg_replace('|</samlp:SessionIndex>|','',$wrappedSamlSessionIndex); |
|
1191 | + $wrappedSamlSessionIndex = preg_replace('|<samlp:SessionIndex>|', '', $tick[0][0]); |
|
1192 | + $ticket2logout = preg_replace('|</samlp:SessionIndex>|', '', $wrappedSamlSessionIndex); |
|
1193 | 1193 | phpCAS::log("Ticket to logout: ".$ticket2logout); |
1194 | - $session_id = preg_replace('/[^\w]/','',$ticket2logout); |
|
1194 | + $session_id = preg_replace('/[^\w]/', '', $ticket2logout); |
|
1195 | 1195 | phpCAS::log("Session id: ".$session_id); |
1196 | 1196 | |
1197 | 1197 | // destroy a possible application session created before phpcas |
1198 | - if(session_id()){ |
|
1198 | + if (session_id()) { |
|
1199 | 1199 | session_unset(); |
1200 | 1200 | session_destroy(); |
1201 | 1201 | } |
1202 | 1202 | // fix session ID |
1203 | 1203 | session_id($session_id); |
1204 | - $_COOKIE[session_name()]=$session_id; |
|
1205 | - $_GET[session_name()]=$session_id; |
|
1204 | + $_COOKIE[session_name()] = $session_id; |
|
1205 | + $_GET[session_name()] = $session_id; |
|
1206 | 1206 | |
1207 | 1207 | // Overwrite session |
1208 | 1208 | session_start(); |
@@ -1338,18 +1338,18 @@ discard block |
||
1338 | 1338 | * |
1339 | 1339 | * @private |
1340 | 1340 | */ |
1341 | - function validateST($validate_url,&$text_response,&$tree_response) |
|
1341 | + function validateST($validate_url, &$text_response, &$tree_response) |
|
1342 | 1342 | { |
1343 | 1343 | phpCAS::traceBegin(); |
1344 | 1344 | // build the URL to validate the ticket |
1345 | 1345 | $validate_url = $this->getServerServiceValidateURL().'&ticket='.$this->getST(); |
1346 | - if ( $this->isProxy() ) { |
|
1346 | + if ($this->isProxy()) { |
|
1347 | 1347 | // pass the callback url for CAS proxies |
1348 | 1348 | $validate_url .= '&pgtUrl='.$this->getCallbackURL(); |
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | // open and read the URL |
1352 | - if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) { |
|
1352 | + if (!$this->readURL($validate_url, ''/*cookies*/, $headers, $text_response, $err_msg)) { |
|
1353 | 1353 | phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')'); |
1354 | 1354 | $this->authError('ST not validated', |
1355 | 1355 | $validate_url, |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | // analyze the result depending on the version |
1360 | 1360 | switch ($this->getServerVersion()) { |
1361 | 1361 | case CAS_VERSION_1_0: |
1362 | - if (preg_match('/^no\n/',$text_response)) { |
|
1362 | + if (preg_match('/^no\n/', $text_response)) { |
|
1363 | 1363 | phpCAS::trace('ST has not been validated'); |
1364 | 1364 | $this->authError('ST not validated', |
1365 | 1365 | $validate_url, |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | FALSE/*$bad_response*/, |
1368 | 1368 | $text_response); |
1369 | 1369 | } |
1370 | - if (!preg_match('/^yes\n/',$text_response)) { |
|
1370 | + if (!preg_match('/^yes\n/', $text_response)) { |
|
1371 | 1371 | phpCAS::trace('ill-formed response'); |
1372 | 1372 | $this->authError('ST not validated', |
1373 | 1373 | $validate_url, |
@@ -1376,12 +1376,12 @@ discard block |
||
1376 | 1376 | $text_response); |
1377 | 1377 | } |
1378 | 1378 | // ST has been validated, extract the user name |
1379 | - $arr = preg_split('/\n/',$text_response); |
|
1379 | + $arr = preg_split('/\n/', $text_response); |
|
1380 | 1380 | $this->setUser(trim($arr[1])); |
1381 | 1381 | break; |
1382 | 1382 | case CAS_VERSION_2_0: |
1383 | 1383 | // read the response of the CAS server into a DOM object |
1384 | - if ( !($dom = domxml_open_mem($text_response))) { |
|
1384 | + if (!($dom = domxml_open_mem($text_response))) { |
|
1385 | 1385 | phpCAS::trace('domxml_open_mem() failed'); |
1386 | 1386 | $this->authError('ST not validated', |
1387 | 1387 | $validate_url, |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | $text_response); |
1391 | 1391 | } |
1392 | 1392 | // read the root node of the XML tree |
1393 | - if ( !($tree_response = $dom->document_element()) ) { |
|
1393 | + if (!($tree_response = $dom->document_element())) { |
|
1394 | 1394 | phpCAS::trace('document_element() failed'); |
1395 | 1395 | $this->authError('ST not validated', |
1396 | 1396 | $validate_url, |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | $text_response); |
1400 | 1400 | } |
1401 | 1401 | // insure that tag name is 'serviceResponse' |
1402 | - if ( $tree_response->node_name() != 'serviceResponse' ) { |
|
1402 | + if ($tree_response->node_name() != 'serviceResponse') { |
|
1403 | 1403 | phpCAS::trace('bad XML root node (should be `serviceResponse\' instead of `'.$tree_response->node_name().'\''); |
1404 | 1404 | $this->authError('ST not validated', |
1405 | 1405 | $validate_url, |
@@ -1407,9 +1407,9 @@ discard block |
||
1407 | 1407 | TRUE/*$bad_response*/, |
1408 | 1408 | $text_response); |
1409 | 1409 | } |
1410 | - if ( sizeof($success_elements = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { |
|
1410 | + if (sizeof($success_elements = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { |
|
1411 | 1411 | // authentication succeded, extract the user name |
1412 | - if ( sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) { |
|
1412 | + if (sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) { |
|
1413 | 1413 | phpCAS::trace('<authenticationSuccess> found, but no <user>'); |
1414 | 1414 | $this->authError('ST not validated', |
1415 | 1415 | $validate_url, |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | phpCAS::trace('user = `'.$user); |
1422 | 1422 | $this->setUser($user); |
1423 | 1423 | |
1424 | - } else if ( sizeof($failure_elements = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { |
|
1424 | + } else if (sizeof($failure_elements = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { |
|
1425 | 1425 | phpCAS::trace('<authenticationFailure> found'); |
1426 | 1426 | // authentication failed, extract the error code and message |
1427 | 1427 | $this->authError('ST not validated', |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @private |
1470 | 1470 | */ |
1471 | - function validateSA($validate_url,&$text_response,&$tree_response) |
|
1471 | + function validateSA($validate_url, &$text_response, &$tree_response) |
|
1472 | 1472 | { |
1473 | 1473 | phpCAS::traceBegin(); |
1474 | 1474 | |
@@ -1476,7 +1476,7 @@ discard block |
||
1476 | 1476 | $validate_url = $this->getServerSamlValidateURL(); |
1477 | 1477 | |
1478 | 1478 | // open and read the URL |
1479 | - if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) { |
|
1479 | + if (!$this->readURL($validate_url, ''/*cookies*/, $headers, $text_response, $err_msg)) { |
|
1480 | 1480 | phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')'); |
1481 | 1481 | $this->authError('SA not validated', $validate_url, TRUE/*$no_response*/); |
1482 | 1482 | } |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | case SAML_VERSION_1_1: |
1489 | 1489 | |
1490 | 1490 | // read the response of the CAS server into a DOM object |
1491 | - if ( !($dom = domxml_open_mem($text_response))) { |
|
1491 | + if (!($dom = domxml_open_mem($text_response))) { |
|
1492 | 1492 | phpCAS::trace('domxml_open_mem() failed'); |
1493 | 1493 | $this->authError('SA not validated', |
1494 | 1494 | $validate_url, |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | $text_response); |
1498 | 1498 | } |
1499 | 1499 | // read the root node of the XML tree |
1500 | - if ( !($tree_response = $dom->document_element()) ) { |
|
1500 | + if (!($tree_response = $dom->document_element())) { |
|
1501 | 1501 | phpCAS::trace('document_element() failed'); |
1502 | 1502 | $this->authError('SA not validated', |
1503 | 1503 | $validate_url, |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | $text_response); |
1507 | 1507 | } |
1508 | 1508 | // insure that tag name is 'Envelope' |
1509 | - if ( $tree_response->node_name() != 'Envelope' ) { |
|
1509 | + if ($tree_response->node_name() != 'Envelope') { |
|
1510 | 1510 | phpCAS::trace('bad XML root node (should be `Envelope\' instead of `'.$tree_response->node_name().'\''); |
1511 | 1511 | $this->authError('SA not validated', |
1512 | 1512 | $validate_url, |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | $text_response); |
1516 | 1516 | } |
1517 | 1517 | // check for the NameIdentifier tag in the SAML response |
1518 | - if ( sizeof($success_elements = $tree_response->get_elements_by_tagname("NameIdentifier")) != 0) { |
|
1518 | + if (sizeof($success_elements = $tree_response->get_elements_by_tagname("NameIdentifier")) != 0) { |
|
1519 | 1519 | phpCAS::trace('NameIdentifier found'); |
1520 | 1520 | $user = trim($success_elements[0]->get_content()); |
1521 | 1521 | phpCAS::trace('user = `'.$user.'`'); |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | $result = FALSE; |
1554 | 1554 | |
1555 | 1555 | if (isset($_SESSION[SAML_ATTRIBUTES])) { |
1556 | - phpCAS::trace("session attrs already set."); //testbml - do we care? |
|
1556 | + phpCAS::trace("session attrs already set."); //testbml - do we care? |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | $attr_array = array(); |
@@ -1565,21 +1565,21 @@ discard block |
||
1565 | 1565 | $nodelist = $xPath->xpath_eval("//saml:Attribute"); |
1566 | 1566 | $attrs = $nodelist->nodeset; |
1567 | 1567 | phpCAS::trace($text_response); |
1568 | - foreach($attrs as $attr){ |
|
1568 | + foreach ($attrs as $attr) { |
|
1569 | 1569 | $xres = $xPath->xpath_eval("saml:AttributeValue", $attr); |
1570 | 1570 | $name = $attr->get_attribute("AttributeName"); |
1571 | 1571 | $value_array = array(); |
1572 | - foreach($xres->nodeset as $node){ |
|
1572 | + foreach ($xres->nodeset as $node) { |
|
1573 | 1573 | $value_array[] = $node->get_content(); |
1574 | 1574 | |
1575 | 1575 | } |
1576 | - phpCAS::trace("* " . $name . "=" . $value_array); |
|
1576 | + phpCAS::trace("* ".$name."=".$value_array); |
|
1577 | 1577 | $attr_array[$name] = $value_array; |
1578 | 1578 | } |
1579 | 1579 | $_SESSION[SAML_ATTRIBUTES] = $attr_array; |
1580 | 1580 | // UGent addition... |
1581 | - foreach($attr_array as $attr_key => $attr_value) { |
|
1582 | - if(count($attr_value) > 1) { |
|
1581 | + foreach ($attr_array as $attr_key => $attr_value) { |
|
1582 | + if (count($attr_value) > 1) { |
|
1583 | 1583 | $this->_attributes[$attr_key] = $attr_value; |
1584 | 1584 | } |
1585 | 1585 | else { |
@@ -1741,14 +1741,14 @@ discard block |
||
1741 | 1741 | function getCallbackURL() |
1742 | 1742 | { |
1743 | 1743 | // the URL is built when needed only |
1744 | - if ( empty($this->_callback_url) ) { |
|
1744 | + if (empty($this->_callback_url)) { |
|
1745 | 1745 | $final_uri = ''; |
1746 | 1746 | // remove the ticket if present in the URL |
1747 | 1747 | $final_uri = 'https://'; |
1748 | 1748 | /* replaced by Julien Marchal - v0.4.6 |
1749 | 1749 | * $this->uri .= $_SERVER['SERVER_NAME']; |
1750 | 1750 | */ |
1751 | - if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){ |
|
1751 | + if (empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { |
|
1752 | 1752 | /* replaced by teedog - v0.4.12 |
1753 | 1753 | * $final_uri .= $_SERVER['SERVER_NAME']; |
1754 | 1754 | */ |
@@ -1760,13 +1760,13 @@ discard block |
||
1760 | 1760 | } else { |
1761 | 1761 | $final_uri .= $_SERVER['HTTP_X_FORWARDED_SERVER']; |
1762 | 1762 | } |
1763 | - if ( ($this->isHttps() && $_SERVER['SERVER_PORT']!=443) |
|
1764 | - || (!$this->isHttps() && $_SERVER['SERVER_PORT']!=80) ) { |
|
1763 | + if (($this->isHttps() && $_SERVER['SERVER_PORT'] != 443) |
|
1764 | + || (!$this->isHttps() && $_SERVER['SERVER_PORT'] != 80)) { |
|
1765 | 1765 | $final_uri .= ':'; |
1766 | 1766 | $final_uri .= $_SERVER['SERVER_PORT']; |
1767 | 1767 | } |
1768 | 1768 | $request_uri = $_SERVER['REQUEST_URI']; |
1769 | - $request_uri = preg_replace('/\?.*$/','',$request_uri); |
|
1769 | + $request_uri = preg_replace('/\?.*$/', '', $request_uri); |
|
1770 | 1770 | $final_uri .= $request_uri; |
1771 | 1771 | $this->setCallbackURL($final_uri); |
1772 | 1772 | } |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | $pgt = $_GET['pgtId']; |
1800 | 1800 | phpCAS::trace('Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\')'); |
1801 | 1801 | echo '<p>Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').</p>'; |
1802 | - $this->storePGT($pgt,$pgt_iou); |
|
1802 | + $this->storePGT($pgt, $pgt_iou); |
|
1803 | 1803 | $this->printHTMLFooter(); |
1804 | 1804 | phpCAS::traceExit(); |
1805 | 1805 | exit(); |
@@ -1834,7 +1834,7 @@ discard block |
||
1834 | 1834 | function initPGTStorage() |
1835 | 1835 | { |
1836 | 1836 | // if no SetPGTStorageXxx() has been used, default to file |
1837 | - if ( !is_object($this->_pgt_storage) ) { |
|
1837 | + if (!is_object($this->_pgt_storage)) { |
|
1838 | 1838 | $this->setPGTStorageFile(); |
1839 | 1839 | } |
1840 | 1840 | |
@@ -1850,12 +1850,12 @@ discard block |
||
1850 | 1850 | * |
1851 | 1851 | * @private |
1852 | 1852 | */ |
1853 | - function storePGT($pgt,$pgt_iou) |
|
1853 | + function storePGT($pgt, $pgt_iou) |
|
1854 | 1854 | { |
1855 | 1855 | // ensure that storage is initialized |
1856 | 1856 | $this->initPGTStorage(); |
1857 | 1857 | // writes the PGT |
1858 | - $this->_pgt_storage->write($pgt,$pgt_iou); |
|
1858 | + $this->_pgt_storage->write($pgt, $pgt_iou); |
|
1859 | 1859 | } |
1860 | 1860 | |
1861 | 1861 | /** |
@@ -1884,16 +1884,16 @@ discard block |
||
1884 | 1884 | * |
1885 | 1885 | * @public |
1886 | 1886 | */ |
1887 | - function setPGTStorageFile($format='', |
|
1888 | - $path='') |
|
1887 | + function setPGTStorageFile($format = '', |
|
1888 | + $path = '') |
|
1889 | 1889 | { |
1890 | 1890 | // check that the storage has not already been set |
1891 | - if ( is_object($this->_pgt_storage) ) { |
|
1891 | + if (is_object($this->_pgt_storage)) { |
|
1892 | 1892 | phpCAS::error('PGT storage already defined'); |
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | // create the storage object |
1896 | - $this->_pgt_storage = new PGTStorageFile($this,$format,$path); |
|
1896 | + $this->_pgt_storage = new PGTStorageFile($this, $format, $path); |
|
1897 | 1897 | } |
1898 | 1898 | |
1899 | 1899 | /** |
@@ -1922,15 +1922,15 @@ discard block |
||
1922 | 1922 | $table) |
1923 | 1923 | { |
1924 | 1924 | // check that the storage has not already been set |
1925 | - if ( is_object($this->_pgt_storage) ) { |
|
1925 | + if (is_object($this->_pgt_storage)) { |
|
1926 | 1926 | phpCAS::error('PGT storage already defined'); |
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | // warn the user that he should use file storage... |
1930 | - trigger_error('PGT storage into database is an experimental feature, use at your own risk',E_USER_WARNING); |
|
1930 | + trigger_error('PGT storage into database is an experimental feature, use at your own risk', E_USER_WARNING); |
|
1931 | 1931 | |
1932 | 1932 | // create the storage object |
1933 | - $this->_pgt_storage = new PGTStorageDB($this,$user,$password,$database_type,$hostname,$port,$database,$table); |
|
1933 | + $this->_pgt_storage = new PGTStorageDB($this, $user, $password, $database_type, $hostname, $port, $database, $table); |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | // ######################################################################## |
@@ -1949,11 +1949,11 @@ discard block |
||
1949 | 1949 | * |
1950 | 1950 | * @private |
1951 | 1951 | */ |
1952 | - function validatePGT(&$validate_url,$text_response,$tree_response) |
|
1952 | + function validatePGT(&$validate_url, $text_response, $tree_response) |
|
1953 | 1953 | { |
1954 | 1954 | // here cannot use phpCAS::traceBegin(); alongside domxml-php4-to-php5.php |
1955 | 1955 | phpCAS::log('start validatePGT()'); |
1956 | - if ( sizeof($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) { |
|
1956 | + if (sizeof($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) { |
|
1957 | 1957 | phpCAS::trace('<proxyGrantingTicket> not found'); |
1958 | 1958 | // authentication succeded, but no PGT Iou was transmitted |
1959 | 1959 | $this->authError('Ticket validated but no PGT Iou transmitted', |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | // PGT Iou transmitted, extract it |
1966 | 1966 | $pgt_iou = trim($arr[0]->get_content()); |
1967 | 1967 | $pgt = $this->loadPGT($pgt_iou); |
1968 | - if ( $pgt == FALSE ) { |
|
1968 | + if ($pgt == FALSE) { |
|
1969 | 1969 | phpCAS::trace('could not load PGT'); |
1970 | 1970 | $this->authError('PGT Iou was transmitted but PGT could not be retrieved', |
1971 | 1971 | $validate_url, |
@@ -1995,7 +1995,7 @@ discard block |
||
1995 | 1995 | * |
1996 | 1996 | * @private |
1997 | 1997 | */ |
1998 | - function retrievePT($target_service,&$err_code,&$err_msg) |
|
1998 | + function retrievePT($target_service, &$err_code, &$err_msg) |
|
1999 | 1999 | { |
2000 | 2000 | phpCAS::traceBegin(); |
2001 | 2001 | |
@@ -2010,7 +2010,7 @@ discard block |
||
2010 | 2010 | $cas_url = $this->getServerProxyURL().'?targetService='.urlencode($target_service).'&pgt='.$this->getPGT(); |
2011 | 2011 | |
2012 | 2012 | // open and read the URL |
2013 | - if ( !$this->readURL($cas_url,''/*cookies*/,$headers,$cas_response,$err_msg) ) { |
|
2013 | + if (!$this->readURL($cas_url, ''/*cookies*/, $headers, $cas_response, $err_msg)) { |
|
2014 | 2014 | phpCAS::trace('could not open URL \''.$cas_url.'\' to validate ('.$err_msg.')'); |
2015 | 2015 | $err_code = PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE; |
2016 | 2016 | $err_msg = 'could not retrieve PT (no response from the CAS server)'; |
@@ -2020,38 +2020,38 @@ discard block |
||
2020 | 2020 | |
2021 | 2021 | $bad_response = FALSE; |
2022 | 2022 | |
2023 | - if ( !$bad_response ) { |
|
2023 | + if (!$bad_response) { |
|
2024 | 2024 | // read the response of the CAS server into a DOM object |
2025 | - if ( !($dom = @domxml_open_mem($cas_response))) { |
|
2025 | + if (!($dom = @domxml_open_mem($cas_response))) { |
|
2026 | 2026 | phpCAS::trace('domxml_open_mem() failed'); |
2027 | 2027 | // read failed |
2028 | 2028 | $bad_response = TRUE; |
2029 | 2029 | } |
2030 | 2030 | } |
2031 | 2031 | |
2032 | - if ( !$bad_response ) { |
|
2032 | + if (!$bad_response) { |
|
2033 | 2033 | // read the root node of the XML tree |
2034 | - if ( !($root = $dom->document_element()) ) { |
|
2034 | + if (!($root = $dom->document_element())) { |
|
2035 | 2035 | phpCAS::trace('document_element() failed'); |
2036 | 2036 | // read failed |
2037 | 2037 | $bad_response = TRUE; |
2038 | 2038 | } |
2039 | 2039 | } |
2040 | 2040 | |
2041 | - if ( !$bad_response ) { |
|
2041 | + if (!$bad_response) { |
|
2042 | 2042 | // insure that tag name is 'serviceResponse' |
2043 | - if ( $root->node_name() != 'serviceResponse' ) { |
|
2043 | + if ($root->node_name() != 'serviceResponse') { |
|
2044 | 2044 | phpCAS::trace('node_name() failed'); |
2045 | 2045 | // bad root node |
2046 | 2046 | $bad_response = TRUE; |
2047 | 2047 | } |
2048 | 2048 | } |
2049 | 2049 | |
2050 | - if ( !$bad_response ) { |
|
2050 | + if (!$bad_response) { |
|
2051 | 2051 | // look for a proxySuccess tag |
2052 | - if ( sizeof($arr = $root->get_elements_by_tagname("proxySuccess")) != 0) { |
|
2052 | + if (sizeof($arr = $root->get_elements_by_tagname("proxySuccess")) != 0) { |
|
2053 | 2053 | // authentication succeded, look for a proxyTicket tag |
2054 | - if ( sizeof($arr = $root->get_elements_by_tagname("proxyTicket")) != 0) { |
|
2054 | + if (sizeof($arr = $root->get_elements_by_tagname("proxyTicket")) != 0) { |
|
2055 | 2055 | $err_code = PHPCAS_SERVICE_OK; |
2056 | 2056 | $err_msg = ''; |
2057 | 2057 | phpCAS::trace('original PT: '.trim($arr[0]->get_content())); |
@@ -2063,7 +2063,7 @@ discard block |
||
2063 | 2063 | } |
2064 | 2064 | } |
2065 | 2065 | // look for a proxyFailure tag |
2066 | - else if ( sizeof($arr = $root->get_elements_by_tagname("proxyFailure")) != 0) { |
|
2066 | + else if (sizeof($arr = $root->get_elements_by_tagname("proxyFailure")) != 0) { |
|
2067 | 2067 | // authentication failed, extract the error |
2068 | 2068 | $err_code = PHPCAS_SERVICE_PT_FAILURE; |
2069 | 2069 | $err_msg = 'PT retrieving failed (code=`' |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | * |
2106 | 2106 | * @private |
2107 | 2107 | */ |
2108 | - function readURL($url,$cookies,&$headers,&$body,&$err_msg) |
|
2108 | + function readURL($url, $cookies, &$headers, &$body, &$err_msg) |
|
2109 | 2109 | { |
2110 | 2110 | phpCAS::traceBegin(); |
2111 | 2111 | $headers = ''; |
@@ -2117,7 +2117,7 @@ discard block |
||
2117 | 2117 | // initialize the CURL session |
2118 | 2118 | $ch = curl_init($url); |
2119 | 2119 | |
2120 | - if (version_compare(PHP_VERSION,'5.1.3','>=')) { |
|
2120 | + if (version_compare(PHP_VERSION, '5.1.3', '>=')) { |
|
2121 | 2121 | //only avaible in php5 |
2122 | 2122 | curl_setopt_array($ch, $this->_curl_options); |
2123 | 2123 | } else { |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | curl_setopt($ch, CURLOPT_CAINFO, $this->_cas_server_ca_cert); |
2138 | 2138 | curl_setopt($ch, CURLOPT_VERBOSE, '1'); |
2139 | 2139 | phpCAS::trace('CURL: Set all required opts for mutual authentication ------'); |
2140 | - } else if ($this->_cas_server_cert != '' ) { |
|
2140 | + } else if ($this->_cas_server_cert != '') { |
|
2141 | 2141 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); |
2142 | 2142 | curl_setopt($ch, CURLOPT_SSLCERT, $this->_cas_server_cert); |
2143 | 2143 | } else if ($this->_cas_server_ca_cert != '') { |
@@ -2154,12 +2154,12 @@ discard block |
||
2154 | 2154 | $this->_curl_headers = array(); // empty the headers array |
2155 | 2155 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, '_curl_read_headers')); |
2156 | 2156 | // add cookies headers |
2157 | - if ( is_array($cookies) ) { |
|
2158 | - curl_setopt($ch,CURLOPT_COOKIE,implode(';',$cookies)); |
|
2157 | + if (is_array($cookies)) { |
|
2158 | + curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies)); |
|
2159 | 2159 | } |
2160 | 2160 | // add extra stuff if SAML |
2161 | 2161 | if ($this->hasSA()) { |
2162 | - $more_headers = array ("soapaction: http://www.oasis-open.org/committees/security", |
|
2162 | + $more_headers = array("soapaction: http://www.oasis-open.org/committees/security", |
|
2163 | 2163 | "cache-control: no-cache", |
2164 | 2164 | "pragma: no-cache", |
2165 | 2165 | "accept: text/xml", |
@@ -2173,18 +2173,18 @@ discard block |
||
2173 | 2173 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
2174 | 2174 | } |
2175 | 2175 | // perform the query |
2176 | - $buf = curl_exec ($ch); |
|
2176 | + $buf = curl_exec($ch); |
|
2177 | 2177 | //phpCAS::trace('CURL: Call completed. Response body is: \''.$buf.'\''); |
2178 | - if ( $buf === FALSE ) { |
|
2178 | + if ($buf === FALSE) { |
|
2179 | 2179 | phpCAS::trace('curl_exec() failed'); |
2180 | 2180 | $err_msg = 'CURL error #'.curl_errno($ch).': '.curl_error($ch); |
2181 | 2181 | //phpCAS::trace('curl error: '.$err_msg); |
2182 | 2182 | // close the CURL session |
2183 | - curl_close ($ch); |
|
2183 | + curl_close($ch); |
|
2184 | 2184 | $res = FALSE; |
2185 | 2185 | } else { |
2186 | 2186 | // close the CURL session |
2187 | - curl_close ($ch); |
|
2187 | + curl_close($ch); |
|
2188 | 2188 | |
2189 | 2189 | $headers = $this->_curl_headers; |
2190 | 2190 | $body = $buf; |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | $sa = $this->getSA(); |
2210 | 2210 | //phpCAS::trace("SA: ".$sa); |
2211 | 2211 | |
2212 | - $body=SAML_SOAP_ENV.SAML_SOAP_BODY.SAMLP_REQUEST.SAML_ASSERTION_ARTIFACT.$sa.SAML_ASSERTION_ARTIFACT_CLOSE.SAMLP_REQUEST_CLOSE.SAML_SOAP_BODY_CLOSE.SAML_SOAP_ENV_CLOSE; |
|
2212 | + $body = SAML_SOAP_ENV.SAML_SOAP_BODY.SAMLP_REQUEST.SAML_ASSERTION_ARTIFACT.$sa.SAML_ASSERTION_ARTIFACT_CLOSE.SAMLP_REQUEST_CLOSE.SAML_SOAP_BODY_CLOSE.SAML_SOAP_ENV_CLOSE; |
|
2213 | 2213 | |
2214 | 2214 | phpCAS::traceEnd($body); |
2215 | 2215 | return ($body); |
@@ -2240,36 +2240,36 @@ discard block |
||
2240 | 2240 | * |
2241 | 2241 | * @public |
2242 | 2242 | */ |
2243 | - function serviceWeb($url,&$err_code,&$output) |
|
2243 | + function serviceWeb($url, &$err_code, &$output) |
|
2244 | 2244 | { |
2245 | 2245 | phpCAS::traceBegin(); |
2246 | 2246 | // at first retrieve a PT |
2247 | - $pt = $this->retrievePT($url,$err_code,$output); |
|
2247 | + $pt = $this->retrievePT($url, $err_code, $output); |
|
2248 | 2248 | |
2249 | 2249 | $res = TRUE; |
2250 | 2250 | |
2251 | 2251 | // test if PT was retrieved correctly |
2252 | - if ( !$pt ) { |
|
2252 | + if (!$pt) { |
|
2253 | 2253 | // note: $err_code and $err_msg are filled by CASClient::retrievePT() |
2254 | 2254 | phpCAS::trace('PT was not retrieved correctly'); |
2255 | 2255 | $res = FALSE; |
2256 | 2256 | } else { |
2257 | 2257 | // add cookies if necessary |
2258 | - if ( is_array($_SESSION['phpCAS']['services'][$url]['cookies']) ) { |
|
2259 | - foreach ( $_SESSION['phpCAS']['services'][$url]['cookies'] as $name => $val ) { |
|
2258 | + if (is_array($_SESSION['phpCAS']['services'][$url]['cookies'])) { |
|
2259 | + foreach ($_SESSION['phpCAS']['services'][$url]['cookies'] as $name => $val) { |
|
2260 | 2260 | $cookies[] = $name.'='.$val; |
2261 | 2261 | } |
2262 | 2262 | } |
2263 | 2263 | |
2264 | 2264 | // build the URL including the PT |
2265 | - if ( strstr($url,'?') === FALSE ) { |
|
2265 | + if (strstr($url, '?') === FALSE) { |
|
2266 | 2266 | $service_url = $url.'?ticket='.$pt; |
2267 | 2267 | } else { |
2268 | 2268 | $service_url = $url.'&ticket='.$pt; |
2269 | 2269 | } |
2270 | 2270 | |
2271 | 2271 | phpCAS::trace('reading URL`'.$service_url.'\''); |
2272 | - if ( !$this->readURL($service_url,$cookies,$headers,$output,$err_msg) ) { |
|
2272 | + if (!$this->readURL($service_url, $cookies, $headers, $output, $err_msg)) { |
|
2273 | 2273 | phpCAS::trace('could not read URL`'.$service_url.'\''); |
2274 | 2274 | $err_code = PHPCAS_SERVICE_NOT_AVAILABLE; |
2275 | 2275 | // give an error message |
@@ -2280,15 +2280,15 @@ discard block |
||
2280 | 2280 | } else { |
2281 | 2281 | // URL has been fetched, extract the cookies |
2282 | 2282 | phpCAS::trace('URL`'.$service_url.'\' has been read, storing cookies:'); |
2283 | - foreach ( $headers as $header ) { |
|
2283 | + foreach ($headers as $header) { |
|
2284 | 2284 | // test if the header is a cookie |
2285 | - if ( preg_match('/^Set-Cookie:/',$header) ) { |
|
2285 | + if (preg_match('/^Set-Cookie:/', $header)) { |
|
2286 | 2286 | // the header is a cookie, remove the beginning |
2287 | - $header_val = preg_replace('/^Set-Cookie: */','',$header); |
|
2287 | + $header_val = preg_replace('/^Set-Cookie: */', '', $header); |
|
2288 | 2288 | // extract interesting information |
2289 | - $name_val = strtok($header_val,'; '); |
|
2289 | + $name_val = strtok($header_val, '; '); |
|
2290 | 2290 | // extract the name and the value of the cookie |
2291 | - $cookie_name = strtok($name_val,'='); |
|
2291 | + $cookie_name = strtok($name_val, '='); |
|
2292 | 2292 | $cookie_val = strtok('='); |
2293 | 2293 | // store the cookie |
2294 | 2294 | $_SESSION['phpCAS']['services'][$url]['cookies'][$cookie_name] = $cookie_val; |
@@ -2321,28 +2321,28 @@ discard block |
||
2321 | 2321 | * |
2322 | 2322 | * @public |
2323 | 2323 | */ |
2324 | - function serviceMail($url,$service,$flags,&$err_code,&$err_msg,&$pt) |
|
2324 | + function serviceMail($url, $service, $flags, &$err_code, &$err_msg, &$pt) |
|
2325 | 2325 | { |
2326 | 2326 | phpCAS::traceBegin(); |
2327 | 2327 | // at first retrieve a PT |
2328 | - $pt = $this->retrievePT($service,$err_code,$output); |
|
2328 | + $pt = $this->retrievePT($service, $err_code, $output); |
|
2329 | 2329 | |
2330 | 2330 | $stream = FALSE; |
2331 | 2331 | |
2332 | 2332 | // test if PT was retrieved correctly |
2333 | - if ( !$pt ) { |
|
2333 | + if (!$pt) { |
|
2334 | 2334 | // note: $err_code and $err_msg are filled by CASClient::retrievePT() |
2335 | 2335 | phpCAS::trace('PT was not retrieved correctly'); |
2336 | 2336 | } else { |
2337 | 2337 | phpCAS::trace('opening IMAP URL `'.$url.'\'...'); |
2338 | - $stream = @imap_open($url,$this->getUser(),$pt,$flags); |
|
2339 | - if ( !$stream ) { |
|
2338 | + $stream = @imap_open($url, $this->getUser(), $pt, $flags); |
|
2339 | + if (!$stream) { |
|
2340 | 2340 | phpCAS::trace('could not open URL'); |
2341 | 2341 | $err_code = PHPCAS_SERVICE_NOT_AVAILABLE; |
2342 | 2342 | // give an error message |
2343 | 2343 | $err_msg = sprintf($this->getString(CAS_STR_SERVICE_UNAVAILABLE), |
2344 | 2344 | $service_url, |
2345 | - var_export(imap_errors(),TRUE)); |
|
2345 | + var_export(imap_errors(), TRUE)); |
|
2346 | 2346 | $pt = FALSE; |
2347 | 2347 | $stream = FALSE; |
2348 | 2348 | } else { |
@@ -2446,19 +2446,19 @@ discard block |
||
2446 | 2446 | * |
2447 | 2447 | * @private |
2448 | 2448 | */ |
2449 | - function validatePT(&$validate_url,&$text_response,&$tree_response) |
|
2449 | + function validatePT(&$validate_url, &$text_response, &$tree_response) |
|
2450 | 2450 | { |
2451 | 2451 | phpCAS::traceBegin(); |
2452 | 2452 | // build the URL to validate the ticket |
2453 | 2453 | $validate_url = $this->getServerProxyValidateURL().'&ticket='.$this->getPT(); |
2454 | 2454 | |
2455 | - if ( $this->isProxy() ) { |
|
2455 | + if ($this->isProxy()) { |
|
2456 | 2456 | // pass the callback url for CAS proxies |
2457 | 2457 | $validate_url .= '&pgtUrl='.$this->getCallbackURL(); |
2458 | 2458 | } |
2459 | 2459 | |
2460 | 2460 | // open and read the URL |
2461 | - if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) { |
|
2461 | + if (!$this->readURL($validate_url, ''/*cookies*/, $headers, $text_response, $err_msg)) { |
|
2462 | 2462 | phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')'); |
2463 | 2463 | $this->authError('PT not validated', |
2464 | 2464 | $validate_url, |
@@ -2466,7 +2466,7 @@ discard block |
||
2466 | 2466 | } |
2467 | 2467 | |
2468 | 2468 | // read the response of the CAS server into a DOM object |
2469 | - if ( !($dom = domxml_open_mem($text_response))) { |
|
2469 | + if (!($dom = domxml_open_mem($text_response))) { |
|
2470 | 2470 | // read failed |
2471 | 2471 | $this->authError('PT not validated', |
2472 | 2472 | $validate_url, |
@@ -2475,7 +2475,7 @@ discard block |
||
2475 | 2475 | $text_response); |
2476 | 2476 | } |
2477 | 2477 | // read the root node of the XML tree |
2478 | - if ( !($tree_response = $dom->document_element()) ) { |
|
2478 | + if (!($tree_response = $dom->document_element())) { |
|
2479 | 2479 | // read failed |
2480 | 2480 | $this->authError('PT not validated', |
2481 | 2481 | $validate_url, |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $text_response); |
2485 | 2485 | } |
2486 | 2486 | // insure that tag name is 'serviceResponse' |
2487 | - if ( $tree_response->node_name() != 'serviceResponse' ) { |
|
2487 | + if ($tree_response->node_name() != 'serviceResponse') { |
|
2488 | 2488 | // bad root node |
2489 | 2489 | $this->authError('PT not validated', |
2490 | 2490 | $validate_url, |
@@ -2492,9 +2492,9 @@ discard block |
||
2492 | 2492 | TRUE/*$bad_response*/, |
2493 | 2493 | $text_response); |
2494 | 2494 | } |
2495 | - if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { |
|
2495 | + if (sizeof($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { |
|
2496 | 2496 | // authentication succeded, extract the user name |
2497 | - if ( sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) { |
|
2497 | + if (sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) { |
|
2498 | 2498 | // no user specified => error |
2499 | 2499 | $this->authError('PT not validated', |
2500 | 2500 | $validate_url, |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | } |
2505 | 2505 | $this->setUser(trim($arr[0]->get_content())); |
2506 | 2506 | |
2507 | - } else if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { |
|
2507 | + } else if (sizeof($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { |
|
2508 | 2508 | // authentication succeded, extract the error code and message |
2509 | 2509 | $this->authError('PT not validated', |
2510 | 2510 | $validate_url, |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | { |
2565 | 2565 | phpCAS::traceBegin(); |
2566 | 2566 | // the URL is built when needed only |
2567 | - if ( empty($this->_url) ) { |
|
2567 | + if (empty($this->_url)) { |
|
2568 | 2568 | $final_uri = ''; |
2569 | 2569 | // remove the ticket if present in the URL |
2570 | 2570 | $final_uri = ($this->isHttps()) ? 'https' : 'http'; |
@@ -2572,7 +2572,7 @@ discard block |
||
2572 | 2572 | /* replaced by Julien Marchal - v0.4.6 |
2573 | 2573 | * $this->_url .= $_SERVER['SERVER_NAME']; |
2574 | 2574 | */ |
2575 | - if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){ |
|
2575 | + if (empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { |
|
2576 | 2576 | /* replaced by teedog - v0.4.12 |
2577 | 2577 | * $this->_url .= $_SERVER['SERVER_NAME']; |
2578 | 2578 | */ |
@@ -2586,8 +2586,8 @@ discard block |
||
2586 | 2586 | } |
2587 | 2587 | $final_uri .= $server_name; |
2588 | 2588 | if (!strpos($server_name, ':')) { |
2589 | - if ( ($this->isHttps() && $_SERVER['SERVER_PORT']!=443) |
|
2590 | - || (!$this->isHttps() && $_SERVER['SERVER_PORT']!=80) ) { |
|
2589 | + if (($this->isHttps() && $_SERVER['SERVER_PORT'] != 443) |
|
2590 | + || (!$this->isHttps() && $_SERVER['SERVER_PORT'] != 80)) { |
|
2591 | 2591 | $final_uri .= ':'; |
2592 | 2592 | $final_uri .= $_SERVER['SERVER_PORT']; |
2593 | 2593 | } |
@@ -2598,11 +2598,11 @@ discard block |
||
2598 | 2598 | |
2599 | 2599 | if (isset($request_uri[1]) && $request_uri[1]) |
2600 | 2600 | { |
2601 | - $query_string = $this->removeParameterFromQueryString('ticket', $request_uri[1]); |
|
2601 | + $query_string = $this->removeParameterFromQueryString('ticket', $request_uri[1]); |
|
2602 | 2602 | |
2603 | 2603 | // If the query string still has anything left, append it to the final URI |
2604 | 2604 | if ($query_string !== '') |
2605 | - $final_uri .= "?$query_string"; |
|
2605 | + $final_uri .= "?$query_string"; |
|
2606 | 2606 | |
2607 | 2607 | } |
2608 | 2608 | |
@@ -2626,7 +2626,7 @@ discard block |
||
2626 | 2626 | */ |
2627 | 2627 | function removeParameterFromQueryString($parameterName, $queryString) |
2628 | 2628 | { |
2629 | - $parameterName = preg_quote($parameterName); |
|
2629 | + $parameterName = preg_quote($parameterName); |
|
2630 | 2630 | return preg_replace("/&$parameterName(=[^&]*)?|^$parameterName(=[^&]*)?&?/", '', $queryString); |
2631 | 2631 | } |
2632 | 2632 | |
@@ -2661,18 +2661,18 @@ discard block |
||
2661 | 2661 | * |
2662 | 2662 | * @private |
2663 | 2663 | */ |
2664 | - function authError($failure,$cas_url,$no_response,$bad_response='',$cas_response='',$err_code='',$err_msg='') |
|
2664 | + function authError($failure, $cas_url, $no_response, $bad_response = '', $cas_response = '', $err_code = '', $err_msg = '') |
|
2665 | 2665 | { |
2666 | 2666 | phpCAS::traceBegin(); |
2667 | 2667 | |
2668 | 2668 | $this->printHTMLHeader($this->getString(CAS_STR_AUTHENTICATION_FAILED)); |
2669 | - printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED),htmlentities($this->getURL()),$_SERVER['SERVER_ADMIN']); |
|
2669 | + printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED), htmlentities($this->getURL()), $_SERVER['SERVER_ADMIN']); |
|
2670 | 2670 | phpCAS::trace('CAS URL: '.$cas_url); |
2671 | 2671 | phpCAS::trace('Authentication failure: '.$failure); |
2672 | - if ( $no_response ) { |
|
2672 | + if ($no_response) { |
|
2673 | 2673 | phpCAS::trace('Reason: no response from the CAS server'); |
2674 | 2674 | } else { |
2675 | - if ( $bad_response ) { |
|
2675 | + if ($bad_response) { |
|
2676 | 2676 | phpCAS::trace('Reason: bad response from the CAS server'); |
2677 | 2677 | } else { |
2678 | 2678 | switch ($this->getServerVersion()) { |
@@ -2680,7 +2680,7 @@ discard block |
||
2680 | 2680 | phpCAS::trace('Reason: CAS error'); |
2681 | 2681 | break; |
2682 | 2682 | case CAS_VERSION_2_0: |
2683 | - if ( empty($err_code) ) |
|
2683 | + if (empty($err_code)) |
|
2684 | 2684 | phpCAS::trace('Reason: no CAS error'); |
2685 | 2685 | else |
2686 | 2686 | phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg); |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | // hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS |
34 | 34 | // |
35 | 35 | if (!$_SERVER['REQUEST_URI']) { |
36 | - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; |
|
36 | + $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // |
40 | 40 | // another one by Vangelis Haniotakis also to make phpCAS work with PHP5 |
41 | 41 | // |
42 | 42 | if (version_compare(PHP_VERSION, '5', '>=')) { |
43 | - require_once (dirname(__FILE__) . '/CAS/domxml-php4-to-php5.php'); |
|
43 | + require_once (dirname(__FILE__).'/CAS/domxml-php4-to-php5.php'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @hideinitializer |
283 | 283 | */ |
284 | -$GLOBALS['PHPCAS_INIT_CALL'] = array ( |
|
284 | +$GLOBALS['PHPCAS_INIT_CALL'] = array( |
|
285 | 285 | 'done' => FALSE, |
286 | 286 | 'file' => '?', |
287 | 287 | 'line' => -1, |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @hideinitializer |
296 | 296 | */ |
297 | -$GLOBALS['PHPCAS_AUTH_CHECK_CALL'] = array ( |
|
297 | +$GLOBALS['PHPCAS_AUTH_CHECK_CALL'] = array( |
|
298 | 298 | 'done' => FALSE, |
299 | 299 | 'file' => '?', |
300 | 300 | 'line' => -1, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @hideinitializer |
309 | 309 | */ |
310 | -$GLOBALS['PHPCAS_DEBUG'] = array ( |
|
310 | +$GLOBALS['PHPCAS_DEBUG'] = array( |
|
311 | 311 | 'filename' => '/tmp/cas.log', |
312 | 312 | 'indent' => 0, |
313 | 313 | 'unique_id' => '' |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // ######################################################################## |
321 | 321 | |
322 | 322 | // include client class |
323 | -include_once (dirname(__FILE__) . '/CAS/client.php'); |
|
323 | +include_once (dirname(__FILE__).'/CAS/client.php'); |
|
324 | 324 | |
325 | 325 | // ######################################################################## |
326 | 326 | // INTERFACE CLASS |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | phpCAS :: traceBegin(); |
370 | 370 | if (is_object($PHPCAS_CLIENT)) { |
371 | - phpCAS :: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')'); |
|
371 | + phpCAS :: error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); |
|
372 | 372 | } |
373 | 373 | if (gettype($server_version) != 'string') { |
374 | 374 | phpCAS :: error('type mismatched for parameter $server_version (should be `string\')'); |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | |
386 | 386 | // store where the initializer is called from |
387 | 387 | $dbg = phpCAS :: backtrace(); |
388 | - $PHPCAS_INIT_CALL = array ( |
|
388 | + $PHPCAS_INIT_CALL = array( |
|
389 | 389 | 'done' => TRUE, |
390 | 390 | 'file' => $dbg[0]['file'], |
391 | 391 | 'line' => $dbg[0]['line'], |
392 | - 'method' => __CLASS__ . '::' . __FUNCTION__ |
|
392 | + 'method' => __CLASS__.'::'.__FUNCTION__ |
|
393 | 393 | ); |
394 | 394 | |
395 | 395 | // initialize the global object $PHPCAS_CLIENT |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | phpCAS :: traceBegin(); |
419 | 419 | if (is_object($PHPCAS_CLIENT)) { |
420 | - phpCAS :: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')'); |
|
420 | + phpCAS :: error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); |
|
421 | 421 | } |
422 | 422 | if (gettype($server_version) != 'string') { |
423 | 423 | phpCAS :: error('type mismatched for parameter $server_version (should be `string\')'); |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | |
435 | 435 | // store where the initialzer is called from |
436 | 436 | $dbg = phpCAS :: backtrace(); |
437 | - $PHPCAS_INIT_CALL = array ( |
|
437 | + $PHPCAS_INIT_CALL = array( |
|
438 | 438 | 'done' => TRUE, |
439 | 439 | 'file' => $dbg[0]['file'], |
440 | 440 | 'line' => $dbg[0]['line'], |
441 | - 'method' => __CLASS__ . '::' . __FUNCTION__ |
|
441 | + 'method' => __CLASS__.'::'.__FUNCTION__ |
|
442 | 442 | ); |
443 | 443 | |
444 | 444 | // initialize the global object $PHPCAS_CLIENT |
@@ -472,17 +472,17 @@ discard block |
||
472 | 472 | if (empty ($filename)) { |
473 | 473 | if (preg_match('/^Win.*/', getenv('OS'))) { |
474 | 474 | if (isset ($_ENV['TMP'])) { |
475 | - $debugDir = $_ENV['TMP'] . '/'; |
|
475 | + $debugDir = $_ENV['TMP'].'/'; |
|
476 | 476 | } else |
477 | 477 | if (isset ($_ENV['TEMP'])) { |
478 | - $debugDir = $_ENV['TEMP'] . '/'; |
|
478 | + $debugDir = $_ENV['TEMP'].'/'; |
|
479 | 479 | } else { |
480 | 480 | $debugDir = ''; |
481 | 481 | } |
482 | 482 | } else { |
483 | 483 | $debugDir = DEFAULT_DEBUG_DIR; |
484 | 484 | } |
485 | - $filename = $debugDir . 'phpCAS.log'; |
|
485 | + $filename = $debugDir.'phpCAS.log'; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | if (empty ($PHPCAS_DEBUG['unique_id'])) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | return debug_backtrace(); |
510 | 510 | } else { |
511 | 511 | // poor man's hack ... but it does work ... |
512 | - return array (); |
|
512 | + return array(); |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | for ($i = 0; $i < $PHPCAS_DEBUG['indent']; $i++) { |
529 | 529 | $indent_str .= '| '; |
530 | 530 | } |
531 | - error_log($PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str . "\n", 3, $PHPCAS_DEBUG['filename']); |
|
531 | + error_log($PHPCAS_DEBUG['unique_id'].' '.$indent_str.$str."\n", 3, $PHPCAS_DEBUG['filename']); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | } |
559 | 559 | } |
560 | - echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>" . __CLASS__ . "::" . $function . '(): ' . htmlentities($msg) . "</b></font> in <b>" . $file . "</b> on line <b>" . $line . "</b><br />\n"; |
|
560 | + echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg)."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n"; |
|
561 | 561 | phpCAS :: trace($msg); |
562 | 562 | phpCAS :: traceExit(); |
563 | 563 | exit (); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | function trace($str) { |
570 | 570 | $dbg = phpCAS :: backtrace(); |
571 | - phpCAS :: log($str . ' [' . basename($dbg[1]['file']) . ':' . $dbg[1]['line'] . ']'); |
|
571 | + phpCAS :: log($str.' ['.basename($dbg[1]['file']).':'.$dbg[1]['line'].']'); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | $dbg = phpCAS :: backtrace(); |
581 | 581 | $str = '=> '; |
582 | 582 | if (!empty ($dbg[2]['class'])) { |
583 | - $str .= $dbg[2]['class'] . '::'; |
|
583 | + $str .= $dbg[2]['class'].'::'; |
|
584 | 584 | } |
585 | - $str .= $dbg[2]['function'] . '('; |
|
585 | + $str .= $dbg[2]['function'].'('; |
|
586 | 586 | if (is_array($dbg[2]['args'])) { |
587 | 587 | foreach ($dbg[2]['args'] as $index => $arg) { |
588 | 588 | if ($index != 0) { |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | $str .= str_replace("\n", "", var_export($arg, TRUE)); |
592 | 592 | } |
593 | 593 | } |
594 | - $str .= ') [' . basename($dbg[2]['file']) . ':' . $dbg[2]['line'] . ']'; |
|
594 | + $str .= ') ['.basename($dbg[2]['file']).':'.$dbg[2]['line'].']'; |
|
595 | 595 | phpCAS :: log($str); |
596 | 596 | $PHPCAS_DEBUG['indent']++; |
597 | 597 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | $PHPCAS_DEBUG['indent']--; |
608 | 608 | $dbg = phpCAS :: backtrace(); |
609 | 609 | $str = ''; |
610 | - $str .= '<= ' . str_replace("\n", "", var_export($res, TRUE)); |
|
610 | + $str .= '<= '.str_replace("\n", "", var_export($res, TRUE)); |
|
611 | 611 | phpCAS :: log($str); |
612 | 612 | } |
613 | 613 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | function setLang($lang) { |
645 | 645 | global $PHPCAS_CLIENT; |
646 | 646 | if (!is_object($PHPCAS_CLIENT)) { |
647 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
647 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
648 | 648 | } |
649 | 649 | if (gettype($lang) != 'string') { |
650 | 650 | phpCAS :: error('type mismatched for parameter $lang (should be `string\')'); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | function setHTMLHeader($header) { |
688 | 688 | global $PHPCAS_CLIENT; |
689 | 689 | if (!is_object($PHPCAS_CLIENT)) { |
690 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
690 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
691 | 691 | } |
692 | 692 | if (gettype($header) != 'string') { |
693 | 693 | phpCAS :: error('type mismatched for parameter $header (should be `string\')'); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | function setHTMLFooter($footer) { |
704 | 704 | global $PHPCAS_CLIENT; |
705 | 705 | if (!is_object($PHPCAS_CLIENT)) { |
706 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
706 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
707 | 707 | } |
708 | 708 | if (gettype($footer) != 'string') { |
709 | 709 | phpCAS :: error('type mismatched for parameter $footer (should be `string\')'); |
@@ -732,13 +732,13 @@ discard block |
||
732 | 732 | |
733 | 733 | phpCAS :: traceBegin(); |
734 | 734 | if (!is_object($PHPCAS_CLIENT)) { |
735 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
735 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
736 | 736 | } |
737 | 737 | if (!$PHPCAS_CLIENT->isProxy()) { |
738 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
738 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
739 | 739 | } |
740 | 740 | if ($PHPCAS_AUTH_CHECK_CALL['done']) { |
741 | - phpCAS :: error('this method should only be called before ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() (called at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ')'); |
|
741 | + phpCAS :: error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); |
|
742 | 742 | } |
743 | 743 | if (gettype($format) != 'string') { |
744 | 744 | phpCAS :: error('type mismatched for parameter $format (should be `string\')'); |
@@ -770,13 +770,13 @@ discard block |
||
770 | 770 | |
771 | 771 | phpCAS :: traceBegin(); |
772 | 772 | if (!is_object($PHPCAS_CLIENT)) { |
773 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
773 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
774 | 774 | } |
775 | 775 | if (!$PHPCAS_CLIENT->isProxy()) { |
776 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
776 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
777 | 777 | } |
778 | 778 | if ($PHPCAS_AUTH_CHECK_CALL['done']) { |
779 | - phpCAS :: error('this method should only be called before ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() (called at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ')'); |
|
779 | + phpCAS :: error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); |
|
780 | 780 | } |
781 | 781 | if (gettype($user) != 'string') { |
782 | 782 | phpCAS :: error('type mismatched for parameter $user (should be `string\')'); |
@@ -830,16 +830,16 @@ discard block |
||
830 | 830 | |
831 | 831 | phpCAS :: traceBegin(); |
832 | 832 | if (!is_object($PHPCAS_CLIENT)) { |
833 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
833 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
834 | 834 | } |
835 | 835 | if (!$PHPCAS_CLIENT->isProxy()) { |
836 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
836 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
837 | 837 | } |
838 | 838 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
839 | - phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()'); |
|
839 | + phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); |
|
840 | 840 | } |
841 | 841 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
842 | - phpCAS :: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
842 | + phpCAS :: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
843 | 843 | } |
844 | 844 | if (gettype($url) != 'string') { |
845 | 845 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
@@ -873,16 +873,16 @@ discard block |
||
873 | 873 | |
874 | 874 | phpCAS :: traceBegin(); |
875 | 875 | if (!is_object($PHPCAS_CLIENT)) { |
876 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
876 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
877 | 877 | } |
878 | 878 | if (!$PHPCAS_CLIENT->isProxy()) { |
879 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
879 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
880 | 880 | } |
881 | 881 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
882 | - phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()'); |
|
882 | + phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); |
|
883 | 883 | } |
884 | 884 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
885 | - phpCAS :: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
885 | + phpCAS :: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
886 | 886 | } |
887 | 887 | if (gettype($url) != 'string') { |
888 | 888 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | function setCacheTimesForAuthRecheck($n) { |
919 | 919 | global $PHPCAS_CLIENT; |
920 | 920 | if (!is_object($PHPCAS_CLIENT)) { |
921 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
921 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
922 | 922 | } |
923 | 923 | if (gettype($n) != 'integer') { |
924 | 924 | phpCAS :: error('type mismatched for parameter $header (should be `string\')'); |
@@ -935,18 +935,18 @@ discard block |
||
935 | 935 | |
936 | 936 | phpCAS :: traceBegin(); |
937 | 937 | if (!is_object($PHPCAS_CLIENT)) { |
938 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
938 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
939 | 939 | } |
940 | 940 | |
941 | 941 | $auth = $PHPCAS_CLIENT->checkAuthentication(); |
942 | 942 | |
943 | 943 | // store where the authentication has been checked and the result |
944 | 944 | $dbg = phpCAS :: backtrace(); |
945 | - $PHPCAS_AUTH_CHECK_CALL = array ( |
|
945 | + $PHPCAS_AUTH_CHECK_CALL = array( |
|
946 | 946 | 'done' => TRUE, |
947 | 947 | 'file' => $dbg[0]['file'], |
948 | 948 | 'line' => $dbg[0]['line'], |
949 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
949 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
950 | 950 | 'result' => $auth |
951 | 951 | ); |
952 | 952 | phpCAS :: traceEnd($auth); |
@@ -963,18 +963,18 @@ discard block |
||
963 | 963 | |
964 | 964 | phpCAS :: traceBegin(); |
965 | 965 | if (!is_object($PHPCAS_CLIENT)) { |
966 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
966 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | $auth = $PHPCAS_CLIENT->forceAuthentication(); |
970 | 970 | |
971 | 971 | // store where the authentication has been checked and the result |
972 | 972 | $dbg = phpCAS :: backtrace(); |
973 | - $PHPCAS_AUTH_CHECK_CALL = array ( |
|
973 | + $PHPCAS_AUTH_CHECK_CALL = array( |
|
974 | 974 | 'done' => TRUE, |
975 | 975 | 'file' => $dbg[0]['file'], |
976 | 976 | 'line' => $dbg[0]['line'], |
977 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
977 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
978 | 978 | 'result' => $auth |
979 | 979 | ); |
980 | 980 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | phpCAS :: trace('user is not authenticated, redirecting to the CAS server'); |
983 | 983 | $PHPCAS_CLIENT->forceAuthentication(); |
984 | 984 | } else { |
985 | - phpCAS :: trace('no need to authenticate (user `' . phpCAS :: getUser() . '\' is already authenticated)'); |
|
985 | + phpCAS :: trace('no need to authenticate (user `'.phpCAS :: getUser().'\' is already authenticated)'); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | phpCAS :: traceEnd(); |
@@ -997,16 +997,16 @@ discard block |
||
997 | 997 | |
998 | 998 | phpCAS :: traceBegin(); |
999 | 999 | if (!is_object($PHPCAS_CLIENT)) { |
1000 | - phpCAS :: error('this method should not be called before' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1000 | + phpCAS :: error('this method should not be called before'.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | // store where the authentication has been checked and the result |
1004 | 1004 | $dbg = phpCAS :: backtrace(); |
1005 | - $PHPCAS_AUTH_CHECK_CALL = array ( |
|
1005 | + $PHPCAS_AUTH_CHECK_CALL = array( |
|
1006 | 1006 | 'done' => TRUE, |
1007 | 1007 | 'file' => $dbg[0]['file'], |
1008 | 1008 | 'line' => $dbg[0]['line'], |
1009 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
1009 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
1010 | 1010 | 'result' => $auth |
1011 | 1011 | ); |
1012 | 1012 | |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | * This method has been left from version 0.4.1 for compatibility reasons. |
1019 | 1019 | */ |
1020 | 1020 | function authenticate() { |
1021 | - phpCAS :: error('this method is deprecated. You should use ' . __CLASS__ . '::forceAuthentication() instead'); |
|
1021 | + phpCAS :: error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead'); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | /** |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | |
1033 | 1033 | phpCAS :: traceBegin(); |
1034 | 1034 | if (!is_object($PHPCAS_CLIENT)) { |
1035 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1035 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | // call the isAuthenticated method of the global $PHPCAS_CLIENT object |
@@ -1040,11 +1040,11 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | // store where the authentication has been checked and the result |
1042 | 1042 | $dbg = phpCAS :: backtrace(); |
1043 | - $PHPCAS_AUTH_CHECK_CALL = array ( |
|
1043 | + $PHPCAS_AUTH_CHECK_CALL = array( |
|
1044 | 1044 | 'done' => TRUE, |
1045 | 1045 | 'file' => $dbg[0]['file'], |
1046 | 1046 | 'line' => $dbg[0]['line'], |
1047 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
1047 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
1048 | 1048 | 'result' => $auth |
1049 | 1049 | ); |
1050 | 1050 | phpCAS :: traceEnd($auth); |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | function isSessionAuthenticated() { |
1061 | 1061 | global $PHPCAS_CLIENT; |
1062 | 1062 | if (!is_object($PHPCAS_CLIENT)) { |
1063 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1063 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1064 | 1064 | } |
1065 | 1065 | return ($PHPCAS_CLIENT->isSessionAuthenticated()); |
1066 | 1066 | } |
@@ -1075,13 +1075,13 @@ discard block |
||
1075 | 1075 | function getUser() { |
1076 | 1076 | global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; |
1077 | 1077 | if (!is_object($PHPCAS_CLIENT)) { |
1078 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1078 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1079 | 1079 | } |
1080 | 1080 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
1081 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()'); |
|
1081 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
|
1082 | 1082 | } |
1083 | 1083 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
1084 | - phpCAS :: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
1084 | + phpCAS :: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
1085 | 1085 | } |
1086 | 1086 | return $PHPCAS_CLIENT->getUser(); |
1087 | 1087 | } |
@@ -1096,13 +1096,13 @@ discard block |
||
1096 | 1096 | function getAttributes() { |
1097 | 1097 | global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; |
1098 | 1098 | if (!is_object($PHPCAS_CLIENT)) { |
1099 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1099 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1100 | 1100 | } |
1101 | 1101 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
1102 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()'); |
|
1102 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
|
1103 | 1103 | } |
1104 | 1104 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
1105 | - phpCAS :: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
1105 | + phpCAS :: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
1106 | 1106 | } |
1107 | 1107 | return $PHPCAS_CLIENT->getAttributes(); |
1108 | 1108 | } |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | function handleLogoutRequests($check_client = true, $allowed_clients = false) { |
1113 | 1113 | global $PHPCAS_CLIENT; |
1114 | 1114 | if (!is_object($PHPCAS_CLIENT)) { |
1115 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1115 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1116 | 1116 | } |
1117 | 1117 | return ($PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients)); |
1118 | 1118 | } |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | function getServerLoginURL() { |
1127 | 1127 | global $PHPCAS_CLIENT; |
1128 | 1128 | if (!is_object($PHPCAS_CLIENT)) { |
1129 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1129 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1130 | 1130 | } |
1131 | 1131 | return $PHPCAS_CLIENT->getServerLoginURL(); |
1132 | 1132 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | phpCAS :: traceBegin(); |
1142 | 1142 | if (!is_object($PHPCAS_CLIENT)) { |
1143 | 1143 | phpCAS :: error('this method should only be called after |
1144 | - ' . __CLASS__ . '::client()'); |
|
1144 | + ' . __CLASS__.'::client()'); |
|
1145 | 1145 | } |
1146 | 1146 | if (gettype($url) != 'string') { |
1147 | 1147 | phpCAS :: error('type mismatched for parameter $url (should be |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | phpCAS :: traceBegin(); |
1163 | 1163 | if (!is_object($PHPCAS_CLIENT)) { |
1164 | 1164 | phpCAS :: error('this method should only be called after |
1165 | - ' . __CLASS__ . '::client()'); |
|
1165 | + ' . __CLASS__.'::client()'); |
|
1166 | 1166 | } |
1167 | 1167 | if (gettype($url) != 'string') { |
1168 | 1168 | phpCAS :: error('type mismatched for parameter $url (should be |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | phpCAS :: traceBegin(); |
1184 | 1184 | if (!is_object($PHPCAS_CLIENT)) { |
1185 | 1185 | phpCAS :: error('this method should only be called after |
1186 | - ' . __CLASS__ . '::client()'); |
|
1186 | + ' . __CLASS__.'::client()'); |
|
1187 | 1187 | } |
1188 | 1188 | if (gettype($url) != 'string') { |
1189 | 1189 | phpCAS :: error('type mismatched for parameter $url (should be |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | phpCAS :: traceBegin(); |
1204 | 1204 | if (!is_object($PHPCAS_CLIENT)) { |
1205 | 1205 | phpCAS :: error('this method should only be called after |
1206 | - ' . __CLASS__ . '::client()'); |
|
1206 | + ' . __CLASS__.'::client()'); |
|
1207 | 1207 | } |
1208 | 1208 | if (gettype($url) != 'string') { |
1209 | 1209 | phpCAS :: error('type mismatched for parameter $url (should be |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | function getServerLogoutURL() { |
1223 | 1223 | global $PHPCAS_CLIENT; |
1224 | 1224 | if (!is_object($PHPCAS_CLIENT)) { |
1225 | - phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1225 | + phpCAS :: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1226 | 1226 | } |
1227 | 1227 | return $PHPCAS_CLIENT->getServerLogoutURL(); |
1228 | 1228 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | phpCAS :: traceBegin(); |
1238 | 1238 | if (!is_object($PHPCAS_CLIENT)) { |
1239 | 1239 | phpCAS :: error('this method should only be called after |
1240 | - ' . __CLASS__ . '::client()'); |
|
1240 | + ' . __CLASS__.'::client()'); |
|
1241 | 1241 | } |
1242 | 1242 | if (gettype($url) != 'string') { |
1243 | 1243 | phpCAS :: error('type mismatched for parameter $url (should be |
@@ -1256,9 +1256,9 @@ discard block |
||
1256 | 1256 | global $PHPCAS_CLIENT; |
1257 | 1257 | phpCAS :: traceBegin(); |
1258 | 1258 | if (!is_object($PHPCAS_CLIENT)) { |
1259 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1259 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1260 | 1260 | } |
1261 | - $parsedParams = array (); |
|
1261 | + $parsedParams = array(); |
|
1262 | 1262 | if ($params != "") { |
1263 | 1263 | if (is_string($params)) { |
1264 | 1264 | phpCAS :: error('method `phpCAS::logout($url)\' is now deprecated, use `phpCAS::logoutWithUrl($url)\' instead'); |
@@ -1286,12 +1286,12 @@ discard block |
||
1286 | 1286 | global $PHPCAS_CLIENT; |
1287 | 1287 | phpCAS :: traceBegin(); |
1288 | 1288 | if (!is_object($PHPCAS_CLIENT)) { |
1289 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1289 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1290 | 1290 | } |
1291 | 1291 | if (!is_string($service)) { |
1292 | 1292 | phpCAS :: error('type mismatched for parameter $service (should be `string\')'); |
1293 | 1293 | } |
1294 | - $PHPCAS_CLIENT->logout(array ( |
|
1294 | + $PHPCAS_CLIENT->logout(array( |
|
1295 | 1295 | "service" => $service |
1296 | 1296 | )); |
1297 | 1297 | // never reached |
@@ -1306,12 +1306,12 @@ discard block |
||
1306 | 1306 | global $PHPCAS_CLIENT; |
1307 | 1307 | phpCAS :: traceBegin(); |
1308 | 1308 | if (!is_object($PHPCAS_CLIENT)) { |
1309 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1309 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1310 | 1310 | } |
1311 | 1311 | if (!is_string($url)) { |
1312 | 1312 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
1313 | 1313 | } |
1314 | - $PHPCAS_CLIENT->logout(array ( |
|
1314 | + $PHPCAS_CLIENT->logout(array( |
|
1315 | 1315 | "url" => $url |
1316 | 1316 | )); |
1317 | 1317 | // never reached |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | global $PHPCAS_CLIENT; |
1328 | 1328 | phpCAS :: traceBegin(); |
1329 | 1329 | if (!is_object($PHPCAS_CLIENT)) { |
1330 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1330 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1331 | 1331 | } |
1332 | 1332 | if (!is_string($service)) { |
1333 | 1333 | phpCAS :: error('type mismatched for parameter $service (should be `string\')'); |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | if (!is_string($url)) { |
1336 | 1336 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
1337 | 1337 | } |
1338 | - $PHPCAS_CLIENT->logout(array ( |
|
1338 | + $PHPCAS_CLIENT->logout(array( |
|
1339 | 1339 | "service" => $service, |
1340 | 1340 | "url" => $url |
1341 | 1341 | )); |
@@ -1353,10 +1353,10 @@ discard block |
||
1353 | 1353 | global $PHPCAS_CLIENT; |
1354 | 1354 | phpCAS :: traceBegin(); |
1355 | 1355 | if (!is_object($PHPCAS_CLIENT)) { |
1356 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1356 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1357 | 1357 | } |
1358 | 1358 | if (!$PHPCAS_CLIENT->isProxy()) { |
1359 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1359 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1360 | 1360 | } |
1361 | 1361 | if (gettype($url) != 'string') { |
1362 | 1362 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | global $PHPCAS_CLIENT; |
1376 | 1376 | phpCAS :: traceBegin(); |
1377 | 1377 | if (!is_object($PHPCAS_CLIENT)) { |
1378 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1378 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1379 | 1379 | } |
1380 | 1380 | if (gettype($url) != 'string') { |
1381 | 1381 | phpCAS :: error('type mismatched for parameter $url (should be `string\')'); |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | function getServiceURL() { |
1391 | 1391 | global $PHPCAS_CLIENT; |
1392 | 1392 | if (!is_object($PHPCAS_CLIENT)) { |
1393 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1393 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1394 | 1394 | } |
1395 | 1395 | return ($PHPCAS_CLIENT->getURL()); |
1396 | 1396 | } |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | function retrievePT($target_service, & $err_code, & $err_msg) { |
1402 | 1402 | global $PHPCAS_CLIENT; |
1403 | 1403 | if (!is_object($PHPCAS_CLIENT)) { |
1404 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1404 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1405 | 1405 | } |
1406 | 1406 | if (gettype($target_service) != 'string') { |
1407 | 1407 | phpCAS :: error('type mismatched for parameter $target_service(should be `string\')'); |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | global $PHPCAS_CLIENT; |
1419 | 1419 | phpCAS :: traceBegin(); |
1420 | 1420 | if (!is_object($PHPCAS_CLIENT)) { |
1421 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1421 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1422 | 1422 | } |
1423 | 1423 | if (gettype($cert) != 'string') { |
1424 | 1424 | phpCAS :: error('type mismatched for parameter $cert (should be `string\')'); |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | global $PHPCAS_CLIENT; |
1437 | 1437 | phpCAS :: traceBegin(); |
1438 | 1438 | if (!is_object($PHPCAS_CLIENT)) { |
1439 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1439 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1440 | 1440 | } |
1441 | 1441 | if (gettype($cert) != 'string') { |
1442 | 1442 | phpCAS :: error('type mismatched for parameter $cert (should be `string\')'); |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | global $PHPCAS_CLIENT; |
1453 | 1453 | phpCAS :: traceBegin(); |
1454 | 1454 | if (!is_object($PHPCAS_CLIENT)) { |
1455 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1455 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1456 | 1456 | } |
1457 | 1457 | $PHPCAS_CLIENT->setNoCasServerValidation(); |
1458 | 1458 | phpCAS :: traceEnd(); |
@@ -1470,7 +1470,7 @@ discard block |
||
1470 | 1470 | global $PHPCAS_CLIENT; |
1471 | 1471 | phpCAS :: traceBegin(); |
1472 | 1472 | if (!is_object($PHPCAS_CLIENT)) { |
1473 | - phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1473 | + phpCAS :: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1474 | 1474 | } |
1475 | 1475 | $PHPCAS_CLIENT->setExtraCurlOption($key, $value); |
1476 | 1476 | phpCAS :: traceEnd(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $message confirmation message(optional) |
62 | 62 | * @param string $error error message(optional) |
63 | 63 | */ |
64 | - public function categories_list($action, $message='', $error='') |
|
64 | + public function categories_list($action, $message = '', $error = '') |
|
65 | 65 | { |
66 | 66 | $data = array(); |
67 | 67 | $data['user_course_categories'] = $this->model->get_user_course_categories(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // we need only the course codes as these will be used to match against the courses of the category |
118 | 118 | if ($user_courses != '') { |
119 | - foreach($user_courses as $key => $value) { |
|
119 | + foreach ($user_courses as $key => $value) { |
|
120 | 120 | $user_coursecodes[] = $value['code']; |
121 | 121 | } |
122 | 122 | } |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $html .= '</strong>'; |
386 | 386 | } else { |
387 | 387 | if (!empty($categoryCourses)) { |
388 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
388 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
389 | 389 | 1, |
390 | 390 | $limit['length'], |
391 | 391 | $categoryCode, |
392 | 392 | $hiddenLinks, |
393 | 393 | $action |
394 | - ) . '">'; |
|
394 | + ).'">'; |
|
395 | 395 | $html .= "$categoryName ($categoryCourses)"; |
396 | 396 | $html .= '</a>'; |
397 | 397 | } else { |
@@ -412,13 +412,13 @@ discard block |
||
412 | 412 | if ($code == $subCategory1Code) { |
413 | 413 | $html .= "<strong>$subCategory1Name ($subCategory1Courses)</strong>"; |
414 | 414 | } else { |
415 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
415 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
416 | 416 | 1, |
417 | 417 | $limit['length'], |
418 | 418 | $categoryCode, |
419 | 419 | $hiddenLinks, |
420 | 420 | $action |
421 | - ) . '">'; |
|
421 | + ).'">'; |
|
422 | 422 | $html .= "$subCategory1Name ($subCategory1Courses)"; |
423 | 423 | $html .= '</a>'; |
424 | 424 | } |
@@ -436,13 +436,13 @@ discard block |
||
436 | 436 | if ($code == $subCategory2Code) { |
437 | 437 | $html .= "<strong>$subCategory2Name ($subCategory2Courses)</strong>"; |
438 | 438 | } else { |
439 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
439 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
440 | 440 | 1, |
441 | 441 | $limit['length'], |
442 | 442 | $categoryCode, |
443 | 443 | $hiddenLinks, |
444 | 444 | $action |
445 | - ) . '">'; |
|
445 | + ).'">'; |
|
446 | 446 | $html .= "$subCategory2Name ($subCategory2Courses)"; |
447 | 447 | $html .= '</a>'; |
448 | 448 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | if ($code == $subCategory3Code) { |
461 | 461 | $html .= "<strong>$subCategory3Name ($subCategory3Courses)</strong>"; |
462 | 462 | } else { |
463 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
463 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
464 | 464 | 1, |
465 | 465 | $limit['length'], |
466 | 466 | $categoryCode, |
467 | 467 | $hiddenLinks, |
468 | 468 | $action |
469 | - ) . '">'; |
|
469 | + ).'">'; |
|
470 | 470 | $html .= "$subCategory3Name ($subCategory3Courses)"; |
471 | 471 | $html .= '</a>'; |
472 | 472 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $icon = '<em class="fa fa-smile-o"></em>'; |
594 | 594 | |
595 | 595 | return Display::div( |
596 | - $icon . ' ' . get_lang("AlreadyRegisteredToSession"), |
|
596 | + $icon.' '.get_lang("AlreadyRegisteredToSession"), |
|
597 | 597 | array('class' => 'info-catalog') |
598 | 598 | ); |
599 | 599 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function getSessionIcon($sessionName) |
607 | 607 | { |
608 | - return Display::return_icon('window_list.png', $sessionName, null,ICON_SIZE_MEDIUM); |
|
608 | + return Display::return_icon('window_list.png', $sessionName, null, ICON_SIZE_MEDIUM); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -626,8 +626,7 @@ discard block |
||
626 | 626 | $pageTotal = intval(ceil(intval($countSessions) / $limit['length'])); |
627 | 627 | // Do NOT show pagination if only one page or less |
628 | 628 | $cataloguePagination = $pageTotal > 1 ? |
629 | - getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : |
|
630 | - ''; |
|
629 | + getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : ''; |
|
631 | 630 | $sessionsBlocks = $this->getFormatedSessionsBlock($sessions); |
632 | 631 | |
633 | 632 | // Get session list catalogue URL |
@@ -638,13 +637,13 @@ discard block |
||
638 | 637 | $tpl = new Template(); |
639 | 638 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
640 | 639 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
641 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
640 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
642 | 641 | $tpl->assign('course_url', $courseUrl); |
643 | 642 | $tpl->assign('catalog_pagination', $cataloguePagination); |
644 | 643 | $tpl->assign('hidden_links', $hiddenLinks); |
645 | 644 | $tpl->assign('search_token', Security::get_token()); |
646 | 645 | $tpl->assign('search_date', $date); |
647 | - $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php'); |
|
646 | + $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH).'course.ajax.php'); |
|
648 | 647 | $tpl->assign('sessions', $sessionsBlocks); |
649 | 648 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
650 | 649 | |
@@ -671,7 +670,7 @@ discard block |
||
671 | 670 | |
672 | 671 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
673 | 672 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
674 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
673 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
675 | 674 | $tpl->assign('course_url', $courseUrl); |
676 | 675 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
677 | 676 | $tpl->assign('hidden_links', $hiddenLinks); |
@@ -702,7 +701,7 @@ discard block |
||
702 | 701 | $tpl = new Template(); |
703 | 702 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
704 | 703 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
705 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
704 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
706 | 705 | $tpl->assign('course_url', $courseUrl); |
707 | 706 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
708 | 707 | $tpl->assign('hidden_links', $hiddenLinks); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $limit |
204 | 204 | ); |
205 | 205 | } else { |
206 | - header('Location: ' . api_get_self()); |
|
206 | + header('Location: '.api_get_self()); |
|
207 | 207 | } |
208 | 208 | break; |
209 | 209 | case 'display_random_courses': |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
279 | 279 | |
280 | 280 | if (!$continueWithSubscription) { |
281 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | + header('Location: '.api_get_path(WEB_CODE_PATH).'auth/courses.php'); |
|
282 | 282 | exit; |
283 | 283 | } |
284 | 284 | } |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | |
297 | 297 | if ($count <= 0) { |
298 | 298 | // no course in session -> return to catalog |
299 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | + $url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
|
300 | 300 | } elseif ($count == 1) { |
301 | 301 | // only one course, so redirect directly to this course |
302 | 302 | foreach ($coursesList as $course) { |
303 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
303 | + $url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.intval($_GET['session_id']); |
|
304 | 304 | } |
305 | 305 | } else { |
306 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
306 | + $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.intval($_GET['session_id']); |
|
307 | 307 | } |
308 | - header('Location: ' . $url); |
|
308 | + header('Location: '.$url); |
|
309 | 309 | exit; |
310 | 310 | } |
311 | 311 | //else show error message? |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | $msg .= '<div class="well_login">'; |
43 | 43 | $msg .= $form->return_form(); |
44 | - $msg .='</div>'; |
|
44 | + $msg .= '</div>'; |
|
45 | 45 | if (api_is_cas_activated()) { |
46 | 46 | $msg .= "</div>"; |
47 | 47 | } |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
5 | -$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
5 | +$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
6 | 6 | |
7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
7 | +if (!isset($_SESSION['conditional_login']['uid'])) |
|
8 | 8 | die("Not Authorised"); |
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | </body> |
21 | 21 | </html> |
22 | 22 | <?php |
23 | -if (isset($_POST['submit'])){ |
|
23 | +if (isset($_POST['submit'])) { |
|
24 | 24 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
25 | 25 | $u['phone'] = $_POST['phone_number']; |
26 | 26 | $password = null; // we don't want to change the password |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | } |
55 | 55 | $course_info = api_get_course_info_by_id($result['c_id']); |
56 | 56 | $course_image = '<img src="'.$course_info['course_image_large'].'">'; |
57 | - $dates .= '<li><a href="#'.$login.'">' . api_convert_and_format_date($login, DATE_FORMAT_SHORT) . '</a></li>'; |
|
57 | + $dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>'; |
|
58 | 58 | $issues .= '<li id ="'.$login.'">'; |
59 | 59 | $issues .= '<div class="img-course">'.$course_image.'</div>'; |
60 | 60 | |
61 | 61 | $issues .= '<div class="text-course">'; |
62 | - $issues .= '<p>' . sprintf( |
|
62 | + $issues .= '<p>'.sprintf( |
|
63 | 63 | get_lang('YouHaveEnteredTheCourseXInY'), |
64 | - '" '. $courseInfo['name'] .' "', |
|
64 | + '" '.$courseInfo['name'].' "', |
|
65 | 65 | api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG) |
66 | - ) . '</p>'; |
|
66 | + ).'</p>'; |
|
67 | 67 | $issues .= '</div>'; |
68 | 68 | $issues .= '</li>'; |
69 | 69 | $count++; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $content .= '<div class="row">'; |
83 | 83 | $content .= '<div class="col-md-12">'; |
84 | 84 | $content .= '<div id="my_timeline">'; |
85 | - $content .= '<ul id="dates">' . $dates . '</ul>'; |
|
86 | - $content .= '<ul id="issues">' . $issues . '</ul>'; |
|
85 | + $content .= '<ul id="dates">'.$dates.'</ul>'; |
|
86 | + $content .= '<ul id="issues">'.$issues.'</ul>'; |
|
87 | 87 | $content .= '<div id="grad_left"></div>'; |
88 | 88 | $content .= '<div id="grad_right"></div>'; |
89 | 89 | $content .= '<a href="#" id="prev"></a>'; |