Completed
Pull Request — develop (#518)
by Agel_Nash
07:00
created
install/lang.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -16,35 +16,35 @@  discard block
 block discarded – undo
16 16
 $install_language = "english";
17 17
 
18 18
 $_langFiles= array (
19
- "en" => "english",
20
- "bg" => "bulgarian",
21
- "cs" => "czech",
22
- "da" => "danish",
23
- "fi" => "finnish-utf8",
24
- "fr" => "francais-utf8",
25
- "de" => "german",
26
- "he" => "hebrew",
27
- "it" => "italian",
28
- "ja" => "japanese-utf8",
29
- "nl" => "nederlands-utf8",
30
- "no" => "norwegian",
31
- "fa" => "persian",
32
- "pl" => "polish-utf8",
33
- "pt" => "portuguese-br-utf8",
19
+    "en" => "english",
20
+    "bg" => "bulgarian",
21
+    "cs" => "czech",
22
+    "da" => "danish",
23
+    "fi" => "finnish-utf8",
24
+    "fr" => "francais-utf8",
25
+    "de" => "german",
26
+    "he" => "hebrew",
27
+    "it" => "italian",
28
+    "ja" => "japanese-utf8",
29
+    "nl" => "nederlands-utf8",
30
+    "no" => "norwegian",
31
+    "fa" => "persian",
32
+    "pl" => "polish-utf8",
33
+    "pt" => "portuguese-br-utf8",
34 34
 // "pt" => "portuguese",
35
- "ru" => "russian-UTF8",
36
- "es" => "spanish-utf8",
37
- "sv" => "svenska"
35
+    "ru" => "russian-UTF8",
36
+    "es" => "spanish-utf8",
37
+    "sv" => "svenska"
38 38
 );
39 39
 $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
40 40
 if (!empty($_langFiles[$_langISO6391]))  $install_language = $_langFiles[$_langISO6391];
41 41
 
42 42
 
43 43
 if (isset($_POST['language']) && !stristr($_POST['language'],"..")) {
44
-	$install_language = $_POST['language'];
44
+    $install_language = $_POST['language'];
45 45
 } else {
46
-	if (isset($_GET['language']) && !stristr($_GET['language'],".."))
47
-		$install_language = $_GET['language'];
46
+    if (isset($_GET['language']) && !stristr($_GET['language'],".."))
47
+        $install_language = $_GET['language'];
48 48
 }
49 49
 # load language file
50 50
 require_once("lang/english.inc.php"); // As fallback
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 $manager_language = $install_language;
54 54
 
55 55
 if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) {
56
-	$manager_language = $_POST['managerlanguage'];
56
+    $manager_language = $_POST['managerlanguage'];
57 57
 } else {
58
-	if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],".."))
59
-		$manager_language = $_GET['managerlanguage'];
58
+    if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],".."))
59
+        $manager_language = $_GET['managerlanguage'];
60 60
 }
61 61
 
62 62
 foreach($_lang as $k=>$v)
63 63
 {
64
-	if(strpos($v,'[+MGR_DIR+]')!==false)
65
-		$_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v);
64
+    if(strpos($v,'[+MGR_DIR+]')!==false)
65
+        $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v);
66 66
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
  * Filename:       /install/lang.php
11 11
  */
12 12
 
13
-$_lang = array ();
13
+$_lang = array();
14 14
 
15 15
 #default fallback language file - english
16 16
 $install_language = "english";
17 17
 
18
-$_langFiles= array (
18
+$_langFiles = array(
19 19
  "en" => "english",
20 20
  "bg" => "bulgarian",
21 21
  "cs" => "czech",
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
  "es" => "spanish-utf8",
37 37
  "sv" => "svenska"
38 38
 );
39
-$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
39
+$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
40 40
 if (!empty($_langFiles[$_langISO6391]))  $install_language = $_langFiles[$_langISO6391];
41 41
 
42 42
 
43
-if (isset($_POST['language']) && !stristr($_POST['language'],"..")) {
43
+if (isset($_POST['language']) && !stristr($_POST['language'], "..")) {
44 44
 	$install_language = $_POST['language'];
45 45
 } else {
46
-	if (isset($_GET['language']) && !stristr($_GET['language'],".."))
46
+	if (isset($_GET['language']) && !stristr($_GET['language'], ".."))
47 47
 		$install_language = $_GET['language'];
48 48
 }
49 49
 # load language file
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
 
53 53
 $manager_language = $install_language;
54 54
 
55
-if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) {
55
+if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'], "..")) {
56 56
 	$manager_language = $_POST['managerlanguage'];
57 57
 } else {
58
-	if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],".."))
58
+	if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'], ".."))
59 59
 		$manager_language = $_GET['managerlanguage'];
60 60
 }
61 61
 
62
-foreach($_lang as $k=>$v)
62
+foreach ($_lang as $k=>$v)
63 63
 {
64
-	if(strpos($v,'[+MGR_DIR+]')!==false)
64
+	if (strpos($v, '[+MGR_DIR+]') !== false)
65 65
 		$_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v);
66 66
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,15 +37,18 @@  discard block
 block discarded – undo
37 37
  "sv" => "svenska"
38 38
 );
39 39
 $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
40
-if (!empty($_langFiles[$_langISO6391]))  $install_language = $_langFiles[$_langISO6391];
40
+if (!empty($_langFiles[$_langISO6391])) {
41
+    $install_language = $_langFiles[$_langISO6391];
42
+}
41 43
 
42 44
 
43 45
 if (isset($_POST['language']) && !stristr($_POST['language'],"..")) {
44 46
 	$install_language = $_POST['language'];
45 47
 } else {
46
-	if (isset($_GET['language']) && !stristr($_GET['language'],".."))
47
-		$install_language = $_GET['language'];
48
-}
48
+	if (isset($_GET['language']) && !stristr($_GET['language'],"..")) {
49
+			$install_language = $_GET['language'];
50
+	}
51
+	}
49 52
 # load language file
50 53
 require_once("lang/english.inc.php"); // As fallback
51 54
 require_once("lang/".$install_language.".inc.php");
@@ -55,12 +58,13 @@  discard block
 block discarded – undo
55 58
 if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) {
56 59
 	$manager_language = $_POST['managerlanguage'];
57 60
 } else {
58
-	if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],".."))
59
-		$manager_language = $_GET['managerlanguage'];
60
-}
61
+	if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) {
62
+			$manager_language = $_GET['managerlanguage'];
63
+	}
64
+	}
61 65
 
62
-foreach($_lang as $k=>$v)
63
-{
64
-	if(strpos($v,'[+MGR_DIR+]')!==false)
65
-		$_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v);
66
-}
66
+foreach($_lang as $k=>$v) {
67
+	if(strpos($v,'[+MGR_DIR+]')!==false) {
68
+			$_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v);
69
+	}
70
+	}
Please login to merge, or discard this patch.
install/sqlParser.class.php 3 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -4,138 +4,138 @@
 block discarded – undo
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
 
30
-	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
-		$this->host = $host;
32
-		$this->dbname = $db;
33
-		$this->prefix = $prefix;
34
-		$this->user = $user;
35
-		$this->password = $password;
36
-		$this->adminpass = $adminpass;
37
-		$this->adminname = $adminname;
38
-		$this->adminemail = $adminemail;
39
-		$this->connection_charset = $connection_charset;
40
-		$this->connection_method = $connection_method;
41
-		$this->ignoreDuplicateErrors = false;
42
-		$this->managerlanguage = $managerlanguage;
30
+    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
+        $this->host = $host;
32
+        $this->dbname = $db;
33
+        $this->prefix = $prefix;
34
+        $this->user = $user;
35
+        $this->password = $password;
36
+        $this->adminpass = $adminpass;
37
+        $this->adminname = $adminname;
38
+        $this->adminemail = $adminemail;
39
+        $this->connection_charset = $connection_charset;
40
+        $this->connection_method = $connection_method;
41
+        $this->ignoreDuplicateErrors = false;
42
+        $this->managerlanguage = $managerlanguage;
43 43
         $this->autoTemplateLogic = $auto_template_logic;
44
-	}
44
+    }
45 45
 
46
-	public function connect() {
47
-		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
48
-		mysqli_select_db($this->conn, $this->dbname);
49
-		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
46
+    public function connect() {
47
+        $this->conn = mysqli_connect($this->host, $this->user, $this->password);
48
+        mysqli_select_db($this->conn, $this->dbname);
49
+        if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
50 50
 
51
-		$this->dbVersion = 3.23; // assume version 3.23
52
-		if(function_exists("mysqli_get_server_info")) {
53
-			$ver = mysqli_get_server_info($this->conn);
54
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
55
-			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
56
-		}
51
+        $this->dbVersion = 3.23; // assume version 3.23
52
+        if(function_exists("mysqli_get_server_info")) {
53
+            $ver = mysqli_get_server_info($this->conn);
54
+            $this->dbMODx 	 = version_compare($ver,"4.0.2");
55
+            $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
56
+        }
57 57
 
58 58
         mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
59
-	}
59
+    }
60 60
 
61 61
     public function process($filename) {
62
-	    global $custom_placeholders;
63
-
64
-		// check to make sure file exists
65
-		if (!file_exists($filename)) {
66
-			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
67
-			$this->installFailed = true ;
68
-			return false;
69
-		}
70
-
71
-		$fh = fopen($filename, 'r');
72
-		$idata = '';
73
-
74
-		while (!feof($fh)) {
75
-			$idata .= fread($fh, 1024);
76
-		}
77
-
78
-		fclose($fh);
79
-		$idata = str_replace("\r", '', $idata);
80
-
81
-		// check if in upgrade mode
82
-		if ($this->mode=="upd") {
83
-			// remove non-upgradeable parts
84
-			$s = strpos($idata,"non-upgrade-able[[");
85
-			$e = strpos($idata,"]]non-upgrade-able")+17;
86
-			if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
87
-		}
88
-
89
-		// replace {} tags
90
-		$idata = str_replace('{PREFIX}', $this->prefix, $idata);
91
-		$idata = str_replace('{ADMIN}', $this->adminname, $idata);
92
-		$idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata);
93
-		$idata = str_replace('{ADMINPASS}', $this->adminpass, $idata);
94
-		$idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata);
95
-		$idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata);
96
-		$idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata);
97
-		$idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata);
98
-		$idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata);
99
-		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
100
-
101
-		// Replace custom placeholders
102
-		foreach($custom_placeholders as $key=>$val) {
103
-			if (strpos($idata, '{'.$key.'}') !== false) {
104
-				$idata = str_replace('{'.$key.'}', $val, $idata);
105
-			}
106
-		}
107
-
108
-		$sql_array = explode("\n\n", $idata);
109
-
110
-		$num = 0;
111
-		foreach($sql_array as $sql_entry) {
112
-			$sql_do = trim($sql_entry, "\r\n; ");
113
-
114
-			if (preg_match('/^\#/', $sql_do)) continue;
115
-
116
-			// strip out comments and \n for mysql 3.x
117
-			if ($this->dbVersion <4.0) {
118
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
119
-				$sql_do = str_replace('\r', "", $sql_do);
120
-				$sql_do = str_replace('\n', "", $sql_do);
121
-			}
122
-
123
-
124
-			$num = $num + 1;
125
-			if ($sql_do) mysqli_query($this->conn, $sql_do);
126
-			if(mysqli_error($this->conn)) {
127
-				// Ignore duplicate and drop errors - Raymond
128
-				if ($this->ignoreDuplicateErrors){
129
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
130
-				}
131
-				// End Ignore duplicate
132
-				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
133
-				$this->installFailed = true;
134
-			}
135
-		}
136
-	}
62
+        global $custom_placeholders;
63
+
64
+        // check to make sure file exists
65
+        if (!file_exists($filename)) {
66
+            $this->mysqlErrors[] = array("error" => "File '$filename' not found");
67
+            $this->installFailed = true ;
68
+            return false;
69
+        }
70
+
71
+        $fh = fopen($filename, 'r');
72
+        $idata = '';
73
+
74
+        while (!feof($fh)) {
75
+            $idata .= fread($fh, 1024);
76
+        }
77
+
78
+        fclose($fh);
79
+        $idata = str_replace("\r", '', $idata);
80
+
81
+        // check if in upgrade mode
82
+        if ($this->mode=="upd") {
83
+            // remove non-upgradeable parts
84
+            $s = strpos($idata,"non-upgrade-able[[");
85
+            $e = strpos($idata,"]]non-upgrade-able")+17;
86
+            if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
87
+        }
88
+
89
+        // replace {} tags
90
+        $idata = str_replace('{PREFIX}', $this->prefix, $idata);
91
+        $idata = str_replace('{ADMIN}', $this->adminname, $idata);
92
+        $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata);
93
+        $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata);
94
+        $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata);
95
+        $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata);
96
+        $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata);
97
+        $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata);
98
+        $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata);
99
+        /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
100
+
101
+        // Replace custom placeholders
102
+        foreach($custom_placeholders as $key=>$val) {
103
+            if (strpos($idata, '{'.$key.'}') !== false) {
104
+                $idata = str_replace('{'.$key.'}', $val, $idata);
105
+            }
106
+        }
107
+
108
+        $sql_array = explode("\n\n", $idata);
109
+
110
+        $num = 0;
111
+        foreach($sql_array as $sql_entry) {
112
+            $sql_do = trim($sql_entry, "\r\n; ");
113
+
114
+            if (preg_match('/^\#/', $sql_do)) continue;
115
+
116
+            // strip out comments and \n for mysql 3.x
117
+            if ($this->dbVersion <4.0) {
118
+                $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
119
+                $sql_do = str_replace('\r', "", $sql_do);
120
+                $sql_do = str_replace('\n', "", $sql_do);
121
+            }
122
+
123
+
124
+            $num = $num + 1;
125
+            if ($sql_do) mysqli_query($this->conn, $sql_do);
126
+            if(mysqli_error($this->conn)) {
127
+                // Ignore duplicate and drop errors - Raymond
128
+                if ($this->ignoreDuplicateErrors){
129
+                    if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
130
+                }
131
+                // End Ignore duplicate
132
+                $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
133
+                $this->installFailed = true;
134
+            }
135
+        }
136
+    }
137 137
 
138 138
     public function close() {
139
-		mysqli_close($this->conn);
140
-	}
139
+        mysqli_close($this->conn);
140
+    }
141 141
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public $connection_method;
28 28
     public $ignoreDuplicateErrors;
29 29
 
30
-	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') {
30
+	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 31
 		$this->host = $host;
32 32
 		$this->dbname = $db;
33 33
 		$this->prefix = $prefix;
@@ -43,28 +43,28 @@  discard block
 block discarded – undo
43 43
         $this->autoTemplateLogic = $auto_template_logic;
44 44
 	}
45 45
 
46
-	public function connect() {
46
+	public function connect(){
47 47
 		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
48 48
 		mysqli_select_db($this->conn, $this->dbname);
49 49
 		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
50 50
 
51 51
 		$this->dbVersion = 3.23; // assume version 3.23
52
-		if(function_exists("mysqli_get_server_info")) {
52
+		if (function_exists("mysqli_get_server_info")) {
53 53
 			$ver = mysqli_get_server_info($this->conn);
54
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
54
+			$this->dbMODx 	 = version_compare($ver, "4.0.2");
55 55
 			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
56 56
 		}
57 57
 
58
-        mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
58
+        mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}");
59 59
 	}
60 60
 
61
-    public function process($filename) {
61
+    public function process($filename){
62 62
 	    global $custom_placeholders;
63 63
 
64 64
 		// check to make sure file exists
65 65
 		if (!file_exists($filename)) {
66 66
 			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
67
-			$this->installFailed = true ;
67
+			$this->installFailed = true;
68 68
 			return false;
69 69
 		}
70 70
 
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		$idata = str_replace("\r", '', $idata);
80 80
 
81 81
 		// check if in upgrade mode
82
-		if ($this->mode=="upd") {
82
+		if ($this->mode == "upd") {
83 83
 			// remove non-upgradeable parts
84
-			$s = strpos($idata,"non-upgrade-able[[");
85
-			$e = strpos($idata,"]]non-upgrade-able")+17;
86
-			if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
84
+			$s = strpos($idata, "non-upgrade-able[[");
85
+			$e = strpos($idata, "]]non-upgrade-able") + 17;
86
+			if ($s && $e) $idata = str_replace(substr($idata, $s, $e - $s), " Removed non upgradeable items", $idata);
87 87
 		}
88 88
 
89 89
 		// replace {} tags
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
100 100
 
101 101
 		// Replace custom placeholders
102
-		foreach($custom_placeholders as $key=>$val) {
102
+		foreach ($custom_placeholders as $key=>$val) {
103 103
 			if (strpos($idata, '{'.$key.'}') !== false) {
104 104
 				$idata = str_replace('{'.$key.'}', $val, $idata);
105 105
 			}
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 		$sql_array = explode("\n\n", $idata);
109 109
 
110 110
 		$num = 0;
111
-		foreach($sql_array as $sql_entry) {
111
+		foreach ($sql_array as $sql_entry) {
112 112
 			$sql_do = trim($sql_entry, "\r\n; ");
113 113
 
114 114
 			if (preg_match('/^\#/', $sql_do)) continue;
115 115
 
116 116
 			// strip out comments and \n for mysql 3.x
117
-			if ($this->dbVersion <4.0) {
118
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
117
+			if ($this->dbVersion < 4.0) {
118
+				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do);
119 119
 				$sql_do = str_replace('\r', "", $sql_do);
120 120
 				$sql_do = str_replace('\n', "", $sql_do);
121 121
 			}
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 
124 124
 			$num = $num + 1;
125 125
 			if ($sql_do) mysqli_query($this->conn, $sql_do);
126
-			if(mysqli_error($this->conn)) {
126
+			if (mysqli_error($this->conn)) {
127 127
 				// Ignore duplicate and drop errors - Raymond
128
-				if ($this->ignoreDuplicateErrors){
129
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
128
+				if ($this->ignoreDuplicateErrors) {
129
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue;
130 130
 				}
131 131
 				// End Ignore duplicate
132 132
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		}
136 136
 	}
137 137
 
138
-    public function close() {
138
+    public function close(){
139 139
 		mysqli_close($this->conn);
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,7 +3,8 @@  discard block
 block discarded – undo
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;
@@ -27,7 +28,8 @@  discard block
 block discarded – undo
27 28
     public $connection_method;
28 29
     public $ignoreDuplicateErrors;
29 30
 
30
-	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
+	{
31 33
 		$this->host = $host;
32 34
 		$this->dbname = $db;
33 35
 		$this->prefix = $prefix;
@@ -43,10 +45,13 @@  discard block
 block discarded – undo
43 45
         $this->autoTemplateLogic = $auto_template_logic;
44 46
 	}
45 47
 
46
-	public function connect() {
48
+	public function connect()
49
+	{
47 50
 		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
48 51
 		mysqli_select_db($this->conn, $this->dbname);
49
-		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
52
+		if (function_exists('mysqli_set_charset')) {
53
+		    mysqli_set_charset($this->conn, $this->connection_charset);
54
+		}
50 55
 
51 56
 		$this->dbVersion = 3.23; // assume version 3.23
52 57
 		if(function_exists("mysqli_get_server_info")) {
@@ -58,7 +63,8 @@  discard block
 block discarded – undo
58 63
         mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
59 64
 	}
60 65
 
61
-    public function process($filename) {
66
+    public function process($filename)
67
+    {
62 68
 	    global $custom_placeholders;
63 69
 
64 70
 		// check to make sure file exists
@@ -83,7 +89,9 @@  discard block
 block discarded – undo
83 89
 			// remove non-upgradeable parts
84 90
 			$s = strpos($idata,"non-upgrade-able[[");
85 91
 			$e = strpos($idata,"]]non-upgrade-able")+17;
86
-			if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
92
+			if($s && $e) {
93
+			    $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
94
+			}
87 95
 		}
88 96
 
89 97
 		// replace {} tags
@@ -111,7 +119,9 @@  discard block
 block discarded – undo
111 119
 		foreach($sql_array as $sql_entry) {
112 120
 			$sql_do = trim($sql_entry, "\r\n; ");
113 121
 
114
-			if (preg_match('/^\#/', $sql_do)) continue;
122
+			if (preg_match('/^\#/', $sql_do)) {
123
+			    continue;
124
+			}
115 125
 
116 126
 			// strip out comments and \n for mysql 3.x
117 127
 			if ($this->dbVersion <4.0) {
@@ -122,11 +132,15 @@  discard block
 block discarded – undo
122 132
 
123 133
 
124 134
 			$num = $num + 1;
125
-			if ($sql_do) mysqli_query($this->conn, $sql_do);
135
+			if ($sql_do) {
136
+			    mysqli_query($this->conn, $sql_do);
137
+			}
126 138
 			if(mysqli_error($this->conn)) {
127 139
 				// Ignore duplicate and drop errors - Raymond
128
-				if ($this->ignoreDuplicateErrors){
129
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
140
+				if ($this->ignoreDuplicateErrors) {
141
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) {
142
+					    continue;
143
+					}
130 144
 				}
131 145
 				// End Ignore duplicate
132 146
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -135,7 +149,8 @@  discard block
 block discarded – undo
135 149
 		}
136 150
 	}
137 151
 
138
-    public function close() {
152
+    public function close()
153
+    {
139 154
 		mysqli_close($this->conn);
140 155
 	}
141 156
 }
Please login to merge, or discard this patch.