@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | |
8 | 8 | $output = $_lang["status_checking_database"]; |
9 | 9 | $h = explode(':', $host, 2); |
10 | -if (!$conn = mysqli_connect($h[0], $uid, $pwd,'', isset($h[1]) ? $h[1] : null)) { |
|
11 | - $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed'] . '</span>'; |
|
10 | +if (!$conn = mysqli_connect($h[0], $uid, $pwd, '', isset($h[1]) ? $h[1] : null)) { |
|
11 | + $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>'; |
|
12 | 12 | } else { |
13 | 13 | $database_name = mysqli_real_escape_string($conn, $_POST['database_name']); |
14 | 14 | $database_name = str_replace("`", "", $database_name); |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | if (!@ mysqli_select_db($conn, $database_name)) { |
20 | 20 | // create database |
21 | 21 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
22 | - $query = "CREATE DATABASE `" . $database_name . "` CHARACTER SET " . $database_charset . " COLLATE " . $database_collation . ";"; |
|
22 | + $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";"; |
|
23 | 23 | |
24 | 24 | if (!mysqli_query($conn, $query)) { |
25 | - $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_could_not_create_database'] . '</span>'; |
|
25 | + $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>'; |
|
26 | 26 | } else { |
27 | - $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed_database_created'] . '</span>'; |
|
27 | + $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>'; |
|
28 | 28 | } |
29 | 29 | } elseif (($installMode == 0) && (mysqli_query($conn, |
30 | 30 | "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
31 | - $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_table_prefix_already_in_use'] . '</span>'; |
|
31 | + $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>'; |
|
32 | 32 | } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, |
33 | 33 | "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
34 | - $output .= '<span id="database_fail" style="color:#FF0000;">' . sprintf($_lang['status_failed_database_collation_does_not_match'], |
|
35 | - $row[1]) . '</span>'; |
|
34 | + $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], |
|
35 | + $row[1]).'</span>'; |
|
36 | 36 | } else { |
37 | - $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed'] . '</span>'; |
|
37 | + $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | -switch($installMode){ |
|
4 | +switch ($installMode) { |
|
5 | 5 | case 0: |
6 | 6 | case 2: |
7 | 7 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8mb4_general_ci'; |
8 | 8 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
9 | 9 | $_POST['database_connection_charset'] = $database_charset; |
10 | - if(empty($_SESSION['databaseloginpassword'])) |
|
10 | + if (empty($_SESSION['databaseloginpassword'])) |
|
11 | 11 | $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
12 | - if(empty($_SESSION['databaseloginname'])) |
|
12 | + if (empty($_SESSION['databaseloginname'])) |
|
13 | 13 | $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
14 | 14 | break; |
15 | 15 | case 1: |
16 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
16 | + include $base_path.MGR_DIR.'/includes/config.inc.php'; |
|
17 | 17 | $host = explode(':', $database_server, 2); |
18 | - if (@ $conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) { |
|
18 | + if (@ $conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null)) { |
|
19 | 19 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
20 | 20 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
21 | 21 | $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : ''; |
70 | 70 | |
71 | 71 | # load setup information file |
72 | -include_once dirname(__DIR__) . '/processor/result.php'; |
|
72 | +include_once dirname(__DIR__).'/processor/result.php'; |
|
73 | 73 | $ph['templates'] = getTemplates($moduleTemplates); |
74 | 74 | $ph['tvs'] = getTVs($moduleTVs); |
75 | 75 | $ph['chunks'] = getChunks($moduleChunks); |
@@ -79,6 +79,6 @@ discard block |
||
79 | 79 | |
80 | 80 | $ph['action'] = ($installMode == 1) ? 'mode' : 'connection'; |
81 | 81 | |
82 | -$tpl = file_get_contents(dirname(__DIR__) . '/template/actions/options.tpl'); |
|
82 | +$tpl = file_get_contents(dirname(__DIR__).'/template/actions/options.tpl'); |
|
83 | 83 | $content = parse($tpl, $ph); |
84 | 84 | echo parse($content, $_lang, '[%', '%]'); |
@@ -1,16 +1,18 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
3 | 3 | |
4 | -switch($installMode){ |
|
4 | +switch($installMode) { |
|
5 | 5 | case 0: |
6 | 6 | case 2: |
7 | 7 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8mb4_general_ci'; |
8 | 8 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
9 | 9 | $_POST['database_connection_charset'] = $database_charset; |
10 | - if(empty($_SESSION['databaseloginpassword'])) |
|
11 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
12 | - if(empty($_SESSION['databaseloginname'])) |
|
13 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
10 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
11 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
12 | + } |
|
13 | + if(empty($_SESSION['databaseloginname'])) { |
|
14 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
15 | + } |
|
14 | 16 | break; |
15 | 17 | case 1: |
16 | 18 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -25,7 +27,9 @@ discard block |
||
25 | 27 | } |
26 | 28 | } |
27 | 29 | } |
28 | - if (empty ($database_collation)) $database_collation = 'utf8mb4_general_ci'; |
|
30 | + if (empty ($database_collation)) { |
|
31 | + $database_collation = 'utf8mb4_general_ci'; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
31 | 35 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -34,7 +38,9 @@ discard block |
||
34 | 38 | |
35 | 39 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
36 | 40 | $database_connection_method = 'SET CHARACTER SET'; |
37 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
41 | + if (function_exists('mysqli_set_charset')) { |
|
42 | + mysqli_set_charset($conn, $database_connection_charset); |
|
43 | + } |
|
38 | 44 | } |
39 | 45 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
40 | 46 | $database_connection_method = 'SET NAMES'; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
17 | 17 | $host = explode(':', $database_server, 2); |
18 | 18 | if (@ $conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) { |
19 | - if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
19 | + if (@ mysqli_query($conn, "use {$dbase}")) { |
|
20 | 20 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
21 | 21 | $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
22 | 22 | } |
@@ -4,141 +4,141 @@ discard block |
||
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() { |
|
47 | + public function connect() { |
|
48 | 48 | $host = explode(':', $this->host, 2); |
49 | 49 | $this->conn = mysqli_connect($host[0], $this->user, $this->password,'', isset($host[1]) ? $host[1] : null); |
50 | - mysqli_select_db($this->conn, $this->dbname); |
|
51 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
52 | - |
|
53 | - $this->dbVersion = 3.23; // assume version 3.23 |
|
54 | - if(function_exists("mysqli_get_server_info")) { |
|
55 | - $ver = mysqli_get_server_info($this->conn); |
|
56 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
57 | - $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
58 | - } |
|
50 | + mysqli_select_db($this->conn, $this->dbname); |
|
51 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
52 | + |
|
53 | + $this->dbVersion = 3.23; // assume version 3.23 |
|
54 | + if(function_exists("mysqli_get_server_info")) { |
|
55 | + $ver = mysqli_get_server_info($this->conn); |
|
56 | + $this->dbMODx = version_compare($ver,"4.0.2"); |
|
57 | + $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
58 | + } |
|
59 | 59 | |
60 | 60 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | public function process($filename) { |
64 | - global $custom_placeholders; |
|
65 | - |
|
66 | - // check to make sure file exists |
|
67 | - if (!file_exists($filename)) { |
|
68 | - $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
69 | - $this->installFailed = true ; |
|
70 | - return false; |
|
71 | - } |
|
72 | - |
|
73 | - $fh = fopen($filename, 'r'); |
|
74 | - $idata = ''; |
|
75 | - |
|
76 | - while (!feof($fh)) { |
|
77 | - $idata .= fread($fh, 1024); |
|
78 | - } |
|
79 | - |
|
80 | - fclose($fh); |
|
81 | - $idata = str_replace("\r", '', $idata); |
|
82 | - |
|
83 | - // check if in upgrade mode |
|
84 | - if ($this->mode === 'upd') { |
|
85 | - // remove non-upgradeable parts |
|
86 | - $s = strpos($idata,'non-upgrade-able[['); |
|
87 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
88 | - if($s && $e) { |
|
89 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
64 | + global $custom_placeholders; |
|
65 | + |
|
66 | + // check to make sure file exists |
|
67 | + if (!file_exists($filename)) { |
|
68 | + $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
69 | + $this->installFailed = true ; |
|
70 | + return false; |
|
71 | + } |
|
72 | + |
|
73 | + $fh = fopen($filename, 'r'); |
|
74 | + $idata = ''; |
|
75 | + |
|
76 | + while (!feof($fh)) { |
|
77 | + $idata .= fread($fh, 1024); |
|
78 | + } |
|
79 | + |
|
80 | + fclose($fh); |
|
81 | + $idata = str_replace("\r", '', $idata); |
|
82 | + |
|
83 | + // check if in upgrade mode |
|
84 | + if ($this->mode === 'upd') { |
|
85 | + // remove non-upgradeable parts |
|
86 | + $s = strpos($idata,'non-upgrade-able[['); |
|
87 | + $e = strpos($idata,']]non-upgrade-able') + 17; |
|
88 | + if($s && $e) { |
|
89 | + $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
90 | 90 | } |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - // replace {} tags |
|
94 | - $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
93 | + // replace {} tags |
|
94 | + $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
95 | 95 | $idata = str_replace('{TABLEENCODING}', $this->getTableEncoding(), $idata); |
96 | - $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
97 | - $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
98 | - $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
99 | - $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
100 | - $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
101 | - $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
102 | - $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
103 | - $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
104 | - /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
105 | - |
|
106 | - // Replace custom placeholders |
|
107 | - foreach($custom_placeholders as $key=>$val) { |
|
108 | - if (strpos($idata, '{'.$key.'}') !== false) { |
|
109 | - $idata = str_replace('{'.$key.'}', $val, $idata); |
|
110 | - } |
|
111 | - } |
|
112 | - |
|
113 | - $sql_array = explode("\n\n", $idata); |
|
114 | - |
|
115 | - $num = 0; |
|
116 | - foreach($sql_array as $sql_entry) { |
|
117 | - $sql_do = trim($sql_entry, "\r\n; "); |
|
118 | - |
|
119 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
120 | - |
|
121 | - // strip out comments and \n for mysql 3.x |
|
122 | - if ($this->dbVersion <4.0) { |
|
123 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
124 | - $sql_do = str_replace('\r', "", $sql_do); |
|
125 | - $sql_do = str_replace('\n', "", $sql_do); |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - $num = $num + 1; |
|
130 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
131 | - if(mysqli_error($this->conn)) { |
|
132 | - // Ignore duplicate and drop errors - Raymond |
|
133 | - if ($this->ignoreDuplicateErrors){ |
|
134 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
135 | - } |
|
136 | - // End Ignore duplicate |
|
137 | - $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
138 | - $this->installFailed = true; |
|
139 | - } |
|
140 | - } |
|
141 | - } |
|
96 | + $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
97 | + $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
98 | + $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
99 | + $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
100 | + $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
101 | + $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
102 | + $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
103 | + $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
104 | + /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
105 | + |
|
106 | + // Replace custom placeholders |
|
107 | + foreach($custom_placeholders as $key=>$val) { |
|
108 | + if (strpos($idata, '{'.$key.'}') !== false) { |
|
109 | + $idata = str_replace('{'.$key.'}', $val, $idata); |
|
110 | + } |
|
111 | + } |
|
112 | + |
|
113 | + $sql_array = explode("\n\n", $idata); |
|
114 | + |
|
115 | + $num = 0; |
|
116 | + foreach($sql_array as $sql_entry) { |
|
117 | + $sql_do = trim($sql_entry, "\r\n; "); |
|
118 | + |
|
119 | + if (preg_match('/^\#/', $sql_do)) continue; |
|
120 | + |
|
121 | + // strip out comments and \n for mysql 3.x |
|
122 | + if ($this->dbVersion <4.0) { |
|
123 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
124 | + $sql_do = str_replace('\r', "", $sql_do); |
|
125 | + $sql_do = str_replace('\n', "", $sql_do); |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + $num = $num + 1; |
|
130 | + if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
131 | + if(mysqli_error($this->conn)) { |
|
132 | + // Ignore duplicate and drop errors - Raymond |
|
133 | + if ($this->ignoreDuplicateErrors){ |
|
134 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
135 | + } |
|
136 | + // End Ignore duplicate |
|
137 | + $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
138 | + $this->installFailed = true; |
|
139 | + } |
|
140 | + } |
|
141 | + } |
|
142 | 142 | |
143 | 143 | public function getTableEncoding() |
144 | 144 | { |
@@ -150,6 +150,6 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function close() { |
153 | - mysqli_close($this->conn); |
|
154 | - } |
|
153 | + mysqli_close($this->conn); |
|
154 | + } |
|
155 | 155 | } |
@@ -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,29 +44,29 @@ discard block |
||
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 45 | } |
46 | 46 | |
47 | - public function connect() { |
|
47 | + public function connect(){ |
|
48 | 48 | $host = explode(':', $this->host, 2); |
49 | - $this->conn = mysqli_connect($host[0], $this->user, $this->password,'', isset($host[1]) ? $host[1] : null); |
|
49 | + $this->conn = mysqli_connect($host[0], $this->user, $this->password, '', isset($host[1]) ? $host[1] : null); |
|
50 | 50 | mysqli_select_db($this->conn, $this->dbname); |
51 | 51 | if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
52 | 52 | |
53 | 53 | $this->dbVersion = 3.23; // assume version 3.23 |
54 | - if(function_exists("mysqli_get_server_info")) { |
|
54 | + if (function_exists("mysqli_get_server_info")) { |
|
55 | 55 | $ver = mysqli_get_server_info($this->conn); |
56 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | + $this->dbMODx = version_compare($ver, "4.0.2"); |
|
57 | 57 | $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
58 | 58 | } |
59 | 59 | |
60 | - mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
|
60 | + mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}"); |
|
61 | 61 | } |
62 | 62 | |
63 | - public function process($filename) { |
|
63 | + public function process($filename){ |
|
64 | 64 | global $custom_placeholders; |
65 | 65 | |
66 | 66 | // check to make sure file exists |
67 | 67 | if (!file_exists($filename)) { |
68 | 68 | $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
69 | - $this->installFailed = true ; |
|
69 | + $this->installFailed = true; |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | // check if in upgrade mode |
84 | 84 | if ($this->mode === 'upd') { |
85 | 85 | // remove non-upgradeable parts |
86 | - $s = strpos($idata,'non-upgrade-able[['); |
|
87 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
88 | - if($s && $e) { |
|
89 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
86 | + $s = strpos($idata, 'non-upgrade-able[['); |
|
87 | + $e = strpos($idata, ']]non-upgrade-able') + 17; |
|
88 | + if ($s && $e) { |
|
89 | + $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
105 | 105 | |
106 | 106 | // Replace custom placeholders |
107 | - foreach($custom_placeholders as $key=>$val) { |
|
107 | + foreach ($custom_placeholders as $key=>$val) { |
|
108 | 108 | if (strpos($idata, '{'.$key.'}') !== false) { |
109 | 109 | $idata = str_replace('{'.$key.'}', $val, $idata); |
110 | 110 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $sql_array = explode("\n\n", $idata); |
114 | 114 | |
115 | 115 | $num = 0; |
116 | - foreach($sql_array as $sql_entry) { |
|
116 | + foreach ($sql_array as $sql_entry) { |
|
117 | 117 | $sql_do = trim($sql_entry, "\r\n; "); |
118 | 118 | |
119 | 119 | if (preg_match('/^\#/', $sql_do)) continue; |
120 | 120 | |
121 | 121 | // strip out comments and \n for mysql 3.x |
122 | - if ($this->dbVersion <4.0) { |
|
123 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | + if ($this->dbVersion < 4.0) { |
|
123 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do); |
|
124 | 124 | $sql_do = str_replace('\r', "", $sql_do); |
125 | 125 | $sql_do = str_replace('\n', "", $sql_do); |
126 | 126 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | |
129 | 129 | $num = $num + 1; |
130 | 130 | if ($sql_do) mysqli_query($this->conn, $sql_do); |
131 | - if(mysqli_error($this->conn)) { |
|
131 | + if (mysqli_error($this->conn)) { |
|
132 | 132 | // Ignore duplicate and drop errors - Raymond |
133 | - if ($this->ignoreDuplicateErrors){ |
|
134 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | + if ($this->ignoreDuplicateErrors) { |
|
134 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue; |
|
135 | 135 | } |
136 | 136 | // End Ignore duplicate |
137 | 137 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | |
143 | 143 | public function getTableEncoding() |
144 | 144 | { |
145 | - $out = 'DEFAULT CHARSET=' . $this->connection_charset; |
|
145 | + $out = 'DEFAULT CHARSET='.$this->connection_charset; |
|
146 | 146 | if (!empty($this->database_collation)) { |
147 | - $out .= ' COLLATE=' . $this->database_collation; |
|
147 | + $out .= ' COLLATE='.$this->database_collation; |
|
148 | 148 | } |
149 | 149 | return $out; |
150 | 150 | } |
151 | 151 | |
152 | - public function close() { |
|
152 | + public function close(){ |
|
153 | 153 | mysqli_close($this->conn); |
154 | 154 | } |
155 | 155 | } |
@@ -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,11 +46,14 @@ discard block |
||
44 | 46 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 47 | } |
46 | 48 | |
47 | - public function connect() { |
|
49 | + public function connect() |
|
50 | + { |
|
48 | 51 | $host = explode(':', $this->host, 2); |
49 | 52 | $this->conn = mysqli_connect($host[0], $this->user, $this->password,'', isset($host[1]) ? $host[1] : null); |
50 | 53 | mysqli_select_db($this->conn, $this->dbname); |
51 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
54 | + if (function_exists('mysqli_set_charset')) { |
|
55 | + mysqli_set_charset($this->conn, $this->connection_charset); |
|
56 | + } |
|
52 | 57 | |
53 | 58 | $this->dbVersion = 3.23; // assume version 3.23 |
54 | 59 | if(function_exists("mysqli_get_server_info")) { |
@@ -60,7 +65,8 @@ discard block |
||
60 | 65 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
61 | 66 | } |
62 | 67 | |
63 | - public function process($filename) { |
|
68 | + public function process($filename) |
|
69 | + { |
|
64 | 70 | global $custom_placeholders; |
65 | 71 | |
66 | 72 | // check to make sure file exists |
@@ -116,7 +122,9 @@ discard block |
||
116 | 122 | foreach($sql_array as $sql_entry) { |
117 | 123 | $sql_do = trim($sql_entry, "\r\n; "); |
118 | 124 | |
119 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
125 | + if (preg_match('/^\#/', $sql_do)) { |
|
126 | + continue; |
|
127 | + } |
|
120 | 128 | |
121 | 129 | // strip out comments and \n for mysql 3.x |
122 | 130 | if ($this->dbVersion <4.0) { |
@@ -127,11 +135,15 @@ discard block |
||
127 | 135 | |
128 | 136 | |
129 | 137 | $num = $num + 1; |
130 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
138 | + if ($sql_do) { |
|
139 | + mysqli_query($this->conn, $sql_do); |
|
140 | + } |
|
131 | 141 | if(mysqli_error($this->conn)) { |
132 | 142 | // Ignore duplicate and drop errors - Raymond |
133 | - if ($this->ignoreDuplicateErrors){ |
|
134 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
143 | + if ($this->ignoreDuplicateErrors) { |
|
144 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) { |
|
145 | + continue; |
|
146 | + } |
|
135 | 147 | } |
136 | 148 | // End Ignore duplicate |
137 | 149 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -149,7 +161,8 @@ discard block |
||
149 | 161 | return $out; |
150 | 162 | } |
151 | 163 | |
152 | - public function close() { |
|
164 | + public function close() |
|
165 | + { |
|
153 | 166 | mysqli_close($this->conn); |
154 | 167 | } |
155 | 168 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! function_exists('getLangOptions')) { |
|
2 | +if (!function_exists('getLangOptions')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $install_language |
5 | 5 | * @return string |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | function getLangOptions($install_language = 'english') |
8 | 8 | { |
9 | 9 | $langs = array(); |
10 | - if ($handle = opendir(__DIR__ . '/lang/')) { |
|
10 | + if ($handle = opendir(__DIR__.'/lang/')) { |
|
11 | 11 | while (false !== ($file = readdir($handle))) { |
12 | 12 | if (strpos($file, '.')) { |
13 | 13 | $langs[] = str_replace('.inc.php', '', $file); |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | $abrv_language = explode('-', $language); |
22 | 22 | $selected = ($language === $install_language) ? 'selected' : ''; |
23 | 23 | $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected, |
24 | - ucwords($abrv_language[0])) . "\n"; |
|
24 | + ucwords($abrv_language[0]))."\n"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | return implode("\n", $_); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -if (! function_exists('install_sessionCheck')) { |
|
31 | +if (!function_exists('install_sessionCheck')) { |
|
32 | 32 | function install_sessionCheck() |
33 | 33 | { |
34 | 34 | global $_lang; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | </head> |
51 | 51 | <body> |
52 | 52 | <div class="install"> |
53 | - <p>' . $_lang["session_problem"] . '</p> |
|
54 | - <p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p> |
|
53 | + <p>' . $_lang["session_problem"].'</p> |
|
54 | + <p><a href="./">' . $_lang["session_problem_try_again"].'</a></p> |
|
55 | 55 | </div> |
56 | 56 | </body> |
57 | 57 | </html>'; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | function parse($src, $ph, $left = '[+', $right = '+]') |
73 | 73 | { |
74 | 74 | foreach ($ph as $k => $v) { |
75 | - $k = $left . $k . $right; |
|
75 | + $k = $left.$k.$right; |
|
76 | 76 | $src = str_replace($k, $v, $src); |
77 | 77 | } |
78 | 78 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
100 | 100 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
101 | 101 | $ph['version'] = $moduleVersion; |
102 | - $ph['release_date'] = ($modx_textdir ? '‏' : '') . $modx_release_date; |
|
102 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
103 | 103 | $ph['footer1'] = $_lang['modx_footer1']; |
104 | 104 | $ph['footer2'] = $_lang['modx_footer2']; |
105 | 105 | $ph['current_year'] = date('Y'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $installmode = 0; |
129 | 129 | } else { |
130 | 130 | $host = explode(':', $database_server, 2); |
131 | - $conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null); |
|
131 | + $conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null); |
|
132 | 132 | if ($conn) { |
133 | 133 | $_SESSION['database_server'] = $database_server; |
134 | 134 | $_SESSION['database_user'] = $database_user; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $manager_language = "english"; |
187 | 187 | } |
188 | 188 | $langs = array(); |
189 | - if ($handle = opendir(MODX_MANAGER_PATH . 'includes/lang')) { |
|
189 | + if ($handle = opendir(MODX_MANAGER_PATH.'includes/lang')) { |
|
190 | 190 | while (false !== ($file = readdir($handle))) { |
191 | 191 | if (strpos($file, '.inc.') !== false) { |
192 | 192 | $langs[] = $file; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $i++; |
253 | 253 | } |
254 | 254 | |
255 | - return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : ''; |
|
255 | + return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : ''; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $i++; |
283 | 283 | } |
284 | 284 | |
285 | - return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : ''; |
|
285 | + return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : ''; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $i++; |
314 | 314 | } |
315 | 315 | |
316 | - return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : ''; |
|
316 | + return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : ''; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $i++; |
345 | 345 | } |
346 | 346 | |
347 | - return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : ''; |
|
347 | + return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : ''; |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $i++; |
380 | 380 | } |
381 | 381 | |
382 | - return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : ''; |
|
382 | + return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : ''; |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $i++; |
411 | 411 | } |
412 | 412 | |
413 | - return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : ''; |
|
413 | + return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : ''; |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
@@ -421,46 +421,46 @@ discard block |
||
421 | 421 | |
422 | 422 | // secure web documents - privateweb |
423 | 423 | mysqli_query($sqlParser->conn, |
424 | - "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
424 | + "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
425 | 425 | $sql = "SELECT DISTINCT sc.id |
426 | - FROM `" . $sqlParser->prefix . "site_content` sc |
|
427 | - LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id |
|
428 | - LEFT JOIN `" . $sqlParser->prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group |
|
426 | + FROM `" . $sqlParser->prefix."site_content` sc |
|
427 | + LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
|
428 | + LEFT JOIN `" . $sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
|
429 | 429 | WHERE wga.id>0"; |
430 | 430 | $ds = mysqli_query($sqlParser->conn, $sql); |
431 | 431 | if (!$ds) { |
432 | - echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn); |
|
432 | + echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
|
433 | 433 | } else { |
434 | 434 | while ($r = mysqli_fetch_assoc($ds)) { |
435 | 435 | $ids[] = $r["id"]; |
436 | 436 | } |
437 | 437 | if (count($ids) > 0) { |
438 | 438 | mysqli_query($sqlParser->conn, |
439 | - "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ", |
|
440 | - $ids) . ")"); |
|
439 | + "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", |
|
440 | + $ids).")"); |
|
441 | 441 | unset($ids); |
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | 445 | // secure manager documents privatemgr |
446 | 446 | mysqli_query($sqlParser->conn, |
447 | - "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
447 | + "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
448 | 448 | $sql = "SELECT DISTINCT sc.id |
449 | - FROM `" . $sqlParser->prefix . "site_content` sc |
|
450 | - LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id |
|
451 | - LEFT JOIN `" . $sqlParser->prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group |
|
449 | + FROM `" . $sqlParser->prefix."site_content` sc |
|
450 | + LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
|
451 | + LEFT JOIN `" . $sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
|
452 | 452 | WHERE mga.id>0"; |
453 | 453 | $ds = mysqli_query($sqlParser->conn, $sql); |
454 | 454 | if (!$ds) { |
455 | - echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn); |
|
455 | + echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
|
456 | 456 | } else { |
457 | 457 | while ($r = mysqli_fetch_assoc($ds)) { |
458 | 458 | $ids[] = $r["id"]; |
459 | 459 | } |
460 | 460 | if (count($ids) > 0) { |
461 | 461 | mysqli_query($sqlParser->conn, |
462 | - "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ", |
|
463 | - $ids) . ")"); |
|
462 | + "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", |
|
463 | + $ids).")"); |
|
464 | 464 | unset($ids); |
465 | 465 | } |
466 | 466 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | function parse_docblock($element_dir, $filename) |
472 | 472 | { |
473 | 473 | $params = array(); |
474 | - $fullpath = $element_dir . '/' . $filename; |
|
474 | + $fullpath = $element_dir.'/'.$filename; |
|
475 | 475 | if (is_readable($fullpath)) { |
476 | 476 | $tpl = @fopen($fullpath, "r"); |
477 | 477 | if ($tpl) { |
@@ -688,17 +688,17 @@ discard block |
||
688 | 688 | function getCreateDbCategory($category, $sqlParser) |
689 | 689 | { |
690 | 690 | $dbase = $sqlParser->dbname; |
691 | - $dbase = '`' . trim($dbase, '`') . '`'; |
|
691 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
692 | 692 | $table_prefix = $sqlParser->prefix; |
693 | 693 | $category_id = 0; |
694 | 694 | if (!empty($category)) { |
695 | 695 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
696 | 696 | $rs = mysqli_query($sqlParser->conn, |
697 | - "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'"); |
|
697 | + "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
|
698 | 698 | if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
699 | 699 | $category_id = $row['id']; |
700 | 700 | } else { |
701 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');"; |
|
701 | + $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
|
702 | 702 | $rs = mysqli_query($sqlParser->conn, $q); |
703 | 703 | if ($rs) { |
704 | 704 | $category_id = mysqli_insert_id($sqlParser->conn); |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | default: |
741 | 741 | return $cleaned; |
742 | 742 | }; |
743 | - if (substr(trim($cleaned), 0, $count) == $include . ' MODX_BASE_PATH.\'assets/' . $elm_name . '/') { |
|
743 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
744 | 744 | return $cleaned; |
745 | 745 | } |
746 | 746 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('makeHTML')) { |
|
3 | +if (!function_exists('makeHTML')) { |
|
4 | 4 | /** |
5 | 5 | * @param int $indent |
6 | 6 | * @param int $parent |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | case 'publishedon': |
38 | 38 | case 'pub_date': |
39 | 39 | case 'unpub_date': |
40 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], |
|
41 | - 'sc.' . $_SESSION['tree_sortby']); |
|
40 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], |
|
41 | + 'sc.'.$_SESSION['tree_sortby']); |
|
42 | 42 | break; |
43 | 43 | default: |
44 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
44 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
45 | 45 | }; |
46 | 46 | |
47 | - $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
47 | + $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
48 | 48 | |
49 | 49 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
50 | 50 | if ($_SESSION['tree_sortby'] == 'isfolder') { |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $_SESSION['mgrDocgroups']) : ''; |
60 | 60 | $showProtected = false; |
61 | 61 | if ($modx->getConfig('tree_show_protected') !== null) { |
62 | - $showProtected = (boolean)$modx->getConfig('tree_show_protected'); |
|
62 | + $showProtected = (boolean) $modx->getConfig('tree_show_protected'); |
|
63 | 63 | } |
64 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
64 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
65 | 65 | if ($showProtected == false) { |
66 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
66 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
67 | 67 | } else { |
68 | 68 | $access = ''; |
69 | 69 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
103 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
103 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
104 | 104 | |
105 | 105 | // Prepare displaying user-locks |
106 | 106 | $lockedByUser = ''; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'element_type' => $_lang["lock_element_type_7"], |
112 | 112 | 'lasthit_df' => $rowLock['lasthit_df'] |
113 | 113 | )); |
114 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
114 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
115 | 115 | } else { |
116 | 116 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
117 | 117 | 'element_type' => $_lang["lock_element_type_7"], |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | 'lasthit_df' => $rowLock['lasthit_df'] |
120 | 120 | )); |
121 | 121 | if ($modx->hasPermission('remove_locks')) { |
122 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
122 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
123 | 123 | } else { |
124 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
124 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | |
131 | 131 | $title = ''; |
132 | 132 | if (isDateNode($nodeNameSource)) { |
133 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
133 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
134 | 134 | } |
135 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
136 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
137 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
138 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
140 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
141 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
142 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
135 | + $title .= $_lang['id'].': '.$row['id']; |
|
136 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
137 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
138 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
140 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
141 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
142 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
147 | 147 | $title = $modx->getPhpCompat()->htmlspecialchars($title); |
148 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
148 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
149 | 149 | |
150 | 150 | $data = array( |
151 | 151 | 'id' => $row['id'], |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($ph['contextmenu']) { |
232 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
232 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if ($_SESSION['tree_show_only_folders']) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | if ($ph['contextmenu']) { |
290 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
290 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $node .= $modx->parseText($tpl, $ph); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | if ($ph['contextmenu']) { |
328 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
328 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $node .= $modx->parseText($tpl, $ph); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if ($ph['contextmenu']) { |
379 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
379 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $node .= $modx->parseText($tpl, $ph); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | if ($ph['contextmenu']) { |
421 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
421 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | $node .= $modx->parseText($tpl, $ph); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if(!function_exists('getIconInfo')) { |
|
447 | +if (!function_exists('getIconInfo')) { |
|
448 | 448 | /** |
449 | 449 | * @param array $_style |
450 | 450 | * @return array |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | -if(!function_exists('getNodeTitle')) { |
|
481 | +if (!function_exists('getNodeTitle')) { |
|
482 | 482 | /** |
483 | 483 | * @param string $nodeNameSource |
484 | 484 | * @param array $row |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | $nodetitle .= $modx->getConfig('friendly_url_suffix'); |
500 | 500 | } |
501 | 501 | } |
502 | - $nodetitle = $modx->getConfig('friendly_url_prefix') . $nodetitle; |
|
502 | + $nodetitle = $modx->getConfig('friendly_url_prefix').$nodetitle; |
|
503 | 503 | break; |
504 | 504 | case 'pagetitle': |
505 | 505 | $nodetitle = $row['pagetitle']; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if(!function_exists('isDateNode')) { |
|
536 | +if (!function_exists('isDateNode')) { |
|
537 | 537 | /** |
538 | 538 | * @param string $nodeNameSource |
539 | 539 | * @return bool |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
556 | -if(!function_exists('checkIsFolder')) { |
|
556 | +if (!function_exists('checkIsFolder')) { |
|
557 | 557 | /** |
558 | 558 | * @param int $parent |
559 | 559 | * @param int $isfolder |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | { |
564 | 564 | $modx = evolutionCMS(); |
565 | 565 | |
566 | - return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getDatabase()->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
566 | + return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getDatabase()->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | -if(!function_exists('_htmlentities')) { |
|
570 | +if (!function_exists('_htmlentities')) { |
|
571 | 571 | /** |
572 | 572 | * @param mixed $array |
573 | 573 | * @return string |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | -if(!function_exists('getTplSingleNode')) { |
|
586 | +if (!function_exists('getTplSingleNode')) { |
|
587 | 587 | /** |
588 | 588 | * @return string |
589 | 589 | */ |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | -if(!function_exists('getTplFolderNode')) { |
|
616 | +if (!function_exists('getTplFolderNode')) { |
|
617 | 617 | /** |
618 | 618 | * @return string |
619 | 619 | */ |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
655 | 655 | } |
656 | 656 | } |
657 | -if(!function_exists('getTplFolderNodeNotChildren')) { |
|
657 | +if (!function_exists('getTplFolderNodeNotChildren')) { |
|
658 | 658 | /** |
659 | 659 | * @return string |
660 | 660 | */ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('createGUID')) { |
|
3 | +if (!function_exists('createGUID')) { |
|
4 | 4 | /** |
5 | 5 | * create globally unique identifiers (guid) |
6 | 6 | * |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function createGUID() |
10 | 10 | { |
11 | - srand((double)microtime() * 1000000); |
|
11 | + srand((double) microtime() * 1000000); |
|
12 | 12 | $r = rand(); |
13 | - $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1); |
|
13 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
14 | 14 | $m = md5($u); |
15 | 15 | |
16 | 16 | return $m; |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if (! function_exists('generate_password')) { |
|
20 | +if (!function_exists('generate_password')) { |
|
21 | 21 | /** |
22 | 22 | * Generate password |
23 | 23 | * |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
30 | 30 | $ps_len = strlen($allowable_characters); |
31 | - mt_srand((double)microtime() * 1000000); |
|
31 | + mt_srand((double) microtime() * 1000000); |
|
32 | 32 | $pass = ""; |
33 | 33 | for ($i = 0; $i < $length; $i++) { |
34 | 34 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if (! function_exists('html_escape')) { |
|
53 | +if (!function_exists('html_escape')) { |
|
54 | 54 | /** |
55 | 55 | * @param $str |
56 | 56 | * @param string $charset |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (! function_exists('get_by_key')) { |
|
66 | +if (!function_exists('get_by_key')) { |
|
67 | 67 | /** |
68 | 68 | * @param mixed $data |
69 | 69 | * @param string|int $key |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | - if ($found === true && ! empty($validate) && \is_callable($validate)) { |
|
105 | + if ($found === true && !empty($validate) && \is_callable($validate)) { |
|
106 | 106 | $out = (($validate($out) === true) ? $out : $default); |
107 | 107 | } |
108 | 108 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | -if (! function_exists('is_cli')) { |
|
113 | +if (!function_exists('is_cli')) { |
|
114 | 114 | function is_cli() |
115 | 115 | { |
116 | 116 | return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('nicesize')) { |
|
120 | +if (!function_exists('nicesize')) { |
|
121 | 121 | /** |
122 | 122 | * @param $size |
123 | 123 | * @return string |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $precisions = count($sizes) - 1; |
129 | 129 | foreach ($sizes as $unit => $bytes) { |
130 | 130 | if ($size >= $bytes) { |
131 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
131 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
132 | 132 | } |
133 | 133 | $precisions--; |
134 | 134 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | -if (! function_exists('data_is_json')) { |
|
140 | +if (!function_exists('data_is_json')) { |
|
141 | 141 | /** |
142 | 142 | * @param $string |
143 | 143 | * @param bool $returnData |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if (! function_exists('is_ajax')) { |
|
154 | +if (!function_exists('is_ajax')) { |
|
155 | 155 | /** |
156 | 156 | * @return bool |
157 | 157 | */ |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! function_exists('fetchRssChannelItems')) { |
|
2 | +if (!function_exists('fetchRssChannelItems')) { |
|
3 | 3 | function fetchRssChannelItems($url) |
4 | 4 | { |
5 | 5 | $items = []; |
6 | - $file = evolutionCMS()->getCachePath() . 'rss/' . md5($url); |
|
6 | + $file = evolutionCMS()->getCachePath().'rss/'.md5($url); |
|
7 | 7 | $loadPath = file_exists($file) ? $file : $url; |
8 | 8 | $content = file_get_contents($loadPath); |
9 | 9 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | if (!empty($items) && $loadPath !== $file) { |
30 | - if(! is_dir(dirname($file))) { |
|
30 | + if (!is_dir(dirname($file))) { |
|
31 | 31 | mkdir(dirname($file)); |
32 | 32 | } |
33 | 33 | file_put_contents($file, $content); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if (! function_exists('rel2abs')) { |
|
41 | +if (!function_exists('rel2abs')) { |
|
42 | 42 | /** |
43 | 43 | * Convert relative path into absolute url |
44 | 44 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $tmp = parse_url($base); |
53 | 53 | extract($tmp); |
54 | 54 | if (strpos($rel, "//") === 0) { |
55 | - return $scheme . ':' . $rel; |
|
55 | + return $scheme.':'.$rel; |
|
56 | 56 | } |
57 | 57 | // return if already absolute URL |
58 | 58 | if (parse_url($rel, PHP_URL_SCHEME) != '') { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | // queries and anchors |
62 | 62 | if ($rel[0] == '#' || $rel[0] == '?') { |
63 | - return $base . $rel; |
|
63 | + return $base.$rel; |
|
64 | 64 | } |
65 | 65 | // remove non-directory element from path |
66 | 66 | $path = preg_replace('#/[^/]*$#', '', $path); |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | $path = ''; |
70 | 70 | } |
71 | 71 | // dirty absolute URL |
72 | - $abs = $host . $path . "/" . $rel; |
|
72 | + $abs = $host.$path."/".$rel; |
|
73 | 73 | // replace '//' or '/./' or '/foo/../' with '/' |
74 | 74 | $abs = preg_replace("/(\/\.?\/)/", "/", $abs); |
75 | 75 | $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs); |
76 | 76 | |
77 | 77 | // absolute URL is ready! |
78 | - return $scheme . '://' . $abs; |
|
78 | + return $scheme.'://'.$abs; |
|
79 | 79 | } |
80 | 80 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('highlightingCoincidence')) { |
|
3 | +if (!function_exists('highlightingCoincidence')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $text |
6 | 6 | * @param string $search |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function highlightingCoincidence($text, $search) |
10 | 10 | { |
11 | - $regexp = '!(' . str_replace(array( |
|
11 | + $regexp = '!('.str_replace(array( |
|
12 | 12 | '(', |
13 | 13 | ')' |
14 | 14 | ), array( |
15 | 15 | '\(', |
16 | 16 | '\)' |
17 | - ), entities(trim($search), evolutionCMS()->getConfig('modx_charset'))) . ')!isu'; |
|
17 | + ), entities(trim($search), evolutionCMS()->getConfig('modx_charset'))).')!isu'; |
|
18 | 18 | |
19 | 19 | return preg_replace($regexp, '<span class="text-danger">$1</span>', entities($text, evolutionCMS()->getConfig('modx_charset'))); |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if(!function_exists('addClassForItemList')) { |
|
23 | +if (!function_exists('addClassForItemList')) { |
|
24 | 24 | /** |
25 | 25 | * @param string $locked |
26 | 26 | * @param string $disabled |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $class .= ' deleted'; |
41 | 41 | } |
42 | 42 | if ($class) { |
43 | - $class = ' class="' . trim($class) . '"'; |
|
43 | + $class = ' class="'.trim($class).'"'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $class; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('createList')) { |
|
2 | +if (!function_exists('createList')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $sectionHeader |
5 | 5 | * @param array $linkArr |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function createList($sectionHeader, $linkArr) |
9 | 9 | { |
10 | - $output = '<div class="sectionHeader">' . $sectionHeader . '</div><div class="sectionBody">' . "\n"; |
|
11 | - $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">' . "\n"; |
|
10 | + $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
11 | + $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
12 | 12 | $links = ''; |
13 | 13 | foreach ($linkArr as $row) { |
14 | 14 | if (!is_array($row['link'])) { |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | } |
17 | 17 | foreach ($row['link'] as $link) { |
18 | 18 | $links .= $links != '' ? '<br/>' : ''; |
19 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
19 | + $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>'; |
|
20 | 20 | } |
21 | 21 | $output .= ' |
22 | 22 | <tr> |
23 | - <td align="left"><strong>' . $row["title"] . '</strong></td> |
|
24 | - <td align="left">' . $links . '</td> |
|
23 | + <td align="left"><strong>' . $row["title"].'</strong></td> |
|
24 | + <td align="left">' . $links.'</td> |
|
25 | 25 | </tr>'; |
26 | 26 | $links = ''; |
27 | 27 | } |
28 | - $output .= '</table></div>' . "\n"; |
|
28 | + $output .= '</table></div>'."\n"; |
|
29 | 29 | |
30 | 30 | return $output; |
31 | 31 | } |