@@ -4,141 +4,141 @@ |
||
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | 6 | class SqlParser { |
7 | - public $host; |
|
8 | - public $dbname; |
|
9 | - public $prefix; |
|
10 | - public $user; |
|
11 | - public $password; |
|
12 | - public $mysqlErrors; |
|
13 | - public $conn; |
|
14 | - public $installFailed; |
|
15 | - public $sitename; |
|
16 | - public $adminname; |
|
17 | - public $adminemail; |
|
18 | - public $adminpass; |
|
19 | - public $managerlanguage; |
|
20 | - public $mode; |
|
21 | - public $fileManagerPath; |
|
22 | - public $imgPath; |
|
23 | - public $imgUrl; |
|
24 | - public $dbMODx; |
|
25 | - public $dbVersion; |
|
7 | + public $host; |
|
8 | + public $dbname; |
|
9 | + public $prefix; |
|
10 | + public $user; |
|
11 | + public $password; |
|
12 | + public $mysqlErrors; |
|
13 | + public $conn; |
|
14 | + public $installFailed; |
|
15 | + public $sitename; |
|
16 | + public $adminname; |
|
17 | + public $adminemail; |
|
18 | + public $adminpass; |
|
19 | + public $managerlanguage; |
|
20 | + public $mode; |
|
21 | + public $fileManagerPath; |
|
22 | + public $imgPath; |
|
23 | + public $imgUrl; |
|
24 | + public $dbMODx; |
|
25 | + public $dbVersion; |
|
26 | 26 | public $connection_charset; |
27 | 27 | public $connection_method; |
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | - $this->host = $host; |
|
33 | - $this->dbname = $db; |
|
34 | - $this->prefix = $prefix; |
|
35 | - $this->user = $user; |
|
36 | - $this->password = $password; |
|
37 | - $this->adminpass = $adminpass; |
|
38 | - $this->adminname = $adminname; |
|
39 | - $this->adminemail = $adminemail; |
|
40 | - $this->connection_charset = $connection_charset; |
|
41 | - $this->connection_method = $connection_method; |
|
42 | - $this->ignoreDuplicateErrors = false; |
|
43 | - $this->managerlanguage = $managerlanguage; |
|
31 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + $this->host = $host; |
|
33 | + $this->dbname = $db; |
|
34 | + $this->prefix = $prefix; |
|
35 | + $this->user = $user; |
|
36 | + $this->password = $password; |
|
37 | + $this->adminpass = $adminpass; |
|
38 | + $this->adminname = $adminname; |
|
39 | + $this->adminemail = $adminemail; |
|
40 | + $this->connection_charset = $connection_charset; |
|
41 | + $this->connection_method = $connection_method; |
|
42 | + $this->ignoreDuplicateErrors = false; |
|
43 | + $this->managerlanguage = $managerlanguage; |
|
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - public function connect() { |
|
48 | - $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | - mysqli_select_db($this->conn, $this->dbname); |
|
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
47 | + public function connect() { |
|
48 | + $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | + mysqli_select_db($this->conn, $this->dbname); |
|
50 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
51 | 51 | |
52 | - $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | - if(function_exists("mysqli_get_server_info")) { |
|
54 | - $ver = mysqli_get_server_info($this->conn); |
|
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | - $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | - } |
|
52 | + $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | + if(function_exists("mysqli_get_server_info")) { |
|
54 | + $ver = mysqli_get_server_info($this->conn); |
|
55 | + $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | + $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | + } |
|
58 | 58 | |
59 | 59 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | public function process($filename) { |
63 | - global $custom_placeholders; |
|
64 | - |
|
65 | - // check to make sure file exists |
|
66 | - if (!file_exists($filename)) { |
|
67 | - $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | - $this->installFailed = true ; |
|
69 | - return false; |
|
70 | - } |
|
71 | - |
|
72 | - $fh = fopen($filename, 'r'); |
|
73 | - $idata = ''; |
|
74 | - |
|
75 | - while (!feof($fh)) { |
|
76 | - $idata .= fread($fh, 1024); |
|
77 | - } |
|
78 | - |
|
79 | - fclose($fh); |
|
80 | - $idata = str_replace("\r", '', $idata); |
|
81 | - |
|
82 | - // check if in upgrade mode |
|
83 | - if ($this->mode === 'upd') { |
|
84 | - // remove non-upgradeable parts |
|
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
63 | + global $custom_placeholders; |
|
64 | + |
|
65 | + // check to make sure file exists |
|
66 | + if (!file_exists($filename)) { |
|
67 | + $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | + $this->installFailed = true ; |
|
69 | + return false; |
|
70 | + } |
|
71 | + |
|
72 | + $fh = fopen($filename, 'r'); |
|
73 | + $idata = ''; |
|
74 | + |
|
75 | + while (!feof($fh)) { |
|
76 | + $idata .= fread($fh, 1024); |
|
77 | + } |
|
78 | + |
|
79 | + fclose($fh); |
|
80 | + $idata = str_replace("\r", '', $idata); |
|
81 | + |
|
82 | + // check if in upgrade mode |
|
83 | + if ($this->mode === 'upd') { |
|
84 | + // remove non-upgradeable parts |
|
85 | + $s = strpos($idata,'non-upgrade-able[['); |
|
86 | + $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | + if($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | - } |
|
91 | - |
|
92 | - // replace {} tags |
|
93 | - $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | - $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | - $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | - $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | - $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | - $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | - $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | - $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | - $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | - /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | - |
|
104 | - // Replace custom placeholders |
|
105 | - foreach($custom_placeholders as $key=>$val) { |
|
106 | - if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | - $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - $sql_array = explode("\n\n", $idata); |
|
112 | - |
|
113 | - $num = 0; |
|
114 | - foreach($sql_array as $sql_entry) { |
|
115 | - $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | - |
|
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | - |
|
119 | - // strip out comments and \n for mysql 3.x |
|
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | - $sql_do = str_replace('\r', "", $sql_do); |
|
123 | - $sql_do = str_replace('\n', "", $sql_do); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - $num = $num + 1; |
|
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | - if(mysqli_error($this->conn)) { |
|
130 | - // Ignore duplicate and drop errors - Raymond |
|
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | - } |
|
134 | - // End Ignore duplicate |
|
135 | - $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | - $this->installFailed = true; |
|
137 | - } |
|
138 | - } |
|
139 | - } |
|
90 | + } |
|
91 | + |
|
92 | + // replace {} tags |
|
93 | + $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | + $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | + $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | + $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | + $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | + $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | + $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | + $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | + $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | + /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | + |
|
104 | + // Replace custom placeholders |
|
105 | + foreach($custom_placeholders as $key=>$val) { |
|
106 | + if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | + $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + $sql_array = explode("\n\n", $idata); |
|
112 | + |
|
113 | + $num = 0; |
|
114 | + foreach($sql_array as $sql_entry) { |
|
115 | + $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | + |
|
117 | + if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | + |
|
119 | + // strip out comments and \n for mysql 3.x |
|
120 | + if ($this->dbVersion <4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | + $sql_do = str_replace('\r', "", $sql_do); |
|
123 | + $sql_do = str_replace('\n', "", $sql_do); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + $num = $num + 1; |
|
128 | + if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | + if(mysqli_error($this->conn)) { |
|
130 | + // Ignore duplicate and drop errors - Raymond |
|
131 | + if ($this->ignoreDuplicateErrors){ |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | + } |
|
134 | + // End Ignore duplicate |
|
135 | + $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | + $this->installFailed = true; |
|
137 | + } |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | public function close() { |
142 | - mysqli_close($this->conn); |
|
143 | - } |
|
142 | + mysqli_close($this->conn); |
|
143 | + } |
|
144 | 144 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser{ |
|
7 | 7 | public $host; |
8 | 8 | public $dbname; |
9 | 9 | public $prefix; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | + public function __construct($host, $user, $password, $db, $prefix = 'modx_', $adminname, $adminemail, $adminpass, $connection_charset = 'utf8', $managerlanguage = 'english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent'){ |
|
32 | 32 | $this->host = $host; |
33 | 33 | $this->dbname = $db; |
34 | 34 | $this->prefix = $prefix; |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 45 | } |
46 | 46 | |
47 | - public function connect() { |
|
47 | + public function connect(){ |
|
48 | 48 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 49 | mysqli_select_db($this->conn, $this->dbname); |
50 | 50 | if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
51 | 51 | |
52 | 52 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | - if(function_exists("mysqli_get_server_info")) { |
|
53 | + if (function_exists("mysqli_get_server_info")) { |
|
54 | 54 | $ver = mysqli_get_server_info($this->conn); |
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | + $this->dbMODx = version_compare($ver, "4.0.2"); |
|
56 | 56 | $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
57 | 57 | } |
58 | 58 | |
59 | - mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
|
59 | + mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}"); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process($filename) { |
|
62 | + public function process($filename){ |
|
63 | 63 | global $custom_placeholders; |
64 | 64 | |
65 | 65 | // check to make sure file exists |
66 | 66 | if (!file_exists($filename)) { |
67 | 67 | $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
68 | - $this->installFailed = true ; |
|
68 | + $this->installFailed = true; |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | // check if in upgrade mode |
83 | 83 | if ($this->mode === 'upd') { |
84 | 84 | // remove non-upgradeable parts |
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
85 | + $s = strpos($idata, 'non-upgrade-able[['); |
|
86 | + $e = strpos($idata, ']]non-upgrade-able') + 17; |
|
87 | + if ($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
103 | 103 | |
104 | 104 | // Replace custom placeholders |
105 | - foreach($custom_placeholders as $key=>$val) { |
|
105 | + foreach ($custom_placeholders as $key=>$val) { |
|
106 | 106 | if (strpos($idata, '{'.$key.'}') !== false) { |
107 | 107 | $idata = str_replace('{'.$key.'}', $val, $idata); |
108 | 108 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $sql_array = explode("\n\n", $idata); |
112 | 112 | |
113 | 113 | $num = 0; |
114 | - foreach($sql_array as $sql_entry) { |
|
114 | + foreach ($sql_array as $sql_entry) { |
|
115 | 115 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 116 | |
117 | 117 | if (preg_match('/^\#/', $sql_do)) continue; |
118 | 118 | |
119 | 119 | // strip out comments and \n for mysql 3.x |
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
120 | + if ($this->dbVersion < 4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do); |
|
122 | 122 | $sql_do = str_replace('\r', "", $sql_do); |
123 | 123 | $sql_do = str_replace('\n', "", $sql_do); |
124 | 124 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $num = $num + 1; |
128 | 128 | if ($sql_do) mysqli_query($this->conn, $sql_do); |
129 | - if(mysqli_error($this->conn)) { |
|
129 | + if (mysqli_error($this->conn)) { |
|
130 | 130 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
131 | + if ($this->ignoreDuplicateErrors) { |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue; |
|
133 | 133 | } |
134 | 134 | // End Ignore duplicate |
135 | 135 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function close() { |
|
141 | + public function close(){ |
|
142 | 142 | mysqli_close($this->conn); |
143 | 143 | } |
144 | 144 | } |
@@ -3,7 +3,8 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser |
|
7 | +{ |
|
7 | 8 | public $host; |
8 | 9 | public $dbname; |
9 | 10 | public $prefix; |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | public $ignoreDuplicateErrors; |
29 | 30 | public $autoTemplateLogic; |
30 | 31 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') |
|
33 | + { |
|
32 | 34 | $this->host = $host; |
33 | 35 | $this->dbname = $db; |
34 | 36 | $this->prefix = $prefix; |
@@ -44,10 +46,13 @@ discard block |
||
44 | 46 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 47 | } |
46 | 48 | |
47 | - public function connect() { |
|
49 | + public function connect() |
|
50 | + { |
|
48 | 51 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 52 | mysqli_select_db($this->conn, $this->dbname); |
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
53 | + if (function_exists('mysqli_set_charset')) { |
|
54 | + mysqli_set_charset($this->conn, $this->connection_charset); |
|
55 | + } |
|
51 | 56 | |
52 | 57 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | 58 | if(function_exists("mysqli_get_server_info")) { |
@@ -59,7 +64,8 @@ discard block |
||
59 | 64 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | 65 | } |
61 | 66 | |
62 | - public function process($filename) { |
|
67 | + public function process($filename) |
|
68 | + { |
|
63 | 69 | global $custom_placeholders; |
64 | 70 | |
65 | 71 | // check to make sure file exists |
@@ -114,7 +120,9 @@ discard block |
||
114 | 120 | foreach($sql_array as $sql_entry) { |
115 | 121 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 122 | |
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
123 | + if (preg_match('/^\#/', $sql_do)) { |
|
124 | + continue; |
|
125 | + } |
|
118 | 126 | |
119 | 127 | // strip out comments and \n for mysql 3.x |
120 | 128 | if ($this->dbVersion <4.0) { |
@@ -125,11 +133,15 @@ discard block |
||
125 | 133 | |
126 | 134 | |
127 | 135 | $num = $num + 1; |
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
136 | + if ($sql_do) { |
|
137 | + mysqli_query($this->conn, $sql_do); |
|
138 | + } |
|
129 | 139 | if(mysqli_error($this->conn)) { |
130 | 140 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
141 | + if ($this->ignoreDuplicateErrors) { |
|
142 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) { |
|
143 | + continue; |
|
144 | + } |
|
133 | 145 | } |
134 | 146 | // End Ignore duplicate |
135 | 147 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +150,8 @@ discard block |
||
138 | 150 | } |
139 | 151 | } |
140 | 152 | |
141 | - public function close() { |
|
153 | + public function close() |
|
154 | + { |
|
142 | 155 | mysqli_close($this->conn); |
143 | 156 | } |
144 | 157 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'sv' => 'svenska' |
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
40 | -if (! empty($_langFiles[$_langISO6391])) { |
|
40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
41 | 41 | $install_language = $_langFiles[$_langISO6391]; |
42 | 42 | } |
43 | 43 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | # load language file |
53 | 53 | require_once 'lang/english.inc.php'; // As fallback |
54 | -require_once 'lang/' . $install_language . '.inc.php'; |
|
54 | +require_once 'lang/'.$install_language.'.inc.php'; |
|
55 | 55 | |
56 | 56 | $manager_language = $install_language; |
57 | 57 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * Please commit your language changes on Transifex (https://www.transifex.com/projects/p/modx-evolution/) or on GitHub (https://github.com/modxcms/evolution). |
17 | 17 | */ |
18 | -setlocale (LC_ALL, 'ru_RU.UTF-8'); |
|
18 | +setlocale(LC_ALL, 'ru_RU.UTF-8'); |
|
19 | 19 | $_lang["agree_to_terms"] = 'Согласиться с условиями лицензии и приступить к установке'; |
20 | 20 | $_lang["alert_database_test_connection"] = 'Вы должны создать базу данных или выбрать базу данных для проверки!'; |
21 | 21 | $_lang["alert_database_test_connection_failed"] = 'Неудачная проверка выбранной базы данных!'; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //:: EVO Installer Setup file |
3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
6 | 6 | } |
7 | 7 | if (!defined('MGR_DIR')) { |
8 | 8 | define('MGR_DIR', 'manager'); |
9 | 9 | } |
10 | 10 | |
11 | -require_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/version.inc.php'); |
|
11 | +require_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/version.inc.php'); |
|
12 | 12 | |
13 | -$chunkPath = $base_path . 'install/assets/chunks'; |
|
14 | -$snippetPath = $base_path . 'install/assets/snippets'; |
|
15 | -$pluginPath = $base_path . 'install/assets/plugins'; |
|
16 | -$modulePath = $base_path . 'install/assets/modules'; |
|
17 | -$templatePath = $base_path . 'install/assets/templates'; |
|
18 | -$tvPath = $base_path . 'install/assets/tvs'; |
|
13 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
14 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
15 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
16 | +$modulePath = $base_path.'install/assets/modules'; |
|
17 | +$templatePath = $base_path.'install/assets/templates'; |
|
18 | +$tvPath = $base_path.'install/assets/tvs'; |
|
19 | 19 | |
20 | 20 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
21 | 21 | $mt = &$moduleTemplates; |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $params = parse_docblock($templatePath, $tplfile); |
29 | 29 | if (is_array($params) && (count($params) > 0)) { |
30 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
31 | - $mt[] = array |
|
32 | - ( |
|
31 | + $mt[] = array( |
|
33 | 32 | $params['name'], |
34 | 33 | $description, |
35 | 34 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -149,7 +148,7 @@ discard block |
||
149 | 148 | $params['modx_category'], |
150 | 149 | $params['legacy_names'], |
151 | 150 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
152 | - (int)$params['disabled'] |
|
151 | + (int) $params['disabled'] |
|
153 | 152 | ); |
154 | 153 | } |
155 | 154 | } |
@@ -174,12 +173,12 @@ discard block |
||
174 | 173 | "$modulePath/{$params['filename']}", |
175 | 174 | $params['properties'], |
176 | 175 | $params['guid'], |
177 | - (int)$params['shareparams'], |
|
176 | + (int) $params['shareparams'], |
|
178 | 177 | $params['modx_category'], |
179 | 178 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
180 | 179 | ); |
181 | 180 | } |
182 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
181 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
183 | 182 | $dependencies = explode(',', $params['dependencies']); |
184 | 183 | foreach ($dependencies as $dependency) { |
185 | 184 | $dependency = explode(':', $dependency); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @param string $param |
174 | 174 | * @param array $tvsArray |
175 | - * @return mixed |
|
175 | + * @return string |
|
176 | 176 | */ |
177 | 177 | function parseTvValues($param, $tvsArray) |
178 | 178 | { |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | /** |
567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
568 | 568 | * |
569 | - * @param $src |
|
569 | + * @param string $src |
|
570 | 570 | * @param string $delim |
571 | 571 | * @param string $type |
572 | 572 | * @param bool $columns |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | |
1023 | 1023 | if (! function_exists('ParseIntputOptions')) { |
1024 | 1024 | /** |
1025 | - * @param string|array|mysqli_result $v |
|
1025 | + * @param string $v |
|
1026 | 1026 | * @return array |
1027 | 1027 | */ |
1028 | 1028 | function ParseIntputOptions($v) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('ProcessTVCommand')) { |
|
3 | +if (!function_exists('ProcessTVCommand')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $value |
6 | 6 | * @param string $name |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()) |
13 | 13 | { |
14 | 14 | $modx = evolutionCMS(); |
15 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
15 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
16 | 16 | $nvalue = trim($value); |
17 | 17 | if (substr($nvalue, 0, 1) != '@') { |
18 | 18 | return $value; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | // if an inherited value is found and if there is content following the @INHERIT binding |
78 | 78 | // remove @INHERIT and output that following content. This content could contain other |
79 | 79 | // @ bindings, that are processed in the next step |
80 | - if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | - $output = trim(str_replace('@INHERIT', '', (string)$tv['value'])); |
|
80 | + if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | + $output = trim(str_replace('@INHERIT', '', (string) $tv['value'])); |
|
82 | 82 | break 2; |
83 | 83 | } |
84 | 84 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | case 'DIRECTORY' : |
88 | 88 | $files = array(); |
89 | - $path = $modx->config['base_path'] . $param; |
|
89 | + $path = $modx->config['base_path'].$param; |
|
90 | 90 | if (substr($path, -1, 1) != '/') { |
91 | 91 | $path .= '/'; |
92 | 92 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('ProcessFile')) { |
|
120 | +if (!function_exists('ProcessFile')) { |
|
121 | 121 | /** |
122 | 122 | * @param $file |
123 | 123 | * @return string |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -if (! function_exists('ParseCommand')) { |
|
137 | +if (!function_exists('ParseCommand')) { |
|
138 | 138 | /** |
139 | 139 | * ParseCommand - separate @ cmd from params |
140 | 140 | * |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $binding_array = array(); |
157 | 157 | foreach ($BINDINGS as $cmd) { |
158 | - if (strpos($binding_string, '@' . $cmd) === 0) { |
|
158 | + if (strpos($binding_string, '@'.$cmd) === 0) { |
|
159 | 159 | $code = substr($binding_string, strlen($cmd) + 1); |
160 | 160 | $binding_array = array($cmd, trim($code)); |
161 | 161 | break; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | -if (! function_exists('parseTvValues')) { |
|
169 | +if (!function_exists('parseTvValues')) { |
|
170 | 170 | /** |
171 | 171 | * Parse MODX Template-Variables |
172 | 172 | * |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | -if (! function_exists('getTVDisplayFormat')) { |
|
200 | +if (!function_exists('getTVDisplayFormat')) { |
|
201 | 201 | /** |
202 | 202 | * @param string $name |
203 | 203 | * @param string $value |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $o = ''; |
216 | 216 | |
217 | 217 | // process any TV commands in value |
218 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
218 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
219 | 219 | $value = ProcessTVCommand($value, $name, $docid); |
220 | 220 | |
221 | 221 | $params = array(); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $attr['align'] = $params['align']; |
255 | 255 | } |
256 | 256 | foreach ($attr as $k => $v) { |
257 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
257 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
258 | 258 | } |
259 | - $attributes .= ' ' . $params['attrib']; |
|
259 | + $attributes .= ' '.$params['attrib']; |
|
260 | 260 | |
261 | 261 | // Output the image with attributes |
262 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
262 | + $o .= '<img'.rtrim($attributes).' />'; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | break; |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | 'target' => $params['target'], |
332 | 332 | ); |
333 | 333 | foreach ($attr as $k => $v) { |
334 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
334 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
335 | 335 | } |
336 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
336 | + $attributes .= ' '.$params['attrib']; // add extra |
|
337 | 337 | |
338 | 338 | // Output the link |
339 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
339 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name).'</a>'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | break; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | 'style' => $params['style'], |
363 | 363 | ); |
364 | 364 | foreach ($attr as $k => $v) { |
365 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
365 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
366 | 366 | } |
367 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
367 | + $attributes .= ' '.$params['attrib']; // add extra |
|
368 | 368 | |
369 | 369 | // Output the HTML Tag |
370 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
370 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
371 | 371 | } |
372 | 372 | break; |
373 | 373 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $w = $params['w'] ? $params['w'] : '100%'; |
377 | 377 | $h = $params['h'] ? $params['h'] : '400px'; |
378 | 378 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
379 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
379 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
380 | 380 | $o .= $modx->getPhpCompat()->htmlspecialchars($value); |
381 | 381 | $o .= '</textarea></div>'; |
382 | 382 | $replace_richtext = array($id); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | case "viewport": |
405 | 405 | $value = parseInput($value); |
406 | - $id = '_' . time(); |
|
406 | + $id = '_'.time(); |
|
407 | 407 | if (!$params['vpid']) { |
408 | 408 | $params['vpid'] = $id; |
409 | 409 | } |
@@ -417,41 +417,41 @@ discard block |
||
417 | 417 | $h = "100%"; |
418 | 418 | } |
419 | 419 | if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
420 | - $autoMode = "3"; //both |
|
420 | + $autoMode = "3"; //both |
|
421 | 421 | } else { |
422 | 422 | if ($params['awidth'] == 'Yes') { |
423 | 423 | $autoMode = "1"; //width only |
424 | 424 | } else { |
425 | 425 | if ($params['aheight'] == 'Yes') { |
426 | - $autoMode = "2"; //height only |
|
426 | + $autoMode = "2"; //height only |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
431 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
432 | 432 | 'name' => 'viewport', |
433 | 433 | 'version' => '0', |
434 | 434 | 'plaintext' => false |
435 | 435 | )); |
436 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
436 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
437 | 437 | if ($params['class']) { |
438 | - $o .= " class='" . $params['class'] . "' "; |
|
438 | + $o .= " class='".$params['class']."' "; |
|
439 | 439 | } |
440 | 440 | if ($params['style']) { |
441 | - $o .= " style='" . $params['style'] . "' "; |
|
441 | + $o .= " style='".$params['style']."' "; |
|
442 | 442 | } |
443 | 443 | if ($params['attrib']) { |
444 | - $o .= $params['attrib'] . " "; |
|
444 | + $o .= $params['attrib']." "; |
|
445 | 445 | } |
446 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
447 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
448 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
446 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
447 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
448 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
449 | 449 | $o .= ">"; |
450 | 450 | $o .= $eTag; |
451 | 451 | break; |
452 | 452 | |
453 | 453 | case "datagrid": |
454 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
454 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
455 | 455 | $grd = new DataGrid('', $value); |
456 | 456 | |
457 | 457 | $grd->noRecordMsg = $params['egmsg']; |
@@ -498,16 +498,16 @@ discard block |
||
498 | 498 | $o = ''; |
499 | 499 | /* If we are loading a file */ |
500 | 500 | if (substr($params['output'], 0, 5) == "@FILE") { |
501 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
501 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
502 | 502 | if (!file_exists($file_name)) { |
503 | - $widget_output = $file_name . ' does not exist'; |
|
503 | + $widget_output = $file_name.' does not exist'; |
|
504 | 504 | } else { |
505 | 505 | $widget_output = file_get_contents($file_name); |
506 | 506 | } |
507 | 507 | } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
508 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
508 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
509 | 509 | if (!file_exists($file_name)) { |
510 | - $widget_output = $file_name . ' does not exist'; |
|
510 | + $widget_output = $file_name.' does not exist'; |
|
511 | 511 | } else { |
512 | 512 | /* The included file needs to set $widget_output. Can be string, array, object */ |
513 | 513 | include $file_name; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -if (! function_exists('decodeParamValue')) { |
|
552 | +if (!function_exists('decodeParamValue')) { |
|
553 | 553 | /** |
554 | 554 | * @param string $s |
555 | 555 | * @return string |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | -if (! function_exists('parseInput')) { |
|
565 | +if (!function_exists('parseInput')) { |
|
566 | 566 | /** |
567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
568 | 568 | * |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | -if (! function_exists('getUnixtimeFromDateString')) { |
|
597 | +if (!function_exists('getUnixtimeFromDateString')) { |
|
598 | 598 | /** |
599 | 599 | * @param string $value |
600 | 600 | * @return bool|false|int |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | -if (! function_exists('renderFormElement')) { |
|
625 | +if (!function_exists('renderFormElement')) { |
|
626 | 626 | /** |
627 | 627 | * DISPLAY FORM ELEMENTS |
628 | 628 | * |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $field_style = '', |
646 | 646 | $row = array(), |
647 | 647 | $tvsArray = array() |
648 | - ) { |
|
648 | + ){ |
|
649 | 649 | $modx = evolutionCMS(); |
650 | 650 | global $_style; |
651 | 651 | global $_lang; |
@@ -665,22 +665,22 @@ discard block |
||
665 | 665 | |
666 | 666 | case "text": // handler for regular text boxes |
667 | 667 | case "rawtext"; // non-htmlentity converted text boxes |
668 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
668 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
669 | 669 | break; |
670 | 670 | case "email": // handles email input fields |
671 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
671 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
672 | 672 | break; |
673 | 673 | case "number": // handles the input of numbers |
674 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
674 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
675 | 675 | break; |
676 | 676 | case "textareamini": // handler for textarea mini boxes |
677 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>'; |
|
677 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>'; |
|
678 | 678 | break; |
679 | 679 | case "textarea": // handler for textarea boxes |
680 | 680 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
681 | 681 | case "htmlarea": // handler for textarea boxes (deprecated) |
682 | 682 | case "richtext": // handler for textarea boxes |
683 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>'; |
|
683 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>'; |
|
684 | 684 | break; |
685 | 685 | case "date": |
686 | 686 | $field_id = str_replace(array( |
@@ -690,12 +690,12 @@ discard block |
||
690 | 690 | if ($field_value == '') { |
691 | 691 | $field_value = 0; |
692 | 692 | } |
693 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
694 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
693 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
694 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
695 | 695 | |
696 | 696 | break; |
697 | 697 | case "dropdown": // handler for select boxes |
698 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
698 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
699 | 699 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
700 | 700 | $tvsArray)); |
701 | 701 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | if (strlen($itemvalue) == 0) { |
704 | 704 | $itemvalue = $item; |
705 | 705 | } |
706 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
706 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
707 | 707 | } |
708 | 708 | $field_html .= "</select>"; |
709 | 709 | break; |
710 | 710 | case "listbox": // handler for select boxes |
711 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
711 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
712 | 712 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
713 | 713 | $tvsArray)); |
714 | 714 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | if (strlen($itemvalue) == 0) { |
717 | 717 | $itemvalue = $item; |
718 | 718 | } |
719 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
719 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
720 | 720 | } |
721 | 721 | $field_html .= "</select>"; |
722 | 722 | break; |
723 | 723 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
724 | 724 | $field_value = explode("||", $field_value); |
725 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
725 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
726 | 726 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
727 | 727 | $tvsArray)); |
728 | 728 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | if (strlen($itemvalue) == 0) { |
731 | 731 | $itemvalue = $item; |
732 | 732 | } |
733 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, |
|
734 | - $field_value) ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
733 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, |
|
734 | + $field_value) ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
735 | 735 | } |
736 | 736 | $field_html .= "</select>"; |
737 | 737 | break; |
@@ -743,17 +743,17 @@ discard block |
||
743 | 743 | 'ftp://' => 'ftp://', |
744 | 744 | 'mailto:' => 'mailto:' |
745 | 745 | ); |
746 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
746 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
747 | 747 | foreach ($urls as $k => $v) { |
748 | 748 | if (strpos($field_value, $v) === false) { |
749 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
749 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
750 | 750 | } else { |
751 | 751 | $field_value = str_replace($v, '', $field_value); |
752 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
752 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | $field_html .= '</select></td><td>'; |
756 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
756 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
757 | 757 | break; |
758 | 758 | case 'checkbox': // handles check boxes |
759 | 759 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (strlen($itemvalue) == 0) { |
796 | 796 | $itemvalue = $item; |
797 | 797 | } |
798 | - $field_html .= '<input type="radio" value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
798 | + $field_html .= '<input type="radio" value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
799 | 799 | $i++; |
800 | 800 | } |
801 | 801 | break; |
@@ -825,13 +825,13 @@ discard block |
||
825 | 825 | lastImageCtrl = ctrl; |
826 | 826 | var w = screen.width * 0.5; |
827 | 827 | var h = screen.height * 0.5; |
828 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
828 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
829 | 829 | } |
830 | 830 | function BrowseFileServer(ctrl) { |
831 | 831 | lastFileCtrl = ctrl; |
832 | 832 | var w = screen.width * 0.5; |
833 | 833 | var h = screen.height * 0.5; |
834 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
834 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
835 | 835 | } |
836 | 836 | function SetUrlChange(el) { |
837 | 837 | if ('createEvent' in document) { |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | </script>"; |
866 | 866 | $ResourceManagerLoaded = true; |
867 | 867 | } |
868 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
868 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
869 | 869 | break; |
870 | 870 | case "file": // handles the input of file uploads |
871 | 871 | /* Modified by Timon for use with resource browser */ |
@@ -895,13 +895,13 @@ discard block |
||
895 | 895 | lastImageCtrl = ctrl; |
896 | 896 | var w = screen.width * 0.5; |
897 | 897 | var h = screen.height * 0.5; |
898 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
898 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
899 | 899 | } |
900 | 900 | function BrowseFileServer(ctrl) { |
901 | 901 | lastFileCtrl = ctrl; |
902 | 902 | var w = screen.width * 0.5; |
903 | 903 | var h = screen.height * 0.5; |
904 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
904 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
905 | 905 | } |
906 | 906 | function SetUrlChange(el) { |
907 | 907 | if ('createEvent' in document) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | </script>"; |
936 | 936 | $ResourceManagerLoaded = true; |
937 | 937 | } |
938 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
938 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
939 | 939 | |
940 | 940 | break; |
941 | 941 | |
@@ -943,16 +943,16 @@ discard block |
||
943 | 943 | $custom_output = ''; |
944 | 944 | /* If we are loading a file */ |
945 | 945 | if (substr($field_elements, 0, 5) == "@FILE") { |
946 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
946 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
947 | 947 | if (!file_exists($file_name)) { |
948 | - $custom_output = $file_name . ' does not exist'; |
|
948 | + $custom_output = $file_name.' does not exist'; |
|
949 | 949 | } else { |
950 | 950 | $custom_output = file_get_contents($file_name); |
951 | 951 | } |
952 | 952 | } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
953 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
953 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
954 | 954 | if (!file_exists($file_name)) { |
955 | - $custom_output = $file_name . ' does not exist'; |
|
955 | + $custom_output = $file_name.' does not exist'; |
|
956 | 956 | } else { |
957 | 957 | ob_start(); |
958 | 958 | include $file_name; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $chunk_name = trim(substr($field_elements, 7)); |
964 | 964 | $chunk_body = $modx->getChunk($chunk_name); |
965 | 965 | if ($chunk_body == false) { |
966 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
966 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
967 | 967 | } else { |
968 | 968 | $custom_output = $chunk_body; |
969 | 969 | } |
@@ -988,15 +988,15 @@ discard block |
||
988 | 988 | break; |
989 | 989 | |
990 | 990 | default: // the default handler -- for errors, mostly |
991 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
991 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
992 | 992 | |
993 | 993 | } // end switch statement |
994 | 994 | } else { |
995 | 995 | $custom = explode(":", $field_type); |
996 | 996 | $custom_output = ''; |
997 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
997 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
998 | 998 | if (!file_exists($file_name)) { |
999 | - $custom_output = $file_name . ' does not exist'; |
|
999 | + $custom_output = $file_name.' does not exist'; |
|
1000 | 1000 | } else { |
1001 | 1001 | ob_start(); |
1002 | 1002 | include $file_name; |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | } // end renderFormElement function |
1021 | 1021 | } |
1022 | 1022 | |
1023 | -if (! function_exists('ParseIntputOptions')) { |
|
1023 | +if (!function_exists('ParseIntputOptions')) { |
|
1024 | 1024 | /** |
1025 | 1025 | * @param string|array|mysqli_result $v |
1026 | 1026 | * @return array |
@@ -573,7 +573,8 @@ |
||
573 | 573 | * @return array|string |
574 | 574 | */ |
575 | 575 | function parseInput($src, $delim = "||", $type = "string", $columns = true) |
576 | - { // type can be: string, array |
|
576 | + { |
|
577 | +// type can be: string, array |
|
577 | 578 | $modx = evolutionCMS(); |
578 | 579 | if ($modx->getDatabase()->isResult($src)) { |
579 | 580 | // must be a recordset |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $modx->setPlaceholder($rvKey, $rvValue); |
52 | 52 | } |
53 | 53 | $param = $modx->mergePlaceholderContent($param); |
54 | - $rs = $modx->getDatabase()->query("SELECT $param;"); |
|
54 | + $rs = $modx->getDatabase()->query("select $param;"); |
|
55 | 55 | $output = $rs; |
56 | 56 | break; |
57 | 57 |
@@ -237,7 +237,7 @@ |
||
237 | 237 | /** |
238 | 238 | * build siteCache file |
239 | 239 | * @param DocumentParser $modx |
240 | - * @return boolean success |
|
240 | + * @return null|boolean success |
|
241 | 241 | */ |
242 | 242 | public function buildCache($modx) |
243 | 243 | { |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | $modx = evolutionCMS(); |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (isset($this->aliases[$id])) { |
98 | 98 | if ($this->aliasVisible[$id] == 1) { |
99 | 99 | if ($path != '') { |
100 | - $path = $this->aliases[$id] . '/' . $path; |
|
100 | + $path = $this->aliases[$id].'/'.$path; |
|
101 | 101 | } else { |
102 | 102 | $path = $this->aliases[$id]; |
103 | 103 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $modx->messageQuit("Cache path not set."); |
122 | 122 | } |
123 | 123 | |
124 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
124 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
125 | 125 | $filesincache = count($files); |
126 | 126 | $deletedfiles = array(); |
127 | 127 | while ($file = array_shift($files)) { |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | if (isset($opcache)) { |
157 | 157 | echo '<p>Opcache empty.</p>'; |
158 | 158 | } |
159 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
159 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
160 | 160 | foreach ($deletedfiles as $deletedfile) { |
161 | - echo '<li>' . $deletedfile . '</li>'; |
|
161 | + echo '<li>'.$deletedfile.'</li>'; |
|
162 | 162 | } |
163 | 163 | echo '</ul>'; |
164 | 164 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | // write the file |
180 | - $content = '<?php' . "\n"; |
|
181 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
182 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
180 | + $content = '<?php'."\n"; |
|
181 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
182 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
183 | 183 | |
184 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
184 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
185 | 185 | if (!$handle = fopen($filename, 'w')) { |
186 | 186 | exit("Cannot open file ({$filename}"); |
187 | 187 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $timesArr = array(); |
206 | 206 | |
207 | 207 | $result = $modx->getDatabase()->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', |
208 | - 'pub_date>' . $this->request_time); |
|
208 | + 'pub_date>'.$this->request_time); |
|
209 | 209 | if (!$result) { |
210 | 210 | echo "Couldn't determine next publish event!"; |
211 | 211 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | $result = $modx->getDatabase()->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', |
219 | - 'unpub_date>' . $this->request_time); |
|
219 | + 'unpub_date>'.$this->request_time); |
|
220 | 220 | if (!$result) { |
221 | 221 | echo "Couldn't determine next unpublish event!"; |
222 | 222 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $config = array(); |
256 | 256 | $content .= '$c=&$this->config;'; |
257 | 257 | while (list($key, $value) = $modx->getDatabase()->getRow($rs, 'num')) { |
258 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
258 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
259 | 259 | $config[$key] = $value; |
260 | 260 | } |
261 | 261 | |
@@ -293,23 +293,23 @@ discard block |
||
293 | 293 | $docid = $doc['id']; |
294 | 294 | if ($use_alias_path) { |
295 | 295 | $tmpPath = $this->getParents($doc['parent']); |
296 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
296 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
297 | 297 | $key = $alias; |
298 | 298 | } else { |
299 | 299 | $key = $doc['alias']; |
300 | 300 | } |
301 | 301 | |
302 | 302 | $doc['path'] = $tmpPath; |
303 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
304 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
305 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
303 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
304 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
305 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | // get content types |
309 | 309 | $rs = $modx->getDatabase()->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
310 | 310 | $content .= '$c=&$this->contentTypes;'; |
311 | 311 | while ($doc = $modx->getDatabase()->getRow($rs)) { |
312 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
312 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // WRITE Chunks to cache file |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | if ($modx->config['minifyphp_incache']) { |
320 | 320 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
321 | 321 | } |
322 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
322 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | // WRITE snippets to cache file |
@@ -330,18 +330,18 @@ discard block |
||
330 | 330 | while ($row = $modx->getDatabase()->getRow($rs)) { |
331 | 331 | $key = $row['name']; |
332 | 332 | if ($row['disabled']) { |
333 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
333 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
334 | 334 | } else { |
335 | 335 | $value = trim($row['snippet']); |
336 | 336 | if ($modx->config['minifyphp_incache']) { |
337 | 337 | $value = $this->php_strip_whitespace($value); |
338 | 338 | } |
339 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
339 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
340 | 340 | $properties = $modx->parseProperties($row['properties']); |
341 | 341 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
342 | 342 | $properties = array_merge($sharedproperties, $properties); |
343 | 343 | if (0 < count($properties)) { |
344 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
344 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | } |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | if ($modx->config['minifyphp_incache']) { |
360 | 360 | $value = $this->php_strip_whitespace($value); |
361 | 361 | } |
362 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
362 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
363 | 363 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
364 | 364 | $properties = $modx->parseProperties($row['properties']); |
365 | 365 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
366 | 366 | $properties = array_merge($sharedproperties, $properties); |
367 | 367 | if (0 < count($properties)) { |
368 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
368 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | } |
389 | 389 | foreach ($events as $evtname => $pluginnames) { |
390 | 390 | $events[$evtname] = $pluginnames; |
391 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', |
|
392 | - $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
391 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', |
|
392 | + $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $content .= "\n"; |
396 | 396 | |
397 | 397 | // close and write the file |
398 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
398 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
399 | 399 | |
400 | 400 | // invoke OnBeforeCacheUpdate event |
401 | 401 | if ($modx) { |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
407 | 407 | } |
408 | 408 | |
409 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
410 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
409 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
410 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | // invoke OnCacheUpdate event |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | $source = trim($source); |
431 | 431 | if (substr($source, 0, 5) !== '<?php') { |
432 | - $source = '<?php ' . $source; |
|
432 | + $source = '<?php '.$source; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | $tokens = token_get_all($source); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | } |
488 | 488 | } |
489 | 489 | $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), |
490 | - array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
490 | + array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
491 | 491 | $source = trim($source); |
492 | 492 | |
493 | 493 | return $source; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @return mixed |
|
66 | + * @return string |
|
67 | 67 | */ |
68 | 68 | public function getOutput() |
69 | 69 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if (is_array($SystemAlertMsgQueque)) { |
36 | 36 | $title = ''; |
37 | 37 | if ($this->name && $this->activePlugin) { |
38 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
38 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
39 | 39 | } |
40 | 40 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
41 | 41 | } |
@@ -278,8 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * Sets the width attribute of each column in the array. |
280 | 280 | * |
281 | - * @param array $value An Array of column widths in the order of the keys in the |
|
282 | - * source table array. |
|
281 | + * @param string[] $widthArray |
|
283 | 282 | */ |
284 | 283 | public function setColumnWidths($widthArray) |
285 | 284 | { |
@@ -289,7 +288,6 @@ discard block |
||
289 | 288 | /** |
290 | 289 | * An optional array of values that can be preselected when using |
291 | 290 | * |
292 | - * @param array $value Indicates the INPUT form element type attribute. |
|
293 | 291 | */ |
294 | 292 | public function setSelectedValues($valueArray) |
295 | 293 | { |
@@ -326,7 +324,7 @@ discard block |
||
326 | 324 | /** |
327 | 325 | * Determines what class the current row should have applied. |
328 | 326 | * |
329 | - * @param int $value The position of the current row being rendered. |
|
327 | + * @param integer $position |
|
330 | 328 | * @return string |
331 | 329 | */ |
332 | 330 | public function determineRowClass($position) |
@@ -353,7 +351,6 @@ discard block |
||
353 | 351 | * Generates an onclick action applied to the current cell, to execute |
354 | 352 | * any specified cell actions. |
355 | 353 | * |
356 | - * @param string $value Indicates the INPUT form element type attribute. |
|
357 | 354 | * @return string |
358 | 355 | */ |
359 | 356 | public function getCellAction($currentActionFieldValue) |
@@ -395,7 +392,7 @@ discard block |
||
395 | 392 | /** |
396 | 393 | * Function to prepare a link generated in the table cell/link actions. |
397 | 394 | * |
398 | - * @param string $value Indicates the INPUT form element type attribute. |
|
395 | + * @param string $link |
|
399 | 396 | * @return string |
400 | 397 | */ |
401 | 398 | public function prepareLink($link) |
@@ -414,7 +411,7 @@ discard block |
||
414 | 411 | * |
415 | 412 | * @param array $fieldsArray The associative array representing the table rows |
416 | 413 | * and columns. |
417 | - * @param array $fieldHeadersArray An optional array of values for providing |
|
414 | + * @param string[] $fieldHeadersArray An optional array of values for providing |
|
418 | 415 | * alternative field headers; this is an associative arrays of keys from |
419 | 416 | * the $fieldsArray where the values represent the alt heading content |
420 | 417 | * for each column. |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function setTableWidth($value) |
132 | 132 | { |
133 | - $this->tableWidth = (int)$value; |
|
133 | + $this->tableWidth = (int) $value; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | { |
318 | 318 | $currentWidth = ''; |
319 | 319 | if (is_array($this->columnWidths)) { |
320 | - $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : ''; |
|
320 | + $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : ''; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | return $currentWidth; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $currentClass = $this->rowAlternateClass; |
347 | 347 | } |
348 | 348 | |
349 | - return ' class="' . $currentClass . '"'; |
|
349 | + return ' class="'.$currentClass.'"'; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | { |
361 | 361 | $cellAction = ''; |
362 | 362 | if ($this->cellAction) { |
363 | - $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" '; |
|
363 | + $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" '; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | return $cellAction; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $cell = $value; |
379 | 379 | if ($this->linkAction) { |
380 | - $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>'; |
|
380 | + $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | return $cell; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $end = '?'; |
407 | 407 | } |
408 | 408 | |
409 | - return $link . $end; |
|
409 | + return $link.$end; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | if (is_array($fieldsArray)) { |
427 | 427 | $i = 0; |
428 | 428 | foreach ($fieldsArray as $fieldName => $fieldValue) { |
429 | - $table .= "\t<tr" . $this->determineRowClass($i) . ">\n"; |
|
429 | + $table .= "\t<tr".$this->determineRowClass($i).">\n"; |
|
430 | 430 | $currentActionFieldValue = $fieldValue[$this->actionField]; |
431 | 431 | if (is_array($this->selectedValues)) { |
432 | 432 | $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1; |
@@ -437,15 +437,15 @@ discard block |
||
437 | 437 | $colPosition = 0; |
438 | 438 | foreach ($fieldValue as $key => $value) { |
439 | 439 | if (!in_array($key, $this->excludeFields)) { |
440 | - $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">"; |
|
440 | + $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">"; |
|
441 | 441 | $table .= $this->createCellText($currentActionFieldValue, $value); |
442 | 442 | $table .= "</td>\n"; |
443 | 443 | if ($i == 0) { |
444 | 444 | if (empty ($header) && $this->formElementType) { |
445 | - $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n"; |
|
445 | + $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n"; |
|
446 | 446 | } |
447 | 447 | $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key; |
448 | - $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n"; |
|
448 | + $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n"; |
|
449 | 449 | } |
450 | 450 | $colPosition++; |
451 | 451 | } |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | $i++; |
454 | 454 | $table .= "\t</tr>\n"; |
455 | 455 | } |
456 | - $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n"; |
|
456 | + $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n"; |
|
457 | 457 | if ($this->formElementType) { |
458 | - $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
|
458 | + $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table; |
|
459 | 459 | } |
460 | 460 | if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
461 | 461 | /* commented this part because of cookie |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>'; |
471 | 471 | */ |
472 | - $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>'; |
|
472 | + $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>'; |
|
473 | 473 | //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>'; |
474 | 474 | |
475 | 475 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | <script language="javascript"> |
479 | 479 | toggled = 0; |
480 | 480 | function clickAll() { |
481 | - myform = document.getElementById("' . $this->formName . '"); |
|
481 | + myform = document.getElementById("' . $this->formName.'"); |
|
482 | 482 | for(i=0;i<myform.length;i++) { |
483 | 483 | if(myform.elements[i].type==\'checkbox\') { |
484 | 484 | myform.elements[i].checked=(toggled?false:true); |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | } |
491 | 491 | if ($this->formElementType) { |
492 | 492 | if ($this->extra) { |
493 | - $table .= "\n" . $this->extra . "\n"; |
|
493 | + $table .= "\n".$this->extra."\n"; |
|
494 | 494 | } |
495 | - $table .= "\n" . '</form>' . "\n"; |
|
495 | + $table .= "\n".'</form>'."\n"; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | return $table; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM); |
516 | 516 | $nav = ''; |
517 | 517 | if ($numPages > 1) { |
518 | - $currentURL = empty($qs) ? '' : '?' . $qs; |
|
518 | + $currentURL = empty($qs) ? '' : '?'.$qs; |
|
519 | 519 | if ($currentPage > 6) { |
520 | 520 | $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]); |
521 | 521 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]); |
541 | 541 | } |
542 | 542 | } |
543 | - $this->pageNav = ' ' . $nav; |
|
543 | + $this->pageNav = ' '.$nav; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -556,14 +556,14 @@ discard block |
||
556 | 556 | public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '') |
557 | 557 | { |
558 | 558 | $modx = evolutionCMS(); |
559 | - $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : ''; |
|
560 | - $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : ''; |
|
559 | + $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : ''; |
|
560 | + $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : ''; |
|
561 | 561 | if (!empty($qs)) { |
562 | 562 | $qs = "?$qs"; |
563 | 563 | } |
564 | 564 | $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'], |
565 | - $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum"; |
|
566 | - $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n"; |
|
565 | + $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum"; |
|
566 | + $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n"; |
|
567 | 567 | |
568 | 568 | return $nav; |
569 | 569 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | $field = ''; |
582 | 582 | if ($this->formElementType) { |
583 | 583 | $checked = $isChecked ? "checked " : ""; |
584 | - $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '" value="' . $value . '" ' . $checked . '/></td>' . "\n"; |
|
584 | + $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'" value="'.$value.'" '.$checked.'/></td>'."\n"; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | return $field; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | public function handlePaging() |
596 | 596 | { |
597 | 597 | $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0; |
598 | - $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM; |
|
598 | + $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM; |
|
599 | 599 | |
600 | 600 | return $limitClause; |
601 | 601 | } |
@@ -610,10 +610,10 @@ discard block |
||
610 | 610 | public function handleSorting($natural_order = false) |
611 | 611 | { |
612 | 612 | $orderByClause = ''; |
613 | - if ((bool)$natural_order === false) { |
|
613 | + if ((bool) $natural_order === false) { |
|
614 | 614 | $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id"; |
615 | 615 | $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC"; |
616 | - $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : ""; |
|
616 | + $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : ""; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | return $orderByClause; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
645 | - return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>'; |
|
645 | + return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>'; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | } |
@@ -457,7 +457,8 @@ |
||
457 | 457 | if ($this->formElementType) { |
458 | 458 | $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
459 | 459 | } |
460 | - if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
|
460 | + if (strlen($this->pageNav) > 1) { |
|
461 | +//changed to display the pagination if exists. |
|
461 | 462 | /* commented this part because of cookie |
462 | 463 | $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">'; |
463 | 464 | $pageSizes= array (10, 25, 50, 100, 250); |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * This function returns the current page number. |
151 | 151 | * |
152 | - * @return int |
|
152 | + * @return string |
|
153 | 153 | */ |
154 | 154 | public function getCurrentPage() |
155 | 155 | { |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | $array_paging['total'] = $this->int_nbr_row; |
102 | 102 | |
103 | 103 | if ($this->int_cur_position != 0) { |
104 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
105 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
104 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
105 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
109 | 109 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
110 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
111 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
110 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
111 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $array_paging; |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
127 | 127 | // if current page, do not make a link |
128 | 128 | if ($i == $this->getCurrentPage()) { |
129 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
129 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
130 | 130 | } else { |
131 | 131 | $int_new_position = ($i * $this->int_num_result); |
132 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
132 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |