@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function isSsl() |
56 | 56 | { |
57 | - if(!is_null(self::$isSSL)) |
|
57 | + if (!is_null(self::$isSSL)) |
|
58 | 58 | { |
59 | 59 | return self::$isSSL; |
60 | 60 | } |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | * */ |
89 | 89 | function loadFile($args) |
90 | 90 | { |
91 | - if(!is_array($args)) |
|
91 | + if (!is_array($args)) |
|
92 | 92 | { |
93 | 93 | $args = array($args); |
94 | 94 | } |
95 | 95 | $file = $this->getFileInfo($args[0], $args[2], $args[1]); |
96 | 96 | |
97 | 97 | $availableExtension = array('css' => 1, 'js' => 1); |
98 | - if(!isset($availableExtension[$file->fileExtension])) |
|
98 | + if (!isset($availableExtension[$file->fileExtension])) |
|
99 | 99 | { |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $file->index = (int) $args[3]; |
104 | 104 | |
105 | - if($file->fileExtension == 'css') |
|
105 | + if ($file->fileExtension == 'css') |
|
106 | 106 | { |
107 | 107 | $map = &$this->cssMap; |
108 | 108 | $mapIndex = &$this->cssMapIndex; |
109 | 109 | |
110 | 110 | $this->_arrangeCssIndex($pathInfo['dirname'], $file); |
111 | 111 | } |
112 | - else if($file->fileExtension == 'js') |
|
112 | + else if ($file->fileExtension == 'js') |
|
113 | 113 | { |
114 | - if($args[1] == 'body') |
|
114 | + if ($args[1] == 'body') |
|
115 | 115 | { |
116 | 116 | $map = &$this->jsBodyMap; |
117 | 117 | $mapIndex = &$this->jsBodyMapIndex; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | (is_null($file->index)) ? $file->index = 0 : $file->index = $file->index; |
127 | - if(!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
127 | + if (!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
128 | 128 | { |
129 | 129 | $this->unloadFile($args[0], $args[2], $args[1]); |
130 | 130 | $map[$file->index][$file->key] = $file; |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | { |
145 | 145 | static $existsInfo = array(); |
146 | 146 | |
147 | - if(isset($existsInfo[$existsKey])) |
|
147 | + if (isset($existsInfo[$existsKey])) |
|
148 | 148 | { |
149 | 149 | return $existsInfo[$existsKey]; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $fileName = preg_replace('/(?:[\/]{3,})(.*)/', '//$1', $fileName); |
153 | 153 | $url_info = parse_url($fileName); |
154 | - $pathInfo = pathinfo(str_replace('?' . $url_info['query'], '', $fileName)); |
|
154 | + $pathInfo = pathinfo(str_replace('?'.$url_info['query'], '', $fileName)); |
|
155 | 155 | |
156 | 156 | $file = new stdClass(); |
157 | 157 | $file->fileName = basename($url_info['path']); |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | $file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension)); |
165 | 165 | $file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']); |
166 | 166 | |
167 | - if(!$file->external) |
|
167 | + if (!$file->external) |
|
168 | 168 | { |
169 | - if(!__DEBUG__ && __XE_VERSION_STABLE__) |
|
169 | + if (!__DEBUG__ && __XE_VERSION_STABLE__) |
|
170 | 170 | { |
171 | 171 | // if no debug mode, load minifed file |
172 | 172 | $minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension)); |
173 | 173 | $minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName)); |
174 | - if(file_exists($minifiedRealPath)) |
|
174 | + if (file_exists($minifiedRealPath)) |
|
175 | 175 | { |
176 | 176 | $file->fileName = $minifiedFileName; |
177 | 177 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | else |
180 | 180 | { |
181 | 181 | // Remove .min |
182 | - if(file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
182 | + if (file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
183 | 183 | { |
184 | 184 | $file->fileName = $file->keyName; |
185 | 185 | } |
@@ -188,18 +188,18 @@ discard block |
||
188 | 188 | |
189 | 189 | $file->targetIe = $targetIe; |
190 | 190 | |
191 | - if($file->fileExtension == 'css') |
|
191 | + if ($file->fileExtension == 'css') |
|
192 | 192 | { |
193 | 193 | $file->media = $media; |
194 | - if(!$file->media) |
|
194 | + if (!$file->media) |
|
195 | 195 | { |
196 | 196 | $file->media = 'all'; |
197 | 197 | } |
198 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; |
|
198 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe."\t".$file->media; |
|
199 | 199 | } |
200 | - else if($file->fileExtension == 'js') |
|
200 | + else if ($file->fileExtension == 'js') |
|
201 | 201 | { |
202 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe; |
|
202 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $file; |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | { |
218 | 218 | $file = $this->getFileInfo($fileName, $targetIe, $media); |
219 | 219 | |
220 | - if($file->fileExtension == 'css') |
|
220 | + if ($file->fileExtension == 'css') |
|
221 | 221 | { |
222 | - if(isset($this->cssMapIndex[$file->key])) |
|
222 | + if (isset($this->cssMapIndex[$file->key])) |
|
223 | 223 | { |
224 | 224 | $index = $this->cssMapIndex[$file->key]; |
225 | 225 | unset($this->cssMap[$index][$file->key], $this->cssMapIndex[$file->key]); |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | } |
228 | 228 | else |
229 | 229 | { |
230 | - if(isset($this->jsHeadMapIndex[$file->key])) |
|
230 | + if (isset($this->jsHeadMapIndex[$file->key])) |
|
231 | 231 | { |
232 | 232 | $index = $this->jsHeadMapIndex[$file->key]; |
233 | 233 | unset($this->jsHeadMap[$index][$file->key], $this->jsHeadMapIndex[$file->key]); |
234 | 234 | } |
235 | - if(isset($this->jsBodyMapIndex[$file->key])) |
|
235 | + if (isset($this->jsBodyMapIndex[$file->key])) |
|
236 | 236 | { |
237 | 237 | $index = $this->jsBodyMapIndex[$file->key]; |
238 | 238 | unset($this->jsBodyMap[$index][$file->key], $this->jsBodyMapIndex[$file->key]); |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function unloadAllFiles($type = 'all') |
250 | 250 | { |
251 | - if($type == 'css' || $type == 'all') |
|
251 | + if ($type == 'css' || $type == 'all') |
|
252 | 252 | { |
253 | 253 | $this->cssMap = array(); |
254 | 254 | $this->cssMapIndex = array(); |
255 | 255 | } |
256 | 256 | |
257 | - if($type == 'js' || $type == 'all') |
|
257 | + if ($type == 'js' || $type == 'all') |
|
258 | 258 | { |
259 | 259 | $this->jsHeadMap = array(); |
260 | 260 | $this->jsBodyMap = array(); |
@@ -276,23 +276,23 @@ discard block |
||
276 | 276 | $this->_sortMap($map, $mapIndex); |
277 | 277 | |
278 | 278 | $result = array(); |
279 | - foreach($map as $indexedMap) |
|
279 | + foreach ($map as $indexedMap) |
|
280 | 280 | { |
281 | - foreach($indexedMap as $file) |
|
281 | + foreach ($indexedMap as $file) |
|
282 | 282 | { |
283 | 283 | $query = ''; |
284 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName)) |
|
284 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName)) |
|
285 | 285 | { |
286 | - $query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); |
|
286 | + $query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); |
|
287 | 287 | } |
288 | - if($file->query) |
|
288 | + if ($file->query) |
|
289 | 289 | { |
290 | - if($query) $query .= '&'; |
|
290 | + if ($query) $query .= '&'; |
|
291 | 291 | $query .= $file->query; |
292 | 292 | } |
293 | - $query = ($query) ? '?' . $query : ''; |
|
293 | + $query = ($query) ? '?'.$query : ''; |
|
294 | 294 | |
295 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query; |
|
295 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query; |
|
296 | 296 | $result[] = array( |
297 | 297 | 'file' => $fullFilePath, |
298 | 298 | 'media' => $file->media, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | $ignore = array('modernizr.js', 'common.js', 'js_app.js', 'xml2json.js', 'xml_handler.js', 'xml_js_filter.js'); |
317 | 317 | |
318 | - if($type == 'head') |
|
318 | + if ($type == 'head') |
|
319 | 319 | { |
320 | 320 | $map = &$this->jsHeadMap; |
321 | 321 | $mapIndex = &$this->jsHeadMapIndex; |
@@ -329,31 +329,31 @@ discard block |
||
329 | 329 | $this->_sortMap($map, $mapIndex); |
330 | 330 | |
331 | 331 | $result = array(); |
332 | - foreach($map as $indexedMap) |
|
332 | + foreach ($map as $indexedMap) |
|
333 | 333 | { |
334 | - foreach($indexedMap as $file) |
|
334 | + foreach ($indexedMap as $file) |
|
335 | 335 | { |
336 | - if((!__DEBUG__ && __XE_VERSION_STABLE__) && $file->filePath === '/common/js') |
|
336 | + if ((!__DEBUG__ && __XE_VERSION_STABLE__) && $file->filePath === '/common/js') |
|
337 | 337 | { |
338 | - if(in_array($file->fileName, $ignore)) |
|
338 | + if (in_array($file->fileName, $ignore)) |
|
339 | 339 | { |
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | 344 | $query = ''; |
345 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName)) |
|
345 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName)) |
|
346 | 346 | { |
347 | - $query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); |
|
347 | + $query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); |
|
348 | 348 | } |
349 | - if($file->query) |
|
349 | + if ($file->query) |
|
350 | 350 | { |
351 | - if($query) $query .= '&'; |
|
351 | + if ($query) $query .= '&'; |
|
352 | 352 | $query .= $file->query; |
353 | 353 | } |
354 | - $query = ($query) ? '?' . $query : ''; |
|
354 | + $query = ($query) ? '?'.$query : ''; |
|
355 | 355 | |
356 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query; |
|
356 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query; |
|
357 | 357 | $result[] = array( |
358 | 358 | 'file' => $fullFilePath, |
359 | 359 | 'targetie' => $file->targetIe |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | */ |
385 | 385 | function _normalizeFilePath($path) |
386 | 386 | { |
387 | - if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
387 | + if (strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
388 | 388 | { |
389 | - $path = './' . $path; |
|
389 | + $path = './'.$path; |
|
390 | 390 | } |
391 | - elseif(!strncmp($path, '//', 2)) |
|
391 | + elseif (!strncmp($path, '//', 2)) |
|
392 | 392 | { |
393 | 393 | return preg_replace('#^//+#', '//', $path); |
394 | 394 | } |
395 | 395 | |
396 | 396 | $path = preg_replace('@/\./|(?<!:)\/\/@', '/', $path); |
397 | 397 | |
398 | - while(strpos($path, '/../')) |
|
398 | + while (strpos($path, '/../')) |
|
399 | 399 | { |
400 | 400 | $path = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $path, 1); |
401 | 401 | } |
@@ -414,20 +414,20 @@ discard block |
||
414 | 414 | $path = $this->_normalizeFilePath($path); |
415 | 415 | $script_path = getScriptPath(); |
416 | 416 | |
417 | - if(strpos($path, './') === 0) |
|
417 | + if (strpos($path, './') === 0) |
|
418 | 418 | { |
419 | - if($script_path == '/' || $script_path == '\\') |
|
419 | + if ($script_path == '/' || $script_path == '\\') |
|
420 | 420 | { |
421 | - $path = '/' . substr($path, 2); |
|
421 | + $path = '/'.substr($path, 2); |
|
422 | 422 | } |
423 | 423 | else |
424 | 424 | { |
425 | - $path = $script_path . substr($path, 2); |
|
425 | + $path = $script_path.substr($path, 2); |
|
426 | 426 | } |
427 | 427 | } |
428 | - else if(strpos($file, '../') === 0) |
|
428 | + else if (strpos($file, '../') === 0) |
|
429 | 429 | { |
430 | - $path = $this->_normalizeFilePath($script_path . $path); |
|
430 | + $path = $this->_normalizeFilePath($script_path.$path); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $path; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | function _arrangeCssIndex($dirName, &$file) |
444 | 444 | { |
445 | - if($file->index !== 0) |
|
445 | + if ($file->index !== 0) |
|
446 | 446 | { |
447 | 447 | return; |
448 | 448 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | if($oModule->module_info->module == $oModule->module) |
25 | 25 | { |
26 | 26 | $skin = $oModule->origin_module_info->skin; |
27 | - } |
|
28 | - else |
|
27 | + } else |
|
29 | 28 | { |
30 | 29 | $skin = $oModule->module_config->skin; |
31 | 30 | } |
@@ -45,13 +44,11 @@ discard block |
||
45 | 44 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
46 | 45 | } |
47 | 46 | } |
48 | - } |
|
49 | - else |
|
47 | + } else |
|
50 | 48 | { |
51 | 49 | $template_path = $oModule->getTemplatePath(); |
52 | 50 | } |
53 | - } |
|
54 | - else |
|
51 | + } else |
|
55 | 52 | { |
56 | 53 | $template_path = $oModule->getTemplatePath(); |
57 | 54 | } |
@@ -224,8 +221,7 @@ discard block |
||
224 | 221 | { |
225 | 222 | $this->_loadMobileJSCSS(); |
226 | 223 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
227 | - } |
|
228 | - else |
|
224 | + } else |
|
229 | 225 | { |
230 | 226 | $this->_loadJSCSS(); |
231 | 227 | $output = $oTemplate->compile('./common/tpl', 'common_layout'); |
@@ -403,13 +399,11 @@ discard block |
||
403 | 399 | if(!__DISABLE_DEFAULT_CSS__) |
404 | 400 | { |
405 | 401 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
406 | - } |
|
407 | - else |
|
402 | + } else |
|
408 | 403 | { |
409 | 404 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
410 | 405 | } |
411 | - } |
|
412 | - else |
|
406 | + } else |
|
413 | 407 | { |
414 | 408 | $oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1110000), true); |
415 | 409 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
@@ -418,8 +412,7 @@ discard block |
||
418 | 412 | if(!__DISABLE_DEFAULT_CSS__) |
419 | 413 | { |
420 | 414 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
421 | - } |
|
422 | - else |
|
415 | + } else |
|
423 | 416 | { |
424 | 417 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
425 | 418 | } |
@@ -437,8 +430,7 @@ discard block |
||
437 | 430 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true); |
438 | 431 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true); |
439 | 432 | $oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true); |
440 | - } |
|
441 | - else |
|
433 | + } else |
|
442 | 434 | { |
443 | 435 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true); |
444 | 436 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -476,14 +468,12 @@ discard block |
||
476 | 468 | { |
477 | 469 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
478 | 470 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
479 | - } |
|
480 | - else |
|
471 | + } else |
|
481 | 472 | { |
482 | 473 | $oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true); |
483 | 474 | $oContext->unloadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
484 | 475 | } |
485 | - } |
|
486 | - else |
|
476 | + } else |
|
487 | 477 | { |
488 | 478 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
489 | 479 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
@@ -492,8 +482,7 @@ discard block |
||
492 | 482 | { |
493 | 483 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
494 | 484 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
495 | - } |
|
496 | - else |
|
485 | + } else |
|
497 | 486 | { |
498 | 487 | $oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
499 | 488 | $oContext->unloadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | $template_path = $oModule->getTemplatePath(); |
21 | 21 | |
22 | - if(!is_dir($template_path)) |
|
22 | + if (!is_dir($template_path)) |
|
23 | 23 | { |
24 | - if($oModule->module_info->module == $oModule->module) |
|
24 | + if ($oModule->module_info->module == $oModule->module) |
|
25 | 25 | { |
26 | 26 | $skin = $oModule->origin_module_info->skin; |
27 | 27 | } |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | $skin = $oModule->module_config->skin; |
31 | 31 | } |
32 | 32 | |
33 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
33 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
34 | 34 | { |
35 | - if($skin && is_string($skin)) |
|
35 | + if ($skin && is_string($skin)) |
|
36 | 36 | { |
37 | 37 | $theme_skin = explode('|@|', $skin); |
38 | 38 | $template_path = $oModule->getTemplatePath(); |
39 | - if(count($theme_skin) == 2) |
|
39 | + if (count($theme_skin) == 2) |
|
40 | 40 | { |
41 | 41 | $theme_path = sprintf('./themes/%s', $theme_skin[0]); |
42 | 42 | // FIXME $theme_path $theme_path $theme_path ?? |
43 | - if(substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
43 | + if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
44 | 44 | { |
45 | 45 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
46 | 46 | } |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | $output = $oTemplate->compile($template_path, $tpl_file); |
62 | 62 | |
63 | 63 | // add .x div for adminitration pages |
64 | - if(Context::getResponseMethod() == 'HTML') |
|
64 | + if (Context::getResponseMethod() == 'HTML') |
|
65 | 65 | { |
66 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
66 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
67 | 67 | { |
68 | - $output = '<div class="x">' . $output . '</div>'; |
|
68 | + $output = '<div class="x">'.$output.'</div>'; |
|
69 | 69 | } |
70 | 70 | |
71 | - if(Context::get('layout') != 'none') |
|
71 | + if (Context::get('layout') != 'none') |
|
72 | 72 | { |
73 | - if(__DEBUG__ == 3) |
|
73 | + if (__DEBUG__ == 3) |
|
74 | 74 | { |
75 | 75 | $start = getMicroTime(); |
76 | 76 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $layout_srl = $layout_info->layout_srl; |
89 | 89 | |
90 | 90 | // compile if connected to the layout |
91 | - if($layout_srl > 0) |
|
91 | + if ($layout_srl > 0) |
|
92 | 92 | { |
93 | 93 | |
94 | 94 | // handle separately if the layout is faceoff |
95 | - if($layout_info && $layout_info->type == 'faceoff') |
|
95 | + if ($layout_info && $layout_info->type == 'faceoff') |
|
96 | 96 | { |
97 | 97 | $oLayoutModel->doActivateFaceOff($layout_info); |
98 | 98 | Context::set('layout_info', $layout_info); |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | // search if the changes CSS exists in the admin layout edit window |
102 | 102 | $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); |
103 | 103 | |
104 | - if(FileHandler::exists($edited_layout_css)) |
|
104 | + if (FileHandler::exists($edited_layout_css)) |
|
105 | 105 | { |
106 | 106 | Context::loadFile(array($edited_layout_css, 'all', '', 100)); |
107 | 107 | } |
108 | 108 | } |
109 | - if(!$layout_path) |
|
109 | + if (!$layout_path) |
|
110 | 110 | { |
111 | 111 | $layout_path = './common/tpl'; |
112 | 112 | } |
113 | - if(!$layout_file) |
|
113 | + if (!$layout_file) |
|
114 | 114 | { |
115 | 115 | $layout_file = 'default_layout'; |
116 | 116 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // if popup_layout, remove admin bar. |
120 | 120 | $realLayoutPath = FileHandler::getRealPath($layout_path); |
121 | - if(substr_compare($realLayoutPath, '/', -1) !== 0) |
|
121 | + if (substr_compare($realLayoutPath, '/', -1) !== 0) |
|
122 | 122 | { |
123 | 123 | $realLayoutPath .= '/'; |
124 | 124 | } |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | $pathInfo = pathinfo($layout_file); |
127 | 127 | $onlyLayoutFile = $pathInfo['filename']; |
128 | 128 | |
129 | - if(__DEBUG__ == 3) |
|
129 | + if (__DEBUG__ == 3) |
|
130 | 130 | { |
131 | 131 | $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; |
132 | 132 | } |
133 | 133 | |
134 | - if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
134 | + if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
135 | 135 | { |
136 | 136 | Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); |
137 | 137 | } |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function prepareToPrint(&$output) |
149 | 149 | { |
150 | - if(Context::getResponseMethod() != 'HTML') |
|
150 | + if (Context::getResponseMethod() != 'HTML') |
|
151 | 151 | { |
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | - if(__DEBUG__ == 3) |
|
155 | + if (__DEBUG__ == 3) |
|
156 | 156 | { |
157 | 157 | $start = getMicroTime(); |
158 | 158 | } |
@@ -170,20 +170,20 @@ discard block |
||
170 | 170 | $output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output); |
171 | 171 | |
172 | 172 | // handles a relative path generated by using the rewrite module |
173 | - if(Context::isAllowRewrite()) |
|
173 | + if (Context::isAllowRewrite()) |
|
174 | 174 | { |
175 | 175 | $url = parse_url(Context::getRequestUri()); |
176 | 176 | $real_path = $url['path']; |
177 | 177 | |
178 | 178 | $pattern = '/src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/s'; |
179 | - $output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output); |
|
179 | + $output = preg_replace($pattern, 'src=$1'.$real_path.'$3/$4.$5$6', $output); |
|
180 | 180 | |
181 | 181 | $pattern = '/href=("|\'){1}(\?[^"\']+)/s'; |
182 | - $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output); |
|
182 | + $output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output); |
|
183 | 183 | |
184 | - if(Context::get('vid')) |
|
184 | + if (Context::get('vid')) |
|
185 | 185 | { |
186 | - $pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is'; |
|
186 | + $pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is'; |
|
187 | 187 | $output = preg_replace($pattern, '/?$1=', $output); |
188 | 188 | } |
189 | 189 | } |
@@ -191,18 +191,18 @@ discard block |
||
191 | 191 | // prevent the 2nd request due to url(none) of the background-image |
192 | 192 | $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); |
193 | 193 | |
194 | - if(is_array(Context::get('INPUT_ERROR'))) |
|
194 | + if (is_array(Context::get('INPUT_ERROR'))) |
|
195 | 195 | { |
196 | 196 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
197 | 197 | $keys = array_keys($INPUT_ERROR); |
198 | - $keys = '(' . implode('|', $keys) . ')'; |
|
198 | + $keys = '('.implode('|', $keys).')'; |
|
199 | 199 | |
200 | - $output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
201 | - $output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
202 | - $output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
200 | + $output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
201 | + $output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
202 | + $output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
203 | 203 | } |
204 | 204 | |
205 | - if(__DEBUG__ == 3) |
|
205 | + if (__DEBUG__ == 3) |
|
206 | 206 | { |
207 | 207 | $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; |
208 | 208 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | // convert the final layout |
221 | 221 | Context::set('content', $output); |
222 | 222 | $oTemplate = TemplateHandler::getInstance(); |
223 | - if(Mobile::isFromMobilePhone()) |
|
223 | + if (Mobile::isFromMobilePhone()) |
|
224 | 224 | { |
225 | 225 | $this->_loadMobileJSCSS(); |
226 | 226 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | { |
246 | 246 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
247 | 247 | |
248 | - $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4]; |
|
248 | + $str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4]; |
|
249 | 249 | |
250 | 250 | // get type |
251 | 251 | $type = 'text'; |
252 | - if(preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
252 | + if (preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
253 | 253 | { |
254 | 254 | $type = strtolower($m[1]); |
255 | 255 | } |
256 | 256 | |
257 | - switch($type) |
|
257 | + switch ($type) |
|
258 | 258 | { |
259 | 259 | case 'text': |
260 | 260 | case 'hidden': |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | case 'number': |
273 | 273 | case 'range': |
274 | 274 | case 'color': |
275 | - $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"'; |
|
275 | + $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"'; |
|
276 | 276 | break; |
277 | 277 | case 'password': |
278 | 278 | $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str); |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | case 'radio': |
281 | 281 | case 'checkbox': |
282 | 282 | $str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); |
283 | - if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) |
|
283 | + if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str)) |
|
284 | 284 | { |
285 | 285 | $str .= ' checked="checked"'; |
286 | 286 | } |
287 | 287 | break; |
288 | 288 | } |
289 | 289 | |
290 | - return $str . ' />'; |
|
290 | + return $str.' />'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m); |
305 | 305 | |
306 | 306 | $key = array_search($INPUT_ERROR[$matches[1]], $m[1]); |
307 | - if($key === FALSE) |
|
307 | + if ($key === FALSE) |
|
308 | 308 | { |
309 | 309 | return $matches[0]; |
310 | 310 | } |
311 | 311 | |
312 | 312 | $m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); |
313 | 313 | |
314 | - return $mm[0] . implode('', $m[0]) . '</select>'; |
|
314 | + return $mm[0].implode('', $m[0]).'</select>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
325 | 325 | preg_match('@<textarea.*?>@is', $matches[0], $mm); |
326 | - return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>'; |
|
326 | + return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | function _moveStyleToHeader($matches) |
336 | 336 | { |
337 | - if(isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
337 | + if (isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
338 | 338 | { |
339 | 339 | return $matches[0]; |
340 | 340 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | function _transMeta($matches) |
372 | 372 | { |
373 | - if($matches[1]) |
|
373 | + if ($matches[1]) |
|
374 | 374 | { |
375 | 375 | return ''; |
376 | 376 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $lang_type = Context::getLangType(); |
388 | 388 | |
389 | 389 | // add common JS/CSS files |
390 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
390 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
391 | 391 | { |
392 | 392 | $oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true); |
393 | 393 | $oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true); |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
401 | 401 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
402 | 402 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
403 | - if(!__DISABLE_DEFAULT_CSS__) |
|
403 | + if (!__DISABLE_DEFAULT_CSS__) |
|
404 | 404 | { |
405 | 405 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
406 | 406 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); |
416 | 416 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
417 | 417 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
418 | - if(!__DISABLE_DEFAULT_CSS__) |
|
418 | + if (!__DISABLE_DEFAULT_CSS__) |
|
419 | 419 | { |
420 | 420 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
421 | 421 | } |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // for admin page, add admin css |
429 | - if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
429 | + if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
430 | 430 | { |
431 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
431 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
432 | 432 | { |
433 | 433 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true); |
434 | 434 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $lang_type = Context::getLangType(); |
461 | 461 | |
462 | 462 | // add common JS/CSS files |
463 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
463 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
464 | 464 | { |
465 | 465 | $oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true); |
466 | 466 | $oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); |
473 | 473 | $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); |
474 | 474 | $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); |
475 | - if(!__DISABLE_DEFAULT_CSS__) |
|
475 | + if (!__DISABLE_DEFAULT_CSS__) |
|
476 | 476 | { |
477 | 477 | $oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); |
478 | 478 | $oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); |
489 | 489 | $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); |
490 | 490 | $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); |
491 | - if(!__DISABLE_DEFAULT_CSS__) |
|
491 | + if (!__DISABLE_DEFAULT_CSS__) |
|
492 | 492 | { |
493 | 493 | $oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); |
494 | 494 | $oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function DBMysqli_innodb($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function __connect($connection) |
45 | 45 | { |
46 | 46 | // Attempt to connect |
47 | - if($connection["db_port"]) |
|
47 | + if ($connection["db_port"]) |
|
48 | 48 | { |
49 | 49 | $result = @mysqli_connect($connection["db_hostname"] |
50 | 50 | , $connection["db_userid"] |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | , $connection["db_database"]); |
61 | 61 | } |
62 | 62 | $error = mysqli_connect_errno(); |
63 | - if($error) |
|
63 | + if ($error) |
|
64 | 64 | { |
65 | 65 | $this->setError($error, mysqli_connect_error()); |
66 | 66 | return; |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | { |
90 | 90 | $connection = $this->_getConnection('master'); |
91 | 91 | |
92 | - if(!$transactionLevel) |
|
92 | + if (!$transactionLevel) |
|
93 | 93 | { |
94 | 94 | $this->_query("begin"); |
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
98 | - $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
|
98 | + $this->_query("SAVEPOINT SP".$transactionLevel, $connection); |
|
99 | 99 | } |
100 | 100 | return true; |
101 | 101 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | $point = $transactionLevel - 1; |
113 | 113 | |
114 | - if($point) |
|
114 | + if ($point) |
|
115 | 115 | { |
116 | - $this->_query("ROLLBACK TO SP" . $point, $connection); |
|
116 | + $this->_query("ROLLBACK TO SP".$point, $connection); |
|
117 | 117 | } |
118 | 118 | else |
119 | 119 | { |
120 | 120 | mysqli_rollback($connection); |
121 | - $this->setQueryLog( array("query"=>"rollback") ); |
|
121 | + $this->setQueryLog(array("query"=>"rollback")); |
|
122 | 122 | } |
123 | 123 | return true; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $connection = $this->_getConnection('master'); |
134 | 134 | mysqli_commit($connection); |
135 | - $this->setQueryLog( array("query"=>"commit") ); |
|
135 | + $this->setQueryLog(array("query"=>"commit")); |
|
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function addQuotes($string) |
147 | 147 | { |
148 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
148 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
149 | 149 | { |
150 | 150 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
151 | 151 | } |
152 | - if(!is_numeric($string)) |
|
152 | + if (!is_numeric($string)) |
|
153 | 153 | { |
154 | 154 | $connection = $this->_getConnection('master'); |
155 | 155 | $string = mysqli_escape_string($connection, $string); |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function __query($query, $connection) |
168 | 168 | { |
169 | - if($this->use_prepared_statements == 'Y') |
|
169 | + if ($this->use_prepared_statements == 'Y') |
|
170 | 170 | { |
171 | 171 | // 1. Prepare query |
172 | 172 | $stmt = mysqli_prepare($connection, $query); |
173 | - if($stmt) |
|
173 | + if ($stmt) |
|
174 | 174 | { |
175 | 175 | $types = ''; |
176 | 176 | $params = array(); |
177 | 177 | $this->_prepareQueryParameters($types, $params); |
178 | 178 | |
179 | - if(!empty($params)) |
|
179 | + if (!empty($params)) |
|
180 | 180 | { |
181 | 181 | $args[0] = $stmt; |
182 | 182 | $args[1] = $types; |
183 | 183 | |
184 | 184 | $i = 2; |
185 | - foreach($params as $key => $param) |
|
185 | + foreach ($params as $key => $param) |
|
186 | 186 | { |
187 | 187 | $copy[$key] = $param; |
188 | 188 | $args[$i++] = &$copy[$key]; |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | |
191 | 191 | // 2. Bind parameters |
192 | 192 | $status = call_user_func_array('mysqli_stmt_bind_param', $args); |
193 | - if(!$status) |
|
193 | + if (!$status) |
|
194 | 194 | { |
195 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection)); |
|
195 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection)); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | // 3. Execute query |
200 | 200 | $status = mysqli_stmt_execute($stmt); |
201 | 201 | |
202 | - if(!$status) |
|
202 | + if (!$status) |
|
203 | 203 | { |
204 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection)); |
|
204 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection)); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Return stmt for other processing - like retrieving resultset (_fetch) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $result = mysqli_query($connection, $query); |
214 | 214 | // Error Check |
215 | 215 | $error = mysqli_error($connection); |
216 | - if($error) |
|
216 | + if ($error) |
|
217 | 217 | { |
218 | 218 | $this->setError(mysqli_errno($connection), $error); |
219 | 219 | } |
@@ -232,23 +232,23 @@ discard block |
||
232 | 232 | { |
233 | 233 | $types = ''; |
234 | 234 | $params = array(); |
235 | - if(!$this->param) |
|
235 | + if (!$this->param) |
|
236 | 236 | { |
237 | 237 | return; |
238 | 238 | } |
239 | 239 | |
240 | - foreach($this->param as $k => $o) |
|
240 | + foreach ($this->param as $k => $o) |
|
241 | 241 | { |
242 | 242 | $value = $o->getUnescapedValue(); |
243 | 243 | $type = $o->getType(); |
244 | 244 | |
245 | 245 | // Skip column names -> this should be concatenated to query string |
246 | - if($o->isColumnName()) |
|
246 | + if ($o->isColumnName()) |
|
247 | 247 | { |
248 | 248 | continue; |
249 | 249 | } |
250 | 250 | |
251 | - switch($type) |
|
251 | + switch ($type) |
|
252 | 252 | { |
253 | 253 | case 'number' : |
254 | 254 | $type = 'i'; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $type = 's'; |
261 | 261 | } |
262 | 262 | |
263 | - if(is_array($value)) |
|
263 | + if (is_array($value)) |
|
264 | 264 | { |
265 | - foreach($value as $v) |
|
265 | + foreach ($value as $v) |
|
266 | 266 | { |
267 | 267 | $params[] = $v; |
268 | 268 | $types .= $type; |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function _fetch($result, $arrayIndexEndValue = NULL) |
286 | 286 | { |
287 | - if($this->use_prepared_statements != 'Y') |
|
287 | + if ($this->use_prepared_statements != 'Y') |
|
288 | 288 | { |
289 | 289 | return parent::_fetch($result, $arrayIndexEndValue); |
290 | 290 | } |
291 | 291 | $output = array(); |
292 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
292 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
293 | 293 | { |
294 | 294 | return $output; |
295 | 295 | } |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | * MYSQLI_TYPE for longtext is 252 |
306 | 306 | */ |
307 | 307 | $longtext_exists = false; |
308 | - foreach($fields as $field) |
|
308 | + foreach ($fields as $field) |
|
309 | 309 | { |
310 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
310 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
311 | 311 | { |
312 | - $field->name = 'repeat_' . $field->name; |
|
312 | + $field->name = 'repeat_'.$field->name; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Array passed needs to contain references, not values |
316 | 316 | $row[$field->name] = ""; |
317 | 317 | $resultArray[$field->name] = &$row[$field->name]; |
318 | 318 | |
319 | - if($field->type == 252) |
|
319 | + if ($field->type == 252) |
|
320 | 320 | { |
321 | 321 | $longtext_exists = true; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $resultArray = array_merge(array($stmt), $resultArray); |
325 | 325 | |
326 | - if($longtext_exists) |
|
326 | + if ($longtext_exists) |
|
327 | 327 | { |
328 | 328 | mysqli_stmt_store_result($stmt); |
329 | 329 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | call_user_func_array('mysqli_stmt_bind_result', $resultArray); |
332 | 332 | |
333 | 333 | $rows = array(); |
334 | - while(mysqli_stmt_fetch($stmt)) |
|
334 | + while (mysqli_stmt_fetch($stmt)) |
|
335 | 335 | { |
336 | 336 | $resultObject = new stdClass(); |
337 | 337 | |
338 | - foreach($resultArray as $key => $value) |
|
338 | + foreach ($resultArray as $key => $value) |
|
339 | 339 | { |
340 | - if($key === 0) |
|
340 | + if ($key === 0) |
|
341 | 341 | { |
342 | 342 | continue; // Skip stmt object |
343 | 343 | } |
344 | - if(strpos($key, 'repeat_')) |
|
344 | + if (strpos($key, 'repeat_')) |
|
345 | 345 | { |
346 | 346 | $key = substr($key, 6); |
347 | 347 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | |
354 | 354 | mysqli_stmt_close($stmt); |
355 | 355 | |
356 | - if($arrayIndexEndValue) |
|
356 | + if ($arrayIndexEndValue) |
|
357 | 357 | { |
358 | - foreach($rows as $row) |
|
358 | + foreach ($rows as $row) |
|
359 | 359 | { |
360 | 360 | $output[$arrayIndexEndValue--] = $row; |
361 | 361 | } |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | $output = $rows; |
366 | 366 | } |
367 | 367 | |
368 | - if(count($output) == 1) |
|
368 | + if (count($output) == 1) |
|
369 | 369 | { |
370 | - if(isset($arrayIndexEndValue)) |
|
370 | + if (isset($arrayIndexEndValue)) |
|
371 | 371 | { |
372 | 372 | return $output; |
373 | 373 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | function _executeInsertAct($queryObject, $with_values = false) |
390 | 390 | { |
391 | - if($this->use_prepared_statements != 'Y') |
|
391 | + if ($this->use_prepared_statements != 'Y') |
|
392 | 392 | { |
393 | 393 | return parent::_executeInsertAct($queryObject); |
394 | 394 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function _executeUpdateAct($queryObject, $with_values = false) |
408 | 408 | { |
409 | - if($this->use_prepared_statements != 'Y') |
|
409 | + if ($this->use_prepared_statements != 'Y') |
|
410 | 410 | { |
411 | 411 | return parent::_executeUpdateAct($queryObject); |
412 | 412 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _executeDeleteAct($queryObject, $with_values = false) |
426 | 426 | { |
427 | - if($this->use_prepared_statements != 'Y') |
|
427 | + if ($this->use_prepared_statements != 'Y') |
|
428 | 428 | { |
429 | 429 | return parent::_executeDeleteAct($queryObject); |
430 | 430 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) |
447 | 447 | { |
448 | - if($this->use_prepared_statements != 'Y') |
|
448 | + if ($this->use_prepared_statements != 'Y') |
|
449 | 449 | { |
450 | 450 | return parent::_executeSelectAct($queryObject, $connection); |
451 | 451 | } |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | $xml_obj = $oXml->parse($xml_doc); |
504 | 504 | // Create a table schema |
505 | 505 | $table_name = $xml_obj->table->attrs->name; |
506 | - if($this->isTableExists($table_name)) |
|
506 | + if ($this->isTableExists($table_name)) |
|
507 | 507 | { |
508 | 508 | return; |
509 | 509 | } |
510 | - $table_name = $this->prefix . $table_name; |
|
510 | + $table_name = $this->prefix.$table_name; |
|
511 | 511 | |
512 | - if(!is_array($xml_obj->table->column)) |
|
512 | + if (!is_array($xml_obj->table->column)) |
|
513 | 513 | { |
514 | 514 | $columns[] = $xml_obj->table->column; |
515 | 515 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $columns = $xml_obj->table->column; |
519 | 519 | } |
520 | 520 | |
521 | - foreach($columns as $column) |
|
521 | + foreach ($columns as $column) |
|
522 | 522 | { |
523 | 523 | $name = $column->attrs->name; |
524 | 524 | $type = $column->attrs->type; |
@@ -530,47 +530,47 @@ discard block |
||
530 | 530 | $default = $column->attrs->default; |
531 | 531 | $auto_increment = $column->attrs->auto_increment; |
532 | 532 | |
533 | - $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
533 | + $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
534 | 534 | |
535 | - if($primary_key) |
|
535 | + if ($primary_key) |
|
536 | 536 | { |
537 | 537 | $primary_list[] = $name; |
538 | 538 | } |
539 | - else if($unique) |
|
539 | + else if ($unique) |
|
540 | 540 | { |
541 | 541 | $unique_list[$unique][] = $name; |
542 | 542 | } |
543 | - else if($index) |
|
543 | + else if ($index) |
|
544 | 544 | { |
545 | 545 | $index_list[$index][] = $name; |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | - if(count($primary_list)) |
|
549 | + if (count($primary_list)) |
|
550 | 550 | { |
551 | - $column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); |
|
551 | + $column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); |
|
552 | 552 | } |
553 | 553 | |
554 | - if(count($unique_list)) |
|
554 | + if (count($unique_list)) |
|
555 | 555 | { |
556 | - foreach($unique_list as $key => $val) |
|
556 | + foreach ($unique_list as $key => $val) |
|
557 | 557 | { |
558 | - $column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
558 | + $column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | - if(count($index_list)) |
|
562 | + if (count($index_list)) |
|
563 | 563 | { |
564 | - foreach($index_list as $key => $val) |
|
564 | + foreach ($index_list as $key => $val) |
|
565 | 565 | { |
566 | - $column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
566 | + $column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | 570 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"); |
571 | 571 | |
572 | 572 | $output = $this->_query($schema); |
573 | - if(!$output) |
|
573 | + if (!$output) |
|
574 | 574 | { |
575 | 575 | return false; |
576 | 576 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function DBMysqli($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function __connect($connection) |
45 | 45 | { |
46 | 46 | // Attempt to connect |
47 | - if($connection["db_port"]) |
|
47 | + if ($connection["db_port"]) |
|
48 | 48 | { |
49 | 49 | $result = @mysqli_connect($connection["db_hostname"] |
50 | 50 | , $connection["db_userid"] |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | , $connection["db_database"]); |
61 | 61 | } |
62 | 62 | $error = mysqli_connect_errno(); |
63 | - if($error) |
|
63 | + if ($error) |
|
64 | 64 | { |
65 | 65 | $this->setError($error, mysqli_connect_error()); |
66 | 66 | return; |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function addQuotes($string) |
89 | 89 | { |
90 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
90 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
91 | 91 | { |
92 | 92 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
93 | 93 | } |
94 | - if(!is_numeric($string)) |
|
94 | + if (!is_numeric($string)) |
|
95 | 95 | { |
96 | 96 | $connection = $this->_getConnection('master'); |
97 | 97 | $string = mysqli_escape_string($connection, $string); |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | */ |
109 | 109 | function __query($query, $connection) |
110 | 110 | { |
111 | - if($this->use_prepared_statements == 'Y') |
|
111 | + if ($this->use_prepared_statements == 'Y') |
|
112 | 112 | { |
113 | 113 | // 1. Prepare query |
114 | 114 | $stmt = mysqli_prepare($connection, $query); |
115 | - if($stmt) |
|
115 | + if ($stmt) |
|
116 | 116 | { |
117 | 117 | $types = ''; |
118 | 118 | $params = array(); |
119 | 119 | $this->_prepareQueryParameters($types, $params); |
120 | 120 | |
121 | - if(!empty($params)) |
|
121 | + if (!empty($params)) |
|
122 | 122 | { |
123 | 123 | $args[0] = $stmt; |
124 | 124 | $args[1] = $types; |
125 | 125 | |
126 | 126 | $i = 2; |
127 | - foreach($params as $key => $param) |
|
127 | + foreach ($params as $key => $param) |
|
128 | 128 | { |
129 | 129 | $copy[$key] = $param; |
130 | 130 | $args[$i++] = &$copy[$key]; |
@@ -132,18 +132,18 @@ discard block |
||
132 | 132 | |
133 | 133 | // 2. Bind parameters |
134 | 134 | $status = call_user_func_array('mysqli_stmt_bind_param', $args); |
135 | - if(!$status) |
|
135 | + if (!$status) |
|
136 | 136 | { |
137 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection)); |
|
137 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection)); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | // 3. Execute query |
142 | 142 | $status = mysqli_stmt_execute($stmt); |
143 | 143 | |
144 | - if(!$status) |
|
144 | + if (!$status) |
|
145 | 145 | { |
146 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection)); |
|
146 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Return stmt for other processing - like retrieving resultset (_fetch) |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $result = mysqli_query($connection, $query); |
156 | 156 | // Error Check |
157 | 157 | $error = mysqli_error($connection); |
158 | - if($error) |
|
158 | + if ($error) |
|
159 | 159 | { |
160 | 160 | $this->setError(mysqli_errno($connection), $error); |
161 | 161 | } |
@@ -174,23 +174,23 @@ discard block |
||
174 | 174 | { |
175 | 175 | $types = ''; |
176 | 176 | $params = array(); |
177 | - if(!$this->param) |
|
177 | + if (!$this->param) |
|
178 | 178 | { |
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - foreach($this->param as $k => $o) |
|
182 | + foreach ($this->param as $k => $o) |
|
183 | 183 | { |
184 | 184 | $value = $o->getUnescapedValue(); |
185 | 185 | $type = $o->getType(); |
186 | 186 | |
187 | 187 | // Skip column names -> this should be concatenated to query string |
188 | - if($o->isColumnName()) |
|
188 | + if ($o->isColumnName()) |
|
189 | 189 | { |
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | |
193 | - switch($type) |
|
193 | + switch ($type) |
|
194 | 194 | { |
195 | 195 | case 'number' : |
196 | 196 | $type = 'i'; |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $type = 's'; |
203 | 203 | } |
204 | 204 | |
205 | - if(is_array($value)) |
|
205 | + if (is_array($value)) |
|
206 | 206 | { |
207 | - foreach($value as $v) |
|
207 | + foreach ($value as $v) |
|
208 | 208 | { |
209 | 209 | $params[] = $v; |
210 | 210 | $types .= $type; |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function _fetch($result, $arrayIndexEndValue = NULL) |
228 | 228 | { |
229 | - if($this->use_prepared_statements != 'Y') |
|
229 | + if ($this->use_prepared_statements != 'Y') |
|
230 | 230 | { |
231 | 231 | return parent::_fetch($result, $arrayIndexEndValue); |
232 | 232 | } |
233 | 233 | $output = array(); |
234 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
234 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
235 | 235 | { |
236 | 236 | return $output; |
237 | 237 | } |
@@ -247,25 +247,25 @@ discard block |
||
247 | 247 | * MYSQLI_TYPE for longtext is 252 |
248 | 248 | */ |
249 | 249 | $longtext_exists = false; |
250 | - foreach($fields as $field) |
|
250 | + foreach ($fields as $field) |
|
251 | 251 | { |
252 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
252 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
253 | 253 | { |
254 | - $field->name = 'repeat_' . $field->name; |
|
254 | + $field->name = 'repeat_'.$field->name; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // Array passed needs to contain references, not values |
258 | 258 | $row[$field->name] = ""; |
259 | 259 | $resultArray[$field->name] = &$row[$field->name]; |
260 | 260 | |
261 | - if($field->type == 252) |
|
261 | + if ($field->type == 252) |
|
262 | 262 | { |
263 | 263 | $longtext_exists = true; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | $resultArray = array_merge(array($stmt), $resultArray); |
267 | 267 | |
268 | - if($longtext_exists) |
|
268 | + if ($longtext_exists) |
|
269 | 269 | { |
270 | 270 | mysqli_stmt_store_result($stmt); |
271 | 271 | } |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | call_user_func_array('mysqli_stmt_bind_result', $resultArray); |
274 | 274 | |
275 | 275 | $rows = array(); |
276 | - while(mysqli_stmt_fetch($stmt)) |
|
276 | + while (mysqli_stmt_fetch($stmt)) |
|
277 | 277 | { |
278 | 278 | $resultObject = new stdClass(); |
279 | 279 | |
280 | - foreach($resultArray as $key => $value) |
|
280 | + foreach ($resultArray as $key => $value) |
|
281 | 281 | { |
282 | - if($key === 0) |
|
282 | + if ($key === 0) |
|
283 | 283 | { |
284 | 284 | continue; // Skip stmt object |
285 | 285 | } |
286 | - if(strpos($key, 'repeat_')) |
|
286 | + if (strpos($key, 'repeat_')) |
|
287 | 287 | { |
288 | 288 | $key = substr($key, 6); |
289 | 289 | } |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | |
296 | 296 | mysqli_stmt_close($stmt); |
297 | 297 | |
298 | - if($arrayIndexEndValue) |
|
298 | + if ($arrayIndexEndValue) |
|
299 | 299 | { |
300 | - foreach($rows as $row) |
|
300 | + foreach ($rows as $row) |
|
301 | 301 | { |
302 | 302 | $output[$arrayIndexEndValue--] = $row; |
303 | 303 | } |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | $output = $rows; |
308 | 308 | } |
309 | 309 | |
310 | - if(count($output) == 1) |
|
310 | + if (count($output) == 1) |
|
311 | 311 | { |
312 | - if(isset($arrayIndexEndValue)) |
|
312 | + if (isset($arrayIndexEndValue)) |
|
313 | 313 | { |
314 | 314 | return $output; |
315 | 315 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | function _executeInsertAct($queryObject, $with_values = false) |
332 | 332 | { |
333 | - if($this->use_prepared_statements != 'Y') |
|
333 | + if ($this->use_prepared_statements != 'Y') |
|
334 | 334 | { |
335 | 335 | return parent::_executeInsertAct($queryObject); |
336 | 336 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | function _executeUpdateAct($queryObject, $with_values = false) |
350 | 350 | { |
351 | - if($this->use_prepared_statements != 'Y') |
|
351 | + if ($this->use_prepared_statements != 'Y') |
|
352 | 352 | { |
353 | 353 | return parent::_executeUpdateAct($queryObject); |
354 | 354 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | function _executeDeleteAct($queryObject, $with_values = false) |
368 | 368 | { |
369 | - if($this->use_prepared_statements != 'Y') |
|
369 | + if ($this->use_prepared_statements != 'Y') |
|
370 | 370 | { |
371 | 371 | return parent::_executeDeleteAct($queryObject); |
372 | 372 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) |
389 | 389 | { |
390 | - if($this->use_prepared_statements != 'Y') |
|
390 | + if ($this->use_prepared_statements != 'Y') |
|
391 | 391 | { |
392 | 392 | return parent::_executeSelectAct($queryObject, $connection); |
393 | 393 | } |