@@ -27,6 +27,11 @@ discard block  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 | // recursive glob  | 
                                                        
| 29 | 29 | // On Windows glob() is case-sensitive.  | 
                                                        
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * @param string $sDir  | 
                                                        |
| 33 | + * @param integer $nFlags  | 
                                                        |
| 34 | + */  | 
                                                        |
| 30 | 35 | public function globr($sDir, $sPattern, $nFlags = NULL)  | 
                                                        
| 31 | 36 |      {  | 
                                                        
| 32 | 37 | // Get the list of all matching files currently in the  | 
                                                        
@@ -129,6 +134,9 @@ discard block  | 
                                                    ||
| 129 | 134 |  	$this->markTestIncomplete('XML Schema Language files should be fixed first.'); | 
                                                        
| 130 | 135 | }  | 
                                                        
| 131 | 136 | |
| 137 | + /**  | 
                                                        |
| 138 | + * @param integer $err_code  | 
                                                        |
| 139 | + */  | 
                                                        |
| 132 | 140 | public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')  | 
                                                        
| 133 | 141 |      { | 
                                                        
| 134 | 142 | $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);  | 
                                                        
@@ -166,6 +174,9 @@ discard block  | 
                                                    ||
| 166 | 174 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);  | 
                                                        
| 167 | 175 | }  | 
                                                        
| 168 | 176 | |
| 177 | + /**  | 
                                                        |
| 178 | + * @param string $dir_name  | 
                                                        |
| 179 | + */  | 
                                                        |
| 169 | 180 | public function getDirFilesList($dir_name)  | 
                                                        
| 170 | 181 |      { | 
                                                        
| 171 | 182 | $output = array();  | 
                                                        
@@ -14,15 +14,15 @@ discard block  | 
                                                    ||
| 14 | 14 | const RETCODE_GENERIC_XML_SYNTAX = 50;  | 
                                                        
| 15 | 15 | const RETCODE_QUERY_ELEMENT = 40;  | 
                                                        
| 16 | 16 | const RETCODE_XSD_VALIDATION = 30;  | 
                                                        
| 17 | - const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 18 | - const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented.  | 
                                                        |
| 17 | + const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 18 | + const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented.  | 
                                                        |
| 19 | 19 | const RETCODE_SUCCESS = 0;  | 
                                                        
| 20 | 20 | |
| 21 | 21 | public $validator_cmd;  | 
                                                        
| 22 | 22 | |
| 23 | 23 | public function setUp()  | 
                                                        
| 24 | 24 |      { | 
                                                        
| 25 | - $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";  | 
                                                        |
| 25 | + $this->validator_cmd = "php ".escapeshellarg(__DIR__.'/../validate.php')." ";  | 
                                                        |
| 26 | 26 | }  | 
                                                        
| 27 | 27 | |
| 28 | 28 | // recursive glob  | 
                                                        
@@ -53,17 +53,16 @@ discard block  | 
                                                    ||
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
| 55 | 55 | /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */  | 
                                                        
| 56 | - public function invoke_testReleasedXMLLangFiles  | 
                                                        |
| 57 | - (  | 
                                                        |
| 56 | + public function invoke_testReleasedXMLLangFiles(  | 
                                                        |
| 58 | 57 | $released_files,  | 
                                                        
| 59 | 58 | $expected_return_code,  | 
                                                        
| 60 | 59 | $validator_args = ''  | 
                                                        
| 61 | 60 | )  | 
                                                        
| 62 | 61 |      { | 
                                                        
| 63 | 62 | // this file is in tools/dbxml_validator/tests  | 
                                                        
| 64 | - $xe_dir = __DIR__ . '/../../..';  | 
                                                        |
| 63 | + $xe_dir = __DIR__.'/../../..';  | 
                                                        |
| 65 | 64 | |
| 66 | - $this->assertTrue(file_exists($xe_dir . '/index.php'), 'XE directory not found');  | 
                                                        |
| 65 | + $this->assertTrue(file_exists($xe_dir.'/index.php'), 'XE directory not found');  | 
                                                        |
| 67 | 66 | |
| 68 | 67 | $cnt = 0;  | 
                                                        
| 69 | 68 | $cmd = $this->validator_cmd;  | 
                                                        
@@ -71,11 +70,9 @@ discard block  | 
                                                    ||
| 71 | 70 | |
| 72 | 71 | foreach ($released_files as $released_file_mask)  | 
                                                        
| 73 | 72 | $xml_files =  | 
                                                        
| 74 | - array_merge  | 
                                                        |
| 75 | - (  | 
                                                        |
| 73 | + array_merge(  | 
                                                        |
| 76 | 74 | $xml_files,  | 
                                                        
| 77 | - $this->globr  | 
                                                        |
| 78 | - (  | 
                                                        |
| 75 | + $this->globr(  | 
                                                        |
| 79 | 76 | $xe_dir,  | 
                                                        
| 80 | 77 | $released_file_mask,  | 
                                                        
| 81 | 78 | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR  | 
                                                        
@@ -84,19 +81,18 @@ discard block  | 
                                                    ||
| 84 | 81 | |
| 85 | 82 | while ($cnt < count($xml_files))  | 
                                                        
| 86 | 83 |  	{ | 
                                                        
| 87 | - $cmd = $this->validator_cmd . $validator_args;  | 
                                                        |
| 84 | + $cmd = $this->validator_cmd.$validator_args;  | 
                                                        |
| 88 | 85 | |
| 89 | 86 | // Validate 50 files at once  | 
                                                        
| 90 | 87 | foreach (array_slice($xml_files, $cnt, 50) as $xml_file)  | 
                                                        
| 91 | - $cmd .= " " . escapeshellarg($xml_file);  | 
                                                        |
| 88 | + $cmd .= " ".escapeshellarg($xml_file);  | 
                                                        |
| 92 | 89 | |
| 93 | - exec($cmd . ' 2>&1', $validator_output, $return_code);  | 
                                                        |
| 90 | + exec($cmd.' 2>&1', $validator_output, $return_code);  | 
                                                        |
| 94 | 91 | |
| 95 | 92 |  	    $output_text = trim(trim(implode("\n", $validator_output)), "\n"); | 
                                                        
| 96 | 93 | |
| 97 | 94 | // Validator should not crash/exit-with-an-error.  | 
                                                        
| 98 | - $this->assertLessThanOrEqual  | 
                                                        |
| 99 | - (  | 
                                                        |
| 95 | + $this->assertLessThanOrEqual(  | 
                                                        |
| 100 | 96 | $expected_return_code,  | 
                                                        
| 101 | 97 | $return_code,  | 
                                                        
| 102 | 98 |  		    "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." | 
                                                        
@@ -108,8 +104,7 @@ discard block  | 
                                                    ||
| 108 | 104 | |
| 109 | 105 | public function testReleasedXMLQueryLangFiles()  | 
                                                        
| 110 | 106 |      { | 
                                                        
| 111 | - $this->invoke_testReleasedXMLLangFiles  | 
                                                        |
| 112 | - (  | 
                                                        |
| 107 | + $this->invoke_testReleasedXMLLangFiles(  | 
                                                        |
| 113 | 108 |  		array('queries/*.xml', 'xml_query/*.xml'), | 
                                                        
| 114 | 109 | self::RETCODE_QUERY_ELEMENT  | 
                                                        
| 115 | 110 | );  | 
                                                        
@@ -119,8 +114,7 @@ discard block  | 
                                                    ||
| 119 | 114 | |
| 120 | 115 | public function testReleasedXMLSchemaLangFiles()  | 
                                                        
| 121 | 116 |      { | 
                                                        
| 122 | - $this->invoke_testReleasedXMLLangFiles  | 
                                                        |
| 123 | - (  | 
                                                        |
| 117 | + $this->invoke_testReleasedXMLLangFiles(  | 
                                                        |
| 124 | 118 |  		array('schemas/*.xml'), | 
                                                        
| 125 | 119 | self::RETCODE_BUILTIN_CHECKS,  | 
                                                        
| 126 | 120 | ' --schema-language'  | 
                                                        
@@ -131,17 +125,16 @@ discard block  | 
                                                    ||
| 131 | 125 | |
| 132 | 126 | public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')  | 
                                                        
| 133 | 127 |      { | 
                                                        
| 134 | - $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);  | 
                                                        |
| 128 | + $cmd = $this->validator_cmd.' '.$args.' '.escapeshellarg($filename);  | 
                                                        |
| 135 | 129 | $validator_output = array();  | 
                                                        
| 136 | 130 | $return_code = 0;  | 
                                                        
| 137 | 131 | |
| 138 | - exec($cmd . '2>&1', $validator_output, $return_code);  | 
                                                        |
| 132 | + exec($cmd.'2>&1', $validator_output, $return_code);  | 
                                                        |
| 139 | 133 | |
| 140 | 134 |  	$output_text = trim(trim(implode("\n", $validator_output)), "\n"); | 
                                                        
| 141 | 135 | |
| 142 | 136 | // Validator should not crash/exit-with-an-error.  | 
                                                        
| 143 | - $this->assertEquals  | 
                                                        |
| 144 | - (  | 
                                                        |
| 137 | + $this->assertEquals(  | 
                                                        |
| 145 | 138 | $err_code,  | 
                                                        
| 146 | 139 | $return_code,  | 
                                                        
| 147 | 140 |  		"{$cmd}\n{$output_text}\nValidator returned code {$return_code}." | 
                                                        
@@ -170,7 +163,7 @@ discard block  | 
                                                    ||
| 170 | 163 |      { | 
                                                        
| 171 | 164 | $output = array();  | 
                                                        
| 172 | 165 | |
| 173 | - $dir = opendir(__DIR__ . '/' . $dir_name);  | 
                                                        |
| 166 | + $dir = opendir(__DIR__.'/'.$dir_name);  | 
                                                        |
| 174 | 167 | |
| 175 | 168 | if ($dir)  | 
                                                        
| 176 | 169 |  	{ | 
                                                        
@@ -178,9 +171,9 @@ discard block  | 
                                                    ||
| 178 | 171 | |
| 179 | 172 | while ($entry !== FALSE)  | 
                                                        
| 180 | 173 |  	    { | 
                                                        
| 181 | - $fname = __DIR__ . '/' . $dir_name .'/' . $entry;  | 
                                                        |
| 174 | + $fname = __DIR__.'/'.$dir_name.'/'.$entry;  | 
                                                        |
| 182 | 175 | |
| 183 | - if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')  | 
                                                        |
| 176 | + if (!is_dir($fname) && $entry != 'wrongQueryId.xml')  | 
                                                        |
| 184 | 177 | $output[] = array($fname);  | 
                                                        
| 185 | 178 | |
| 186 | 179 | $entry = readdir($dir);  | 
                                                        
@@ -2,33 +2,33 @@ discard block  | 
                                                    ||
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */  | 
                                                        
| 3 | 3 | |
| 4 | 4 |  if (!defined('__DIR__')) | 
                                                        
| 5 | -    define('__DIR__', realpath(dirname(__FILE__)));  | 
                                                        |
| 5 | +	define('__DIR__', realpath(dirname(__FILE__)));  | 
                                                        |
| 6 | 6 | |
| 7 | 7 | /** The tests here are meant only for the built-in checks in validator.php,  | 
                                                        
| 8 | 8 | and not for the entire syntax expressed by the .xsd files. */  | 
                                                        
| 9 | 9 | class XmlQueriesTest extends PHPUnit_Framework_TestCase  | 
                                                        
| 10 | 10 |  { | 
                                                        
| 11 | - // taken from validator.php  | 
                                                        |
| 11 | + // taken from validator.php  | 
                                                        |
| 12 | 12 | |
| 13 | - const RETCODE_VALIDATOR_INTERNAL = 60;  | 
                                                        |
| 14 | - const RETCODE_GENERIC_XML_SYNTAX = 50;  | 
                                                        |
| 15 | - const RETCODE_QUERY_ELEMENT = 40;  | 
                                                        |
| 16 | - const RETCODE_XSD_VALIDATION = 30;  | 
                                                        |
| 17 | - const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 18 | - const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented.  | 
                                                        |
| 19 | - const RETCODE_SUCCESS = 0;  | 
                                                        |
| 13 | + const RETCODE_VALIDATOR_INTERNAL = 60;  | 
                                                        |
| 14 | + const RETCODE_GENERIC_XML_SYNTAX = 50;  | 
                                                        |
| 15 | + const RETCODE_QUERY_ELEMENT = 40;  | 
                                                        |
| 16 | + const RETCODE_XSD_VALIDATION = 30;  | 
                                                        |
| 17 | + const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 18 | + const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented.  | 
                                                        |
| 19 | + const RETCODE_SUCCESS = 0;  | 
                                                        |
| 20 | 20 | |
| 21 | - public $validator_cmd;  | 
                                                        |
| 21 | + public $validator_cmd;  | 
                                                        |
| 22 | 22 | |
| 23 | - public function setUp()  | 
                                                        |
| 24 | -    { | 
                                                        |
| 23 | + public function setUp()  | 
                                                        |
| 24 | +	{ | 
                                                        |
| 25 | 25 | $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";  | 
                                                        
| 26 | - }  | 
                                                        |
| 26 | + }  | 
                                                        |
| 27 | 27 | |
| 28 | - // recursive glob  | 
                                                        |
| 29 | - // On Windows glob() is case-sensitive.  | 
                                                        |
| 30 | - public function globr($sDir, $sPattern, $nFlags = NULL)  | 
                                                        |
| 31 | -    {  | 
                                                        |
| 28 | + // recursive glob  | 
                                                        |
| 29 | + // On Windows glob() is case-sensitive.  | 
                                                        |
| 30 | + public function globr($sDir, $sPattern, $nFlags = NULL)  | 
                                                        |
| 31 | +	{  | 
                                                        |
| 32 | 32 | // Get the list of all matching files currently in the  | 
                                                        
| 33 | 33 | // directory.  | 
                                                        
| 34 | 34 | |
@@ -41,25 +41,25 @@ discard block  | 
                                                    ||
| 41 | 41 | |
| 42 | 42 | foreach ($aDirs as $sSubDir)  | 
                                                        
| 43 | 43 |  	{  | 
                                                        
| 44 | - if ($sSubDir != '.' && $sSubDir != '..')  | 
                                                        |
| 45 | -	    { | 
                                                        |
| 44 | + if ($sSubDir != '.' && $sSubDir != '..')  | 
                                                        |
| 45 | +		{ | 
                                                        |
| 46 | 46 | $aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags);  | 
                                                        
| 47 | 47 | $aFiles = array_merge($aFiles, $aSubFiles);  | 
                                                        
| 48 | - }  | 
                                                        |
| 48 | + }  | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | 51 | // return merged array with all (recursive) files  | 
                                                        
| 52 | 52 | return $aFiles;  | 
                                                        
| 53 | - }  | 
                                                        |
| 53 | + }  | 
                                                        |
| 54 | 54 | |
| 55 | - /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */  | 
                                                        |
| 56 | - public function invoke_testReleasedXMLLangFiles  | 
                                                        |
| 55 | + /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */  | 
                                                        |
| 56 | + public function invoke_testReleasedXMLLangFiles  | 
                                                        |
| 57 | 57 | (  | 
                                                        
| 58 | - $released_files,  | 
                                                        |
| 59 | - $expected_return_code,  | 
                                                        |
| 60 | - $validator_args = ''  | 
                                                        |
| 58 | + $released_files,  | 
                                                        |
| 59 | + $expected_return_code,  | 
                                                        |
| 60 | + $validator_args = ''  | 
                                                        |
| 61 | 61 | )  | 
                                                        
| 62 | -    { | 
                                                        |
| 62 | +	{ | 
                                                        |
| 63 | 63 | // this file is in tools/dbxml_validator/tests  | 
                                                        
| 64 | 64 | $xe_dir = __DIR__ . '/../../..';  | 
                                                        
| 65 | 65 | |
@@ -70,67 +70,67 @@ discard block  | 
                                                    ||
| 70 | 70 | $xml_files = array();  | 
                                                        
| 71 | 71 | |
| 72 | 72 | foreach ($released_files as $released_file_mask)  | 
                                                        
| 73 | - $xml_files =  | 
                                                        |
| 73 | + $xml_files =  | 
                                                        |
| 74 | 74 | array_merge  | 
                                                        
| 75 | 75 | (  | 
                                                        
| 76 | - $xml_files,  | 
                                                        |
| 77 | - $this->globr  | 
                                                        |
| 76 | + $xml_files,  | 
                                                        |
| 77 | + $this->globr  | 
                                                        |
| 78 | 78 | (  | 
                                                        
| 79 | - $xe_dir,  | 
                                                        |
| 80 | - $released_file_mask,  | 
                                                        |
| 81 | - GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR  | 
                                                        |
| 79 | + $xe_dir,  | 
                                                        |
| 80 | + $released_file_mask,  | 
                                                        |
| 81 | + GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR  | 
                                                        |
| 82 | 82 | )  | 
                                                        
| 83 | 83 | );  | 
                                                        
| 84 | 84 | |
| 85 | 85 | while ($cnt < count($xml_files))  | 
                                                        
| 86 | 86 |  	{ | 
                                                        
| 87 | - $cmd = $this->validator_cmd . $validator_args;  | 
                                                        |
| 87 | + $cmd = $this->validator_cmd . $validator_args;  | 
                                                        |
| 88 | 88 | |
| 89 | - // Validate 50 files at once  | 
                                                        |
| 90 | - foreach (array_slice($xml_files, $cnt, 50) as $xml_file)  | 
                                                        |
| 89 | + // Validate 50 files at once  | 
                                                        |
| 90 | + foreach (array_slice($xml_files, $cnt, 50) as $xml_file)  | 
                                                        |
| 91 | 91 | $cmd .= " " . escapeshellarg($xml_file);  | 
                                                        
| 92 | 92 | |
| 93 | - exec($cmd . ' 2>&1', $validator_output, $return_code);  | 
                                                        |
| 93 | + exec($cmd . ' 2>&1', $validator_output, $return_code);  | 
                                                        |
| 94 | 94 | |
| 95 | -	    $output_text = trim(trim(implode("\n", $validator_output)), "\n"); | 
                                                        |
| 95 | +		$output_text = trim(trim(implode("\n", $validator_output)), "\n"); | 
                                                        |
| 96 | 96 | |
| 97 | - // Validator should not crash/exit-with-an-error.  | 
                                                        |
| 98 | - $this->assertLessThanOrEqual  | 
                                                        |
| 97 | + // Validator should not crash/exit-with-an-error.  | 
                                                        |
| 98 | + $this->assertLessThanOrEqual  | 
                                                        |
| 99 | 99 | (  | 
                                                        
| 100 | - $expected_return_code,  | 
                                                        |
| 101 | - $return_code,  | 
                                                        |
| 102 | -		    "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." | 
                                                        |
| 100 | + $expected_return_code,  | 
                                                        |
| 101 | + $return_code,  | 
                                                        |
| 102 | +			"{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." | 
                                                        |
| 103 | 103 | );  | 
                                                        
| 104 | 104 | |
| 105 | - $cnt += 50;  | 
                                                        |
| 105 | + $cnt += 50;  | 
                                                        |
| 106 | + }  | 
                                                        |
| 106 | 107 | }  | 
                                                        
| 107 | - }  | 
                                                        |
| 108 | 108 | |
| 109 | - public function testReleasedXMLQueryLangFiles()  | 
                                                        |
| 110 | -    { | 
                                                        |
| 109 | + public function testReleasedXMLQueryLangFiles()  | 
                                                        |
| 110 | +	{ | 
                                                        |
| 111 | 111 | $this->invoke_testReleasedXMLLangFiles  | 
                                                        
| 112 | - (  | 
                                                        |
| 112 | + (  | 
                                                        |
| 113 | 113 |  		array('queries/*.xml', 'xml_query/*.xml'), | 
                                                        
| 114 | 114 | self::RETCODE_QUERY_ELEMENT  | 
                                                        
| 115 | - );  | 
                                                        |
| 115 | + );  | 
                                                        |
| 116 | 116 | |
| 117 | 117 |  	$this->markTestIncomplete('XML Query Language files should be fixed first.'); | 
                                                        
| 118 | - }  | 
                                                        |
| 118 | + }  | 
                                                        |
| 119 | 119 | |
| 120 | - public function testReleasedXMLSchemaLangFiles()  | 
                                                        |
| 121 | -    { | 
                                                        |
| 120 | + public function testReleasedXMLSchemaLangFiles()  | 
                                                        |
| 121 | +	{ | 
                                                        |
| 122 | 122 | $this->invoke_testReleasedXMLLangFiles  | 
                                                        
| 123 | - (  | 
                                                        |
| 123 | + (  | 
                                                        |
| 124 | 124 |  		array('schemas/*.xml'), | 
                                                        
| 125 | 125 | self::RETCODE_BUILTIN_CHECKS,  | 
                                                        
| 126 | 126 | ' --schema-language'  | 
                                                        
| 127 | - );  | 
                                                        |
| 127 | + );  | 
                                                        |
| 128 | 128 | |
| 129 | 129 |  	$this->markTestIncomplete('XML Schema Language files should be fixed first.'); | 
                                                        
| 130 | - }  | 
                                                        |
| 130 | + }  | 
                                                        |
| 131 | 131 | |
| 132 | - public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')  | 
                                                        |
| 133 | -    { | 
                                                        |
| 132 | + public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')  | 
                                                        |
| 133 | +	{ | 
                                                        |
| 134 | 134 | $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);  | 
                                                        
| 135 | 135 | $validator_output = array();  | 
                                                        
| 136 | 136 | $return_code = 0;  | 
                                                        
@@ -141,88 +141,88 @@ discard block  | 
                                                    ||
| 141 | 141 | |
| 142 | 142 | // Validator should not crash/exit-with-an-error.  | 
                                                        
| 143 | 143 | $this->assertEquals  | 
                                                        
| 144 | - (  | 
                                                        |
| 144 | + (  | 
                                                        |
| 145 | 145 | $err_code,  | 
                                                        
| 146 | 146 | $return_code,  | 
                                                        
| 147 | 147 |  		"{$cmd}\n{$output_text}\nValidator returned code {$return_code}." | 
                                                        
| 148 | - );  | 
                                                        |
| 148 | + );  | 
                                                        |
| 149 | 149 | |
| 150 | 150 | // Validator should output some error on the test files  | 
                                                        
| 151 | 151 | $basefilename = basename($filename);  | 
                                                        
| 152 | 152 |  	$this->assertNotEmpty($output_text, "Error reporting failed for {$basefilename} validation."); | 
                                                        
| 153 | 153 | |
| 154 | - }  | 
                                                        |
| 154 | + }  | 
                                                        |
| 155 | 155 | |
| 156 | - public function testInvalidQueryId()  | 
                                                        |
| 157 | -    { | 
                                                        |
| 156 | + public function testInvalidQueryId()  | 
                                                        |
| 157 | +	{ | 
                                                        |
| 158 | 158 | return $this->invoke_testInvalidXmlFiles(__DIR__.'/data/wrongQueryId.xml', self::RETCODE_QUERY_ELEMENT);  | 
                                                        
| 159 | - }  | 
                                                        |
| 159 | + }  | 
                                                        |
| 160 | 160 | |
| 161 | - /**  | 
                                                        |
| 162 | - * @dataProvider getFilesList  | 
                                                        |
| 163 | - */  | 
                                                        |
| 164 | - public function testInvalidXMLQueryFiles($filename)  | 
                                                        |
| 165 | -    { | 
                                                        |
| 161 | + /**  | 
                                                        |
| 162 | + * @dataProvider getFilesList  | 
                                                        |
| 163 | + */  | 
                                                        |
| 164 | + public function testInvalidXMLQueryFiles($filename)  | 
                                                        |
| 165 | +	{ | 
                                                        |
| 166 | 166 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);  | 
                                                        
| 167 | - }  | 
                                                        |
| 167 | + }  | 
                                                        |
| 168 | 168 | |
| 169 | - public function getDirFilesList($dir_name)  | 
                                                        |
| 170 | -    { | 
                                                        |
| 169 | + public function getDirFilesList($dir_name)  | 
                                                        |
| 170 | +	{ | 
                                                        |
| 171 | 171 | $output = array();  | 
                                                        
| 172 | 172 | |
| 173 | 173 | $dir = opendir(__DIR__ . '/' . $dir_name);  | 
                                                        
| 174 | 174 | |
| 175 | 175 | if ($dir)  | 
                                                        
| 176 | 176 |  	{ | 
                                                        
| 177 | - $entry = readdir($dir);  | 
                                                        |
| 177 | + $entry = readdir($dir);  | 
                                                        |
| 178 | 178 | |
| 179 | - while ($entry !== FALSE)  | 
                                                        |
| 180 | -	    { | 
                                                        |
| 179 | + while ($entry !== FALSE)  | 
                                                        |
| 180 | +		{ | 
                                                        |
| 181 | 181 | $fname = __DIR__ . '/' . $dir_name .'/' . $entry;  | 
                                                        
| 182 | 182 | |
| 183 | 183 | if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')  | 
                                                        
| 184 | - $output[] = array($fname);  | 
                                                        |
| 184 | + $output[] = array($fname);  | 
                                                        |
| 185 | 185 | |
| 186 | 186 | $entry = readdir($dir);  | 
                                                        
| 187 | - }  | 
                                                        |
| 187 | + }  | 
                                                        |
| 188 | 188 | |
| 189 | - closedir($dir);  | 
                                                        |
| 189 | + closedir($dir);  | 
                                                        |
| 190 | 190 | }  | 
                                                        
| 191 | 191 | else  | 
                                                        
| 192 | - $this->assertFalse(TRUE);  | 
                                                        |
| 192 | + $this->assertFalse(TRUE);  | 
                                                        |
| 193 | 193 | |
| 194 | - return $output;  | 
                                                        |
| 195 | - }  | 
                                                        |
| 194 | + return $output;  | 
                                                        |
| 195 | + }  | 
                                                        |
| 196 | 196 | |
| 197 | - public function getFilesList()  | 
                                                        |
| 198 | -    { | 
                                                        |
| 197 | + public function getFilesList()  | 
                                                        |
| 198 | +	{ | 
                                                        |
| 199 | 199 |  	return $this->getDirFilesList('data'); | 
                                                        
| 200 | - }  | 
                                                        |
| 200 | + }  | 
                                                        |
| 201 | 201 | |
| 202 | - public function getSchemaFilesList()  | 
                                                        |
| 203 | -    { | 
                                                        |
| 202 | + public function getSchemaFilesList()  | 
                                                        |
| 203 | +	{ | 
                                                        |
| 204 | 204 |  	return $this->getDirFilesList('data/schema'); | 
                                                        
| 205 | - }  | 
                                                        |
| 205 | + }  | 
                                                        |
| 206 | 206 | |
| 207 | - public function getSchemaWarningFilesList()  | 
                                                        |
| 208 | -    { | 
                                                        |
| 207 | + public function getSchemaWarningFilesList()  | 
                                                        |
| 208 | +	{ | 
                                                        |
| 209 | 209 |  	return $this->getDirFilesList('data/schema/warnings'); | 
                                                        
| 210 | - }  | 
                                                        |
| 210 | + }  | 
                                                        |
| 211 | 211 | |
| 212 | - /**  | 
                                                        |
| 213 | - * @dataProvider getSchemaFilesList  | 
                                                        |
| 214 | - */  | 
                                                        |
| 215 | - public function testInvalidXMLSchemaFiles($filename)  | 
                                                        |
| 216 | -    { | 
                                                        |
| 212 | + /**  | 
                                                        |
| 213 | + * @dataProvider getSchemaFilesList  | 
                                                        |
| 214 | + */  | 
                                                        |
| 215 | + public function testInvalidXMLSchemaFiles($filename)  | 
                                                        |
| 216 | +	{ | 
                                                        |
| 217 | 217 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS, '--schema-language');  | 
                                                        
| 218 | - }  | 
                                                        |
| 218 | + }  | 
                                                        |
| 219 | 219 | |
| 220 | - /**  | 
                                                        |
| 221 | - * @dataProvider getSchemaWarningFilesList  | 
                                                        |
| 222 | - */  | 
                                                        |
| 223 | - public function testWarningXMLSchemaFiles($filename)  | 
                                                        |
| 224 | -    { | 
                                                        |
| 220 | + /**  | 
                                                        |
| 221 | + * @dataProvider getSchemaWarningFilesList  | 
                                                        |
| 222 | + */  | 
                                                        |
| 223 | + public function testWarningXMLSchemaFiles($filename)  | 
                                                        |
| 224 | +	{ | 
                                                        |
| 225 | 225 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_SUCCESS, '--schema-language');  | 
                                                        
| 226 | - }  | 
                                                        |
| 226 | + }  | 
                                                        |
| 227 | 227 | }  | 
                                                        
| 228 | 228 | |
@@ -1,8 +1,9 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */  | 
                                                        
| 3 | 3 | |
| 4 | -if (!defined('__DIR__')) | 
                                                        |
| 5 | -    define('__DIR__', realpath(dirname(__FILE__)));  | 
                                                        |
| 4 | +if (!defined('__DIR__')) { | 
                                                        |
| 5 | +    define('__DIR__', realpath(dirname(__FILE__))); | 
                                                        |
| 6 | +}  | 
                                                        |
| 6 | 7 | |
| 7 | 8 | /** The tests here are meant only for the built-in checks in validator.php,  | 
                                                        
| 8 | 9 | and not for the entire syntax expressed by the .xsd files. */  | 
                                                        
@@ -69,8 +70,8 @@ discard block  | 
                                                    ||
| 69 | 70 | $cmd = $this->validator_cmd;  | 
                                                        
| 70 | 71 | $xml_files = array();  | 
                                                        
| 71 | 72 | |
| 72 | - foreach ($released_files as $released_file_mask)  | 
                                                        |
| 73 | - $xml_files =  | 
                                                        |
| 73 | +	foreach ($released_files as $released_file_mask) { | 
                                                        |
| 74 | + $xml_files =  | 
                                                        |
| 74 | 75 | array_merge  | 
                                                        
| 75 | 76 | (  | 
                                                        
| 76 | 77 | $xml_files,  | 
                                                        
@@ -81,14 +82,16 @@ discard block  | 
                                                    ||
| 81 | 82 | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR  | 
                                                        
| 82 | 83 | )  | 
                                                        
| 83 | 84 | );  | 
                                                        
| 85 | + }  | 
                                                        |
| 84 | 86 | |
| 85 | 87 | while ($cnt < count($xml_files))  | 
                                                        
| 86 | 88 |  	{ | 
                                                        
| 87 | 89 | $cmd = $this->validator_cmd . $validator_args;  | 
                                                        
| 88 | 90 | |
| 89 | 91 | // Validate 50 files at once  | 
                                                        
| 90 | - foreach (array_slice($xml_files, $cnt, 50) as $xml_file)  | 
                                                        |
| 91 | - $cmd .= " " . escapeshellarg($xml_file);  | 
                                                        |
| 92 | +	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file) { | 
                                                        |
| 93 | + $cmd .= " " . escapeshellarg($xml_file);  | 
                                                        |
| 94 | + }  | 
                                                        |
| 92 | 95 | |
| 93 | 96 | exec($cmd . ' 2>&1', $validator_output, $return_code);  | 
                                                        
| 94 | 97 | |
@@ -180,16 +183,17 @@ discard block  | 
                                                    ||
| 180 | 183 |  	    { | 
                                                        
| 181 | 184 | $fname = __DIR__ . '/' . $dir_name .'/' . $entry;  | 
                                                        
| 182 | 185 | |
| 183 | - if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')  | 
                                                        |
| 184 | - $output[] = array($fname);  | 
                                                        |
| 186 | +		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') { | 
                                                        |
| 187 | + $output[] = array($fname);  | 
                                                        |
| 188 | + }  | 
                                                        |
| 185 | 189 | |
| 186 | 190 | $entry = readdir($dir);  | 
                                                        
| 187 | 191 | }  | 
                                                        
| 188 | 192 | |
| 189 | 193 | closedir($dir);  | 
                                                        
| 194 | +	} else { | 
                                                        |
| 195 | + $this->assertFalse(TRUE);  | 
                                                        |
| 190 | 196 | }  | 
                                                        
| 191 | - else  | 
                                                        |
| 192 | - $this->assertFalse(TRUE);  | 
                                                        |
| 193 | 197 | |
| 194 | 198 | return $output;  | 
                                                        
| 195 | 199 | }  | 
                                                        
@@ -173,7 +173,7 @@ discard block  | 
                                                    ||
| 173 | 173 | @return  | 
                                                        
| 174 | 174 | @param $xml_file  | 
                                                        
| 175 | 175 | @param $node  | 
                                                        
| 176 | - @param $child_tag  | 
                                                        |
| 176 | + @param string $child_tag  | 
                                                        |
| 177 | 177 | */  | 
                                                        
| 178 | 178 | function checkDuplicateDescendants($xml_file, $node, $child_tag)  | 
                                                        
| 179 | 179 |  { | 
                                                        
@@ -199,13 +199,13 @@ discard block  | 
                                                    ||
| 199 | 199 | messages.  | 
                                                        
| 200 | 200 | @param $node  | 
                                                        
| 201 | 201 | The XML node with the children to be checked.  | 
                                                        
| 202 | - @param $child_tags  | 
                                                        |
| 202 | + @param string[] $child_tags  | 
                                                        |
| 203 | 203 | Array with tag names for the children elements  | 
                                                        
| 204 | - @param $attr_tags  | 
                                                        |
| 204 | + @param string[] $attr_tags  | 
                                                        |
| 205 | 205 | Array with names of attributes to be checked. If multiple attributes  | 
                                                        
| 206 | 206 | are given, than the first one that is present on a child is included  | 
                                                        
| 207 | 207 | in the check.  | 
                                                        
| 208 | - @param $key  | 
                                                        |
| 208 | + @param boolean $key  | 
                                                        |
| 209 | 209 | True if child elements are required to expose at least one of the  | 
                                                        
| 210 | 210 | attribute. False if only the child nodes with some of the  | 
                                                        
| 211 | 211 | attributes present are to be checked.  | 
                                                        
@@ -489,7 +489,7 @@ discard block  | 
                                                    ||
| 489 | 489 | @return  | 
                                                        
| 490 | 490 | @param $xml_file  | 
                                                        
| 491 | 491 | @param $container_element  | 
                                                        
| 492 | - @param $child_tag  | 
                                                        |
| 492 | + @param string $child_tag  | 
                                                        |
| 493 | 493 | */  | 
                                                        
| 494 | 494 | function checkVarContentsValidation  | 
                                                        
| 495 | 495 | (  | 
                                                        
@@ -90,7 +90,7 @@ discard block  | 
                                                    ||
| 90 | 90 | @param $line_no  | 
                                                        
| 91 | 91 | @param $message  | 
                                                        
| 92 | 92 | @access  | 
                                                        
| 93 | - */  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | 94 | public function __construct($file, $line_no, $message)  | 
                                                        
| 95 | 95 |  	{ | 
                                                        
| 96 | 96 |  		parent::__construct("{$file}({$line_no}):\n\t$message"); | 
                                                        
@@ -112,7 +112,7 @@ discard block  | 
                                                    ||
| 112 | 112 | @developer  | 
                                                        
| 113 | 113 | @return  | 
                                                        
| 114 | 114 | @access  | 
                                                        
| 115 | - */  | 
                                                        |
| 115 | + */  | 
                                                        |
| 116 | 116 | public function __destruct()  | 
                                                        
| 117 | 117 |  	{ | 
                                                        
| 118 | 118 | libxml_clear_errors();  | 
                                                        
@@ -834,8 +834,7 @@ discard block  | 
                                                    ||
| 834 | 834 | |
| 835 | 835 | @brief  | 
                                                        
| 836 | 836 | @developer  | 
                                                        
| 837 | -  | 
                                                        |
| 838 | - */  | 
                                                        |
| 837 | + */  | 
                                                        |
| 839 | 838 | class RestoreWorkDir  | 
                                                        
| 840 | 839 |  	{ | 
                                                        
| 841 | 840 | protected $dirname;  | 
                                                        
@@ -845,7 +844,7 @@ discard block  | 
                                                    ||
| 845 | 844 | @developer  | 
                                                        
| 846 | 845 | @return  | 
                                                        
| 847 | 846 | @access  | 
                                                        
| 848 | - */  | 
                                                        |
| 847 | + */  | 
                                                        |
| 849 | 848 | public function __destruct()  | 
                                                        
| 850 | 849 |  		{ | 
                                                        
| 851 | 850 | try  | 
                                                        
@@ -868,7 +867,7 @@ discard block  | 
                                                    ||
| 868 | 867 | @developer  | 
                                                        
| 869 | 868 | @return  | 
                                                        
| 870 | 869 | @access  | 
                                                        
| 871 | - */  | 
                                                        |
| 870 | + */  | 
                                                        |
| 872 | 871 | public function __construct()  | 
                                                        
| 873 | 872 |  		{ | 
                                                        
| 874 | 873 | $this->dirname = getcwd();  | 
                                                        
@@ -1113,7 +1112,7 @@ discard block  | 
                                                    ||
| 1113 | 1112 | @return  | 
                                                        
| 1114 | 1113 | @access  | 
                                                        
| 1115 | 1114 | @param $val  | 
                                                        
| 1116 | - */  | 
                                                        |
| 1115 | + */  | 
                                                        |
| 1117 | 1116 | public function code($val = -1)  | 
                                                        
| 1118 | 1117 |  	{ | 
                                                        
| 1119 | 1118 | if($val == -1)  | 
                                                        
@@ -1135,7 +1134,7 @@ discard block  | 
                                                    ||
| 1135 | 1134 | @return  | 
                                                        
| 1136 | 1135 | @access  | 
                                                        
| 1137 | 1136 | @param $val  | 
                                                        
| 1138 | - */  | 
                                                        |
| 1137 | + */  | 
                                                        |
| 1139 | 1138 | public function push($val)  | 
                                                        
| 1140 | 1139 |  	{ | 
                                                        
| 1141 | 1140 | $this->save = $this->exit_code;  | 
                                                        
@@ -1147,7 +1146,7 @@ discard block  | 
                                                    ||
| 1147 | 1146 | @developer  | 
                                                        
| 1148 | 1147 | @access  | 
                                                        
| 1149 | 1148 | @return  | 
                                                        
| 1150 | - */  | 
                                                        |
| 1149 | + */  | 
                                                        |
| 1151 | 1150 | public function pop()  | 
                                                        
| 1152 | 1151 |  	{ | 
                                                        
| 1153 | 1152 | $this->exit_code = $this->save;  | 
                                                        
@@ -1160,7 +1159,7 @@ discard block  | 
                                                    ||
| 1160 | 1159 | @return  | 
                                                        
| 1161 | 1160 | @access  | 
                                                        
| 1162 | 1161 | @param $val  | 
                                                        
| 1163 | - */  | 
                                                        |
| 1162 | + */  | 
                                                        |
| 1164 | 1163 | public function __construct($val = 0)  | 
                                                        
| 1165 | 1164 |  	{ | 
                                                        
| 1166 | 1165 | $this->save = self::RETCODE_VALIDATOR_INTERNAL;  | 
                                                        
@@ -1181,7 +1180,7 @@ discard block  | 
                                                    ||
| 1181 | 1180 | @developer  | 
                                                        
| 1182 | 1181 | @access  | 
                                                        
| 1183 | 1182 | @return  | 
                                                        
| 1184 | - */  | 
                                                        |
| 1183 | + */  | 
                                                        |
| 1185 | 1184 | public function __destruct()  | 
                                                        
| 1186 | 1185 |  	{ | 
                                                        
| 1187 | 1186 | if($this->file_name)  | 
                                                        
@@ -1196,7 +1195,7 @@ discard block  | 
                                                    ||
| 1196 | 1195 | @access  | 
                                                        
| 1197 | 1196 | @return  | 
                                                        
| 1198 | 1197 | @param $file_name  | 
                                                        
| 1199 | - */  | 
                                                        |
| 1198 | + */  | 
                                                        |
| 1200 | 1199 | public function __construct($file_name)  | 
                                                        
| 1201 | 1200 |  	{ | 
                                                        
| 1202 | 1201 | $this->file_name = $file_name;  | 
                                                        
@@ -1439,7 +1438,7 @@ discard block  | 
                                                    ||
| 1439 | 1438 | |
| 1440 | 1439 | @brief  | 
                                                        
| 1441 | 1440 | @developer  | 
                                                        
| 1442 | - */  | 
                                                        |
| 1441 | + */  | 
                                                        |
| 1443 | 1442 | class Context  | 
                                                        
| 1444 | 1443 |  		{ | 
                                                        
| 1445 | 1444 | protected static $db_info = NULL;  | 
                                                        
@@ -1449,7 +1448,7 @@ discard block  | 
                                                    ||
| 1449 | 1448 | @developer  | 
                                                        
| 1450 | 1449 | @return  | 
                                                        
| 1451 | 1450 | @access  | 
                                                        
| 1452 | - */  | 
                                                        |
| 1451 | + */  | 
                                                        |
| 1453 | 1452 | public static function isInstalled()  | 
                                                        
| 1454 | 1453 |  			{ | 
                                                        
| 1455 | 1454 | return TRUE;  | 
                                                        
@@ -1460,7 +1459,7 @@ discard block  | 
                                                    ||
| 1460 | 1459 | @developer  | 
                                                        
| 1461 | 1460 | @return  | 
                                                        
| 1462 | 1461 | @access  | 
                                                        
| 1463 | - */  | 
                                                        |
| 1462 | + */  | 
                                                        |
| 1464 | 1463 | public static function getLangType()  | 
                                                        
| 1465 | 1464 |  			{ | 
                                                        
| 1466 | 1465 | return 'en';  | 
                                                        
@@ -1471,7 +1470,7 @@ discard block  | 
                                                    ||
| 1471 | 1470 | @developer  | 
                                                        
| 1472 | 1471 | @return  | 
                                                        
| 1473 | 1472 | @access  | 
                                                        
| 1474 | - */  | 
                                                        |
| 1473 | + */  | 
                                                        |
| 1475 | 1474 | public static function getLang()  | 
                                                        
| 1476 | 1475 |  			{ | 
                                                        
| 1477 | 1476 | return 'en';  | 
                                                        
@@ -1482,7 +1481,7 @@ discard block  | 
                                                    ||
| 1482 | 1481 | @developer  | 
                                                        
| 1483 | 1482 | @return  | 
                                                        
| 1484 | 1483 | @access  | 
                                                        
| 1485 | - */  | 
                                                        |
| 1484 | + */  | 
                                                        |
| 1486 | 1485 | public static function getDBType()  | 
                                                        
| 1487 | 1486 |  			{ | 
                                                        
| 1488 | 1487 | if(self::$db_info)  | 
                                                        
@@ -1501,7 +1500,7 @@ discard block  | 
                                                    ||
| 1501 | 1500 | @return  | 
                                                        
| 1502 | 1501 | @access  | 
                                                        
| 1503 | 1502 | @param $db_info  | 
                                                        
| 1504 | - */  | 
                                                        |
| 1503 | + */  | 
                                                        |
| 1505 | 1504 | public static function setDBInfo($db_info)  | 
                                                        
| 1506 | 1505 |  			{ | 
                                                        
| 1507 | 1506 | self::$db_info = $db_info;  | 
                                                        
@@ -1512,7 +1511,7 @@ discard block  | 
                                                    ||
| 1512 | 1511 | @developer  | 
                                                        
| 1513 | 1512 | @return  | 
                                                        
| 1514 | 1513 | @access  | 
                                                        
| 1515 | - */  | 
                                                        |
| 1514 | + */  | 
                                                        |
| 1516 | 1515 | public static function getDBInfo()  | 
                                                        
| 1517 | 1516 |  			{ | 
                                                        
| 1518 | 1517 | return self::$db_info;  | 
                                                        
@@ -1524,7 +1523,7 @@ discard block  | 
                                                    ||
| 1524 | 1523 | @return  | 
                                                        
| 1525 | 1524 | @access  | 
                                                        
| 1526 | 1525 | @param $str  | 
                                                        
| 1527 | - */  | 
                                                        |
| 1526 | + */  | 
                                                        |
| 1528 | 1527 | public static function convertEncodingStr($str)  | 
                                                        
| 1529 | 1528 |  			{ | 
                                                        
| 1530 | 1529 | return $str;  | 
                                                        
@@ -1535,7 +1534,7 @@ discard block  | 
                                                    ||
| 1535 | 1534 | @developer  | 
                                                        
| 1536 | 1535 | @return  | 
                                                        
| 1537 | 1536 | @access  | 
                                                        
| 1538 | - */  | 
                                                        |
| 1537 | + */  | 
                                                        |
| 1539 | 1538 | public static function setNoDBInfo()  | 
                                                        
| 1540 | 1539 |  			{ | 
                                                        
| 1541 | 1540 | $db_info = (object)NULL;  | 
                                                        
@@ -1562,7 +1561,7 @@ discard block  | 
                                                    ||
| 1562 | 1561 | @developer  | 
                                                        
| 1563 | 1562 | @access  | 
                                                        
| 1564 | 1563 | @return  | 
                                                        
| 1565 | - */  | 
                                                        |
| 1564 | + */  | 
                                                        |
| 1566 | 1565 | public static function setMysqlDBInfo()  | 
                                                        
| 1567 | 1566 |  			{ | 
                                                        
| 1568 | 1567 | $db_info = (object)NULL;  | 
                                                        
@@ -1604,7 +1603,7 @@ discard block  | 
                                                    ||
| 1604 | 1603 | @developer  | 
                                                        
| 1605 | 1604 | @return  | 
                                                        
| 1606 | 1605 | @access  | 
                                                        
| 1607 | - */  | 
                                                        |
| 1606 | + */  | 
                                                        |
| 1608 | 1607 | public static function setMysqliDBInfo()  | 
                                                        
| 1609 | 1608 |  			{ | 
                                                        
| 1610 | 1609 | $db_info = (object)NULL;  | 
                                                        
@@ -1646,7 +1645,7 @@ discard block  | 
                                                    ||
| 1646 | 1645 | @developer  | 
                                                        
| 1647 | 1646 | @return  | 
                                                        
| 1648 | 1647 | @access  | 
                                                        
| 1649 | - */  | 
                                                        |
| 1648 | + */  | 
                                                        |
| 1650 | 1649 | public static function setCubridDBInfo()  | 
                                                        
| 1651 | 1650 |  			{ | 
                                                        
| 1652 | 1651 | $db_info = (object)NULL;  | 
                                                        
@@ -1688,7 +1687,7 @@ discard block  | 
                                                    ||
| 1688 | 1687 | @developer  | 
                                                        
| 1689 | 1688 | @return  | 
                                                        
| 1690 | 1689 | @access  | 
                                                        
| 1691 | - */  | 
                                                        |
| 1690 | + */  | 
                                                        |
| 1692 | 1691 | public static function setMssqlDBInfo()  | 
                                                        
| 1693 | 1692 |  			{ | 
                                                        
| 1694 | 1693 | $db_info = (object)NULL;  | 
                                                        
@@ -1729,7 +1728,7 @@ discard block  | 
                                                    ||
| 1729 | 1728 | /**  | 
                                                        
| 1730 | 1729 | @brief  | 
                                                        
| 1731 | 1730 | @developer  | 
                                                        
| 1732 | - */  | 
                                                        |
| 1731 | + */  | 
                                                        |
| 1733 | 1732 | class Any_prop_obj_base  | 
                                                        
| 1734 | 1733 |  		{ | 
                                                        
| 1735 | 1734 | /**  | 
                                                        
@@ -1738,7 +1737,7 @@ discard block  | 
                                                    ||
| 1738 | 1737 | @return  | 
                                                        
| 1739 | 1738 | @param $property  | 
                                                        
| 1740 | 1739 | @access  | 
                                                        
| 1741 | - */  | 
                                                        |
| 1740 | + */  | 
                                                        |
| 1742 | 1741 | public function __get($property)  | 
                                                        
| 1743 | 1742 |  			{ | 
                                                        
| 1744 | 1743 | return NULL;  | 
                                                        
@@ -1748,7 +1747,7 @@ discard block  | 
                                                    ||
| 1748 | 1747 | /**  | 
                                                        
| 1749 | 1748 | @brief  | 
                                                        
| 1750 | 1749 | @developer  | 
                                                        
| 1751 | - */  | 
                                                        |
| 1750 | + */  | 
                                                        |
| 1752 | 1751 | class LangArgFilterErrorMessage  | 
                                                        
| 1753 | 1752 |  		{ | 
                                                        
| 1754 | 1753 | /**  | 
                                                        
@@ -1757,7 +1756,7 @@ discard block  | 
                                                    ||
| 1757 | 1756 | @return  | 
                                                        
| 1758 | 1757 | @param $property  | 
                                                        
| 1759 | 1758 | @access  | 
                                                        
| 1760 | - */  | 
                                                        |
| 1759 | + */  | 
                                                        |
| 1761 | 1760 | public function __get($property)  | 
                                                        
| 1762 | 1761 |  			{ | 
                                                        
| 1763 | 1762 | return 'Argument filter error';  | 
                                                        
@@ -95,7 +95,7 @@ discard block  | 
                                                    ||
| 95 | 95 |  	{ | 
                                                        
| 96 | 96 |  		parent::__construct("{$file}({$line_no}):\n\t$message"); | 
                                                        
| 97 | 97 | |
| 98 | - $this->xml_file = $file;  | 
                                                        |
| 98 | + $this->xml_file = $file;  | 
                                                        |
| 99 | 99 | $this->xml_line_no = $line_no;  | 
                                                        
| 100 | 100 | $this->xml_message = $message;  | 
                                                        
| 101 | 101 | }  | 
                                                        
@@ -133,32 +133,32 @@ discard block  | 
                                                    ||
| 133 | 133 | |
| 134 | 134 | $libXmlErrors = libxml_get_errors();  | 
                                                        
| 135 | 135 | |
| 136 | - if(count($libXmlErrors))  | 
                                                        |
| 136 | + if (count($libXmlErrors))  | 
                                                        |
| 137 | 137 |  	{ | 
                                                        
| 138 | - if(!$filename)  | 
                                                        |
| 138 | + if (!$filename)  | 
                                                        |
| 139 | 139 |  		{ | 
                                                        
| 140 | 140 | $filename = $libXmlErrors[0]->file;  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | 143 | $msg = '';  | 
                                                        
| 144 | 144 | |
| 145 | - foreach($libXmlErrors as $libXmlError)  | 
                                                        |
| 145 | + foreach ($libXmlErrors as $libXmlError)  | 
                                                        |
| 146 | 146 |  		{ | 
                                                        
| 147 | 147 |  			$msg .= "{$libXmlError->file}({$libXmlError->line}):\n\t {$libXmlError->message}"; | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | - if($throw_error)  | 
                                                        |
| 150 | + if ($throw_error)  | 
                                                        |
| 151 | 151 |  		{ | 
                                                        
| 152 | 152 | throw new ErrorMessage($msg);  | 
                                                        
| 153 | 153 | }  | 
                                                        
| 154 | 154 | else  | 
                                                        
| 155 | 155 |  		{ | 
                                                        
| 156 | - fwrite(STDERR, $msg . "\n");  | 
                                                        |
| 156 | + fwrite(STDERR, $msg."\n");  | 
                                                        |
| 157 | 157 | }  | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | 159 | else  | 
                                                        
| 160 | 160 |  	{ | 
                                                        
| 161 | - if($throw_error)  | 
                                                        |
| 161 | + if ($throw_error)  | 
                                                        |
| 162 | 162 |  		{ | 
                                                        
| 163 | 163 |  			throw new ErrorMessage('Schema validation failed.'); | 
                                                        
| 164 | 164 | }  | 
                                                        
@@ -179,7 +179,7 @@ discard block  | 
                                                    ||
| 179 | 179 |  { | 
                                                        
| 180 | 180 | $children = $node->getElementsByTagName($child_tag);  | 
                                                        
| 181 | 181 | |
| 182 | - if($children->length > 1)  | 
                                                        |
| 182 | + if ($children->length > 1)  | 
                                                        |
| 183 | 183 |  	{ | 
                                                        
| 184 | 184 | throw  | 
                                                        
| 185 | 185 | new XmlSchemaError(  | 
                                                        
@@ -217,21 +217,21 @@ discard block  | 
                                                    ||
| 217 | 217 |  { | 
                                                        
| 218 | 218 | $key_values = array();  | 
                                                        
| 219 | 219 | |
| 220 | - foreach($node->childNodes as $child_node)  | 
                                                        |
| 220 | + foreach ($node->childNodes as $child_node)  | 
                                                        |
| 221 | 221 |  	{ | 
                                                        
| 222 | - if($child_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 222 | + if ($child_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 223 | 223 | &&  | 
                                                        
| 224 | 224 | in_array($child_node->tagName, $child_tags))  | 
                                                        
| 225 | 225 |  		{ | 
                                                        
| 226 | 226 | $key_value = NULL;  | 
                                                        
| 227 | 227 | |
| 228 | - foreach($attr_tags as $attr_tag)  | 
                                                        |
| 228 | + foreach ($attr_tags as $attr_tag)  | 
                                                        |
| 229 | 229 |  			{ | 
                                                        
| 230 | - if($child_node->hasAttribute($attr_tag))  | 
                                                        |
| 230 | + if ($child_node->hasAttribute($attr_tag))  | 
                                                        |
| 231 | 231 |  				{ | 
                                                        
| 232 | 232 | $key_value = $child_node->getAttribute($attr_tag);  | 
                                                        
| 233 | 233 | |
| 234 | - if(array_key_exists($key_value, $key_values))  | 
                                                        |
| 234 | + if (array_key_exists($key_value, $key_values))  | 
                                                        |
| 235 | 235 |  					{ | 
                                                        
| 236 | 236 | throw  | 
                                                        
| 237 | 237 | new XmlSchemaError(  | 
                                                        
@@ -246,7 +246,7 @@ discard block  | 
                                                    ||
| 246 | 246 | }  | 
                                                        
| 247 | 247 | }  | 
                                                        
| 248 | 248 | |
| 249 | - if(!$key_value && $key)  | 
                                                        |
| 249 | + if (!$key_value && $key)  | 
                                                        |
| 250 | 250 |  			{ | 
                                                        
| 251 | 251 | throw  | 
                                                        
| 252 | 252 | new XmlSchemaError(  | 
                                                        
@@ -254,7 +254,7 @@ discard block  | 
                                                    ||
| 254 | 254 | $child_node->getLineNo(),  | 
                                                        
| 255 | 255 |  						"<{$child_node->tagName}>: at least one of the following attributes is expected: " | 
                                                        
| 256 | 256 | .  | 
                                                        
| 257 | -						implode(', ', $attr_tags) . '.' | 
                                                        |
| 257 | +						implode(', ', $attr_tags).'.' | 
                                                        |
| 258 | 258 | );  | 
                                                        
| 259 | 259 | }  | 
                                                        
| 260 | 260 | }  | 
                                                        
@@ -282,19 +282,19 @@ discard block  | 
                                                    ||
| 282 | 282 | $table_name = NULL;  | 
                                                        
| 283 | 283 | $join_type = NULL;  | 
                                                        
| 284 | 284 | |
| 285 | -	if($table_element->hasAttribute('name')) | 
                                                        |
| 285 | +	if ($table_element->hasAttribute('name')) | 
                                                        |
| 286 | 286 |  	{ | 
                                                        
| 287 | 287 |  		$table_name = $table_element->getAttribute('name'); | 
                                                        
| 288 | 288 | }  | 
                                                        
| 289 | 289 | |
| 290 | -	if($table_element->hasAttribute('type')) | 
                                                        |
| 290 | +	if ($table_element->hasAttribute('type')) | 
                                                        |
| 291 | 291 |  	{ | 
                                                        
| 292 | 292 |  		$join_type = $table_element->getAttribute('type'); | 
                                                        
| 293 | 293 | }  | 
                                                        
| 294 | 294 | |
| 295 | -	if($table_element->getAttribute('query') == 'true') | 
                                                        |
| 295 | +	if ($table_element->getAttribute('query') == 'true') | 
                                                        |
| 296 | 296 |  	{ | 
                                                        
| 297 | - if($table_name !== NULL)  | 
                                                        |
| 297 | + if ($table_name !== NULL)  | 
                                                        |
| 298 | 298 |  		{ | 
                                                        
| 299 | 299 | throw  | 
                                                        
| 300 | 300 | new XmlSchemaError(  | 
                                                        
@@ -304,7 +304,7 @@ discard block  | 
                                                    ||
| 304 | 304 | );  | 
                                                        
| 305 | 305 | }  | 
                                                        
| 306 | 306 | |
| 307 | - if($join_type !== NULL)  | 
                                                        |
| 307 | + if ($join_type !== NULL)  | 
                                                        |
| 308 | 308 |  		{ | 
                                                        
| 309 | 309 | throw  | 
                                                        
| 310 | 310 | new XmlSchemaError(  | 
                                                        
@@ -322,9 +322,9 @@ discard block  | 
                                                    ||
| 322 | 322 | // check contents for a select list or a table-specification  | 
                                                        
| 323 | 323 | $has_query_clauses = FALSE;  | 
                                                        
| 324 | 324 | |
| 325 | - foreach($table_element->childNodes as $query_clause)  | 
                                                        |
| 325 | + foreach ($table_element->childNodes as $query_clause)  | 
                                                        |
| 326 | 326 |  		{ | 
                                                        
| 327 | - if($query_clause->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 327 | + if ($query_clause->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 328 | 328 | &&  | 
                                                        
| 329 | 329 | (  | 
                                                        
| 330 | 330 | $query_clause->tagName == 'columns'  | 
                                                        
@@ -335,7 +335,7 @@ discard block  | 
                                                    ||
| 335 | 335 | }  | 
                                                        
| 336 | 336 | }  | 
                                                        
| 337 | 337 | |
| 338 | - if(!$has_query_clauses)  | 
                                                        |
| 338 | + if (!$has_query_clauses)  | 
                                                        |
| 339 | 339 |  		{ | 
                                                        
| 340 | 340 | throw  | 
                                                        
| 341 | 341 | new XmlSchemaError(  | 
                                                        
@@ -351,17 +351,17 @@ discard block  | 
                                                    ||
| 351 | 351 |  	{ | 
                                                        
| 352 | 352 | // base table or view  | 
                                                        
| 353 | 353 | |
| 354 | - if($join_type !== NULL)  | 
                                                        |
| 354 | + if ($join_type !== NULL)  | 
                                                        |
| 355 | 355 |  		{ | 
                                                        
| 356 | 356 | $has_conditions_element = FALSE;  | 
                                                        
| 357 | 357 | |
| 358 | - foreach($table_element->childNodes as $child_node)  | 
                                                        |
| 358 | + foreach ($table_element->childNodes as $child_node)  | 
                                                        |
| 359 | 359 |  			{ | 
                                                        
| 360 | - if($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 360 | + if ($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 361 | 361 |  				{ | 
                                                        
| 362 | - if($child_node->tagName == 'conditions')  | 
                                                        |
| 362 | + if ($child_node->tagName == 'conditions')  | 
                                                        |
| 363 | 363 |  					{ | 
                                                        
| 364 | - if($has_conditions_element)  | 
                                                        |
| 364 | + if ($has_conditions_element)  | 
                                                        |
| 365 | 365 |  						{ | 
                                                        
| 366 | 366 | throw  | 
                                                        
| 367 | 367 | new XmlSchemaError(  | 
                                                        
@@ -387,7 +387,7 @@ discard block  | 
                                                    ||
| 387 | 387 | }  | 
                                                        
| 388 | 388 | }  | 
                                                        
| 389 | 389 | |
| 390 | - if(!$has_conditions_element)  | 
                                                        |
| 390 | + if (!$has_conditions_element)  | 
                                                        |
| 391 | 391 |  			{ | 
                                                        
| 392 | 392 | throw  | 
                                                        
| 393 | 393 | new XmlSchemaError(  | 
                                                        
@@ -399,9 +399,9 @@ discard block  | 
                                                    ||
| 399 | 399 | }  | 
                                                        
| 400 | 400 | else  | 
                                                        
| 401 | 401 |  		{ | 
                                                        
| 402 | - foreach($table_element->childNodes as $child_node)  | 
                                                        |
| 402 | + foreach ($table_element->childNodes as $child_node)  | 
                                                        |
| 403 | 403 |  			{ | 
                                                        
| 404 | - if($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 404 | + if ($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 405 | 405 |  				{ | 
                                                        
| 406 | 406 | throw  | 
                                                        
| 407 | 407 | new XmlSchemaError(  | 
                                                        
@@ -429,26 +429,25 @@ discard block  | 
                                                    ||
| 429 | 429 | */  | 
                                                        
| 430 | 430 | function checkTablesClause($xml_file, $tables_element)  | 
                                                        
| 431 | 431 |  { | 
                                                        
| 432 | - checkUniqueKey  | 
                                                        |
| 433 | - (  | 
                                                        |
| 432 | + checkUniqueKey(  | 
                                                        |
| 434 | 433 | $xml_file,  | 
                                                        
| 435 | 434 | $tables_element,  | 
                                                        
| 436 | -			array('table'),				// child elements to be checked | 
                                                        |
| 437 | -			array('alias', 'name'),		// attributes to be checked | 
                                                        |
| 435 | +			array('table'), // child elements to be checked | 
                                                        |
| 436 | +			array('alias', 'name'), // attributes to be checked | 
                                                        |
| 438 | 437 | TRUE // attributes are required  | 
                                                        
| 439 | 438 | );  | 
                                                        
| 440 | 439 | |
| 441 | - foreach($tables_element->childNodes as $table)  | 
                                                        |
| 440 | + foreach ($tables_element->childNodes as $table)  | 
                                                        |
| 442 | 441 |  	{ | 
                                                        
| 443 | - if($table->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 442 | + if ($table->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 444 | 443 | &&  | 
                                                        
| 445 | 444 | $table->tagName == 'table')  | 
                                                        
| 446 | 445 |  		{ | 
                                                        
| 447 | 446 | checkTableExpression($xml_file, $table);  | 
                                                        
| 448 | 447 | |
| 449 | -			if($table->getAttribute('query') == 'true') | 
                                                        |
| 448 | +			if ($table->getAttribute('query') == 'true') | 
                                                        |
| 450 | 449 |  			{ | 
                                                        
| 451 | - validate_select_query($xml_file, $table); // recursive call  | 
                                                        |
| 450 | + validate_select_query($xml_file, $table); // recursive call  | 
                                                        |
| 452 | 451 | }  | 
                                                        
| 453 | 452 | }  | 
                                                        
| 454 | 453 | }  | 
                                                        
@@ -470,12 +469,11 @@ discard block  | 
                                                    ||
| 470 | 469 | */  | 
                                                        
| 471 | 470 | function checkSelectListClause($xml_file, $columns_element)  | 
                                                        
| 472 | 471 |  { | 
                                                        
| 473 | - checkUniqueKey  | 
                                                        |
| 474 | - (  | 
                                                        |
| 472 | + checkUniqueKey(  | 
                                                        |
| 475 | 473 | $xml_file,  | 
                                                        
| 476 | 474 | $columns_element,  | 
                                                        
| 477 | -			array('column', 'query'),	// child elements | 
                                                        |
| 478 | -			array('alias', 'name'),		// attributes | 
                                                        |
| 475 | +			array('column', 'query'), // child elements | 
                                                        |
| 476 | +			array('alias', 'name'), // attributes | 
                                                        |
| 479 | 477 | FALSE // ignore if no attributes present  | 
                                                        
| 480 | 478 | );  | 
                                                        
| 481 | 479 | }  | 
                                                        
@@ -491,8 +489,7 @@ discard block  | 
                                                    ||
| 491 | 489 | @param $container_element  | 
                                                        
| 492 | 490 | @param $child_tag  | 
                                                        
| 493 | 491 | */  | 
                                                        
| 494 | -function checkVarContentsValidation  | 
                                                        |
| 495 | - (  | 
                                                        |
| 492 | +function checkVarContentsValidation(  | 
                                                        |
| 496 | 493 | $xml_file,  | 
                                                        
| 497 | 494 | $container_element,  | 
                                                        
| 498 | 495 | $child_tag  | 
                                                        
@@ -503,23 +500,22 @@ discard block  | 
                                                    ||
| 503 | 500 | |
| 504 | 501 | static  | 
                                                        
| 505 | 502 | $var_attrs =  | 
                                                        
| 506 | - array  | 
                                                        |
| 507 | - (  | 
                                                        |
| 503 | + array(  | 
                                                        |
| 508 | 504 | 'filter', 'notnull', 'minlength',  | 
                                                        
| 509 | 505 | 'maxlength'  | 
                                                        
| 510 | 506 | );  | 
                                                        
| 511 | 507 | |
| 512 | - foreach($container_element->childNodes as $child_node)  | 
                                                        |
| 508 | + foreach ($container_element->childNodes as $child_node)  | 
                                                        |
| 513 | 509 |  	{ | 
                                                        
| 514 | - if($child_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 510 | + if ($child_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 515 | 511 | &&  | 
                                                        
| 516 | 512 | $child_node->tagName == $child_tag)  | 
                                                        
| 517 | 513 |  		{ | 
                                                        
| 518 | - if(!$child_node->hasAttribute($key_attr))  | 
                                                        |
| 514 | + if (!$child_node->hasAttribute($key_attr))  | 
                                                        |
| 519 | 515 |  			{ | 
                                                        
| 520 | - foreach($var_attrs as $var_attr)  | 
                                                        |
| 516 | + foreach ($var_attrs as $var_attr)  | 
                                                        |
| 521 | 517 |  				{ | 
                                                        
| 522 | - if($child_node->hasAttribute($var_attr))  | 
                                                        |
| 518 | + if ($child_node->hasAttribute($var_attr))  | 
                                                        |
| 523 | 519 |  					{ | 
                                                        
| 524 | 520 | throw  | 
                                                        
| 525 | 521 | new XmlSchemaError(  | 
                                                        
@@ -551,9 +547,9 @@ discard block  | 
                                                    ||
| 551 | 547 |  	$has_var_attribute = $condition->hasAttribute('var') || $condition->hasAttribute('default'); | 
                                                        
| 552 | 548 | $query_line_no = -1;  | 
                                                        
| 553 | 549 | |
| 554 | - foreach($condition->childNodes as $query_node)  | 
                                                        |
| 550 | + foreach ($condition->childNodes as $query_node)  | 
                                                        |
| 555 | 551 |  	{ | 
                                                        
| 556 | - if($query_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 552 | + if ($query_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 557 | 553 | &&  | 
                                                        
| 558 | 554 | $query_node->tagName == 'query')  | 
                                                        
| 559 | 555 |  		{ | 
                                                        
@@ -564,7 +560,7 @@ discard block  | 
                                                    ||
| 564 | 560 | }  | 
                                                        
| 565 | 561 | }  | 
                                                        
| 566 | 562 | |
| 567 | - if($child_query_node && $has_var_attribute)  | 
                                                        |
| 563 | + if ($child_query_node && $has_var_attribute)  | 
                                                        |
| 568 | 564 |  	{ | 
                                                        
| 569 | 565 | throw  | 
                                                        
| 570 | 566 | new XmlSchemaError(  | 
                                                        
@@ -574,7 +570,7 @@ discard block  | 
                                                    ||
| 574 | 570 | );  | 
                                                        
| 575 | 571 | }  | 
                                                        
| 576 | 572 | |
| 577 | - if(!($child_query_node || $has_var_attribute))  | 
                                                        |
| 573 | + if (!($child_query_node || $has_var_attribute))  | 
                                                        |
| 578 | 574 |  	{ | 
                                                        
| 579 | 575 | throw  | 
                                                        
| 580 | 576 | new XmlSchemaError(  | 
                                                        
@@ -601,18 +597,18 @@ discard block  | 
                                                    ||
| 601 | 597 |  { | 
                                                        
| 602 | 598 | $first_child = TRUE;  | 
                                                        
| 603 | 599 | |
| 604 | - foreach($conditions->childNodes as $child_node)  | 
                                                        |
| 600 | + foreach ($conditions->childNodes as $child_node)  | 
                                                        |
| 605 | 601 |  	{ | 
                                                        
| 606 | - if($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 602 | + if ($child_node->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 607 | 603 |  		{ | 
                                                        
| 608 | 604 | // check for 'pipe' attribute  | 
                                                        
| 609 | - if($first_child)  | 
                                                        |
| 605 | + if ($first_child)  | 
                                                        |
| 610 | 606 |  			{ | 
                                                        
| 611 | 607 | $first_child = FALSE;  | 
                                                        
| 612 | 608 | }  | 
                                                        
| 613 | 609 | else  | 
                                                        
| 614 | 610 |  			{ | 
                                                        
| 615 | -				if(!$child_node->hasAttribute('pipe')) | 
                                                        |
| 611 | +				if (!$child_node->hasAttribute('pipe')) | 
                                                        |
| 616 | 612 |  				{ | 
                                                        
| 617 | 613 | throw  | 
                                                        
| 618 | 614 | new XmlSchemaError(  | 
                                                        
@@ -626,19 +622,19 @@ discard block  | 
                                                    ||
| 626 | 622 | }  | 
                                                        
| 627 | 623 | |
| 628 | 624 | // recurse in condition groups/queries  | 
                                                        
| 629 | - if($child_node->tagName == 'group')  | 
                                                        |
| 625 | + if ($child_node->tagName == 'group')  | 
                                                        |
| 630 | 626 |  			{ | 
                                                        
| 631 | 627 | checkConditionsGroup($xml_file, $child_node);  | 
                                                        
| 632 | 628 | }  | 
                                                        
| 633 | 629 | else  | 
                                                        
| 634 | 630 |  			{ | 
                                                        
| 635 | - if($child_node->tagName == 'query')  | 
                                                        |
| 631 | + if ($child_node->tagName == 'query')  | 
                                                        |
| 636 | 632 |  				{ | 
                                                        
| 637 | 633 | validate_select_query($xml_file, $child_node);  | 
                                                        
| 638 | 634 | }  | 
                                                        
| 639 | 635 | else  | 
                                                        
| 640 | 636 |  				{ | 
                                                        
| 641 | - if($child_node->tagName == 'condition')  | 
                                                        |
| 637 | + if ($child_node->tagName == 'condition')  | 
                                                        |
| 642 | 638 |  					{ | 
                                                        
| 643 | 639 | checkConditionElement($xml_file, $child_node);  | 
                                                        
| 644 | 640 | }  | 
                                                        
@@ -664,12 +660,11 @@ discard block  | 
                                                    ||
| 664 | 660 | */  | 
                                                        
| 665 | 661 | function checkNavigationClauses($xml_file, $navigation_element)  | 
                                                        
| 666 | 662 |  { | 
                                                        
| 667 | -	foreach(array('list_count', 'page_count', 'page') | 
                                                        |
| 663 | +	foreach (array('list_count', 'page_count', 'page') | 
                                                        |
| 668 | 664 | as  | 
                                                        
| 669 | 665 | $navigation_el)  | 
                                                        
| 670 | 666 |  	{ | 
                                                        
| 671 | - checkDuplicateDescendants  | 
                                                        |
| 672 | - (  | 
                                                        |
| 667 | + checkDuplicateDescendants(  | 
                                                        |
| 673 | 668 | $xml_file,  | 
                                                        
| 674 | 669 | $navigation_element,  | 
                                                        
| 675 | 670 | $navigation_el  | 
                                                        
@@ -693,11 +688,11 @@ discard block  | 
                                                    ||
| 693 | 688 | */  | 
                                                        
| 694 | 689 | function validate_select_query($xml_file, $query_element)  | 
                                                        
| 695 | 690 |  { | 
                                                        
| 696 | - foreach($query_element->childNodes as $select_clause)  | 
                                                        |
| 691 | + foreach ($query_element->childNodes as $select_clause)  | 
                                                        |
| 697 | 692 |  	{ | 
                                                        
| 698 | - if($select_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 693 | + if ($select_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 699 | 694 |  		{ | 
                                                        
| 700 | - switch($select_clause->tagName)  | 
                                                        |
| 695 | + switch ($select_clause->tagName)  | 
                                                        |
| 701 | 696 |  			{ | 
                                                        
| 702 | 697 | case 'columns':  | 
                                                        
| 703 | 698 | checkSelectListClause($xml_file, $select_clause);  | 
                                                        
@@ -728,11 +723,11 @@ discard block  | 
                                                    ||
| 728 | 723 | */  | 
                                                        
| 729 | 724 | function validate_update_query($xml_file, $query_element)  | 
                                                        
| 730 | 725 |  { | 
                                                        
| 731 | - foreach($query_element->childNodes as $update_clause)  | 
                                                        |
| 726 | + foreach ($query_element->childNodes as $update_clause)  | 
                                                        |
| 732 | 727 |  	{ | 
                                                        
| 733 | - if($update_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 728 | + if ($update_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 734 | 729 |  		{ | 
                                                        
| 735 | - switch($update_clause->tagName)  | 
                                                        |
| 730 | + switch ($update_clause->tagName)  | 
                                                        |
| 736 | 731 |  			{ | 
                                                        
| 737 | 732 | case 'tables':  | 
                                                        
| 738 | 733 | checkTablesClause($xml_file, $update_clause);  | 
                                                        
@@ -755,11 +750,11 @@ discard block  | 
                                                    ||
| 755 | 750 | */  | 
                                                        
| 756 | 751 | function validate_delete_query($xml_file, $query_element)  | 
                                                        
| 757 | 752 |  { | 
                                                        
| 758 | - foreach($query_element->childNodes as $delete_clause)  | 
                                                        |
| 753 | + foreach ($query_element->childNodes as $delete_clause)  | 
                                                        |
| 759 | 754 |  	{ | 
                                                        
| 760 | - if($delete_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 755 | + if ($delete_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 761 | 756 |  		{ | 
                                                        
| 762 | - switch($delete_clause->tagName)  | 
                                                        |
| 757 | + switch ($delete_clause->tagName)  | 
                                                        |
| 763 | 758 |  			{ | 
                                                        
| 764 | 759 | case 'conditions':  | 
                                                        
| 765 | 760 | checkConditionsGroup($xml_file, $delete_clause);  | 
                                                        
@@ -778,11 +773,11 @@ discard block  | 
                                                    ||
| 778 | 773 | */  | 
                                                        
| 779 | 774 | function validate_insert_select_query($xml_file, $query_element)  | 
                                                        
| 780 | 775 |  { | 
                                                        
| 781 | - foreach($query_element->childNodes as $statement_clause)  | 
                                                        |
| 776 | + foreach ($query_element->childNodes as $statement_clause)  | 
                                                        |
| 782 | 777 |  	{ | 
                                                        
| 783 | - if($statement_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 778 | + if ($statement_clause->nodeType == XML_ELEMENT_NODE)  | 
                                                        |
| 784 | 779 |  		{ | 
                                                        
| 785 | - switch($statement_clause->tagName)  | 
                                                        |
| 780 | + switch ($statement_clause->tagName)  | 
                                                        |
| 786 | 781 |  			{ | 
                                                        
| 787 | 782 | case 'query':  | 
                                                        
| 788 | 783 | validate_select_query($xml_file, $statement_clause);  | 
                                                        
@@ -793,8 +788,7 @@ discard block  | 
                                                    ||
| 793 | 788 | }  | 
                                                        
| 794 | 789 | |
| 795 | 790 | $validate_query_type =  | 
                                                        
| 796 | - array  | 
                                                        |
| 797 | - (  | 
                                                        |
| 791 | + array(  | 
                                                        |
| 798 | 792 | // 'insert' =>  | 
                                                        
| 799 | 793 | // there is currently nothing special to check  | 
                                                        
| 800 | 794 | // for a plain insert, all the needed checks  | 
                                                        
@@ -818,13 +812,13 @@ discard block  | 
                                                    ||
| 818 | 812 | |
| 819 | 813 |  	$action = $query_element->getAttribute('action'); | 
                                                        
| 820 | 814 | |
| 821 | - if(array_key_exists($action, $validate_query_type))  | 
                                                        |
| 815 | + if (array_key_exists($action, $validate_query_type))  | 
                                                        |
| 822 | 816 |  	{ | 
                                                        
| 823 | 817 | $validate_query_type[$action]($xml_file, $query_element);  | 
                                                        
| 824 | 818 | }  | 
                                                        
| 825 | 819 | }  | 
                                                        
| 826 | 820 | |
| 827 | -if(strpos(PHP_SAPI, 'cli') !== FALSE  | 
                                                        |
| 821 | +if (strpos(PHP_SAPI, 'cli') !== FALSE  | 
                                                        |
| 828 | 822 | ||  | 
                                                        
| 829 | 823 | strpos(PHP_SAPI, 'cgi') !== FALSE)  | 
                                                        
| 830 | 824 |  { | 
                                                        
@@ -857,7 +851,7 @@ discard block  | 
                                                    ||
| 857 | 851 |  				print "Failed to restore working dir {$this->dirname}."; | 
                                                        
| 858 | 852 | }  | 
                                                        
| 859 | 853 | |
| 860 | - if(!$success)  | 
                                                        |
| 854 | + if (!$success)  | 
                                                        |
| 861 | 855 |  			{ | 
                                                        
| 862 | 856 |  				print "Failed to restore working dir {$this->dirname}."; | 
                                                        
| 863 | 857 | }  | 
                                                        
@@ -873,7 +867,7 @@ discard block  | 
                                                    ||
| 873 | 867 |  		{ | 
                                                        
| 874 | 868 | $this->dirname = getcwd();  | 
                                                        
| 875 | 869 | |
| 876 | - if(!$this->dirname)  | 
                                                        |
| 870 | + if (!$this->dirname)  | 
                                                        |
| 877 | 871 |  			{ | 
                                                        
| 878 | 872 |  				throw new ErrorMessage("Failed to get current directory."); | 
                                                        
| 879 | 873 | }  | 
                                                        
@@ -903,7 +897,7 @@ discard block  | 
                                                    ||
| 903 | 897 | $lowercase_name = strtolower($xml_path_info['basename']);  | 
                                                        
| 904 | 898 | $uppercase_name = strtoupper($xml_path_info['basename']);  | 
                                                        
| 905 | 899 | |
| 906 | - if(strlen($lowercase_name) != $filename_len  | 
                                                        |
| 900 | + if (strlen($lowercase_name) != $filename_len  | 
                                                        |
| 907 | 901 | ||  | 
                                                        
| 908 | 902 | strlen($uppercase_name) != $filename_len)  | 
                                                        
| 909 | 903 |  	{ | 
                                                        
@@ -916,9 +910,9 @@ discard block  | 
                                                    ||
| 916 | 910 | |
| 917 | 911 | $varing_case_filename = '';  | 
                                                        
| 918 | 912 | |
| 919 | - for($i = 0; $i < $filename_len; $i++)  | 
                                                        |
| 913 | + for ($i = 0; $i < $filename_len; $i++)  | 
                                                        |
| 920 | 914 |  	{ | 
                                                        
| 921 | - if($lowercase_name[$i] != $uppercase_name[$i])  | 
                                                        |
| 915 | + if ($lowercase_name[$i] != $uppercase_name[$i])  | 
                                                        |
| 922 | 916 |  		{ | 
                                                        
| 923 | 917 |  			$varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]"; | 
                                                        
| 924 | 918 | }  | 
                                                        
@@ -932,13 +926,13 @@ discard block  | 
                                                    ||
| 932 | 926 | |
| 933 | 927 | $restoreWorkDir = new RestoreWorkDir();  | 
                                                        
| 934 | 928 | |
| 935 | - if($glob_pattern)  | 
                                                        |
| 929 | + if ($glob_pattern)  | 
                                                        |
| 936 | 930 |  	{ | 
                                                        
| 937 | 931 | // change current dir to the xml file directory to keep  | 
                                                        
| 938 | 932 | // glob pattern shorter (maximum 260 chars).  | 
                                                        
| 939 | 933 | $success = chdir($glob_pattern);  | 
                                                        
| 940 | 934 | |
| 941 | - if(!$success)  | 
                                                        |
| 935 | + if (!$success)  | 
                                                        |
| 942 | 936 |  		{ | 
                                                        
| 943 | 937 |  			throw new ErrorMessage("Failed to change work dir to {$glob_pattern}."); | 
                                                        
| 944 | 938 | }  | 
                                                        
@@ -950,14 +944,14 @@ discard block  | 
                                                    ||
| 950 | 944 | // realpath() would have the same effect, but it is not documented as such  | 
                                                        
| 951 | 945 | $matched_files = glob($glob_pattern, GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR);  | 
                                                        
| 952 | 946 | |
| 953 | - unset($RestoreWorkDir); // restore work dir after call to glob()  | 
                                                        |
| 947 | + unset($RestoreWorkDir); // restore work dir after call to glob()  | 
                                                        |
| 954 | 948 | |
| 955 | - if($matched_files === FALSE || !is_array($matched_files))  | 
                                                        |
| 949 | + if ($matched_files === FALSE || !is_array($matched_files))  | 
                                                        |
| 956 | 950 |  	{ | 
                                                        
| 957 | 951 |  		throw new ErrorMessage("Directory listing for $xml_file failed."); | 
                                                        
| 958 | 952 | }  | 
                                                        
| 959 | 953 | |
| 960 | - switch(count($matched_files))  | 
                                                        |
| 954 | + switch (count($matched_files))  | 
                                                        |
| 961 | 955 |  	{ | 
                                                        
| 962 | 956 | case 0:  | 
                                                        
| 963 | 957 |  			throw new ErrorMessage("Directory listing for $xml_file failed."); | 
                                                        
@@ -968,9 +962,9 @@ discard block  | 
                                                    ||
| 968 | 962 | default:  | 
                                                        
| 969 | 963 | // more than one files with the same name and different case  | 
                                                        
| 970 | 964 | // case-sensitive file system  | 
                                                        
| 971 | - foreach($mached_files as $matched_file)  | 
                                                        |
| 965 | + foreach ($mached_files as $matched_file)  | 
                                                        |
| 972 | 966 |  			{ | 
                                                        
| 973 | - if(pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename'])  | 
                                                        |
| 967 | + if (pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename'])  | 
                                                        |
| 974 | 968 |  				{ | 
                                                        
| 975 | 969 | return ($xml_path_info['filename'] == $query_id);  | 
                                                        
| 976 | 970 | }  | 
                                                        
@@ -979,7 +973,7 @@ discard block  | 
                                                    ||
| 979 | 973 | |
| 980 | 974 | }  | 
                                                        
| 981 | 975 | |
| 982 | -	throw new ErrorMessage("Internal application error.");  // unreachable | 
                                                        |
| 976 | +	throw new ErrorMessage("Internal application error."); // unreachable | 
                                                        |
| 983 | 977 | }  | 
                                                        
| 984 | 978 | |
| 985 | 979 | /**  | 
                                                        
@@ -1000,9 +994,9 @@ discard block  | 
                                                    ||
| 1000 | 994 | */  | 
                                                        
| 1001 | 995 | function validate_schema_doc($xml_file, $table_element)  | 
                                                        
| 1002 | 996 |  { | 
                                                        
| 1003 | - foreach($table_element->childNodes as $col_node)  | 
                                                        |
| 997 | + foreach ($table_element->childNodes as $col_node)  | 
                                                        |
| 1004 | 998 |  	{ | 
                                                        
| 1005 | - if($col_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 999 | + if ($col_node->nodeType == XML_ELEMENT_NODE  | 
                                                        |
| 1006 | 1000 | &&  | 
                                                        
| 1007 | 1001 | $col_node->tagName == 'column')  | 
                                                        
| 1008 | 1002 |  		{ | 
                                                        
@@ -1010,12 +1004,11 @@ discard block  | 
                                                    ||
| 1010 | 1004 | $col_size = NULL;  | 
                                                        
| 1011 | 1005 | |
| 1012 | 1006 | // check auto-increment column  | 
                                                        
| 1013 | -			if($col_node->hasAttribute('auto_increment')) | 
                                                        |
| 1007 | +			if ($col_node->hasAttribute('auto_increment')) | 
                                                        |
| 1014 | 1008 |  			{ | 
                                                        
| 1015 | - fwrite  | 
                                                        |
| 1016 | - (  | 
                                                        |
| 1009 | + fwrite(  | 
                                                        |
| 1017 | 1010 |  						fopen('php://stdout', 'wt'),  | 
                                                        
| 1018 | -						$xml_file . '(' . $col_node->getLineNo() . ")\n\t" | 
                                                        |
| 1011 | +						$xml_file.'('.$col_node->getLineNo().")\n\t" | 
                                                        |
| 1019 | 1012 | .  | 
                                                        
| 1020 | 1013 | "<column>: attribute 'auto_increment' is currently supported only by SQL Server and mysql backends.\n"  | 
                                                        
| 1021 | 1014 | );  | 
                                                        
@@ -1023,7 +1016,7 @@ discard block  | 
                                                    ||
| 1023 | 1016 | static  | 
                                                        
| 1024 | 1017 |  					$autoinc_types = array('number', 'bignumber'); | 
                                                        
| 1025 | 1018 | |
| 1026 | - if(!in_array($col_type, $autoinc_types))  | 
                                                        |
| 1019 | + if (!in_array($col_type, $autoinc_types))  | 
                                                        |
| 1027 | 1020 |  				{ | 
                                                        
| 1028 | 1021 | throw  | 
                                                        
| 1029 | 1022 | new XmlSchemaError(  | 
                                                        
@@ -1031,30 +1024,29 @@ discard block  | 
                                                    ||
| 1031 | 1024 | $col_node->getLineNo(),  | 
                                                        
| 1032 | 1025 | "<column>: attribute 'auto_increment' only expected for one of the following types: "  | 
                                                        
| 1033 | 1026 | .  | 
                                                        
| 1034 | -							implode(', ', $autoinc_types) . '.' | 
                                                        |
| 1027 | +							implode(', ', $autoinc_types).'.' | 
                                                        |
| 1035 | 1028 | );  | 
                                                        
| 1036 | 1029 | }  | 
                                                        
| 1037 | 1030 | }  | 
                                                        
| 1038 | 1031 | |
| 1039 | 1032 | // check tinytext  | 
                                                        
| 1040 | - if($col_type == 'tinytext')  | 
                                                        |
| 1033 | + if ($col_type == 'tinytext')  | 
                                                        |
| 1041 | 1034 |  			{ | 
                                                        
| 1042 | - fwrite  | 
                                                        |
| 1043 | - (  | 
                                                        |
| 1035 | + fwrite(  | 
                                                        |
| 1044 | 1036 |  						fopen('php://stdout', 'wt'),  | 
                                                        
| 1045 | -						$xml_file . '(' . $col_node->getLineNo() . ")\n\t" | 
                                                        |
| 1037 | +						$xml_file.'('.$col_node->getLineNo().")\n\t" | 
                                                        |
| 1046 | 1038 | .  | 
                                                        
| 1047 | 1039 | "<column>: type \"tinytext\" is supported only by CUBRID.\n"  | 
                                                        
| 1048 | 1040 | );  | 
                                                        
| 1049 | 1041 | }  | 
                                                        
| 1050 | 1042 | |
| 1051 | 1043 | // check size attribute  | 
                                                        
| 1052 | -			if($col_node->hasAttribute('size')) | 
                                                        |
| 1044 | +			if ($col_node->hasAttribute('size')) | 
                                                        |
| 1053 | 1045 |  			{ | 
                                                        
| 1054 | 1046 |  				$col_size = $col_node->getAttribute('size'); | 
                                                        
| 1055 | 1047 | }  | 
                                                        
| 1056 | 1048 | |
| 1057 | - if($col_type == 'varchar' && $col_size === NULL)  | 
                                                        |
| 1049 | + if ($col_type == 'varchar' && $col_size === NULL)  | 
                                                        |
| 1058 | 1050 |  			{ | 
                                                        
| 1059 | 1051 | throw  | 
                                                        
| 1060 | 1052 | new XmlSchemaError(  | 
                                                        
@@ -1068,7 +1060,7 @@ discard block  | 
                                                    ||
| 1068 | 1060 |  				$varsize_types = array('char', 'varchar', 'float'); | 
                                                        
| 1069 | 1061 | |
| 1070 | 1062 | |
| 1071 | - if($col_size !== NULL && !in_array($col_type, $varsize_types))  | 
                                                        |
| 1063 | + if ($col_size !== NULL && !in_array($col_type, $varsize_types))  | 
                                                        |
| 1072 | 1064 |  			{ | 
                                                        
| 1073 | 1065 | throw  | 
                                                        
| 1074 | 1066 | new XmlSchemaError(  | 
                                                        
@@ -1076,7 +1068,7 @@ discard block  | 
                                                    ||
| 1076 | 1068 | $col_node->getLineNo(),  | 
                                                        
| 1077 | 1069 | "<column>: 'size' attribute only expected for the following types: "  | 
                                                        
| 1078 | 1070 | .  | 
                                                        
| 1079 | -							implode(', ', $varsize_types) . "." | 
                                                        |
| 1071 | +							implode(', ', $varsize_types)."." | 
                                                        |
| 1080 | 1072 | );  | 
                                                        
| 1081 | 1073 | }  | 
                                                        
| 1082 | 1074 | }  | 
                                                        
@@ -1102,8 +1094,8 @@ discard block  | 
                                                    ||
| 1102 | 1094 | const RETCODE_GENERIC_XML_SYNTAX = 50;  | 
                                                        
| 1103 | 1095 | const RETCODE_QUERY_ELEMENT = 40;  | 
                                                        
| 1104 | 1096 | const RETCODE_XSD_VALIDATION = 30;  | 
                                                        
| 1105 | - const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 1106 | - const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented.  | 
                                                        |
| 1097 | + const RETCODE_BUILTIN_CHECKS = 20;  | 
                                                        |
| 1098 | + const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented.  | 
                                                        |
| 1107 | 1099 | const RETCODE_SUCCESS = 0;  | 
                                                        
| 1108 | 1100 | |
| 1109 | 1101 | |
@@ -1116,13 +1108,13 @@ discard block  | 
                                                    ||
| 1116 | 1108 | */  | 
                                                        
| 1117 | 1109 | public function code($val = -1)  | 
                                                        
| 1118 | 1110 |  	{ | 
                                                        
| 1119 | - if($val == -1)  | 
                                                        |
| 1111 | + if ($val == -1)  | 
                                                        |
| 1120 | 1112 |  		{ | 
                                                        
| 1121 | 1113 | return $this->exit_code;  | 
                                                        
| 1122 | 1114 | }  | 
                                                        
| 1123 | 1115 | else  | 
                                                        
| 1124 | 1116 |  		{ | 
                                                        
| 1125 | - if($this->exit_code < $val)  | 
                                                        |
| 1117 | + if ($this->exit_code < $val)  | 
                                                        |
| 1126 | 1118 |  			{ | 
                                                        
| 1127 | 1119 | $this->exit_code = $val;  | 
                                                        
| 1128 | 1120 | }  | 
                                                        
@@ -1184,7 +1176,7 @@ discard block  | 
                                                    ||
| 1184 | 1176 | */  | 
                                                        
| 1185 | 1177 | public function __destruct()  | 
                                                        
| 1186 | 1178 |  	{ | 
                                                        
| 1187 | - if($this->file_name)  | 
                                                        |
| 1179 | + if ($this->file_name)  | 
                                                        |
| 1188 | 1180 |  		{ | 
                                                        
| 1189 | 1181 | unlink($this->file_name);  | 
                                                        
| 1190 | 1182 | $this->file_name = NULL;  | 
                                                        
@@ -1214,12 +1206,12 @@ discard block  | 
                                                    ||
| 1214 | 1206 | $cmdname = CMD_NAME;  | 
                                                        
| 1215 | 1207 | |
| 1216 | 1208 | // php manual says resources should not normally be declared constant  | 
                                                        
| 1217 | -	if(!defined('STDERR')) | 
                                                        |
| 1209 | +	if (!defined('STDERR')) | 
                                                        |
| 1218 | 1210 |  	{ | 
                                                        
| 1219 | 1211 |  		define('STDERR', fopen('php://stderr', 'wt')); | 
                                                        
| 1220 | 1212 | }  | 
                                                        
| 1221 | 1213 | |
| 1222 | -	if(!defined('__DIR__')) | 
                                                        |
| 1214 | +	if (!defined('__DIR__')) | 
                                                        |
| 1223 | 1215 |  	{ | 
                                                        
| 1224 | 1216 |  		define('__DIR__', dirname(__FILE__));  | 
                                                        
| 1225 | 1217 | }  | 
                                                        
@@ -1234,7 +1226,7 @@ discard block  | 
                                                    ||
| 1234 | 1226 | $query_args = NULL;  | 
                                                        
| 1235 | 1227 | $query_args_file = NULL;  | 
                                                        
| 1236 | 1228 | |
| 1237 | - while($argc >= 2 && $argv[1][0] == '-')  | 
                                                        |
| 1229 | + while ($argc >= 2 && $argv[1][0] == '-')  | 
                                                        |
| 1238 | 1230 |  	{ | 
                                                        
| 1239 | 1231 | $option = $argv[1];  | 
                                                        
| 1240 | 1232 | |
@@ -1242,17 +1234,17 @@ discard block  | 
                                                    ||
| 1242 | 1234 | $argv = array_values($argv);  | 
                                                        
| 1243 | 1235 | $argc = count($argv);  | 
                                                        
| 1244 | 1236 | |
| 1245 | - switch($option)  | 
                                                        |
| 1237 | + switch ($option)  | 
                                                        |
| 1246 | 1238 |  		{ | 
                                                        
| 1247 | 1239 | case '-s':  | 
                                                        
| 1248 | 1240 | case '--schema':  | 
                                                        
| 1249 | 1241 | case '--schema-language':  | 
                                                        
| 1250 | - if($query_args !== NULL)  | 
                                                        |
| 1242 | + if ($query_args !== NULL)  | 
                                                        |
| 1251 | 1243 |  				{ | 
                                                        
| 1252 | 1244 |  					throw new SyntaxError("Both --args-string and --schema-language options given."); | 
                                                        
| 1253 | 1245 | }  | 
                                                        
| 1254 | 1246 | |
| 1255 | - if($query_args_file !== NULL)  | 
                                                        |
| 1247 | + if ($query_args_file !== NULL)  | 
                                                        |
| 1256 | 1248 |  				{ | 
                                                        
| 1257 | 1249 |  					throw new SyntaxError("Both --args-file and --schema-language options given."); | 
                                                        
| 1258 | 1250 | }  | 
                                                        
@@ -1272,7 +1264,7 @@ discard block  | 
                                                    ||
| 1272 | 1264 | |
| 1273 | 1265 | case '--xe-path':  | 
                                                        
| 1274 | 1266 | case '--xe':  | 
                                                        
| 1275 | - if($argc < 2)  | 
                                                        |
| 1267 | + if ($argc < 2)  | 
                                                        |
| 1276 | 1268 |  				{ | 
                                                        
| 1277 | 1269 | throw  | 
                                                        
| 1278 | 1270 |  						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); | 
                                                        
@@ -1290,17 +1282,17 @@ discard block  | 
                                                    ||
| 1290 | 1282 | case '--args-string':  | 
                                                        
| 1291 | 1283 | case '--arguments':  | 
                                                        
| 1292 | 1284 | case '--args':  | 
                                                        
| 1293 | - if($schema_language !== NULL)  | 
                                                        |
| 1285 | + if ($schema_language !== NULL)  | 
                                                        |
| 1294 | 1286 |  				{ | 
                                                        
| 1295 | 1287 |  					throw new SyntaxError("Both --schema-language and --args-string options given."); | 
                                                        
| 1296 | 1288 | }  | 
                                                        
| 1297 | 1289 | |
| 1298 | - if($query_args_file !== NULL)  | 
                                                        |
| 1290 | + if ($query_args_file !== NULL)  | 
                                                        |
| 1299 | 1291 |  				{ | 
                                                        
| 1300 | 1292 |  					throw new SyntaxError("Both --args-string and --args-file options given."); | 
                                                        
| 1301 | 1293 | }  | 
                                                        
| 1302 | 1294 | |
| 1303 | - if($argc < 2)  | 
                                                        |
| 1295 | + if ($argc < 2)  | 
                                                        |
| 1304 | 1296 |  				{ | 
                                                        
| 1305 | 1297 | throw  | 
                                                        
| 1306 | 1298 |  						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); | 
                                                        
@@ -1316,17 +1308,17 @@ discard block  | 
                                                    ||
| 1316 | 1308 | |
| 1317 | 1309 | case '--arguments-file':  | 
                                                        
| 1318 | 1310 | case '--args-file':  | 
                                                        
| 1319 | - if($schema_language !== NULL)  | 
                                                        |
| 1311 | + if ($schema_language !== NULL)  | 
                                                        |
| 1320 | 1312 |  				{ | 
                                                        
| 1321 | 1313 |  					throw new SyntaxError("Both --schema-language and --args-file options given."); | 
                                                        
| 1322 | 1314 | }  | 
                                                        
| 1323 | 1315 | |
| 1324 | - if($query_args !== NULL)  | 
                                                        |
| 1316 | + if ($query_args !== NULL)  | 
                                                        |
| 1325 | 1317 |  				{ | 
                                                        
| 1326 | 1318 |  					throw new SyntaxError("Both --args-string and --args-file options given."); | 
                                                        
| 1327 | 1319 | }  | 
                                                        
| 1328 | 1320 | |
| 1329 | - if($argc < 2)  | 
                                                        |
| 1321 | + if ($argc < 2)  | 
                                                        |
| 1330 | 1322 |  				{ | 
                                                        
| 1331 | 1323 | throw  | 
                                                        
| 1332 | 1324 |  						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); | 
                                                        
@@ -1357,7 +1349,7 @@ discard block  | 
                                                    ||
| 1357 | 1349 | }  | 
                                                        
| 1358 | 1350 | }  | 
                                                        
| 1359 | 1351 | |
| 1360 | - if($argc < 2 ||  | 
                                                        |
| 1352 | + if ($argc < 2 ||  | 
                                                        |
| 1361 | 1353 | (  | 
                                                        
| 1362 | 1354 | $argc == 2  | 
                                                        
| 1363 | 1355 | &&  | 
                                                        
@@ -1366,48 +1358,48 @@ discard block  | 
                                                    ||
| 1366 | 1358 |  	{ | 
                                                        
| 1367 | 1359 | throw  | 
                                                        
| 1368 | 1360 | new SyntaxError(  | 
                                                        
| 1369 | - "Validates an XML document against a given schema definition (XSD), using the standard php library.\n" .  | 
                                                        |
| 1370 | - "Syntax:\n" .  | 
                                                        |
| 1371 | -				"	{$cmdname} schema.xsd document.xml...\n" . | 
                                                        |
| 1372 | -				"	{$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n" . | 
                                                        |
| 1373 | - "Where:\n" .  | 
                                                        |
| 1374 | - " --schema-language\n" .  | 
                                                        |
| 1375 | - " --schema\n" .  | 
                                                        |
| 1376 | - " -s\n" .  | 
                                                        |
| 1377 | - " If given, the document(s) are validated against XE XML Schema Language,\n" .  | 
                                                        |
| 1378 | - " otherwise document(s) are validated against XE XML Query Language.\n" .  | 
                                                        |
| 1379 | - "\n" .  | 
                                                        |
| 1380 | - " --skip-query-id\n" .  | 
                                                        |
| 1381 | - " Do not check the query id, which should normally match the file name.\n" .  | 
                                                        |
| 1382 | - "\n" .  | 
                                                        |
| 1383 | - " --xe-path\n" .  | 
                                                        |
| 1384 | - " --xe\n" .  | 
                                                        |
| 1385 | - " Path to XE installation. Used to load the database-specific parsers to generate\n" .  | 
                                                        |
| 1386 | - " SQL from the XML language files.\n" .  | 
                                                        |
| 1387 | - "\n" .  | 
                                                        |
| 1388 | - " --validate-only\n" .  | 
                                                        |
| 1389 | - " Only check XML schemas, no SQL generated with the database-specific parsers.\n" .  | 
                                                        |
| 1390 | - "\n" .  | 
                                                        |
| 1391 | - " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n" .  | 
                                                        |
| 1392 | - " --args-file args/file/name.php\n" .  | 
                                                        |
| 1393 | - " Variables and values for the query, if it has any (only for XML Query Language).\n" .  | 
                                                        |
| 1394 | - " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n" .  | 
                                                        |
| 1395 | - " array constructor. The validator script will directly eval()/include() this content.\n" .  | 
                                                        |
| 1396 | - " The file named with --args-file should include an array() constructor around the\n" .  | 
                                                        |
| 1397 | - " name-value list, and should immediately return it, without a named array variable.\n" .  | 
                                                        |
| 1398 | - " E.g.:\n" .  | 
                                                        |
| 1399 | - " return \n" .  | 
                                                        |
| 1400 | - " array\n" .  | 
                                                        |
| 1401 | - " (\n" .  | 
                                                        |
| 1402 | - " 'name' => 'val',\n" .  | 
                                                        |
| 1403 | - " 'name' => 'val',\n" .  | 
                                                        |
| 1404 | - " ...\n" .  | 
                                                        |
| 1405 | - " );\n" .  | 
                                                        |
| 1406 | - "\n" .  | 
                                                        |
| 1407 | - " schema.xsd if given, is the file name for the schema definition to validate the\n" .  | 
                                                        |
| 1408 | - " document against\n" .  | 
                                                        |
| 1409 | - "\n" .  | 
                                                        |
| 1410 | - " document.xml is the file name for the XML document to be validated against the schema.\n" .  | 
                                                        |
| 1361 | + "Validates an XML document against a given schema definition (XSD), using the standard php library.\n".  | 
                                                        |
| 1362 | + "Syntax:\n".  | 
                                                        |
| 1363 | +				"	{$cmdname} schema.xsd document.xml...\n". | 
                                                        |
| 1364 | +				"	{$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n". | 
                                                        |
| 1365 | + "Where:\n".  | 
                                                        |
| 1366 | + " --schema-language\n".  | 
                                                        |
| 1367 | + " --schema\n".  | 
                                                        |
| 1368 | + " -s\n".  | 
                                                        |
| 1369 | + " If given, the document(s) are validated against XE XML Schema Language,\n".  | 
                                                        |
| 1370 | + " otherwise document(s) are validated against XE XML Query Language.\n".  | 
                                                        |
| 1371 | + "\n".  | 
                                                        |
| 1372 | + " --skip-query-id\n".  | 
                                                        |
| 1373 | + " Do not check the query id, which should normally match the file name.\n".  | 
                                                        |
| 1374 | + "\n".  | 
                                                        |
| 1375 | + " --xe-path\n".  | 
                                                        |
| 1376 | + " --xe\n".  | 
                                                        |
| 1377 | + " Path to XE installation. Used to load the database-specific parsers to generate\n".  | 
                                                        |
| 1378 | + " SQL from the XML language files.\n".  | 
                                                        |
| 1379 | + "\n".  | 
                                                        |
| 1380 | + " --validate-only\n".  | 
                                                        |
| 1381 | + " Only check XML schemas, no SQL generated with the database-specific parsers.\n".  | 
                                                        |
| 1382 | + "\n".  | 
                                                        |
| 1383 | + " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n".  | 
                                                        |
| 1384 | + " --args-file args/file/name.php\n".  | 
                                                        |
| 1385 | + " Variables and values for the query, if it has any (only for XML Query Language).\n".  | 
                                                        |
| 1386 | + " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n".  | 
                                                        |
| 1387 | + " array constructor. The validator script will directly eval()/include() this content.\n".  | 
                                                        |
| 1388 | + " The file named with --args-file should include an array() constructor around the\n".  | 
                                                        |
| 1389 | + " name-value list, and should immediately return it, without a named array variable.\n".  | 
                                                        |
| 1390 | + " E.g.:\n".  | 
                                                        |
| 1391 | + " return \n".  | 
                                                        |
| 1392 | + " array\n".  | 
                                                        |
| 1393 | + " (\n".  | 
                                                        |
| 1394 | + " 'name' => 'val',\n".  | 
                                                        |
| 1395 | + " 'name' => 'val',\n".  | 
                                                        |
| 1396 | + " ...\n".  | 
                                                        |
| 1397 | + " );\n".  | 
                                                        |
| 1398 | + "\n".  | 
                                                        |
| 1399 | + " schema.xsd if given, is the file name for the schema definition to validate the\n".  | 
                                                        |
| 1400 | + " document against\n".  | 
                                                        |
| 1401 | + "\n".  | 
                                                        |
| 1402 | + " document.xml is the file name for the XML document to be validated against the schema.\n".  | 
                                                        |
| 1411 | 1403 | " Multiple .xml files can be given.\n"  | 
                                                        
| 1412 | 1404 | );  | 
                                                        
| 1413 | 1405 | }  | 
                                                        
@@ -1415,23 +1407,23 @@ discard block  | 
                                                    ||
| 1415 | 1407 | $query_user_args = array();  | 
                                                        
| 1416 | 1408 | |
| 1417 | 1409 | // check $xe_path, $query_args  | 
                                                        
| 1418 | - if(!$validate_only)  | 
                                                        |
| 1410 | + if (!$validate_only)  | 
                                                        |
| 1419 | 1411 |  	{ | 
                                                        
| 1420 | - if($xe_path == NULL)  | 
                                                        |
| 1412 | + if ($xe_path == NULL)  | 
                                                        |
| 1421 | 1413 |  		{ | 
                                                        
| 1422 | 1414 | // assume validator.php is in directory .../xe/tools/dbxml_validator/ in an XE installation  | 
                                                        
| 1423 | 1415 | $xe_path = dirname(dirname(realpath(__DIR__)));  | 
                                                        
| 1424 | 1416 | }  | 
                                                        
| 1425 | 1417 | |
| 1426 | - if(!file_exists($xe_path . '/index.php'))  | 
                                                        |
| 1418 | + if (!file_exists($xe_path.'/index.php'))  | 
                                                        |
| 1427 | 1419 |  		{ | 
                                                        
| 1428 | 1420 | throw  | 
                                                        
| 1429 | 1421 |  				new ErrorMessage("File index.php not found in {$xe_path}."); | 
                                                        
| 1430 | 1422 | }  | 
                                                        
| 1431 | 1423 | |
| 1432 | -		if(!defined('_XE_PATH_')) | 
                                                        |
| 1424 | +		if (!defined('_XE_PATH_')) | 
                                                        |
| 1433 | 1425 |  		{ | 
                                                        
| 1434 | -			define('_XE_PATH_', $xe_path . '/'); | 
                                                        |
| 1426 | +			define('_XE_PATH_', $xe_path.'/'); | 
                                                        |
| 1435 | 1427 | }  | 
                                                        
| 1436 | 1428 | |
| 1437 | 1429 | /**  | 
                                                        
@@ -1485,7 +1477,7 @@ discard block  | 
                                                    ||
| 1485 | 1477 | */  | 
                                                        
| 1486 | 1478 | public static function getDBType()  | 
                                                        
| 1487 | 1479 |  			{ | 
                                                        
| 1488 | - if(self::$db_info)  | 
                                                        |
| 1480 | + if (self::$db_info)  | 
                                                        |
| 1489 | 1481 |  				{ | 
                                                        
| 1490 | 1482 | return self::$db_info->master_db['db_type'];  | 
                                                        
| 1491 | 1483 | }  | 
                                                        
@@ -1538,10 +1530,9 @@ discard block  | 
                                                    ||
| 1538 | 1530 | */  | 
                                                        
| 1539 | 1531 | public static function setNoDBInfo()  | 
                                                        
| 1540 | 1532 |  			{ | 
                                                        
| 1541 | - $db_info = (object)NULL;  | 
                                                        |
| 1533 | + $db_info = (object) NULL;  | 
                                                        |
| 1542 | 1534 | $db_info->master_db =  | 
                                                        
| 1543 | - array  | 
                                                        |
| 1544 | - (  | 
                                                        |
| 1535 | + array(  | 
                                                        |
| 1545 | 1536 | 'db_type' => NULL,  | 
                                                        
| 1546 | 1537 | 'db_hostname' => NULL,  | 
                                                        
| 1547 | 1538 | 'db_port' => NULL,  | 
                                                        
@@ -1565,10 +1556,9 @@ discard block  | 
                                                    ||
| 1565 | 1556 | */  | 
                                                        
| 1566 | 1557 | public static function setMysqlDBInfo()  | 
                                                        
| 1567 | 1558 |  			{ | 
                                                        
| 1568 | - $db_info = (object)NULL;  | 
                                                        |
| 1559 | + $db_info = (object) NULL;  | 
                                                        |
| 1569 | 1560 | $db_info->master_db =  | 
                                                        
| 1570 | - array  | 
                                                        |
| 1571 | - (  | 
                                                        |
| 1561 | + array(  | 
                                                        |
| 1572 | 1562 | 'db_type' => 'mysql',  | 
                                                        
| 1573 | 1563 | 'db_hostname' => NULL,  | 
                                                        
| 1574 | 1564 | 'db_port' => NULL,  | 
                                                        
@@ -1584,7 +1574,7 @@ discard block  | 
                                                    ||
| 1584 | 1574 | |
| 1585 | 1575 | self::setDBInfo($db_info);  | 
                                                        
| 1586 | 1576 | |
| 1587 | -				if(array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1577 | +				if (array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1588 | 1578 | &&  | 
                                                        
| 1589 | 1579 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1590 | 1580 |  				{ | 
                                                        
@@ -1607,10 +1597,9 @@ discard block  | 
                                                    ||
| 1607 | 1597 | */  | 
                                                        
| 1608 | 1598 | public static function setMysqliDBInfo()  | 
                                                        
| 1609 | 1599 |  			{ | 
                                                        
| 1610 | - $db_info = (object)NULL;  | 
                                                        |
| 1600 | + $db_info = (object) NULL;  | 
                                                        |
| 1611 | 1601 | $db_info->master_db =  | 
                                                        
| 1612 | - array  | 
                                                        |
| 1613 | - (  | 
                                                        |
| 1602 | + array(  | 
                                                        |
| 1614 | 1603 | 'db_type' => 'mysqli',  | 
                                                        
| 1615 | 1604 | 'db_hostname' => NULL,  | 
                                                        
| 1616 | 1605 | 'db_port' => NULL,  | 
                                                        
@@ -1626,7 +1615,7 @@ discard block  | 
                                                    ||
| 1626 | 1615 | |
| 1627 | 1616 | self::setDBInfo($db_info);  | 
                                                        
| 1628 | 1617 | |
| 1629 | -				if(array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1618 | +				if (array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1630 | 1619 | &&  | 
                                                        
| 1631 | 1620 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1632 | 1621 |  				{ | 
                                                        
@@ -1649,10 +1638,9 @@ discard block  | 
                                                    ||
| 1649 | 1638 | */  | 
                                                        
| 1650 | 1639 | public static function setCubridDBInfo()  | 
                                                        
| 1651 | 1640 |  			{ | 
                                                        
| 1652 | - $db_info = (object)NULL;  | 
                                                        |
| 1641 | + $db_info = (object) NULL;  | 
                                                        |
| 1653 | 1642 | $db_info->master_db =  | 
                                                        
| 1654 | - array  | 
                                                        |
| 1655 | - (  | 
                                                        |
| 1643 | + array(  | 
                                                        |
| 1656 | 1644 | 'db_type' => 'cubrid',  | 
                                                        
| 1657 | 1645 | 'db_hostname' => NULL,  | 
                                                        
| 1658 | 1646 | 'db_port' => NULL,  | 
                                                        
@@ -1668,7 +1656,7 @@ discard block  | 
                                                    ||
| 1668 | 1656 | |
| 1669 | 1657 | self::setDBInfo($db_info);  | 
                                                        
| 1670 | 1658 | |
| 1671 | -				if(array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1659 | +				if (array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1672 | 1660 | &&  | 
                                                        
| 1673 | 1661 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1674 | 1662 |  				{ | 
                                                        
@@ -1691,10 +1679,9 @@ discard block  | 
                                                    ||
| 1691 | 1679 | */  | 
                                                        
| 1692 | 1680 | public static function setMssqlDBInfo()  | 
                                                        
| 1693 | 1681 |  			{ | 
                                                        
| 1694 | - $db_info = (object)NULL;  | 
                                                        |
| 1682 | + $db_info = (object) NULL;  | 
                                                        |
| 1695 | 1683 | $db_info->master_db =  | 
                                                        
| 1696 | - array  | 
                                                        |
| 1697 | - (  | 
                                                        |
| 1684 | + array(  | 
                                                        |
| 1698 | 1685 | 'db_type' => 'mssql',  | 
                                                        
| 1699 | 1686 | 'db_hostname' => NULL,  | 
                                                        
| 1700 | 1687 | 'db_port' => NULL,  | 
                                                        
@@ -1710,7 +1697,7 @@ discard block  | 
                                                    ||
| 1710 | 1697 | |
| 1711 | 1698 | self::setDBInfo($db_info);  | 
                                                        
| 1712 | 1699 | |
| 1713 | -				if(array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1700 | +				if (array_key_exists('__DB__', $GLOBALS) | 
                                                        |
| 1714 | 1701 | &&  | 
                                                        
| 1715 | 1702 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1716 | 1703 |  				{ | 
                                                        
@@ -1765,49 +1752,49 @@ discard block  | 
                                                    ||
| 1765 | 1752 | }  | 
                                                        
| 1766 | 1753 | |
| 1767 | 1754 | global $lang;  | 
                                                        
| 1768 | - $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties  | 
                                                        |
| 1755 | + $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties  | 
                                                        |
| 1769 | 1756 | $lang->filter = New LangArgFilterErrorMessage();  | 
                                                        
| 1770 | 1757 | |
| 1771 | -		if(!defined('__XE__')) | 
                                                        |
| 1758 | +		if (!defined('__XE__')) | 
                                                        |
| 1772 | 1759 |  		{ | 
                                                        
| 1773 | 1760 |  			define('__XE__', TRUE); | 
                                                        
| 1774 | 1761 | }  | 
                                                        
| 1775 | 1762 | |
| 1776 | -		if(!defined('__ZBXE__')) | 
                                                        |
| 1763 | +		if (!defined('__ZBXE__')) | 
                                                        |
| 1777 | 1764 |  		{ | 
                                                        
| 1778 | 1765 |  			define('__ZBXE__', TRUE); | 
                                                        
| 1779 | 1766 | }  | 
                                                        
| 1780 | 1767 | |
| 1781 | -		if(!defined('__DEBUG__')) | 
                                                        |
| 1768 | +		if (!defined('__DEBUG__')) | 
                                                        |
| 1782 | 1769 |  		{ | 
                                                        
| 1783 | 1770 |  			define('__DEBUG__', 0); | 
                                                        
| 1784 | 1771 | }  | 
                                                        
| 1785 | 1772 | |
| 1786 | -		if(!defined('__DEBUG_QUERY__')) | 
                                                        |
| 1773 | +		if (!defined('__DEBUG_QUERY__')) | 
                                                        |
| 1787 | 1774 |  		{ | 
                                                        
| 1788 | 1775 |  			define('__DEBUG_QUERY__', 0); | 
                                                        
| 1789 | 1776 | }  | 
                                                        
| 1790 | 1777 | |
| 1791 | - include(_XE_PATH_ . 'classes/object/BaseObject.class.php');  | 
                                                        |
| 1792 | - include(_XE_PATH_ . 'classes/handler/Handler.class.php');  | 
                                                        |
| 1793 | - include(_XE_PATH_ . 'classes/file/FileHandler.class.php');  | 
                                                        |
| 1794 | - include(_XE_PATH_ . 'classes/page/PageHandler.class.php');  | 
                                                        |
| 1778 | + include(_XE_PATH_.'classes/object/BaseObject.class.php');  | 
                                                        |
| 1779 | + include(_XE_PATH_.'classes/handler/Handler.class.php');  | 
                                                        |
| 1780 | + include(_XE_PATH_.'classes/file/FileHandler.class.php');  | 
                                                        |
| 1781 | + include(_XE_PATH_.'classes/page/PageHandler.class.php');  | 
                                                        |
| 1795 | 1782 | |
| 1796 | 1783 | Context::setNoDBInfo();  | 
                                                        
| 1797 | 1784 | |
| 1798 | - require_once(_XE_PATH_ . 'classes/db/DB.class.php');  | 
                                                        |
| 1799 | - require_once(_XE_PATH_ . 'classes/db/DBMysql.class.php');  | 
                                                        |
| 1800 | - require_once(_XE_PATH_ . 'classes/db/DBMysqli.class.php');  | 
                                                        |
| 1801 | - require_once(_XE_PATH_ . 'classes/db/DBMysql_innodb.class.php');  | 
                                                        |
| 1802 | - require_once(_XE_PATH_ . 'classes/db/DBCubrid.class.php');  | 
                                                        |
| 1803 | - require_once(_XE_PATH_ . 'classes/db/DBMssql.class.php');  | 
                                                        |
| 1804 | - require_once(_XE_PATH_ . 'classes/xml/XmlParser.class.php');  | 
                                                        |
| 1805 | - require_once(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php');  | 
                                                        |
| 1785 | + require_once(_XE_PATH_.'classes/db/DB.class.php');  | 
                                                        |
| 1786 | + require_once(_XE_PATH_.'classes/db/DBMysql.class.php');  | 
                                                        |
| 1787 | + require_once(_XE_PATH_.'classes/db/DBMysqli.class.php');  | 
                                                        |
| 1788 | + require_once(_XE_PATH_.'classes/db/DBMysql_innodb.class.php');  | 
                                                        |
| 1789 | + require_once(_XE_PATH_.'classes/db/DBCubrid.class.php');  | 
                                                        |
| 1790 | + require_once(_XE_PATH_.'classes/db/DBMssql.class.php');  | 
                                                        |
| 1791 | + require_once(_XE_PATH_.'classes/xml/XmlParser.class.php');  | 
                                                        |
| 1792 | + require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');  | 
                                                        |
| 1806 | 1793 | |
| 1807 | - require_once(__DIR__ . '/connect_wrapper.php');  | 
                                                        |
| 1794 | + require_once(__DIR__.'/connect_wrapper.php');  | 
                                                        |
| 1808 | 1795 | |
| 1809 | 1796 | // check $query_args, $query_args_file  | 
                                                        
| 1810 | - if($query_args_file)  | 
                                                        |
| 1797 | + if ($query_args_file)  | 
                                                        |
| 1811 | 1798 |  		{ | 
                                                        
| 1812 | 1799 | try  | 
                                                        
| 1813 | 1800 |  			{ | 
                                                        
@@ -1821,11 +1808,11 @@ discard block  | 
                                                    ||
| 1821 | 1808 | }  | 
                                                        
| 1822 | 1809 | else  | 
                                                        
| 1823 | 1810 |  		{ | 
                                                        
| 1824 | - if($query_args)  | 
                                                        |
| 1811 | + if ($query_args)  | 
                                                        |
| 1825 | 1812 |  			{ | 
                                                        
| 1826 | 1813 | try  | 
                                                        
| 1827 | 1814 |  				{ | 
                                                        
| 1828 | -					eval('$query_user_args = array(' . $query_args . ');'); | 
                                                        |
| 1815 | +					eval('$query_user_args = array('.$query_args.');'); | 
                                                        |
| 1829 | 1816 | }  | 
                                                        
| 1830 | 1817 | catch (Exception $exc)  | 
                                                        
| 1831 | 1818 |  				{ | 
                                                        
@@ -1841,26 +1828,25 @@ discard block  | 
                                                    ||
| 1841 | 1828 | |
| 1842 | 1829 | $schema_file = NULL;  | 
                                                        
| 1843 | 1830 | $schemas_set =  | 
                                                        
| 1844 | - array  | 
                                                        |
| 1845 | - (  | 
                                                        |
| 1846 | - 'delete' => __DIR__ . '/xml_delete.xsd',  | 
                                                        |
| 1847 | - 'update' => __DIR__ . '/xml_update.xsd',  | 
                                                        |
| 1848 | - 'select' => __DIR__ . '/xml_select.xsd',  | 
                                                        |
| 1849 | - 'insert' => __DIR__ . '/xml_insert.xsd',  | 
                                                        |
| 1850 | - 'insert-select' => __DIR__ . '/xml_insert_select.xsd'  | 
                                                        |
| 1831 | + array(  | 
                                                        |
| 1832 | + 'delete' => __DIR__.'/xml_delete.xsd',  | 
                                                        |
| 1833 | + 'update' => __DIR__.'/xml_update.xsd',  | 
                                                        |
| 1834 | + 'select' => __DIR__.'/xml_select.xsd',  | 
                                                        |
| 1835 | + 'insert' => __DIR__.'/xml_insert.xsd',  | 
                                                        |
| 1836 | + 'insert-select' => __DIR__.'/xml_insert_select.xsd'  | 
                                                        |
| 1851 | 1837 | );  | 
                                                        
| 1852 | - $table_schema = __DIR__ . '/xml_create_table.xsd';  | 
                                                        |
| 1838 | + $table_schema = __DIR__.'/xml_create_table.xsd';  | 
                                                        |
| 1853 | 1839 | |
| 1854 | 1840 | $domDocument = new DOMDocument();  | 
                                                        
| 1855 | 1841 | |
| 1856 | 1842 | $i = 1;  | 
                                                        
| 1857 | 1843 | |
| 1858 | - if(pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd')  | 
                                                        |
| 1844 | + if (pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd')  | 
                                                        |
| 1859 | 1845 |  	{ | 
                                                        
| 1860 | 1846 | $schema_file = $argv[$i++];  | 
                                                        
| 1861 | 1847 | }  | 
                                                        
| 1862 | 1848 | |
| 1863 | - for(; $i < count($argv); $i++)  | 
                                                        |
| 1849 | + for (; $i < count($argv); $i++)  | 
                                                        |
| 1864 | 1850 |  	{ | 
                                                        
| 1865 | 1851 | try  | 
                                                        
| 1866 | 1852 |  		{ | 
                                                        
@@ -1869,7 +1855,7 @@ discard block  | 
                                                    ||
| 1869 | 1855 | $use_schema_language = $schema_language;  | 
                                                        
| 1870 | 1856 | |
| 1871 | 1857 | $retcode->push(ReturnCode::RETCODE_GENERIC_XML_SYNTAX);  | 
                                                        
| 1872 | - if($domDocument->load($argv[$i]))  | 
                                                        |
| 1858 | + if ($domDocument->load($argv[$i]))  | 
                                                        |
| 1873 | 1859 |  			{ | 
                                                        
| 1874 | 1860 | $retcode->pop();  | 
                                                        
| 1875 | 1861 | |
@@ -1883,7 +1869,7 @@ discard block  | 
                                                    ||
| 1883 | 1869 | }  | 
                                                        
| 1884 | 1870 | }  | 
                                                        
| 1885 | 1871 | |
| 1886 | - if(!$schema_file && !$use_schema_language  | 
                                                        |
| 1872 | + if (!$schema_file && !$use_schema_language  | 
                                                        |
| 1887 | 1873 | &&  | 
                                                        
| 1888 | 1874 | (  | 
                                                        
| 1889 | 1875 | $queryElement->tagName != 'query'  | 
                                                        
@@ -1895,15 +1881,15 @@ discard block  | 
                                                    ||
| 1895 | 1881 | |
| 1896 | 1882 | throw  | 
                                                        
| 1897 | 1883 | new ErrorMessage(  | 
                                                        
| 1898 | -								"{$argv[$i]}:" . | 
                                                        |
| 1899 | - " Root element should be <query> and should have an action attribute of:" .  | 
                                                        |
| 1900 | - " insert, insert-select, select, update or delete." .  | 
                                                        |
| 1901 | - " Otherwise an explicit schema, to validate the document with, should be" .  | 
                                                        |
| 1884 | +								"{$argv[$i]}:". | 
                                                        |
| 1885 | + " Root element should be <query> and should have an action attribute of:".  | 
                                                        |
| 1886 | + " insert, insert-select, select, update or delete.".  | 
                                                        |
| 1887 | + " Otherwise an explicit schema, to validate the document with, should be".  | 
                                                        |
| 1902 | 1888 | " specified as first argument on the command line."  | 
                                                        
| 1903 | 1889 | );  | 
                                                        
| 1904 | 1890 | }  | 
                                                        
| 1905 | 1891 | |
| 1906 | - if(!$schema_file && !$use_schema_language && !$skip_query_id  | 
                                                        |
| 1892 | + if (!$schema_file && !$use_schema_language && !$skip_query_id  | 
                                                        |
| 1907 | 1893 | &&  | 
                                                        
| 1908 | 1894 |  						!validate_query_id($argv[$i], $queryElement->getAttribute('id'))) | 
                                                        
| 1909 | 1895 |  				{ | 
                                                        
@@ -1912,28 +1898,28 @@ discard block  | 
                                                    ||
| 1912 | 1898 | |
| 1913 | 1899 | throw  | 
                                                        
| 1914 | 1900 | new ErrorMessage(  | 
                                                        
| 1915 | -							"{$argv[$i]}(" . $queryElement->getLineNo() . "):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name." | 
                                                        |
| 1901 | +							"{$argv[$i]}(".$queryElement->getLineNo()."):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name." | 
                                                        |
| 1916 | 1902 | );  | 
                                                        
| 1917 | 1903 | }  | 
                                                        
| 1918 | 1904 | |
| 1919 | - if($use_schema_language)  | 
                                                        |
| 1905 | + if ($use_schema_language)  | 
                                                        |
| 1920 | 1906 |  				{ | 
                                                        
| 1921 | 1907 | $document_schema = $table_schema;  | 
                                                        
| 1922 | 1908 | }  | 
                                                        
| 1923 | 1909 | else  | 
                                                        
| 1924 | 1910 |  				{ | 
                                                        
| 1925 | - if(!$document_schema)  | 
                                                        |
| 1911 | + if (!$document_schema)  | 
                                                        |
| 1926 | 1912 |  					{ | 
                                                        
| 1927 | 1913 |  						$document_schema = $schemas_set[$queryElement->getAttribute('action')]; | 
                                                        
| 1928 | 1914 | }  | 
                                                        
| 1929 | 1915 | }  | 
                                                        
| 1930 | 1916 | |
| 1931 | 1917 | $retcode->push(ReturnCode::RETCODE_XSD_VALIDATION);  | 
                                                        
| 1932 | - if($domDocument->schemaValidate($document_schema))  | 
                                                        |
| 1918 | + if ($domDocument->schemaValidate($document_schema))  | 
                                                        |
| 1933 | 1919 |  				{ | 
                                                        
| 1934 | 1920 | $retcode->pop();  | 
                                                        
| 1935 | 1921 | |
| 1936 | - if($use_schema_language)  | 
                                                        |
| 1922 | + if ($use_schema_language)  | 
                                                        |
| 1937 | 1923 |  					{ | 
                                                        
| 1938 | 1924 | validate_schema_doc($argv[$i], $domDocument->documentElement);  | 
                                                        
| 1939 | 1925 | }  | 
                                                        
@@ -1944,22 +1930,22 @@ discard block  | 
                                                    ||
| 1944 | 1930 | $success = TRUE;  | 
                                                        
| 1945 | 1931 | }  | 
                                                        
| 1946 | 1932 | |
| 1947 | - if(!$validate_only)  | 
                                                        |
| 1933 | + if (!$validate_only)  | 
                                                        |
| 1948 | 1934 |  				{ | 
                                                        
| 1949 | 1935 | // Generate SQL with the db provider back-ends  | 
                                                        
| 1950 | 1936 | |
| 1951 | -					if(function_exists('sys_get_temp_dir')) | 
                                                        |
| 1937 | +					if (function_exists('sys_get_temp_dir')) | 
                                                        |
| 1952 | 1938 |  					{ | 
                                                        
| 1953 | 1939 | $tmpdir = sys_get_temp_dir();  | 
                                                        
| 1954 | 1940 | }  | 
                                                        
| 1955 | 1941 | else  | 
                                                        
| 1956 | 1942 |  					{ | 
                                                        
| 1957 | 1943 |  						$tmpdir = getenv('TEMP'); | 
                                                        
| 1958 | - if(!$tmpdir)  | 
                                                        |
| 1944 | + if (!$tmpdir)  | 
                                                        |
| 1959 | 1945 |  						{ | 
                                                        
| 1960 | 1946 |  							$tmpdir = getenv('TMP'); | 
                                                        
| 1961 | 1947 | }  | 
                                                        
| 1962 | - if(!$tmpdir)  | 
                                                        |
| 1948 | + if (!$tmpdir)  | 
                                                        |
| 1963 | 1949 |  						{ | 
                                                        
| 1964 | 1950 | $tmpdir = '/tmp';  | 
                                                        
| 1965 | 1951 | }  | 
                                                        
@@ -1968,30 +1954,29 @@ discard block  | 
                                                    ||
| 1968 | 1954 | |
| 1969 | 1955 | global $_SERVER;  | 
                                                        
| 1970 | 1956 | |
| 1971 | - if(!is_array($_SERVER))  | 
                                                        |
| 1957 | + if (!is_array($_SERVER))  | 
                                                        |
| 1972 | 1958 |  					{ | 
                                                        
| 1973 | 1959 | $_SERVER = array();  | 
                                                        
| 1974 | 1960 | }  | 
                                                        
| 1975 | 1961 | |
| 1976 | -					if(!array_key_exists('REMOTE_ADDR', $_SERVER)) | 
                                                        |
| 1962 | +					if (!array_key_exists('REMOTE_ADDR', $_SERVER)) | 
                                                        |
| 1977 | 1963 |  					{ | 
                                                        
| 1978 | 1964 | $_SERVER['REMOTE_ADDR'] = '127.0.0.1';  | 
                                                        
| 1979 | 1965 | }  | 
                                                        
| 1980 | 1966 | |
| 1981 | 1967 | $set_db_info_methods =  | 
                                                        
| 1982 | - array  | 
                                                        |
| 1983 | - (  | 
                                                        |
| 1968 | + array(  | 
                                                        |
| 1984 | 1969 | 'mysql' => 'setMysqlDBInfo',  | 
                                                        
| 1985 | 1970 | 'mysqli' => 'setMysqliDBInfo',  | 
                                                        
| 1986 | 1971 | 'cubrid' => 'setCubridDBInfo',  | 
                                                        
| 1987 | 1972 | 'mssql' => 'setMssqlDBInfo'  | 
                                                        
| 1988 | 1973 | );  | 
                                                        
| 1989 | 1974 | |
| 1990 | - foreach($set_db_info_methods as $db_type => $set_info_method)  | 
                                                        |
| 1975 | + foreach ($set_db_info_methods as $db_type => $set_info_method)  | 
                                                        |
| 1991 | 1976 |  					{ | 
                                                        
| 1992 | 1977 | Context::$set_info_method(); // calls setMysqlDBInfo()/setCubridDBInfo()/...  | 
                                                        
| 1993 | 1978 | |
| 1994 | - if($use_schema_language)  | 
                                                        |
| 1979 | + if ($use_schema_language)  | 
                                                        |
| 1995 | 1980 |  						{ | 
                                                        
| 1996 | 1981 | $GLOBALS['__DB__'][$db_type]->queries = '';  | 
                                                        
| 1997 | 1982 | $GLOBALS['__DB__'][$db_type]->createTableByXmlFile($argv[$i]);  | 
                                                        
@@ -2010,39 +1995,38 @@ discard block  | 
                                                    ||
| 2010 | 1995 | // copied from classes/db/DB.class.php  | 
                                                        
| 2011 | 1996 | $oParser = new XmlQueryParser();  | 
                                                        
| 2012 | 1997 | $args_array =  | 
                                                        
| 2013 | - $oParser->parse_xml_query  | 
                                                        |
| 2014 | - (  | 
                                                        |
| 1998 | + $oParser->parse_xml_query(  | 
                                                        |
| 2015 | 1999 | pathinfo($argv[$i], PATHINFO_FILENAME), // query id  | 
                                                        
| 2016 | - $argv[$i], // xml file  | 
                                                        |
| 2000 | + $argv[$i], // xml file  | 
                                                        |
| 2017 | 2001 | $unlink_tmpfile->file_name // cache file  | 
                                                        
| 2018 | 2002 | );  | 
                                                        
| 2019 | 2003 | $args_array = $args_array->queryTag->getArguments();  | 
                                                        
| 2020 | 2004 | |
| 2021 | 2005 | $GLOBALS['__DB__'][$db_type]->queries = '';  | 
                                                        
| 2022 | 2006 | $k = 1;  | 
                                                        
| 2023 | - foreach($args_array as $arg)  | 
                                                        |
| 2007 | + foreach ($args_array as $arg)  | 
                                                        |
| 2024 | 2008 |  							{ | 
                                                        
| 2025 | - if(// why would there be a query arg without a var name ?  | 
                                                        |
| 2009 | + if (// why would there be a query arg without a var name ?  | 
                                                        |
| 2026 | 2010 | isset($arg->variable_name)  | 
                                                        
| 2027 | 2011 | &&  | 
                                                        
| 2028 | 2012 | !array_key_exists($arg->variable_name, $query_user_args))  | 
                                                        
| 2029 | 2013 |  								{ | 
                                                        
| 2030 | - if(isset($arg->argument_validator))  | 
                                                        |
| 2014 | + if (isset($arg->argument_validator))  | 
                                                        |
| 2031 | 2015 |  									{ | 
                                                        
| 2032 | - if(FALSE // some default values are to be parsed by php, some are not...  | 
                                                        |
| 2016 | + if (FALSE // some default values are to be parsed by php, some are not...  | 
                                                        |
| 2033 | 2017 | &&  | 
                                                        
| 2034 | 2018 | isset($arg->argument_validator->default_value)  | 
                                                        
| 2035 | 2019 | &&  | 
                                                        
| 2036 | 2020 | isset($arg->argument_validator->default_value->value))  | 
                                                        
| 2037 | 2021 |  										{ | 
                                                        
| 2038 | 2022 | $query_user_args[$arg->variable_name] =  | 
                                                        
| 2039 | -												eval('return ' . $arg->argument_validator->default_value->toString() . ';'); | 
                                                        |
| 2023 | +												eval('return '.$arg->argument_validator->default_value->toString().';'); | 
                                                        |
| 2040 | 2024 | }  | 
                                                        
| 2041 | 2025 | else  | 
                                                        
| 2042 | 2026 |  										{ | 
                                                        
| 2043 | - if($arg->argument_validator->filter)  | 
                                                        |
| 2027 | + if ($arg->argument_validator->filter)  | 
                                                        |
| 2044 | 2028 |  											{ | 
                                                        
| 2045 | - switch($arg->argument_validator->filter)  | 
                                                        |
| 2029 | + switch ($arg->argument_validator->filter)  | 
                                                        |
| 2046 | 2030 |  												{ | 
                                                        
| 2047 | 2031 | case 'email':  | 
                                                        
| 2048 | 2032 | case 'email_address':  | 
                                                        
@@ -2081,18 +2065,17 @@ discard block  | 
                                                    ||
| 2081 | 2065 | }  | 
                                                        
| 2082 | 2066 | }  | 
                                                        
| 2083 | 2067 | |
| 2084 | - if(!array_key_exists($arg->variable_name, $query_user_args))  | 
                                                        |
| 2068 | + if (!array_key_exists($arg->variable_name, $query_user_args))  | 
                                                        |
| 2085 | 2069 |  									{ | 
                                                        
| 2086 | 2070 |  										$query_user_args[$arg->variable_name] = sprintf('%06d', $k); | 
                                                        
| 2087 | 2071 | }  | 
                                                        
| 2088 | 2072 | |
| 2089 | - if(isset($arg->argument_validator))  | 
                                                        |
| 2073 | + if (isset($arg->argument_validator))  | 
                                                        |
| 2090 | 2074 |  									{ | 
                                                        
| 2091 | - if(isset($arg->argument_validator->min_length))  | 
                                                        |
| 2075 | + if (isset($arg->argument_validator->min_length))  | 
                                                        |
| 2092 | 2076 |  										{ | 
                                                        
| 2093 | 2077 | $query_user_args[$arg->variable_name] =  | 
                                                        
| 2094 | - str_pad  | 
                                                        |
| 2095 | - (  | 
                                                        |
| 2078 | + str_pad(  | 
                                                        |
| 2096 | 2079 | $query_user_args[$arg->variable_name],  | 
                                                        
| 2097 | 2080 | $arg->argument_validator->min_length,  | 
                                                        
| 2098 | 2081 | isset($arg->argument_validator->filter) &&  | 
                                                        
@@ -2105,11 +2088,10 @@ discard block  | 
                                                    ||
| 2105 | 2088 | );  | 
                                                        
| 2106 | 2089 | }  | 
                                                        
| 2107 | 2090 | |
| 2108 | - if(isset($arg->argument_validator->max_length))  | 
                                                        |
| 2091 | + if (isset($arg->argument_validator->max_length))  | 
                                                        |
| 2109 | 2092 |  										{ | 
                                                        
| 2110 | 2093 | $query_user_args[$arg->variable_name] =  | 
                                                        
| 2111 | - substr  | 
                                                        |
| 2112 | - (  | 
                                                        |
| 2094 | + substr(  | 
                                                        |
| 2113 | 2095 | $query_user_args[$arg->variable_name],  | 
                                                        
| 2114 | 2096 | 0,  | 
                                                        
| 2115 | 2097 | $arg->argument_validator->max_length  | 
                                                        
@@ -2122,15 +2104,14 @@ discard block  | 
                                                    ||
| 2122 | 2104 | }  | 
                                                        
| 2123 | 2105 | |
| 2124 | 2106 | $resultset =  | 
                                                        
| 2125 | - $GLOBALS['__DB__'][$db_type]->_executeQuery  | 
                                                        |
| 2126 | - (  | 
                                                        |
| 2127 | - $unlink_tmpfile->file_name, // cache_file  | 
                                                        |
| 2128 | - (object)$query_user_args, // source_args  | 
                                                        |
| 2129 | - basename($argv[$i]), // query_id  | 
                                                        |
| 2107 | + $GLOBALS['__DB__'][$db_type]->_executeQuery(  | 
                                                        |
| 2108 | + $unlink_tmpfile->file_name, // cache_file  | 
                                                        |
| 2109 | + (object) $query_user_args, // source_args  | 
                                                        |
| 2110 | + basename($argv[$i]), // query_id  | 
                                                        |
| 2130 | 2111 | array() // arg_columns  | 
                                                        
| 2131 | 2112 | );  | 
                                                        
| 2132 | 2113 | |
| 2133 | - if(is_a($resultset, 'BaseObject') && !$resultset->toBool())  | 
                                                        |
| 2114 | + if (is_a($resultset, 'BaseObject') && !$resultset->toBool())  | 
                                                        |
| 2134 | 2115 |  							{ | 
                                                        
| 2135 | 2116 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed');  | 
                                                        
| 2136 | 2117 | }  | 
                                                        
@@ -2147,7 +2128,7 @@ discard block  | 
                                                    ||
| 2147 | 2128 | }  | 
                                                        
| 2148 | 2129 | }  | 
                                                        
| 2149 | 2130 | |
| 2150 | - if(!$success)  | 
                                                        |
| 2131 | + if (!$success)  | 
                                                        |
| 2151 | 2132 |  			{ | 
                                                        
| 2152 | 2133 | libXmlDisplayError($argv[$i], TRUE);  | 
                                                        
| 2153 | 2134 | }  | 
                                                        
@@ -2156,21 +2137,21 @@ discard block  | 
                                                    ||
| 2156 | 2137 |  		{ | 
                                                        
| 2157 | 2138 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS);  | 
                                                        
| 2158 | 2139 | |
| 2159 | - fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        |
| 2140 | + fwrite(STDERR, $exc->getMessage()."\n");  | 
                                                        |
| 2160 | 2141 | }  | 
                                                        
| 2161 | 2142 | catch (ErrorMessage $exc)  | 
                                                        
| 2162 | 2143 |  		{ | 
                                                        
| 2163 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        |
| 2144 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        |
| 2164 | 2145 |  			{ | 
                                                        
| 2165 | 2146 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);  | 
                                                        
| 2166 | 2147 | }  | 
                                                        
| 2167 | 2148 | |
| 2168 | - fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        |
| 2149 | + fwrite(STDERR, $exc->getMessage()."\n");  | 
                                                        |
| 2169 | 2150 | libXmlDisplayError($argv[$i]);  | 
                                                        
| 2170 | 2151 | }  | 
                                                        
| 2171 | 2152 | catch (ErrorException $exc)  | 
                                                        
| 2172 | 2153 |  		{ | 
                                                        
| 2173 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        |
| 2154 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        |
| 2174 | 2155 |  			{ | 
                                                        
| 2175 | 2156 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);  | 
                                                        
| 2176 | 2157 | }  | 
                                                        
@@ -2183,7 +2164,7 @@ discard block  | 
                                                    ||
| 2183 | 2164 |  		{ | 
                                                        
| 2184 | 2165 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);  | 
                                                        
| 2185 | 2166 | |
| 2186 | - fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        |
| 2167 | + fwrite(STDERR, $exc->getMessage()."\n");  | 
                                                        |
| 2187 | 2168 | fwrite(STDERR, $exc->getTraceAsString());  | 
                                                        
| 2188 | 2169 | libXmlDisplayError($argv[$i]);  | 
                                                        
| 2189 | 2170 | }  | 
                                                        
@@ -2193,22 +2174,22 @@ discard block  | 
                                                    ||
| 2193 | 2174 | }  | 
                                                        
| 2194 | 2175 | catch (SyntaxError $syntax)  | 
                                                        
| 2195 | 2176 |  { | 
                                                        
| 2196 | - fwrite(STDERR, $syntax->getMessage() . "\n");  | 
                                                        |
| 2197 | - exit(254); // wrong command line  | 
                                                        |
| 2177 | + fwrite(STDERR, $syntax->getMessage()."\n");  | 
                                                        |
| 2178 | + exit(254); // wrong command line  | 
                                                        |
| 2198 | 2179 | // 255 is reserved by php (for parse errors, etc.)  | 
                                                        
| 2199 | 2180 | }  | 
                                                        
| 2200 | 2181 | catch (ErrorMessage $exc)  | 
                                                        
| 2201 | 2182 |  { | 
                                                        
| 2202 | - fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        |
| 2183 | + fwrite(STDERR, $exc->getMessage()."\n");  | 
                                                        |
| 2203 | 2184 | libXmlDisplayError();  | 
                                                        
| 2204 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error  | 
                                                        |
| 2185 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error  | 
                                                        |
| 2205 | 2186 | }  | 
                                                        
| 2206 | 2187 | catch (Exception $exc)  | 
                                                        
| 2207 | 2188 |  { | 
                                                        
| 2208 | -	fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n"); | 
                                                        |
| 2189 | +	fwrite(STDERR, $exc->getFile().'('.$exc->getLine().")\n\t".$exc->getMessage()."\n"); | 
                                                        |
| 2209 | 2190 | fwrite(STDERR, $exc->getTraceAsString());  | 
                                                        
| 2210 | 2191 | libXmlDisplayError();  | 
                                                        
| 2211 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error  | 
                                                        |
| 2192 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error  | 
                                                        |
| 2212 | 2193 | }  | 
                                                        
| 2213 | 2194 | |
| 2214 | 2195 | /* End of file validate.php */  | 
                                                        
@@ -150,13 +150,11 @@ discard block  | 
                                                    ||
| 150 | 150 | if($throw_error)  | 
                                                        
| 151 | 151 |  		{ | 
                                                        
| 152 | 152 | throw new ErrorMessage($msg);  | 
                                                        
| 153 | - }  | 
                                                        |
| 154 | - else  | 
                                                        |
| 153 | + } else  | 
                                                        |
| 155 | 154 |  		{ | 
                                                        
| 156 | 155 | fwrite(STDERR, $msg . "\n");  | 
                                                        
| 157 | 156 | }  | 
                                                        
| 158 | - }  | 
                                                        |
| 159 | - else  | 
                                                        |
| 157 | + } else  | 
                                                        |
| 160 | 158 |  	{ | 
                                                        
| 161 | 159 | if($throw_error)  | 
                                                        
| 162 | 160 |  		{ | 
                                                        
@@ -346,8 +344,7 @@ discard block  | 
                                                    ||
| 346 | 344 | "\nANSI SQL-99 declares the table specification as required."  | 
                                                        
| 347 | 345 | );  | 
                                                        
| 348 | 346 | }  | 
                                                        
| 349 | - }  | 
                                                        |
| 350 | - else  | 
                                                        |
| 347 | + } else  | 
                                                        |
| 351 | 348 |  	{ | 
                                                        
| 352 | 349 | // base table or view  | 
                                                        
| 353 | 350 | |
@@ -369,13 +366,11 @@ discard block  | 
                                                    ||
| 369 | 366 | $child_node->getLineNo(),  | 
                                                        
| 370 | 367 | 'Duplicate <conditions> elements.'  | 
                                                        
| 371 | 368 | );  | 
                                                        
| 372 | - }  | 
                                                        |
| 373 | - else  | 
                                                        |
| 369 | + } else  | 
                                                        |
| 374 | 370 |  						{ | 
                                                        
| 375 | 371 | $has_conditions_element = TRUE;  | 
                                                        
| 376 | 372 | }  | 
                                                        
| 377 | - }  | 
                                                        |
| 378 | - else  | 
                                                        |
| 373 | + } else  | 
                                                        |
| 379 | 374 |  					{ | 
                                                        
| 380 | 375 | throw  | 
                                                        
| 381 | 376 | new XmlSchemaError(  | 
                                                        
@@ -396,8 +391,7 @@ discard block  | 
                                                    ||
| 396 | 391 | 'Expected <conditions> element as content.'  | 
                                                        
| 397 | 392 | );  | 
                                                        
| 398 | 393 | }  | 
                                                        
| 399 | - }  | 
                                                        |
| 400 | - else  | 
                                                        |
| 394 | + } else  | 
                                                        |
| 401 | 395 |  		{ | 
                                                        
| 402 | 396 | foreach($table_element->childNodes as $child_node)  | 
                                                        
| 403 | 397 |  			{ | 
                                                        
@@ -609,8 +603,7 @@ discard block  | 
                                                    ||
| 609 | 603 | if($first_child)  | 
                                                        
| 610 | 604 |  			{ | 
                                                        
| 611 | 605 | $first_child = FALSE;  | 
                                                        
| 612 | - }  | 
                                                        |
| 613 | - else  | 
                                                        |
| 606 | + } else  | 
                                                        |
| 614 | 607 |  			{ | 
                                                        
| 615 | 608 |  				if(!$child_node->hasAttribute('pipe')) | 
                                                        
| 616 | 609 |  				{ | 
                                                        
@@ -629,14 +622,12 @@ discard block  | 
                                                    ||
| 629 | 622 | if($child_node->tagName == 'group')  | 
                                                        
| 630 | 623 |  			{ | 
                                                        
| 631 | 624 | checkConditionsGroup($xml_file, $child_node);  | 
                                                        
| 632 | - }  | 
                                                        |
| 633 | - else  | 
                                                        |
| 625 | + } else  | 
                                                        |
| 634 | 626 |  			{ | 
                                                        
| 635 | 627 | if($child_node->tagName == 'query')  | 
                                                        
| 636 | 628 |  				{ | 
                                                        
| 637 | 629 | validate_select_query($xml_file, $child_node);  | 
                                                        
| 638 | - }  | 
                                                        |
| 639 | - else  | 
                                                        |
| 630 | + } else  | 
                                                        |
| 640 | 631 |  				{ | 
                                                        
| 641 | 632 | if($child_node->tagName == 'condition')  | 
                                                        
| 642 | 633 |  					{ | 
                                                        
@@ -851,8 +842,7 @@ discard block  | 
                                                    ||
| 851 | 842 | try  | 
                                                        
| 852 | 843 |  			{ | 
                                                        
| 853 | 844 | $success = chdir($this->dirname);  | 
                                                        
| 854 | - }  | 
                                                        |
| 855 | - catch (Exception $e)  | 
                                                        |
| 845 | + } catch (Exception $e)  | 
                                                        |
| 856 | 846 |  			{ | 
                                                        
| 857 | 847 |  				print "Failed to restore working dir {$this->dirname}."; | 
                                                        
| 858 | 848 | }  | 
                                                        
@@ -921,8 +911,7 @@ discard block  | 
                                                    ||
| 921 | 911 | if($lowercase_name[$i] != $uppercase_name[$i])  | 
                                                        
| 922 | 912 |  		{ | 
                                                        
| 923 | 913 |  			$varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]"; | 
                                                        
| 924 | - }  | 
                                                        |
| 925 | - else  | 
                                                        |
| 914 | + } else  | 
                                                        |
| 926 | 915 |  		{ | 
                                                        
| 927 | 916 | $varing_case_filename .= $lowercase_name[$i];  | 
                                                        
| 928 | 917 | }  | 
                                                        
@@ -1119,8 +1108,7 @@ discard block  | 
                                                    ||
| 1119 | 1108 | if($val == -1)  | 
                                                        
| 1120 | 1109 |  		{ | 
                                                        
| 1121 | 1110 | return $this->exit_code;  | 
                                                        
| 1122 | - }  | 
                                                        |
| 1123 | - else  | 
                                                        |
| 1111 | + } else  | 
                                                        |
| 1124 | 1112 |  		{ | 
                                                        
| 1125 | 1113 | if($this->exit_code < $val)  | 
                                                        
| 1126 | 1114 |  			{ | 
                                                        
@@ -1488,8 +1476,7 @@ discard block  | 
                                                    ||
| 1488 | 1476 | if(self::$db_info)  | 
                                                        
| 1489 | 1477 |  				{ | 
                                                        
| 1490 | 1478 | return self::$db_info->master_db['db_type'];  | 
                                                        
| 1491 | - }  | 
                                                        |
| 1492 | - else  | 
                                                        |
| 1479 | + } else  | 
                                                        |
| 1493 | 1480 |  				{ | 
                                                        
| 1494 | 1481 | return NULL;  | 
                                                        
| 1495 | 1482 | }  | 
                                                        
@@ -1588,8 +1575,7 @@ discard block  | 
                                                    ||
| 1588 | 1575 | &&  | 
                                                        
| 1589 | 1576 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1590 | 1577 |  				{ | 
                                                        
| 1591 | - }  | 
                                                        |
| 1592 | - else  | 
                                                        |
| 1578 | + } else  | 
                                                        |
| 1593 | 1579 |  				{ | 
                                                        
| 1594 | 1580 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] =  | 
                                                        
| 1595 | 1581 | new DBMysqlConnectWrapper();  | 
                                                        
@@ -1630,8 +1616,7 @@ discard block  | 
                                                    ||
| 1630 | 1616 | &&  | 
                                                        
| 1631 | 1617 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1632 | 1618 |  				{ | 
                                                        
| 1633 | - }  | 
                                                        |
| 1634 | - else  | 
                                                        |
| 1619 | + } else  | 
                                                        |
| 1635 | 1620 |  				{ | 
                                                        
| 1636 | 1621 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] =  | 
                                                        
| 1637 | 1622 | new DBMysqliConnectWrapper();  | 
                                                        
@@ -1672,8 +1657,7 @@ discard block  | 
                                                    ||
| 1672 | 1657 | &&  | 
                                                        
| 1673 | 1658 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1674 | 1659 |  				{ | 
                                                        
| 1675 | - }  | 
                                                        |
| 1676 | - else  | 
                                                        |
| 1660 | + } else  | 
                                                        |
| 1677 | 1661 |  				{ | 
                                                        
| 1678 | 1662 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] =  | 
                                                        
| 1679 | 1663 | new DBCubridConnectWrapper();  | 
                                                        
@@ -1714,8 +1698,7 @@ discard block  | 
                                                    ||
| 1714 | 1698 | &&  | 
                                                        
| 1715 | 1699 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))  | 
                                                        
| 1716 | 1700 |  				{ | 
                                                        
| 1717 | - }  | 
                                                        |
| 1718 | - else  | 
                                                        |
| 1701 | + } else  | 
                                                        |
| 1719 | 1702 |  				{ | 
                                                        
| 1720 | 1703 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] =  | 
                                                        
| 1721 | 1704 | new DBMssqlConnectWrapper();  | 
                                                        
@@ -1812,22 +1795,19 @@ discard block  | 
                                                    ||
| 1812 | 1795 | try  | 
                                                        
| 1813 | 1796 |  			{ | 
                                                        
| 1814 | 1797 | $query_user_args = require($query_args_file);  | 
                                                        
| 1815 | - }  | 
                                                        |
| 1816 | - catch (Exception $exc)  | 
                                                        |
| 1798 | + } catch (Exception $exc)  | 
                                                        |
| 1817 | 1799 |  			{ | 
                                                        
| 1818 | 1800 | fwrite(STDERR, "Error in arguments file.\n");  | 
                                                        
| 1819 | 1801 | throw $exc;  | 
                                                        
| 1820 | 1802 | }  | 
                                                        
| 1821 | - }  | 
                                                        |
| 1822 | - else  | 
                                                        |
| 1803 | + } else  | 
                                                        |
| 1823 | 1804 |  		{ | 
                                                        
| 1824 | 1805 | if($query_args)  | 
                                                        
| 1825 | 1806 |  			{ | 
                                                        
| 1826 | 1807 | try  | 
                                                        
| 1827 | 1808 |  				{ | 
                                                        
| 1828 | 1809 |  					eval('$query_user_args = array(' . $query_args . ');'); | 
                                                        
| 1829 | - }  | 
                                                        |
| 1830 | - catch (Exception $exc)  | 
                                                        |
| 1810 | + } catch (Exception $exc)  | 
                                                        |
| 1831 | 1811 |  				{ | 
                                                        
| 1832 | 1812 | fwrite(STDERR, "Error in arguments string.\n");  | 
                                                        
| 1833 | 1813 | throw $exc;  | 
                                                        
@@ -1919,8 +1899,7 @@ discard block  | 
                                                    ||
| 1919 | 1899 | if($use_schema_language)  | 
                                                        
| 1920 | 1900 |  				{ | 
                                                        
| 1921 | 1901 | $document_schema = $table_schema;  | 
                                                        
| 1922 | - }  | 
                                                        |
| 1923 | - else  | 
                                                        |
| 1902 | + } else  | 
                                                        |
| 1924 | 1903 |  				{ | 
                                                        
| 1925 | 1904 | if(!$document_schema)  | 
                                                        
| 1926 | 1905 |  					{ | 
                                                        
@@ -1936,8 +1915,7 @@ discard block  | 
                                                    ||
| 1936 | 1915 | if($use_schema_language)  | 
                                                        
| 1937 | 1916 |  					{ | 
                                                        
| 1938 | 1917 | validate_schema_doc($argv[$i], $domDocument->documentElement);  | 
                                                        
| 1939 | - }  | 
                                                        |
| 1940 | - else  | 
                                                        |
| 1918 | + } else  | 
                                                        |
| 1941 | 1919 |  					{ | 
                                                        
| 1942 | 1920 | validate_xml_query($argv[$i], $domDocument->documentElement);  | 
                                                        
| 1943 | 1921 | }  | 
                                                        
@@ -1951,8 +1929,7 @@ discard block  | 
                                                    ||
| 1951 | 1929 |  					if(function_exists('sys_get_temp_dir')) | 
                                                        
| 1952 | 1930 |  					{ | 
                                                        
| 1953 | 1931 | $tmpdir = sys_get_temp_dir();  | 
                                                        
| 1954 | - }  | 
                                                        |
| 1955 | - else  | 
                                                        |
| 1932 | + } else  | 
                                                        |
| 1956 | 1933 |  					{ | 
                                                        
| 1957 | 1934 |  						$tmpdir = getenv('TEMP'); | 
                                                        
| 1958 | 1935 | if(!$tmpdir)  | 
                                                        
@@ -2001,8 +1978,7 @@ discard block  | 
                                                    ||
| 2001 | 1978 |  							print " {$db_type} query:\n"; | 
                                                        
| 2002 | 1979 | print $GLOBALS['__DB__'][$db_type]->queries;  | 
                                                        
| 2003 | 1980 | print "\n";  | 
                                                        
| 2004 | - }  | 
                                                        |
| 2005 | - else  | 
                                                        |
| 1981 | + } else  | 
                                                        |
| 2006 | 1982 |  						{ | 
                                                        
| 2007 | 1983 | $unlink_tmpfile =  | 
                                                        
| 2008 | 1984 | new UnlinkFile(tempnam($tmpdir, 'xe_'));  | 
                                                        
@@ -2037,8 +2013,7 @@ discard block  | 
                                                    ||
| 2037 | 2013 |  										{ | 
                                                        
| 2038 | 2014 | $query_user_args[$arg->variable_name] =  | 
                                                        
| 2039 | 2015 |  												eval('return ' . $arg->argument_validator->default_value->toString() . ';'); | 
                                                        
| 2040 | - }  | 
                                                        |
| 2041 | - else  | 
                                                        |
| 2016 | + } else  | 
                                                        |
| 2042 | 2017 |  										{ | 
                                                        
| 2043 | 2018 | if($arg->argument_validator->filter)  | 
                                                        
| 2044 | 2019 |  											{ | 
                                                        
@@ -2133,8 +2108,7 @@ discard block  | 
                                                    ||
| 2133 | 2108 | if(is_a($resultset, 'BaseObject') && !$resultset->toBool())  | 
                                                        
| 2134 | 2109 |  							{ | 
                                                        
| 2135 | 2110 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed');  | 
                                                        
| 2136 | - }  | 
                                                        |
| 2137 | - else  | 
                                                        |
| 2111 | + } else  | 
                                                        |
| 2138 | 2112 |  							{ | 
                                                        
| 2139 | 2113 | print "\n";  | 
                                                        
| 2140 | 2114 | print pathinfo($argv[$i], PATHINFO_FILENAME);  | 
                                                        
@@ -2151,14 +2125,12 @@ discard block  | 
                                                    ||
| 2151 | 2125 |  			{ | 
                                                        
| 2152 | 2126 | libXmlDisplayError($argv[$i], TRUE);  | 
                                                        
| 2153 | 2127 | }  | 
                                                        
| 2154 | - }  | 
                                                        |
| 2155 | - catch (XmlSchemaError $exc)  | 
                                                        |
| 2128 | + } catch (XmlSchemaError $exc)  | 
                                                        |
| 2156 | 2129 |  		{ | 
                                                        
| 2157 | 2130 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS);  | 
                                                        
| 2158 | 2131 | |
| 2159 | 2132 | fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        
| 2160 | - }  | 
                                                        |
| 2161 | - catch (ErrorMessage $exc)  | 
                                                        |
| 2133 | + } catch (ErrorMessage $exc)  | 
                                                        |
| 2162 | 2134 |  		{ | 
                                                        
| 2163 | 2135 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        
| 2164 | 2136 |  			{ | 
                                                        
@@ -2167,8 +2139,7 @@ discard block  | 
                                                    ||
| 2167 | 2139 | |
| 2168 | 2140 | fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        
| 2169 | 2141 | libXmlDisplayError($argv[$i]);  | 
                                                        
| 2170 | - }  | 
                                                        |
| 2171 | - catch (ErrorException $exc)  | 
                                                        |
| 2142 | + } catch (ErrorException $exc)  | 
                                                        |
| 2172 | 2143 |  		{ | 
                                                        
| 2173 | 2144 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS)  | 
                                                        
| 2174 | 2145 |  			{ | 
                                                        
@@ -2178,8 +2149,7 @@ discard block  | 
                                                    ||
| 2178 | 2149 |  			fwrite(STDERR, "{$exc->getFile()}({$exc->getLine()}):\n\t{$exc->getMessage()}.\n"); | 
                                                        
| 2179 | 2150 | fwrite(STDERR, $exc->getTraceAsString());  | 
                                                        
| 2180 | 2151 | libXmlDisplayError($argv[$i]);  | 
                                                        
| 2181 | - }  | 
                                                        |
| 2182 | - catch (Exception $exc)  | 
                                                        |
| 2152 | + } catch (Exception $exc)  | 
                                                        |
| 2183 | 2153 |  		{ | 
                                                        
| 2184 | 2154 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);  | 
                                                        
| 2185 | 2155 | |
@@ -2190,20 +2160,17 @@ discard block  | 
                                                    ||
| 2190 | 2160 | }  | 
                                                        
| 2191 | 2161 | |
| 2192 | 2162 | exit($retcode->code());  | 
                                                        
| 2193 | -}  | 
                                                        |
| 2194 | -catch (SyntaxError $syntax)  | 
                                                        |
| 2163 | +} catch (SyntaxError $syntax)  | 
                                                        |
| 2195 | 2164 |  { | 
                                                        
| 2196 | 2165 | fwrite(STDERR, $syntax->getMessage() . "\n");  | 
                                                        
| 2197 | 2166 | exit(254); // wrong command line  | 
                                                        
| 2198 | 2167 | // 255 is reserved by php (for parse errors, etc.)  | 
                                                        
| 2199 | -}  | 
                                                        |
| 2200 | -catch (ErrorMessage $exc)  | 
                                                        |
| 2168 | +} catch (ErrorMessage $exc)  | 
                                                        |
| 2201 | 2169 |  { | 
                                                        
| 2202 | 2170 | fwrite(STDERR, $exc->getMessage() . "\n");  | 
                                                        
| 2203 | 2171 | libXmlDisplayError();  | 
                                                        
| 2204 | 2172 | exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error  | 
                                                        
| 2205 | -}  | 
                                                        |
| 2206 | -catch (Exception $exc)  | 
                                                        |
| 2173 | +} catch (Exception $exc)  | 
                                                        |
| 2207 | 2174 |  { | 
                                                        
| 2208 | 2175 |  	fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n"); | 
                                                        
| 2209 | 2176 | fwrite(STDERR, $exc->getTraceAsString());  | 
                                                        
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | - /*********************************************************************  | 
                                                        |
| 2 | + /*********************************************************************  | 
                                                        |
| 3 | 3 | *  | 
                                                        
| 4 | 4 | * PHP FTP Client Class By TOMO ( [email protected] )  | 
                                                        
| 5 | 5 | * Modified By XEHub ( [email protected] )  | 
                                                        
@@ -18,7 +18,7 @@ discard block  | 
                                                    ||
| 18 | 18 | *  | 
                                                        
| 19 | 19 | ********************************************************************/  | 
                                                        
| 20 | 20 | |
| 21 | - /*********************************************************************  | 
                                                        |
| 21 | + /*********************************************************************  | 
                                                        |
| 22 | 22 | * List of available functions  | 
                                                        
| 23 | 23 | * ftp_connect($server, $port = 21)  | 
                                                        
| 24 | 24 | * ftp_login($user, $pass)  | 
                                                        
@@ -41,448 +41,448 @@ discard block  | 
                                                    ||
| 41 | 41 | * ftp_quit()  | 
                                                        
| 42 | 42 | *********************************************************************/  | 
                                                        
| 43 | 43 | |
| 44 | - class ftp  | 
                                                        |
| 45 | -    { | 
                                                        |
| 46 | - /* Public variables */  | 
                                                        |
| 47 | - var $debug;  | 
                                                        |
| 48 | - var $umask;  | 
                                                        |
| 49 | - var $timeout;  | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - /* Private variables */  | 
                                                        |
| 52 | - var $ftp_sock;  | 
                                                        |
| 53 | - var $ftp_resp;  | 
                                                        |
| 54 | -  | 
                                                        |
| 55 | - /* Constractor */  | 
                                                        |
| 56 | - function ftp()  | 
                                                        |
| 57 | -        { | 
                                                        |
| 58 | - $this->debug = false;  | 
                                                        |
| 59 | - $this->umask = 0022;  | 
                                                        |
| 60 | - $this->timeout = 30;  | 
                                                        |
| 61 | -  | 
                                                        |
| 62 | -            if (!defined("FTP_BINARY")) { | 
                                                        |
| 63 | -                define("FTP_BINARY", 1); | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | -            if (!defined("FTP_ASCII")) { | 
                                                        |
| 66 | -                define("FTP_ASCII", 0); | 
                                                        |
| 67 | - }  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - $this->ftp_resp = "";  | 
                                                        |
| 70 | - }  | 
                                                        |
| 71 | -  | 
                                                        |
| 72 | - /* Public functions */  | 
                                                        |
| 73 | - function ftp_connect($server, $port = 21)  | 
                                                        |
| 74 | -        { | 
                                                        |
| 75 | -            $this->ftp_debug("Trying to ".$server.":".$port." ...\n"); | 
                                                        |
| 76 | - $this->ftp_sock = @fsockopen($server, $port, $errno, $errstr, $this->timeout);  | 
                                                        |
| 77 | -  | 
                                                        |
| 78 | -            if (!$this->ftp_sock || !$this->ftp_ok()) { | 
                                                        |
| 79 | -                $this->ftp_debug("Error : Cannot connect to remote host \"".$server.":".$port."\"\n"); | 
                                                        |
| 80 | -                $this->ftp_debug("Error : fsockopen() ".$errstr." (".$errno.")\n"); | 
                                                        |
| 81 | - return FALSE;  | 
                                                        |
| 82 | - }  | 
                                                        |
| 44 | + class ftp  | 
                                                        |
| 45 | +	{ | 
                                                        |
| 46 | + /* Public variables */  | 
                                                        |
| 47 | + var $debug;  | 
                                                        |
| 48 | + var $umask;  | 
                                                        |
| 49 | + var $timeout;  | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + /* Private variables */  | 
                                                        |
| 52 | + var $ftp_sock;  | 
                                                        |
| 53 | + var $ftp_resp;  | 
                                                        |
| 54 | +  | 
                                                        |
| 55 | + /* Constractor */  | 
                                                        |
| 56 | + function ftp()  | 
                                                        |
| 57 | +		{ | 
                                                        |
| 58 | + $this->debug = false;  | 
                                                        |
| 59 | + $this->umask = 0022;  | 
                                                        |
| 60 | + $this->timeout = 30;  | 
                                                        |
| 61 | +  | 
                                                        |
| 62 | +			if (!defined("FTP_BINARY")) { | 
                                                        |
| 63 | +				define("FTP_BINARY", 1); | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | +			if (!defined("FTP_ASCII")) { | 
                                                        |
| 66 | +				define("FTP_ASCII", 0); | 
                                                        |
| 67 | + }  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + $this->ftp_resp = "";  | 
                                                        |
| 70 | + }  | 
                                                        |
| 71 | +  | 
                                                        |
| 72 | + /* Public functions */  | 
                                                        |
| 73 | + function ftp_connect($server, $port = 21)  | 
                                                        |
| 74 | +		{ | 
                                                        |
| 75 | +			$this->ftp_debug("Trying to ".$server.":".$port." ...\n"); | 
                                                        |
| 76 | + $this->ftp_sock = @fsockopen($server, $port, $errno, $errstr, $this->timeout);  | 
                                                        |
| 77 | +  | 
                                                        |
| 78 | +			if (!$this->ftp_sock || !$this->ftp_ok()) { | 
                                                        |
| 79 | +				$this->ftp_debug("Error : Cannot connect to remote host \"".$server.":".$port."\"\n"); | 
                                                        |
| 80 | +				$this->ftp_debug("Error : fsockopen() ".$errstr." (".$errno.")\n"); | 
                                                        |
| 81 | + return FALSE;  | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | 83 | |
| 84 | 84 | if(substr($this->ftp_resp, 0, 3) !== '220')  | 
                                                        
| 85 | 85 |  			{ | 
                                                        
| 86 | 86 | return FALSE;  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
| 89 | -            $this->ftp_debug("Connected to remote host \"".$server.":".$port."\"\n"); | 
                                                        |
| 90 | -  | 
                                                        |
| 91 | - return TRUE;  | 
                                                        |
| 92 | - }  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | - function ftp_login($user, $pass)  | 
                                                        |
| 95 | -        { | 
                                                        |
| 96 | -            $this->ftp_putcmd("USER", $user); | 
                                                        |
| 97 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 98 | -                $this->ftp_debug("Error : USER command failed\n"); | 
                                                        |
| 99 | - return FALSE;  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | -            $this->ftp_putcmd("PASS", $pass); | 
                                                        |
| 103 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 104 | -                $this->ftp_debug("Error : PASS command failed\n"); | 
                                                        |
| 105 | - return FALSE;  | 
                                                        |
| 106 | - }  | 
                                                        |
| 107 | -            $this->ftp_debug("Authentication succeeded\n"); | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - return TRUE;  | 
                                                        |
| 110 | - }  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - function ftp_pwd()  | 
                                                        |
| 113 | -        { | 
                                                        |
| 114 | -            $this->ftp_putcmd("PWD"); | 
                                                        |
| 115 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 116 | -                $this->ftp_debug("Error : PWD command failed\n"); | 
                                                        |
| 117 | - return FALSE;  | 
                                                        |
| 118 | - }  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | -            return preg_replace("@^[0-9]{3} \"(.+)\" .+\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 121 | - }  | 
                                                        |
| 122 | -  | 
                                                        |
| 123 | - function ftp_size($pathname)  | 
                                                        |
| 124 | -        { | 
                                                        |
| 125 | -            $this->ftp_putcmd("SIZE", $pathname); | 
                                                        |
| 126 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 127 | -                $this->ftp_debug("Error : SIZE command failed\n"); | 
                                                        |
| 128 | - return -1;  | 
                                                        |
| 129 | - }  | 
                                                        |
| 130 | -  | 
                                                        |
| 131 | -            return preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 132 | - }  | 
                                                        |
| 133 | -  | 
                                                        |
| 134 | - function ftp_mdtm($pathname)  | 
                                                        |
| 135 | -        { | 
                                                        |
| 136 | -            $this->ftp_putcmd("MDTM", $pathname); | 
                                                        |
| 137 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 138 | -                $this->ftp_debug("Error : MDTM command failed\n"); | 
                                                        |
| 139 | - return -1;  | 
                                                        |
| 140 | - }  | 
                                                        |
| 141 | -            $mdtm = preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 142 | - $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");  | 
                                                        |
| 143 | - $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);  | 
                                                        |
| 144 | -  | 
                                                        |
| 145 | - return $timestamp;  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | -  | 
                                                        |
| 148 | - function ftp_systype()  | 
                                                        |
| 149 | -        { | 
                                                        |
| 150 | -            $this->ftp_putcmd("SYST"); | 
                                                        |
| 151 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 152 | -                $this->ftp_debug("Error : SYST command failed\n"); | 
                                                        |
| 153 | - return FALSE;  | 
                                                        |
| 154 | - }  | 
                                                        |
| 155 | -            $DATA = explode(" ", $this->ftp_resp); | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | - return $DATA[1];  | 
                                                        |
| 158 | - }  | 
                                                        |
| 159 | -  | 
                                                        |
| 160 | - function ftp_cdup()  | 
                                                        |
| 161 | -        { | 
                                                        |
| 162 | -            $this->ftp_putcmd("CDUP"); | 
                                                        |
| 163 | - $response = $this->ftp_ok();  | 
                                                        |
| 164 | -            if (!$response) { | 
                                                        |
| 165 | -                $this->ftp_debug("Error : CDUP command failed\n"); | 
                                                        |
| 166 | - }  | 
                                                        |
| 167 | - return $response;  | 
                                                        |
| 168 | - }  | 
                                                        |
| 169 | -  | 
                                                        |
| 170 | - function ftp_chdir($pathname)  | 
                                                        |
| 171 | -        { | 
                                                        |
| 172 | -            $this->ftp_putcmd("CWD", $pathname); | 
                                                        |
| 173 | - $response = $this->ftp_ok();  | 
                                                        |
| 174 | -            if (!$response) { | 
                                                        |
| 175 | -                $this->ftp_debug("Error : CWD command failed\n"); | 
                                                        |
| 176 | - }  | 
                                                        |
| 177 | - return $response;  | 
                                                        |
| 178 | - }  | 
                                                        |
| 179 | -  | 
                                                        |
| 180 | - function ftp_delete($pathname)  | 
                                                        |
| 181 | -        { | 
                                                        |
| 182 | -            $this->ftp_putcmd("DELE", $pathname); | 
                                                        |
| 183 | - $response = $this->ftp_ok();  | 
                                                        |
| 184 | -            if (!$response) { | 
                                                        |
| 185 | -                $this->ftp_debug("Error : DELE command failed\n"); | 
                                                        |
| 186 | - }  | 
                                                        |
| 187 | - return $response;  | 
                                                        |
| 188 | - }  | 
                                                        |
| 189 | -  | 
                                                        |
| 190 | - function ftp_rmdir($pathname)  | 
                                                        |
| 191 | -        { | 
                                                        |
| 192 | -            $this->ftp_putcmd("RMD", $pathname); | 
                                                        |
| 193 | - $response = $this->ftp_ok();  | 
                                                        |
| 194 | -            if (!$response) { | 
                                                        |
| 195 | -                $this->ftp_debug("Error : RMD command failed\n"); | 
                                                        |
| 196 | - }  | 
                                                        |
| 197 | - return $response;  | 
                                                        |
| 198 | - }  | 
                                                        |
| 199 | -  | 
                                                        |
| 200 | - function ftp_mkdir($pathname)  | 
                                                        |
| 201 | -        { | 
                                                        |
| 202 | -            $this->ftp_putcmd("MKD", $pathname); | 
                                                        |
| 203 | - $response = $this->ftp_ok();  | 
                                                        |
| 204 | -            if (!$response) { | 
                                                        |
| 205 | -                $this->ftp_debug("Error : MKD command failed\n"); | 
                                                        |
| 206 | - }  | 
                                                        |
| 207 | - return $response;  | 
                                                        |
| 208 | - }  | 
                                                        |
| 209 | -  | 
                                                        |
| 210 | - function ftp_file_exists($pathname)  | 
                                                        |
| 211 | -        { | 
                                                        |
| 212 | -            if (!($remote_list = $this->ftp_nlist("-a"))) { | 
                                                        |
| 213 | -                $this->ftp_debug("Error : Cannot get remote file list\n"); | 
                                                        |
| 214 | - return -1;  | 
                                                        |
| 215 | - }  | 
                                                        |
| 89 | +			$this->ftp_debug("Connected to remote host \"".$server.":".$port."\"\n"); | 
                                                        |
| 90 | +  | 
                                                        |
| 91 | + return TRUE;  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | + function ftp_login($user, $pass)  | 
                                                        |
| 95 | +		{ | 
                                                        |
| 96 | +			$this->ftp_putcmd("USER", $user); | 
                                                        |
| 97 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 98 | +				$this->ftp_debug("Error : USER command failed\n"); | 
                                                        |
| 99 | + return FALSE;  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | +			$this->ftp_putcmd("PASS", $pass); | 
                                                        |
| 103 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 104 | +				$this->ftp_debug("Error : PASS command failed\n"); | 
                                                        |
| 105 | + return FALSE;  | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | +			$this->ftp_debug("Authentication succeeded\n"); | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + return TRUE;  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + function ftp_pwd()  | 
                                                        |
| 113 | +		{ | 
                                                        |
| 114 | +			$this->ftp_putcmd("PWD"); | 
                                                        |
| 115 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 116 | +				$this->ftp_debug("Error : PWD command failed\n"); | 
                                                        |
| 117 | + return FALSE;  | 
                                                        |
| 118 | + }  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | +			return preg_replace("@^[0-9]{3} \"(.+)\" .+\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | +  | 
                                                        |
| 123 | + function ftp_size($pathname)  | 
                                                        |
| 124 | +		{ | 
                                                        |
| 125 | +			$this->ftp_putcmd("SIZE", $pathname); | 
                                                        |
| 126 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 127 | +				$this->ftp_debug("Error : SIZE command failed\n"); | 
                                                        |
| 128 | + return -1;  | 
                                                        |
| 129 | + }  | 
                                                        |
| 130 | +  | 
                                                        |
| 131 | +			return preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 132 | + }  | 
                                                        |
| 133 | +  | 
                                                        |
| 134 | + function ftp_mdtm($pathname)  | 
                                                        |
| 135 | +		{ | 
                                                        |
| 136 | +			$this->ftp_putcmd("MDTM", $pathname); | 
                                                        |
| 137 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 138 | +				$this->ftp_debug("Error : MDTM command failed\n"); | 
                                                        |
| 139 | + return -1;  | 
                                                        |
| 140 | + }  | 
                                                        |
| 141 | +			$mdtm = preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); | 
                                                        |
| 142 | + $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");  | 
                                                        |
| 143 | + $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);  | 
                                                        |
| 144 | +  | 
                                                        |
| 145 | + return $timestamp;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | +  | 
                                                        |
| 148 | + function ftp_systype()  | 
                                                        |
| 149 | +		{ | 
                                                        |
| 150 | +			$this->ftp_putcmd("SYST"); | 
                                                        |
| 151 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 152 | +				$this->ftp_debug("Error : SYST command failed\n"); | 
                                                        |
| 153 | + return FALSE;  | 
                                                        |
| 154 | + }  | 
                                                        |
| 155 | +			$DATA = explode(" ", $this->ftp_resp); | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | + return $DATA[1];  | 
                                                        |
| 158 | + }  | 
                                                        |
| 159 | +  | 
                                                        |
| 160 | + function ftp_cdup()  | 
                                                        |
| 161 | +		{ | 
                                                        |
| 162 | +			$this->ftp_putcmd("CDUP"); | 
                                                        |
| 163 | + $response = $this->ftp_ok();  | 
                                                        |
| 164 | +			if (!$response) { | 
                                                        |
| 165 | +				$this->ftp_debug("Error : CDUP command failed\n"); | 
                                                        |
| 166 | + }  | 
                                                        |
| 167 | + return $response;  | 
                                                        |
| 168 | + }  | 
                                                        |
| 169 | +  | 
                                                        |
| 170 | + function ftp_chdir($pathname)  | 
                                                        |
| 171 | +		{ | 
                                                        |
| 172 | +			$this->ftp_putcmd("CWD", $pathname); | 
                                                        |
| 173 | + $response = $this->ftp_ok();  | 
                                                        |
| 174 | +			if (!$response) { | 
                                                        |
| 175 | +				$this->ftp_debug("Error : CWD command failed\n"); | 
                                                        |
| 176 | + }  | 
                                                        |
| 177 | + return $response;  | 
                                                        |
| 178 | + }  | 
                                                        |
| 179 | +  | 
                                                        |
| 180 | + function ftp_delete($pathname)  | 
                                                        |
| 181 | +		{ | 
                                                        |
| 182 | +			$this->ftp_putcmd("DELE", $pathname); | 
                                                        |
| 183 | + $response = $this->ftp_ok();  | 
                                                        |
| 184 | +			if (!$response) { | 
                                                        |
| 185 | +				$this->ftp_debug("Error : DELE command failed\n"); | 
                                                        |
| 186 | + }  | 
                                                        |
| 187 | + return $response;  | 
                                                        |
| 188 | + }  | 
                                                        |
| 189 | +  | 
                                                        |
| 190 | + function ftp_rmdir($pathname)  | 
                                                        |
| 191 | +		{ | 
                                                        |
| 192 | +			$this->ftp_putcmd("RMD", $pathname); | 
                                                        |
| 193 | + $response = $this->ftp_ok();  | 
                                                        |
| 194 | +			if (!$response) { | 
                                                        |
| 195 | +				$this->ftp_debug("Error : RMD command failed\n"); | 
                                                        |
| 196 | + }  | 
                                                        |
| 197 | + return $response;  | 
                                                        |
| 198 | + }  | 
                                                        |
| 199 | +  | 
                                                        |
| 200 | + function ftp_mkdir($pathname)  | 
                                                        |
| 201 | +		{ | 
                                                        |
| 202 | +			$this->ftp_putcmd("MKD", $pathname); | 
                                                        |
| 203 | + $response = $this->ftp_ok();  | 
                                                        |
| 204 | +			if (!$response) { | 
                                                        |
| 205 | +				$this->ftp_debug("Error : MKD command failed\n"); | 
                                                        |
| 206 | + }  | 
                                                        |
| 207 | + return $response;  | 
                                                        |
| 208 | + }  | 
                                                        |
| 209 | +  | 
                                                        |
| 210 | + function ftp_file_exists($pathname)  | 
                                                        |
| 211 | +		{ | 
                                                        |
| 212 | +			if (!($remote_list = $this->ftp_nlist("-a"))) { | 
                                                        |
| 213 | +				$this->ftp_debug("Error : Cannot get remote file list\n"); | 
                                                        |
| 214 | + return -1;  | 
                                                        |
| 215 | + }  | 
                                                        |
| 216 | 216 | |
| 217 | - reset($remote_list);  | 
                                                        |
| 218 | -            while (list(,$value) = each($remote_list)) { | 
                                                        |
| 219 | -                if ($value == $pathname) { | 
                                                        |
| 220 | -                    $this->ftp_debug("Remote file ".$pathname." exists\n"); | 
                                                        |
| 221 | - return 1;  | 
                                                        |
| 222 | - }  | 
                                                        |
| 223 | - }  | 
                                                        |
| 224 | -            $this->ftp_debug("Remote file ".$pathname." does not exist\n"); | 
                                                        |
| 225 | -  | 
                                                        |
| 226 | - return 0;  | 
                                                        |
| 227 | - }  | 
                                                        |
| 228 | -  | 
                                                        |
| 229 | - function ftp_rename($from, $to)  | 
                                                        |
| 230 | -        { | 
                                                        |
| 231 | -            $this->ftp_putcmd("RNFR", $from); | 
                                                        |
| 232 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 233 | -                $this->ftp_debug("Error : RNFR command failed\n"); | 
                                                        |
| 234 | - return FALSE;  | 
                                                        |
| 235 | - }  | 
                                                        |
| 236 | -            $this->ftp_putcmd("RNTO", $to); | 
                                                        |
| 237 | -  | 
                                                        |
| 238 | - $response = $this->ftp_ok();  | 
                                                        |
| 239 | -            if (!$response) { | 
                                                        |
| 240 | -                $this->ftp_debug("Error : RNTO command failed\n"); | 
                                                        |
| 241 | - }  | 
                                                        |
| 242 | - return $response;  | 
                                                        |
| 243 | - }  | 
                                                        |
| 244 | -  | 
                                                        |
| 245 | - function ftp_nlist($arg = "", $pathname = "")  | 
                                                        |
| 246 | -        { | 
                                                        |
| 247 | -            if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 248 | - return FALSE;  | 
                                                        |
| 249 | - }  | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | -            if ($arg == "") { | 
                                                        |
| 252 | - $nlst = "NLST";  | 
                                                        |
| 253 | -            } else { | 
                                                        |
| 254 | - $nlst = "NLST ".$arg;  | 
                                                        |
| 255 | - }  | 
                                                        |
| 256 | - $this->ftp_putcmd($nlst, $pathname);  | 
                                                        |
| 257 | -  | 
                                                        |
| 258 | - $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 259 | -            if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 260 | -                $this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 261 | -                $this->ftp_debug("Error : NLST command failed\n"); | 
                                                        |
| 262 | - return FALSE;  | 
                                                        |
| 263 | - }  | 
                                                        |
| 264 | -            $this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 217 | + reset($remote_list);  | 
                                                        |
| 218 | +			while (list(,$value) = each($remote_list)) { | 
                                                        |
| 219 | +				if ($value == $pathname) { | 
                                                        |
| 220 | +					$this->ftp_debug("Remote file ".$pathname." exists\n"); | 
                                                        |
| 221 | + return 1;  | 
                                                        |
| 222 | + }  | 
                                                        |
| 223 | + }  | 
                                                        |
| 224 | +			$this->ftp_debug("Remote file ".$pathname." does not exist\n"); | 
                                                        |
| 225 | +  | 
                                                        |
| 226 | + return 0;  | 
                                                        |
| 227 | + }  | 
                                                        |
| 228 | +  | 
                                                        |
| 229 | + function ftp_rename($from, $to)  | 
                                                        |
| 230 | +		{ | 
                                                        |
| 231 | +			$this->ftp_putcmd("RNFR", $from); | 
                                                        |
| 232 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 233 | +				$this->ftp_debug("Error : RNFR command failed\n"); | 
                                                        |
| 234 | + return FALSE;  | 
                                                        |
| 235 | + }  | 
                                                        |
| 236 | +			$this->ftp_putcmd("RNTO", $to); | 
                                                        |
| 237 | +  | 
                                                        |
| 238 | + $response = $this->ftp_ok();  | 
                                                        |
| 239 | +			if (!$response) { | 
                                                        |
| 240 | +				$this->ftp_debug("Error : RNTO command failed\n"); | 
                                                        |
| 241 | + }  | 
                                                        |
| 242 | + return $response;  | 
                                                        |
| 243 | + }  | 
                                                        |
| 244 | +  | 
                                                        |
| 245 | + function ftp_nlist($arg = "", $pathname = "")  | 
                                                        |
| 246 | +		{ | 
                                                        |
| 247 | +			if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 248 | + return FALSE;  | 
                                                        |
| 249 | + }  | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | +			if ($arg == "") { | 
                                                        |
| 252 | + $nlst = "NLST";  | 
                                                        |
| 253 | +			} else { | 
                                                        |
| 254 | + $nlst = "NLST ".$arg;  | 
                                                        |
| 255 | + }  | 
                                                        |
| 256 | + $this->ftp_putcmd($nlst, $pathname);  | 
                                                        |
| 257 | +  | 
                                                        |
| 258 | + $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 259 | +			if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 260 | +				$this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 261 | +				$this->ftp_debug("Error : NLST command failed\n"); | 
                                                        |
| 262 | + return FALSE;  | 
                                                        |
| 263 | + }  | 
                                                        |
| 264 | +			$this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 265 | 265 | |
| 266 | 266 | $list = array();  | 
                                                        
| 267 | -            while (!feof($sock_data)) { | 
                                                        |
| 268 | -                $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); | 
                                                        |
| 269 | - }  | 
                                                        |
| 270 | - $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 271 | -            $this->ftp_debug(implode("\n", $list)); | 
                                                        |
| 272 | -  | 
                                                        |
| 273 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 274 | -                $this->ftp_debug("Error : NLST command failed\n"); | 
                                                        |
| 275 | - return FALSE;  | 
                                                        |
| 276 | - }  | 
                                                        |
| 277 | -  | 
                                                        |
| 278 | - return $list;  | 
                                                        |
| 279 | - }  | 
                                                        |
| 280 | -  | 
                                                        |
| 281 | - function ftp_rawlist($pathname = "")  | 
                                                        |
| 282 | -        { | 
                                                        |
| 283 | -            if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 284 | - return FALSE;  | 
                                                        |
| 285 | - }  | 
                                                        |
| 286 | -  | 
                                                        |
| 287 | -            $this->ftp_putcmd("LIST", $pathname); | 
                                                        |
| 288 | -  | 
                                                        |
| 289 | - $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 290 | -            if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 291 | -                $this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 292 | -                $this->ftp_debug("Error : LIST command failed\n"); | 
                                                        |
| 293 | - return FALSE;  | 
                                                        |
| 294 | - }  | 
                                                        |
| 295 | -  | 
                                                        |
| 296 | -            $this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 297 | -  | 
                                                        |
| 298 | -            while (!feof($sock_data)) { | 
                                                        |
| 299 | -                $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); | 
                                                        |
| 300 | - }  | 
                                                        |
| 301 | -            $this->ftp_debug(implode("\n", $list)); | 
                                                        |
| 302 | - $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 303 | -  | 
                                                        |
| 304 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 305 | -                $this->ftp_debug("Error : LIST command failed\n"); | 
                                                        |
| 306 | - return FALSE;  | 
                                                        |
| 307 | - }  | 
                                                        |
| 308 | -  | 
                                                        |
| 309 | - return $list;  | 
                                                        |
| 310 | - }  | 
                                                        |
| 311 | -  | 
                                                        |
| 312 | - function ftp_get($localfile, $remotefile, $mode = 1)  | 
                                                        |
| 313 | -        { | 
                                                        |
| 314 | - umask($this->umask);  | 
                                                        |
| 315 | -  | 
                                                        |
| 316 | -            if (@file_exists($localfile)) { | 
                                                        |
| 317 | -                $this->ftp_debug("Warning : local file will be overwritten\n"); | 
                                                        |
| 318 | - }  | 
                                                        |
| 319 | -  | 
                                                        |
| 320 | - $fp = @fopen($localfile, "w");  | 
                                                        |
| 321 | -            if (!$fp) { | 
                                                        |
| 322 | -                $this->ftp_debug("Error : Cannot create \"".$localfile."\""); | 
                                                        |
| 323 | -                $this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 324 | - return FALSE;  | 
                                                        |
| 325 | - }  | 
                                                        |
| 326 | -  | 
                                                        |
| 327 | -            if (!$this->ftp_type($mode)) { | 
                                                        |
| 328 | -                $this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 329 | - return FALSE;  | 
                                                        |
| 330 | - }  | 
                                                        |
| 331 | -  | 
                                                        |
| 332 | -            if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 333 | -                $this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 334 | - return FALSE;  | 
                                                        |
| 335 | - }  | 
                                                        |
| 336 | -  | 
                                                        |
| 337 | -            $this->ftp_putcmd("RETR", $remotefile); | 
                                                        |
| 338 | -  | 
                                                        |
| 339 | - $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 340 | -            if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 341 | -                $this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 342 | -                $this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 343 | - return FALSE;  | 
                                                        |
| 344 | - }  | 
                                                        |
| 345 | -            $this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 346 | -            $this->ftp_debug("Retrieving remote file \"".$remotefile."\" to local file \"".$localfile."\"\n"); | 
                                                        |
| 347 | -            while (!feof($sock_data)) { | 
                                                        |
| 348 | - fputs($fp, fread($sock_data, 4096));  | 
                                                        |
| 349 | - }  | 
                                                        |
| 350 | - fclose($fp);  | 
                                                        |
| 351 | -  | 
                                                        |
| 352 | - $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 353 | -  | 
                                                        |
| 354 | - $response = $this->ftp_ok();  | 
                                                        |
| 355 | -            if (!$response) { | 
                                                        |
| 356 | -                $this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 357 | - }  | 
                                                        |
| 358 | - return $response;  | 
                                                        |
| 359 | - }  | 
                                                        |
| 360 | -  | 
                                                        |
| 361 | - function ftp_put($remotefile, $localfile, $mode = 1)  | 
                                                        |
| 362 | -        { | 
                                                        |
| 267 | +			while (!feof($sock_data)) { | 
                                                        |
| 268 | +				$list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); | 
                                                        |
| 269 | + }  | 
                                                        |
| 270 | + $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 271 | +			$this->ftp_debug(implode("\n", $list)); | 
                                                        |
| 272 | +  | 
                                                        |
| 273 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 274 | +				$this->ftp_debug("Error : NLST command failed\n"); | 
                                                        |
| 275 | + return FALSE;  | 
                                                        |
| 276 | + }  | 
                                                        |
| 277 | +  | 
                                                        |
| 278 | + return $list;  | 
                                                        |
| 279 | + }  | 
                                                        |
| 280 | +  | 
                                                        |
| 281 | + function ftp_rawlist($pathname = "")  | 
                                                        |
| 282 | +		{ | 
                                                        |
| 283 | +			if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 284 | + return FALSE;  | 
                                                        |
| 285 | + }  | 
                                                        |
| 286 | +  | 
                                                        |
| 287 | +			$this->ftp_putcmd("LIST", $pathname); | 
                                                        |
| 288 | +  | 
                                                        |
| 289 | + $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 290 | +			if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 291 | +				$this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 292 | +				$this->ftp_debug("Error : LIST command failed\n"); | 
                                                        |
| 293 | + return FALSE;  | 
                                                        |
| 294 | + }  | 
                                                        |
| 295 | +  | 
                                                        |
| 296 | +			$this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 297 | +  | 
                                                        |
| 298 | +			while (!feof($sock_data)) { | 
                                                        |
| 299 | +				$list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); | 
                                                        |
| 300 | + }  | 
                                                        |
| 301 | +			$this->ftp_debug(implode("\n", $list)); | 
                                                        |
| 302 | + $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 303 | +  | 
                                                        |
| 304 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 305 | +				$this->ftp_debug("Error : LIST command failed\n"); | 
                                                        |
| 306 | + return FALSE;  | 
                                                        |
| 307 | + }  | 
                                                        |
| 308 | +  | 
                                                        |
| 309 | + return $list;  | 
                                                        |
| 310 | + }  | 
                                                        |
| 311 | +  | 
                                                        |
| 312 | + function ftp_get($localfile, $remotefile, $mode = 1)  | 
                                                        |
| 313 | +		{ | 
                                                        |
| 314 | + umask($this->umask);  | 
                                                        |
| 315 | +  | 
                                                        |
| 316 | +			if (@file_exists($localfile)) { | 
                                                        |
| 317 | +				$this->ftp_debug("Warning : local file will be overwritten\n"); | 
                                                        |
| 318 | + }  | 
                                                        |
| 319 | +  | 
                                                        |
| 320 | + $fp = @fopen($localfile, "w");  | 
                                                        |
| 321 | +			if (!$fp) { | 
                                                        |
| 322 | +				$this->ftp_debug("Error : Cannot create \"".$localfile."\""); | 
                                                        |
| 323 | +				$this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 324 | + return FALSE;  | 
                                                        |
| 325 | + }  | 
                                                        |
| 326 | +  | 
                                                        |
| 327 | +			if (!$this->ftp_type($mode)) { | 
                                                        |
| 328 | +				$this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 329 | + return FALSE;  | 
                                                        |
| 330 | + }  | 
                                                        |
| 331 | +  | 
                                                        |
| 332 | +			if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 333 | +				$this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 334 | + return FALSE;  | 
                                                        |
| 335 | + }  | 
                                                        |
| 336 | +  | 
                                                        |
| 337 | +			$this->ftp_putcmd("RETR", $remotefile); | 
                                                        |
| 338 | +  | 
                                                        |
| 339 | + $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 340 | +			if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 341 | +				$this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 342 | +				$this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 343 | + return FALSE;  | 
                                                        |
| 344 | + }  | 
                                                        |
| 345 | +			$this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 346 | +			$this->ftp_debug("Retrieving remote file \"".$remotefile."\" to local file \"".$localfile."\"\n"); | 
                                                        |
| 347 | +			while (!feof($sock_data)) { | 
                                                        |
| 348 | + fputs($fp, fread($sock_data, 4096));  | 
                                                        |
| 349 | + }  | 
                                                        |
| 350 | + fclose($fp);  | 
                                                        |
| 351 | +  | 
                                                        |
| 352 | + $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 353 | +  | 
                                                        |
| 354 | + $response = $this->ftp_ok();  | 
                                                        |
| 355 | +			if (!$response) { | 
                                                        |
| 356 | +				$this->ftp_debug("Error : GET command failed\n"); | 
                                                        |
| 357 | + }  | 
                                                        |
| 358 | + return $response;  | 
                                                        |
| 359 | + }  | 
                                                        |
| 360 | +  | 
                                                        |
| 361 | + function ftp_put($remotefile, $localfile, $mode = 1)  | 
                                                        |
| 362 | +		{ | 
                                                        |
| 363 | 363 | |
| 364 | -            if (!@file_exists($localfile)) { | 
                                                        |
| 365 | -                $this->ftp_debug("Error : No such file or directory \"".$localfile."\"\n"); | 
                                                        |
| 366 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 367 | - return FALSE;  | 
                                                        |
| 368 | - }  | 
                                                        |
| 369 | -  | 
                                                        |
| 370 | - $fp = @fopen($localfile, "r");  | 
                                                        |
| 371 | -            if (!$fp) { | 
                                                        |
| 372 | -                $this->ftp_debug("Error : Cannot read file \"".$localfile."\"\n"); | 
                                                        |
| 373 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 374 | - return FALSE;  | 
                                                        |
| 375 | - }  | 
                                                        |
| 376 | -  | 
                                                        |
| 377 | -            if (!$this->ftp_type($mode)) { | 
                                                        |
| 378 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 379 | - return FALSE;  | 
                                                        |
| 380 | - }  | 
                                                        |
| 381 | -  | 
                                                        |
| 382 | -            if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 383 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 384 | - return FALSE;  | 
                                                        |
| 385 | - }  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | -            $this->ftp_putcmd("STOR", $remotefile); | 
                                                        |
| 388 | -  | 
                                                        |
| 389 | - $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 390 | -            if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 391 | -                $this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 392 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 393 | - return FALSE;  | 
                                                        |
| 394 | - }  | 
                                                        |
| 395 | -            $this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 396 | -            $this->ftp_debug("Storing local file \"".$localfile."\" to remote file \"".$remotefile."\"\n"); | 
                                                        |
| 397 | -            while (!feof($fp)) { | 
                                                        |
| 398 | - fputs($sock_data, fread($fp, 4096));  | 
                                                        |
| 399 | - }  | 
                                                        |
| 400 | - fclose($fp);  | 
                                                        |
| 401 | -  | 
                                                        |
| 402 | - $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 403 | -  | 
                                                        |
| 404 | - $response = $this->ftp_ok();  | 
                                                        |
| 405 | -            if (!$response) { | 
                                                        |
| 406 | -                $this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 407 | - }  | 
                                                        |
| 408 | - return $response;  | 
                                                        |
| 409 | - }  | 
                                                        |
| 410 | -  | 
                                                        |
| 411 | - function ftp_site($command)  | 
                                                        |
| 412 | -        { | 
                                                        |
| 413 | -            $this->ftp_putcmd("SITE", $command); | 
                                                        |
| 414 | - $response = $this->ftp_ok();  | 
                                                        |
| 415 | -            if (!$response) { | 
                                                        |
| 416 | -                $this->ftp_debug("Error : SITE command failed\n"); | 
                                                        |
| 417 | - }  | 
                                                        |
| 418 | - return $response;  | 
                                                        |
| 419 | - }  | 
                                                        |
| 420 | -  | 
                                                        |
| 421 | - function ftp_quit()  | 
                                                        |
| 422 | -        { | 
                                                        |
| 423 | -            $this->ftp_putcmd("QUIT"); | 
                                                        |
| 424 | -            if (!$this->ftp_ok() || !fclose($this->ftp_sock)) { | 
                                                        |
| 425 | -                $this->ftp_debug("Error : QUIT command failed\n"); | 
                                                        |
| 426 | - return FALSE;  | 
                                                        |
| 427 | - }  | 
                                                        |
| 428 | -            $this->ftp_debug("Disconnected from remote host\n"); | 
                                                        |
| 429 | - return TRUE;  | 
                                                        |
| 430 | - }  | 
                                                        |
| 431 | -  | 
                                                        |
| 432 | - /* Private Functions */  | 
                                                        |
| 433 | -  | 
                                                        |
| 434 | - function ftp_type($mode)  | 
                                                        |
| 435 | -        { | 
                                                        |
| 436 | -            if ($mode) { | 
                                                        |
| 437 | - $type = "I"; //Binary mode  | 
                                                        |
| 438 | -            } else { | 
                                                        |
| 439 | - $type = "A"; //ASCII mode  | 
                                                        |
| 440 | - }  | 
                                                        |
| 441 | -            $this->ftp_putcmd("TYPE", $type); | 
                                                        |
| 442 | - $response = $this->ftp_ok();  | 
                                                        |
| 443 | -            if (!$response) { | 
                                                        |
| 444 | -                $this->ftp_debug("Error : TYPE command failed\n"); | 
                                                        |
| 445 | - }  | 
                                                        |
| 446 | - return $response;  | 
                                                        |
| 447 | - }  | 
                                                        |
| 448 | -  | 
                                                        |
| 449 | - function ftp_port($ip_port)  | 
                                                        |
| 450 | -        { | 
                                                        |
| 451 | -            $this->ftp_putcmd("PORT", $ip_port); | 
                                                        |
| 452 | - $response = $this->ftp_ok();  | 
                                                        |
| 453 | -            if (!$response) { | 
                                                        |
| 454 | -                $this->ftp_debug("Error : PORT command failed\n"); | 
                                                        |
| 455 | - }  | 
                                                        |
| 456 | - return $response;  | 
                                                        |
| 457 | - }  | 
                                                        |
| 458 | -  | 
                                                        |
| 459 | - function ftp_pasv()  | 
                                                        |
| 460 | -        { | 
                                                        |
| 461 | -            $this->ftp_putcmd("PASV"); | 
                                                        |
| 462 | -            if (!$this->ftp_ok()) { | 
                                                        |
| 463 | -                $this->ftp_debug("Error : PASV command failed\n"); | 
                                                        |
| 464 | - return FALSE;  | 
                                                        |
| 465 | - }  | 
                                                        |
| 466 | -  | 
                                                        |
| 467 | -            $ip_port = preg_replace("@^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$@", "\\1", $this->ftp_resp); | 
                                                        |
| 468 | - return $ip_port;  | 
                                                        |
| 469 | - }  | 
                                                        |
| 470 | -  | 
                                                        |
| 471 | - function ftp_putcmd($cmd, $arg = "")  | 
                                                        |
| 472 | -        { | 
                                                        |
| 473 | -            if ($arg != "") { | 
                                                        |
| 474 | - $cmd = $cmd." ".$arg;  | 
                                                        |
| 475 | - }  | 
                                                        |
| 476 | -  | 
                                                        |
| 477 | - fputs($this->ftp_sock, $cmd."\r\n");  | 
                                                        |
| 478 | -            $this->ftp_debug("> ".$cmd."\n"); | 
                                                        |
| 479 | -  | 
                                                        |
| 480 | - return TRUE;  | 
                                                        |
| 481 | - }  | 
                                                        |
| 482 | -  | 
                                                        |
| 483 | - function ftp_ok()  | 
                                                        |
| 484 | -        { | 
                                                        |
| 485 | - $this->ftp_resp = "";  | 
                                                        |
| 364 | +			if (!@file_exists($localfile)) { | 
                                                        |
| 365 | +				$this->ftp_debug("Error : No such file or directory \"".$localfile."\"\n"); | 
                                                        |
| 366 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 367 | + return FALSE;  | 
                                                        |
| 368 | + }  | 
                                                        |
| 369 | +  | 
                                                        |
| 370 | + $fp = @fopen($localfile, "r");  | 
                                                        |
| 371 | +			if (!$fp) { | 
                                                        |
| 372 | +				$this->ftp_debug("Error : Cannot read file \"".$localfile."\"\n"); | 
                                                        |
| 373 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 374 | + return FALSE;  | 
                                                        |
| 375 | + }  | 
                                                        |
| 376 | +  | 
                                                        |
| 377 | +			if (!$this->ftp_type($mode)) { | 
                                                        |
| 378 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 379 | + return FALSE;  | 
                                                        |
| 380 | + }  | 
                                                        |
| 381 | +  | 
                                                        |
| 382 | +			if (!($string = $this->ftp_pasv())) { | 
                                                        |
| 383 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 384 | + return FALSE;  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | +			$this->ftp_putcmd("STOR", $remotefile); | 
                                                        |
| 388 | +  | 
                                                        |
| 389 | + $sock_data = $this->ftp_open_data_connection($string);  | 
                                                        |
| 390 | +			if (!$sock_data || !$this->ftp_ok()) { | 
                                                        |
| 391 | +				$this->ftp_debug("Error : Cannot connect to remote host\n"); | 
                                                        |
| 392 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 393 | + return FALSE;  | 
                                                        |
| 394 | + }  | 
                                                        |
| 395 | +			$this->ftp_debug("Connected to remote host\n"); | 
                                                        |
| 396 | +			$this->ftp_debug("Storing local file \"".$localfile."\" to remote file \"".$remotefile."\"\n"); | 
                                                        |
| 397 | +			while (!feof($fp)) { | 
                                                        |
| 398 | + fputs($sock_data, fread($fp, 4096));  | 
                                                        |
| 399 | + }  | 
                                                        |
| 400 | + fclose($fp);  | 
                                                        |
| 401 | +  | 
                                                        |
| 402 | + $this->ftp_close_data_connection($sock_data);  | 
                                                        |
| 403 | +  | 
                                                        |
| 404 | + $response = $this->ftp_ok();  | 
                                                        |
| 405 | +			if (!$response) { | 
                                                        |
| 406 | +				$this->ftp_debug("Error : PUT command failed\n"); | 
                                                        |
| 407 | + }  | 
                                                        |
| 408 | + return $response;  | 
                                                        |
| 409 | + }  | 
                                                        |
| 410 | +  | 
                                                        |
| 411 | + function ftp_site($command)  | 
                                                        |
| 412 | +		{ | 
                                                        |
| 413 | +			$this->ftp_putcmd("SITE", $command); | 
                                                        |
| 414 | + $response = $this->ftp_ok();  | 
                                                        |
| 415 | +			if (!$response) { | 
                                                        |
| 416 | +				$this->ftp_debug("Error : SITE command failed\n"); | 
                                                        |
| 417 | + }  | 
                                                        |
| 418 | + return $response;  | 
                                                        |
| 419 | + }  | 
                                                        |
| 420 | +  | 
                                                        |
| 421 | + function ftp_quit()  | 
                                                        |
| 422 | +		{ | 
                                                        |
| 423 | +			$this->ftp_putcmd("QUIT"); | 
                                                        |
| 424 | +			if (!$this->ftp_ok() || !fclose($this->ftp_sock)) { | 
                                                        |
| 425 | +				$this->ftp_debug("Error : QUIT command failed\n"); | 
                                                        |
| 426 | + return FALSE;  | 
                                                        |
| 427 | + }  | 
                                                        |
| 428 | +			$this->ftp_debug("Disconnected from remote host\n"); | 
                                                        |
| 429 | + return TRUE;  | 
                                                        |
| 430 | + }  | 
                                                        |
| 431 | +  | 
                                                        |
| 432 | + /* Private Functions */  | 
                                                        |
| 433 | +  | 
                                                        |
| 434 | + function ftp_type($mode)  | 
                                                        |
| 435 | +		{ | 
                                                        |
| 436 | +			if ($mode) { | 
                                                        |
| 437 | + $type = "I"; //Binary mode  | 
                                                        |
| 438 | +			} else { | 
                                                        |
| 439 | + $type = "A"; //ASCII mode  | 
                                                        |
| 440 | + }  | 
                                                        |
| 441 | +			$this->ftp_putcmd("TYPE", $type); | 
                                                        |
| 442 | + $response = $this->ftp_ok();  | 
                                                        |
| 443 | +			if (!$response) { | 
                                                        |
| 444 | +				$this->ftp_debug("Error : TYPE command failed\n"); | 
                                                        |
| 445 | + }  | 
                                                        |
| 446 | + return $response;  | 
                                                        |
| 447 | + }  | 
                                                        |
| 448 | +  | 
                                                        |
| 449 | + function ftp_port($ip_port)  | 
                                                        |
| 450 | +		{ | 
                                                        |
| 451 | +			$this->ftp_putcmd("PORT", $ip_port); | 
                                                        |
| 452 | + $response = $this->ftp_ok();  | 
                                                        |
| 453 | +			if (!$response) { | 
                                                        |
| 454 | +				$this->ftp_debug("Error : PORT command failed\n"); | 
                                                        |
| 455 | + }  | 
                                                        |
| 456 | + return $response;  | 
                                                        |
| 457 | + }  | 
                                                        |
| 458 | +  | 
                                                        |
| 459 | + function ftp_pasv()  | 
                                                        |
| 460 | +		{ | 
                                                        |
| 461 | +			$this->ftp_putcmd("PASV"); | 
                                                        |
| 462 | +			if (!$this->ftp_ok()) { | 
                                                        |
| 463 | +				$this->ftp_debug("Error : PASV command failed\n"); | 
                                                        |
| 464 | + return FALSE;  | 
                                                        |
| 465 | + }  | 
                                                        |
| 466 | +  | 
                                                        |
| 467 | +			$ip_port = preg_replace("@^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$@", "\\1", $this->ftp_resp); | 
                                                        |
| 468 | + return $ip_port;  | 
                                                        |
| 469 | + }  | 
                                                        |
| 470 | +  | 
                                                        |
| 471 | + function ftp_putcmd($cmd, $arg = "")  | 
                                                        |
| 472 | +		{ | 
                                                        |
| 473 | +			if ($arg != "") { | 
                                                        |
| 474 | + $cmd = $cmd." ".$arg;  | 
                                                        |
| 475 | + }  | 
                                                        |
| 476 | +  | 
                                                        |
| 477 | + fputs($this->ftp_sock, $cmd."\r\n");  | 
                                                        |
| 478 | +			$this->ftp_debug("> ".$cmd."\n"); | 
                                                        |
| 479 | +  | 
                                                        |
| 480 | + return TRUE;  | 
                                                        |
| 481 | + }  | 
                                                        |
| 482 | +  | 
                                                        |
| 483 | + function ftp_ok()  | 
                                                        |
| 484 | +		{ | 
                                                        |
| 485 | + $this->ftp_resp = "";  | 
                                                        |
| 486 | 486 | |
| 487 | 487 | // 한줄을 읽는다.  | 
                                                        
| 488 | 488 | $line = '';  | 
                                                        
@@ -521,49 +521,49 @@ discard block  | 
                                                    ||
| 521 | 521 | }while($line);  | 
                                                        
| 522 | 522 | }  | 
                                                        
| 523 | 523 | |
| 524 | -            $this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp)); | 
                                                        |
| 525 | -  | 
                                                        |
| 526 | -            if (!preg_match("@^[123]@", $this->ftp_resp)) { | 
                                                        |
| 527 | - return FALSE;  | 
                                                        |
| 528 | - }  | 
                                                        |
| 529 | -  | 
                                                        |
| 530 | - return TRUE;  | 
                                                        |
| 531 | - }  | 
                                                        |
| 532 | -  | 
                                                        |
| 533 | - function ftp_close_data_connection($sock)  | 
                                                        |
| 534 | -        { | 
                                                        |
| 535 | -            $this->ftp_debug("Disconnected from remote host\n"); | 
                                                        |
| 536 | - return fclose($sock);  | 
                                                        |
| 537 | - }  | 
                                                        |
| 538 | -  | 
                                                        |
| 539 | - function ftp_open_data_connection($ip_port)  | 
                                                        |
| 540 | -        { | 
                                                        |
| 541 | -            if (!preg_match("@[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+@", $ip_port)) { | 
                                                        |
| 542 | -                $this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n"); | 
                                                        |
| 543 | - return FALSE;  | 
                                                        |
| 544 | - }  | 
                                                        |
| 545 | -  | 
                                                        |
| 546 | -            $DATA = explode(",", $ip_port); | 
                                                        |
| 547 | - $ipaddr = $DATA[0].".".$DATA[1].".".$DATA[2].".".$DATA[3];  | 
                                                        |
| 548 | - $port = $DATA[4]*256 + $DATA[5];  | 
                                                        |
| 549 | -            $this->ftp_debug("Trying to ".$ipaddr.":".$port." ...\n"); | 
                                                        |
| 550 | - $data_connection = @fsockopen($ipaddr, $port, $errno, $errstr);  | 
                                                        |
| 551 | -            if (!$data_connection) { | 
                                                        |
| 552 | -                $this->ftp_debug("Error : Cannot open data connection to ".$ipaddr.":".$port."\n"); | 
                                                        |
| 553 | -                $this->ftp_debug("Error : ".$errstr." (".$errno.")\n"); | 
                                                        |
| 554 | - return FALSE;  | 
                                                        |
| 555 | - }  | 
                                                        |
| 556 | -  | 
                                                        |
| 557 | - return $data_connection;  | 
                                                        |
| 558 | - }  | 
                                                        |
| 559 | -  | 
                                                        |
| 560 | - function ftp_debug($message = "")  | 
                                                        |
| 561 | -        { | 
                                                        |
| 562 | -            if ($this->debug) { | 
                                                        |
| 563 | - echo $message;  | 
                                                        |
| 564 | - }  | 
                                                        |
| 565 | -  | 
                                                        |
| 566 | - return TRUE;  | 
                                                        |
| 567 | - }  | 
                                                        |
| 568 | - }  | 
                                                        |
| 524 | +			$this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp)); | 
                                                        |
| 525 | +  | 
                                                        |
| 526 | +			if (!preg_match("@^[123]@", $this->ftp_resp)) { | 
                                                        |
| 527 | + return FALSE;  | 
                                                        |
| 528 | + }  | 
                                                        |
| 529 | +  | 
                                                        |
| 530 | + return TRUE;  | 
                                                        |
| 531 | + }  | 
                                                        |
| 532 | +  | 
                                                        |
| 533 | + function ftp_close_data_connection($sock)  | 
                                                        |
| 534 | +		{ | 
                                                        |
| 535 | +			$this->ftp_debug("Disconnected from remote host\n"); | 
                                                        |
| 536 | + return fclose($sock);  | 
                                                        |
| 537 | + }  | 
                                                        |
| 538 | +  | 
                                                        |
| 539 | + function ftp_open_data_connection($ip_port)  | 
                                                        |
| 540 | +		{ | 
                                                        |
| 541 | +			if (!preg_match("@[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+@", $ip_port)) { | 
                                                        |
| 542 | +				$this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n"); | 
                                                        |
| 543 | + return FALSE;  | 
                                                        |
| 544 | + }  | 
                                                        |
| 545 | +  | 
                                                        |
| 546 | +			$DATA = explode(",", $ip_port); | 
                                                        |
| 547 | + $ipaddr = $DATA[0].".".$DATA[1].".".$DATA[2].".".$DATA[3];  | 
                                                        |
| 548 | + $port = $DATA[4]*256 + $DATA[5];  | 
                                                        |
| 549 | +			$this->ftp_debug("Trying to ".$ipaddr.":".$port." ...\n"); | 
                                                        |
| 550 | + $data_connection = @fsockopen($ipaddr, $port, $errno, $errstr);  | 
                                                        |
| 551 | +			if (!$data_connection) { | 
                                                        |
| 552 | +				$this->ftp_debug("Error : Cannot open data connection to ".$ipaddr.":".$port."\n"); | 
                                                        |
| 553 | +				$this->ftp_debug("Error : ".$errstr." (".$errno.")\n"); | 
                                                        |
| 554 | + return FALSE;  | 
                                                        |
| 555 | + }  | 
                                                        |
| 556 | +  | 
                                                        |
| 557 | + return $data_connection;  | 
                                                        |
| 558 | + }  | 
                                                        |
| 559 | +  | 
                                                        |
| 560 | + function ftp_debug($message = "")  | 
                                                        |
| 561 | +		{ | 
                                                        |
| 562 | +			if ($this->debug) { | 
                                                        |
| 563 | + echo $message;  | 
                                                        |
| 564 | + }  | 
                                                        |
| 565 | +  | 
                                                        |
| 566 | + return TRUE;  | 
                                                        |
| 567 | + }  | 
                                                        |
| 568 | + }  | 
                                                        |
| 569 | 569 | ?>  | 
                                                        
@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | /**  | 
                                                        
| 13 | 13 | @brief  | 
                                                        
| 14 | 14 | @developer  | 
                                                        
| 15 | - */  | 
                                                        |
| 15 | + */  | 
                                                        |
| 16 | 16 | class DBMysqlConnectWrapper extends DBMysql  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | 18 | public $queries = '';  | 
                                                        
@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 | @developer  | 
                                                        
| 23 | 23 | @return  | 
                                                        
| 24 | 24 | @access  | 
                                                        
| 25 | - */  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | 26 | public function __construct()  | 
                                                        
| 27 | 27 |  	{ | 
                                                        
| 28 | 28 | $this->db_type = 'mysql';  | 
                                                        
@@ -34,7 +34,7 @@ discard block  | 
                                                    ||
| 34 | 34 | @developer  | 
                                                        
| 35 | 35 | @return  | 
                                                        
| 36 | 36 | @access  | 
                                                        
| 37 | - */  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | 38 | public function create()  | 
                                                        
| 39 | 39 |  	{ | 
                                                        
| 40 | 40 | return new DBMysqlConnectWrapper();  | 
                                                        
@@ -45,7 +45,7 @@ discard block  | 
                                                    ||
| 45 | 45 | @developer  | 
                                                        
| 46 | 46 | @return  | 
                                                        
| 47 | 47 | @access  | 
                                                        
| 48 | - */  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | 49 | public function actDBClassStart()  | 
                                                        
| 50 | 50 |  	{ | 
                                                        
| 51 | 51 | }  | 
                                                        
@@ -56,7 +56,7 @@ discard block  | 
                                                    ||
| 56 | 56 | @return  | 
                                                        
| 57 | 57 | @access  | 
                                                        
| 58 | 58 | @param $query  | 
                                                        
| 59 | - */  | 
                                                        |
| 59 | + */  | 
                                                        |
| 60 | 60 | public function actStart($query)  | 
                                                        
| 61 | 61 |  	{ | 
                                                        
| 62 | 62 | }  | 
                                                        
@@ -66,7 +66,7 @@ discard block  | 
                                                    ||
| 66 | 66 | @developer  | 
                                                        
| 67 | 67 | @return  | 
                                                        
| 68 | 68 | @access  | 
                                                        
| 69 | - */  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | 70 | public function actFinish()  | 
                                                        
| 71 | 71 |  	{ | 
                                                        
| 72 | 72 | }  | 
                                                        
@@ -76,7 +76,7 @@ discard block  | 
                                                    ||
| 76 | 76 | @developer  | 
                                                        
| 77 | 77 | @return  | 
                                                        
| 78 | 78 | @access  | 
                                                        
| 79 | - */  | 
                                                        |
| 79 | + */  | 
                                                        |
| 80 | 80 | public function actDBClassFinish()  | 
                                                        
| 81 | 81 |  	{ | 
                                                        
| 82 | 82 | }  | 
                                                        
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | @developer  | 
                                                        
| 87 | 87 | @return  | 
                                                        
| 88 | 88 | @access  | 
                                                        
| 89 | - */  | 
                                                        |
| 89 | + */  | 
                                                        |
| 90 | 90 | public function isSupported()  | 
                                                        
| 91 | 91 |  	{ | 
                                                        
| 92 | 92 | // No need to actually check for 'mysql_connect' function  | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | @return  | 
                                                        
| 100 | 100 | @access  | 
                                                        
| 101 | 101 | @param $connection  | 
                                                        
| 102 | - */  | 
                                                        |
| 102 | + */  | 
                                                        |
| 103 | 103 | public function __connect($connection)  | 
                                                        
| 104 | 104 |  	{ | 
                                                        
| 105 | 105 | return TRUE;  | 
                                                        
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | @return  | 
                                                        
| 112 | 112 | @access  | 
                                                        
| 113 | 113 | @param $connection  | 
                                                        
| 114 | - */  | 
                                                        |
| 114 | + */  | 
                                                        |
| 115 | 115 | public function _afterConnect($connection)  | 
                                                        
| 116 | 116 |  	{ | 
                                                        
| 117 | 117 | }  | 
                                                        
@@ -122,7 +122,7 @@ discard block  | 
                                                    ||
| 122 | 122 | @return  | 
                                                        
| 123 | 123 | @access  | 
                                                        
| 124 | 124 | @param $connection  | 
                                                        
| 125 | - */  | 
                                                        |
| 125 | + */  | 
                                                        |
| 126 | 126 | public function _close($connection)  | 
                                                        
| 127 | 127 |  	{ | 
                                                        
| 128 | 128 | }  | 
                                                        
@@ -134,7 +134,7 @@ discard block  | 
                                                    ||
| 134 | 134 | @access  | 
                                                        
| 135 | 135 | @param $type  | 
                                                        
| 136 | 136 | @param $indx  | 
                                                        
| 137 | - */  | 
                                                        |
| 137 | + */  | 
                                                        |
| 138 | 138 | public function close($type = 'master', $indx = NULL)  | 
                                                        
| 139 | 139 |  	{ | 
                                                        
| 140 | 140 | }  | 
                                                        
@@ -144,7 +144,7 @@ discard block  | 
                                                    ||
| 144 | 144 | @developer  | 
                                                        
| 145 | 145 | @return  | 
                                                        
| 146 | 146 | @access  | 
                                                        
| 147 | - */  | 
                                                        |
| 147 | + */  | 
                                                        |
| 148 | 148 | public function _begin()  | 
                                                        
| 149 | 149 |  	{ | 
                                                        
| 150 | 150 | return TRUE;  | 
                                                        
@@ -155,7 +155,7 @@ discard block  | 
                                                    ||
| 155 | 155 | @developer  | 
                                                        
| 156 | 156 | @return  | 
                                                        
| 157 | 157 | @access  | 
                                                        
| 158 | - */  | 
                                                        |
| 158 | + */  | 
                                                        |
| 159 | 159 | public function _rollback()  | 
                                                        
| 160 | 160 |  	{ | 
                                                        
| 161 | 161 | return TRUE;  | 
                                                        
@@ -166,7 +166,7 @@ discard block  | 
                                                    ||
| 166 | 166 | @developer  | 
                                                        
| 167 | 167 | @return  | 
                                                        
| 168 | 168 | @access  | 
                                                        
| 169 | - */  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | 170 | public function _commit()  | 
                                                        
| 171 | 171 |  	{ | 
                                                        
| 172 | 172 | return TRUE;  | 
                                                        
@@ -179,7 +179,7 @@ discard block  | 
                                                    ||
| 179 | 179 | @access  | 
                                                        
| 180 | 180 | @param $query  | 
                                                        
| 181 | 181 | @param $connection  | 
                                                        
| 182 | - */  | 
                                                        |
| 182 | + */  | 
                                                        |
| 183 | 183 | public function __query($query, $connection)  | 
                                                        
| 184 | 184 |  	{ | 
                                                        
| 185 | 185 | $this->queries .= "\n" . $query;  | 
                                                        
@@ -194,7 +194,7 @@ discard block  | 
                                                    ||
| 194 | 194 | @access  | 
                                                        
| 195 | 195 | @param $result  | 
                                                        
| 196 | 196 | @param $arrayIndexEndValue  | 
                                                        
| 197 | - */  | 
                                                        |
| 197 | + */  | 
                                                        |
| 198 | 198 | public function _fetch($result, $arrayIndexEndValue = NULL)  | 
                                                        
| 199 | 199 |  	{ | 
                                                        
| 200 | 200 | return new Any_prop_obj_base();  | 
                                                        
@@ -206,7 +206,7 @@ discard block  | 
                                                    ||
| 206 | 206 | @return  | 
                                                        
| 207 | 207 | @access  | 
                                                        
| 208 | 208 | @param $target_name  | 
                                                        
| 209 | - */  | 
                                                        |
| 209 | + */  | 
                                                        |
| 210 | 210 | public function isTableExists($target_name)  | 
                                                        
| 211 | 211 |  	{ | 
                                                        
| 212 | 212 | parent::isTableExists($target_name);  | 
                                                        
@@ -219,7 +219,7 @@ discard block  | 
                                                    ||
| 219 | 219 | @developer  | 
                                                        
| 220 | 220 | @return  | 
                                                        
| 221 | 221 | @access  | 
                                                        
| 222 | - */  | 
                                                        |
| 222 | + */  | 
                                                        |
| 223 | 223 | public function db_insert_id()  | 
                                                        
| 224 | 224 |  	{ | 
                                                        
| 225 | 225 | return NULL;  | 
                                                        
@@ -231,7 +231,7 @@ discard block  | 
                                                    ||
| 231 | 231 | @return  | 
                                                        
| 232 | 232 | @access  | 
                                                        
| 233 | 233 | @param $result  | 
                                                        
| 234 | - */  | 
                                                        |
| 234 | + */  | 
                                                        |
| 235 | 235 | public function db_fetch_object(&$result)  | 
                                                        
| 236 | 236 |  	{ | 
                                                        
| 237 | 237 | return new Any_prop_obj_base();  | 
                                                        
@@ -241,7 +241,7 @@ discard block  | 
                                                    ||
| 241 | 241 | /**  | 
                                                        
| 242 | 242 | @brief  | 
                                                        
| 243 | 243 | @developer  | 
                                                        
| 244 | - */  | 
                                                        |
| 244 | + */  | 
                                                        |
| 245 | 245 | class DBMysqliConnectWrapper extends DBMysqli  | 
                                                        
| 246 | 246 |  { | 
                                                        
| 247 | 247 | public $queries = '';  | 
                                                        
@@ -251,7 +251,7 @@ discard block  | 
                                                    ||
| 251 | 251 | @developer  | 
                                                        
| 252 | 252 | @return  | 
                                                        
| 253 | 253 | @access  | 
                                                        
| 254 | - */  | 
                                                        |
| 254 | + */  | 
                                                        |
| 255 | 255 | public function __construct()  | 
                                                        
| 256 | 256 |  	{ | 
                                                        
| 257 | 257 | $this->db_type = 'mysqli';  | 
                                                        
@@ -263,7 +263,7 @@ discard block  | 
                                                    ||
| 263 | 263 | @developer  | 
                                                        
| 264 | 264 | @return  | 
                                                        
| 265 | 265 | @access  | 
                                                        
| 266 | - */  | 
                                                        |
| 266 | + */  | 
                                                        |
| 267 | 267 | public function create()  | 
                                                        
| 268 | 268 |  	{ | 
                                                        
| 269 | 269 | return new DBMysqlConnectWrapper();  | 
                                                        
@@ -274,7 +274,7 @@ discard block  | 
                                                    ||
| 274 | 274 | @developer  | 
                                                        
| 275 | 275 | @return  | 
                                                        
| 276 | 276 | @access  | 
                                                        
| 277 | - */  | 
                                                        |
| 277 | + */  | 
                                                        |
| 278 | 278 | public function actDBClassStart()  | 
                                                        
| 279 | 279 |  	{ | 
                                                        
| 280 | 280 | }  | 
                                                        
@@ -285,7 +285,7 @@ discard block  | 
                                                    ||
| 285 | 285 | @return  | 
                                                        
| 286 | 286 | @access  | 
                                                        
| 287 | 287 | @param $query  | 
                                                        
| 288 | - */  | 
                                                        |
| 288 | + */  | 
                                                        |
| 289 | 289 | public function actStart($query)  | 
                                                        
| 290 | 290 |  	{ | 
                                                        
| 291 | 291 | }  | 
                                                        
@@ -295,7 +295,7 @@ discard block  | 
                                                    ||
| 295 | 295 | @developer  | 
                                                        
| 296 | 296 | @return  | 
                                                        
| 297 | 297 | @access  | 
                                                        
| 298 | - */  | 
                                                        |
| 298 | + */  | 
                                                        |
| 299 | 299 | public function actFinish()  | 
                                                        
| 300 | 300 |  	{ | 
                                                        
| 301 | 301 | }  | 
                                                        
@@ -305,7 +305,7 @@ discard block  | 
                                                    ||
| 305 | 305 | @developer  | 
                                                        
| 306 | 306 | @return  | 
                                                        
| 307 | 307 | @access  | 
                                                        
| 308 | - */  | 
                                                        |
| 308 | + */  | 
                                                        |
| 309 | 309 | public function actDBClassFinish()  | 
                                                        
| 310 | 310 |  	{ | 
                                                        
| 311 | 311 | }  | 
                                                        
@@ -315,7 +315,7 @@ discard block  | 
                                                    ||
| 315 | 315 | @developer  | 
                                                        
| 316 | 316 | @return  | 
                                                        
| 317 | 317 | @access  | 
                                                        
| 318 | - */  | 
                                                        |
| 318 | + */  | 
                                                        |
| 319 | 319 | public function isSupported()  | 
                                                        
| 320 | 320 |  	{ | 
                                                        
| 321 | 321 | // No need to actually check for 'mysql_connect' function  | 
                                                        
@@ -328,7 +328,7 @@ discard block  | 
                                                    ||
| 328 | 328 | @return  | 
                                                        
| 329 | 329 | @access  | 
                                                        
| 330 | 330 | @param $target_name  | 
                                                        
| 331 | - */  | 
                                                        |
| 331 | + */  | 
                                                        |
| 332 | 332 | public function isTableExists($target_name)  | 
                                                        
| 333 | 333 |  	{ | 
                                                        
| 334 | 334 | parent::isTableExists($target_name);  | 
                                                        
@@ -344,7 +344,7 @@ discard block  | 
                                                    ||
| 344 | 344 | @return  | 
                                                        
| 345 | 345 | @access  | 
                                                        
| 346 | 346 | @param $string  | 
                                                        
| 347 | - */  | 
                                                        |
| 347 | + */  | 
                                                        |
| 348 | 348 | public function addQuotes($string)  | 
                                                        
| 349 | 349 |  	{ | 
                                                        
| 350 | 350 | if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())  | 
                                                        
@@ -366,7 +366,7 @@ discard block  | 
                                                    ||
| 366 | 366 | @return  | 
                                                        
| 367 | 367 | @access  | 
                                                        
| 368 | 368 | @param $connection  | 
                                                        
| 369 | - */  | 
                                                        |
| 369 | + */  | 
                                                        |
| 370 | 370 | public function __connect($connection)  | 
                                                        
| 371 | 371 |  	{ | 
                                                        
| 372 | 372 | return TRUE;  | 
                                                        
@@ -378,7 +378,7 @@ discard block  | 
                                                    ||
| 378 | 378 | @return  | 
                                                        
| 379 | 379 | @access  | 
                                                        
| 380 | 380 | @param $connection  | 
                                                        
| 381 | - */  | 
                                                        |
| 381 | + */  | 
                                                        |
| 382 | 382 | public function _afterConnect($connection)  | 
                                                        
| 383 | 383 |  	{ | 
                                                        
| 384 | 384 | }  | 
                                                        
@@ -389,7 +389,7 @@ discard block  | 
                                                    ||
| 389 | 389 | @return  | 
                                                        
| 390 | 390 | @access  | 
                                                        
| 391 | 391 | @param $connection  | 
                                                        
| 392 | - */  | 
                                                        |
| 392 | + */  | 
                                                        |
| 393 | 393 | public function _close($connection)  | 
                                                        
| 394 | 394 |  	{ | 
                                                        
| 395 | 395 | }  | 
                                                        
@@ -401,7 +401,7 @@ discard block  | 
                                                    ||
| 401 | 401 | @access  | 
                                                        
| 402 | 402 | @param $type  | 
                                                        
| 403 | 403 | @param $indx  | 
                                                        
| 404 | - */  | 
                                                        |
| 404 | + */  | 
                                                        |
| 405 | 405 | public function close($type = 'master', $indx = NULL)  | 
                                                        
| 406 | 406 |  	{ | 
                                                        
| 407 | 407 | }  | 
                                                        
@@ -411,7 +411,7 @@ discard block  | 
                                                    ||
| 411 | 411 | @developer  | 
                                                        
| 412 | 412 | @return  | 
                                                        
| 413 | 413 | @access  | 
                                                        
| 414 | - */  | 
                                                        |
| 414 | + */  | 
                                                        |
| 415 | 415 | public function _begin()  | 
                                                        
| 416 | 416 |  	{ | 
                                                        
| 417 | 417 | return TRUE;  | 
                                                        
@@ -422,7 +422,7 @@ discard block  | 
                                                    ||
| 422 | 422 | @developer  | 
                                                        
| 423 | 423 | @return  | 
                                                        
| 424 | 424 | @access  | 
                                                        
| 425 | - */  | 
                                                        |
| 425 | + */  | 
                                                        |
| 426 | 426 | public function _rollback()  | 
                                                        
| 427 | 427 |  	{ | 
                                                        
| 428 | 428 | return TRUE;  | 
                                                        
@@ -433,7 +433,7 @@ discard block  | 
                                                    ||
| 433 | 433 | @developer  | 
                                                        
| 434 | 434 | @return  | 
                                                        
| 435 | 435 | @access  | 
                                                        
| 436 | - */  | 
                                                        |
| 436 | + */  | 
                                                        |
| 437 | 437 | public function _commit()  | 
                                                        
| 438 | 438 |  	{ | 
                                                        
| 439 | 439 | return TRUE;  | 
                                                        
@@ -446,7 +446,7 @@ discard block  | 
                                                    ||
| 446 | 446 | @access  | 
                                                        
| 447 | 447 | @param $query  | 
                                                        
| 448 | 448 | @param $connection  | 
                                                        
| 449 | - */  | 
                                                        |
| 449 | + */  | 
                                                        |
| 450 | 450 | public function __query($query, $connection)  | 
                                                        
| 451 | 451 |  	{ | 
                                                        
| 452 | 452 | $this->queries .= "\n" . $query;  | 
                                                        
@@ -461,7 +461,7 @@ discard block  | 
                                                    ||
| 461 | 461 | @access  | 
                                                        
| 462 | 462 | @param $result  | 
                                                        
| 463 | 463 | @param $arrayIndexEndValue  | 
                                                        
| 464 | - */  | 
                                                        |
| 464 | + */  | 
                                                        |
| 465 | 465 | public function _fetch($result, $arrayIndexEndValue = NULL)  | 
                                                        
| 466 | 466 |  	{ | 
                                                        
| 467 | 467 | return new Any_prop_obj_base();  | 
                                                        
@@ -472,7 +472,7 @@ discard block  | 
                                                    ||
| 472 | 472 | @developer  | 
                                                        
| 473 | 473 | @return  | 
                                                        
| 474 | 474 | @access  | 
                                                        
| 475 | - */  | 
                                                        |
| 475 | + */  | 
                                                        |
| 476 | 476 | public function db_insert_id()  | 
                                                        
| 477 | 477 |  	{ | 
                                                        
| 478 | 478 | return NULL;  | 
                                                        
@@ -484,7 +484,7 @@ discard block  | 
                                                    ||
| 484 | 484 | @return  | 
                                                        
| 485 | 485 | @access  | 
                                                        
| 486 | 486 | @param $result  | 
                                                        
| 487 | - */  | 
                                                        |
| 487 | + */  | 
                                                        |
| 488 | 488 | public function db_fetch_object(&$result)  | 
                                                        
| 489 | 489 |  	{ | 
                                                        
| 490 | 490 | return new Any_prop_obj_base();  | 
                                                        
@@ -494,7 +494,7 @@ discard block  | 
                                                    ||
| 494 | 494 | /**  | 
                                                        
| 495 | 495 | @brief  | 
                                                        
| 496 | 496 | @developer  | 
                                                        
| 497 | - */  | 
                                                        |
| 497 | + */  | 
                                                        |
| 498 | 498 | class DBCubridConnectWrapper extends DBCubrid  | 
                                                        
| 499 | 499 |  { | 
                                                        
| 500 | 500 | public $queries = '';  | 
                                                        
@@ -504,7 +504,7 @@ discard block  | 
                                                    ||
| 504 | 504 | @developer  | 
                                                        
| 505 | 505 | @return  | 
                                                        
| 506 | 506 | @access  | 
                                                        
| 507 | - */  | 
                                                        |
| 507 | + */  | 
                                                        |
| 508 | 508 | public function __construct()  | 
                                                        
| 509 | 509 |  	{ | 
                                                        
| 510 | 510 | $this->db_type = 'cubrid';  | 
                                                        
@@ -516,7 +516,7 @@ discard block  | 
                                                    ||
| 516 | 516 | @developer  | 
                                                        
| 517 | 517 | @return  | 
                                                        
| 518 | 518 | @access  | 
                                                        
| 519 | - */  | 
                                                        |
| 519 | + */  | 
                                                        |
| 520 | 520 | public function create()  | 
                                                        
| 521 | 521 |  	{ | 
                                                        
| 522 | 522 | return new DBMysqlConnectWrapper();  | 
                                                        
@@ -527,7 +527,7 @@ discard block  | 
                                                    ||
| 527 | 527 | @developer  | 
                                                        
| 528 | 528 | @return  | 
                                                        
| 529 | 529 | @access  | 
                                                        
| 530 | - */  | 
                                                        |
| 530 | + */  | 
                                                        |
| 531 | 531 | public function actDBClassStart()  | 
                                                        
| 532 | 532 |  	{ | 
                                                        
| 533 | 533 | }  | 
                                                        
@@ -538,7 +538,7 @@ discard block  | 
                                                    ||
| 538 | 538 | @return  | 
                                                        
| 539 | 539 | @access  | 
                                                        
| 540 | 540 | @param $query  | 
                                                        
| 541 | - */  | 
                                                        |
| 541 | + */  | 
                                                        |
| 542 | 542 | public function actStart($query)  | 
                                                        
| 543 | 543 |  	{ | 
                                                        
| 544 | 544 | }  | 
                                                        
@@ -548,7 +548,7 @@ discard block  | 
                                                    ||
| 548 | 548 | @developer  | 
                                                        
| 549 | 549 | @return  | 
                                                        
| 550 | 550 | @access  | 
                                                        
| 551 | - */  | 
                                                        |
| 551 | + */  | 
                                                        |
| 552 | 552 | public function _makeSequence()  | 
                                                        
| 553 | 553 |  	{ | 
                                                        
| 554 | 554 | return TRUE;  | 
                                                        
@@ -559,7 +559,7 @@ discard block  | 
                                                    ||
| 559 | 559 | @developer  | 
                                                        
| 560 | 560 | @return  | 
                                                        
| 561 | 561 | @access  | 
                                                        
| 562 | - */  | 
                                                        |
| 562 | + */  | 
                                                        |
| 563 | 563 | public function actFinish()  | 
                                                        
| 564 | 564 |  	{ | 
                                                        
| 565 | 565 | }  | 
                                                        
@@ -569,7 +569,7 @@ discard block  | 
                                                    ||
| 569 | 569 | @developer  | 
                                                        
| 570 | 570 | @return  | 
                                                        
| 571 | 571 | @access  | 
                                                        
| 572 | - */  | 
                                                        |
| 572 | + */  | 
                                                        |
| 573 | 573 | public function actDBClassFinish()  | 
                                                        
| 574 | 574 |  	{ | 
                                                        
| 575 | 575 | }  | 
                                                        
@@ -579,7 +579,7 @@ discard block  | 
                                                    ||
| 579 | 579 | @developer  | 
                                                        
| 580 | 580 | @return  | 
                                                        
| 581 | 581 | @access  | 
                                                        
| 582 | - */  | 
                                                        |
| 582 | + */  | 
                                                        |
| 583 | 583 | public function isSupported()  | 
                                                        
| 584 | 584 |  	{ | 
                                                        
| 585 | 585 | // No need to actually check for 'cubrid_connect' function  | 
                                                        
@@ -592,7 +592,7 @@ discard block  | 
                                                    ||
| 592 | 592 | @return  | 
                                                        
| 593 | 593 | @access  | 
                                                        
| 594 | 594 | @param $target_name  | 
                                                        
| 595 | - */  | 
                                                        |
| 595 | + */  | 
                                                        |
| 596 | 596 | public function isTableExists($target_name)  | 
                                                        
| 597 | 597 |  	{ | 
                                                        
| 598 | 598 | try  | 
                                                        
@@ -612,7 +612,7 @@ discard block  | 
                                                    ||
| 612 | 612 | @return  | 
                                                        
| 613 | 613 | @access  | 
                                                        
| 614 | 614 | @param $connection  | 
                                                        
| 615 | - */  | 
                                                        |
| 615 | + */  | 
                                                        |
| 616 | 616 | public function __connect($connection)  | 
                                                        
| 617 | 617 |  	{ | 
                                                        
| 618 | 618 | return TRUE;  | 
                                                        
@@ -624,7 +624,7 @@ discard block  | 
                                                    ||
| 624 | 624 | @return  | 
                                                        
| 625 | 625 | @access  | 
                                                        
| 626 | 626 | @param $connection  | 
                                                        
| 627 | - */  | 
                                                        |
| 627 | + */  | 
                                                        |
| 628 | 628 | public function _afterConnect($connection)  | 
                                                        
| 629 | 629 |  	{ | 
                                                        
| 630 | 630 | }  | 
                                                        
@@ -635,7 +635,7 @@ discard block  | 
                                                    ||
| 635 | 635 | @return  | 
                                                        
| 636 | 636 | @access  | 
                                                        
| 637 | 637 | @param $connection  | 
                                                        
| 638 | - */  | 
                                                        |
| 638 | + */  | 
                                                        |
| 639 | 639 | public function _close($connection)  | 
                                                        
| 640 | 640 |  	{ | 
                                                        
| 641 | 641 | }  | 
                                                        
@@ -647,7 +647,7 @@ discard block  | 
                                                    ||
| 647 | 647 | @access  | 
                                                        
| 648 | 648 | @param $type  | 
                                                        
| 649 | 649 | @param $indx  | 
                                                        
| 650 | - */  | 
                                                        |
| 650 | + */  | 
                                                        |
| 651 | 651 | public function close($type = 'master', $indx = NULL)  | 
                                                        
| 652 | 652 |  	{ | 
                                                        
| 653 | 653 | }  | 
                                                        
@@ -657,7 +657,7 @@ discard block  | 
                                                    ||
| 657 | 657 | @developer  | 
                                                        
| 658 | 658 | @return  | 
                                                        
| 659 | 659 | @access  | 
                                                        
| 660 | - */  | 
                                                        |
| 660 | + */  | 
                                                        |
| 661 | 661 | public function _begin()  | 
                                                        
| 662 | 662 |  	{ | 
                                                        
| 663 | 663 | return TRUE;  | 
                                                        
@@ -668,7 +668,7 @@ discard block  | 
                                                    ||
| 668 | 668 | @developer  | 
                                                        
| 669 | 669 | @return  | 
                                                        
| 670 | 670 | @access  | 
                                                        
| 671 | - */  | 
                                                        |
| 671 | + */  | 
                                                        |
| 672 | 672 | public function _rollback()  | 
                                                        
| 673 | 673 |  	{ | 
                                                        
| 674 | 674 | return TRUE;  | 
                                                        
@@ -679,7 +679,7 @@ discard block  | 
                                                    ||
| 679 | 679 | @developer  | 
                                                        
| 680 | 680 | @return  | 
                                                        
| 681 | 681 | @access  | 
                                                        
| 682 | - */  | 
                                                        |
| 682 | + */  | 
                                                        |
| 683 | 683 | public function _commit()  | 
                                                        
| 684 | 684 |  	{ | 
                                                        
| 685 | 685 | return TRUE;  | 
                                                        
@@ -692,7 +692,7 @@ discard block  | 
                                                    ||
| 692 | 692 | @access  | 
                                                        
| 693 | 693 | @param $query  | 
                                                        
| 694 | 694 | @param $connection  | 
                                                        
| 695 | - */  | 
                                                        |
| 695 | + */  | 
                                                        |
| 696 | 696 | public function __query($query, $connection)  | 
                                                        
| 697 | 697 |  	{ | 
                                                        
| 698 | 698 | $this->queries .= "\n" . $query;  | 
                                                        
@@ -707,7 +707,7 @@ discard block  | 
                                                    ||
| 707 | 707 | @access  | 
                                                        
| 708 | 708 | @param $result  | 
                                                        
| 709 | 709 | @param $arrayIndexEndValue  | 
                                                        
| 710 | - */  | 
                                                        |
| 710 | + */  | 
                                                        |
| 711 | 711 | public function _fetch($result, $arrayIndexEndValue = NULL)  | 
                                                        
| 712 | 712 |  	{ | 
                                                        
| 713 | 713 | return new Any_prop_obj_base();  | 
                                                        
@@ -718,7 +718,7 @@ discard block  | 
                                                    ||
| 718 | 718 | @developer  | 
                                                        
| 719 | 719 | @return  | 
                                                        
| 720 | 720 | @access  | 
                                                        
| 721 | - */  | 
                                                        |
| 721 | + */  | 
                                                        |
| 722 | 722 | public function db_insert_id()  | 
                                                        
| 723 | 723 |  	{ | 
                                                        
| 724 | 724 | return NULL;  | 
                                                        
@@ -729,7 +729,7 @@ discard block  | 
                                                    ||
| 729 | 729 | @developer  | 
                                                        
| 730 | 730 | @return  | 
                                                        
| 731 | 731 | @access  | 
                                                        
| 732 | - */  | 
                                                        |
| 732 | + */  | 
                                                        |
| 733 | 733 | public function &db_fetch_object()  | 
                                                        
| 734 | 734 |  	{ | 
                                                        
| 735 | 735 | return new Any_prop_obj_base();  | 
                                                        
@@ -739,7 +739,7 @@ discard block  | 
                                                    ||
| 739 | 739 | /**  | 
                                                        
| 740 | 740 | @brief  | 
                                                        
| 741 | 741 | @developer  | 
                                                        
| 742 | - */  | 
                                                        |
| 742 | + */  | 
                                                        |
| 743 | 743 | class DBMssqlConnectWrapper extends DBMssql  | 
                                                        
| 744 | 744 |  { | 
                                                        
| 745 | 745 | public $queries = '';  | 
                                                        
@@ -749,7 +749,7 @@ discard block  | 
                                                    ||
| 749 | 749 | @developer  | 
                                                        
| 750 | 750 | @return  | 
                                                        
| 751 | 751 | @access  | 
                                                        
| 752 | - */  | 
                                                        |
| 752 | + */  | 
                                                        |
| 753 | 753 | public function __construct()  | 
                                                        
| 754 | 754 |  	{ | 
                                                        
| 755 | 755 | $this->db_type = 'mssql';  | 
                                                        
@@ -761,7 +761,7 @@ discard block  | 
                                                    ||
| 761 | 761 | @developer  | 
                                                        
| 762 | 762 | @return  | 
                                                        
| 763 | 763 | @access  | 
                                                        
| 764 | - */  | 
                                                        |
| 764 | + */  | 
                                                        |
| 765 | 765 | public function create()  | 
                                                        
| 766 | 766 |  	{ | 
                                                        
| 767 | 767 | return new DBMssqlConnectWrapper();  | 
                                                        
@@ -772,7 +772,7 @@ discard block  | 
                                                    ||
| 772 | 772 | @developer  | 
                                                        
| 773 | 773 | @return  | 
                                                        
| 774 | 774 | @access  | 
                                                        
| 775 | - */  | 
                                                        |
| 775 | + */  | 
                                                        |
| 776 | 776 | public function actDBClassStart()  | 
                                                        
| 777 | 777 |  	{ | 
                                                        
| 778 | 778 | }  | 
                                                        
@@ -783,7 +783,7 @@ discard block  | 
                                                    ||
| 783 | 783 | @return  | 
                                                        
| 784 | 784 | @access  | 
                                                        
| 785 | 785 | @param $query  | 
                                                        
| 786 | - */  | 
                                                        |
| 786 | + */  | 
                                                        |
| 787 | 787 | public function actStart($query)  | 
                                                        
| 788 | 788 |  	{ | 
                                                        
| 789 | 789 | }  | 
                                                        
@@ -793,7 +793,7 @@ discard block  | 
                                                    ||
| 793 | 793 | @developer  | 
                                                        
| 794 | 794 | @return  | 
                                                        
| 795 | 795 | @access  | 
                                                        
| 796 | - */  | 
                                                        |
| 796 | + */  | 
                                                        |
| 797 | 797 | public function actFinish()  | 
                                                        
| 798 | 798 |  	{ | 
                                                        
| 799 | 799 | }  | 
                                                        
@@ -803,7 +803,7 @@ discard block  | 
                                                    ||
| 803 | 803 | @developer  | 
                                                        
| 804 | 804 | @return  | 
                                                        
| 805 | 805 | @access  | 
                                                        
| 806 | - */  | 
                                                        |
| 806 | + */  | 
                                                        |
| 807 | 807 | public function actDBClassFinish()  | 
                                                        
| 808 | 808 |  	{ | 
                                                        
| 809 | 809 | }  | 
                                                        
@@ -813,7 +813,7 @@ discard block  | 
                                                    ||
| 813 | 813 | @developer  | 
                                                        
| 814 | 814 | @return  | 
                                                        
| 815 | 815 | @access  | 
                                                        
| 816 | - */  | 
                                                        |
| 816 | + */  | 
                                                        |
| 817 | 817 | public function isSupported()  | 
                                                        
| 818 | 818 |  	{ | 
                                                        
| 819 | 819 | // No need to actually check for 'mssql_connect' function  | 
                                                        
@@ -826,7 +826,7 @@ discard block  | 
                                                    ||
| 826 | 826 | @return  | 
                                                        
| 827 | 827 | @access  | 
                                                        
| 828 | 828 | @param $target_name  | 
                                                        
| 829 | - */  | 
                                                        |
| 829 | + */  | 
                                                        |
| 830 | 830 | public function isTableExists($target_name)  | 
                                                        
| 831 | 831 |  	{ | 
                                                        
| 832 | 832 | parent::isTableExists($target_name);  | 
                                                        
@@ -840,7 +840,7 @@ discard block  | 
                                                    ||
| 840 | 840 | @return  | 
                                                        
| 841 | 841 | @access  | 
                                                        
| 842 | 842 | @param $connection  | 
                                                        
| 843 | - */  | 
                                                        |
| 843 | + */  | 
                                                        |
| 844 | 844 | public function __connect($connection)  | 
                                                        
| 845 | 845 |  	{ | 
                                                        
| 846 | 846 | return TRUE;  | 
                                                        
@@ -852,7 +852,7 @@ discard block  | 
                                                    ||
| 852 | 852 | @return  | 
                                                        
| 853 | 853 | @access  | 
                                                        
| 854 | 854 | @param $connection  | 
                                                        
| 855 | - */  | 
                                                        |
| 855 | + */  | 
                                                        |
| 856 | 856 | public function _afterConnect($connection)  | 
                                                        
| 857 | 857 |  	{ | 
                                                        
| 858 | 858 | }  | 
                                                        
@@ -863,7 +863,7 @@ discard block  | 
                                                    ||
| 863 | 863 | @return  | 
                                                        
| 864 | 864 | @access  | 
                                                        
| 865 | 865 | @param $connection  | 
                                                        
| 866 | - */  | 
                                                        |
| 866 | + */  | 
                                                        |
| 867 | 867 | public function _close($connection)  | 
                                                        
| 868 | 868 |  	{ | 
                                                        
| 869 | 869 | }  | 
                                                        
@@ -875,7 +875,7 @@ discard block  | 
                                                    ||
| 875 | 875 | @access  | 
                                                        
| 876 | 876 | @param $type  | 
                                                        
| 877 | 877 | @param $indx  | 
                                                        
| 878 | - */  | 
                                                        |
| 878 | + */  | 
                                                        |
| 879 | 879 | public function close($type = 'master', $indx = NULL)  | 
                                                        
| 880 | 880 |  	{ | 
                                                        
| 881 | 881 | }  | 
                                                        
@@ -885,7 +885,7 @@ discard block  | 
                                                    ||
| 885 | 885 | @developer  | 
                                                        
| 886 | 886 | @return  | 
                                                        
| 887 | 887 | @access  | 
                                                        
| 888 | - */  | 
                                                        |
| 888 | + */  | 
                                                        |
| 889 | 889 | public function _begin()  | 
                                                        
| 890 | 890 |  	{ | 
                                                        
| 891 | 891 | return TRUE;  | 
                                                        
@@ -896,7 +896,7 @@ discard block  | 
                                                    ||
| 896 | 896 | @developer  | 
                                                        
| 897 | 897 | @return  | 
                                                        
| 898 | 898 | @access  | 
                                                        
| 899 | - */  | 
                                                        |
| 899 | + */  | 
                                                        |
| 900 | 900 | public function _rollback()  | 
                                                        
| 901 | 901 |  	{ | 
                                                        
| 902 | 902 | return TRUE;  | 
                                                        
@@ -907,7 +907,7 @@ discard block  | 
                                                    ||
| 907 | 907 | @developer  | 
                                                        
| 908 | 908 | @return  | 
                                                        
| 909 | 909 | @access  | 
                                                        
| 910 | - */  | 
                                                        |
| 910 | + */  | 
                                                        |
| 911 | 911 | public function _commit()  | 
                                                        
| 912 | 912 |  	{ | 
                                                        
| 913 | 913 | return TRUE;  | 
                                                        
@@ -920,7 +920,7 @@ discard block  | 
                                                    ||
| 920 | 920 | @access  | 
                                                        
| 921 | 921 | @param $query  | 
                                                        
| 922 | 922 | @param $connection  | 
                                                        
| 923 | - */  | 
                                                        |
| 923 | + */  | 
                                                        |
| 924 | 924 | public function __query($query, $connection)  | 
                                                        
| 925 | 925 |  	{ | 
                                                        
| 926 | 926 | if($this->queries)  | 
                                                        
@@ -940,7 +940,7 @@ discard block  | 
                                                    ||
| 940 | 940 | @access  | 
                                                        
| 941 | 941 | @param $result  | 
                                                        
| 942 | 942 | @param $arrayIndexEndValue  | 
                                                        
| 943 | - */  | 
                                                        |
| 943 | + */  | 
                                                        |
| 944 | 944 | public function _fetch($result, $arrayIndexEndValue = NULL)  | 
                                                        
| 945 | 945 |  	{ | 
                                                        
| 946 | 946 | return new Any_prop_obj_base();  | 
                                                        
@@ -951,7 +951,7 @@ discard block  | 
                                                    ||
| 951 | 951 | @developer  | 
                                                        
| 952 | 952 | @return  | 
                                                        
| 953 | 953 | @access  | 
                                                        
| 954 | - */  | 
                                                        |
| 954 | + */  | 
                                                        |
| 955 | 955 | public function db_insert_id()  | 
                                                        
| 956 | 956 |  	{ | 
                                                        
| 957 | 957 | return NULL;  | 
                                                        
@@ -962,7 +962,7 @@ discard block  | 
                                                    ||
| 962 | 962 | @developer  | 
                                                        
| 963 | 963 | @return  | 
                                                        
| 964 | 964 | @access  | 
                                                        
| 965 | - */  | 
                                                        |
| 965 | + */  | 
                                                        |
| 966 | 966 | public function &db_fetch_object()  | 
                                                        
| 967 | 967 |  	{ | 
                                                        
| 968 | 968 | return new Any_prop_obj_base();  | 
                                                        
@@ -26,7 +26,7 @@ discard block  | 
                                                    ||
| 26 | 26 | public function __construct()  | 
                                                        
| 27 | 27 |  	{ | 
                                                        
| 28 | 28 | $this->db_type = 'mysql';  | 
                                                        
| 29 | - $this->_setDBInfo(); // Context::get() should indicate a mysql db  | 
                                                        |
| 29 | + $this->_setDBInfo(); // Context::get() should indicate a mysql db  | 
                                                        |
| 30 | 30 | }  | 
                                                        
| 31 | 31 | |
| 32 | 32 | /**  | 
                                                        
@@ -182,7 +182,7 @@ discard block  | 
                                                    ||
| 182 | 182 | */  | 
                                                        
| 183 | 183 | public function __query($query, $connection)  | 
                                                        
| 184 | 184 |  	{ | 
                                                        
| 185 | - $this->queries .= "\n" . $query;  | 
                                                        |
| 185 | + $this->queries .= "\n".$query;  | 
                                                        |
| 186 | 186 | |
| 187 | 187 | return TRUE;  | 
                                                        
| 188 | 188 | }  | 
                                                        
@@ -255,7 +255,7 @@ discard block  | 
                                                    ||
| 255 | 255 | public function __construct()  | 
                                                        
| 256 | 256 |  	{ | 
                                                        
| 257 | 257 | $this->db_type = 'mysqli';  | 
                                                        
| 258 | - $this->_setDBInfo(); // Context::get() should indicate a mysqli db  | 
                                                        |
| 258 | + $this->_setDBInfo(); // Context::get() should indicate a mysqli db  | 
                                                        |
| 259 | 259 | }  | 
                                                        
| 260 | 260 | |
| 261 | 261 | /**  | 
                                                        
@@ -347,12 +347,12 @@ discard block  | 
                                                    ||
| 347 | 347 | */  | 
                                                        
| 348 | 348 | public function addQuotes($string)  | 
                                                        
| 349 | 349 |  	{ | 
                                                        
| 350 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())  | 
                                                        |
| 350 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())  | 
                                                        |
| 351 | 351 |  		{ | 
                                                        
| 352 | 352 |  			$string = stripslashes(str_replace("\\", "\\\\", $string)); | 
                                                        
| 353 | 353 | }  | 
                                                        
| 354 | 354 | |
| 355 | - if(!is_numeric($string))  | 
                                                        |
| 355 | + if (!is_numeric($string))  | 
                                                        |
| 356 | 356 |  		{ | 
                                                        
| 357 | 357 | $string = @mysql_real_escape_string($string);  | 
                                                        
| 358 | 358 | }  | 
                                                        
@@ -449,7 +449,7 @@ discard block  | 
                                                    ||
| 449 | 449 | */  | 
                                                        
| 450 | 450 | public function __query($query, $connection)  | 
                                                        
| 451 | 451 |  	{ | 
                                                        
| 452 | - $this->queries .= "\n" . $query;  | 
                                                        |
| 452 | + $this->queries .= "\n".$query;  | 
                                                        |
| 453 | 453 | |
| 454 | 454 | return TRUE;  | 
                                                        
| 455 | 455 | }  | 
                                                        
@@ -508,7 +508,7 @@ discard block  | 
                                                    ||
| 508 | 508 | public function __construct()  | 
                                                        
| 509 | 509 |  	{ | 
                                                        
| 510 | 510 | $this->db_type = 'cubrid';  | 
                                                        
| 511 | - $this->_setDBInfo(); // Context::get() should indicate a CUBRID db  | 
                                                        |
| 511 | + $this->_setDBInfo(); // Context::get() should indicate a CUBRID db  | 
                                                        |
| 512 | 512 | }  | 
                                                        
| 513 | 513 | |
| 514 | 514 | /**  | 
                                                        
@@ -695,7 +695,7 @@ discard block  | 
                                                    ||
| 695 | 695 | */  | 
                                                        
| 696 | 696 | public function __query($query, $connection)  | 
                                                        
| 697 | 697 |  	{ | 
                                                        
| 698 | - $this->queries .= "\n" . $query;  | 
                                                        |
| 698 | + $this->queries .= "\n".$query;  | 
                                                        |
| 699 | 699 | |
| 700 | 700 | return TRUE;  | 
                                                        
| 701 | 701 | }  | 
                                                        
@@ -753,7 +753,7 @@ discard block  | 
                                                    ||
| 753 | 753 | public function __construct()  | 
                                                        
| 754 | 754 |  	{ | 
                                                        
| 755 | 755 | $this->db_type = 'mssql';  | 
                                                        
| 756 | - $this->_setDBInfo(); // Context::get() should indicate a MS Sql db  | 
                                                        |
| 756 | + $this->_setDBInfo(); // Context::get() should indicate a MS Sql db  | 
                                                        |
| 757 | 757 | }  | 
                                                        
| 758 | 758 | |
| 759 | 759 | /**  | 
                                                        
@@ -923,7 +923,7 @@ discard block  | 
                                                    ||
| 923 | 923 | */  | 
                                                        
| 924 | 924 | public function __query($query, $connection)  | 
                                                        
| 925 | 925 |  	{ | 
                                                        
| 926 | - if($this->queries)  | 
                                                        |
| 926 | + if ($this->queries)  | 
                                                        |
| 927 | 927 |  		{ | 
                                                        
| 928 | 928 | $this->queries .= ";\n";  | 
                                                        
| 929 | 929 | }  | 
                                                        
@@ -598,8 +598,7 @@  | 
                                                    ||
| 598 | 598 | try  | 
                                                        
| 599 | 599 |  		{ | 
                                                        
| 600 | 600 | parent::isTableExists($target_name);  | 
                                                        
| 601 | - }  | 
                                                        |
| 602 | - catch (Exception $ex)  | 
                                                        |
| 601 | + } catch (Exception $ex)  | 
                                                        |
| 603 | 602 |  		{ | 
                                                        
| 604 | 603 | }  | 
                                                        
| 605 | 604 | |
@@ -15,7 +15,7 @@ discard block  | 
                                                    ||
| 15 | 15 | function procWAP(&$oMobile)  | 
                                                        
| 16 | 16 |  	{ | 
                                                        
| 17 | 17 | // check grant  | 
                                                        
| 18 | - if(!$this->grant->list || $this->module_info->consultation == 'Y')  | 
                                                        |
| 18 | + if (!$this->grant->list || $this->module_info->consultation == 'Y')  | 
                                                        |
| 19 | 19 |  		{ | 
                                                        
| 20 | 20 |  			return $oMobile->setContent(Context::getLang('msg_not_permitted')); | 
                                                        
| 21 | 21 | }  | 
                                                        
@@ -25,13 +25,13 @@ discard block  | 
                                                    ||
| 25 | 25 | |
| 26 | 26 | // if the doument is existed  | 
                                                        
| 27 | 27 |  		$document_srl = Context::get('document_srl'); | 
                                                        
| 28 | - if($document_srl)  | 
                                                        |
| 28 | + if ($document_srl)  | 
                                                        |
| 29 | 29 |  		{ | 
                                                        
| 30 | 30 | $oDocument = $oDocumentModel->getDocument($document_srl);  | 
                                                        
| 31 | - if($oDocument->isExists())  | 
                                                        |
| 31 | + if ($oDocument->isExists())  | 
                                                        |
| 32 | 32 |  			{ | 
                                                        
| 33 | 33 | // check the grant  | 
                                                        
| 34 | - if(!$this->grant->view)  | 
                                                        |
| 34 | + if (!$this->grant->view)  | 
                                                        |
| 35 | 35 |  				{ | 
                                                        
| 36 | 36 |  					return $oMobile->setContent(Context::getLang('msg_not_permitted')); | 
                                                        
| 37 | 37 | }  | 
                                                        
@@ -40,48 +40,48 @@ discard block  | 
                                                    ||
| 40 | 40 | Context::setBrowserTitle($oDocument->getTitleText());  | 
                                                        
| 41 | 41 | |
| 42 | 42 | // if the act is display comment list  | 
                                                        
| 43 | - if($this->act=='dispBoardContentCommentList')  | 
                                                        |
| 43 | + if ($this->act == 'dispBoardContentCommentList')  | 
                                                        |
| 44 | 44 |  				{ | 
                                                        
| 45 | 45 | |
| 46 | 46 |  					$oCommentModel = getModel('comment'); | 
                                                        
| 47 | 47 | $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());  | 
                                                        
| 48 | 48 | |
| 49 | 49 | $content = '';  | 
                                                        
| 50 | - if(count($output->data))  | 
                                                        |
| 50 | + if (count($output->data))  | 
                                                        |
| 51 | 51 |  					{ | 
                                                        
| 52 | - foreach($output->data as $key => $val)  | 
                                                        |
| 52 | + foreach ($output->data as $key => $val)  | 
                                                        |
| 53 | 53 |  						{ | 
                                                        
| 54 | 54 | $oComment = new commentItem();  | 
                                                        
| 55 | 55 | $oComment->setAttribute($val);  | 
                                                        
| 56 | 56 | |
| 57 | - if(!$oComment->isAccessible()) continue;  | 
                                                        |
| 57 | + if (!$oComment->isAccessible()) continue;  | 
                                                        |
| 58 | 58 | |
| 59 | -							$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n"; | 
                                                        |
| 59 | +							$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false, false)."<br>\r\n"; | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | |
| 63 | 63 | // setup mobile contents  | 
                                                        
| 64 | - $oMobile->setContent( $content );  | 
                                                        |
| 64 | + $oMobile->setContent($content);  | 
                                                        |
| 65 | 65 | |
| 66 | 66 | // setup upper URL  | 
                                                        
| 67 | -					$oMobile->setUpperUrl( getUrl('act',''), Context::getLang('cmd_go_upper') ); | 
                                                        |
| 67 | +					$oMobile->setUpperUrl(getUrl('act', ''), Context::getLang('cmd_go_upper')); | 
                                                        |
| 68 | 68 | |
| 69 | 69 | // display the document if the act is not display the comment list  | 
                                                        
| 70 | 70 |  				} else { | 
                                                        
| 71 | 71 | |
| 72 | 72 | // setup contents (strip all html tags)  | 
                                                        
| 73 | -					$content = strip_tags(str_replace('<p>','<br>   ',$oDocument->getContent(false,false,false)),'<br><b><i><u><em><small><strong><big>'); | 
                                                        |
| 73 | +					$content = strip_tags(str_replace('<p>', '<br>   ', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>'); | 
                                                        |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | // setup content information(include the comments link)  | 
                                                        
| 77 | -					$content = Context::getLang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content; | 
                                                        |
| 77 | +					$content = Context::getLang('replies').' : <a href="'.getUrl('act', 'dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content; | 
                                                        |
| 78 | 78 |  					$content = '<b>'.$oDocument->getNickName().'</b> ('.$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content; | 
                                                        
| 79 | 79 | |
| 80 | 80 | // setup mobile contents  | 
                                                        
| 81 | - $oMobile->setContent( $content );  | 
                                                        |
| 81 | + $oMobile->setContent($content);  | 
                                                        |
| 82 | 82 | |
| 83 | 83 | // setup upper URL  | 
                                                        
| 84 | -					$oMobile->setUpperUrl( getUrl('document_srl',''), Context::getLang('cmd_list') ); | 
                                                        |
| 84 | +					$oMobile->setUpperUrl(getUrl('document_srl', ''), Context::getLang('cmd_list')); | 
                                                        |
| 85 | 85 | |
| 86 | 86 | }  | 
                                                        
| 87 | 87 | |
@@ -92,25 +92,25 @@ discard block  | 
                                                    ||
| 92 | 92 | // board index  | 
                                                        
| 93 | 93 | $args = new stdClass;  | 
                                                        
| 94 | 94 | $args->module_srl = $this->module_srl;  | 
                                                        
| 95 | -		$args->page = Context::get('page');; | 
                                                        |
| 95 | +		$args->page = Context::get('page'); ; | 
                                                        |
| 96 | 96 | $args->list_count = 9;  | 
                                                        
| 97 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';  | 
                                                        |
| 98 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';  | 
                                                        |
| 97 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order';  | 
                                                        |
| 98 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc';  | 
                                                        |
| 99 | 99 | $output = $oDocumentModel->getDocumentList($args, $this->except_notice);  | 
                                                        
| 100 | 100 | $document_list = $output->data;  | 
                                                        
| 101 | 101 | $page_navigation = $output->page_navigation;  | 
                                                        
| 102 | 102 | |
| 103 | 103 | $childs = array();  | 
                                                        
| 104 | - if($document_list && count($document_list))  | 
                                                        |
| 104 | + if ($document_list && count($document_list))  | 
                                                        |
| 105 | 105 |  		{ | 
                                                        
| 106 | - foreach($document_list as $key => $val)  | 
                                                        |
| 106 | + foreach ($document_list as $key => $val)  | 
                                                        |
| 107 | 107 |  			{ | 
                                                        
| 108 | -				$href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl); | 
                                                        |
| 108 | +				$href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl); | 
                                                        |
| 109 | 109 | $obj = null;  | 
                                                        
| 110 | 110 | $obj['href'] = $val->getPermanentUrl();  | 
                                                        
| 111 | 111 | |
| 112 | 112 | $title = htmlspecialchars($val->getTitleText());  | 
                                                        
| 113 | - if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';  | 
                                                        |
| 113 | + if ($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';  | 
                                                        |
| 114 | 114 | $obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title;  | 
                                                        
| 115 | 115 | $childs[] = $obj;  | 
                                                        
| 116 | 116 | }  | 
                                                        
@@ -118,18 +118,18 @@ discard block  | 
                                                    ||
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | 120 | $totalPage = $page_navigation->last_page;  | 
                                                        
| 121 | -		$page = (int)Context::get('page'); | 
                                                        |
| 122 | - if(!$page) $page = 1;  | 
                                                        |
| 121 | +		$page = (int) Context::get('page'); | 
                                                        |
| 122 | + if (!$page) $page = 1;  | 
                                                        |
| 123 | 123 | |
| 124 | 124 | // next/prevUrl specification  | 
                                                        
| 125 | - if($page > 1)  | 
                                                        |
| 125 | + if ($page > 1)  | 
                                                        |
| 126 | 126 |  		{ | 
                                                        
| 127 | -			$oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page-1, $totalPage)); | 
                                                        |
| 127 | +			$oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page - 1, $totalPage)); | 
                                                        |
| 128 | 128 | }  | 
                                                        
| 129 | 129 | |
| 130 | - if($page < $totalPage)  | 
                                                        |
| 130 | + if ($page < $totalPage)  | 
                                                        |
| 131 | 131 |  		{ | 
                                                        
| 132 | -			$oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page+1, $totalPage)); | 
                                                        |
| 132 | +			$oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page + 1, $totalPage)); | 
                                                        |
| 133 | 133 | }  | 
                                                        
| 134 | 134 | |
| 135 | 135 | $oMobile->mobilePage = $page;  | 
                                                        
@@ -54,7 +54,9 @@ discard block  | 
                                                    ||
| 54 | 54 | $oComment = new commentItem();  | 
                                                        
| 55 | 55 | $oComment->setAttribute($val);  | 
                                                        
| 56 | 56 | |
| 57 | - if(!$oComment->isAccessible()) continue;  | 
                                                        |
| 57 | +							if(!$oComment->isAccessible()) { | 
                                                        |
| 58 | + continue;  | 
                                                        |
| 59 | + }  | 
                                                        |
| 58 | 60 | |
| 59 | 61 |  							$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n"; | 
                                                        
| 60 | 62 | }  | 
                                                        
@@ -110,7 +112,9 @@ discard block  | 
                                                    ||
| 110 | 112 | $obj['href'] = $val->getPermanentUrl();  | 
                                                        
| 111 | 113 | |
| 112 | 114 | $title = htmlspecialchars($val->getTitleText());  | 
                                                        
| 113 | - if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';  | 
                                                        |
| 115 | +				if($val->getCommentCount()) { | 
                                                        |
| 116 | + $title .= ' ['.$val->getCommentCount().']';  | 
                                                        |
| 117 | + }  | 
                                                        |
| 114 | 118 | $obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title;  | 
                                                        
| 115 | 119 | $childs[] = $obj;  | 
                                                        
| 116 | 120 | }  | 
                                                        
@@ -119,7 +123,9 @@ discard block  | 
                                                    ||
| 119 | 123 | |
| 120 | 124 | $totalPage = $page_navigation->last_page;  | 
                                                        
| 121 | 125 |  		$page = (int)Context::get('page'); | 
                                                        
| 122 | - if(!$page) $page = 1;  | 
                                                        |
| 126 | +		if(!$page) { | 
                                                        |
| 127 | + $page = 1;  | 
                                                        |
| 128 | + }  | 
                                                        |
| 123 | 129 | |
| 124 | 130 | // next/prevUrl specification  | 
                                                        
| 125 | 131 | if($page > 1)  | 
                                                        
@@ -10,32 +10,32 @@ discard block  | 
                                                    ||
| 10 | 10 | $oSecurity = new Security();  | 
                                                        
| 11 | 11 |  		$oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); | 
                                                        
| 12 | 12 | |
| 13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count;  | 
                                                        |
| 14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count;  | 
                                                        |
| 15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count;  | 
                                                        |
| 16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count;  | 
                                                        |
| 17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count;  | 
                                                        |
| 18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count;  | 
                                                        |
| 13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count;  | 
                                                        |
| 14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count;  | 
                                                        |
| 15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count;  | 
                                                        |
| 16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count;  | 
                                                        |
| 17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count;  | 
                                                        |
| 18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count;  | 
                                                        |
| 19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true;  | 
                                                        
| 20 | 20 | |
| 21 | 21 | // $this->_getStatusNameListecret option backward compatibility  | 
                                                        
| 22 | 22 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 23 | 23 | |
| 24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel);  | 
                                                        
| 25 | - if(isset($statusList['SECRET']))  | 
                                                        |
| 25 | + if (isset($statusList['SECRET']))  | 
                                                        |
| 26 | 26 |  		{ | 
                                                        
| 27 | 27 | $this->module_info->secret = 'Y';  | 
                                                        
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
| 30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x  | 
                                                        
| 31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl));  | 
                                                        
| 32 | - if($count_category)  | 
                                                        |
| 32 | + if ($count_category)  | 
                                                        |
| 33 | 33 |  		{ | 
                                                        
| 34 | - if($this->module_info->hide_category)  | 
                                                        |
| 34 | + if ($this->module_info->hide_category)  | 
                                                        |
| 35 | 35 |  			{ | 
                                                        
| 36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y';  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | - else if($this->module_info->use_category)  | 
                                                        |
| 38 | + else if ($this->module_info->use_category)  | 
                                                        |
| 39 | 39 |  			{ | 
                                                        
| 40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y';  | 
                                                        
| 41 | 41 | }  | 
                                                        
@@ -55,10 +55,10 @@ discard block  | 
                                                    ||
| 55 | 55 | * check the consultation function, if the user is admin then swich off consultation function  | 
                                                        
| 56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document  | 
                                                        
| 57 | 57 | **/  | 
                                                        
| 58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)  | 
                                                        |
| 58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)  | 
                                                        |
| 59 | 59 |  		{ | 
                                                        
| 60 | 60 | $this->consultation = true;  | 
                                                        
| 61 | -			if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; | 
                                                        |
| 61 | +			if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; | 
                                                        |
| 62 | 62 |  		} else { | 
                                                        
| 63 | 63 | $this->consultation = false;  | 
                                                        
| 64 | 64 | }  | 
                                                        
@@ -67,11 +67,11 @@ discard block  | 
                                                    ||
| 67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl);  | 
                                                        
| 68 | 68 |  		Context::set('extra_keys', $extra_keys); | 
                                                        
| 69 | 69 | |
| 70 | -		$template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); | 
                                                        |
| 71 | - if(!is_dir($template_path)||!$this->module_info->mskin)  | 
                                                        |
| 70 | +		$template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); | 
                                                        |
| 71 | + if (!is_dir($template_path) || !$this->module_info->mskin)  | 
                                                        |
| 72 | 72 |  		{ | 
                                                        
| 73 | 73 | $this->module_info->mskin = 'default';  | 
                                                        
| 74 | -			$template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); | 
                                                        |
| 74 | +			$template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); | 
                                                        |
| 75 | 75 | }  | 
                                                        
| 76 | 76 | $this->setTemplatePath($template_path);  | 
                                                        
| 77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml');  | 
                                                        
@@ -87,19 +87,19 @@ discard block  | 
                                                    ||
| 87 | 87 | function getBoardCommentPage()  | 
                                                        
| 88 | 88 |  	{ | 
                                                        
| 89 | 89 |  		$document_srl = Context::get('document_srl'); | 
                                                        
| 90 | -		$oDocumentModel =& getModel('document'); | 
                                                        |
| 91 | - if(!$document_srl)  | 
                                                        |
| 90 | +		$oDocumentModel = & getModel('document'); | 
                                                        |
| 91 | + if (!$document_srl)  | 
                                                        |
| 92 | 92 |  		{ | 
                                                        
| 93 | 93 | return new BaseObject(-1, "msg_invalid_request");  | 
                                                        
| 94 | 94 | }  | 
                                                        
| 95 | 95 | |
| 96 | - if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))  | 
                                                        |
| 96 | + if ($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))  | 
                                                        |
| 97 | 97 |  		{ | 
                                                        
| 98 | 98 | return new BaseObject(-1, "msg_not_permitted");  | 
                                                        
| 99 | 99 | }  | 
                                                        
| 100 | 100 | |
| 101 | 101 | $oDocument = $oDocumentModel->getDocument($document_srl);  | 
                                                        
| 102 | - if(!$oDocument->isExists())  | 
                                                        |
| 102 | + if (!$oDocument->isExists())  | 
                                                        |
| 103 | 103 |  		{ | 
                                                        
| 104 | 104 | return new BaseObject(-1, "msg_invalid_request");  | 
                                                        
| 105 | 105 | }  | 
                                                        
@@ -112,7 +112,7 @@ discard block  | 
                                                    ||
| 112 | 112 | function dispBoardMessage($msg_code)  | 
                                                        
| 113 | 113 |  	{ | 
                                                        
| 114 | 114 | $msg = Context::getLang($msg_code);  | 
                                                        
| 115 | -		$oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); | 
                                                        |
| 115 | +		$oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile'); | 
                                                        |
| 116 | 116 | $oMessageObject->setError(-1);  | 
                                                        
| 117 | 117 | $oMessageObject->setMessage($msg);  | 
                                                        
| 118 | 118 | $oMessageObject->dispMessage();  | 
                                                        
@@ -10,12 +10,24 @@ discard block  | 
                                                    ||
| 10 | 10 | $oSecurity = new Security();  | 
                                                        
| 11 | 11 |  		$oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); | 
                                                        
| 12 | 12 | |
| 13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count;  | 
                                                        |
| 14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count;  | 
                                                        |
| 15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count;  | 
                                                        |
| 16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count;  | 
                                                        |
| 17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count;  | 
                                                        |
| 18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count;  | 
                                                        |
| 13 | +		if($this->module_info->list_count) { | 
                                                        |
| 14 | + $this->list_count = $this->module_info->list_count;  | 
                                                        |
| 15 | + }  | 
                                                        |
| 16 | +		if($this->module_info->mobile_list_count) { | 
                                                        |
| 17 | + $this->list_count = $this->module_info->mobile_list_count;  | 
                                                        |
| 18 | + }  | 
                                                        |
| 19 | +		if($this->module_info->search_list_count) { | 
                                                        |
| 20 | + $this->search_list_count = $this->module_info->search_list_count;  | 
                                                        |
| 21 | + }  | 
                                                        |
| 22 | +		if($this->module_info->mobile_search_list_count) { | 
                                                        |
| 23 | + $this->search_list_count = $this->module_info->mobile_search_list_count;  | 
                                                        |
| 24 | + }  | 
                                                        |
| 25 | +		if($this->module_info->page_count) { | 
                                                        |
| 26 | + $this->page_count = $this->module_info->page_count;  | 
                                                        |
| 27 | + }  | 
                                                        |
| 28 | +		if($this->module_info->mobile_page_count) { | 
                                                        |
| 29 | + $this->page_count = $this->module_info->mobile_page_count;  | 
                                                        |
| 30 | + }  | 
                                                        |
| 19 | 31 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true;  | 
                                                        
| 20 | 32 | |
| 21 | 33 | // $this->_getStatusNameListecret option backward compatibility  | 
                                                        
@@ -34,18 +46,15 @@ discard block  | 
                                                    ||
| 34 | 46 | if($this->module_info->hide_category)  | 
                                                        
| 35 | 47 |  			{ | 
                                                        
| 36 | 48 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y';  | 
                                                        
| 37 | - }  | 
                                                        |
| 38 | - else if($this->module_info->use_category)  | 
                                                        |
| 49 | + } else if($this->module_info->use_category)  | 
                                                        |
| 39 | 50 |  			{ | 
                                                        
| 40 | 51 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y';  | 
                                                        
| 41 | - }  | 
                                                        |
| 42 | - else  | 
                                                        |
| 52 | + } else  | 
                                                        |
| 43 | 53 |  			{ | 
                                                        
| 44 | 54 | $this->module_info->hide_category = 'N';  | 
                                                        
| 45 | 55 | $this->module_info->use_category = 'Y';  | 
                                                        
| 46 | 56 | }  | 
                                                        
| 47 | - }  | 
                                                        |
| 48 | - else  | 
                                                        |
| 57 | + } else  | 
                                                        |
| 49 | 58 |  		{ | 
                                                        
| 50 | 59 | $this->module_info->hide_category = 'Y';  | 
                                                        
| 51 | 60 | $this->module_info->use_category = 'N';  | 
                                                        
@@ -58,7 +67,9 @@ discard block  | 
                                                    ||
| 58 | 67 | if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)  | 
                                                        
| 59 | 68 |  		{ | 
                                                        
| 60 | 69 | $this->consultation = true;  | 
                                                        
| 61 | -			if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; | 
                                                        |
| 70 | +			if(!Context::get('is_logged')) { | 
                                                        |
| 71 | + $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 62 | 73 |  		} else { | 
                                                        
| 63 | 74 | $this->consultation = false;  | 
                                                        
| 64 | 75 | }  | 
                                                        
@@ -25,19 +25,19 @@ discard block  | 
                                                    ||
| 25 | 25 | |
| 26 | 26 | // get the list config value, if it is not exitsted then setup the default value  | 
                                                        
| 27 | 27 |  		$list_config = $oModuleModel->getModulePartConfig('board', $module_srl); | 
                                                        
| 28 | - if(!$list_config || count($list_config) <= 0)  | 
                                                        |
| 28 | + if (!$list_config || count($list_config) <= 0)  | 
                                                        |
| 29 | 29 |  		{ | 
                                                        
| 30 | - $list_config = array( 'no', 'title', 'nick_name','regdate','readed_count');  | 
                                                        |
| 30 | +			$list_config = array('no', 'title', 'nick_name', 'regdate', 'readed_count'); | 
                                                        |
| 31 | 31 | }  | 
                                                        
| 32 | 32 | |
| 33 | 33 | // get the extra variables  | 
                                                        
| 34 | 34 | $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl);  | 
                                                        
| 35 | 35 | |
| 36 | - foreach($list_config as $key)  | 
                                                        |
| 36 | + foreach ($list_config as $key)  | 
                                                        |
| 37 | 37 |  		{ | 
                                                        
| 38 | -			if(preg_match('/^([0-9]+)$/',$key)) | 
                                                        |
| 38 | +			if (preg_match('/^([0-9]+)$/', $key)) | 
                                                        |
| 39 | 39 |  			{ | 
                                                        
| 40 | - if($inserted_extra_vars[$key])  | 
                                                        |
| 40 | + if ($inserted_extra_vars[$key])  | 
                                                        |
| 41 | 41 |  				{ | 
                                                        
| 42 | 42 | $output['extra_vars'.$key] = $inserted_extra_vars[$key];  | 
                                                        
| 43 | 43 | }  | 
                                                        
@@ -60,9 +60,9 @@ discard block  | 
                                                    ||
| 60 | 60 | function getDefaultListConfig($module_srl)  | 
                                                        
| 61 | 61 |  	{ | 
                                                        
| 62 | 62 | // add virtual srl, title, registered date, update date, nickname, ID, name, readed count, voted count etc.  | 
                                                        
| 63 | - $virtual_vars = array( 'no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name',  | 
                                                        |
| 63 | +		$virtual_vars = array('no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name', | 
                                                        |
| 64 | 64 | 'user_id', 'user_name', 'readed_count', 'voted_count', 'blamed_count', 'thumbnail', 'summary', 'comment_status');  | 
                                                        
| 65 | - foreach($virtual_vars as $key)  | 
                                                        |
| 65 | + foreach ($virtual_vars as $key)  | 
                                                        |
| 66 | 66 |  		{ | 
                                                        
| 67 | 67 | $extra_vars[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null);  | 
                                                        
| 68 | 68 | }  | 
                                                        
@@ -71,9 +71,9 @@ discard block  | 
                                                    ||
| 71 | 71 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 72 | 72 | $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl);  | 
                                                        
| 73 | 73 | |
| 74 | - if(count($inserted_extra_vars))  | 
                                                        |
| 74 | + if (count($inserted_extra_vars))  | 
                                                        |
| 75 | 75 |  		{ | 
                                                        
| 76 | - foreach($inserted_extra_vars as $obj)  | 
                                                        |
| 76 | + foreach ($inserted_extra_vars as $obj)  | 
                                                        |
| 77 | 77 |  			{ | 
                                                        
| 78 | 78 | $extra_vars['extra_vars'.$obj->idx] = $obj;  | 
                                                        
| 79 | 79 | }  | 
                                                        
@@ -40,13 +40,11 @@  | 
                                                    ||
| 40 | 40 | if($inserted_extra_vars[$key])  | 
                                                        
| 41 | 41 |  				{ | 
                                                        
| 42 | 42 | $output['extra_vars'.$key] = $inserted_extra_vars[$key];  | 
                                                        
| 43 | - }  | 
                                                        |
| 44 | - else  | 
                                                        |
| 43 | + } else  | 
                                                        |
| 45 | 44 |  				{ | 
                                                        
| 46 | 45 | continue;  | 
                                                        
| 47 | 46 | }  | 
                                                        
| 48 | - }  | 
                                                        |
| 49 | - else  | 
                                                        |
| 47 | + } else  | 
                                                        |
| 50 | 48 |  			{ | 
                                                        
| 51 | 49 | $output[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null);  | 
                                                        
| 52 | 50 | }  | 
                                                        
@@ -7,7 +7,7 @@ discard block  | 
                                                    ||
| 7 | 7 | * @file config/config.inc.php  | 
                                                        
| 8 | 8 | * @author XEHub ([email protected])  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if(version_compare(PHP_VERSION, '5.4.0', '<'))  | 
                                                        |
| 10 | +if (version_compare(PHP_VERSION, '5.4.0', '<'))  | 
                                                        |
| 11 | 11 |  { | 
                                                        
| 12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);  | 
                                                        
| 13 | 13 | }  | 
                                                        
@@ -16,7 +16,7 @@ discard block  | 
                                                    ||
| 16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT);  | 
                                                        
| 17 | 17 | }  | 
                                                        
| 18 | 18 | |
| 19 | -if(!defined('__XE__')) | 
                                                        |
| 19 | +if (!defined('__XE__')) | 
                                                        |
| 20 | 20 |  { | 
                                                        
| 21 | 21 | exit();  | 
                                                        
| 22 | 22 | }  | 
                                                        
@@ -52,9 +52,9 @@ discard block  | 
                                                    ||
| 52 | 52 | // Set can use other method instead cookie to store session id(for file upload)  | 
                                                        
| 53 | 53 |  ini_set('session.use_only_cookies', 0); | 
                                                        
| 54 | 54 | |
| 55 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php'))  | 
                                                        |
| 55 | +if (file_exists(_XE_PATH_.'config/package.inc.php'))  | 
                                                        |
| 56 | 56 |  { | 
                                                        
| 57 | - require _XE_PATH_ . 'config/package.inc.php';  | 
                                                        |
| 57 | + require _XE_PATH_.'config/package.inc.php';  | 
                                                        |
| 58 | 58 | }  | 
                                                        
| 59 | 59 | else  | 
                                                        
| 60 | 60 |  { | 
                                                        
@@ -96,12 +96,12 @@ discard block  | 
                                                    ||
| 96 | 96 |   * define('__ENABLE_PHPUNIT_TEST__', 0); | 
                                                        
| 97 | 97 |   * define('__PROXY_SERVER__', 'http://domain:port/path'); | 
                                                        
| 98 | 98 | */  | 
                                                        
| 99 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php'))  | 
                                                        |
| 99 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php'))  | 
                                                        |
| 100 | 100 |  { | 
                                                        
| 101 | - require _XE_PATH_ . 'config/config.user.inc.php';  | 
                                                        |
| 101 | + require _XE_PATH_.'config/config.user.inc.php';  | 
                                                        |
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
| 104 | -if(!defined('__DEBUG__')) | 
                                                        |
| 104 | +if (!defined('__DEBUG__')) | 
                                                        |
| 105 | 105 |  { | 
                                                        
| 106 | 106 | /**  | 
                                                        
| 107 | 107 | * output debug message(bit value)  | 
                                                        
@@ -116,7 +116,7 @@ discard block  | 
                                                    ||
| 116 | 116 |  	define('__DEBUG__', 0); | 
                                                        
| 117 | 117 | }  | 
                                                        
| 118 | 118 | |
| 119 | -if(!defined('__DEBUG_OUTPUT__')) | 
                                                        |
| 119 | +if (!defined('__DEBUG_OUTPUT__')) | 
                                                        |
| 120 | 120 |  { | 
                                                        
| 121 | 121 | /**  | 
                                                        
| 122 | 122 | * output location of debug message  | 
                                                        
@@ -130,7 +130,7 @@ discard block  | 
                                                    ||
| 130 | 130 |  	define('__DEBUG_OUTPUT__', 0); | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | -if(!defined('__DEBUG_PROTECT__')) | 
                                                        |
| 133 | +if (!defined('__DEBUG_PROTECT__')) | 
                                                        |
| 134 | 134 |  { | 
                                                        
| 135 | 135 | /**  | 
                                                        
| 136 | 136 | * output comments of the firePHP console and browser  | 
                                                        
@@ -143,7 +143,7 @@ discard block  | 
                                                    ||
| 143 | 143 |  	define('__DEBUG_PROTECT__', 1); | 
                                                        
| 144 | 144 | }  | 
                                                        
| 145 | 145 | |
| 146 | -if(!defined('__DEBUG_PROTECT_IP__')) | 
                                                        |
| 146 | +if (!defined('__DEBUG_PROTECT_IP__')) | 
                                                        |
| 147 | 147 |  { | 
                                                        
| 148 | 148 | /**  | 
                                                        
| 149 | 149 | * Set a ip address to allow debug  | 
                                                        
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 |  	define('__DEBUG_PROTECT_IP__', '127.0.0.1'); | 
                                                        
| 152 | 152 | }  | 
                                                        
| 153 | 153 | |
| 154 | -if(!defined('__DEBUG_DB_OUTPUT__')) | 
                                                        |
| 154 | +if (!defined('__DEBUG_DB_OUTPUT__')) | 
                                                        |
| 155 | 155 |  { | 
                                                        
| 156 | 156 | /**  | 
                                                        
| 157 | 157 | * DB error message definition  | 
                                                        
@@ -164,7 +164,7 @@ discard block  | 
                                                    ||
| 164 | 164 |  	define('__DEBUG_DB_OUTPUT__', 0); | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | |
| 167 | -if(!defined('__LOG_SLOW_QUERY__')) | 
                                                        |
| 167 | +if (!defined('__LOG_SLOW_QUERY__')) | 
                                                        |
| 168 | 168 |  { | 
                                                        
| 169 | 169 | /**  | 
                                                        
| 170 | 170 | * Query log for only timeout query among DB queries  | 
                                                        
@@ -178,7 +178,7 @@ discard block  | 
                                                    ||
| 178 | 178 |  	define('__LOG_SLOW_QUERY__', 0); | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 | |
| 181 | -if(!defined('__LOG_SLOW_TRIGGER__')) | 
                                                        |
| 181 | +if (!defined('__LOG_SLOW_TRIGGER__')) | 
                                                        |
| 182 | 182 |  { | 
                                                        
| 183 | 183 | /**  | 
                                                        
| 184 | 184 | * Trigger excute time log  | 
                                                        
@@ -192,7 +192,7 @@ discard block  | 
                                                    ||
| 192 | 192 |  	define('__LOG_SLOW_TRIGGER__', 0); | 
                                                        
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | -if(!defined('__LOG_SLOW_ADDON__')) | 
                                                        |
| 195 | +if (!defined('__LOG_SLOW_ADDON__')) | 
                                                        |
| 196 | 196 |  { | 
                                                        
| 197 | 197 | /**  | 
                                                        
| 198 | 198 | * Addon excute time log  | 
                                                        
@@ -206,7 +206,7 @@ discard block  | 
                                                    ||
| 206 | 206 |  	define('__LOG_SLOW_ADDON__', 0); | 
                                                        
| 207 | 207 | }  | 
                                                        
| 208 | 208 | |
| 209 | -if(!defined('__LOG_SLOW_WIDGET__')) | 
                                                        |
| 209 | +if (!defined('__LOG_SLOW_WIDGET__')) | 
                                                        |
| 210 | 210 |  { | 
                                                        
| 211 | 211 | /**  | 
                                                        
| 212 | 212 | * Widget excute time log  | 
                                                        
@@ -220,7 +220,7 @@ discard block  | 
                                                    ||
| 220 | 220 |  	define('__LOG_SLOW_WIDGET__', 0); | 
                                                        
| 221 | 221 | }  | 
                                                        
| 222 | 222 | |
| 223 | -if(!defined('__DEBUG_QUERY__')) | 
                                                        |
| 223 | +if (!defined('__DEBUG_QUERY__')) | 
                                                        |
| 224 | 224 |  { | 
                                                        
| 225 | 225 | /**  | 
                                                        
| 226 | 226 | * Leave DB query information  | 
                                                        
@@ -233,7 +233,7 @@ discard block  | 
                                                    ||
| 233 | 233 |  	define('__DEBUG_QUERY__', 0); | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | 235 | |
| 236 | -if(!defined('__OB_GZHANDLER_ENABLE__')) | 
                                                        |
| 236 | +if (!defined('__OB_GZHANDLER_ENABLE__')) | 
                                                        |
| 237 | 237 |  { | 
                                                        
| 238 | 238 | /**  | 
                                                        
| 239 | 239 | * option to enable/disable a compression feature using ob_gzhandler  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 |  	define('__OB_GZHANDLER_ENABLE__', 1); | 
                                                        
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) | 
                                                        |
| 250 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) | 
                                                        |
| 251 | 251 |  { | 
                                                        
| 252 | 252 | /**  | 
                                                        
| 253 | 253 | * decide to use/not use the php unit test (Path/tests/index.php)  | 
                                                        
@@ -260,7 +260,7 @@ discard block  | 
                                                    ||
| 260 | 260 |  	define('__ENABLE_PHPUNIT_TEST__', 0); | 
                                                        
| 261 | 261 | }  | 
                                                        
| 262 | 262 | |
| 263 | -if(!defined('__PROXY_SERVER__')) | 
                                                        |
| 263 | +if (!defined('__PROXY_SERVER__')) | 
                                                        |
| 264 | 264 |  { | 
                                                        
| 265 | 265 | /**  | 
                                                        
| 266 | 266 | * __PROXY_SERVER__ has server information to request to the external through the target server  | 
                                                        
@@ -269,7 +269,7 @@ discard block  | 
                                                    ||
| 269 | 269 |  	define('__PROXY_SERVER__', NULL); | 
                                                        
| 270 | 270 | }  | 
                                                        
| 271 | 271 | |
| 272 | -if(!defined('__ERROR_LOG__')) | 
                                                        |
| 272 | +if (!defined('__ERROR_LOG__')) | 
                                                        |
| 273 | 273 |  { | 
                                                        
| 274 | 274 | /**  | 
                                                        
| 275 | 275 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다.  | 
                                                        
@@ -280,7 +280,7 @@ discard block  | 
                                                    ||
| 280 | 280 |  	define('__ERROR_LOG__', 0); | 
                                                        
| 281 | 281 | }  | 
                                                        
| 282 | 282 | |
| 283 | -if(!defined('__DISABLE_DEFAULT_CSS__')) | 
                                                        |
| 283 | +if (!defined('__DISABLE_DEFAULT_CSS__')) | 
                                                        |
| 284 | 284 |  { | 
                                                        
| 285 | 285 | /**  | 
                                                        
| 286 | 286 | * XE의 기본 CSS 스타일을 로드하지 않도록 합니다.  | 
                                                        
@@ -295,7 +295,7 @@ discard block  | 
                                                    ||
| 295 | 295 |  	define('__DISABLE_DEFAULT_CSS__', 0); | 
                                                        
| 296 | 296 | }  | 
                                                        
| 297 | 297 | |
| 298 | -if(!defined('__AUTO_OPCACHE_INVALIDATE__')) | 
                                                        |
| 298 | +if (!defined('__AUTO_OPCACHE_INVALIDATE__')) | 
                                                        |
| 299 | 299 |  { | 
                                                        
| 300 | 300 | /**  | 
                                                        
| 301 | 301 | * 업데이트 시 주요 파일의 OPcache를 자동 초기화 옵션  | 
                                                        
@@ -310,13 +310,13 @@ discard block  | 
                                                    ||
| 310 | 310 | }  | 
                                                        
| 311 | 311 | |
| 312 | 312 | // Require specific files when using Firebug console output  | 
                                                        
| 313 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 313 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 314 | 314 |  { | 
                                                        
| 315 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php';  | 
                                                        |
| 315 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';  | 
                                                        |
| 316 | 316 | }  | 
                                                        
| 317 | 317 | |
| 318 | 318 | // Set Timezone as server time  | 
                                                        
| 319 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0)  | 
                                                        |
| 319 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0)  | 
                                                        |
| 320 | 320 |  { | 
                                                        
| 321 | 321 | date_default_timezone_set(@date_default_timezone_get());  | 
                                                        
| 322 | 322 | }  | 
                                                        
@@ -422,8 +422,8 @@ discard block  | 
                                                    ||
| 422 | 422 | * Invalidates a cached script of OPcache when version is changed.  | 
                                                        
| 423 | 423 | * @see https://github.com/xpressengine/xe-core/issues/2189  | 
                                                        
| 424 | 424 | **/  | 
                                                        
| 425 | -$cache_path = _XE_PATH_ . 'files/cache/store/' . __XE_VERSION__;  | 
                                                        |
| 426 | -if(  | 
                                                        |
| 425 | +$cache_path = _XE_PATH_.'files/cache/store/'.__XE_VERSION__;  | 
                                                        |
| 426 | +if (  | 
                                                        |
| 427 | 427 | __AUTO_OPCACHE_INVALIDATE__ === 1  | 
                                                        
| 428 | 428 | && !is_dir($cache_path)  | 
                                                        
| 429 | 429 |  	&& function_exists('opcache_get_status') | 
                                                        
@@ -433,62 +433,62 @@ discard block  | 
                                                    ||
| 433 | 433 | @mkdir($cache_path, 0755, TRUE);  | 
                                                        
| 434 | 434 | @chmod($cache_path, 0755);  | 
                                                        
| 435 | 435 | |
| 436 | -	foreach($GLOBALS['__xe_autoload_file_map'] as $script) { | 
                                                        |
| 437 | - opcache_invalidate(_XE_PATH_ . $script, true);  | 
                                                        |
| 436 | +	foreach ($GLOBALS['__xe_autoload_file_map'] as $script) { | 
                                                        |
| 437 | + opcache_invalidate(_XE_PATH_.$script, true);  | 
                                                        |
| 438 | 438 | }  | 
                                                        
| 439 | - opcache_invalidate(_XE_PATH_ . 'config/func.inc.php', true);  | 
                                                        |
| 439 | + opcache_invalidate(_XE_PATH_.'config/func.inc.php', true);  | 
                                                        |
| 440 | 440 | }  | 
                                                        
| 441 | 441 | |
| 442 | 442 | // Require a function-defined-file for simple use  | 
                                                        
| 443 | -require(_XE_PATH_ . 'config/func.inc.php');  | 
                                                        |
| 443 | +require(_XE_PATH_.'config/func.inc.php');  | 
                                                        |
| 444 | 444 | |
| 445 | -if(__DEBUG__) { | 
                                                        |
| 445 | +if (__DEBUG__) { | 
                                                        |
| 446 | 446 |  	define('__StartTime__', getMicroTime()); | 
                                                        
| 447 | 447 | }  | 
                                                        
| 448 | 448 | |
| 449 | -if(__DEBUG__) { | 
                                                        |
| 449 | +if (__DEBUG__) { | 
                                                        |
| 450 | 450 | $GLOBALS['__elapsed_class_load__'] = 0;  | 
                                                        
| 451 | 451 | }  | 
                                                        
| 452 | 452 | |
| 453 | 453 | function __xe_autoload($class_name)  | 
                                                        
| 454 | 454 |  { | 
                                                        
| 455 | -	if(__DEBUG__) { | 
                                                        |
| 455 | +	if (__DEBUG__) { | 
                                                        |
| 456 | 456 | $time_at = getMicroTime();  | 
                                                        
| 457 | 457 | }  | 
                                                        
| 458 | 458 | |
| 459 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))  | 
                                                        |
| 459 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))  | 
                                                        |
| 460 | 460 |  	{ | 
                                                        
| 461 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];  | 
                                                        |
| 461 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];  | 
                                                        |
| 462 | 462 | }  | 
                                                        
| 463 | -	elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) | 
                                                        |
| 463 | +	elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) | 
                                                        |
| 464 | 464 |  	{ | 
                                                        
| 465 | 465 | $candidate_filename = array();  | 
                                                        
| 466 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1];  | 
                                                        |
| 467 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';  | 
                                                        |
| 466 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1];  | 
                                                        |
| 467 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';  | 
                                                        |
| 468 | 468 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class';  | 
                                                        
| 469 | 469 | $candidate_filename[] = 'php';  | 
                                                        
| 470 | 470 | |
| 471 | 471 |  		$candidate_filename = implode('.', $candidate_filename); | 
                                                        
| 472 | 472 | |
| 473 | - if(file_exists(_XE_PATH_ . $candidate_filename))  | 
                                                        |
| 473 | + if (file_exists(_XE_PATH_.$candidate_filename))  | 
                                                        |
| 474 | 474 |  		{ | 
                                                        
| 475 | - require _XE_PATH_ . $candidate_filename;  | 
                                                        |
| 475 | + require _XE_PATH_.$candidate_filename;  | 
                                                        |
| 476 | 476 | }  | 
                                                        
| 477 | 477 | }  | 
                                                        
| 478 | 478 | |
| 479 | -	if(__DEBUG__) { | 
                                                        |
| 479 | +	if (__DEBUG__) { | 
                                                        |
| 480 | 480 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at;  | 
                                                        
| 481 | 481 | }  | 
                                                        
| 482 | 482 | }  | 
                                                        
| 483 | 483 |  spl_autoload_register('__xe_autoload'); | 
                                                        
| 484 | 484 | |
| 485 | -if(version_compare(PHP_VERSION, '7.2', '<'))  | 
                                                        |
| 485 | +if (version_compare(PHP_VERSION, '7.2', '<'))  | 
                                                        |
| 486 | 486 |  { | 
                                                        
| 487 | 487 |  	class_alias('BaseObject', 'Object', true); | 
                                                        
| 488 | 488 | }  | 
                                                        
| 489 | 489 | |
| 490 | -if(file_exists(_XE_PATH_  . '/vendor/autoload.php')) { | 
                                                        |
| 491 | - require _XE_PATH_ . '/vendor/autoload.php';  | 
                                                        |
| 490 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { | 
                                                        |
| 491 | + require _XE_PATH_.'/vendor/autoload.php';  | 
                                                        |
| 492 | 492 | }  | 
                                                        
| 493 | 493 | /* End of file config.inc.php */  | 
                                                        
| 494 | 494 | /* Location: ./config/config.inc.php */  | 
                                                        
@@ -6,13 +6,13 @@ discard block  | 
                                                    ||
| 6 | 6 | *  | 
                                                        
| 7 | 7 | * @author XEHub ([email protected])  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if(!defined('__XE__')) | 
                                                        |
| 9 | +if (!defined('__XE__')) | 
                                                        |
| 10 | 10 |  { | 
                                                        
| 11 | 11 | exit();  | 
                                                        
| 12 | 12 | }  | 
                                                        
| 13 | 13 | |
| 14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist  | 
                                                        
| 15 | -if(!function_exists('iconv')) | 
                                                        |
| 15 | +if (!function_exists('iconv')) | 
                                                        |
| 16 | 16 |  { | 
                                                        
| 17 | 17 |  	eval(' | 
                                                        
| 18 | 18 | function iconv($in_charset, $out_charset, $str)  | 
                                                        
@@ -220,7 +220,7 @@ discard block  | 
                                                    ||
| 220 | 220 |  { | 
                                                        
| 221 | 221 | $oDB = DB::getInstance();  | 
                                                        
| 222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns);  | 
                                                        
| 223 | - if(!is_array($output->data) && count($output->data) > 0)  | 
                                                        |
| 223 | + if (!is_array($output->data) && count($output->data) > 0)  | 
                                                        |
| 224 | 224 |  	{ | 
                                                        
| 225 | 225 | $output->data = array($output->data);  | 
                                                        
| 226 | 226 | }  | 
                                                        
@@ -250,9 +250,9 @@ discard block  | 
                                                    ||
| 250 | 250 | function setUserSequence($seq)  | 
                                                        
| 251 | 251 |  { | 
                                                        
| 252 | 252 | $arr_seq = array();  | 
                                                        
| 253 | - if(isset($_SESSION['seq']))  | 
                                                        |
| 253 | + if (isset($_SESSION['seq']))  | 
                                                        |
| 254 | 254 |  	{ | 
                                                        
| 255 | -		if(!is_array($_SESSION['seq'])) { | 
                                                        |
| 255 | +		if (!is_array($_SESSION['seq'])) { | 
                                                        |
| 256 | 256 | $_SESSION['seq'] = array($_SESSION['seq']);  | 
                                                        
| 257 | 257 | }  | 
                                                        
| 258 | 258 | $arr_seq = $_SESSION['seq'];  | 
                                                        
@@ -269,11 +269,11 @@ discard block  | 
                                                    ||
| 269 | 269 | */  | 
                                                        
| 270 | 270 | function checkUserSequence($seq)  | 
                                                        
| 271 | 271 |  { | 
                                                        
| 272 | - if(!isset($_SESSION['seq']))  | 
                                                        |
| 272 | + if (!isset($_SESSION['seq']))  | 
                                                        |
| 273 | 273 |  	{ | 
                                                        
| 274 | 274 | return false;  | 
                                                        
| 275 | 275 | }  | 
                                                        
| 276 | - if(!in_array($seq, $_SESSION['seq']))  | 
                                                        |
| 276 | + if (!in_array($seq, $_SESSION['seq']))  | 
                                                        |
| 277 | 277 |  	{ | 
                                                        
| 278 | 278 | return false;  | 
                                                        
| 279 | 279 | }  | 
                                                        
@@ -299,7 +299,7 @@ discard block  | 
                                                    ||
| 299 | 299 | $num_args = func_num_args();  | 
                                                        
| 300 | 300 | $args_list = func_get_args();  | 
                                                        
| 301 | 301 | |
| 302 | - if($num_args)  | 
                                                        |
| 302 | + if ($num_args)  | 
                                                        |
| 303 | 303 | $url = Context::getUrl($num_args, $args_list);  | 
                                                        
| 304 | 304 | else  | 
                                                        
| 305 | 305 | $url = Context::getRequestUri();  | 
                                                        
@@ -318,7 +318,7 @@ discard block  | 
                                                    ||
| 318 | 318 | $num_args = func_num_args();  | 
                                                        
| 319 | 319 | $args_list = func_get_args();  | 
                                                        
| 320 | 320 | |
| 321 | - if($num_args)  | 
                                                        |
| 321 | + if ($num_args)  | 
                                                        |
| 322 | 322 |  	{ | 
                                                        
| 323 | 323 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 324 | 324 | }  | 
                                                        
@@ -341,7 +341,7 @@ discard block  | 
                                                    ||
| 341 | 341 | $num_args = func_num_args();  | 
                                                        
| 342 | 342 | $args_list = func_get_args();  | 
                                                        
| 343 | 343 | |
| 344 | - if($num_args)  | 
                                                        |
| 344 | + if ($num_args)  | 
                                                        |
| 345 | 345 |  	{ | 
                                                        
| 346 | 346 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);  | 
                                                        
| 347 | 347 | }  | 
                                                        
@@ -363,16 +363,16 @@ discard block  | 
                                                    ||
| 363 | 363 | $num_args = func_num_args();  | 
                                                        
| 364 | 364 | $args_list = func_get_args();  | 
                                                        
| 365 | 365 | $request_uri = Context::getRequestUri();  | 
                                                        
| 366 | - if(!$num_args)  | 
                                                        |
| 366 | + if (!$num_args)  | 
                                                        |
| 367 | 367 |  	{ | 
                                                        
| 368 | 368 | return $request_uri;  | 
                                                        
| 369 | 369 | }  | 
                                                        
| 370 | 370 | |
| 371 | 371 | $url = Context::getUrl($num_args, $args_list);  | 
                                                        
| 372 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 372 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 373 | 373 |  	{ | 
                                                        
| 374 | 374 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 375 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 375 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 376 | 376 | }  | 
                                                        
| 377 | 377 | return $url;  | 
                                                        
| 378 | 378 | }  | 
                                                        
@@ -387,17 +387,17 @@ discard block  | 
                                                    ||
| 387 | 387 | $num_args = func_num_args();  | 
                                                        
| 388 | 388 | $args_list = func_get_args();  | 
                                                        
| 389 | 389 | $request_uri = Context::getRequestUri();  | 
                                                        
| 390 | - if(!$num_args)  | 
                                                        |
| 390 | + if (!$num_args)  | 
                                                        |
| 391 | 391 |  	{ | 
                                                        
| 392 | 392 | return $request_uri;  | 
                                                        
| 393 | 393 | }  | 
                                                        
| 394 | 394 | |
| 395 | 395 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 396 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 396 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 397 | 397 |  	{ | 
                                                        
| 398 | 398 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 399 | 399 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE);  | 
                                                        
| 400 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 400 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 401 | 401 | }  | 
                                                        
| 402 | 402 | return $url;  | 
                                                        
| 403 | 403 | }  | 
                                                        
@@ -413,7 +413,7 @@ discard block  | 
                                                    ||
| 413 | 413 | $num_args = func_num_args();  | 
                                                        
| 414 | 414 | $args_list = func_get_args();  | 
                                                        
| 415 | 415 | |
| 416 | - if(!$num_args)  | 
                                                        |
| 416 | + if (!$num_args)  | 
                                                        |
| 417 | 417 |  	{ | 
                                                        
| 418 | 418 | return Context::getRequestUri();  | 
                                                        
| 419 | 419 | }  | 
                                                        
@@ -435,7 +435,7 @@ discard block  | 
                                                    ||
| 435 | 435 | $num_args = func_num_args();  | 
                                                        
| 436 | 436 | $args_list = func_get_args();  | 
                                                        
| 437 | 437 | |
| 438 | - if(!$num_args)  | 
                                                        |
| 438 | + if (!$num_args)  | 
                                                        |
| 439 | 439 |  	{ | 
                                                        
| 440 | 440 | return Context::getRequestUri();  | 
                                                        
| 441 | 441 | }  | 
                                                        
@@ -457,7 +457,7 @@ discard block  | 
                                                    ||
| 457 | 457 | $args_list = func_get_args();  | 
                                                        
| 458 | 458 | |
| 459 | 459 | $request_uri = Context::getRequestUri();  | 
                                                        
| 460 | - if(!$num_args)  | 
                                                        |
| 460 | + if (!$num_args)  | 
                                                        |
| 461 | 461 |  	{ | 
                                                        
| 462 | 462 | return $request_uri;  | 
                                                        
| 463 | 463 | }  | 
                                                        
@@ -466,10 +466,10 @@ discard block  | 
                                                    ||
| 466 | 466 | $num_args = count($args_list);  | 
                                                        
| 467 | 467 | |
| 468 | 468 | $url = Context::getUrl($num_args, $args_list, $domain);  | 
                                                        
| 469 | -	if(strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 469 | +	if (strncasecmp('http', $url, 4) !== 0) | 
                                                        |
| 470 | 470 |  	{ | 
                                                        
| 471 | 471 |  		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); | 
                                                        
| 472 | - return substr($match[0], 0, -1) . $url;  | 
                                                        |
| 472 | + return substr($match[0], 0, -1).$url;  | 
                                                        |
| 473 | 473 | }  | 
                                                        
| 474 | 474 | return $url;  | 
                                                        
| 475 | 475 | }  | 
                                                        
@@ -482,7 +482,7 @@ discard block  | 
                                                    ||
| 482 | 482 | function getCurrentPageUrl()  | 
                                                        
| 483 | 483 |  { | 
                                                        
| 484 | 484 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';  | 
                                                        
| 485 | -	$url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); | 
                                                        |
| 485 | +	$url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); | 
                                                        |
| 486 | 486 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);  | 
                                                        
| 487 | 487 | }  | 
                                                        
| 488 | 488 | |
@@ -507,12 +507,12 @@ discard block  | 
                                                    ||
| 507 | 507 | */  | 
                                                        
| 508 | 508 | function cut_str($string, $cut_size = 0, $tail = '...')  | 
                                                        
| 509 | 509 |  { | 
                                                        
| 510 | - if($cut_size < 1 || !$string)  | 
                                                        |
| 510 | + if ($cut_size < 1 || !$string)  | 
                                                        |
| 511 | 511 |  	{ | 
                                                        
| 512 | 512 | return $string;  | 
                                                        
| 513 | 513 | }  | 
                                                        
| 514 | 514 | |
| 515 | -	if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) | 
                                                        |
| 515 | +	if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) | 
                                                        |
| 516 | 516 |  	{ | 
                                                        
| 517 | 517 | $GLOBALS['use_mb_strimwidth'] = TRUE;  | 
                                                        
| 518 | 518 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8');  | 
                                                        
@@ -526,16 +526,16 @@ discard block  | 
                                                    ||
| 526 | 526 | $char_count = 0;  | 
                                                        
| 527 | 527 | |
| 528 | 528 | $idx = 0;  | 
                                                        
| 529 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)  | 
                                                        |
| 529 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)  | 
                                                        |
| 530 | 530 |  	{ | 
                                                        
| 531 | 531 | $c = ord(substr($string, $idx, 1));  | 
                                                        
| 532 | 532 | $char_count++;  | 
                                                        
| 533 | - if($c < 128)  | 
                                                        |
| 533 | + if ($c < 128)  | 
                                                        |
| 534 | 534 |  		{ | 
                                                        
| 535 | 535 | $char_width += (int) $chars[$c - 32];  | 
                                                        
| 536 | 536 | $idx++;  | 
                                                        
| 537 | 537 | }  | 
                                                        
| 538 | - else if(191 < $c && $c < 224)  | 
                                                        |
| 538 | + else if (191 < $c && $c < 224)  | 
                                                        |
| 539 | 539 |  		{ | 
                                                        
| 540 | 540 | $char_width += $chars[4];  | 
                                                        
| 541 | 541 | $idx += 2;  | 
                                                        
@@ -548,7 +548,7 @@ discard block  | 
                                                    ||
| 548 | 548 | }  | 
                                                        
| 549 | 549 | |
| 550 | 550 | $output = substr($string, 0, $idx);  | 
                                                        
| 551 | - if(strlen($output) < $string_length)  | 
                                                        |
| 551 | + if (strlen($output) < $string_length)  | 
                                                        |
| 552 | 552 |  	{ | 
                                                        
| 553 | 553 | $output .= $tail;  | 
                                                        
| 554 | 554 | }  | 
                                                        
@@ -564,7 +564,7 @@ discard block  | 
                                                    ||
| 564 | 564 | function zgap()  | 
                                                        
| 565 | 565 |  { | 
                                                        
| 566 | 566 | $time_zone = $GLOBALS['_time_zone'];  | 
                                                        
| 567 | - if($time_zone < 0)  | 
                                                        |
| 567 | + if ($time_zone < 0)  | 
                                                        |
| 568 | 568 |  	{ | 
                                                        
| 569 | 569 | $to = -1;  | 
                                                        
| 570 | 570 | }  | 
                                                        
@@ -577,7 +577,7 @@ discard block  | 
                                                    ||
| 577 | 577 | $t_min = substr($time_zone, 3, 2) * $to;  | 
                                                        
| 578 | 578 | |
| 579 | 579 |  	$server_time_zone = date("O"); | 
                                                        
| 580 | - if($server_time_zone < 0)  | 
                                                        |
| 580 | + if ($server_time_zone < 0)  | 
                                                        |
| 581 | 581 |  	{ | 
                                                        
| 582 | 582 | $so = -1;  | 
                                                        
| 583 | 583 | }  | 
                                                        
@@ -604,7 +604,7 @@ discard block  | 
                                                    ||
| 604 | 604 | */  | 
                                                        
| 605 | 605 | function ztime($str)  | 
                                                        
| 606 | 606 |  { | 
                                                        
| 607 | - if(!$str)  | 
                                                        |
| 607 | + if (!$str)  | 
                                                        |
| 608 | 608 |  	{ | 
                                                        
| 609 | 609 | return;  | 
                                                        
| 610 | 610 | }  | 
                                                        
@@ -619,7 +619,7 @@ discard block  | 
                                                    ||
| 619 | 619 | $year = (int) substr($str, 0, 4);  | 
                                                        
| 620 | 620 | $month = (int) substr($str, 4, 2);  | 
                                                        
| 621 | 621 | $day = (int) substr($str, 6, 2);  | 
                                                        
| 622 | - if(strlen($str) <= 8)  | 
                                                        |
| 622 | + if (strlen($str) <= 8)  | 
                                                        |
| 623 | 623 |  	{ | 
                                                        
| 624 | 624 | $gap = 0;  | 
                                                        
| 625 | 625 | }  | 
                                                        
@@ -643,19 +643,19 @@ discard block  | 
                                                    ||
| 643 | 643 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);  | 
                                                        
| 644 | 644 | |
| 645 | 645 |  	$lang_time_gap = Context::getLang('time_gap'); | 
                                                        
| 646 | - if($gap < 60)  | 
                                                        |
| 646 | + if ($gap < 60)  | 
                                                        |
| 647 | 647 |  	{ | 
                                                        
| 648 | 648 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);  | 
                                                        
| 649 | 649 | }  | 
                                                        
| 650 | - elseif($gap < 60 * 60)  | 
                                                        |
| 650 | + elseif ($gap < 60 * 60)  | 
                                                        |
| 651 | 651 |  	{ | 
                                                        
| 652 | 652 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);  | 
                                                        
| 653 | 653 | }  | 
                                                        
| 654 | - elseif($gap < 60 * 60 * 2)  | 
                                                        |
| 654 | + elseif ($gap < 60 * 60 * 2)  | 
                                                        |
| 655 | 655 |  	{ | 
                                                        
| 656 | 656 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);  | 
                                                        
| 657 | 657 | }  | 
                                                        
| 658 | - elseif($gap < 60 * 60 * 24)  | 
                                                        |
| 658 | + elseif ($gap < 60 * 60 * 24)  | 
                                                        |
| 659 | 659 |  	{ | 
                                                        
| 660 | 660 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);  | 
                                                        
| 661 | 661 | }  | 
                                                        
@@ -692,40 +692,40 @@ discard block  | 
                                                    ||
| 692 | 692 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)  | 
                                                        
| 693 | 693 |  { | 
                                                        
| 694 | 694 | // return null if no target time is specified  | 
                                                        
| 695 | - if(!$str)  | 
                                                        |
| 695 | + if (!$str)  | 
                                                        |
| 696 | 696 |  	{ | 
                                                        
| 697 | 697 | return;  | 
                                                        
| 698 | 698 | }  | 
                                                        
| 699 | 699 | // convert the date format according to the language  | 
                                                        
| 700 | - if($conversion == TRUE)  | 
                                                        |
| 700 | + if ($conversion == TRUE)  | 
                                                        |
| 701 | 701 |  	{ | 
                                                        
| 702 | - switch(Context::getLangType())  | 
                                                        |
| 702 | + switch (Context::getLangType())  | 
                                                        |
| 703 | 703 |  		{ | 
                                                        
| 704 | 704 | case 'en' :  | 
                                                        
| 705 | 705 | case 'es' :  | 
                                                        
| 706 | - if($format == 'Y-m-d')  | 
                                                        |
| 706 | + if ($format == 'Y-m-d')  | 
                                                        |
| 707 | 707 |  				{ | 
                                                        
| 708 | 708 | $format = 'M d, Y';  | 
                                                        
| 709 | 709 | }  | 
                                                        
| 710 | - elseif($format == 'Y-m-d H:i:s')  | 
                                                        |
| 710 | + elseif ($format == 'Y-m-d H:i:s')  | 
                                                        |
| 711 | 711 |  				{ | 
                                                        
| 712 | 712 | $format = 'M d, Y H:i:s';  | 
                                                        
| 713 | 713 | }  | 
                                                        
| 714 | - elseif($format == 'Y-m-d H:i')  | 
                                                        |
| 714 | + elseif ($format == 'Y-m-d H:i')  | 
                                                        |
| 715 | 715 |  				{ | 
                                                        
| 716 | 716 | $format = 'M d, Y H:i';  | 
                                                        
| 717 | 717 | }  | 
                                                        
| 718 | 718 | break;  | 
                                                        
| 719 | 719 | case 'vi' :  | 
                                                        
| 720 | - if($format == 'Y-m-d')  | 
                                                        |
| 720 | + if ($format == 'Y-m-d')  | 
                                                        |
| 721 | 721 |  				{ | 
                                                        
| 722 | 722 | $format = 'd-m-Y';  | 
                                                        
| 723 | 723 | }  | 
                                                        
| 724 | - elseif($format == 'Y-m-d H:i:s')  | 
                                                        |
| 724 | + elseif ($format == 'Y-m-d H:i:s')  | 
                                                        |
| 725 | 725 |  				{ | 
                                                        
| 726 | 726 | $format = 'H:i:s d-m-Y';  | 
                                                        
| 727 | 727 | }  | 
                                                        
| 728 | - elseif($format == 'Y-m-d H:i')  | 
                                                        |
| 728 | + elseif ($format == 'Y-m-d H:i')  | 
                                                        |
| 729 | 729 |  				{ | 
                                                        
| 730 | 730 | $format = 'H:i d-m-Y';  | 
                                                        
| 731 | 731 | }  | 
                                                        
@@ -734,7 +734,7 @@ discard block  | 
                                                    ||
| 734 | 734 | }  | 
                                                        
| 735 | 735 | |
| 736 | 736 | // If year value is less than 1970, handle it separately.  | 
                                                        
| 737 | - if((int) substr($str, 0, 4) < 1970)  | 
                                                        |
| 737 | + if ((int) substr($str, 0, 4) < 1970)  | 
                                                        |
| 738 | 738 |  	{ | 
                                                        
| 739 | 739 | $hour = (int) substr($str, 8, 2);  | 
                                                        
| 740 | 740 | $min = (int) substr($str, 10, 2);  | 
                                                        
@@ -784,9 +784,9 @@ discard block  | 
                                                    ||
| 784 | 784 | function getEncodeEmailAddress($email)  | 
                                                        
| 785 | 785 |  { | 
                                                        
| 786 | 786 | $return = '';  | 
                                                        
| 787 | - for($i = 0, $c = strlen($email); $i < $c; $i++)  | 
                                                        |
| 787 | + for ($i = 0, $c = strlen($email); $i < $c; $i++)  | 
                                                        |
| 788 | 788 |  	{ | 
                                                        
| 789 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';  | 
                                                        |
| 789 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';';  | 
                                                        |
| 790 | 790 | }  | 
                                                        
| 791 | 791 | return $return;  | 
                                                        
| 792 | 792 | }  | 
                                                        
@@ -806,25 +806,25 @@ discard block  | 
                                                    ||
| 806 | 806 |  { | 
                                                        
| 807 | 807 | static $debug_file;  | 
                                                        
| 808 | 808 | |
| 809 | - if(!(__DEBUG__ & 1))  | 
                                                        |
| 809 | + if (!(__DEBUG__ & 1))  | 
                                                        |
| 810 | 810 |  	{ | 
                                                        
| 811 | 811 | return;  | 
                                                        
| 812 | 812 | }  | 
                                                        
| 813 | 813 | |
| 814 | 814 | static $firephp;  | 
                                                        
| 815 | 815 | $bt = debug_backtrace();  | 
                                                        
| 816 | - if(is_array($bt))  | 
                                                        |
| 816 | + if (is_array($bt))  | 
                                                        |
| 817 | 817 |  	{ | 
                                                        
| 818 | 818 | $bt_debug_print = array_shift($bt);  | 
                                                        
| 819 | 819 | $bt_called_function = array_shift($bt);  | 
                                                        
| 820 | 820 | }  | 
                                                        
| 821 | 821 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);  | 
                                                        
| 822 | 822 | $line_num = $bt_debug_print['line'];  | 
                                                        
| 823 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];  | 
                                                        |
| 823 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];  | 
                                                        |
| 824 | 824 | |
| 825 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 825 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)  | 
                                                        |
| 826 | 826 |  	{ | 
                                                        
| 827 | - if(!isset($firephp))  | 
                                                        |
| 827 | + if (!isset($firephp))  | 
                                                        |
| 828 | 828 |  		{ | 
                                                        
| 829 | 829 | $firephp = FirePHP::getInstance(TRUE);  | 
                                                        
| 830 | 830 | }  | 
                                                        
@@ -833,16 +833,16 @@ discard block  | 
                                                    ||
| 833 | 833 |  		$label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); | 
                                                        
| 834 | 834 | |
| 835 | 835 | // Check a FirePHP option  | 
                                                        
| 836 | - if($display_option === 'TABLE')  | 
                                                        |
| 836 | + if ($display_option === 'TABLE')  | 
                                                        |
| 837 | 837 |  		{ | 
                                                        
| 838 | 838 | $label = $display_option;  | 
                                                        
| 839 | 839 | }  | 
                                                        
| 840 | - if($display_option === 'ERROR')  | 
                                                        |
| 840 | + if ($display_option === 'ERROR')  | 
                                                        |
| 841 | 841 |  		{ | 
                                                        
| 842 | 842 | $type = $display_option;  | 
                                                        
| 843 | 843 | }  | 
                                                        
| 844 | 844 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.  | 
                                                        
| 845 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 845 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 846 | 846 |  		{ | 
                                                        
| 847 | 847 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';  | 
                                                        
| 848 | 848 | $label = NULL;  | 
                                                        
@@ -852,52 +852,52 @@ discard block  | 
                                                    ||
| 852 | 852 | }  | 
                                                        
| 853 | 853 | else  | 
                                                        
| 854 | 854 |  	{ | 
                                                        
| 855 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 855 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])  | 
                                                        |
| 856 | 856 |  		{ | 
                                                        
| 857 | 857 | return;  | 
                                                        
| 858 | 858 | }  | 
                                                        
| 859 | 859 | |
| 860 | 860 | $print = array();  | 
                                                        
| 861 | - if(!$debug_file)  | 
                                                        |
| 861 | + if (!$debug_file)  | 
                                                        |
| 862 | 862 |  		{ | 
                                                        
| 863 | - $debug_file = _XE_PATH_ . 'files/' . $file;  | 
                                                        |
| 863 | + $debug_file = _XE_PATH_.'files/'.$file;  | 
                                                        |
| 864 | 864 | }  | 
                                                        
| 865 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';  | 
                                                        |
| 865 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';  | 
                                                        |
| 866 | 866 | |
| 867 | - if($display_option === TRUE || $display_option === 'ERROR')  | 
                                                        |
| 867 | + if ($display_option === TRUE || $display_option === 'ERROR')  | 
                                                        |
| 868 | 868 |  		{ | 
                                                        
| 869 | -			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; | 
                                                        |
| 869 | +			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; | 
                                                        |
| 870 | 870 |  			$print[] = str_repeat('=', 80); | 
                                                        
| 871 | 871 | }  | 
                                                        
| 872 | 872 | $type = gettype($debug_output);  | 
                                                        
| 873 | -		if(!in_array($type, array('array', 'object', 'resource'))) | 
                                                        |
| 873 | +		if (!in_array($type, array('array', 'object', 'resource'))) | 
                                                        |
| 874 | 874 |  		{ | 
                                                        
| 875 | - if($display_option === 'ERROR')  | 
                                                        |
| 875 | + if ($display_option === 'ERROR')  | 
                                                        |
| 876 | 876 |  			{ | 
                                                        
| 877 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE);  | 
                                                        |
| 877 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE);  | 
                                                        |
| 878 | 878 | }  | 
                                                        
| 879 | 879 | else  | 
                                                        
| 880 | 880 |  			{ | 
                                                        
| 881 | -				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; | 
                                                        |
| 881 | +				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; | 
                                                        |
| 882 | 882 | }  | 
                                                        
| 883 | 883 | }  | 
                                                        
| 884 | 884 | else  | 
                                                        
| 885 | 885 |  		{ | 
                                                        
| 886 | -			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true))); | 
                                                        |
| 886 | +			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true))); | 
                                                        |
| 887 | 887 | }  | 
                                                        
| 888 | 888 |  		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; | 
                                                        
| 889 | 889 | $backtrace = debug_backtrace($backtrace_args);  | 
                                                        
| 890 | 890 | |
| 891 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])  | 
                                                        |
| 891 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])  | 
                                                        |
| 892 | 892 |  		{ | 
                                                        
| 893 | 893 | array_shift($backtrace);  | 
                                                        
| 894 | 894 | }  | 
                                                        
| 895 | - foreach($backtrace as $val)  | 
                                                        |
| 895 | + foreach ($backtrace as $val)  | 
                                                        |
| 896 | 896 |  		{ | 
                                                        
| 897 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line'];  | 
                                                        |
| 897 | + $print[] = ' - '.$val['file'].' : '.$val['line'];  | 
                                                        |
| 898 | 898 | }  | 
                                                        
| 899 | 899 | $print[] = PHP_EOL;  | 
                                                        
| 900 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);  | 
                                                        |
| 900 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);  | 
                                                        |
| 901 | 901 | }  | 
                                                        
| 902 | 902 | }  | 
                                                        
| 903 | 903 | |
@@ -908,7 +908,7 @@ discard block  | 
                                                    ||
| 908 | 908 | */  | 
                                                        
| 909 | 909 | function writeSlowlog($type, $elapsed_time, $obj)  | 
                                                        
| 910 | 910 |  { | 
                                                        
| 911 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;  | 
                                                        |
| 911 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;  | 
                                                        |
| 912 | 912 | |
| 913 | 913 | static $log_filename = array(  | 
                                                        
| 914 | 914 | 'query' => 'files/_slowlog_query.php',  | 
                                                        
@@ -918,47 +918,47 @@ discard block  | 
                                                    ||
| 918 | 918 | );  | 
                                                        
| 919 | 919 | $write_file = true;  | 
                                                        
| 920 | 920 | |
| 921 | - $log_file = _XE_PATH_ . $log_filename[$type];  | 
                                                        |
| 921 | + $log_file = _XE_PATH_.$log_filename[$type];  | 
                                                        |
| 922 | 922 | |
| 923 | 923 | $buff = array();  | 
                                                        
| 924 | 924 | $buff[] = '<?php exit(); ?>';  | 
                                                        
| 925 | 925 |  	$buff[] = date('c'); | 
                                                        
| 926 | 926 | |
| 927 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)  | 
                                                        |
| 927 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)  | 
                                                        |
| 928 | 928 |  	{ | 
                                                        
| 929 | - $buff[] = "\tCaller : " . $obj->caller;  | 
                                                        |
| 930 | - $buff[] = "\tCalled : " . $obj->called;  | 
                                                        |
| 929 | + $buff[] = "\tCaller : ".$obj->caller;  | 
                                                        |
| 930 | + $buff[] = "\tCalled : ".$obj->called;  | 
                                                        |
| 931 | 931 | }  | 
                                                        
| 932 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)  | 
                                                        |
| 932 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)  | 
                                                        |
| 933 | 933 |  	{ | 
                                                        
| 934 | - $buff[] = "\tAddon : " . $obj->called;  | 
                                                        |
| 935 | - $buff[] = "\tCalled position : " . $obj->caller;  | 
                                                        |
| 934 | + $buff[] = "\tAddon : ".$obj->called;  | 
                                                        |
| 935 | + $buff[] = "\tCalled position : ".$obj->caller;  | 
                                                        |
| 936 | 936 | }  | 
                                                        
| 937 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)  | 
                                                        |
| 937 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)  | 
                                                        |
| 938 | 938 |  	{ | 
                                                        
| 939 | - $buff[] = "\tWidget : " . $obj->called;  | 
                                                        |
| 939 | + $buff[] = "\tWidget : ".$obj->called;  | 
                                                        |
| 940 | 940 | }  | 
                                                        
| 941 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)  | 
                                                        |
| 941 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)  | 
                                                        |
| 942 | 942 |  	{ | 
                                                        
| 943 | 943 | |
| 944 | 944 | $buff[] = $obj->query;  | 
                                                        
| 945 | - $buff[] = "\tQuery ID : " . $obj->query_id;  | 
                                                        |
| 946 | - $buff[] = "\tCaller : " . $obj->caller;  | 
                                                        |
| 947 | - $buff[] = "\tConnection : " . $obj->connection;  | 
                                                        |
| 945 | + $buff[] = "\tQuery ID : ".$obj->query_id;  | 
                                                        |
| 946 | + $buff[] = "\tCaller : ".$obj->caller;  | 
                                                        |
| 947 | + $buff[] = "\tConnection : ".$obj->connection;  | 
                                                        |
| 948 | 948 | }  | 
                                                        
| 949 | 949 | else  | 
                                                        
| 950 | 950 |  	{ | 
                                                        
| 951 | 951 | $write_file = false;  | 
                                                        
| 952 | 952 | }  | 
                                                        
| 953 | 953 | |
| 954 | - if($write_file)  | 
                                                        |
| 954 | + if ($write_file)  | 
                                                        |
| 955 | 955 |  	{ | 
                                                        
| 956 | 956 |  		$buff[] = sprintf("\t%0.6f sec", $elapsed_time); | 
                                                        
| 957 | - $buff[] = PHP_EOL . PHP_EOL;  | 
                                                        |
| 957 | + $buff[] = PHP_EOL.PHP_EOL;  | 
                                                        |
| 958 | 958 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);  | 
                                                        
| 959 | 959 | }  | 
                                                        
| 960 | 960 | |
| 961 | - if($type != 'query')  | 
                                                        |
| 961 | + if ($type != 'query')  | 
                                                        |
| 962 | 962 |  	{ | 
                                                        
| 963 | 963 | $trigger_args = $obj;  | 
                                                        
| 964 | 964 | $trigger_args->_log_type = $type;  | 
                                                        
@@ -998,11 +998,11 @@ discard block  | 
                                                    ||
| 998 | 998 | */  | 
                                                        
| 999 | 999 | function delObjectVars($target_obj, $del_obj)  | 
                                                        
| 1000 | 1000 |  { | 
                                                        
| 1001 | - if(!is_object($target_obj))  | 
                                                        |
| 1001 | + if (!is_object($target_obj))  | 
                                                        |
| 1002 | 1002 |  	{ | 
                                                        
| 1003 | 1003 | return;  | 
                                                        
| 1004 | 1004 | }  | 
                                                        
| 1005 | - if(!is_object($del_obj))  | 
                                                        |
| 1005 | + if (!is_object($del_obj))  | 
                                                        |
| 1006 | 1006 |  	{ | 
                                                        
| 1007 | 1007 | return;  | 
                                                        
| 1008 | 1008 | }  | 
                                                        
@@ -1012,7 +1012,7 @@ discard block  | 
                                                    ||
| 1012 | 1012 | |
| 1013 | 1013 | $target = array_keys($target_vars);  | 
                                                        
| 1014 | 1014 | $del = array_keys($del_vars);  | 
                                                        
| 1015 | - if(!count($target) || !count($del))  | 
                                                        |
| 1015 | + if (!count($target) || !count($del))  | 
                                                        |
| 1016 | 1016 |  	{ | 
                                                        
| 1017 | 1017 | return $target_obj;  | 
                                                        
| 1018 | 1018 | }  | 
                                                        
@@ -1020,10 +1020,10 @@ discard block  | 
                                                    ||
| 1020 | 1020 | $return_obj = new stdClass();  | 
                                                        
| 1021 | 1021 | |
| 1022 | 1022 | $target_count = count($target);  | 
                                                        
| 1023 | - for($i = 0; $i < $target_count; $i++)  | 
                                                        |
| 1023 | + for ($i = 0; $i < $target_count; $i++)  | 
                                                        |
| 1024 | 1024 |  	{ | 
                                                        
| 1025 | 1025 | $target_key = $target[$i];  | 
                                                        
| 1026 | - if(!in_array($target_key, $del))  | 
                                                        |
| 1026 | + if (!in_array($target_key, $del))  | 
                                                        |
| 1027 | 1027 |  		{ | 
                                                        
| 1028 | 1028 |  			$return_obj->{$target_key} = $target_obj->{$target_key}; | 
                                                        
| 1029 | 1029 | }  | 
                                                        
@@ -1036,10 +1036,10 @@ discard block  | 
                                                    ||
| 1036 | 1036 |  { | 
                                                        
| 1037 | 1037 |  	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); | 
                                                        
| 1038 | 1038 | |
| 1039 | - foreach($del_vars as $var)  | 
                                                        |
| 1039 | + foreach ($del_vars as $var)  | 
                                                        |
| 1040 | 1040 |  	{ | 
                                                        
| 1041 | - if(is_array($vars)) unset($vars[$var]);  | 
                                                        |
| 1042 | - else if(is_object($vars)) unset($vars->$var);  | 
                                                        |
| 1041 | + if (is_array($vars)) unset($vars[$var]);  | 
                                                        |
| 1042 | + else if (is_object($vars)) unset($vars->$var);  | 
                                                        |
| 1043 | 1043 | }  | 
                                                        
| 1044 | 1044 | |
| 1045 | 1045 | return $vars;  | 
                                                        
@@ -1056,12 +1056,12 @@ discard block  | 
                                                    ||
| 1056 | 1056 | */  | 
                                                        
| 1057 | 1057 | function handleError($errno, $errstr, $file, $line)  | 
                                                        
| 1058 | 1058 |  { | 
                                                        
| 1059 | - if(!__DEBUG__)  | 
                                                        |
| 1059 | + if (!__DEBUG__)  | 
                                                        |
| 1060 | 1060 |  	{ | 
                                                        
| 1061 | 1061 | return;  | 
                                                        
| 1062 | 1062 | }  | 
                                                        
| 1063 | 1063 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE);  | 
                                                        
| 1064 | - if(!in_array($errno, $errors))  | 
                                                        |
| 1064 | + if (!in_array($errno, $errors))  | 
                                                        |
| 1065 | 1065 |  	{ | 
                                                        
| 1066 | 1066 | return;  | 
                                                        
| 1067 | 1067 | }  | 
                                                        
@@ -1081,8 +1081,8 @@ discard block  | 
                                                    ||
| 1081 | 1081 | function getNumberingPath($no, $size = 3)  | 
                                                        
| 1082 | 1082 |  { | 
                                                        
| 1083 | 1083 | $mod = pow(10, $size);  | 
                                                        
| 1084 | -	$output = sprintf('%0' . $size . 'd/', $no % $mod); | 
                                                        |
| 1085 | - if($no >= $mod)  | 
                                                        |
| 1084 | +	$output = sprintf('%0'.$size.'d/', $no % $mod); | 
                                                        |
| 1085 | + if ($no >= $mod)  | 
                                                        |
| 1086 | 1086 |  	{ | 
                                                        
| 1087 | 1087 | $output .= getNumberingPath((int) $no / $mod, $size);  | 
                                                        
| 1088 | 1088 | }  | 
                                                        
@@ -1102,12 +1102,12 @@ discard block  | 
                                                    ||
| 1102 | 1102 | |
| 1103 | 1103 | function purifierHtml(&$content)  | 
                                                        
| 1104 | 1104 |  { | 
                                                        
| 1105 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');  | 
                                                        |
| 1105 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php');  | 
                                                        |
| 1106 | 1106 | $oPurifier = Purifier::getInstance();  | 
                                                        
| 1107 | 1107 | |
| 1108 | 1108 | // @see https://github.com/xpressengine/xe-core/issues/2278  | 
                                                        
| 1109 | 1109 |  	$logged_info = Context::get('logged_info'); | 
                                                        
| 1110 | -	if($logged_info->is_admin !== 'Y') { | 
                                                        |
| 1110 | +	if ($logged_info->is_admin !== 'Y') { | 
                                                        |
| 1111 | 1111 |  		$oPurifier->setConfig('HTML.Nofollow', true); | 
                                                        
| 1112 | 1112 | }  | 
                                                        
| 1113 | 1113 | |
@@ -1122,7 +1122,7 @@ discard block  | 
                                                    ||
| 1122 | 1122 | */  | 
                                                        
| 1123 | 1123 | function removeHackTag($content)  | 
                                                        
| 1124 | 1124 |  { | 
                                                        
| 1125 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 1125 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');  | 
                                                        |
| 1126 | 1126 | $oEmbedFilter = EmbedFilter::getInstance();  | 
                                                        
| 1127 | 1127 | $oEmbedFilter->check($content);  | 
                                                        
| 1128 | 1128 | |
@@ -1164,7 +1164,7 @@ discard block  | 
                                                    ||
| 1164 | 1164 | */  | 
                                                        
| 1165 | 1165 | function checkUploadedFile($file, $filename = null)  | 
                                                        
| 1166 | 1166 |  { | 
                                                        
| 1167 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');  | 
                                                        |
| 1167 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');  | 
                                                        |
| 1168 | 1168 | return UploadFileFilter::check($file, $filename);  | 
                                                        
| 1169 | 1169 | }  | 
                                                        
| 1170 | 1170 | |
@@ -1178,13 +1178,13 @@ discard block  | 
                                                    ||
| 1178 | 1178 |  { | 
                                                        
| 1179 | 1179 |  	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); | 
                                                        
| 1180 | 1180 | |
| 1181 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)  | 
                                                        |
| 1181 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)  | 
                                                        |
| 1182 | 1182 |  	{ | 
                                                        
| 1183 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)  | 
                                                        |
| 1183 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)  | 
                                                        |
| 1184 | 1184 |  		{ | 
                                                        
| 1185 | 1185 | $content .= '</xmp>';  | 
                                                        
| 1186 | 1186 | }  | 
                                                        
| 1187 | - else if($close_xmp < $start_xmp)  | 
                                                        |
| 1187 | + else if ($close_xmp < $start_xmp)  | 
                                                        |
| 1188 | 1188 |  		{ | 
                                                        
| 1189 | 1189 | $content .= '</xmp>';  | 
                                                        
| 1190 | 1190 | }  | 
                                                        
@@ -1204,33 +1204,33 @@ discard block  | 
                                                    ||
| 1204 | 1204 | $tag = strtolower($match[2]);  | 
                                                        
| 1205 | 1205 | |
| 1206 | 1206 | // xmp tag ?뺣━  | 
                                                        
| 1207 | - if($tag == 'xmp')  | 
                                                        |
| 1207 | + if ($tag == 'xmp')  | 
                                                        |
| 1208 | 1208 |  	{ | 
                                                        
| 1209 | 1209 |  		return "<{$match[1]}xmp>"; | 
                                                        
| 1210 | 1210 | }  | 
                                                        
| 1211 | - if($match[1])  | 
                                                        |
| 1211 | + if ($match[1])  | 
                                                        |
| 1212 | 1212 |  	{ | 
                                                        
| 1213 | 1213 | return $match[0];  | 
                                                        
| 1214 | 1214 | }  | 
                                                        
| 1215 | - if($match[4])  | 
                                                        |
| 1215 | + if ($match[4])  | 
                                                        |
| 1216 | 1216 |  	{ | 
                                                        
| 1217 | - $match[4] = ' ' . $match[4];  | 
                                                        |
| 1217 | + $match[4] = ' '.$match[4];  | 
                                                        |
| 1218 | 1218 | }  | 
                                                        
| 1219 | 1219 | |
| 1220 | 1220 | $attrs = array();  | 
                                                        
| 1221 | -	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) | 
                                                        |
| 1221 | +	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) | 
                                                        |
| 1222 | 1222 |  	{ | 
                                                        
| 1223 | - foreach($m[1] as $idx => $name)  | 
                                                        |
| 1223 | + foreach ($m[1] as $idx => $name)  | 
                                                        |
| 1224 | 1224 |  		{ | 
                                                        
| 1225 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)  | 
                                                        |
| 1225 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)  | 
                                                        |
| 1226 | 1226 |  			{ | 
                                                        
| 1227 | 1227 | continue;  | 
                                                        
| 1228 | 1228 | }  | 
                                                        
| 1229 | 1229 | |
| 1230 | -			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); | 
                                                        |
| 1230 | +			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); | 
                                                        |
| 1231 | 1231 |  			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); | 
                                                        
| 1232 | 1232 | |
| 1233 | -			if(preg_match('/^[a-z]+script:/i', $val)) | 
                                                        |
| 1233 | +			if (preg_match('/^[a-z]+script:/i', $val)) | 
                                                        |
| 1234 | 1234 |  			{ | 
                                                        
| 1235 | 1235 | continue;  | 
                                                        
| 1236 | 1236 | }  | 
                                                        
@@ -1241,60 +1241,60 @@ discard block  | 
                                                    ||
| 1241 | 1241 | |
| 1242 | 1242 |  	$filter_arrts = array('style', 'src', 'href'); | 
                                                        
| 1243 | 1243 | |
| 1244 | - if($tag === 'object') array_push($filter_arrts, 'data');  | 
                                                        |
| 1245 | - if($tag === 'param') array_push($filter_arrts, 'value');  | 
                                                        |
| 1244 | + if ($tag === 'object') array_push($filter_arrts, 'data');  | 
                                                        |
| 1245 | + if ($tag === 'param') array_push($filter_arrts, 'value');  | 
                                                        |
| 1246 | 1246 | |
| 1247 | - foreach($filter_arrts as $attr)  | 
                                                        |
| 1247 | + foreach ($filter_arrts as $attr)  | 
                                                        |
| 1248 | 1248 |  	{ | 
                                                        
| 1249 | - if(!isset($attrs[$attr])) continue;  | 
                                                        |
| 1249 | + if (!isset($attrs[$attr])) continue;  | 
                                                        |
| 1250 | 1250 | |
| 1251 | 1251 | $attr_value = rawurldecode($attrs[$attr]);  | 
                                                        
| 1252 | 1252 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);  | 
                                                        
| 1253 | 1253 |  		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); | 
                                                        
| 1254 | -		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') | 
                                                        |
| 1254 | +		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') | 
                                                        |
| 1255 | 1255 |  		{ | 
                                                        
| 1256 | 1256 | unset($attrs[$attr]);  | 
                                                        
| 1257 | 1257 | }  | 
                                                        
| 1258 | 1258 | }  | 
                                                        
| 1259 | 1259 | |
| 1260 | -	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) | 
                                                        |
| 1260 | +	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) | 
                                                        |
| 1261 | 1261 |  	{ | 
                                                        
| 1262 | 1262 | unset($attrs['style']);  | 
                                                        
| 1263 | 1263 | }  | 
                                                        
| 1264 | 1264 | |
| 1265 | 1265 | $attr = array();  | 
                                                        
| 1266 | - foreach($attrs as $name => $val)  | 
                                                        |
| 1266 | + foreach ($attrs as $name => $val)  | 
                                                        |
| 1267 | 1267 |  	{ | 
                                                        
| 1268 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a')  | 
                                                        |
| 1268 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a')  | 
                                                        |
| 1269 | 1269 |  		{ | 
                                                        
| 1270 | 1270 | $attribute = strtolower(trim($name));  | 
                                                        
| 1271 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')  | 
                                                        |
| 1271 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')  | 
                                                        |
| 1272 | 1272 |  			{ | 
                                                        
| 1273 | - if(stripos($val, 'data:') === 0)  | 
                                                        |
| 1273 | + if (stripos($val, 'data:') === 0)  | 
                                                        |
| 1274 | 1274 |  				{ | 
                                                        
| 1275 | 1275 | continue;  | 
                                                        
| 1276 | 1276 | }  | 
                                                        
| 1277 | 1277 | }  | 
                                                        
| 1278 | 1278 | }  | 
                                                        
| 1279 | 1279 | |
| 1280 | - if($tag == 'img')  | 
                                                        |
| 1280 | + if ($tag == 'img')  | 
                                                        |
| 1281 | 1281 |  		{ | 
                                                        
| 1282 | 1282 | $attribute = strtolower(trim($name));  | 
                                                        
| 1283 | - if(stripos($val, 'data:') === 0)  | 
                                                        |
| 1283 | + if (stripos($val, 'data:') === 0)  | 
                                                        |
| 1284 | 1284 |  			{ | 
                                                        
| 1285 | 1285 | continue;  | 
                                                        
| 1286 | 1286 | }  | 
                                                        
| 1287 | 1287 | }  | 
                                                        
| 1288 | 1288 |  		$val = str_replace('"', '"', $val); | 
                                                        
| 1289 | -		$attr[] = $name . "=\"{$val}\""; | 
                                                        |
| 1289 | +		$attr[] = $name."=\"{$val}\""; | 
                                                        |
| 1290 | 1290 | }  | 
                                                        
| 1291 | -	$attr = count($attr) ? ' ' . implode(' ', $attr) : ''; | 
                                                        |
| 1291 | +	$attr = count($attr) ? ' '.implode(' ', $attr) : ''; | 
                                                        |
| 1292 | 1292 | |
| 1293 | 1293 |  	return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; | 
                                                        
| 1294 | 1294 | }  | 
                                                        
| 1295 | 1295 | |
| 1296 | 1296 | // convert hexa value to RGB  | 
                                                        
| 1297 | -if(!function_exists('hexrgb')) | 
                                                        |
| 1297 | +if (!function_exists('hexrgb')) | 
                                                        |
| 1298 | 1298 |  { | 
                                                        
| 1299 | 1299 | |
| 1300 | 1300 | /**  | 
                                                        
@@ -1330,9 +1330,9 @@ discard block  | 
                                                    ||
| 1330 | 1330 | |
| 1331 | 1331 | settype($password, "string");  | 
                                                        
| 1332 | 1332 | |
| 1333 | - for($i = 0; $i < strlen($password); $i++)  | 
                                                        |
| 1333 | + for ($i = 0; $i < strlen($password); $i++)  | 
                                                        |
| 1334 | 1334 |  	{ | 
                                                        
| 1335 | - if($password[$i] == ' ' || $password[$i] == '\t')  | 
                                                        |
| 1335 | + if ($password[$i] == ' ' || $password[$i] == '\t')  | 
                                                        |
| 1336 | 1336 |  		{ | 
                                                        
| 1337 | 1337 | continue;  | 
                                                        
| 1338 | 1338 | }  | 
                                                        
@@ -1344,11 +1344,11 @@ discard block  | 
                                                    ||
| 1344 | 1344 |  	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); | 
                                                        
| 1345 | 1345 |  	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); | 
                                                        
| 1346 | 1346 | |
| 1347 | - if($result1 == '80000000')  | 
                                                        |
| 1347 | + if ($result1 == '80000000')  | 
                                                        |
| 1348 | 1348 |  	{ | 
                                                        
| 1349 | 1349 | $nr += 0x80000000;  | 
                                                        
| 1350 | 1350 | }  | 
                                                        
| 1351 | - if($result2 == '80000000')  | 
                                                        |
| 1351 | + if ($result2 == '80000000')  | 
                                                        |
| 1352 | 1352 |  	{ | 
                                                        
| 1353 | 1353 | $nr2 += 0x80000000;  | 
                                                        
| 1354 | 1354 | }  | 
                                                        
@@ -1364,7 +1364,7 @@ discard block  | 
                                                    ||
| 1364 | 1364 | function getScriptPath()  | 
                                                        
| 1365 | 1365 |  { | 
                                                        
| 1366 | 1366 | static $url = NULL;  | 
                                                        
| 1367 | - if($url == NULL)  | 
                                                        |
| 1367 | + if ($url == NULL)  | 
                                                        |
| 1368 | 1368 |  	{ | 
                                                        
| 1369 | 1369 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);  | 
                                                        
| 1370 | 1370 |  		$url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); | 
                                                        
@@ -1395,14 +1395,14 @@ discard block  | 
                                                    ||
| 1395 | 1395 | $decodedStr = '';  | 
                                                        
| 1396 | 1396 | $pos = 0;  | 
                                                        
| 1397 | 1397 | $len = strlen($source);  | 
                                                        
| 1398 | - while($pos < $len)  | 
                                                        |
| 1398 | + while ($pos < $len)  | 
                                                        |
| 1399 | 1399 |  	{ | 
                                                        
| 1400 | 1400 | $charAt = substr($source, $pos, 1);  | 
                                                        
| 1401 | - if($charAt == '%')  | 
                                                        |
| 1401 | + if ($charAt == '%')  | 
                                                        |
| 1402 | 1402 |  		{ | 
                                                        
| 1403 | 1403 | $pos++;  | 
                                                        
| 1404 | 1404 | $charAt = substr($source, $pos, 1);  | 
                                                        
| 1405 | - if($charAt == 'u')  | 
                                                        |
| 1405 | + if ($charAt == 'u')  | 
                                                        |
| 1406 | 1406 |  			{ | 
                                                        
| 1407 | 1407 | // we got a unicode character  | 
                                                        
| 1408 | 1408 | $pos++;  | 
                                                        
@@ -1436,21 +1436,21 @@ discard block  | 
                                                    ||
| 1436 | 1436 | */  | 
                                                        
| 1437 | 1437 | function _code2utf($num)  | 
                                                        
| 1438 | 1438 |  { | 
                                                        
| 1439 | - if($num < 128)  | 
                                                        |
| 1439 | + if ($num < 128)  | 
                                                        |
| 1440 | 1440 |  	{ | 
                                                        
| 1441 | 1441 | return chr($num);  | 
                                                        
| 1442 | 1442 | }  | 
                                                        
| 1443 | - if($num < 2048)  | 
                                                        |
| 1443 | + if ($num < 2048)  | 
                                                        |
| 1444 | 1444 |  	{ | 
                                                        
| 1445 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128);  | 
                                                        |
| 1445 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128);  | 
                                                        |
| 1446 | 1446 | }  | 
                                                        
| 1447 | - if($num < 65536)  | 
                                                        |
| 1447 | + if ($num < 65536)  | 
                                                        |
| 1448 | 1448 |  	{ | 
                                                        
| 1449 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);  | 
                                                        |
| 1449 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);  | 
                                                        |
| 1450 | 1450 | }  | 
                                                        
| 1451 | - if($num < 2097152)  | 
                                                        |
| 1451 | + if ($num < 2097152)  | 
                                                        |
| 1452 | 1452 |  	{ | 
                                                        
| 1453 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);  | 
                                                        |
| 1453 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);  | 
                                                        |
| 1454 | 1454 | }  | 
                                                        
| 1455 | 1455 | return '';  | 
                                                        
| 1456 | 1456 | }  | 
                                                        
@@ -1465,7 +1465,7 @@ discard block  | 
                                                    ||
| 1465 | 1465 | */  | 
                                                        
| 1466 | 1466 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)  | 
                                                        
| 1467 | 1467 |  { | 
                                                        
| 1468 | - if($urldecode)  | 
                                                        |
| 1468 | + if ($urldecode)  | 
                                                        |
| 1469 | 1469 |  	{ | 
                                                        
| 1470 | 1470 | $string = urldecode($string);  | 
                                                        
| 1471 | 1471 | }  | 
                                                        
@@ -1473,12 +1473,12 @@ discard block  | 
                                                    ||
| 1473 | 1473 |  	$sample = iconv('utf-8', 'utf-8', $string); | 
                                                        
| 1474 | 1474 | $is_utf8 = (md5($sample) === md5($string));  | 
                                                        
| 1475 | 1475 | |
| 1476 | - if(!$urldecode)  | 
                                                        |
| 1476 | + if (!$urldecode)  | 
                                                        |
| 1477 | 1477 |  	{ | 
                                                        
| 1478 | 1478 | $string = urldecode($string);  | 
                                                        
| 1479 | 1479 | }  | 
                                                        
| 1480 | 1480 | |
| 1481 | - if($return_convert)  | 
                                                        |
| 1481 | + if ($return_convert)  | 
                                                        |
| 1482 | 1482 |  	{ | 
                                                        
| 1483 | 1483 |  		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); | 
                                                        
| 1484 | 1484 | }  | 
                                                        
@@ -1494,7 +1494,7 @@ discard block  | 
                                                    ||
| 1494 | 1494 | */  | 
                                                        
| 1495 | 1495 | function json_encode2($data)  | 
                                                        
| 1496 | 1496 |  { | 
                                                        
| 1497 | - switch(gettype($data))  | 
                                                        |
| 1497 | + switch (gettype($data))  | 
                                                        |
| 1498 | 1498 |  	{ | 
                                                        
| 1499 | 1499 | case 'boolean':  | 
                                                        
| 1500 | 1500 | return $data ? 'true' : 'false';  | 
                                                        
@@ -1502,15 +1502,15 @@ discard block  | 
                                                    ||
| 1502 | 1502 | case 'double':  | 
                                                        
| 1503 | 1503 | return $data;  | 
                                                        
| 1504 | 1504 | case 'string':  | 
                                                        
| 1505 | -			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; | 
                                                        |
| 1505 | +			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; | 
                                                        |
| 1506 | 1506 | case 'object':  | 
                                                        
| 1507 | 1507 | $data = get_object_vars($data);  | 
                                                        
| 1508 | 1508 | case 'array':  | 
                                                        
| 1509 | 1509 | $rel = FALSE; // relative array?  | 
                                                        
| 1510 | 1510 | $key = array_keys($data);  | 
                                                        
| 1511 | - foreach($key as $v)  | 
                                                        |
| 1511 | + foreach ($key as $v)  | 
                                                        |
| 1512 | 1512 |  			{ | 
                                                        
| 1513 | - if(!is_int($v))  | 
                                                        |
| 1513 | + if (!is_int($v))  | 
                                                        |
| 1514 | 1514 |  				{ | 
                                                        
| 1515 | 1515 | $rel = TRUE;  | 
                                                        
| 1516 | 1516 | break;  | 
                                                        
@@ -1518,12 +1518,12 @@ discard block  | 
                                                    ||
| 1518 | 1518 | }  | 
                                                        
| 1519 | 1519 | |
| 1520 | 1520 | $arr = array();  | 
                                                        
| 1521 | - foreach($data as $k => $v)  | 
                                                        |
| 1521 | + foreach ($data as $k => $v)  | 
                                                        |
| 1522 | 1522 |  			{ | 
                                                        
| 1523 | -				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); | 
                                                        |
| 1523 | +				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); | 
                                                        |
| 1524 | 1524 | }  | 
                                                        
| 1525 | 1525 | |
| 1526 | -			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; | 
                                                        |
| 1526 | +			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; | 
                                                        |
| 1527 | 1527 | default:  | 
                                                        
| 1528 | 1528 | return '""';  | 
                                                        
| 1529 | 1529 | }  | 
                                                        
@@ -1537,7 +1537,7 @@ discard block  | 
                                                    ||
| 1537 | 1537 | */  | 
                                                        
| 1538 | 1538 | function isCrawler($agent = NULL)  | 
                                                        
| 1539 | 1539 |  { | 
                                                        
| 1540 | - if(!$agent)  | 
                                                        |
| 1540 | + if (!$agent)  | 
                                                        |
| 1541 | 1541 |  	{ | 
                                                        
| 1542 | 1542 | $agent = $_SERVER['HTTP_USER_AGENT'];  | 
                                                        
| 1543 | 1543 | }  | 
                                                        
@@ -1547,9 +1547,9 @@ discard block  | 
                                                    ||
| 1547 | 1547 | /*'211.245.21.110-211.245.21.119' mixsh is closed */  | 
                                                        
| 1548 | 1548 | );  | 
                                                        
| 1549 | 1549 | |
| 1550 | - foreach($check_agent as $str)  | 
                                                        |
| 1550 | + foreach ($check_agent as $str)  | 
                                                        |
| 1551 | 1551 |  	{ | 
                                                        
| 1552 | - if(stristr($agent, $str) != FALSE)  | 
                                                        |
| 1552 | + if (stristr($agent, $str) != FALSE)  | 
                                                        |
| 1553 | 1553 |  		{ | 
                                                        
| 1554 | 1554 | return TRUE;  | 
                                                        
| 1555 | 1555 | }  | 
                                                        
@@ -1567,7 +1567,7 @@ discard block  | 
                                                    ||
| 1567 | 1567 | */  | 
                                                        
| 1568 | 1568 | function stripEmbedTagForAdmin(&$content, $writer_member_srl)  | 
                                                        
| 1569 | 1569 |  { | 
                                                        
| 1570 | -	if(!Context::get('is_logged')) | 
                                                        |
| 1570 | +	if (!Context::get('is_logged')) | 
                                                        |
| 1571 | 1571 |  	{ | 
                                                        
| 1572 | 1572 | return;  | 
                                                        
| 1573 | 1573 | }  | 
                                                        
@@ -1575,18 +1575,18 @@ discard block  | 
                                                    ||
| 1575 | 1575 |  	$oModuleModel = getModel('module'); | 
                                                        
| 1576 | 1576 |  	$logged_info = Context::get('logged_info'); | 
                                                        
| 1577 | 1577 | |
| 1578 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))  | 
                                                        |
| 1578 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))  | 
                                                        |
| 1579 | 1579 |  	{ | 
                                                        
| 1580 | - if($writer_member_srl)  | 
                                                        |
| 1580 | + if ($writer_member_srl)  | 
                                                        |
| 1581 | 1581 |  		{ | 
                                                        
| 1582 | 1582 |  			$oMemberModel = getModel('member'); | 
                                                        
| 1583 | 1583 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);  | 
                                                        
| 1584 | - if($member_info->is_admin == "Y")  | 
                                                        |
| 1584 | + if ($member_info->is_admin == "Y")  | 
                                                        |
| 1585 | 1585 |  			{ | 
                                                        
| 1586 | 1586 | return;  | 
                                                        
| 1587 | 1587 | }  | 
                                                        
| 1588 | 1588 | }  | 
                                                        
| 1589 | -		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; | 
                                                        |
| 1589 | +		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; | 
                                                        |
| 1590 | 1590 |  		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); | 
                                                        
| 1591 | 1591 |  		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); | 
                                                        
| 1592 | 1592 |  		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); | 
                                                        
@@ -1603,18 +1603,18 @@ discard block  | 
                                                    ||
| 1603 | 1603 | function requirePear()  | 
                                                        
| 1604 | 1604 |  { | 
                                                        
| 1605 | 1605 | static $required = false;  | 
                                                        
| 1606 | - if($required)  | 
                                                        |
| 1606 | + if ($required)  | 
                                                        |
| 1607 | 1607 |  	{ | 
                                                        
| 1608 | 1608 | return;  | 
                                                        
| 1609 | 1609 | }  | 
                                                        
| 1610 | 1610 | |
| 1611 | - if(version_compare(PHP_VERSION, "5.3.0") < 0)  | 
                                                        |
| 1611 | + if (version_compare(PHP_VERSION, "5.3.0") < 0)  | 
                                                        |
| 1612 | 1612 |  	{ | 
                                                        
| 1613 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());  | 
                                                        |
| 1613 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 1614 | 1614 | }  | 
                                                        
| 1615 | 1615 | else  | 
                                                        
| 1616 | 1616 |  	{ | 
                                                        
| 1617 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());  | 
                                                        |
| 1617 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 1618 | 1618 | }  | 
                                                        
| 1619 | 1619 | |
| 1620 | 1620 | $required = true;  | 
                                                        
@@ -1622,7 +1622,7 @@ discard block  | 
                                                    ||
| 1622 | 1622 | |
| 1623 | 1623 | function checkCSRF()  | 
                                                        
| 1624 | 1624 |  { | 
                                                        
| 1625 | - if($_SERVER['REQUEST_METHOD'] != 'POST')  | 
                                                        |
| 1625 | + if ($_SERVER['REQUEST_METHOD'] != 'POST')  | 
                                                        |
| 1626 | 1626 |  	{ | 
                                                        
| 1627 | 1627 | return FALSE;  | 
                                                        
| 1628 | 1628 | }  | 
                                                        
@@ -1630,9 +1630,9 @@ discard block  | 
                                                    ||
| 1630 | 1630 | $default_url = Context::getDefaultUrl();  | 
                                                        
| 1631 | 1631 | $referer = $_SERVER["HTTP_REFERER"];  | 
                                                        
| 1632 | 1632 | |
| 1633 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)  | 
                                                        |
| 1633 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)  | 
                                                        |
| 1634 | 1634 |  	{ | 
                                                        
| 1635 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1635 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');  | 
                                                        |
| 1636 | 1636 |  		$IDN = new idna_convert(array('idn_version' => 2008)); | 
                                                        
| 1637 | 1637 | $referer = $IDN->encode($referer);  | 
                                                        
| 1638 | 1638 | }  | 
                                                        
@@ -1643,9 +1643,9 @@ discard block  | 
                                                    ||
| 1643 | 1643 |  	$oModuleModel = getModel('module'); | 
                                                        
| 1644 | 1644 | $siteModuleInfo = $oModuleModel->getDefaultMid();  | 
                                                        
| 1645 | 1645 | |
| 1646 | - if($siteModuleInfo->site_srl == 0)  | 
                                                        |
| 1646 | + if ($siteModuleInfo->site_srl == 0)  | 
                                                        |
| 1647 | 1647 |  	{ | 
                                                        
| 1648 | - if($default_url['host'] !== $referer['host'])  | 
                                                        |
| 1648 | + if ($default_url['host'] !== $referer['host'])  | 
                                                        |
| 1649 | 1649 |  		{ | 
                                                        
| 1650 | 1650 | return FALSE;  | 
                                                        
| 1651 | 1651 | }  | 
                                                        
@@ -1653,7 +1653,7 @@ discard block  | 
                                                    ||
| 1653 | 1653 | else  | 
                                                        
| 1654 | 1654 |  	{ | 
                                                        
| 1655 | 1655 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);  | 
                                                        
| 1656 | -		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) | 
                                                        |
| 1656 | +		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) | 
                                                        |
| 1657 | 1657 |  		{ | 
                                                        
| 1658 | 1658 | return FALSE;  | 
                                                        
| 1659 | 1659 | }  | 
                                                        
@@ -1669,15 +1669,15 @@ discard block  | 
                                                    ||
| 1669 | 1669 | */  | 
                                                        
| 1670 | 1670 | function recurciveExposureCheck(&$menu)  | 
                                                        
| 1671 | 1671 |  { | 
                                                        
| 1672 | - if(is_array($menu))  | 
                                                        |
| 1672 | + if (is_array($menu))  | 
                                                        |
| 1673 | 1673 |  	{ | 
                                                        
| 1674 | - foreach($menu AS $key=>$value)  | 
                                                        |
| 1674 | + foreach ($menu AS $key=>$value)  | 
                                                        |
| 1675 | 1675 |  		{ | 
                                                        
| 1676 | - if(!$value['isShow'])  | 
                                                        |
| 1676 | + if (!$value['isShow'])  | 
                                                        |
| 1677 | 1677 |  			{ | 
                                                        
| 1678 | 1678 | unset($menu[$key]);  | 
                                                        
| 1679 | 1679 | }  | 
                                                        
| 1680 | - if(is_array($value['list']) && count($value['list']) > 0)  | 
                                                        |
| 1680 | + if (is_array($value['list']) && count($value['list']) > 0)  | 
                                                        |
| 1681 | 1681 |  			{ | 
                                                        
| 1682 | 1682 | recurciveExposureCheck($menu[$key]['list']);  | 
                                                        
| 1683 | 1683 | }  | 
                                                        
@@ -1687,14 +1687,14 @@ discard block  | 
                                                    ||
| 1687 | 1687 | |
| 1688 | 1688 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')  | 
                                                        
| 1689 | 1689 |  { | 
                                                        
| 1690 | - if($requestKey != $dbKey)  | 
                                                        |
| 1690 | + if ($requestKey != $dbKey)  | 
                                                        |
| 1691 | 1691 |  	{ | 
                                                        
| 1692 | 1692 |  		$arrayUrl = parse_url(Context::get('success_return_url')); | 
                                                        
| 1693 | - if($arrayUrl['query'])  | 
                                                        |
| 1693 | + if ($arrayUrl['query'])  | 
                                                        |
| 1694 | 1694 |  		{ | 
                                                        
| 1695 | 1695 | parse_str($arrayUrl['query'], $parsedStr);  | 
                                                        
| 1696 | 1696 | |
| 1697 | - if(isset($parsedStr[$key]))  | 
                                                        |
| 1697 | + if (isset($parsedStr[$key]))  | 
                                                        |
| 1698 | 1698 |  			{ | 
                                                        
| 1699 | 1699 | $parsedStr[$key] = $requestKey;  | 
                                                        
| 1700 | 1700 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);  | 
                                                        
@@ -1737,14 +1737,14 @@ discard block  | 
                                                    ||
| 1737 | 1737 | */  | 
                                                        
| 1738 | 1738 | function alertScript($msg)  | 
                                                        
| 1739 | 1739 |  { | 
                                                        
| 1740 | - if(!$msg)  | 
                                                        |
| 1740 | + if (!$msg)  | 
                                                        |
| 1741 | 1741 |  	{ | 
                                                        
| 1742 | 1742 | return;  | 
                                                        
| 1743 | 1743 | }  | 
                                                        
| 1744 | 1744 | |
| 1745 | 1745 | echo '<script type="text/javascript">  | 
                                                        
| 1746 | 1746 | //<![CDATA[  | 
                                                        
| 1747 | -alert("' . $msg . '"); | 
                                                        |
| 1747 | +alert("' . $msg.'"); | 
                                                        |
| 1748 | 1748 | //]]>  | 
                                                        
| 1749 | 1749 | </script>';  | 
                                                        
| 1750 | 1750 | }  | 
                                                        
@@ -1775,7 +1775,7 @@ discard block  | 
                                                    ||
| 1775 | 1775 | |
| 1776 | 1776 | echo '<script type="text/javascript">  | 
                                                        
| 1777 | 1777 | //<![CDATA[  | 
                                                        
| 1778 | -' . $reloadScript . '  | 
                                                        |
| 1778 | +' . $reloadScript.'  | 
                                                        |
| 1779 | 1779 | //]]>  | 
                                                        
| 1780 | 1780 | </script>';  | 
                                                        
| 1781 | 1781 | }  | 
                                                        
@@ -1798,7 +1798,7 @@ discard block  | 
                                                    ||
| 1798 | 1798 | */  | 
                                                        
| 1799 | 1799 | function escape($str, $double_escape = true, $escape_defined_lang_code = false)  | 
                                                        
| 1800 | 1800 |  { | 
                                                        
| 1801 | - if(!$escape_defined_lang_code && isDefinedLangCode($str)) return $str;  | 
                                                        |
| 1801 | + if (!$escape_defined_lang_code && isDefinedLangCode($str)) return $str;  | 
                                                        |
| 1802 | 1802 | |
| 1803 | 1803 | $flags = ENT_QUOTES | ENT_SUBSTITUTE;  | 
                                                        
| 1804 | 1804 | return htmlspecialchars($str, $flags, 'UTF-8', $double_escape);  | 
                                                        
@@ -1830,7 +1830,7 @@ discard block  | 
                                                    ||
| 1830 | 1830 | function escape_js($str)  | 
                                                        
| 1831 | 1831 |  { | 
                                                        
| 1832 | 1832 | $flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE;  | 
                                                        
| 1833 | - $str = json_encode((string)$str, $flags);  | 
                                                        |
| 1833 | + $str = json_encode((string) $str, $flags);  | 
                                                        |
| 1834 | 1834 | return substr($str, 1, strlen($str) - 2);  | 
                                                        
| 1835 | 1835 | }  | 
                                                        
| 1836 | 1836 | |
@@ -1882,12 +1882,12 @@ discard block  | 
                                                    ||
| 1882 | 1882 |  { | 
                                                        
| 1883 | 1883 | if ($limit < 1) $limit = null;  | 
                                                        
| 1884 | 1884 | $result = array();  | 
                                                        
| 1885 | -	$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); | 
                                                        |
| 1885 | +	$split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit); | 
                                                        |
| 1886 | 1886 | foreach ($split as $piece)  | 
                                                        
| 1887 | 1887 |  	{ | 
                                                        
| 1888 | 1888 | if (trim($piece) !== '')  | 
                                                        
| 1889 | 1889 |  		{ | 
                                                        
| 1890 | - $result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece));  | 
                                                        |
| 1890 | + $result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece));  | 
                                                        |
| 1891 | 1891 | }  | 
                                                        
| 1892 | 1892 | }  | 
                                                        
| 1893 | 1893 | return $result;  | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | * @param string $module_name The module name to get a instance  | 
                                                        
| 75 | 75 | * @param string $type disp, proc, controller, class  | 
                                                        
| 76 | 76 | * @param string $kind admin, null  | 
                                                        
| 77 | - * @return mixed Module instance  | 
                                                        |
| 77 | + * @return ModuleObject Module instance  | 
                                                        |
| 78 | 78 | */  | 
                                                        
| 79 | 79 | function getModule($module_name, $type = 'view', $kind = '')  | 
                                                        
| 80 | 80 |  { | 
                                                        
@@ -85,7 +85,7 @@ discard block  | 
                                                    ||
| 85 | 85 | * Create a controller instance of the module  | 
                                                        
| 86 | 86 | *  | 
                                                        
| 87 | 87 | * @param string $module_name The module name to get a controller instance  | 
                                                        
| 88 | - * @return mixed Module controller instance  | 
                                                        |
| 88 | + * @return ModuleObject Module controller instance  | 
                                                        |
| 89 | 89 | */  | 
                                                        
| 90 | 90 | function getController($module_name)  | 
                                                        
| 91 | 91 |  { | 
                                                        
@@ -96,7 +96,7 @@ discard block  | 
                                                    ||
| 96 | 96 | * Create a admin controller instance of the module  | 
                                                        
| 97 | 97 | *  | 
                                                        
| 98 | 98 | * @param string $module_name The module name to get a admin controller instance  | 
                                                        
| 99 | - * @return mixed Module admin controller instance  | 
                                                        |
| 99 | + * @return ModuleObject Module admin controller instance  | 
                                                        |
| 100 | 100 | */  | 
                                                        
| 101 | 101 | function getAdminController($module_name)  | 
                                                        
| 102 | 102 |  { | 
                                                        
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | * Create a view instance of the module  | 
                                                        
| 108 | 108 | *  | 
                                                        
| 109 | 109 | * @param string $module_name The module name to get a view instance  | 
                                                        
| 110 | - * @return mixed Module view instance  | 
                                                        |
| 110 | + * @return ModuleObject Module view instance  | 
                                                        |
| 111 | 111 | */  | 
                                                        
| 112 | 112 | function getView($module_name)  | 
                                                        
| 113 | 113 |  { | 
                                                        
@@ -118,7 +118,7 @@ discard block  | 
                                                    ||
| 118 | 118 | * Create a mobile instance of the module  | 
                                                        
| 119 | 119 | *  | 
                                                        
| 120 | 120 | * @param string $module_name The module name to get a mobile instance  | 
                                                        
| 121 | - * @return mixed Module mobile instance  | 
                                                        |
| 121 | + * @return ModuleObject Module mobile instance  | 
                                                        |
| 122 | 122 | */  | 
                                                        
| 123 | 123 | function &getMobile($module_name)  | 
                                                        
| 124 | 124 |  { | 
                                                        
@@ -129,7 +129,7 @@ discard block  | 
                                                    ||
| 129 | 129 | * Create a admin view instance of the module  | 
                                                        
| 130 | 130 | *  | 
                                                        
| 131 | 131 | * @param string $module_name The module name to get a admin view instance  | 
                                                        
| 132 | - * @return mixed Module admin view instance  | 
                                                        |
| 132 | + * @return ModuleObject Module admin view instance  | 
                                                        |
| 133 | 133 | */  | 
                                                        
| 134 | 134 | function getAdminView($module_name)  | 
                                                        
| 135 | 135 |  { | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 | * Create a model instance of the module  | 
                                                        
| 141 | 141 | *  | 
                                                        
| 142 | 142 | * @param string $module_name The module name to get a model instance  | 
                                                        
| 143 | - * @return mixed Module model instance  | 
                                                        |
| 143 | + * @return ModuleObject Module model instance  | 
                                                        |
| 144 | 144 | */  | 
                                                        
| 145 | 145 | function getModel($module_name)  | 
                                                        
| 146 | 146 |  { | 
                                                        
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | * Create an admin model instance of the module  | 
                                                        
| 152 | 152 | *  | 
                                                        
| 153 | 153 | * @param string $module_name The module name to get a admin model instance  | 
                                                        
| 154 | - * @return mixed Module admin model instance  | 
                                                        |
| 154 | + * @return ModuleObject Module admin model instance  | 
                                                        |
| 155 | 155 | */  | 
                                                        
| 156 | 156 | function getAdminModel($module_name)  | 
                                                        
| 157 | 157 |  { | 
                                                        
@@ -162,7 +162,7 @@ discard block  | 
                                                    ||
| 162 | 162 | * Create an api instance of the module  | 
                                                        
| 163 | 163 | *  | 
                                                        
| 164 | 164 | * @param string $module_name The module name to get a api instance  | 
                                                        
| 165 | - * @return mixed Module api class instance  | 
                                                        |
| 165 | + * @return ModuleObject Module api class instance  | 
                                                        |
| 166 | 166 | */  | 
                                                        
| 167 | 167 | function getAPI($module_name)  | 
                                                        
| 168 | 168 |  { | 
                                                        
@@ -173,7 +173,7 @@ discard block  | 
                                                    ||
| 173 | 173 | * Create a wap instance of the module  | 
                                                        
| 174 | 174 | *  | 
                                                        
| 175 | 175 | * @param string $module_name The module name to get a wap instance  | 
                                                        
| 176 | - * @return mixed Module wap class instance  | 
                                                        |
| 176 | + * @return ModuleObject Module wap class instance  | 
                                                        |
| 177 | 177 | */  | 
                                                        
| 178 | 178 | function getWAP($module_name)  | 
                                                        
| 179 | 179 |  { | 
                                                        
@@ -184,7 +184,7 @@ discard block  | 
                                                    ||
| 184 | 184 | * Create a class instance of the module  | 
                                                        
| 185 | 185 | *  | 
                                                        
| 186 | 186 | * @param string $module_name The module name to get a class instance  | 
                                                        
| 187 | - * @return mixed Module class instance  | 
                                                        |
| 187 | + * @return ModuleObject Module class instance  | 
                                                        |
| 188 | 188 | */  | 
                                                        
| 189 | 189 | function getClass($module_name)  | 
                                                        
| 190 | 190 |  { | 
                                                        
@@ -490,7 +490,7 @@ discard block  | 
                                                    ||
| 490 | 490 | * Return if domain of the virtual site is url type or id type  | 
                                                        
| 491 | 491 | *  | 
                                                        
| 492 | 492 | * @param string $domain  | 
                                                        
| 493 | - * @return bool  | 
                                                        |
| 493 | + * @return integer  | 
                                                        |
| 494 | 494 | */  | 
                                                        
| 495 | 495 | function isSiteID($domain)  | 
                                                        
| 496 | 496 |  { | 
                                                        
@@ -559,7 +559,7 @@ discard block  | 
                                                    ||
| 559 | 559 | /**  | 
                                                        
| 560 | 560 | * Get a time gap between server's timezone and XE's timezone  | 
                                                        
| 561 | 561 | *  | 
                                                        
| 562 | - * @return int  | 
                                                        |
| 562 | + * @return double  | 
                                                        |
| 563 | 563 | */  | 
                                                        
| 564 | 564 | function zgap()  | 
                                                        
| 565 | 565 |  { | 
                                                        
@@ -797,7 +797,7 @@ discard block  | 
                                                    ||
| 797 | 797 | * Display $buff contents into the file ./files/_debug_message.php.  | 
                                                        
| 798 | 798 | * You can see the file on your prompt by command: tail-f./files/_debug_message.php  | 
                                                        
| 799 | 799 | *  | 
                                                        
| 800 | - * @param mixed $debug_output Target object to be printed  | 
                                                        |
| 800 | + * @param string $debug_output Target object to be printed  | 
                                                        |
| 801 | 801 | * @param bool $display_option boolean Flag whether to print seperator (default:true)  | 
                                                        
| 802 | 802 | * @param string $file Target file name  | 
                                                        
| 803 | 803 | * @return void  | 
                                                        
@@ -904,7 +904,7 @@ discard block  | 
                                                    ||
| 904 | 904 | /**  | 
                                                        
| 905 | 905 | * @param string $type query, trigger  | 
                                                        
| 906 | 906 | * @param float $elapsed_time  | 
                                                        
| 907 | - * @param object $obj  | 
                                                        |
| 907 | + * @param stdClass $obj  | 
                                                        |
| 908 | 908 | */  | 
                                                        
| 909 | 909 | function writeSlowlog($type, $elapsed_time, $obj)  | 
                                                        
| 910 | 910 |  { | 
                                                        
@@ -1685,6 +1685,9 @@ discard block  | 
                                                    ||
| 1685 | 1685 | }  | 
                                                        
| 1686 | 1686 | }  | 
                                                        
| 1687 | 1687 | |
| 1688 | +/**  | 
                                                        |
| 1689 | + * @param string $key  | 
                                                        |
| 1690 | + */  | 
                                                        |
| 1688 | 1691 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')  | 
                                                        
| 1689 | 1692 |  { | 
                                                        
| 1690 | 1693 | if($requestKey != $dbKey)  | 
                                                        
@@ -1781,6 +1784,9 @@ discard block  | 
                                                    ||
| 1781 | 1784 | }  | 
                                                        
| 1782 | 1785 | |
| 1783 | 1786 | |
| 1787 | +/**  | 
                                                        |
| 1788 | + * @param string $str  | 
                                                        |
| 1789 | + */  | 
                                                        |
| 1784 | 1790 | function isDefinedLangCode($str)  | 
                                                        
| 1785 | 1791 |  { | 
                                                        
| 1786 | 1792 |  	return preg_match('!^\$user_lang->([a-z0-9\_]+)$!is', trim($str)); |