Completed
Pull Request — release-2.1 (#4892)
by Mathias
13:10 queued 03:24
created
Sources/Profile-Actions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
 	{
985 985
 		loadMemberData($memID, false, 'profile');
986 986
 		$profile = $user_profile[$memID];
987
-		$removeFields = array('secret_question','tfa_secret','password_salt');
987
+		$removeFields = array('secret_question', 'tfa_secret', 'password_salt');
988 988
 		foreach ($removeFields as $value)
989 989
 		{
990 990
 			unset($profile[$value]);
991 991
 		}
992
-		foreach($profile as $key => &$value)
992
+		foreach ($profile as $key => &$value)
993 993
 		{
994 994
 			if (is_array($value))
995 995
 				$value = $smcFunc['json_encode']($value);
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	elseif ($mode == 'messages') // messages
1002 1002
 	{
1003 1003
 		
1004
-		$request = $smcFunc['db_query']('','
1004
+		$request = $smcFunc['db_query']('', '
1005 1005
 			SELECT id_msg, id_topic, poster_time, subject, modified_time, modified_name, modified_reason, body, likes, poster_ip
1006 1006
 			FROM {db_prefix}messages 
1007 1007
 			WHERE id_member = {int:memID}',
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	}
1018 1018
 	else
1019 1019
 	{
1020
-		$profileData = $smcFunc['db_query']('','
1020
+		$profileData = $smcFunc['db_query']('', '
1021 1021
 			SELECT pm.msgtime, pm.subject, pm.body
1022 1022
 			FROM {db_prefix}personal_messages pm
1023 1023
 			LEFT JOIN {db_prefix}pm_recipients pmr on (pm.id_pm = pmr.id_pm and pmr.id_member = {int:memID})
@@ -1033,14 +1033,14 @@  discard block
 block discarded – undo
1033 1033
 	}
1034 1034
 	$count = count($profileData);
1035 1035
 	$csv_data = '';
1036
-	for($i = 0; $i < $count; $i++)
1036
+	for ($i = 0; $i < $count; $i++)
1037 1037
 	{
1038 1038
 		$csv_data .= arrayToCsv($profileData[$i]) . "\r\n";
1039 1039
 	}
1040 1040
 
1041 1041
 
1042 1042
 	header("Pragma: no-cache");
1043
-	header('Content-Disposition: attachment; filename="privacySMF'.$mode.'.csv";');
1043
+	header('Content-Disposition: attachment; filename="privacySMF' . $mode . '.csv";');
1044 1044
 	header("Content-Length: " . strlen($csv_data));
1045 1045
 	header("Content-Transfer-Encoding: binary");
1046 1046
 	header("Content-Type: application/force-download");
@@ -1059,12 +1059,12 @@  discard block
 block discarded – undo
1059 1059
  * @param boolean $encloseAll enclose all
1060 1060
  * @param boolean $nullToMysqlNull
1061 1061
   */
1062
-function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) {
1062
+function arrayToCsv(array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false) {
1063 1063
 	$delimiter_esc = preg_quote($delimiter, '/');
1064 1064
 	$enclosure_esc = preg_quote($enclosure, '/');
1065 1065
 
1066 1066
 	$output = array();
1067
-	foreach ( $fields as $field )
1067
+	foreach ($fields as $field)
1068 1068
 	{
1069 1069
 		if ($field === null && $nullToMysqlNull)
1070 1070
 		{
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 		}
1074 1074
 
1075 1075
 		// Enclose fields containing $delimiter, $enclosure or whitespace
1076
-		if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) )
1076
+		if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field))
1077 1077
 		{
1078 1078
 			$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
1079 1079
 		}
@@ -1083,6 +1083,6 @@  discard block
 block discarded – undo
1083 1083
 		}
1084 1084
 	}
1085 1085
 
1086
-	return implode( $delimiter, $output );
1086
+	return implode($delimiter, $output);
1087 1087
 }
1088 1088
 ?>
1089 1089
\ No newline at end of file
Please login to merge, or discard this patch.