Completed
Pull Request — release-2.1 (#4892)
by Mathias
08:24
created
Sources/Profile-Actions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -992,12 +992,12 @@  discard block
 block discarded – undo
992 992
 	{
993 993
 		loadMemberData($memID, false, 'profile');
994 994
 		$profile = $user_profile[$memID];
995
-		$removeFields = array('secret_question','tfa_secret','password_salt');
995
+		$removeFields = array('secret_question', 'tfa_secret', 'password_salt');
996 996
 		foreach ($removeFields as $value)
997 997
 		{
998 998
 			unset($profile[$value]);
999 999
 		}
1000
-		foreach($profile as $key => &$value)
1000
+		foreach ($profile as $key => &$value)
1001 1001
 		{
1002 1002
 			if (is_array($value))
1003 1003
 				$value = $smcFunc['json_encode']($value);
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	elseif ($mode == 'messages') // messages
1010 1010
 	{
1011 1011
 		
1012
-		$request = $smcFunc['db_query']('','
1012
+		$request = $smcFunc['db_query']('', '
1013 1013
 			SELECT id_msg, id_topic, poster_time, subject, modified_time, modified_name, modified_reason, body, likes, poster_ip
1014 1014
 			FROM {db_prefix}messages 
1015 1015
 			WHERE id_member = {int:memID}',
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	}
1028 1028
 	elseif ($mode == 'pmessages')
1029 1029
 	{
1030
-		$request = $smcFunc['db_query']('','
1030
+		$request = $smcFunc['db_query']('', '
1031 1031
 			SELECT pm.msgtime, pm.subject, pm.body
1032 1032
 			FROM {db_prefix}personal_messages pm
1033 1033
 			LEFT JOIN {db_prefix}pm_recipients pmr on (pm.id_pm = pmr.id_pm and pmr.id_member = {int:memID})
@@ -1045,14 +1045,14 @@  discard block
 block discarded – undo
1045 1045
 	}
1046 1046
 	$count = count($profileData);
1047 1047
 	$csv_data = '';
1048
-	for($i = 0; $i < $count; $i++)
1048
+	for ($i = 0; $i < $count; $i++)
1049 1049
 	{
1050 1050
 		$csv_data .= arrayToCsv($profileData[$i]) . "\r\n";
1051 1051
 	}
1052 1052
 
1053 1053
 
1054 1054
 	header("Pragma: no-cache");
1055
-	header('Content-Disposition: attachment; filename="privacySMF'.$mode.'.csv";');
1055
+	header('Content-Disposition: attachment; filename="privacySMF' . $mode . '.csv";');
1056 1056
 	header("Content-Length: " . strlen($csv_data));
1057 1057
 	header("Content-Transfer-Encoding: binary");
1058 1058
 	header("Content-Type: application/force-download");
@@ -1071,12 +1071,12 @@  discard block
 block discarded – undo
1071 1071
  * @param boolean $encloseAll enclose all
1072 1072
  * @param boolean $nullToMysqlNull
1073 1073
   */
1074
-function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) {
1074
+function arrayToCsv(array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false) {
1075 1075
 	$delimiter_esc = preg_quote($delimiter, '/');
1076 1076
 	$enclosure_esc = preg_quote($enclosure, '/');
1077 1077
 
1078 1078
 	$output = array();
1079
-	foreach ( $fields as $field )
1079
+	foreach ($fields as $field)
1080 1080
 	{
1081 1081
 		if ($field === null && $nullToMysqlNull)
1082 1082
 		{
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 		}
1086 1086
 
1087 1087
 		// Enclose fields containing $delimiter, $enclosure or whitespace
1088
-		if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) )
1088
+		if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field))
1089 1089
 		{
1090 1090
 			$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
1091 1091
 		}
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		}
1096 1096
 	}
1097 1097
 
1098
-	return implode( $delimiter, $output );
1098
+	return implode($delimiter, $output);
1099 1099
 }
1100 1100
 
1101 1101
 ?>
1102 1102
\ No newline at end of file
Please login to merge, or discard this patch.