Completed
Pull Request — develop (#518)
by Agel_Nash
06:14
created
manager/media/browser/mcpuk/core/autoload.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $modx = new DocumentParser;
27 27
 $modx->db->connect();
28 28
 startCMSSession();
29
-if(!isset($_SESSION['mgrValidated'])) {
29
+if (!isset($_SESSION['mgrValidated'])) {
30 30
         die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
31 31
 }
32 32
 define('IN_MANAGER_MODE', "true");
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 $manager_language = $modx->config['manager_language'];
36 36
 // Pass language code from MODX to KCFinder
37
-if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) {
37
+if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) {
38 38
     $manager_language = "english"; // if not set, get the english language file.
39 39
 }
40 40
 include_once "../../../includes/lang/".$manager_language.".inc.php";
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 // PHP VERSION CHECK
44 44
 if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5)
45
-    die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");
45
+    die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");
46 46
 
47 47
 
48 48
 // SAFE MODE CHECK
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 
53 53
 // MAGIC AUTOLOAD CLASSES FUNCTION
54
-function autoloadda9d06472ccb71b84928677ce2a6ca89($class) {
54
+function autoloadda9d06472ccb71b84928677ce2a6ca89($class){
55 55
     static $classes = null;
56 56
     if ($classes === null) {
57 57
         $classes = array(
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         );
76 76
     }
77 77
     if (isset($classes[$class])) {
78
-        require dirname(__FILE__) . $classes[$class];
78
+        require dirname(__FILE__).$classes[$class];
79 79
     }
80 80
 }
81 81
 spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true);
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING
85 85
 if (!function_exists("json_encode")) {
86 86
 
87
-    function kcfinder_json_string_encode($string) {
88
-        return '"' .
87
+    function kcfinder_json_string_encode($string){
88
+        return '"'.
89 89
             str_replace('/', "\\/",
90 90
             str_replace("\t", "\\t",
91 91
             str_replace("\r", "\\r",
92 92
             str_replace("\n", "\\n",
93 93
             str_replace('"', "\\\"",
94 94
             str_replace("\\", "\\\\",
95
-        $string)))))) . '"';
95
+        $string)))))).'"';
96 96
     }
97 97
 
98
-    function json_encode($data) {
98
+    function json_encode($data){
99 99
 
100 100
         if (is_array($data)) {
101 101
             $ret = array();
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
             // OBJECT
104 104
             if (array_keys($data) !== range(0, count($data) - 1)) {
105 105
                 foreach ($data as $key => $val)
106
-                    $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val);
107
-                return "{" . implode(",", $ret) . "}";
106
+                    $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val);
107
+                return "{".implode(",", $ret)."}";
108 108
 
109 109
             // ARRAY
110 110
             } else {
111 111
                 foreach ($data as $val)
112 112
                     $ret[] = json_encode($val);
113
-                return "[" . implode(",", $ret) . "]";
113
+                return "[".implode(",", $ret)."]";
114 114
             }
115 115
 
116 116
         // BOOLEAN OR NULL
Please login to merge, or discard this patch.
install/sqlParser.class.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  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
 	var $host, $dbname, $prefix, $user, $password, $mysqlErrors;
8 8
 	var $conn, $installFailed, $sitename, $adminname, $adminemail, $adminpass, $managerlanguage;
9 9
 	var $mode, $fileManagerPath, $imgPath, $imgUrl;
10 10
 	var $dbMODx, $dbVersion;
11 11
     var $connection_charset, $connection_method;
12 12
 
13
-	function SqlParser($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') {
13
+	function SqlParser($host, $user, $password, $db, $prefix = 'modx_', $adminname, $adminemail, $adminpass, $connection_charset = 'utf8', $managerlanguage = 'english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent'){
14 14
 		$this->host = $host;
15 15
 		$this->dbname = $db;
16 16
 		$this->prefix = $prefix;
@@ -26,28 +26,28 @@  discard block
 block discarded – undo
26 26
         $this->autoTemplateLogic = $auto_template_logic;
27 27
 	}
28 28
 
29
-	function connect() {
29
+	function connect(){
30 30
 		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
31 31
 		mysqli_select_db($this->conn, $this->dbname);
32 32
 		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
33 33
 
34 34
 		$this->dbVersion = 3.23; // assume version 3.23
35
-		if(function_exists("mysqli_get_server_info")) {
35
+		if (function_exists("mysqli_get_server_info")) {
36 36
 			$ver = mysqli_get_server_info($this->conn);
37
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
37
+			$this->dbMODx 	 = version_compare($ver, "4.0.2");
38 38
 			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
39 39
 		}
40 40
 
41
-        mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
41
+        mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}");
42 42
 	}
43 43
 
44
-	function process($filename) {
44
+	function process($filename){
45 45
 	    global $custom_placeholders;
46 46
 
47 47
 		// check to make sure file exists
48 48
 		if (!file_exists($filename)) {
49 49
 			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
50
-			$this->installFailed = true ;
50
+			$this->installFailed = true;
51 51
 			return false;
52 52
 		}
53 53
 
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		$idata = str_replace("\r", '', $idata);
63 63
 
64 64
 		// check if in upgrade mode
65
-		if ($this->mode=="upd") {
65
+		if ($this->mode == "upd") {
66 66
 			// remove non-upgradeable parts
67
-			$s = strpos($idata,"non-upgrade-able[[");
68
-			$e = strpos($idata,"]]non-upgrade-able")+17;
69
-			if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata);
67
+			$s = strpos($idata, "non-upgrade-able[[");
68
+			$e = strpos($idata, "]]non-upgrade-able") + 17;
69
+			if ($s && $e) $idata = str_replace(substr($idata, $s, $e - $s), " Removed non upgradeable items", $idata);
70 70
 		}
71 71
 
72 72
 		// replace {} tags
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
83 83
 
84 84
 		// Replace custom placeholders
85
-		foreach($custom_placeholders as $key=>$val) {
85
+		foreach ($custom_placeholders as $key=>$val) {
86 86
 			if (strpos($idata, '{'.$key.'}') !== false) {
87 87
 				$idata = str_replace('{'.$key.'}', $val, $idata);
88 88
 			}
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		$sql_array = explode("\n\n", $idata);
92 92
 
93 93
 		$num = 0;
94
-		foreach($sql_array as $sql_entry) {
94
+		foreach ($sql_array as $sql_entry) {
95 95
 			$sql_do = trim($sql_entry, "\r\n; ");
96 96
 
97 97
 			if (preg_match('/^\#/', $sql_do)) continue;
98 98
 
99 99
 			// strip out comments and \n for mysql 3.x
100
-			if ($this->dbVersion <4.0) {
101
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
100
+			if ($this->dbVersion < 4.0) {
101
+				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do);
102 102
 				$sql_do = str_replace('\r', "", $sql_do);
103 103
 				$sql_do = str_replace('\n', "", $sql_do);
104 104
 			}
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 
107 107
 			$num = $num + 1;
108 108
 			if ($sql_do) mysqli_query($this->conn, $sql_do);
109
-			if(mysqli_error($this->conn)) {
109
+			if (mysqli_error($this->conn)) {
110 110
 				// Ignore duplicate and drop errors - Raymond
111
-				if ($this->ignoreDuplicateErrors){
112
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
111
+				if ($this->ignoreDuplicateErrors) {
112
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue;
113 113
 				}
114 114
 				// End Ignore duplicate
115 115
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		}
119 119
 	}
120 120
 
121
-	function close() {
121
+	function close(){
122 122
 		mysqli_close($this->conn);
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
install/lang.php 1 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.