@@ -46,7 +46,7 @@ |
||
46 | 46 | E_USER_NOTICE => "User Notice", |
47 | 47 | E_STRICT => "Runtime Notice" |
48 | 48 | ]; |
49 | - $errorType = isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error'; |
|
49 | + $errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error'; |
|
50 | 50 | parent::__construct("[$errorType] $errstr (@line $errline in file $errfile)."); |
51 | 51 | } |
52 | 52 |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | class THttpUtility |
22 | 22 | { |
23 | - private static $_encodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
24 | - private static $_decodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
25 | - private static $_stripTable = ['<' => '','>' => '','"' => '']; |
|
23 | + private static $_encodeTable = ['<' => '<', '>' => '>', '"' => '"']; |
|
24 | + private static $_decodeTable = ['<' => '<', '>' => '>', '"' => '"']; |
|
25 | + private static $_stripTable = ['<' => '', '>' => '', '"' => '']; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * HTML-encodes a string. |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $code = strtoupper($this->getToggleKey()); |
87 | 87 | $info = '(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).'; |
88 | 88 | $link = '<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>'; |
89 | - $usage = 'Press ALT-' . $code . ' (Or CTRL-' . $code . ' on OS X) to'; |
|
89 | + $usage = 'Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to'; |
|
90 | 90 | $writer->write("{$usage} {$link} {$info}"); |
91 | 91 | } |
92 | 92 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function writeLine($str = '') |
55 | 55 | { |
56 | - $this->write($str . "\n"); |
|
56 | + $this->write($str."\n"); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -26,18 +26,18 @@ |
||
26 | 26 | private $_keys; |
27 | 27 | private $_method = TMappedStatement::QUERY_FOR_LIST; |
28 | 28 | |
29 | - public function getStatement(){ return $this->_statement; } |
|
30 | - public function setStatement($value){ $this->_statement = $value; } |
|
29 | + public function getStatement() { return $this->_statement; } |
|
30 | + public function setStatement($value) { $this->_statement = $value; } |
|
31 | 31 | |
32 | - public function getResultProperty(){ return $this->_property; } |
|
33 | - public function setResultProperty($value){ $this->_property = $value; } |
|
32 | + public function getResultProperty() { return $this->_property; } |
|
33 | + public function setResultProperty($value) { $this->_property = $value; } |
|
34 | 34 | |
35 | - public function getResultObject(){ return $this->_resultObject; } |
|
36 | - public function setResultObject($value){ $this->_resultObject = $value; } |
|
35 | + public function getResultObject() { return $this->_resultObject; } |
|
36 | + public function setResultObject($value) { $this->_resultObject = $value; } |
|
37 | 37 | |
38 | - public function getKeys(){ return $this->_keys; } |
|
39 | - public function setKeys($value){ $this->_keys = $value; } |
|
38 | + public function getKeys() { return $this->_keys; } |
|
39 | + public function setKeys($value) { $this->_keys = $value; } |
|
40 | 40 | |
41 | - public function getMethod(){ return $this->_method; } |
|
42 | - public function setMethod($value){ $this->_method = $value; } |
|
41 | + public function getMethod() { return $this->_method; } |
|
42 | + public function setMethod($value) { $this->_method = $value; } |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | * @license https://github.com/pradosoft/prado/blob/master/LICENSE |
10 | 10 | */ |
11 | 11 | |
12 | -if(!isset($_SERVER['argv']) || php_sapi_name() !== 'cli') |
|
12 | +if (!isset($_SERVER['argv']) || php_sapi_name() !== 'cli') |
|
13 | 13 | die('Must be run from the command line'); |
14 | 14 | |
15 | 15 | // Locate composer's autoloader |
16 | -if(file_exists($autoloader = realpath(__DIR__ . '/../vendor/autoload.php'))) |
|
16 | +if (file_exists($autoloader = realpath(__DIR__.'/../vendor/autoload.php'))) |
|
17 | 17 | { |
18 | 18 | // if we are running inside a prado repo checkout, get out of bin/ |
19 | 19 | include($autoloader); |
20 | -} elseif(file_exists($autoloader = realpath(__DIR__ . '/../../../autoload.php'))) { |
|
20 | +} elseif (file_exists($autoloader = realpath(__DIR__.'/../../../autoload.php'))) { |
|
21 | 21 | // if we are running from inside an application's vendor/ directory, get out of pradosoft/prado/bin/ |
22 | 22 | include($autoloader); |
23 | 23 | } |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | public static function getInstance() |
79 | 79 | { |
80 | 80 | static $instance; |
81 | - if($instance === null) |
|
81 | + if ($instance === null) |
|
82 | 82 | $instance = new self; |
83 | 83 | return $instance; |
84 | 84 | } |
85 | 85 | |
86 | 86 | public static function printGreeting() |
87 | 87 | { |
88 | - echo "Command line tools for Prado " . Prado::getVersion() . ".\n"; |
|
88 | + echo "Command line tools for Prado ".Prado::getVersion().".\n"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function run($args) |
96 | 96 | { |
97 | - if(count($args) > 1) |
|
97 | + if (count($args) > 1) |
|
98 | 98 | array_shift($args); |
99 | 99 | $valid = false; |
100 | - foreach($this->_actions as $class => $action) |
|
100 | + foreach ($this->_actions as $class => $action) |
|
101 | 101 | { |
102 | - if($action->isValidAction($args)) |
|
102 | + if ($action->isValidAction($args)) |
|
103 | 103 | { |
104 | 104 | $valid |= $action->performAction($args); |
105 | 105 | break; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $valid = false; |
110 | 110 | } |
111 | 111 | } |
112 | - if(!$valid) |
|
112 | + if (!$valid) |
|
113 | 113 | $this->printHelp(); |
114 | 114 | } |
115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | echo "usage: php prado-cli.php action <parameter> [optional]\n"; |
124 | 124 | echo "example: php prado-cli.php -c mysite\n\n"; |
125 | 125 | echo "actions:\n"; |
126 | - foreach($this->_actions as $action) |
|
126 | + foreach ($this->_actions as $action) |
|
127 | 127 | echo $action->renderHelp(); |
128 | 128 | } |
129 | 129 | } |
@@ -145,18 +145,18 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function createDirectory($dir, $mask) |
147 | 147 | { |
148 | - if(!is_dir($dir)) |
|
148 | + if (!is_dir($dir)) |
|
149 | 149 | { |
150 | 150 | mkdir($dir); |
151 | 151 | echo "creating $dir\n"; |
152 | 152 | } |
153 | - if(is_dir($dir)) |
|
153 | + if (is_dir($dir)) |
|
154 | 154 | chmod($dir, $mask); |
155 | 155 | } |
156 | 156 | |
157 | 157 | protected function createFile($filename, $content) |
158 | 158 | { |
159 | - if(!is_file($filename)) |
|
159 | + if (!is_file($filename)) |
|
160 | 160 | { |
161 | 161 | file_put_contents($filename, $content); |
162 | 162 | echo "creating $filename\n"; |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | public function renderHelp() |
173 | 173 | { |
174 | 174 | $params = []; |
175 | - foreach($this->parameters as $v) |
|
176 | - $params[] = '<' . $v . '>'; |
|
175 | + foreach ($this->parameters as $v) |
|
176 | + $params[] = '<'.$v.'>'; |
|
177 | 177 | $parameters = implode($params, ' '); |
178 | 178 | $options = []; |
179 | - foreach($this->optional as $v) |
|
180 | - $options[] = '[' . $v . ']'; |
|
181 | - $optional = (strlen($parameters) ? ' ' : '') . implode($options, ' '); |
|
179 | + foreach ($this->optional as $v) |
|
180 | + $options[] = '['.$v.']'; |
|
181 | + $optional = (strlen($parameters) ? ' ' : '').implode($options, ' '); |
|
182 | 182 | $description = ''; |
183 | - foreach(explode("\n", wordwrap($this->description, 65)) as $line) |
|
184 | - $description .= ' ' . $line . "\n"; |
|
183 | + foreach (explode("\n", wordwrap($this->description, 65)) as $line) |
|
184 | + $description .= ' '.$line."\n"; |
|
185 | 185 | return <<<EOD |
186 | 186 | {$this->action} {$parameters}{$optional} |
187 | 187 | {$description} |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | |
192 | 192 | protected function initializePradoApplication($directory) |
193 | 193 | { |
194 | - $_SERVER['SCRIPT_FILENAME'] = $directory . '/index.php'; |
|
195 | - $app_dir = realpath($directory . '/protected/'); |
|
196 | - if($app_dir !== false && is_dir($app_dir)) |
|
194 | + $_SERVER['SCRIPT_FILENAME'] = $directory.'/index.php'; |
|
195 | + $app_dir = realpath($directory.'/protected/'); |
|
196 | + if ($app_dir !== false && is_dir($app_dir)) |
|
197 | 197 | { |
198 | - if(Prado::getApplication() === null) |
|
198 | + if (Prado::getApplication() === null) |
|
199 | 199 | { |
200 | 200 | $app = new PradoShellApplication($app_dir); |
201 | 201 | $app->run(); |
202 | 202 | $dir = substr(str_replace(realpath('./'), '', $app_dir), 1); |
203 | 203 | PradoCommandLineInterpreter::printGreeting(); |
204 | - echo '** Loaded PRADO appplication in directory "' . $dir . "\".\n"; |
|
204 | + echo '** Loaded PRADO appplication in directory "'.$dir."\".\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return Prado::getApplication(); |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | else |
210 | 210 | { |
211 | 211 | PradoCommandLineInterpreter::printGreeting(); |
212 | - echo '+' . str_repeat('-', 77) . "+\n"; |
|
213 | - echo '** Unable to load PRADO application in directory "' . $directory . "\".\n"; |
|
214 | - echo '+' . str_repeat('-', 77) . "+\n"; |
|
212 | + echo '+'.str_repeat('-', 77)."+\n"; |
|
213 | + echo '** Unable to load PRADO application in directory "'.$directory."\".\n"; |
|
214 | + echo '+'.str_repeat('-', 77)."+\n"; |
|
215 | 215 | } |
216 | 216 | return false; |
217 | 217 | } |
@@ -243,25 +243,25 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function createNewPradoProject($dir) |
245 | 245 | { |
246 | - if(strlen(trim($dir)) == 0) |
|
246 | + if (strlen(trim($dir)) == 0) |
|
247 | 247 | return; |
248 | 248 | |
249 | 249 | $rootPath = realpath(dirname(trim($dir))); |
250 | 250 | |
251 | - if(basename($dir) !== '.') |
|
252 | - $basePath = $rootPath . DIRECTORY_SEPARATOR . basename($dir); |
|
251 | + if (basename($dir) !== '.') |
|
252 | + $basePath = $rootPath.DIRECTORY_SEPARATOR.basename($dir); |
|
253 | 253 | else |
254 | 254 | $basePath = $rootPath; |
255 | 255 | $appName = basename($basePath); |
256 | - $assetPath = $basePath . DIRECTORY_SEPARATOR . 'assets'; |
|
257 | - $protectedPath = $basePath . DIRECTORY_SEPARATOR . 'protected'; |
|
258 | - $runtimePath = $basePath . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'runtime'; |
|
259 | - $pagesPath = $protectedPath . DIRECTORY_SEPARATOR . 'pages'; |
|
256 | + $assetPath = $basePath.DIRECTORY_SEPARATOR.'assets'; |
|
257 | + $protectedPath = $basePath.DIRECTORY_SEPARATOR.'protected'; |
|
258 | + $runtimePath = $basePath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'runtime'; |
|
259 | + $pagesPath = $protectedPath.DIRECTORY_SEPARATOR.'pages'; |
|
260 | 260 | |
261 | - $indexFile = $basePath . DIRECTORY_SEPARATOR . 'index.php'; |
|
262 | - $htaccessFile = $protectedPath . DIRECTORY_SEPARATOR . '.htaccess'; |
|
263 | - $configFile = $protectedPath . DIRECTORY_SEPARATOR . 'application.xml'; |
|
264 | - $defaultPageFile = $pagesPath . DIRECTORY_SEPARATOR . 'Home.page'; |
|
261 | + $indexFile = $basePath.DIRECTORY_SEPARATOR.'index.php'; |
|
262 | + $htaccessFile = $protectedPath.DIRECTORY_SEPARATOR.'.htaccess'; |
|
263 | + $configFile = $protectedPath.DIRECTORY_SEPARATOR.'application.xml'; |
|
264 | + $defaultPageFile = $pagesPath.DIRECTORY_SEPARATOR.'Home.page'; |
|
265 | 265 | |
266 | 266 | $this->createDirectory($basePath, 0755); |
267 | 267 | $this->createDirectory($assetPath, 0777); |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | |
278 | 278 | protected function renderIndexFile() |
279 | 279 | { |
280 | - $framework = realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'prado.php'; |
|
280 | + $framework = realpath(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'prado.php'; |
|
281 | 281 | return '<?php |
282 | 282 | |
283 | -$frameworkPath=\'' . $framework . '\'; |
|
283 | +$frameworkPath=\'' . $framework.'\'; |
|
284 | 284 | |
285 | 285 | // The following directory checks may be removed if performance is required |
286 | 286 | $basePath=dirname(__FILE__); |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | |
391 | 391 | protected function createTestFixtures($dir) |
392 | 392 | { |
393 | - if(strlen(trim($dir)) == 0) |
|
393 | + if (strlen(trim($dir)) == 0) |
|
394 | 394 | return; |
395 | 395 | |
396 | 396 | $rootPath = realpath(dirname(trim($dir))); |
397 | - $basePath = $rootPath . '/' . basename($dir); |
|
397 | + $basePath = $rootPath.'/'.basename($dir); |
|
398 | 398 | |
399 | - $tests = $basePath . '/tests'; |
|
400 | - $unit_tests = $tests . '/unit'; |
|
401 | - $functional_tests = $tests . '/functional'; |
|
399 | + $tests = $basePath.'/tests'; |
|
400 | + $unit_tests = $tests.'/unit'; |
|
401 | + $functional_tests = $tests.'/functional'; |
|
402 | 402 | |
403 | 403 | $this->createDirectory($tests, 0755); |
404 | 404 | $this->createDirectory($unit_tests, 0755); |
405 | 405 | $this->createDirectory($functional_tests, 0755); |
406 | 406 | |
407 | - $unit_test_index = $tests . '/unit.php'; |
|
408 | - $functional_test_index = $tests . '/functional.php'; |
|
407 | + $unit_test_index = $tests.'/unit.php'; |
|
408 | + $functional_test_index = $tests.'/functional.php'; |
|
409 | 409 | |
410 | 410 | $this->createFile($unit_test_index, $this->renderUnitTestFixture()); |
411 | 411 | $this->createFile($functional_test_index, $this->renderFunctionalTestFixture()); |
@@ -413,10 +413,10 @@ discard block |
||
413 | 413 | |
414 | 414 | protected function renderUnitTestFixture() |
415 | 415 | { |
416 | - $tester = realpath(dirname(dirname(__FILE__))) . '/tests/test_tools/unit_tests.php'; |
|
416 | + $tester = realpath(dirname(dirname(__FILE__))).'/tests/test_tools/unit_tests.php'; |
|
417 | 417 | return '<?php |
418 | 418 | |
419 | -include_once \'' . $tester . '\'; |
|
419 | +include_once \'' . $tester.'\'; |
|
420 | 420 | |
421 | 421 | $app_directory = "../protected"; |
422 | 422 | $test_cases = dirname(__FILE__)."/unit"; |
@@ -428,10 +428,10 @@ discard block |
||
428 | 428 | |
429 | 429 | protected function renderFunctionalTestFixture() |
430 | 430 | { |
431 | - $tester = realpath(dirname(dirname(__FILE__))) . '/tests/test_tools/functional_tests.php'; |
|
431 | + $tester = realpath(dirname(dirname(__FILE__))).'/tests/test_tools/functional_tests.php'; |
|
432 | 432 | return '<?php |
433 | 433 | |
434 | -include_once \'' . $tester . '\'; |
|
434 | +include_once \'' . $tester.'\'; |
|
435 | 435 | |
436 | 436 | $test_cases = dirname(__FILE__)."/functional"; |
437 | 437 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | public function performAction($args) |
459 | 459 | { |
460 | - if(count($args) > 1) |
|
460 | + if (count($args) > 1) |
|
461 | 461 | $this->initializePradoApplication($args[1]); |
462 | 462 | |
463 | 463 | \Psy\debug([], Prado::getApplication()); |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | { |
484 | 484 | $app_dir = count($args) > 3 ? $this->getAppDir($args[3]) : $this->getAppDir(); |
485 | 485 | $this->_soap = count($args) > 4; |
486 | - if($app_dir !== false) |
|
486 | + if ($app_dir !== false) |
|
487 | 487 | { |
488 | 488 | $config = $this->getActiveRecordConfig($app_dir); |
489 | 489 | $output = $this->getOutputFile($app_dir, $args[2]); |
490 | - if(is_file($output)) |
|
490 | + if (is_file($output)) |
|
491 | 491 | echo "** File $output already exists, skiping. \n"; |
492 | - elseif($config !== false && $output !== false) |
|
492 | + elseif ($config !== false && $output !== false) |
|
493 | 493 | $this->generateActiveRecord($config, $args[1], $output); |
494 | 494 | } |
495 | 495 | return true; |
@@ -497,68 +497,68 @@ discard block |
||
497 | 497 | |
498 | 498 | protected function getAppDir($dir = ".") |
499 | 499 | { |
500 | - if(is_dir($dir)) |
|
500 | + if (is_dir($dir)) |
|
501 | 501 | return realpath($dir); |
502 | - if(false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir)) |
|
502 | + if (false !== ($app_dir = realpath($dir.'/protected/')) && is_dir($app_dir)) |
|
503 | 503 | return $app_dir; |
504 | - echo '** Unable to find directory "' . $dir . "\".\n"; |
|
504 | + echo '** Unable to find directory "'.$dir."\".\n"; |
|
505 | 505 | return false; |
506 | 506 | } |
507 | 507 | |
508 | 508 | protected function getXmlFile($app_dir) |
509 | 509 | { |
510 | - if(false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml)) |
|
510 | + if (false !== ($xml = realpath($app_dir.'/application.xml')) && is_file($xml)) |
|
511 | 511 | return $xml; |
512 | - if(false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml)) |
|
512 | + if (false !== ($xml = realpath($app_dir.'/protected/application.xml')) && is_file($xml)) |
|
513 | 513 | return $xml; |
514 | - echo '** Unable to find application.xml in ' . $app_dir . "\n"; |
|
514 | + echo '** Unable to find application.xml in '.$app_dir."\n"; |
|
515 | 515 | return false; |
516 | 516 | } |
517 | 517 | |
518 | 518 | protected function getActiveRecordConfig($app_dir) |
519 | 519 | { |
520 | - if(false === ($xml = $this->getXmlFile($app_dir))) |
|
520 | + if (false === ($xml = $this->getXmlFile($app_dir))) |
|
521 | 521 | return false; |
522 | - if(false !== ($app = $this->initializePradoApplication($app_dir))) |
|
522 | + if (false !== ($app = $this->initializePradoApplication($app_dir))) |
|
523 | 523 | { |
524 | 524 | Prado::using('System.Data.ActiveRecord.TActiveRecordConfig'); |
525 | - foreach($app->getModules() as $module) |
|
526 | - if($module instanceof TActiveRecordConfig) |
|
525 | + foreach ($app->getModules() as $module) |
|
526 | + if ($module instanceof TActiveRecordConfig) |
|
527 | 527 | return $module; |
528 | - echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n"; |
|
528 | + echo '** Unable to find TActiveRecordConfig module in '.$xml."\n"; |
|
529 | 529 | } |
530 | 530 | return false; |
531 | 531 | } |
532 | 532 | |
533 | 533 | protected function getOutputFile($app_dir, $namespace) |
534 | 534 | { |
535 | - if(is_file($namespace) && strpos($namespace, $app_dir) === 0) |
|
535 | + if (is_file($namespace) && strpos($namespace, $app_dir) === 0) |
|
536 | 536 | return $namespace; |
537 | 537 | $file = Prado::getPathOfNamespace($namespace, ".php"); |
538 | - if($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) |
|
538 | + if ($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) |
|
539 | 539 | { |
540 | - if(strpos($path, $app_dir) === 0) |
|
540 | + if (strpos($path, $app_dir) === 0) |
|
541 | 541 | return $file; |
542 | 542 | } |
543 | - echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n"; |
|
543 | + echo '** Output file '.$file.' must be within directory '.$app_dir."\n"; |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | |
547 | 547 | protected function generateActiveRecord($config, $tablename, $output) |
548 | 548 | { |
549 | 549 | $manager = TActiveRecordManager::getInstance(); |
550 | - if($manager->getDbConnection()) { |
|
550 | + if ($manager->getDbConnection()) { |
|
551 | 551 | $gateway = $manager->getRecordGateway(); |
552 | 552 | $tableInfo = $gateway->getTableInfo($manager->getDbConnection(), $tablename); |
553 | - if(count($tableInfo->getColumns()) === 0) |
|
553 | + if (count($tableInfo->getColumns()) === 0) |
|
554 | 554 | { |
555 | - echo '** Unable to find table or view "' . $tablename . '" in "' . $manager->getDbConnection()->getConnectionString() . "\".\n"; |
|
555 | + echo '** Unable to find table or view "'.$tablename.'" in "'.$manager->getDbConnection()->getConnectionString()."\".\n"; |
|
556 | 556 | return false; |
557 | 557 | } |
558 | 558 | else |
559 | 559 | { |
560 | 560 | $properties = []; |
561 | - foreach($tableInfo->getColumns() as $field => $column) |
|
561 | + foreach ($tableInfo->getColumns() as $field => $column) |
|
562 | 562 | $properties[] = $this->generateProperty($field, $column); |
563 | 563 | } |
564 | 564 | |
@@ -567,16 +567,16 @@ discard block |
||
567 | 567 | echo " Writing class $classname to file $output\n"; |
568 | 568 | file_put_contents($output, $class); |
569 | 569 | } else { |
570 | - echo '** Unable to connect to database with ConnectionID=\'' . $config->getConnectionID() . "'. Please check your settings in application.xml and ensure your database connection is set up first.\n"; |
|
570 | + echo '** Unable to connect to database with ConnectionID=\''.$config->getConnectionID()."'. Please check your settings in application.xml and ensure your database connection is set up first.\n"; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
574 | 574 | protected function generateProperty($field, $column) |
575 | 575 | { |
576 | 576 | $prop = ''; |
577 | - $name = '$' . $field; |
|
577 | + $name = '$'.$field; |
|
578 | 578 | $type = $column->getPHPType(); |
579 | - if($this->_soap) |
|
579 | + if ($this->_soap) |
|
580 | 580 | { |
581 | 581 | $prop .= <<<EOD |
582 | 582 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $con = $manager->getDbConnection(); |
649 | 649 | $con->Active = true; |
650 | 650 | |
651 | - switch($con->getDriverName()) |
|
651 | + switch ($con->getDriverName()) |
|
652 | 652 | { |
653 | 653 | case 'mysqli': |
654 | 654 | case 'mysql': |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | case 'oci': |
666 | 666 | // case 'ibm': |
667 | 667 | default: |
668 | - echo "\n Sorry, generateAll is not implemented for " . $con->getDriverName() . "\n"; |
|
668 | + echo "\n Sorry, generateAll is not implemented for ".$con->getDriverName()."\n"; |
|
669 | 669 | |
670 | 670 | } |
671 | 671 | |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | } |
678 | 678 | $con->Active = false; |
679 | 679 | foreach ($tables as $key => $table) { |
680 | - $output = $args[1] . "." . $this->_prefix . ucfirst($table) . $this->_postfix; |
|
680 | + $output = $args[1].".".$this->_prefix.ucfirst($table).$this->_postfix; |
|
681 | 681 | if ($config !== false && $output !== false) { |
682 | - $this->generate("generate " . $table . " " . $output . " " . $this->_soap . " " . $this->_overwrite); |
|
682 | + $this->generate("generate ".$table." ".$output." ".$this->_soap." ".$this->_overwrite); |
|
683 | 683 | } |
684 | 684 | } |
685 | 685 | } |
@@ -689,14 +689,14 @@ discard block |
||
689 | 689 | public function generate($l) |
690 | 690 | { |
691 | 691 | $input = explode(" ", trim($l)); |
692 | - if(count($input) > 2) |
|
692 | + if (count($input) > 2) |
|
693 | 693 | { |
694 | 694 | $app_dir = '.'; |
695 | - if(Prado::getApplication() !== null) |
|
695 | + if (Prado::getApplication() !== null) |
|
696 | 696 | $app_dir = dirname(Prado::getApplication()->getBasePath()); |
697 | - $args = [$input[0],$input[1], $input[2],$app_dir]; |
|
698 | - if(count($input) > 3) |
|
699 | - $args = [$input[0],$input[1], $input[2],$app_dir,'soap']; |
|
697 | + $args = [$input[0], $input[1], $input[2], $app_dir]; |
|
698 | + if (count($input) > 3) |
|
699 | + $args = [$input[0], $input[1], $input[2], $app_dir, 'soap']; |
|
700 | 700 | $cmd = new PradoCommandLineActiveRecordGen; |
701 | 701 | $cmd->performAction($args); |
702 | 702 | } |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | protected function getAppDir($dir = ".") { |
710 | 710 | if (is_dir($dir)) |
711 | 711 | return realpath($dir); |
712 | - if (false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir)) |
|
712 | + if (false !== ($app_dir = realpath($dir.'/protected/')) && is_dir($app_dir)) |
|
713 | 713 | return $app_dir; |
714 | - echo '** Unable to find directory "' . $dir . "\".\n"; |
|
714 | + echo '** Unable to find directory "'.$dir."\".\n"; |
|
715 | 715 | return false; |
716 | 716 | } |
717 | 717 | |
718 | 718 | protected function getXmlFile($app_dir) { |
719 | - if (false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml)) |
|
719 | + if (false !== ($xml = realpath($app_dir.'/application.xml')) && is_file($xml)) |
|
720 | 720 | return $xml; |
721 | - if (false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml)) |
|
721 | + if (false !== ($xml = realpath($app_dir.'/protected/application.xml')) && is_file($xml)) |
|
722 | 722 | return $xml; |
723 | - echo '** Unable to find application.xml in ' . $app_dir . "\n"; |
|
723 | + echo '** Unable to find application.xml in '.$app_dir."\n"; |
|
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | foreach ($app->getModules() as $module) |
733 | 733 | if ($module instanceof TActiveRecordConfig) |
734 | 734 | return $module; |
735 | - echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n"; |
|
735 | + echo '** Unable to find TActiveRecordConfig module in '.$xml."\n"; |
|
736 | 736 | } |
737 | 737 | return false; |
738 | 738 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | if (strpos($path, $app_dir) === 0) |
746 | 746 | return $file; |
747 | 747 | } |
748 | - echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n"; |
|
748 | + echo '** Output file '.$file.' must be within directory '.$app_dir."\n"; |
|
749 | 749 | return false; |
750 | 750 | } |
751 | 751 |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | $this->setConfigurationType($configType); |
301 | 301 | $this->resolvePaths($basePath); |
302 | 302 | |
303 | - if($cacheConfig) |
|
304 | - $this->_cacheFile = $this->_runtimePath . DIRECTORY_SEPARATOR . self::CONFIGCACHE_FILE; |
|
303 | + if ($cacheConfig) |
|
304 | + $this->_cacheFile = $this->_runtimePath.DIRECTORY_SEPARATOR.self::CONFIGCACHE_FILE; |
|
305 | 305 | |
306 | 306 | // generates unique ID by hashing the runtime path |
307 | 307 | $this->_uniqueID = md5($this->_runtimePath); |
308 | 308 | $this->_parameters = new \Prado\Collections\TMap; |
309 | - $this->_services = [$this->getPageServiceID() => ['TPageService',[],null]]; |
|
309 | + $this->_services = [$this->getPageServiceID() => ['TPageService', [], null]]; |
|
310 | 310 | |
311 | 311 | Prado::setPathOfAlias('Application', $this->_basePath); |
312 | 312 | } |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | protected function resolvePaths($basePath) |
325 | 325 | { |
326 | 326 | // determine configuration path and file |
327 | - if(empty($basePath) || ($basePath = realpath($basePath)) === false) |
|
327 | + if (empty($basePath) || ($basePath = realpath($basePath)) === false) |
|
328 | 328 | throw new TConfigurationException('application_basepath_invalid', $basePath); |
329 | - if(is_dir($basePath) && is_file($basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName())) |
|
330 | - $configFile = $basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName(); |
|
331 | - elseif(is_file($basePath)) |
|
329 | + if (is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName())) |
|
330 | + $configFile = $basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName(); |
|
331 | + elseif (is_file($basePath)) |
|
332 | 332 | { |
333 | 333 | $configFile = $basePath; |
334 | 334 | $basePath = dirname($configFile); |
@@ -337,15 +337,15 @@ discard block |
||
337 | 337 | $configFile = null; |
338 | 338 | |
339 | 339 | // determine runtime path |
340 | - $runtimePath = $basePath . DIRECTORY_SEPARATOR . self::RUNTIME_PATH; |
|
341 | - if(is_writable($runtimePath)) |
|
340 | + $runtimePath = $basePath.DIRECTORY_SEPARATOR.self::RUNTIME_PATH; |
|
341 | + if (is_writable($runtimePath)) |
|
342 | 342 | { |
343 | - if($configFile !== null) |
|
343 | + if ($configFile !== null) |
|
344 | 344 | { |
345 | - $runtimePath .= DIRECTORY_SEPARATOR . basename($configFile) . '-' . Prado::getVersion(); |
|
346 | - if(!is_dir($runtimePath)) |
|
345 | + $runtimePath .= DIRECTORY_SEPARATOR.basename($configFile).'-'.Prado::getVersion(); |
|
346 | + if (!is_dir($runtimePath)) |
|
347 | 347 | { |
348 | - if(@mkdir($runtimePath) === false) |
|
348 | + if (@mkdir($runtimePath) === false) |
|
349 | 349 | throw new TConfigurationException('application_runtimepath_failed', $runtimePath); |
350 | 350 | @chmod($runtimePath, PRADO_CHMOD); //make it deletable |
351 | 351 | } |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | $n = count(self::$_steps); |
373 | 373 | $this->_step = 0; |
374 | 374 | $this->_requestCompleted = false; |
375 | - while($this->_step < $n) |
|
375 | + while ($this->_step < $n) |
|
376 | 376 | { |
377 | - if($this->_mode === TApplicationMode::Off) |
|
377 | + if ($this->_mode === TApplicationMode::Off) |
|
378 | 378 | throw new THttpException(503, 'application_unavailable'); |
379 | - if($this->_requestCompleted) |
|
379 | + if ($this->_requestCompleted) |
|
380 | 380 | break; |
381 | 381 | $method = self::$_steps[$this->_step]; |
382 | 382 | Prado::trace("Executing $method()", 'Prado\TApplication'); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->_step++; |
385 | 385 | } |
386 | 386 | } |
387 | - catch(\Exception $e) |
|
387 | + catch (\Exception $e) |
|
388 | 388 | { |
389 | 389 | $this->onError($e); |
390 | 390 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function getGlobalState($key, $defaultValue = null) |
421 | 421 | { |
422 | - return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue; |
|
422 | + return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -435,11 +435,11 @@ discard block |
||
435 | 435 | public function setGlobalState($key, $value, $defaultValue = null, $forceSave = false) |
436 | 436 | { |
437 | 437 | $this->_stateChanged = true; |
438 | - if($value === $defaultValue) |
|
438 | + if ($value === $defaultValue) |
|
439 | 439 | unset($this->_globals[$key]); |
440 | 440 | else |
441 | 441 | $this->_globals[$key] = $value; |
442 | - if($forceSave) |
|
442 | + if ($forceSave) |
|
443 | 443 | $this->saveGlobals(); |
444 | 444 | } |
445 | 445 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | */ |
473 | 473 | protected function saveGlobals() |
474 | 474 | { |
475 | - if($this->_stateChanged) |
|
475 | + if ($this->_stateChanged) |
|
476 | 476 | { |
477 | 477 | $this->_stateChanged = false; |
478 | 478 | $this->getApplicationStatePersister()->save($this->_globals); |
@@ -588,9 +588,9 @@ discard block |
||
588 | 588 | */ |
589 | 589 | public function getConfigurationFileExt() |
590 | 590 | { |
591 | - if($this->_configFileExt === null) |
|
591 | + if ($this->_configFileExt === null) |
|
592 | 592 | { |
593 | - switch($this->_configType) |
|
593 | + switch ($this->_configType) |
|
594 | 594 | { |
595 | 595 | case TApplication::CONFIG_TYPE_PHP: |
596 | 596 | $this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP; |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | public function getConfigurationFileName() |
609 | 609 | { |
610 | 610 | static $fileName; |
611 | - if($fileName == null) |
|
611 | + if ($fileName == null) |
|
612 | 612 | { |
613 | - switch($this->_configType) |
|
613 | + switch ($this->_configType) |
|
614 | 614 | { |
615 | 615 | case TApplication::CONFIG_TYPE_PHP: |
616 | 616 | $fileName = TApplication::CONFIG_FILE_PHP; |
@@ -636,8 +636,8 @@ discard block |
||
636 | 636 | public function setRuntimePath($value) |
637 | 637 | { |
638 | 638 | $this->_runtimePath = $value; |
639 | - if($this->_cacheFile) |
|
640 | - $this->_cacheFile = $this->_runtimePath . DIRECTORY_SEPARATOR . self::CONFIGCACHE_FILE; |
|
639 | + if ($this->_cacheFile) |
|
640 | + $this->_cacheFile = $this->_runtimePath.DIRECTORY_SEPARATOR.self::CONFIGCACHE_FILE; |
|
641 | 641 | // generates unique ID by hashing the runtime path |
642 | 642 | $this->_uniqueID = md5($this->_runtimePath); |
643 | 643 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | */ |
667 | 667 | public function setModule($id, IModule $module = null) |
668 | 668 | { |
669 | - if(isset($this->_modules[$id])) |
|
669 | + if (isset($this->_modules[$id])) |
|
670 | 670 | throw new TConfigurationException('application_moduleid_duplicated', $id); |
671 | 671 | else |
672 | 672 | $this->_modules[$id] = $module; |
@@ -677,11 +677,11 @@ discard block |
||
677 | 677 | */ |
678 | 678 | public function getModule($id) |
679 | 679 | { |
680 | - if(!array_key_exists($id, $this->_modules)) |
|
680 | + if (!array_key_exists($id, $this->_modules)) |
|
681 | 681 | return null; |
682 | 682 | |
683 | 683 | // force loading of a lazy module |
684 | - if($this->_modules[$id] === null) |
|
684 | + if ($this->_modules[$id] === null) |
|
685 | 685 | { |
686 | 686 | $module = $this->internalLoadModule($id, true); |
687 | 687 | $module[0]->init($module[1]); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | public function getRequest() |
718 | 718 | { |
719 | - if(!$this->_request) |
|
719 | + if (!$this->_request) |
|
720 | 720 | { |
721 | 721 | $this->_request = new \Prado\Web\THttpRequest; |
722 | 722 | $this->_request->init(null); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function getResponse() |
739 | 739 | { |
740 | - if(!$this->_response) |
|
740 | + if (!$this->_response) |
|
741 | 741 | { |
742 | 742 | $this->_response = new THttpResponse; |
743 | 743 | $this->_response->init(null); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | public function getSession() |
760 | 760 | { |
761 | - if(!$this->_session) |
|
761 | + if (!$this->_session) |
|
762 | 762 | { |
763 | 763 | $this->_session = new THttpSession; |
764 | 764 | $this->_session->init(null); |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | */ |
780 | 780 | public function getErrorHandler() |
781 | 781 | { |
782 | - if(!$this->_errorHandler) |
|
782 | + if (!$this->_errorHandler) |
|
783 | 783 | { |
784 | 784 | $this->_errorHandler = new TErrorHandler; |
785 | 785 | $this->_errorHandler->init(null); |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | */ |
801 | 801 | public function getSecurityManager() |
802 | 802 | { |
803 | - if(!$this->_security) |
|
803 | + if (!$this->_security) |
|
804 | 804 | { |
805 | 805 | $this->_security = new TSecurityManager; |
806 | 806 | $this->_security->init(null); |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | */ |
822 | 822 | public function getAssetManager() |
823 | 823 | { |
824 | - if(!$this->_assetManager) |
|
824 | + if (!$this->_assetManager) |
|
825 | 825 | { |
826 | 826 | $this->_assetManager = new TAssetManager; |
827 | 827 | $this->_assetManager->init(null); |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | */ |
843 | 843 | public function getApplicationStatePersister() |
844 | 844 | { |
845 | - if(!$this->_statePersister) |
|
845 | + if (!$this->_statePersister) |
|
846 | 846 | { |
847 | 847 | $this->_statePersister = new TApplicationStatePersister; |
848 | 848 | $this->_statePersister->init(null); |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | */ |
897 | 897 | public function getGlobalization($createIfNotExists = true) |
898 | 898 | { |
899 | - if($this->_globalization === null && $createIfNotExists) |
|
899 | + if ($this->_globalization === null && $createIfNotExists) |
|
900 | 900 | { |
901 | 901 | $this->_globalization = new TGlobalization; |
902 | 902 | $this->_globalization->init(null); |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | */ |
918 | 918 | public function getAuthorizationRules() |
919 | 919 | { |
920 | - if($this->_authRules === null) |
|
920 | + if ($this->_authRules === null) |
|
921 | 921 | $this->_authRules = new \Prado\Security\TAuthorizationRuleCollection; |
922 | 922 | return $this->_authRules; |
923 | 923 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | protected function internalLoadModule($id, $force = false) |
931 | 931 | { |
932 | 932 | list($moduleClass, $initProperties, $configElement) = $this->_lazyModules[$id]; |
933 | - if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) |
|
933 | + if (isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) |
|
934 | 934 | { |
935 | 935 | Prado::trace("Postponed loading of lazy module $id ({$moduleClass})", '\Prado\TApplication'); |
936 | 936 | $this->setModule($id, null); |
@@ -939,16 +939,16 @@ discard block |
||
939 | 939 | |
940 | 940 | Prado::trace("Loading module $id ({$moduleClass})", '\Prado\TApplication'); |
941 | 941 | $module = Prado::createComponent($moduleClass); |
942 | - foreach($initProperties as $name => $value) |
|
942 | + foreach ($initProperties as $name => $value) |
|
943 | 943 | { |
944 | - if($name === 'lazy') continue; |
|
944 | + if ($name === 'lazy') continue; |
|
945 | 945 | $module->setSubProperty($name, $value); |
946 | 946 | } |
947 | 947 | $this->setModule($id, $module); |
948 | 948 | // keep the key to avoid reuse of the old module id |
949 | 949 | $this->_lazyModules[$id] = null; |
950 | 950 | |
951 | - return [$module,$configElement]; |
|
951 | + return [$module, $configElement]; |
|
952 | 952 | } |
953 | 953 | /** |
954 | 954 | * Applies an application configuration. |
@@ -957,32 +957,32 @@ discard block |
||
957 | 957 | */ |
958 | 958 | public function applyConfiguration($config, $withinService = false) |
959 | 959 | { |
960 | - if($config->getIsEmpty()) |
|
960 | + if ($config->getIsEmpty()) |
|
961 | 961 | return; |
962 | 962 | |
963 | 963 | // set path aliases and using namespaces |
964 | - foreach($config->getAliases() as $alias => $path) |
|
964 | + foreach ($config->getAliases() as $alias => $path) |
|
965 | 965 | Prado::setPathOfAlias($alias, $path); |
966 | - foreach($config->getUsings() as $using) |
|
966 | + foreach ($config->getUsings() as $using) |
|
967 | 967 | Prado::using($using); |
968 | 968 | |
969 | 969 | // set application properties |
970 | - if(!$withinService) |
|
970 | + if (!$withinService) |
|
971 | 971 | { |
972 | - foreach($config->getProperties() as $name => $value) |
|
972 | + foreach ($config->getProperties() as $name => $value) |
|
973 | 973 | $this->setSubProperty($name, $value); |
974 | 974 | } |
975 | 975 | |
976 | - if(empty($this->_services)) |
|
977 | - $this->_services = [$this->getPageServiceID() => ['Prado\Web\Services\TPageService',[],null]]; |
|
976 | + if (empty($this->_services)) |
|
977 | + $this->_services = [$this->getPageServiceID() => ['Prado\Web\Services\TPageService', [], null]]; |
|
978 | 978 | |
979 | 979 | // load parameters |
980 | - foreach($config->getParameters() as $id => $parameter) |
|
980 | + foreach ($config->getParameters() as $id => $parameter) |
|
981 | 981 | { |
982 | - if(is_array($parameter)) |
|
982 | + if (is_array($parameter)) |
|
983 | 983 | { |
984 | 984 | $component = Prado::createComponent($parameter[0]); |
985 | - foreach($parameter[1] as $name => $value) |
|
985 | + foreach ($parameter[1] as $name => $value) |
|
986 | 986 | $component->setSubProperty($name, $value); |
987 | 987 | $this->_parameters->add($id, $component); |
988 | 988 | } |
@@ -992,29 +992,29 @@ discard block |
||
992 | 992 | |
993 | 993 | // load and init modules specified in app config |
994 | 994 | $modules = []; |
995 | - foreach($config->getModules() as $id => $moduleConfig) |
|
995 | + foreach ($config->getModules() as $id => $moduleConfig) |
|
996 | 996 | { |
997 | - if(!is_string($id)) |
|
998 | - $id = '_module' . count($this->_lazyModules); |
|
997 | + if (!is_string($id)) |
|
998 | + $id = '_module'.count($this->_lazyModules); |
|
999 | 999 | $this->_lazyModules[$id] = $moduleConfig; |
1000 | - if($module = $this->internalLoadModule($id)) |
|
1000 | + if ($module = $this->internalLoadModule($id)) |
|
1001 | 1001 | $modules[] = $module; |
1002 | 1002 | } |
1003 | - foreach($modules as $module) |
|
1003 | + foreach ($modules as $module) |
|
1004 | 1004 | $module[0]->init($module[1]); |
1005 | 1005 | |
1006 | 1006 | // load service |
1007 | - foreach($config->getServices() as $serviceID => $serviceConfig) |
|
1007 | + foreach ($config->getServices() as $serviceID => $serviceConfig) |
|
1008 | 1008 | $this->_services[$serviceID] = $serviceConfig; |
1009 | 1009 | |
1010 | 1010 | // external configurations |
1011 | - foreach($config->getExternalConfigurations() as $filePath => $condition) |
|
1011 | + foreach ($config->getExternalConfigurations() as $filePath => $condition) |
|
1012 | 1012 | { |
1013 | - if($condition !== true) |
|
1013 | + if ($condition !== true) |
|
1014 | 1014 | $condition = $this->evaluateExpression($condition); |
1015 | - if($condition) |
|
1015 | + if ($condition) |
|
1016 | 1016 | { |
1017 | - if(($path = Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt())) === null || !is_file($path)) |
|
1017 | + if (($path = Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt())) === null || !is_file($path)) |
|
1018 | 1018 | throw new TConfigurationException('application_includefile_invalid', $filePath); |
1019 | 1019 | $cn = $this->getApplicationConfigurationClass(); |
1020 | 1020 | $c = new $cn; |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | { |
1038 | 1038 | Prado::trace('Initializing application', 'Prado\TApplication'); |
1039 | 1039 | |
1040 | - if($this->_configFile !== null) |
|
1040 | + if ($this->_configFile !== null) |
|
1041 | 1041 | { |
1042 | - if($this->_cacheFile === null || @filemtime($this->_cacheFile) < filemtime($this->_configFile)) |
|
1042 | + if ($this->_cacheFile === null || @filemtime($this->_cacheFile) < filemtime($this->_configFile)) |
|
1043 | 1043 | { |
1044 | 1044 | $config = new TApplicationConfiguration; |
1045 | 1045 | $config->loadFromFile($this->_configFile); |
1046 | - if($this->_cacheFile !== null) |
|
1046 | + if ($this->_cacheFile !== null) |
|
1047 | 1047 | file_put_contents($this->_cacheFile, serialize($config), LOCK_EX); |
1048 | 1048 | } |
1049 | 1049 | else |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | $this->applyConfiguration($config, false); |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - if(($serviceID = $this->getRequest()->resolveRequest(array_keys($this->_services))) === null) |
|
1055 | + if (($serviceID = $this->getRequest()->resolveRequest(array_keys($this->_services))) === null) |
|
1056 | 1056 | $serviceID = $this->getPageServiceID(); |
1057 | 1057 | |
1058 | 1058 | $this->startService($serviceID); |
@@ -1066,24 +1066,24 @@ discard block |
||
1066 | 1066 | */ |
1067 | 1067 | public function startService($serviceID) |
1068 | 1068 | { |
1069 | - if(isset($this->_services[$serviceID])) |
|
1069 | + if (isset($this->_services[$serviceID])) |
|
1070 | 1070 | { |
1071 | 1071 | list($serviceClass, $initProperties, $configElement) = $this->_services[$serviceID]; |
1072 | 1072 | $service = Prado::createComponent($serviceClass); |
1073 | - if(!($service instanceof IService)) |
|
1073 | + if (!($service instanceof IService)) |
|
1074 | 1074 | throw new THttpException(500, 'application_service_invalid', $serviceClass); |
1075 | - if(!$service->getEnabled()) |
|
1075 | + if (!$service->getEnabled()) |
|
1076 | 1076 | throw new THttpException(500, 'application_service_unavailable', $serviceClass); |
1077 | 1077 | $service->setID($serviceID); |
1078 | 1078 | $this->setService($service); |
1079 | 1079 | |
1080 | - foreach($initProperties as $name => $value) |
|
1080 | + foreach ($initProperties as $name => $value) |
|
1081 | 1081 | $service->setSubProperty($name, $value); |
1082 | 1082 | |
1083 | - if($configElement !== null) |
|
1083 | + if ($configElement !== null) |
|
1084 | 1084 | { |
1085 | 1085 | $config = new TApplicationConfiguration; |
1086 | - if($this->getConfigurationType() == self::CONFIG_TYPE_PHP) |
|
1086 | + if ($this->getConfigurationType() == self::CONFIG_TYPE_PHP) |
|
1087 | 1087 | $config->loadFromPhp($configElement, $this->getBasePath()); |
1088 | 1088 | else |
1089 | 1089 | $config->loadFromXml($configElement, $this->getBasePath()); |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | public function runService() |
1192 | 1192 | { |
1193 | - if($this->_service) |
|
1193 | + if ($this->_service) |
|
1194 | 1194 | $this->_service->run(); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | public function onEndRequest() |
1239 | 1239 | { |
1240 | 1240 | $this->flushOutput(false); // flush all remaining content in the buffer |
1241 | - $this->saveGlobals(); // save global state |
|
1241 | + $this->saveGlobals(); // save global state |
|
1242 | 1242 | $this->raiseEvent('OnEndRequest', $this, null); |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | public function init($config) |
112 | 112 | { |
113 | 113 | $this->loadUserData($config); |
114 | - if($this->_userFile !== null) |
|
114 | + if ($this->_userFile !== null) |
|
115 | 115 | { |
116 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
116 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
117 | 117 | { |
118 | 118 | $userFile = include $this->_userFile; |
119 | 119 | $this->loadUserDataFromPhp($userFile); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function loadUserData($config) |
136 | 136 | { |
137 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
137 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
138 | 138 | $this->loadUserDataFromPhp($config); |
139 | 139 | else |
140 | 140 | $this->loadUserDataFromXml($config); |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | */ |
147 | 147 | private function loadUserDataFromPhp($config) |
148 | 148 | { |
149 | - if(isset($config['users']) && is_array($config['users'])) |
|
149 | + if (isset($config['users']) && is_array($config['users'])) |
|
150 | 150 | { |
151 | - foreach($config['users'] as $user) |
|
151 | + foreach ($config['users'] as $user) |
|
152 | 152 | { |
153 | - $name = trim(strtolower(isset($user['name'])?$user['name']:'')); |
|
154 | - $password = isset($user['password'])?$user['password']:''; |
|
153 | + $name = trim(strtolower(isset($user['name']) ? $user['name'] : '')); |
|
154 | + $password = isset($user['password']) ? $user['password'] : ''; |
|
155 | 155 | $this->_users[$name] = $password; |
156 | - $roles = isset($user['roles'])?$user['roles']:''; |
|
157 | - if($roles !== '') |
|
156 | + $roles = isset($user['roles']) ? $user['roles'] : ''; |
|
157 | + if ($roles !== '') |
|
158 | 158 | { |
159 | - foreach(explode(',', $roles) as $role) |
|
159 | + foreach (explode(',', $roles) as $role) |
|
160 | 160 | { |
161 | - if(($role = trim($role)) !== '') |
|
161 | + if (($role = trim($role)) !== '') |
|
162 | 162 | $this->_roles[$name][] = $role; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | - if(isset($config['roles']) && is_array($config['roles'])) |
|
167 | + if (isset($config['roles']) && is_array($config['roles'])) |
|
168 | 168 | { |
169 | - foreach($config['roles'] as $role) |
|
169 | + foreach ($config['roles'] as $role) |
|
170 | 170 | { |
171 | - $name = isset($role['name'])?$role['name']:''; |
|
172 | - $users = isset($role['users'])?$role['users']:''; |
|
173 | - foreach(explode(',', $users) as $user) |
|
171 | + $name = isset($role['name']) ? $role['name'] : ''; |
|
172 | + $users = isset($role['users']) ? $role['users'] : ''; |
|
173 | + foreach (explode(',', $users) as $user) |
|
174 | 174 | { |
175 | - if(($user = trim($user)) !== '') |
|
175 | + if (($user = trim($user)) !== '') |
|
176 | 176 | $this->_roles[strtolower($user)][] = $name; |
177 | 177 | } |
178 | 178 | } |
@@ -185,24 +185,24 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function loadUserDataFromXml($xmlNode) |
187 | 187 | { |
188 | - foreach($xmlNode->getElementsByTagName('user') as $node) |
|
188 | + foreach ($xmlNode->getElementsByTagName('user') as $node) |
|
189 | 189 | { |
190 | 190 | $name = trim(strtolower($node->getAttribute('name'))); |
191 | 191 | $this->_users[$name] = $node->getAttribute('password'); |
192 | - if(($roles = trim($node->getAttribute('roles'))) !== '') |
|
192 | + if (($roles = trim($node->getAttribute('roles'))) !== '') |
|
193 | 193 | { |
194 | - foreach(explode(',', $roles) as $role) |
|
194 | + foreach (explode(',', $roles) as $role) |
|
195 | 195 | { |
196 | - if(($role = trim($role)) !== '') |
|
196 | + if (($role = trim($role)) !== '') |
|
197 | 197 | $this->_roles[$name][] = $role; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
201 | - foreach($xmlNode->getElementsByTagName('role') as $node) |
|
201 | + foreach ($xmlNode->getElementsByTagName('role') as $node) |
|
202 | 202 | { |
203 | - foreach(explode(',', $node->getAttribute('users')) as $user) |
|
203 | + foreach (explode(',', $node->getAttribute('users')) as $user) |
|
204 | 204 | { |
205 | - if(($user = trim($user)) !== '') |
|
205 | + if (($user = trim($user)) !== '') |
|
206 | 206 | $this->_roles[strtolower($user)][] = $node->getAttribute('name'); |
207 | 207 | } |
208 | 208 | } |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function setUserFile($value) |
250 | 250 | { |
251 | - if($this->_initialized) |
|
251 | + if ($this->_initialized) |
|
252 | 252 | throw new TInvalidOperationException('usermanager_userfile_unchangeable'); |
253 | - elseif(($this->_userFile = Prado::getPathOfNamespace($value, self::USER_FILE_EXT)) === null || !is_file($this->_userFile)) |
|
253 | + elseif (($this->_userFile = Prado::getPathOfNamespace($value, self::USER_FILE_EXT)) === null || !is_file($this->_userFile)) |
|
254 | 254 | throw new TConfigurationException('usermanager_userfile_invalid', $value); |
255 | 255 | } |
256 | 256 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function validateUser($username, $password) |
296 | 296 | { |
297 | - if($this->_passwordMode === TUserManagerPasswordMode::MD5) |
|
297 | + if ($this->_passwordMode === TUserManagerPasswordMode::MD5) |
|
298 | 298 | $password = md5($password); |
299 | - elseif($this->_passwordMode === TUserManagerPasswordMode::SHA1) |
|
299 | + elseif ($this->_passwordMode === TUserManagerPasswordMode::SHA1) |
|
300 | 300 | $password = sha1($password); |
301 | 301 | $username = strtolower($username); |
302 | 302 | return (isset($this->_users[$username]) && $this->_users[$username] === $password); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function getUser($username = null) |
311 | 311 | { |
312 | - if($username === null) |
|
312 | + if ($username === null) |
|
313 | 313 | { |
314 | 314 | $user = new TUser($this); |
315 | 315 | $user->setIsGuest(true); |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | else |
319 | 319 | { |
320 | 320 | $username = strtolower($username); |
321 | - if(isset($this->_users[$username])) |
|
321 | + if (isset($this->_users[$username])) |
|
322 | 322 | { |
323 | 323 | $user = new TUser($this); |
324 | 324 | $user->setName($username); |
325 | 325 | $user->setIsGuest(false); |
326 | - if(isset($this->_roles[$username])) |
|
326 | + if (isset($this->_roles[$username])) |
|
327 | 327 | $user->setRoles($this->_roles[$username]); |
328 | 328 | return $user; |
329 | 329 | } |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getUserFromCookie($cookie) |
342 | 342 | { |
343 | - if(($data = $cookie->getValue()) !== '') |
|
343 | + if (($data = $cookie->getValue()) !== '') |
|
344 | 344 | { |
345 | 345 | $data = unserialize($data); |
346 | - if(is_array($data) && count($data) === 2) |
|
346 | + if (is_array($data) && count($data) === 2) |
|
347 | 347 | { |
348 | 348 | list($username, $token) = $data; |
349 | - if(isset($this->_users[$username]) && $token === md5($username . $this->_users[$username])) |
|
349 | + if (isset($this->_users[$username]) && $token === md5($username.$this->_users[$username])) |
|
350 | 350 | return $this->getUser($username); |
351 | 351 | } |
352 | 352 | } |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | { |
363 | 363 | $user = $this->getApplication()->getUser(); |
364 | 364 | $username = strtolower($user->getName()); |
365 | - if(isset($this->_users[$username])) |
|
365 | + if (isset($this->_users[$username])) |
|
366 | 366 | { |
367 | - $data = [$username,md5($username . $this->_users[$username])]; |
|
367 | + $data = [$username, md5($username.$this->_users[$username])]; |
|
368 | 368 | $cookie->setValue(serialize($data)); |
369 | 369 | } |
370 | 370 | } |
@@ -89,22 +89,22 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function init($config) |
91 | 91 | { |
92 | - if($this->_userManager === null) |
|
92 | + if ($this->_userManager === null) |
|
93 | 93 | throw new TConfigurationException('authmanager_usermanager_required'); |
94 | - if($this->_returnUrlVarName === null) |
|
95 | - $this->_returnUrlVarName = $this->getApplication()->getID() . ':' . self::RETURN_URL_VAR; |
|
94 | + if ($this->_returnUrlVarName === null) |
|
95 | + $this->_returnUrlVarName = $this->getApplication()->getID().':'.self::RETURN_URL_VAR; |
|
96 | 96 | $application = $this->getApplication(); |
97 | - if(is_string($this->_userManager)) |
|
97 | + if (is_string($this->_userManager)) |
|
98 | 98 | { |
99 | - if(($users = $application->getModule($this->_userManager)) === null) |
|
99 | + if (($users = $application->getModule($this->_userManager)) === null) |
|
100 | 100 | throw new TConfigurationException('authmanager_usermanager_inexistent', $this->_userManager); |
101 | - if(!($users instanceof IUserManager)) |
|
101 | + if (!($users instanceof IUserManager)) |
|
102 | 102 | throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager); |
103 | 103 | $this->_userManager = $users; |
104 | 104 | } |
105 | - $application->attachEventHandler('OnAuthentication', [$this,'doAuthentication']); |
|
106 | - $application->attachEventHandler('OnEndRequest', [$this,'leave']); |
|
107 | - $application->attachEventHandler('OnAuthorization', [$this,'doAuthorization']); |
|
105 | + $application->attachEventHandler('OnAuthentication', [$this, 'doAuthentication']); |
|
106 | + $application->attachEventHandler('OnEndRequest', [$this, 'leave']); |
|
107 | + $application->attachEventHandler('OnAuthorization', [$this, 'doAuthorization']); |
|
108 | 108 | $this->_initialized = true; |
109 | 109 | } |
110 | 110 | |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setUserManager($provider) |
124 | 124 | { |
125 | - if($this->_initialized) |
|
125 | + if ($this->_initialized) |
|
126 | 126 | throw new TInvalidOperationException('authmanager_usermanager_unchangeable'); |
127 | - if(!is_string($provider) && !($provider instanceof IUserManager)) |
|
127 | + if (!is_string($provider) && !($provider instanceof IUserManager)) |
|
128 | 128 | throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager); |
129 | 129 | $this->_userManager = $provider; |
130 | 130 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->onAuthenticate($param); |
161 | 161 | |
162 | 162 | $service = $this->getService(); |
163 | - if(($service instanceof TPageService) && $service->getRequestedPagePath() === $this->getLoginPage()) |
|
163 | + if (($service instanceof TPageService) && $service->getRequestedPagePath() === $this->getLoginPage()) |
|
164 | 164 | $this->_skipAuthorization = true; |
165 | 165 | } |
166 | 166 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function doAuthorization($sender, $param) |
175 | 175 | { |
176 | - if(!$this->_skipAuthorization) |
|
176 | + if (!$this->_skipAuthorization) |
|
177 | 177 | { |
178 | 178 | $this->onAuthorize($param); |
179 | 179 | } |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | public function leave($sender, $param) |
190 | 190 | { |
191 | 191 | $application = $this->getApplication(); |
192 | - if($application->getResponse()->getStatusCode() === 401) |
|
192 | + if ($application->getResponse()->getStatusCode() === 401) |
|
193 | 193 | { |
194 | 194 | $service = $application->getService(); |
195 | - if($service instanceof TPageService) |
|
195 | + if ($service instanceof TPageService) |
|
196 | 196 | { |
197 | 197 | $returnUrl = $application->getRequest()->getRequestUri(); |
198 | 198 | $this->setReturnUrl($returnUrl); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $application = $this->getApplication(); |
285 | 285 | |
286 | 286 | // restoring user info from session |
287 | - if(($session = $application->getSession()) === null) |
|
287 | + if (($session = $application->getSession()) === null) |
|
288 | 288 | throw new TConfigurationException('authmanager_session_required'); |
289 | 289 | $session->open(); |
290 | 290 | $sessionInfo = $session->itemAt($this->getUserKey()); |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | ($expiretime = $session->itemAt('AuthExpireTime')) && $expiretime < time(); |
296 | 296 | |
297 | 297 | // try authenticating through cookie if possible |
298 | - if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired)) |
|
298 | + if ($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired)) |
|
299 | 299 | { |
300 | 300 | $cookie = $this->getRequest()->getCookies()->itemAt($this->getUserKey()); |
301 | - if($cookie instanceof THttpCookie) |
|
301 | + if ($cookie instanceof THttpCookie) |
|
302 | 302 | { |
303 | - if(($user2 = $this->_userManager->getUserFromCookie($cookie)) !== null) |
|
303 | + if (($user2 = $this->_userManager->getUserFromCookie($cookie)) !== null) |
|
304 | 304 | { |
305 | 305 | $user = $user2; |
306 | 306 | $this->updateSessionUser($user); |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | $application->setUser($user); |
314 | 314 | |
315 | 315 | // handle authentication expiration or update expiration time |
316 | - if($isAuthExpired) |
|
316 | + if ($isAuthExpired) |
|
317 | 317 | $this->onAuthExpire($param); |
318 | 318 | else |
319 | 319 | $session->add('AuthExpireTime', time() + $this->_authExpire); |
320 | 320 | |
321 | 321 | // event handler gets a chance to do further auth work |
322 | - if($this->hasEventHandler('OnAuthenticate')) |
|
322 | + if ($this->hasEventHandler('OnAuthenticate')) |
|
323 | 323 | $this->raiseEvent('OnAuthenticate', $this, $application); |
324 | 324 | } |
325 | 325 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | public function onAuthExpire($param) |
332 | 332 | { |
333 | 333 | $this->logout(); |
334 | - if($this->hasEventHandler('OnAuthExpire')) |
|
334 | + if ($this->hasEventHandler('OnAuthExpire')) |
|
335 | 335 | $this->raiseEvent('OnAuthExpire', $this, $param); |
336 | 336 | } |
337 | 337 | |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | public function onAuthorize($param) |
346 | 346 | { |
347 | 347 | $application = $this->getApplication(); |
348 | - if($this->hasEventHandler('OnAuthorize')) |
|
348 | + if ($this->hasEventHandler('OnAuthorize')) |
|
349 | 349 | $this->raiseEvent('OnAuthorize', $this, $application); |
350 | - if(!$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress())) |
|
350 | + if (!$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress())) |
|
351 | 351 | { |
352 | 352 | $application->getResponse()->setStatusCode(401); |
353 | 353 | $application->completeRequest(); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function getUserKey() |
362 | 362 | { |
363 | - if($this->_userKey === null) |
|
363 | + if ($this->_userKey === null) |
|
364 | 364 | $this->_userKey = $this->generateUserKey(); |
365 | 365 | return $this->_userKey; |
366 | 366 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | protected function generateUserKey() |
373 | 373 | { |
374 | - return md5($this->getApplication()->getUniqueID() . 'prado:user'); |
|
374 | + return md5($this->getApplication()->getUniqueID().'prado:user'); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function updateSessionUser($user) |
383 | 383 | { |
384 | - if(!$user->getIsGuest()) |
|
384 | + if (!$user->getIsGuest()) |
|
385 | 385 | { |
386 | - if(($session = $this->getSession()) === null) |
|
386 | + if (($session = $this->getSession()) === null) |
|
387 | 387 | throw new TConfigurationException('authmanager_session_required'); |
388 | 388 | else |
389 | 389 | $session->add($this->getUserKey(), $user->saveToString()); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function switchUser($username) |
400 | 400 | { |
401 | - if(($user = $this->_userManager->getUser($username)) === null) |
|
401 | + if (($user = $this->_userManager->getUser($username)) === null) |
|
402 | 402 | return false; |
403 | 403 | $this->updateSessionUser($user); |
404 | 404 | $this->getApplication()->setUser($user); |
@@ -416,14 +416,14 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function login($username, $password, $expire = 0) |
418 | 418 | { |
419 | - if($this->_userManager->validateUser($username, $password)) |
|
419 | + if ($this->_userManager->validateUser($username, $password)) |
|
420 | 420 | { |
421 | - if(($user = $this->_userManager->getUser($username)) === null) |
|
421 | + if (($user = $this->_userManager->getUser($username)) === null) |
|
422 | 422 | return false; |
423 | 423 | $this->updateSessionUser($user); |
424 | 424 | $this->getApplication()->setUser($user); |
425 | 425 | |
426 | - if($expire > 0) |
|
426 | + if ($expire > 0) |
|
427 | 427 | { |
428 | 428 | $cookie = new THttpCookie($this->getUserKey(), ''); |
429 | 429 | $cookie->setExpire(time() + $expire); |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function logout() |
445 | 445 | { |
446 | - if(($session = $this->getSession()) === null) |
|
446 | + if (($session = $this->getSession()) === null) |
|
447 | 447 | throw new TConfigurationException('authmanager_session_required'); |
448 | 448 | $this->getApplication()->getUser()->setIsGuest(true); |
449 | 449 | $session->destroy(); |
450 | - if($this->getAllowAutoLogin()) |
|
450 | + if ($this->getAllowAutoLogin()) |
|
451 | 451 | { |
452 | 452 | $cookie = new THttpCookie($this->getUserKey(), ''); |
453 | 453 | $this->getResponse()->getCookies()->add($cookie); |