Completed
Pull Request — develop (#518)
by Agel_Nash
05:20
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/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.
install/sqlParser.class.php 1 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.