Completed
Pull Request — release-2.1 (#3761)
by Rick
07:11
created
other/upgrade.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -3122,94 +3122,94 @@
 block discarded – undo
3122 3122
 		// Translation table for the character sets not native for MySQL.
3123 3123
 		$translation_tables = array(
3124 3124
 			'windows-1255' => array(
3125
-				'0x81' => '\'\'',		'0x8A' => '\'\'',		'0x8C' => '\'\'',
3126
-				'0x8D' => '\'\'',		'0x8E' => '\'\'',		'0x8F' => '\'\'',
3127
-				'0x90' => '\'\'',		'0x9A' => '\'\'',		'0x9C' => '\'\'',
3128
-				'0x9D' => '\'\'',		'0x9E' => '\'\'',		'0x9F' => '\'\'',
3129
-				'0xCA' => '\'\'',		'0xD9' => '\'\'',		'0xDA' => '\'\'',
3130
-				'0xDB' => '\'\'',		'0xDC' => '\'\'',		'0xDD' => '\'\'',
3131
-				'0xDE' => '\'\'',		'0xDF' => '\'\'',		'0xFB' => '0xD792',
3132
-				'0xFC' => '0xE282AC',		'0xFF' => '0xD6B2',		'0xC2' => '0xFF',
3133
-				'0x80' => '0xFC',		'0xE2' => '0xFB',		'0xA0' => '0xC2A0',
3134
-				'0xA1' => '0xC2A1',		'0xA2' => '0xC2A2',		'0xA3' => '0xC2A3',
3135
-				'0xA5' => '0xC2A5',		'0xA6' => '0xC2A6',		'0xA7' => '0xC2A7',
3136
-				'0xA8' => '0xC2A8',		'0xA9' => '0xC2A9',		'0xAB' => '0xC2AB',
3137
-				'0xAC' => '0xC2AC',		'0xAD' => '0xC2AD',		'0xAE' => '0xC2AE',
3138
-				'0xAF' => '0xC2AF',		'0xB0' => '0xC2B0',		'0xB1' => '0xC2B1',
3139
-				'0xB2' => '0xC2B2',		'0xB3' => '0xC2B3',		'0xB4' => '0xC2B4',
3140
-				'0xB5' => '0xC2B5',		'0xB6' => '0xC2B6',		'0xB7' => '0xC2B7',
3141
-				'0xB8' => '0xC2B8',		'0xB9' => '0xC2B9',		'0xBB' => '0xC2BB',
3142
-				'0xBC' => '0xC2BC',		'0xBD' => '0xC2BD',		'0xBE' => '0xC2BE',
3143
-				'0xBF' => '0xC2BF',		'0xD7' => '0xD7B3',		'0xD1' => '0xD781',
3144
-				'0xD4' => '0xD7B0',		'0xD5' => '0xD7B1',		'0xD6' => '0xD7B2',
3145
-				'0xE0' => '0xD790',		'0xEA' => '0xD79A',		'0xEC' => '0xD79C',
3146
-				'0xED' => '0xD79D',		'0xEE' => '0xD79E',		'0xEF' => '0xD79F',
3147
-				'0xF0' => '0xD7A0',		'0xF1' => '0xD7A1',		'0xF2' => '0xD7A2',
3148
-				'0xF3' => '0xD7A3',		'0xF5' => '0xD7A5',		'0xF6' => '0xD7A6',
3149
-				'0xF7' => '0xD7A7',		'0xF8' => '0xD7A8',		'0xF9' => '0xD7A9',
3150
-				'0x82' => '0xE2809A',	'0x84' => '0xE2809E',	'0x85' => '0xE280A6',
3151
-				'0x86' => '0xE280A0',	'0x87' => '0xE280A1',	'0x89' => '0xE280B0',
3152
-				'0x8B' => '0xE280B9',	'0x93' => '0xE2809C',	'0x94' => '0xE2809D',
3153
-				'0x95' => '0xE280A2',	'0x97' => '0xE28094',	'0x99' => '0xE284A2',
3154
-				'0xC0' => '0xD6B0',		'0xC1' => '0xD6B1',		'0xC3' => '0xD6B3',
3155
-				'0xC4' => '0xD6B4',		'0xC5' => '0xD6B5',		'0xC6' => '0xD6B6',
3156
-				'0xC7' => '0xD6B7',		'0xC8' => '0xD6B8',		'0xC9' => '0xD6B9',
3157
-				'0xCB' => '0xD6BB',		'0xCC' => '0xD6BC',		'0xCD' => '0xD6BD',
3158
-				'0xCE' => '0xD6BE',		'0xCF' => '0xD6BF',		'0xD0' => '0xD780',
3159
-				'0xD2' => '0xD782',		'0xE3' => '0xD793',		'0xE4' => '0xD794',
3160
-				'0xE5' => '0xD795',		'0xE7' => '0xD797',		'0xE9' => '0xD799',
3161
-				'0xFD' => '0xE2808E',	'0xFE' => '0xE2808F',	'0x92' => '0xE28099',
3162
-				'0x83' => '0xC692',		'0xD3' => '0xD783',		'0x88' => '0xCB86',
3163
-				'0x98' => '0xCB9C',		'0x91' => '0xE28098',	'0x96' => '0xE28093',
3164
-				'0xBA' => '0xC3B7',		'0x9B' => '0xE280BA',	'0xAA' => '0xC397',
3165
-				'0xA4' => '0xE282AA',	'0xE1' => '0xD791',		'0xE6' => '0xD796',
3166
-				'0xE8' => '0xD798',		'0xEB' => '0xD79B',		'0xF4' => '0xD7A4',
3125
+				'0x81' => '\'\'', '0x8A' => '\'\'', '0x8C' => '\'\'',
3126
+				'0x8D' => '\'\'', '0x8E' => '\'\'', '0x8F' => '\'\'',
3127
+				'0x90' => '\'\'', '0x9A' => '\'\'', '0x9C' => '\'\'',
3128
+				'0x9D' => '\'\'', '0x9E' => '\'\'', '0x9F' => '\'\'',
3129
+				'0xCA' => '\'\'', '0xD9' => '\'\'', '0xDA' => '\'\'',
3130
+				'0xDB' => '\'\'', '0xDC' => '\'\'', '0xDD' => '\'\'',
3131
+				'0xDE' => '\'\'', '0xDF' => '\'\'', '0xFB' => '0xD792',
3132
+				'0xFC' => '0xE282AC', '0xFF' => '0xD6B2', '0xC2' => '0xFF',
3133
+				'0x80' => '0xFC', '0xE2' => '0xFB', '0xA0' => '0xC2A0',
3134
+				'0xA1' => '0xC2A1', '0xA2' => '0xC2A2', '0xA3' => '0xC2A3',
3135
+				'0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7',
3136
+				'0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB',
3137
+				'0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE',
3138
+				'0xAF' => '0xC2AF', '0xB0' => '0xC2B0', '0xB1' => '0xC2B1',
3139
+				'0xB2' => '0xC2B2', '0xB3' => '0xC2B3', '0xB4' => '0xC2B4',
3140
+				'0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7',
3141
+				'0xB8' => '0xC2B8', '0xB9' => '0xC2B9', '0xBB' => '0xC2BB',
3142
+				'0xBC' => '0xC2BC', '0xBD' => '0xC2BD', '0xBE' => '0xC2BE',
3143
+				'0xBF' => '0xC2BF', '0xD7' => '0xD7B3', '0xD1' => '0xD781',
3144
+				'0xD4' => '0xD7B0', '0xD5' => '0xD7B1', '0xD6' => '0xD7B2',
3145
+				'0xE0' => '0xD790', '0xEA' => '0xD79A', '0xEC' => '0xD79C',
3146
+				'0xED' => '0xD79D', '0xEE' => '0xD79E', '0xEF' => '0xD79F',
3147
+				'0xF0' => '0xD7A0', '0xF1' => '0xD7A1', '0xF2' => '0xD7A2',
3148
+				'0xF3' => '0xD7A3', '0xF5' => '0xD7A5', '0xF6' => '0xD7A6',
3149
+				'0xF7' => '0xD7A7', '0xF8' => '0xD7A8', '0xF9' => '0xD7A9',
3150
+				'0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6',
3151
+				'0x86' => '0xE280A0', '0x87' => '0xE280A1', '0x89' => '0xE280B0',
3152
+				'0x8B' => '0xE280B9', '0x93' => '0xE2809C', '0x94' => '0xE2809D',
3153
+				'0x95' => '0xE280A2', '0x97' => '0xE28094', '0x99' => '0xE284A2',
3154
+				'0xC0' => '0xD6B0', '0xC1' => '0xD6B1', '0xC3' => '0xD6B3',
3155
+				'0xC4' => '0xD6B4', '0xC5' => '0xD6B5', '0xC6' => '0xD6B6',
3156
+				'0xC7' => '0xD6B7', '0xC8' => '0xD6B8', '0xC9' => '0xD6B9',
3157
+				'0xCB' => '0xD6BB', '0xCC' => '0xD6BC', '0xCD' => '0xD6BD',
3158
+				'0xCE' => '0xD6BE', '0xCF' => '0xD6BF', '0xD0' => '0xD780',
3159
+				'0xD2' => '0xD782', '0xE3' => '0xD793', '0xE4' => '0xD794',
3160
+				'0xE5' => '0xD795', '0xE7' => '0xD797', '0xE9' => '0xD799',
3161
+				'0xFD' => '0xE2808E', '0xFE' => '0xE2808F', '0x92' => '0xE28099',
3162
+				'0x83' => '0xC692', '0xD3' => '0xD783', '0x88' => '0xCB86',
3163
+				'0x98' => '0xCB9C', '0x91' => '0xE28098', '0x96' => '0xE28093',
3164
+				'0xBA' => '0xC3B7', '0x9B' => '0xE280BA', '0xAA' => '0xC397',
3165
+				'0xA4' => '0xE282AA', '0xE1' => '0xD791', '0xE6' => '0xD796',
3166
+				'0xE8' => '0xD798', '0xEB' => '0xD79B', '0xF4' => '0xD7A4',
3167 3167
 				'0xFA' => '0xD7AA',
3168 3168
 			),
3169 3169
 			'windows-1253' => array(
3170
-				'0x81' => '\'\'',			'0x88' => '\'\'',			'0x8A' => '\'\'',
3171
-				'0x8C' => '\'\'',			'0x8D' => '\'\'',			'0x8E' => '\'\'',
3172
-				'0x8F' => '\'\'',			'0x90' => '\'\'',			'0x98' => '\'\'',
3173
-				'0x9A' => '\'\'',			'0x9C' => '\'\'',			'0x9D' => '\'\'',
3174
-				'0x9E' => '\'\'',			'0x9F' => '\'\'',			'0xAA' => '\'\'',
3175
-				'0xD2' => '0xE282AC',			'0xFF' => '0xCE92',			'0xCE' => '0xCE9E',
3176
-				'0xB8' => '0xCE88',		'0xBA' => '0xCE8A',		'0xBC' => '0xCE8C',
3177
-				'0xBE' => '0xCE8E',		'0xBF' => '0xCE8F',		'0xC0' => '0xCE90',
3178
-				'0xC8' => '0xCE98',		'0xCA' => '0xCE9A',		'0xCC' => '0xCE9C',
3179
-				'0xCD' => '0xCE9D',		'0xCF' => '0xCE9F',		'0xDA' => '0xCEAA',
3180
-				'0xE8' => '0xCEB8',		'0xEA' => '0xCEBA',		'0xEC' => '0xCEBC',
3181
-				'0xEE' => '0xCEBE',		'0xEF' => '0xCEBF',		'0xC2' => '0xFF',
3182
-				'0xBD' => '0xC2BD',		'0xED' => '0xCEBD',		'0xB2' => '0xC2B2',
3183
-				'0xA0' => '0xC2A0',		'0xA3' => '0xC2A3',		'0xA4' => '0xC2A4',
3184
-				'0xA5' => '0xC2A5',		'0xA6' => '0xC2A6',		'0xA7' => '0xC2A7',
3185
-				'0xA8' => '0xC2A8',		'0xA9' => '0xC2A9',		'0xAB' => '0xC2AB',
3186
-				'0xAC' => '0xC2AC',		'0xAD' => '0xC2AD',		'0xAE' => '0xC2AE',
3187
-				'0xB0' => '0xC2B0',		'0xB1' => '0xC2B1',		'0xB3' => '0xC2B3',
3188
-				'0xB5' => '0xC2B5',		'0xB6' => '0xC2B6',		'0xB7' => '0xC2B7',
3189
-				'0xBB' => '0xC2BB',		'0xE2' => '0xCEB2',		'0x80' => '0xD2',
3190
-				'0x82' => '0xE2809A',	'0x84' => '0xE2809E',	'0x85' => '0xE280A6',
3191
-				'0x86' => '0xE280A0',	'0xA1' => '0xCE85',		'0xA2' => '0xCE86',
3192
-				'0x87' => '0xE280A1',	'0x89' => '0xE280B0',	'0xB9' => '0xCE89',
3193
-				'0x8B' => '0xE280B9',	'0x91' => '0xE28098',	'0x99' => '0xE284A2',
3194
-				'0x92' => '0xE28099',	'0x93' => '0xE2809C',	'0x94' => '0xE2809D',
3195
-				'0x95' => '0xE280A2',	'0x96' => '0xE28093',	'0x97' => '0xE28094',
3196
-				'0x9B' => '0xE280BA',	'0xAF' => '0xE28095',	'0xB4' => '0xCE84',
3197
-				'0xC1' => '0xCE91',		'0xC3' => '0xCE93',		'0xC4' => '0xCE94',
3198
-				'0xC5' => '0xCE95',		'0xC6' => '0xCE96',		'0x83' => '0xC692',
3199
-				'0xC7' => '0xCE97',		'0xC9' => '0xCE99',		'0xCB' => '0xCE9B',
3200
-				'0xD0' => '0xCEA0',		'0xD1' => '0xCEA1',		'0xD3' => '0xCEA3',
3201
-				'0xD4' => '0xCEA4',		'0xD5' => '0xCEA5',		'0xD6' => '0xCEA6',
3202
-				'0xD7' => '0xCEA7',		'0xD8' => '0xCEA8',		'0xD9' => '0xCEA9',
3203
-				'0xDB' => '0xCEAB',		'0xDC' => '0xCEAC',		'0xDD' => '0xCEAD',
3204
-				'0xDE' => '0xCEAE',		'0xDF' => '0xCEAF',		'0xE0' => '0xCEB0',
3205
-				'0xE1' => '0xCEB1',		'0xE3' => '0xCEB3',		'0xE4' => '0xCEB4',
3206
-				'0xE5' => '0xCEB5',		'0xE6' => '0xCEB6',		'0xE7' => '0xCEB7',
3207
-				'0xE9' => '0xCEB9',		'0xEB' => '0xCEBB',		'0xF0' => '0xCF80',
3208
-				'0xF1' => '0xCF81',		'0xF2' => '0xCF82',		'0xF3' => '0xCF83',
3209
-				'0xF4' => '0xCF84',		'0xF5' => '0xCF85',		'0xF6' => '0xCF86',
3210
-				'0xF7' => '0xCF87',		'0xF8' => '0xCF88',		'0xF9' => '0xCF89',
3211
-				'0xFA' => '0xCF8A',		'0xFB' => '0xCF8B',		'0xFC' => '0xCF8C',
3212
-				'0xFD' => '0xCF8D',		'0xFE' => '0xCF8E',
3170
+				'0x81' => '\'\'', '0x88' => '\'\'', '0x8A' => '\'\'',
3171
+				'0x8C' => '\'\'', '0x8D' => '\'\'', '0x8E' => '\'\'',
3172
+				'0x8F' => '\'\'', '0x90' => '\'\'', '0x98' => '\'\'',
3173
+				'0x9A' => '\'\'', '0x9C' => '\'\'', '0x9D' => '\'\'',
3174
+				'0x9E' => '\'\'', '0x9F' => '\'\'', '0xAA' => '\'\'',
3175
+				'0xD2' => '0xE282AC', '0xFF' => '0xCE92', '0xCE' => '0xCE9E',
3176
+				'0xB8' => '0xCE88', '0xBA' => '0xCE8A', '0xBC' => '0xCE8C',
3177
+				'0xBE' => '0xCE8E', '0xBF' => '0xCE8F', '0xC0' => '0xCE90',
3178
+				'0xC8' => '0xCE98', '0xCA' => '0xCE9A', '0xCC' => '0xCE9C',
3179
+				'0xCD' => '0xCE9D', '0xCF' => '0xCE9F', '0xDA' => '0xCEAA',
3180
+				'0xE8' => '0xCEB8', '0xEA' => '0xCEBA', '0xEC' => '0xCEBC',
3181
+				'0xEE' => '0xCEBE', '0xEF' => '0xCEBF', '0xC2' => '0xFF',
3182
+				'0xBD' => '0xC2BD', '0xED' => '0xCEBD', '0xB2' => '0xC2B2',
3183
+				'0xA0' => '0xC2A0', '0xA3' => '0xC2A3', '0xA4' => '0xC2A4',
3184
+				'0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7',
3185
+				'0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB',
3186
+				'0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE',
3187
+				'0xB0' => '0xC2B0', '0xB1' => '0xC2B1', '0xB3' => '0xC2B3',
3188
+				'0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7',
3189
+				'0xBB' => '0xC2BB', '0xE2' => '0xCEB2', '0x80' => '0xD2',
3190
+				'0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6',
3191
+				'0x86' => '0xE280A0', '0xA1' => '0xCE85', '0xA2' => '0xCE86',
3192
+				'0x87' => '0xE280A1', '0x89' => '0xE280B0', '0xB9' => '0xCE89',
3193
+				'0x8B' => '0xE280B9', '0x91' => '0xE28098', '0x99' => '0xE284A2',
3194
+				'0x92' => '0xE28099', '0x93' => '0xE2809C', '0x94' => '0xE2809D',
3195
+				'0x95' => '0xE280A2', '0x96' => '0xE28093', '0x97' => '0xE28094',
3196
+				'0x9B' => '0xE280BA', '0xAF' => '0xE28095', '0xB4' => '0xCE84',
3197
+				'0xC1' => '0xCE91', '0xC3' => '0xCE93', '0xC4' => '0xCE94',
3198
+				'0xC5' => '0xCE95', '0xC6' => '0xCE96', '0x83' => '0xC692',
3199
+				'0xC7' => '0xCE97', '0xC9' => '0xCE99', '0xCB' => '0xCE9B',
3200
+				'0xD0' => '0xCEA0', '0xD1' => '0xCEA1', '0xD3' => '0xCEA3',
3201
+				'0xD4' => '0xCEA4', '0xD5' => '0xCEA5', '0xD6' => '0xCEA6',
3202
+				'0xD7' => '0xCEA7', '0xD8' => '0xCEA8', '0xD9' => '0xCEA9',
3203
+				'0xDB' => '0xCEAB', '0xDC' => '0xCEAC', '0xDD' => '0xCEAD',
3204
+				'0xDE' => '0xCEAE', '0xDF' => '0xCEAF', '0xE0' => '0xCEB0',
3205
+				'0xE1' => '0xCEB1', '0xE3' => '0xCEB3', '0xE4' => '0xCEB4',
3206
+				'0xE5' => '0xCEB5', '0xE6' => '0xCEB6', '0xE7' => '0xCEB7',
3207
+				'0xE9' => '0xCEB9', '0xEB' => '0xCEBB', '0xF0' => '0xCF80',
3208
+				'0xF1' => '0xCF81', '0xF2' => '0xCF82', '0xF3' => '0xCF83',
3209
+				'0xF4' => '0xCF84', '0xF5' => '0xCF85', '0xF6' => '0xCF86',
3210
+				'0xF7' => '0xCF87', '0xF8' => '0xCF88', '0xF9' => '0xCF89',
3211
+				'0xFA' => '0xCF8A', '0xFB' => '0xCF8B', '0xFC' => '0xCF8C',
3212
+				'0xFD' => '0xCF8D', '0xFE' => '0xCF8E',
3213 3213
 			),
3214 3214
 		);
3215 3215
 
Please login to merge, or discard this patch.
other/upgrade-helper.php 1 patch
Indentation   +307 added lines, -307 removed lines patch added patch discarded remove patch
@@ -14,66 +14,66 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
 if (!defined('SMF_VERSION'))
17
-    die('No direct access!');
17
+	die('No direct access!');
18 18
 
19 19
 if (!function_exists('un_htmlspecialchars'))
20 20
 {
21
-    /**
22
-     * Undo the voodoo htmlspecialchars does.
23
-     *
24
-     * @param $string
25
-     * @return string
26
-     */
27
-    function un_htmlspecialchars($string)
28
-    {
29
-        return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)) + array(''' => '\'', ' ' => ' '));
30
-    }
21
+	/**
22
+	 * Undo the voodoo htmlspecialchars does.
23
+	 *
24
+	 * @param $string
25
+	 * @return string
26
+	 */
27
+	function un_htmlspecialchars($string)
28
+	{
29
+		return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)) + array(''' => '\'', ' ' => ' '));
30
+	}
31 31
 }
32 32
 
33 33
 if (!function_exists('text2words'))
34 34
 {
35
-    /**
36
-     * Split a sentence into words.
37
-     *
38
-     * @param $text
39
-     * @return array
40
-     */
41
-    function text2words($text)
42
-    {
43
-        // Step 1: Remove entities/things we don't consider words:
44
-        $words = preg_replace('~(?:[\x0B\0\xA0\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~', ' ', $text);
45
-
46
-        // Step 2: Entities we left to letters, where applicable, lowercase.
47
-        $words = preg_replace('~([^&\d]|^)[#;]~', '$1 ', un_htmlspecialchars(strtolower($words)));
48
-
49
-        // Step 3: Ready to split apart and index!
50
-        $words = explode(' ', $words);
51
-        $returned_words = array();
52
-        foreach ($words as $word)
53
-        {
54
-            $word = trim($word, '-_\'');
55
-
56
-            if ($word != '')
57
-                $returned_words[] = substr($word, 0, 20);
58
-        }
59
-
60
-        return array_unique($returned_words);
61
-    }
35
+	/**
36
+	 * Split a sentence into words.
37
+	 *
38
+	 * @param $text
39
+	 * @return array
40
+	 */
41
+	function text2words($text)
42
+	{
43
+		// Step 1: Remove entities/things we don't consider words:
44
+		$words = preg_replace('~(?:[\x0B\0\xA0\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~', ' ', $text);
45
+
46
+		// Step 2: Entities we left to letters, where applicable, lowercase.
47
+		$words = preg_replace('~([^&\d]|^)[#;]~', '$1 ', un_htmlspecialchars(strtolower($words)));
48
+
49
+		// Step 3: Ready to split apart and index!
50
+		$words = explode(' ', $words);
51
+		$returned_words = array();
52
+		foreach ($words as $word)
53
+		{
54
+			$word = trim($word, '-_\'');
55
+
56
+			if ($word != '')
57
+				$returned_words[] = substr($word, 0, 20);
58
+		}
59
+
60
+		return array_unique($returned_words);
61
+	}
62 62
 }
63 63
 
64 64
 if (!function_exists('md5_hmac'))
65 65
 {
66
-    /**
67
-     * Generate an MD5 hash using the HMAC method.
68
-     *
69
-     * @param string $data
70
-     * @param string $key
71
-     * @return string
72
-     */
73
-    function md5_hmac($data, $key)
74
-    {
75
-        return hash_hmac('md5', $data, $key);
76
-    }
66
+	/**
67
+	 * Generate an MD5 hash using the HMAC method.
68
+	 *
69
+	 * @param string $data
70
+	 * @param string $key
71
+	 * @return string
72
+	 */
73
+	function md5_hmac($data, $key)
74
+	{
75
+		return hash_hmac('md5', $data, $key);
76
+	}
77 77
 }
78 78
 
79 79
 /**
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function upgrade_clean_cache()
84 84
 {
85
-    global $cacheAPI, $sourcedir;
85
+	global $cacheAPI, $sourcedir;
86 86
 
87
-    // Initialize the cache API if it does not have an instance yet.
88
-    if (empty($cacheAPI))
89
-    {
90
-        require_once($sourcedir . '/Load.php');
91
-        loadCacheAccelerator();
92
-    }
87
+	// Initialize the cache API if it does not have an instance yet.
88
+	if (empty($cacheAPI))
89
+	{
90
+		require_once($sourcedir . '/Load.php');
91
+		loadCacheAccelerator();
92
+	}
93 93
 
94
-    // Just fall back to Load.php's clean_cache function.
95
-    clean_cache();
94
+	// Just fall back to Load.php's clean_cache function.
95
+	clean_cache();
96 96
 }
97 97
 
98 98
 /**
@@ -102,40 +102,40 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function getMemberGroups()
104 104
 {
105
-    global $smcFunc;
106
-    static $member_groups = array();
105
+	global $smcFunc;
106
+	static $member_groups = array();
107 107
 
108
-    if (!empty($member_groups))
109
-        return $member_groups;
108
+	if (!empty($member_groups))
109
+		return $member_groups;
110 110
 
111
-    $request = $smcFunc['db_query']('', '
111
+	$request = $smcFunc['db_query']('', '
112 112
 		SELECT group_name, id_group
113 113
 		FROM {db_prefix}membergroups
114 114
 		WHERE id_group = {int:admin_group} OR id_group > {int:old_group}',
115
-        array(
116
-            'admin_group' => 1,
117
-            'old_group' => 7,
118
-            'db_error_skip' => true,
119
-        )
120
-    );
121
-    if ($request === false)
122
-    {
123
-        $request = $smcFunc['db_query']('', '
115
+		array(
116
+			'admin_group' => 1,
117
+			'old_group' => 7,
118
+			'db_error_skip' => true,
119
+		)
120
+	);
121
+	if ($request === false)
122
+	{
123
+		$request = $smcFunc['db_query']('', '
124 124
 			SELECT membergroup, id_group
125 125
 			FROM {db_prefix}membergroups
126 126
 			WHERE id_group = {int:admin_group} OR id_group > {int:old_group}',
127
-            array(
128
-                'admin_group' => 1,
129
-                'old_group' => 7,
130
-                'db_error_skip' => true,
131
-            )
132
-        );
133
-    }
134
-    while ($row = $smcFunc['db_fetch_row']($request))
135
-        $member_groups[trim($row[0])] = $row[1];
136
-    $smcFunc['db_free_result']($request);
137
-
138
-    return $member_groups;
127
+			array(
128
+				'admin_group' => 1,
129
+				'old_group' => 7,
130
+				'db_error_skip' => true,
131
+			)
132
+		);
133
+	}
134
+	while ($row = $smcFunc['db_fetch_row']($request))
135
+		$member_groups[trim($row[0])] = $row[1];
136
+	$smcFunc['db_free_result']($request);
137
+
138
+	return $member_groups;
139 139
 }
140 140
 
141 141
 /**
@@ -146,197 +146,197 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function makeFilesWritable(&$files)
148 148
 {
149
-    global $upcontext, $boarddir;
150
-
151
-    if (empty($files))
152
-        return true;
153
-
154
-    $failure = false;
155
-    // On linux, it's easy - just use is_writable!
156
-    if (substr(__FILE__, 1, 2) != ':\\')
157
-    {
158
-        $upcontext['systemos'] = 'linux';
159
-
160
-        foreach ($files as $k => $file)
161
-        {
162
-            if (!is_writable($file))
163
-            {
164
-                @chmod($file, 0755);
165
-
166
-                // Well, 755 hopefully worked... if not, try 777.
167
-                if (!is_writable($file) && !@chmod($file, 0777))
168
-                    $failure = true;
169
-                // Otherwise remove it as it's good!
170
-                else
171
-                    unset($files[$k]);
172
-            }
173
-            else
174
-                unset($files[$k]);
175
-        }
176
-    }
177
-    // Windows is trickier.  Let's try opening for r+...
178
-    else
179
-    {
180
-        $upcontext['systemos'] = 'windows';
181
-
182
-        foreach ($files as $k => $file)
183
-        {
184
-            // Folders can't be opened for write... but the index.php in them can ;).
185
-            if (is_dir($file))
186
-                $file .= '/index.php';
187
-
188
-            // Funny enough, chmod actually does do something on windows - it removes the read only attribute.
189
-            @chmod($file, 0777);
190
-            $fp = @fopen($file, 'r+');
191
-
192
-            // Hmm, okay, try just for write in that case...
193
-            if (!$fp)
194
-                $fp = @fopen($file, 'w');
195
-
196
-            if (!$fp)
197
-                $failure = true;
198
-            else
199
-                unset($files[$k]);
200
-            @fclose($fp);
201
-        }
202
-    }
203
-
204
-    if (empty($files))
205
-        return true;
206
-
207
-    if (!isset($_SERVER))
208
-        return !$failure;
209
-
210
-    // What still needs to be done?
211
-    $upcontext['chmod']['files'] = $files;
212
-
213
-    // If it's windows it's a mess...
214
-    if ($failure && substr(__FILE__, 1, 2) == ':\\')
215
-    {
216
-        $upcontext['chmod']['ftp_error'] = 'total_mess';
217
-
218
-        return false;
219
-    }
220
-    // We're going to have to use... FTP!
221
-    elseif ($failure)
222
-    {
223
-        // Load any session data we might have...
224
-        if (!isset($_POST['ftp_username']) && isset($_SESSION['installer_temp_ftp']))
225
-        {
226
-            $upcontext['chmod']['server'] = $_SESSION['installer_temp_ftp']['server'];
227
-            $upcontext['chmod']['port'] = $_SESSION['installer_temp_ftp']['port'];
228
-            $upcontext['chmod']['username'] = $_SESSION['installer_temp_ftp']['username'];
229
-            $upcontext['chmod']['password'] = $_SESSION['installer_temp_ftp']['password'];
230
-            $upcontext['chmod']['path'] = $_SESSION['installer_temp_ftp']['path'];
231
-        }
232
-        // Or have we submitted?
233
-        elseif (isset($_POST['ftp_username']))
234
-        {
235
-            $upcontext['chmod']['server'] = $_POST['ftp_server'];
236
-            $upcontext['chmod']['port'] = $_POST['ftp_port'];
237
-            $upcontext['chmod']['username'] = $_POST['ftp_username'];
238
-            $upcontext['chmod']['password'] = $_POST['ftp_password'];
239
-            $upcontext['chmod']['path'] = $_POST['ftp_path'];
240
-        }
241
-
242
-        if (isset($upcontext['chmod']['username']))
243
-        {
244
-            $ftp = new ftp_connection($upcontext['chmod']['server'], $upcontext['chmod']['port'], $upcontext['chmod']['username'], $upcontext['chmod']['password']);
245
-
246
-            if ($ftp->error === false)
247
-            {
248
-                // Try it without /home/abc just in case they messed up.
249
-                if (!$ftp->chdir($upcontext['chmod']['path']))
250
-                {
251
-                    $upcontext['chmod']['ftp_error'] = $ftp->last_message;
252
-                    $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $upcontext['chmod']['path']));
253
-                }
254
-            }
255
-        }
256
-
257
-        if (!isset($ftp) || $ftp->error !== false)
258
-        {
259
-            if (!isset($ftp))
260
-                $ftp = new ftp_connection(null);
261
-            // Save the error so we can mess with listing...
262
-            elseif ($ftp->error !== false && !isset($upcontext['chmod']['ftp_error']))
263
-                $upcontext['chmod']['ftp_error'] = $ftp->last_message === null ? '' : $ftp->last_message;
264
-
265
-            list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
266
-
267
-            if ($found_path || !isset($upcontext['chmod']['path']))
268
-                $upcontext['chmod']['path'] = $detect_path;
269
-
270
-            if (!isset($upcontext['chmod']['username']))
271
-                $upcontext['chmod']['username'] = $username;
272
-
273
-            // Don't forget the login token.
274
-            $upcontext += createToken('login');
275
-
276
-            return false;
277
-        }
278
-        else
279
-        {
280
-            // We want to do a relative path for FTP.
281
-            if (!in_array($upcontext['chmod']['path'], array('', '/')))
282
-            {
283
-                $ftp_root = strtr($boarddir, array($upcontext['chmod']['path'] => ''));
284
-                if (substr($ftp_root, -1) == '/' && ($upcontext['chmod']['path'] == '' || $upcontext['chmod']['path'][0] === '/'))
285
-                    $ftp_root = substr($ftp_root, 0, -1);
286
-            }
287
-            else
288
-                $ftp_root = $boarddir;
289
-
290
-            // Save the info for next time!
291
-            $_SESSION['installer_temp_ftp'] = array(
292
-                'server' => $upcontext['chmod']['server'],
293
-                'port' => $upcontext['chmod']['port'],
294
-                'username' => $upcontext['chmod']['username'],
295
-                'password' => $upcontext['chmod']['password'],
296
-                'path' => $upcontext['chmod']['path'],
297
-                'root' => $ftp_root,
298
-            );
299
-
300
-            foreach ($files as $k => $file)
301
-            {
302
-                if (!is_writable($file))
303
-                    $ftp->chmod($file, 0755);
304
-                if (!is_writable($file))
305
-                    $ftp->chmod($file, 0777);
306
-
307
-                // Assuming that didn't work calculate the path without the boarddir.
308
-                if (!is_writable($file))
309
-                {
310
-                    if (strpos($file, $boarddir) === 0)
311
-                    {
312
-                        $ftp_file = strtr($file, array($_SESSION['installer_temp_ftp']['root'] => ''));
313
-                        $ftp->chmod($ftp_file, 0755);
314
-                        if (!is_writable($file))
315
-                            $ftp->chmod($ftp_file, 0777);
316
-                        // Sometimes an extra slash can help...
317
-                        $ftp_file = '/' . $ftp_file;
318
-                        if (!is_writable($file))
319
-                            $ftp->chmod($ftp_file, 0755);
320
-                        if (!is_writable($file))
321
-                            $ftp->chmod($ftp_file, 0777);
322
-                    }
323
-                }
324
-
325
-                if (is_writable($file))
326
-                    unset($files[$k]);
327
-            }
328
-
329
-            $ftp->close();
330
-        }
331
-    }
332
-
333
-    // What remains?
334
-    $upcontext['chmod']['files'] = $files;
335
-
336
-    if (empty($files))
337
-        return true;
338
-
339
-    return false;
149
+	global $upcontext, $boarddir;
150
+
151
+	if (empty($files))
152
+		return true;
153
+
154
+	$failure = false;
155
+	// On linux, it's easy - just use is_writable!
156
+	if (substr(__FILE__, 1, 2) != ':\\')
157
+	{
158
+		$upcontext['systemos'] = 'linux';
159
+
160
+		foreach ($files as $k => $file)
161
+		{
162
+			if (!is_writable($file))
163
+			{
164
+				@chmod($file, 0755);
165
+
166
+				// Well, 755 hopefully worked... if not, try 777.
167
+				if (!is_writable($file) && !@chmod($file, 0777))
168
+					$failure = true;
169
+				// Otherwise remove it as it's good!
170
+				else
171
+					unset($files[$k]);
172
+			}
173
+			else
174
+				unset($files[$k]);
175
+		}
176
+	}
177
+	// Windows is trickier.  Let's try opening for r+...
178
+	else
179
+	{
180
+		$upcontext['systemos'] = 'windows';
181
+
182
+		foreach ($files as $k => $file)
183
+		{
184
+			// Folders can't be opened for write... but the index.php in them can ;).
185
+			if (is_dir($file))
186
+				$file .= '/index.php';
187
+
188
+			// Funny enough, chmod actually does do something on windows - it removes the read only attribute.
189
+			@chmod($file, 0777);
190
+			$fp = @fopen($file, 'r+');
191
+
192
+			// Hmm, okay, try just for write in that case...
193
+			if (!$fp)
194
+				$fp = @fopen($file, 'w');
195
+
196
+			if (!$fp)
197
+				$failure = true;
198
+			else
199
+				unset($files[$k]);
200
+			@fclose($fp);
201
+		}
202
+	}
203
+
204
+	if (empty($files))
205
+		return true;
206
+
207
+	if (!isset($_SERVER))
208
+		return !$failure;
209
+
210
+	// What still needs to be done?
211
+	$upcontext['chmod']['files'] = $files;
212
+
213
+	// If it's windows it's a mess...
214
+	if ($failure && substr(__FILE__, 1, 2) == ':\\')
215
+	{
216
+		$upcontext['chmod']['ftp_error'] = 'total_mess';
217
+
218
+		return false;
219
+	}
220
+	// We're going to have to use... FTP!
221
+	elseif ($failure)
222
+	{
223
+		// Load any session data we might have...
224
+		if (!isset($_POST['ftp_username']) && isset($_SESSION['installer_temp_ftp']))
225
+		{
226
+			$upcontext['chmod']['server'] = $_SESSION['installer_temp_ftp']['server'];
227
+			$upcontext['chmod']['port'] = $_SESSION['installer_temp_ftp']['port'];
228
+			$upcontext['chmod']['username'] = $_SESSION['installer_temp_ftp']['username'];
229
+			$upcontext['chmod']['password'] = $_SESSION['installer_temp_ftp']['password'];
230
+			$upcontext['chmod']['path'] = $_SESSION['installer_temp_ftp']['path'];
231
+		}
232
+		// Or have we submitted?
233
+		elseif (isset($_POST['ftp_username']))
234
+		{
235
+			$upcontext['chmod']['server'] = $_POST['ftp_server'];
236
+			$upcontext['chmod']['port'] = $_POST['ftp_port'];
237
+			$upcontext['chmod']['username'] = $_POST['ftp_username'];
238
+			$upcontext['chmod']['password'] = $_POST['ftp_password'];
239
+			$upcontext['chmod']['path'] = $_POST['ftp_path'];
240
+		}
241
+
242
+		if (isset($upcontext['chmod']['username']))
243
+		{
244
+			$ftp = new ftp_connection($upcontext['chmod']['server'], $upcontext['chmod']['port'], $upcontext['chmod']['username'], $upcontext['chmod']['password']);
245
+
246
+			if ($ftp->error === false)
247
+			{
248
+				// Try it without /home/abc just in case they messed up.
249
+				if (!$ftp->chdir($upcontext['chmod']['path']))
250
+				{
251
+					$upcontext['chmod']['ftp_error'] = $ftp->last_message;
252
+					$ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $upcontext['chmod']['path']));
253
+				}
254
+			}
255
+		}
256
+
257
+		if (!isset($ftp) || $ftp->error !== false)
258
+		{
259
+			if (!isset($ftp))
260
+				$ftp = new ftp_connection(null);
261
+			// Save the error so we can mess with listing...
262
+			elseif ($ftp->error !== false && !isset($upcontext['chmod']['ftp_error']))
263
+				$upcontext['chmod']['ftp_error'] = $ftp->last_message === null ? '' : $ftp->last_message;
264
+
265
+			list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
266
+
267
+			if ($found_path || !isset($upcontext['chmod']['path']))
268
+				$upcontext['chmod']['path'] = $detect_path;
269
+
270
+			if (!isset($upcontext['chmod']['username']))
271
+				$upcontext['chmod']['username'] = $username;
272
+
273
+			// Don't forget the login token.
274
+			$upcontext += createToken('login');
275
+
276
+			return false;
277
+		}
278
+		else
279
+		{
280
+			// We want to do a relative path for FTP.
281
+			if (!in_array($upcontext['chmod']['path'], array('', '/')))
282
+			{
283
+				$ftp_root = strtr($boarddir, array($upcontext['chmod']['path'] => ''));
284
+				if (substr($ftp_root, -1) == '/' && ($upcontext['chmod']['path'] == '' || $upcontext['chmod']['path'][0] === '/'))
285
+					$ftp_root = substr($ftp_root, 0, -1);
286
+			}
287
+			else
288
+				$ftp_root = $boarddir;
289
+
290
+			// Save the info for next time!
291
+			$_SESSION['installer_temp_ftp'] = array(
292
+				'server' => $upcontext['chmod']['server'],
293
+				'port' => $upcontext['chmod']['port'],
294
+				'username' => $upcontext['chmod']['username'],
295
+				'password' => $upcontext['chmod']['password'],
296
+				'path' => $upcontext['chmod']['path'],
297
+				'root' => $ftp_root,
298
+			);
299
+
300
+			foreach ($files as $k => $file)
301
+			{
302
+				if (!is_writable($file))
303
+					$ftp->chmod($file, 0755);
304
+				if (!is_writable($file))
305
+					$ftp->chmod($file, 0777);
306
+
307
+				// Assuming that didn't work calculate the path without the boarddir.
308
+				if (!is_writable($file))
309
+				{
310
+					if (strpos($file, $boarddir) === 0)
311
+					{
312
+						$ftp_file = strtr($file, array($_SESSION['installer_temp_ftp']['root'] => ''));
313
+						$ftp->chmod($ftp_file, 0755);
314
+						if (!is_writable($file))
315
+							$ftp->chmod($ftp_file, 0777);
316
+						// Sometimes an extra slash can help...
317
+						$ftp_file = '/' . $ftp_file;
318
+						if (!is_writable($file))
319
+							$ftp->chmod($ftp_file, 0755);
320
+						if (!is_writable($file))
321
+							$ftp->chmod($ftp_file, 0777);
322
+					}
323
+				}
324
+
325
+				if (is_writable($file))
326
+					unset($files[$k]);
327
+			}
328
+
329
+			$ftp->close();
330
+		}
331
+	}
332
+
333
+	// What remains?
334
+	$upcontext['chmod']['files'] = $files;
335
+
336
+	if (empty($files))
337
+		return true;
338
+
339
+	return false;
340 340
 }
341 341
 
342 342
 /**
@@ -347,24 +347,24 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function quickFileWritable($file)
349 349
 {
350
-    if (is_writable($file))
351
-        return true;
350
+	if (is_writable($file))
351
+		return true;
352 352
 
353
-    @chmod($file, 0755);
353
+	@chmod($file, 0755);
354 354
 
355
-    // Try 755 and 775 first since 777 doesn't always work and could be a risk...
356
-    $chmod_values = array(0755, 0775, 0777);
355
+	// Try 755 and 775 first since 777 doesn't always work and could be a risk...
356
+	$chmod_values = array(0755, 0775, 0777);
357 357
 
358
-    foreach ($chmod_values as $val)
359
-    {
360
-        // If it's writable, break out of the loop
361
-        if (is_writable($file))
362
-            break;
363
-        else
364
-            @chmod($file, $val);
365
-    }
358
+	foreach ($chmod_values as $val)
359
+	{
360
+		// If it's writable, break out of the loop
361
+		if (is_writable($file))
362
+			break;
363
+		else
364
+			@chmod($file, $val);
365
+	}
366 366
 
367
-    return is_writable($file);
367
+	return is_writable($file);
368 368
 }
369 369
 
370 370
 /**
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function smf_strtolower($string)
377 377
 {
378
-    return mb_strtolower($string, 'UTF-8');
378
+	return mb_strtolower($string, 'UTF-8');
379 379
 }
380 380
 
381 381
 /**
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function print_error($message, $fatal = false)
388 388
 {
389
-    static $fp = null;
389
+	static $fp = null;
390 390
 
391
-    if ($fp === null)
392
-        $fp = fopen('php://stderr', 'wb');
391
+	if ($fp === null)
392
+		$fp = fopen('php://stderr', 'wb');
393 393
 
394
-    fwrite($fp, $message . "\n");
394
+	fwrite($fp, $message . "\n");
395 395
 
396
-    if ($fatal)
397
-        exit;
396
+	if ($fatal)
397
+		exit;
398 398
 }
399 399
 
400 400
 /**
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
  */
406 406
 function throw_error($message)
407 407
 {
408
-    global $upcontext;
408
+	global $upcontext;
409 409
 
410
-    $upcontext['error_msg'] = $message;
411
-    $upcontext['sub_template'] = 'error_message';
410
+	$upcontext['error_msg'] = $message;
411
+	$upcontext['sub_template'] = 'error_message';
412 412
 
413
-    return false;
413
+	return false;
414 414
 }
415 415
 
416 416
 /**
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  */
423 423
 function smf_mysql_fetch_assoc($rs)
424 424
 {
425
-    return mysqli_fetch_assoc($rs);
425
+	return mysqli_fetch_assoc($rs);
426 426
 }
427 427
 
428 428
 /**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
  */
432 432
 function smf_mysql_fetch_row($rs)
433 433
 {
434
-    return mysqli_fetch_row($rs);
434
+	return mysqli_fetch_row($rs);
435 435
 }
436 436
 
437 437
 /**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
  */
440 440
 function smf_mysql_free_result($rs)
441 441
 {
442
-    mysqli_free_result($rs);
442
+	mysqli_free_result($rs);
443 443
 }
444 444
 
445 445
 /**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function smf_mysql_insert_id($rs)
450 450
 {
451
-    return mysqli_insert_id($rs);
451
+	return mysqli_insert_id($rs);
452 452
 }
453 453
 
454 454
 /**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
  */
458 458
 function smf_mysql_num_rows($rs)
459 459
 {
460
-    return mysqli_num_rows($rs);
460
+	return mysqli_num_rows($rs);
461 461
 }
462 462
 
463 463
 /**
@@ -465,6 +465,6 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function smf_mysql_real_escape_string($string)
467 467
 {
468
-    global $db_connection;
469
-    mysqli_real_escape_string($db_connection, $string);
468
+	global $db_connection;
469
+	mysqli_real_escape_string($db_connection, $string);
470 470
 }
471 471
\ No newline at end of file
Please login to merge, or discard this patch.