@@ -92,43 +92,43 @@ |
||
92 | 92 | */ |
93 | 93 | $dsninfo = $this->dns; |
94 | 94 | |
95 | - if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') |
|
96 | - $dbhost = ':' . $dsninfo['socket']; |
|
97 | - else |
|
98 | - { |
|
95 | + if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') |
|
96 | + $dbhost = ':' . $dsninfo['socket']; |
|
97 | + else |
|
98 | + { |
|
99 | 99 | $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; |
100 | - if (!empty($dsninfo['port'])) |
|
101 | - $dbhost .= ':' . $dsninfo['port']; |
|
102 | - } |
|
103 | - $user = $dsninfo['username']; |
|
104 | - $pw = $dsninfo['password']; |
|
105 | - |
|
106 | - $connect_function = 'mysql_connect'; |
|
107 | - |
|
108 | - if ($dbhost && $user && $pw) |
|
109 | - $conn = @$connect_function($dbhost, $user, $pw); |
|
110 | - elseif ($dbhost && $user) |
|
111 | - $conn = @$connect_function($dbhost, $user); |
|
112 | - elseif ($dbhost) |
|
113 | - $conn = @$connect_function($dbhost); |
|
114 | - else |
|
115 | - $conn = false; |
|
116 | - |
|
117 | - if (empty($conn)) |
|
118 | - { |
|
119 | - throw new Exception('Error in connecting to '.$dsninfo); |
|
120 | - } |
|
121 | - |
|
122 | - if ($dsninfo['database']) |
|
123 | - { |
|
124 | - if (!@mysql_select_db($dsninfo['database'], $conn)) |
|
125 | - throw new Exception('Error in connecting database, dns:'. |
|
126 | - $dsninfo); |
|
127 | - } |
|
128 | - else |
|
129 | - throw new Exception('Please provide a database for message'. |
|
130 | - ' translation.'); |
|
131 | - return $conn; |
|
100 | + if (!empty($dsninfo['port'])) |
|
101 | + $dbhost .= ':' . $dsninfo['port']; |
|
102 | + } |
|
103 | + $user = $dsninfo['username']; |
|
104 | + $pw = $dsninfo['password']; |
|
105 | + |
|
106 | + $connect_function = 'mysql_connect'; |
|
107 | + |
|
108 | + if ($dbhost && $user && $pw) |
|
109 | + $conn = @$connect_function($dbhost, $user, $pw); |
|
110 | + elseif ($dbhost && $user) |
|
111 | + $conn = @$connect_function($dbhost, $user); |
|
112 | + elseif ($dbhost) |
|
113 | + $conn = @$connect_function($dbhost); |
|
114 | + else |
|
115 | + $conn = false; |
|
116 | + |
|
117 | + if (empty($conn)) |
|
118 | + { |
|
119 | + throw new Exception('Error in connecting to '.$dsninfo); |
|
120 | + } |
|
121 | + |
|
122 | + if ($dsninfo['database']) |
|
123 | + { |
|
124 | + if (!@mysql_select_db($dsninfo['database'], $conn)) |
|
125 | + throw new Exception('Error in connecting database, dns:'. |
|
126 | + $dsninfo); |
|
127 | + } |
|
128 | + else |
|
129 | + throw new Exception('Please provide a database for message'. |
|
130 | + ' translation.'); |
|
131 | + return $conn; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $tmp = $data; |
61 | 61 | foreach (explode(".", $field) as $f) |
62 | - $tmp = $tmp[$f]; |
|
62 | + $tmp = $tmp[$f]; |
|
63 | 63 | return $tmp; |
64 | 64 | } |
65 | 65 | else if(is_object($data)) |
@@ -139,9 +139,9 @@ |
||
139 | 139 | $feed->init($feedConfig); |
140 | 140 | |
141 | 141 | $content=$feed->getFeedContent(); |
142 | - //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | - $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | - $this->getResponse()->write($content); |
|
142 | + //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | + $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | + $this->getResponse()->write($content); |
|
145 | 145 | } |
146 | 146 | else |
147 | 147 | throw new THttpException(404,'feedservice_feed_unknown',$id); |
@@ -144,15 +144,15 @@ |
||
144 | 144 | */ |
145 | 145 | public function getKeyPrefix() |
146 | 146 | { |
147 | - return $this->_prefix; |
|
147 | + return $this->_prefix; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | - */ |
|
151 | + * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | + */ |
|
153 | 153 | public function setKeyPrefix($value) |
154 | 154 | { |
155 | - $this->_prefix=$value; |
|
155 | + $this->_prefix=$value; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -180,24 +180,24 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
184 | - */ |
|
183 | + * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
184 | + */ |
|
185 | 185 | public function getCssUrl() |
186 | 186 | { |
187 | 187 | return $this->getViewState('CssUrl','default'); |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | - * @param string URL for the CSS file including all relevant CSS class definitions. |
|
192 | - */ |
|
191 | + * @param string URL for the CSS file including all relevant CSS class definitions. |
|
192 | + */ |
|
193 | 193 | public function setCssUrl($value) |
194 | 194 | { |
195 | 195 | $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
199 | - * @return string CSS class for the whole accordion control div. |
|
200 | - */ |
|
199 | + * @return string CSS class for the whole accordion control div. |
|
200 | + */ |
|
201 | 201 | public function getCssClass() |
202 | 202 | { |
203 | 203 | $cssClass=parent::getCssClass(); |
@@ -205,32 +205,32 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
209 | - */ |
|
208 | + * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
209 | + */ |
|
210 | 210 | public function getViewCssClass() |
211 | 211 | { |
212 | 212 | return $this->getViewStyle()->getCssClass(); |
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | - * @param string CSS class for the currently displayed view div. |
|
217 | - */ |
|
216 | + * @param string CSS class for the currently displayed view div. |
|
217 | + */ |
|
218 | 218 | public function setViewCssClass($value) |
219 | 219 | { |
220 | 220 | $this->getViewStyle()->setCssClass($value); |
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
225 | - */ |
|
224 | + * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
225 | + */ |
|
226 | 226 | public function getAnimationDuration() |
227 | 227 | { |
228 | 228 | return $this->getViewState('AnimationDuration','1'); |
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | - * @param string CSS class for the currently displayed view div. |
|
233 | - */ |
|
232 | + * @param string CSS class for the currently displayed view div. |
|
233 | + */ |
|
234 | 234 | public function setAnimationDuration($value) |
235 | 235 | { |
236 | 236 | $this->setViewState('AnimationDuration',$value); |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getIsValid() |
133 | 133 | { |
134 | - return $this->_isValid; |
|
134 | + return $this->_isValid; |
|
135 | 135 | } |
136 | 136 | /** |
137 | 137 | * @param bool wether this control is valid. |
138 | 138 | */ |
139 | 139 | public function setIsValid($value) |
140 | 140 | { |
141 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
141 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function getSurroundingTag() |
290 | 290 | { |
291 | - return 'span'; |
|
291 | + return 'span'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function getSurroundingTagID() |
298 | 298 | { |
299 | - return $this->getSpanNeeded() ? $this->getClientID().'_parent' : $this->getClientID(); |
|
299 | + return $this->getSpanNeeded() ? $this->getClientID().'_parent' : $this->getClientID(); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | } |
327 | 327 | else |
328 | 328 | $onclick=''; |
329 | - if($needspan=$this->getSpanNeeded()) |
|
330 | - { |
|
331 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
332 | - $writer->renderBeginTag($this->getSurroundingTag()); |
|
333 | - } |
|
329 | + if($needspan=$this->getSpanNeeded()) |
|
330 | + { |
|
331 | + $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
332 | + $writer->renderBeginTag($this->getSurroundingTag()); |
|
333 | + } |
|
334 | 334 | $clientID=$this->getClientID(); |
335 | 335 | if(($text=$this->getText())!=='') |
336 | 336 | { |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
417 | 417 | } |
418 | 418 | |
419 | - /** |
|
420 | - * Check if we need a span tag to surround this control. The span tag will be created if |
|
421 | - * the Text property is set for this control. |
|
422 | - * |
|
423 | - * @return bool wether this control needs a surrounding span tag |
|
424 | - */ |
|
425 | - protected function getSpanNeeded() { |
|
426 | - return $this->getText()!==''; |
|
427 | - } |
|
419 | + /** |
|
420 | + * Check if we need a span tag to surround this control. The span tag will be created if |
|
421 | + * the Text property is set for this control. |
|
422 | + * |
|
423 | + * @return bool wether this control needs a surrounding span tag |
|
424 | + */ |
|
425 | + protected function getSpanNeeded() { |
|
426 | + return $this->getText()!==''; |
|
427 | + } |
|
428 | 428 | |
429 | 429 | /** |
430 | 430 | * Renders a label beside the checkbox. |
@@ -46,50 +46,50 @@ discard block |
||
46 | 46 | * @throws TConfigurationException If XSL extension is not available |
47 | 47 | */ |
48 | 48 | public function __construct() { |
49 | - if(!class_exists('XSLTProcessor', false)) { |
|
50 | - throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | - } |
|
49 | + if(!class_exists('XSLTProcessor', false)) { |
|
50 | + throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @return string The path to the XML style sheet. |
56 | 56 | */ |
57 | 57 | public function getTransformPath() { |
58 | - return $this->getViewState('TransformPath', ''); |
|
58 | + return $this->getViewState('TransformPath', ''); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param string The path to the XML style sheet. It must be in namespace format. |
63 | 63 | */ |
64 | 64 | public function setTransformPath($value) { |
65 | - if(!is_file($value)) { |
|
66 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | - if($value === null) { |
|
65 | + if(!is_file($value)) { |
|
66 | + $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | + if($value === null) { |
|
68 | 68 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
69 | - } |
|
70 | - } |
|
71 | - $this->setViewState('TransformPath', $value, ''); |
|
69 | + } |
|
70 | + } |
|
71 | + $this->setViewState('TransformPath', $value, ''); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @return string XML style sheet as string |
76 | 76 | */ |
77 | 77 | public function getTransformContent() { |
78 | - return $this->getViewState('TransformContent', ''); |
|
78 | + return $this->getViewState('TransformContent', ''); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @param string $value XML style sheet as string |
83 | 83 | */ |
84 | 84 | public function setTransformContent($value) { |
85 | - $this->setViewState('TransformContent', $value, ''); |
|
85 | + $this->setViewState('TransformContent', $value, ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return string The path to the XML document. It must be in namespace format. |
90 | 90 | */ |
91 | 91 | public function getDocumentPath() { |
92 | - return $this->getViewState('DocumentPath', ''); |
|
92 | + return $this->getViewState('DocumentPath', ''); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | * @throws TInvalidDataValueException |
98 | 98 | */ |
99 | 99 | public function setDocumentPath($value) { |
100 | - if(!is_file($value)) { |
|
101 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | - if($value === null) { |
|
100 | + if(!is_file($value)) { |
|
101 | + $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | + if($value === null) { |
|
103 | 103 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
104 | - } |
|
105 | - } |
|
106 | - $this->setViewState('DocumentPath', $value, ''); |
|
104 | + } |
|
105 | + } |
|
106 | + $this->setViewState('DocumentPath', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return string XML data |
111 | 111 | */ |
112 | 112 | public function getDocumentContent() { |
113 | - return $this->getViewState('DocumentContent', ''); |
|
113 | + return $this->getViewState('DocumentContent', ''); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @param string $value XML data. If not empty, it takes precedence over {@link setDocumentPath DocumentPath}. |
118 | 118 | */ |
119 | 119 | public function setDocumentContent($value) { |
120 | - $this->setViewState('DocumentContent', $value, ''); |
|
120 | + $this->setViewState('DocumentContent', $value, ''); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,41 +125,41 @@ discard block |
||
125 | 125 | * @return TAttributeCollection the list of custom parameters |
126 | 126 | */ |
127 | 127 | public function getParameters() { |
128 | - if($params = $this->getViewState('Parameters',null)) { |
|
129 | - return $params; |
|
130 | - } else { |
|
131 | - $params = new TAttributeCollection(); |
|
132 | - $this->setViewState('Parameters', $params, null); |
|
133 | - return $params; |
|
134 | - } |
|
128 | + if($params = $this->getViewState('Parameters',null)) { |
|
129 | + return $params; |
|
130 | + } else { |
|
131 | + $params = new TAttributeCollection(); |
|
132 | + $this->setViewState('Parameters', $params, null); |
|
133 | + return $params; |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | private function getTransformXmlDocument() { |
138 | - if(($content = $this->getTransformContent()) !== '') { |
|
139 | - $document = new DOMDocument(); |
|
140 | - $document->loadXML($content); |
|
141 | - return $document; |
|
142 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | - $document = new DOMDocument(); |
|
144 | - $document->load($path); |
|
145 | - return $document; |
|
146 | - } else { |
|
147 | - throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | - } |
|
138 | + if(($content = $this->getTransformContent()) !== '') { |
|
139 | + $document = new DOMDocument(); |
|
140 | + $document->loadXML($content); |
|
141 | + return $document; |
|
142 | + } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | + $document = new DOMDocument(); |
|
144 | + $document->load($path); |
|
145 | + return $document; |
|
146 | + } else { |
|
147 | + throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | private function getSourceXmlDocument() { |
152 | - if(($content = $this->getDocumentContent()) !== '') { |
|
153 | - $document = new DOMDocument(); |
|
154 | - $document->loadXML($content); |
|
155 | - return $document; |
|
156 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | - $document = new DOMDocument(); |
|
158 | - $document->load($path); |
|
159 | - return $document; |
|
160 | - } else { |
|
161 | - return null; |
|
162 | - } |
|
152 | + if(($content = $this->getDocumentContent()) !== '') { |
|
153 | + $document = new DOMDocument(); |
|
154 | + $document->loadXML($content); |
|
155 | + return $document; |
|
156 | + } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | + $document = new DOMDocument(); |
|
158 | + $document->load($path); |
|
159 | + return $document; |
|
160 | + } else { |
|
161 | + return null; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | * @param THtmlWriter The writer used for the rendering purpose |
168 | 168 | */ |
169 | 169 | public function render($writer) { |
170 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
170 | + if(($document=$this->getSourceXmlDocument()) === null) { |
|
171 | 171 | $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
172 | 172 | parent::render($htmlWriter); |
173 | - $document = new DOMDocument(); |
|
174 | - $document->loadXML($htmlWriter->flush()); |
|
175 | - } |
|
176 | - $stylesheet = $this->getTransformXmlDocument(); |
|
177 | - |
|
178 | - // Perform XSL transformation |
|
179 | - $xslt = new XSLTProcessor(); |
|
180 | - $xslt->importStyleSheet($stylesheet); |
|
181 | - |
|
182 | - // Check for parameters |
|
183 | - $parameters = $this->getParameters(); |
|
184 | - foreach($parameters as $name => $value) { |
|
185 | - $xslt->setParameter('', $name, $value); |
|
186 | - } |
|
187 | - $output = $xslt->transformToXML($document); |
|
188 | - |
|
189 | - // Write output |
|
190 | - $writer->write($output); |
|
173 | + $document = new DOMDocument(); |
|
174 | + $document->loadXML($htmlWriter->flush()); |
|
175 | + } |
|
176 | + $stylesheet = $this->getTransformXmlDocument(); |
|
177 | + |
|
178 | + // Perform XSL transformation |
|
179 | + $xslt = new XSLTProcessor(); |
|
180 | + $xslt->importStyleSheet($stylesheet); |
|
181 | + |
|
182 | + // Check for parameters |
|
183 | + $parameters = $this->getParameters(); |
|
184 | + foreach($parameters as $name => $value) { |
|
185 | + $xslt->setParameter('', $name, $value); |
|
186 | + } |
|
187 | + $output = $xslt->transformToXML($document); |
|
188 | + |
|
189 | + // Write output |
|
190 | + $writer->write($output); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 |
@@ -170,12 +170,12 @@ |
||
170 | 170 | public function validate() |
171 | 171 | { |
172 | 172 | if (! |
173 | - ( |
|
173 | + ( |
|
174 | 174 | ($challenge = @$_POST[$this->getChallengeFieldName()]) |
175 | 175 | and |
176 | 176 | ($response = @$_POST[$this->getResponseFieldName()]) |
177 | - ) |
|
178 | - ) |
|
177 | + ) |
|
178 | + ) |
|
179 | 179 | return false; |
180 | 180 | |
181 | 181 | $resp = recaptcha_check_answer( |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function setWidth($value) |
160 | 160 | { |
161 | 161 | if(($value=TPropertyValue::ensureInteger($value))<0) |
162 | - $value=-1; |
|
162 | + $value=-1; |
|
163 | 163 | $this->setViewState('Width',$value,-1); |
164 | 164 | } |
165 | 165 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function setHeight($value) |
178 | 178 | { |
179 | 179 | if(($value=TPropertyValue::ensureInteger($value))<0) |
180 | - $value=-1; |
|
180 | + $value=-1; |
|
181 | 181 | $this->setViewState('Height',$value,-1); |
182 | 182 | } |
183 | 183 |