@@ -19,10 +19,10 @@ |
||
19 | 19 | foreach (content_types() as $key => $info) { |
20 | 20 | // Exclude node types profile, team, and panel |
21 | 21 | switch ($key) { |
22 | - case 'profile': |
|
23 | - case 'team': |
|
24 | - case 'panel': |
|
25 | - continue 2; |
|
22 | + case 'profile': |
|
23 | + case 'team': |
|
24 | + case 'panel': |
|
25 | + continue 2; |
|
26 | 26 | }// switch key |
27 | 27 | $options[$key] = $info['name']; |
28 | 28 | } |
@@ -1066,42 +1066,42 @@ |
||
1066 | 1066 | $R=$StartR;$G=$StartG;$B=$StartB; |
1067 | 1067 | switch($Direction) |
1068 | 1068 | { |
1069 | - case DIRECTION_VERTICAL: |
|
1070 | - $StartY = $Y1; $EndY = floor($Y2)+1; $LastY2 = $StartY; |
|
1071 | - for($i=0;$i<=$Step;$i++) |
|
1069 | + case DIRECTION_VERTICAL: |
|
1070 | + $StartY = $Y1; $EndY = floor($Y2)+1; $LastY2 = $StartY; |
|
1071 | + for($i=0;$i<=$Step;$i++) |
|
1072 | + { |
|
1073 | + $Y2 = floor($StartY + ($i * $StepSize)); |
|
1074 | + |
|
1075 | + if ($Y2 > $EndY) { $Y2 = $EndY; } |
|
1076 | + if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY) |
|
1072 | 1077 | { |
1073 | - $Y2 = floor($StartY + ($i * $StepSize)); |
|
1074 | - |
|
1075 | - if ($Y2 > $EndY) { $Y2 = $EndY; } |
|
1076 | - if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY) |
|
1077 | - { |
|
1078 | - $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
|
1079 | - $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
|
1080 | - $LastY2 = max($LastY2,$Y2); |
|
1081 | - $Y1 = $Y2+1; |
|
1082 | - } |
|
1083 | - $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep; |
|
1078 | + $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
|
1079 | + $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
|
1080 | + $LastY2 = max($LastY2,$Y2); |
|
1081 | + $Y1 = $Y2+1; |
|
1084 | 1082 | } |
1085 | - if ( $LastY2 < $EndY && isset($Color)) { for ($i=$LastY2+1;$i<=$EndY;$i++) { $this->drawLine($X1,$i,$X2,$i,$Color); } } |
|
1086 | - break; |
|
1087 | - |
|
1088 | - case DIRECTION_HORIZONTAL: |
|
1089 | - $StartX = $X1; $EndX = $X2; |
|
1090 | - for($i=0;$i<=$Step;$i++) |
|
1083 | + $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep; |
|
1084 | + } |
|
1085 | + if ( $LastY2 < $EndY && isset($Color)) { for ($i=$LastY2+1;$i<=$EndY;$i++) { $this->drawLine($X1,$i,$X2,$i,$Color); } } |
|
1086 | + break; |
|
1087 | + |
|
1088 | + case DIRECTION_HORIZONTAL: |
|
1089 | + $StartX = $X1; $EndX = $X2; |
|
1090 | + for($i=0;$i<=$Step;$i++) |
|
1091 | + { |
|
1092 | + $X2 = floor($StartX + ($i * $StepSize)); |
|
1093 | + |
|
1094 | + if ($X2 > $EndX) { $X2 = $EndX; } |
|
1095 | + if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX) |
|
1091 | 1096 | { |
1092 | - $X2 = floor($StartX + ($i * $StepSize)); |
|
1093 | - |
|
1094 | - if ($X2 > $EndX) { $X2 = $EndX; } |
|
1095 | - if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX) |
|
1096 | - { |
|
1097 | - $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
|
1098 | - $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
|
1099 | - $X1 = $X2+1; |
|
1100 | - } |
|
1101 | - $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep; |
|
1097 | + $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
|
1098 | + $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
|
1099 | + $X1 = $X2+1; |
|
1102 | 1100 | } |
1103 | - if ( $X2 < $EndX && isset($Color)) { $this->drawFilledRectangle($X2,$Y1,$EndX,$Y2,$Color); } |
|
1104 | - break; |
|
1101 | + $R = $R + $RStep; $G = $G + $GStep; $B = $B + $BStep; |
|
1102 | + } |
|
1103 | + if ( $X2 < $EndX && isset($Color)) { $this->drawFilledRectangle($X2,$Y1,$EndX,$Y2,$Color); } |
|
1104 | + break; |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | $this->Shadow = $Shadow; |
@@ -643,9 +643,9 @@ |
||
643 | 643 | } |
644 | 644 | break; |
645 | 645 | |
646 | - default: |
|
647 | - // Don't generate form elements for things that aren't explicitly form |
|
648 | - // elements (i.e. 'title', '@attributes' keys, and the like) |
|
646 | + default: |
|
647 | + // Don't generate form elements for things that aren't explicitly form |
|
648 | + // elements (i.e. 'title', '@attributes' keys, and the like) |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 |
@@ -180,12 +180,12 @@ |
||
180 | 180 | */ |
181 | 181 | function boincwork_locale($op = 'groups', $group = NULL) { |
182 | 182 | switch ($op) { |
183 | - case 'groups': |
|
184 | - return array('project' => bts('Project')); |
|
185 | - case 'info': |
|
186 | - $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
|
187 | - $info['project']['format'] = FALSE; |
|
188 | - return $info; |
|
183 | + case 'groups': |
|
184 | + return array('project' => bts('Project')); |
|
185 | + case 'info': |
|
186 | + $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
|
187 | + $info['project']['format'] = FALSE; |
|
188 | + return $info; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 |
@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | */ |
552 | 552 | function boinccore_locale($op = 'groups', $group = NULL) { |
553 | 553 | switch ($op) { |
554 | - case 'groups': |
|
555 | - return array('boinc' => bts('BOINC')); |
|
556 | - case 'info': |
|
557 | - //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | - $info['boinc']['format'] = FALSE; |
|
559 | - return $info; |
|
554 | + case 'groups': |
|
555 | + return array('boinc' => bts('BOINC')); |
|
556 | + case 'info': |
|
557 | + //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | + $info['boinc']['format'] = FALSE; |
|
559 | + return $info; |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
@@ -1853,19 +1853,19 @@ discard block |
||
1853 | 1853 | // Transform arguments before inserting them. |
1854 | 1854 | foreach ($args as $key => $value) { |
1855 | 1855 | switch ($key [0]) { |
1856 | - case '@': |
|
1857 | - // Escaped only. |
|
1858 | - $args [$key] = check_plain($value); |
|
1859 | - break; |
|
1856 | + case '@': |
|
1857 | + // Escaped only. |
|
1858 | + $args [$key] = check_plain($value); |
|
1859 | + break; |
|
1860 | 1860 | |
1861 | - case '%': |
|
1862 | - default: |
|
1863 | - // Escaped and placeholder. |
|
1864 | - $args [$key] = theme('placeholder', $value); |
|
1865 | - break; |
|
1861 | + case '%': |
|
1862 | + default: |
|
1863 | + // Escaped and placeholder. |
|
1864 | + $args [$key] = theme('placeholder', $value); |
|
1865 | + break; |
|
1866 | 1866 | |
1867 | - case '!': |
|
1868 | - // Pass-through. |
|
1867 | + case '!': |
|
1868 | + // Pass-through. |
|
1869 | 1869 | } |
1870 | 1870 | } |
1871 | 1871 | return strtr($string, $args); |
@@ -300,125 +300,125 @@ |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | switch ($form_state['values']['import']) { |
303 | - case 'users': |
|
304 | - boincimport_users(); |
|
305 | - break; |
|
306 | - |
|
307 | - case 'teams': |
|
308 | - boincimport_teams(); |
|
309 | - if (!variable_get('boincimport_import_team_successful', 0)) { |
|
310 | - $_SESSION['boincimport_stage_selected'] = 'teams'; |
|
311 | - } |
|
312 | - else { |
|
313 | - $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
314 | - } |
|
315 | - break; |
|
303 | + case 'users': |
|
304 | + boincimport_users(); |
|
305 | + break; |
|
316 | 306 | |
317 | - case 'friends': |
|
318 | - boincimport_friends(); |
|
319 | - if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
320 | - $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
321 | - } |
|
322 | - else { |
|
323 | - $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
324 | - } |
|
325 | - break; |
|
307 | + case 'teams': |
|
308 | + boincimport_teams(); |
|
309 | + if (!variable_get('boincimport_import_team_successful', 0)) { |
|
310 | + $_SESSION['boincimport_stage_selected'] = 'teams'; |
|
311 | + } |
|
312 | + else { |
|
313 | + $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
314 | + } |
|
315 | + break; |
|
326 | 316 | |
327 | - case 'preferences': |
|
328 | - boincimport_preferences(); |
|
329 | - if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
330 | - $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
331 | - } |
|
332 | - else { |
|
333 | - $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
334 | - } |
|
335 | - break; |
|
317 | + case 'friends': |
|
318 | + boincimport_friends(); |
|
319 | + if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
320 | + $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
321 | + } |
|
322 | + else { |
|
323 | + $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
324 | + } |
|
325 | + break; |
|
336 | 326 | |
337 | - case 'private messages': |
|
338 | - boincimport_private_msgs(); |
|
339 | - if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
340 | - $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
341 | - } |
|
342 | - else { |
|
343 | - $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
344 | - } |
|
345 | - break; |
|
327 | + case 'preferences': |
|
328 | + boincimport_preferences(); |
|
329 | + if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
330 | + $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
331 | + } |
|
332 | + else { |
|
333 | + $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
334 | + } |
|
335 | + break; |
|
346 | 336 | |
347 | - case 'categories': |
|
348 | - boincimport_forum_categories(); |
|
349 | - if (!variable_get('boincimport_import_category_successful', 0)) { |
|
350 | - $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
351 | - } |
|
352 | - else { |
|
353 | - $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
354 | - } |
|
355 | - break; |
|
337 | + case 'private messages': |
|
338 | + boincimport_private_msgs(); |
|
339 | + if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
340 | + $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
341 | + } |
|
342 | + else { |
|
343 | + $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
344 | + } |
|
345 | + break; |
|
356 | 346 | |
357 | - case 'topics': |
|
358 | - boincimport_forum_topics(); |
|
359 | - if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
360 | - $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
361 | - } |
|
362 | - else { |
|
363 | - $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
364 | - } |
|
365 | - break; |
|
347 | + case 'categories': |
|
348 | + boincimport_forum_categories(); |
|
349 | + if (!variable_get('boincimport_import_category_successful', 0)) { |
|
350 | + $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
351 | + } |
|
352 | + else { |
|
353 | + $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
354 | + } |
|
355 | + break; |
|
356 | + |
|
357 | + case 'topics': |
|
358 | + boincimport_forum_topics(); |
|
359 | + if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
360 | + $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
361 | + } |
|
362 | + else { |
|
363 | + $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
364 | + } |
|
365 | + break; |
|
366 | 366 | |
367 | - case 'posts': |
|
368 | - boincimport_forum_posts(); |
|
369 | - if (!variable_get('boincimport_import_post_successful', 0)) { |
|
370 | - $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
371 | - } |
|
372 | - else { |
|
373 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
374 | - } |
|
375 | - break; |
|
367 | + case 'posts': |
|
368 | + boincimport_forum_posts(); |
|
369 | + if (!variable_get('boincimport_import_post_successful', 0)) { |
|
370 | + $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
371 | + } |
|
372 | + else { |
|
373 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
374 | + } |
|
375 | + break; |
|
376 | 376 | |
377 | - case 'team forums': |
|
378 | - boincimport_team_forums(); |
|
379 | - if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
380 | - $_SESSION['boincimport_stage_selected'] = 'team forums'; |
|
381 | - } |
|
382 | - else { |
|
383 | - $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
384 | - } |
|
385 | - break; |
|
377 | + case 'team forums': |
|
378 | + boincimport_team_forums(); |
|
379 | + if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
380 | + $_SESSION['boincimport_stage_selected'] = 'team forums'; |
|
381 | + } |
|
382 | + else { |
|
383 | + $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
384 | + } |
|
385 | + break; |
|
386 | 386 | |
387 | - case 'team topics': |
|
388 | - boincimport_team_forum_topics(); |
|
389 | - if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
390 | - $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
391 | - } |
|
392 | - else { |
|
393 | - $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
394 | - } |
|
395 | - break; |
|
387 | + case 'team topics': |
|
388 | + boincimport_team_forum_topics(); |
|
389 | + if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
390 | + $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
391 | + } |
|
392 | + else { |
|
393 | + $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
394 | + } |
|
395 | + break; |
|
396 | 396 | |
397 | - case 'team posts': |
|
398 | - boincimport_team_forum_posts(); |
|
399 | - if (!variable_get('boincimport_team_post_successful', 0)) { |
|
400 | - $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
401 | - } |
|
402 | - else { |
|
403 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
404 | - } |
|
405 | - break; |
|
397 | + case 'team posts': |
|
398 | + boincimport_team_forum_posts(); |
|
399 | + if (!variable_get('boincimport_team_post_successful', 0)) { |
|
400 | + $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
401 | + } |
|
402 | + else { |
|
403 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
404 | + } |
|
405 | + break; |
|
406 | 406 | |
407 | - case 'url': |
|
408 | - boincimport_replace_urls(); |
|
409 | - if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
410 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
411 | - } |
|
412 | - else { |
|
413 | - drupal_set_message('Congratulations. Import Finished'); |
|
414 | - drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
|
415 | - watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
|
416 | - unset($_SESSION['boincimport_stage_selected']); |
|
417 | - } |
|
418 | - break; |
|
419 | - default: |
|
420 | - $_SESSION['boincimport_stage_selected'] = 'users'; |
|
421 | - break; |
|
407 | + case 'url': |
|
408 | + boincimport_replace_urls(); |
|
409 | + if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
410 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
411 | + } |
|
412 | + else { |
|
413 | + drupal_set_message('Congratulations. Import Finished'); |
|
414 | + drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
|
415 | + watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
|
416 | + unset($_SESSION['boincimport_stage_selected']); |
|
417 | + } |
|
418 | + break; |
|
419 | + default: |
|
420 | + $_SESSION['boincimport_stage_selected'] = 'users'; |
|
421 | + break; |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 |
@@ -1377,72 +1377,72 @@ |
||
1377 | 1377 | |
1378 | 1378 | switch ($op) { |
1379 | 1379 | // Return stored strings |
1380 | - case 'mem-report': |
|
1381 | - return $strings; |
|
1380 | + case 'mem-report': |
|
1381 | + return $strings; |
|
1382 | 1382 | |
1383 | - // Store string in memory (only supports single strings) |
|
1384 | - case 'mem-store': |
|
1385 | - $strings[$value['msgid']] = $value['msgstr']; |
|
1386 | - return; |
|
1383 | + // Store string in memory (only supports single strings) |
|
1384 | + case 'mem-store': |
|
1385 | + $strings[$value['msgid']] = $value['msgstr']; |
|
1386 | + return; |
|
1387 | 1387 | |
1388 | - // Called at end of import to inform the user |
|
1389 | - case 'db-report': |
|
1390 | - return array( |
|
1391 | - $headerdone, |
|
1392 | - $report['additions'], |
|
1393 | - $report['updates'], |
|
1394 | - $report['deletes'], |
|
1395 | - $report['skips'], |
|
1396 | - ); |
|
1388 | + // Called at end of import to inform the user |
|
1389 | + case 'db-report': |
|
1390 | + return array( |
|
1391 | + $headerdone, |
|
1392 | + $report['additions'], |
|
1393 | + $report['updates'], |
|
1394 | + $report['deletes'], |
|
1395 | + $report['skips'], |
|
1396 | + ); |
|
1397 | 1397 | |
1398 | - // Store the string we got in the database. |
|
1399 | - case 'db-store': |
|
1400 | - // We got header information. |
|
1401 | - if ($value['msgid'] == '') { |
|
1402 | - $languages = language_list(); |
|
1403 | - if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) { |
|
1404 | - // Since we only need to parse the header if we ought to update the |
|
1405 | - // plural formula, only run this if we don't need to keep existing |
|
1406 | - // data untouched or if we don't have an existing plural formula. |
|
1407 | - $header = _locale_import_parse_header($value['msgstr']); |
|
1398 | + // Store the string we got in the database. |
|
1399 | + case 'db-store': |
|
1400 | + // We got header information. |
|
1401 | + if ($value['msgid'] == '') { |
|
1402 | + $languages = language_list(); |
|
1403 | + if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) { |
|
1404 | + // Since we only need to parse the header if we ought to update the |
|
1405 | + // plural formula, only run this if we don't need to keep existing |
|
1406 | + // data untouched or if we don't have an existing plural formula. |
|
1407 | + $header = _locale_import_parse_header($value['msgstr']); |
|
1408 | 1408 | |
1409 | - // Get and store the plural formula if available. |
|
1410 | - if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1411 | - list($nplurals, $plural) = $p; |
|
1412 | - db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang); |
|
1413 | - } |
|
1409 | + // Get and store the plural formula if available. |
|
1410 | + if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1411 | + list($nplurals, $plural) = $p; |
|
1412 | + db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang); |
|
1414 | 1413 | } |
1415 | - $headerdone = TRUE; |
|
1416 | 1414 | } |
1415 | + $headerdone = TRUE; |
|
1416 | + } |
|
1417 | 1417 | |
1418 | - else { |
|
1419 | - // Some real string to import. |
|
1420 | - $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
|
1418 | + else { |
|
1419 | + // Some real string to import. |
|
1420 | + $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
|
1421 | 1421 | |
1422 | - if (strpos($value['msgid'], "\0")) { |
|
1423 | - // This string has plural versions. |
|
1424 | - $english = explode("\0", $value['msgid'], 2); |
|
1425 | - $entries = array_keys($value['msgstr']); |
|
1426 | - for ($i = 3; $i <= count($entries); $i++) { |
|
1427 | - $english[] = $english[1]; |
|
1428 | - } |
|
1429 | - $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1430 | - $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1431 | - foreach ($translation as $key => $trans) { |
|
1432 | - if ($key == 0) { |
|
1433 | - $plid = 0; |
|
1434 | - } |
|
1435 | - $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
|
1422 | + if (strpos($value['msgid'], "\0")) { |
|
1423 | + // This string has plural versions. |
|
1424 | + $english = explode("\0", $value['msgid'], 2); |
|
1425 | + $entries = array_keys($value['msgstr']); |
|
1426 | + for ($i = 3; $i <= count($entries); $i++) { |
|
1427 | + $english[] = $english[1]; |
|
1428 | + } |
|
1429 | + $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1430 | + $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1431 | + foreach ($translation as $key => $trans) { |
|
1432 | + if ($key == 0) { |
|
1433 | + $plid = 0; |
|
1436 | 1434 | } |
1435 | + $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
|
1437 | 1436 | } |
1437 | + } |
|
1438 | 1438 | |
1439 | - else { |
|
1440 | - // A simple string to import. |
|
1441 | - $english = $value['msgid']; |
|
1442 | - $translation = $value['msgstr']; |
|
1443 | - _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1444 | - } |
|
1439 | + else { |
|
1440 | + // A simple string to import. |
|
1441 | + $english = $value['msgid']; |
|
1442 | + $translation = $value['msgstr']; |
|
1443 | + _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1445 | 1444 | } |
1445 | + } |
|
1446 | 1446 | } // end of db-store operation |
1447 | 1447 | } |
1448 | 1448 |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | return; |
222 | 222 | } |
223 | 223 | switch ($this->Debugoutput) { |
224 | - case 'error_log': |
|
225 | - //Don't output, just log |
|
226 | - error_log($str); |
|
227 | - break; |
|
228 | - case 'html': |
|
229 | - //Cleans up output a bit for a better looking, HTML-safe output |
|
230 | - echo htmlentities( |
|
231 | - preg_replace('/[\r\n]+/', '', $str), |
|
232 | - ENT_QUOTES, |
|
233 | - 'UTF-8' |
|
234 | - ) |
|
235 | - . "<br>\n"; |
|
236 | - break; |
|
237 | - case 'echo': |
|
238 | - default: |
|
239 | - //Normalize line breaks |
|
240 | - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
241 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
242 | - "\n", |
|
243 | - "\n \t ", |
|
244 | - trim($str) |
|
245 | - )."\n"; |
|
224 | + case 'error_log': |
|
225 | + //Don't output, just log |
|
226 | + error_log($str); |
|
227 | + break; |
|
228 | + case 'html': |
|
229 | + //Cleans up output a bit for a better looking, HTML-safe output |
|
230 | + echo htmlentities( |
|
231 | + preg_replace('/[\r\n]+/', '', $str), |
|
232 | + ENT_QUOTES, |
|
233 | + 'UTF-8' |
|
234 | + ) |
|
235 | + . "<br>\n"; |
|
236 | + break; |
|
237 | + case 'echo': |
|
238 | + default: |
|
239 | + //Normalize line breaks |
|
240 | + $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
241 | + echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
242 | + "\n", |
|
243 | + "\n \t ", |
|
244 | + trim($str) |
|
245 | + )."\n"; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
@@ -435,48 +435,48 @@ discard block |
||
435 | 435 | $authtype = 'LOGIN'; |
436 | 436 | } |
437 | 437 | switch ($authtype) { |
438 | - case 'PLAIN': |
|
439 | - // Start authentication |
|
440 | - if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { |
|
441 | - return false; |
|
442 | - } |
|
443 | - // Send encoded username and password |
|
444 | - if (!$this->sendCommand( |
|
445 | - 'User & Password', |
|
446 | - base64_encode("\0" . $username . "\0" . $password), |
|
447 | - 235 |
|
448 | - ) |
|
449 | - ) { |
|
450 | - return false; |
|
451 | - } |
|
452 | - break; |
|
453 | - case 'LOGIN': |
|
454 | - // Start authentication |
|
455 | - if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { |
|
456 | - return false; |
|
457 | - } |
|
458 | - if (!$this->sendCommand("Username", base64_encode($username), 334)) { |
|
459 | - return false; |
|
460 | - } |
|
461 | - if (!$this->sendCommand("Password", base64_encode($password), 235)) { |
|
462 | - return false; |
|
463 | - } |
|
464 | - break; |
|
465 | - case 'XOAUTH2': |
|
466 | - //If the OAuth Instance is not set. Can be a case when PHPMailer is used |
|
467 | - //instead of PHPMailerOAuth |
|
468 | - if (is_null($OAuth)) { |
|
469 | - return false; |
|
470 | - } |
|
471 | - $oauth = $OAuth->getOauth64(); |
|
438 | + case 'PLAIN': |
|
439 | + // Start authentication |
|
440 | + if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { |
|
441 | + return false; |
|
442 | + } |
|
443 | + // Send encoded username and password |
|
444 | + if (!$this->sendCommand( |
|
445 | + 'User & Password', |
|
446 | + base64_encode("\0" . $username . "\0" . $password), |
|
447 | + 235 |
|
448 | + ) |
|
449 | + ) { |
|
450 | + return false; |
|
451 | + } |
|
452 | + break; |
|
453 | + case 'LOGIN': |
|
454 | + // Start authentication |
|
455 | + if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { |
|
456 | + return false; |
|
457 | + } |
|
458 | + if (!$this->sendCommand("Username", base64_encode($username), 334)) { |
|
459 | + return false; |
|
460 | + } |
|
461 | + if (!$this->sendCommand("Password", base64_encode($password), 235)) { |
|
462 | + return false; |
|
463 | + } |
|
464 | + break; |
|
465 | + case 'XOAUTH2': |
|
466 | + //If the OAuth Instance is not set. Can be a case when PHPMailer is used |
|
467 | + //instead of PHPMailerOAuth |
|
468 | + if (is_null($OAuth)) { |
|
469 | + return false; |
|
470 | + } |
|
471 | + $oauth = $OAuth->getOauth64(); |
|
472 | 472 | |
473 | - // Start authentication |
|
474 | - if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { |
|
475 | - return false; |
|
476 | - } |
|
477 | - break; |
|
478 | - case 'NTLM': |
|
479 | - /* |
|
473 | + // Start authentication |
|
474 | + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { |
|
475 | + return false; |
|
476 | + } |
|
477 | + break; |
|
478 | + case 'NTLM': |
|
479 | + /* |
|
480 | 480 | * ntlm_sasl_client.php |
481 | 481 | * Bundled with Permission |
482 | 482 | * |
@@ -484,63 +484,63 @@ discard block |
||
484 | 484 | * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx |
485 | 485 | * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication |
486 | 486 | */ |
487 | - require_once 'extras/ntlm_sasl_client.php'; |
|
488 | - $temp = new stdClass; |
|
489 | - $ntlm_client = new ntlm_sasl_client_class; |
|
490 | - //Check that functions are available |
|
491 | - if (!$ntlm_client->initialize($temp)) { |
|
492 | - $this->setError($temp->error); |
|
493 | - $this->edebug( |
|
494 | - 'You need to enable some modules in your php.ini file: ' |
|
495 | - . $this->error['error'], |
|
496 | - self::DEBUG_CLIENT |
|
497 | - ); |
|
498 | - return false; |
|
499 | - } |
|
500 | - //msg1 |
|
501 | - $msg1 = $ntlm_client->typeMsg1($realm, $workstation); //msg1 |
|
502 | - |
|
503 | - if (!$this->sendCommand( |
|
504 | - 'AUTH NTLM', |
|
505 | - 'AUTH NTLM ' . base64_encode($msg1), |
|
506 | - 334 |
|
507 | - ) |
|
508 | - ) { |
|
509 | - return false; |
|
510 | - } |
|
511 | - //Though 0 based, there is a white space after the 3 digit number |
|
512 | - //msg2 |
|
513 | - $challenge = substr($this->last_reply, 3); |
|
514 | - $challenge = base64_decode($challenge); |
|
515 | - $ntlm_res = $ntlm_client->NTLMResponse( |
|
516 | - substr($challenge, 24, 8), |
|
517 | - $password |
|
518 | - ); |
|
519 | - //msg3 |
|
520 | - $msg3 = $ntlm_client->typeMsg3( |
|
521 | - $ntlm_res, |
|
522 | - $username, |
|
523 | - $realm, |
|
524 | - $workstation |
|
487 | + require_once 'extras/ntlm_sasl_client.php'; |
|
488 | + $temp = new stdClass; |
|
489 | + $ntlm_client = new ntlm_sasl_client_class; |
|
490 | + //Check that functions are available |
|
491 | + if (!$ntlm_client->initialize($temp)) { |
|
492 | + $this->setError($temp->error); |
|
493 | + $this->edebug( |
|
494 | + 'You need to enable some modules in your php.ini file: ' |
|
495 | + . $this->error['error'], |
|
496 | + self::DEBUG_CLIENT |
|
525 | 497 | ); |
526 | - // send encoded username |
|
527 | - return $this->sendCommand('Username', base64_encode($msg3), 235); |
|
528 | - case 'CRAM-MD5': |
|
529 | - // Start authentication |
|
530 | - if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { |
|
531 | - return false; |
|
532 | - } |
|
533 | - // Get the challenge |
|
534 | - $challenge = base64_decode(substr($this->last_reply, 4)); |
|
498 | + return false; |
|
499 | + } |
|
500 | + //msg1 |
|
501 | + $msg1 = $ntlm_client->typeMsg1($realm, $workstation); //msg1 |
|
502 | + |
|
503 | + if (!$this->sendCommand( |
|
504 | + 'AUTH NTLM', |
|
505 | + 'AUTH NTLM ' . base64_encode($msg1), |
|
506 | + 334 |
|
507 | + ) |
|
508 | + ) { |
|
509 | + return false; |
|
510 | + } |
|
511 | + //Though 0 based, there is a white space after the 3 digit number |
|
512 | + //msg2 |
|
513 | + $challenge = substr($this->last_reply, 3); |
|
514 | + $challenge = base64_decode($challenge); |
|
515 | + $ntlm_res = $ntlm_client->NTLMResponse( |
|
516 | + substr($challenge, 24, 8), |
|
517 | + $password |
|
518 | + ); |
|
519 | + //msg3 |
|
520 | + $msg3 = $ntlm_client->typeMsg3( |
|
521 | + $ntlm_res, |
|
522 | + $username, |
|
523 | + $realm, |
|
524 | + $workstation |
|
525 | + ); |
|
526 | + // send encoded username |
|
527 | + return $this->sendCommand('Username', base64_encode($msg3), 235); |
|
528 | + case 'CRAM-MD5': |
|
529 | + // Start authentication |
|
530 | + if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { |
|
531 | + return false; |
|
532 | + } |
|
533 | + // Get the challenge |
|
534 | + $challenge = base64_decode(substr($this->last_reply, 4)); |
|
535 | 535 | |
536 | - // Build the response |
|
537 | - $response = $username . ' ' . $this->hmac($challenge, $password); |
|
536 | + // Build the response |
|
537 | + $response = $username . ' ' . $this->hmac($challenge, $password); |
|
538 | 538 | |
539 | - // send encoded credentials |
|
540 | - return $this->sendCommand('Username', base64_encode($response), 235); |
|
541 | - default: |
|
542 | - $this->setError("Authentication method \"$authtype\" is not supported"); |
|
543 | - return false; |
|
539 | + // send encoded credentials |
|
540 | + return $this->sendCommand('Username', base64_encode($response), 235); |
|
541 | + default: |
|
542 | + $this->setError("Authentication method \"$authtype\" is not supported"); |
|
543 | + return false; |
|
544 | 544 | } |
545 | 545 | return true; |
546 | 546 | } |
@@ -777,16 +777,16 @@ discard block |
||
777 | 777 | } else { |
778 | 778 | $name = array_shift($fields); |
779 | 779 | switch ($name) { |
780 | - case 'SIZE': |
|
781 | - $fields = ($fields ? $fields[0] : 0); |
|
782 | - break; |
|
783 | - case 'AUTH': |
|
784 | - if (!is_array($fields)) { |
|
785 | - $fields = array(); |
|
786 | - } |
|
787 | - break; |
|
788 | - default: |
|
789 | - $fields = true; |
|
780 | + case 'SIZE': |
|
781 | + $fields = ($fields ? $fields[0] : 0); |
|
782 | + break; |
|
783 | + case 'AUTH': |
|
784 | + if (!is_array($fields)) { |
|
785 | + $fields = array(); |
|
786 | + } |
|
787 | + break; |
|
788 | + default: |
|
789 | + $fields = true; |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | $this->server_caps[$name] = $fields; |
@@ -719,28 +719,28 @@ discard block |
||
719 | 719 | return; |
720 | 720 | } |
721 | 721 | switch ($this->Debugoutput) { |
722 | - case 'error_log': |
|
723 | - //Don't output, just log |
|
724 | - error_log($str); |
|
725 | - break; |
|
726 | - case 'html': |
|
727 | - //Cleans up output a bit for a better looking, HTML-safe output |
|
728 | - echo htmlentities( |
|
729 | - preg_replace('/[\r\n]+/', '', $str), |
|
730 | - ENT_QUOTES, |
|
731 | - 'UTF-8' |
|
732 | - ) |
|
733 | - . "<br>\n"; |
|
734 | - break; |
|
735 | - case 'echo': |
|
736 | - default: |
|
737 | - //Normalize line breaks |
|
738 | - $str = preg_replace('/\r\n?/ms', "\n", $str); |
|
739 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
740 | - "\n", |
|
741 | - "\n \t ", |
|
742 | - trim($str) |
|
743 | - ) . "\n"; |
|
722 | + case 'error_log': |
|
723 | + //Don't output, just log |
|
724 | + error_log($str); |
|
725 | + break; |
|
726 | + case 'html': |
|
727 | + //Cleans up output a bit for a better looking, HTML-safe output |
|
728 | + echo htmlentities( |
|
729 | + preg_replace('/[\r\n]+/', '', $str), |
|
730 | + ENT_QUOTES, |
|
731 | + 'UTF-8' |
|
732 | + ) |
|
733 | + . "<br>\n"; |
|
734 | + break; |
|
735 | + case 'echo': |
|
736 | + default: |
|
737 | + //Normalize line breaks |
|
738 | + $str = preg_replace('/\r\n?/ms', "\n", $str); |
|
739 | + echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
740 | + "\n", |
|
741 | + "\n \t ", |
|
742 | + trim($str) |
|
743 | + ) . "\n"; |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | |
@@ -1100,59 +1100,59 @@ discard block |
||
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | switch ($patternselect) { |
1103 | - case 'pcre8': |
|
1104 | - /** |
|
1103 | + case 'pcre8': |
|
1104 | + /** |
|
1105 | 1105 | * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. |
1106 | 1106 | * @link http://squiloople.com/2009/12/20/email-address-validation/ |
1107 | 1107 | * @copyright 2009-2010 Michael Rushton |
1108 | 1108 | * Feel free to use and redistribute this code. But please keep this copyright notice. |
1109 | 1109 | */ |
1110 | - return (boolean)preg_match( |
|
1111 | - '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . |
|
1112 | - '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
|
1113 | - '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
|
1114 | - '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
|
1115 | - '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . |
|
1116 | - '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . |
|
1117 | - '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . |
|
1118 | - '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
|
1119 | - '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
|
1120 | - $address |
|
1121 | - ); |
|
1122 | - case 'pcre': |
|
1123 | - //An older regex that doesn't need a recent PCRE |
|
1124 | - return (boolean)preg_match( |
|
1125 | - '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . |
|
1126 | - '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . |
|
1127 | - '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . |
|
1128 | - '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . |
|
1129 | - '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . |
|
1130 | - '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . |
|
1131 | - '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . |
|
1132 | - '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . |
|
1133 | - '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
|
1134 | - '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', |
|
1135 | - $address |
|
1136 | - ); |
|
1137 | - case 'html5': |
|
1138 | - /** |
|
1110 | + return (boolean)preg_match( |
|
1111 | + '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . |
|
1112 | + '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
|
1113 | + '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
|
1114 | + '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
|
1115 | + '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . |
|
1116 | + '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . |
|
1117 | + '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . |
|
1118 | + '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
|
1119 | + '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
|
1120 | + $address |
|
1121 | + ); |
|
1122 | + case 'pcre': |
|
1123 | + //An older regex that doesn't need a recent PCRE |
|
1124 | + return (boolean)preg_match( |
|
1125 | + '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . |
|
1126 | + '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . |
|
1127 | + '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . |
|
1128 | + '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . |
|
1129 | + '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . |
|
1130 | + '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . |
|
1131 | + '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . |
|
1132 | + '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . |
|
1133 | + '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
|
1134 | + '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', |
|
1135 | + $address |
|
1136 | + ); |
|
1137 | + case 'html5': |
|
1138 | + /** |
|
1139 | 1139 | * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. |
1140 | 1140 | * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) |
1141 | 1141 | */ |
1142 | - return (boolean)preg_match( |
|
1143 | - '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . |
|
1144 | - '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', |
|
1145 | - $address |
|
1146 | - ); |
|
1147 | - case 'noregex': |
|
1148 | - //No PCRE! Do something _very_ approximate! |
|
1149 | - //Check the address is 3 chars or longer and contains an @ that's not the first or last char |
|
1150 | - return (strlen($address) >= 3 |
|
1151 | - and strpos($address, '@') >= 1 |
|
1152 | - and strpos($address, '@') != strlen($address) - 1); |
|
1153 | - case 'php': |
|
1154 | - default: |
|
1155 | - return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); |
|
1142 | + return (boolean)preg_match( |
|
1143 | + '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . |
|
1144 | + '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', |
|
1145 | + $address |
|
1146 | + ); |
|
1147 | + case 'noregex': |
|
1148 | + //No PCRE! Do something _very_ approximate! |
|
1149 | + //Check the address is 3 chars or longer and contains an @ that's not the first or last char |
|
1150 | + return (strlen($address) >= 3 |
|
1151 | + and strpos($address, '@') >= 1 |
|
1152 | + and strpos($address, '@') != strlen($address) - 1); |
|
1153 | + case 'php': |
|
1154 | + default: |
|
1155 | + return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1328,20 +1328,20 @@ discard block |
||
1328 | 1328 | try { |
1329 | 1329 | // Choose the mailer and send through it |
1330 | 1330 | switch ($this->Mailer) { |
1331 | - case 'sendmail': |
|
1332 | - case 'qmail': |
|
1333 | - return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); |
|
1334 | - case 'smtp': |
|
1335 | - return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); |
|
1336 | - case 'mail': |
|
1337 | - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
1338 | - default: |
|
1339 | - $sendMethod = $this->Mailer.'Send'; |
|
1340 | - if (method_exists($this, $sendMethod)) { |
|
1341 | - return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); |
|
1342 | - } |
|
1331 | + case 'sendmail': |
|
1332 | + case 'qmail': |
|
1333 | + return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); |
|
1334 | + case 'smtp': |
|
1335 | + return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); |
|
1336 | + case 'mail': |
|
1337 | + return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
1338 | + default: |
|
1339 | + $sendMethod = $this->Mailer.'Send'; |
|
1340 | + if (method_exists($this, $sendMethod)) { |
|
1341 | + return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); |
|
1342 | + } |
|
1343 | 1343 | |
1344 | - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
1344 | + return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
1345 | 1345 | } |
1346 | 1346 | } catch (phpmailerException $exc) { |
1347 | 1347 | $this->setError($exc->getMessage()); |
@@ -2003,15 +2003,15 @@ discard block |
||
2003 | 2003 | } |
2004 | 2004 | |
2005 | 2005 | switch ($this->message_type) { |
2006 | - case 'alt': |
|
2007 | - case 'alt_inline': |
|
2008 | - case 'alt_attach': |
|
2009 | - case 'alt_inline_attach': |
|
2010 | - $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); |
|
2011 | - break; |
|
2012 | - default: |
|
2013 | - $this->Body = $this->wrapText($this->Body, $this->WordWrap); |
|
2014 | - break; |
|
2006 | + case 'alt': |
|
2007 | + case 'alt_inline': |
|
2008 | + case 'alt_attach': |
|
2009 | + case 'alt_inline_attach': |
|
2010 | + $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); |
|
2011 | + break; |
|
2012 | + default: |
|
2013 | + $this->Body = $this->wrapText($this->Body, $this->WordWrap); |
|
2014 | + break; |
|
2015 | 2015 | } |
2016 | 2016 | } |
2017 | 2017 | |
@@ -2123,27 +2123,27 @@ discard block |
||
2123 | 2123 | $result = ''; |
2124 | 2124 | $ismultipart = true; |
2125 | 2125 | switch ($this->message_type) { |
2126 | - case 'inline': |
|
2127 | - $result .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2128 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2129 | - break; |
|
2130 | - case 'attach': |
|
2131 | - case 'inline_attach': |
|
2132 | - case 'alt_attach': |
|
2133 | - case 'alt_inline_attach': |
|
2134 | - $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); |
|
2135 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2136 | - break; |
|
2137 | - case 'alt': |
|
2138 | - case 'alt_inline': |
|
2139 | - $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2140 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2141 | - break; |
|
2142 | - default: |
|
2143 | - // Catches case 'plain': and case '': |
|
2144 | - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); |
|
2145 | - $ismultipart = false; |
|
2146 | - break; |
|
2126 | + case 'inline': |
|
2127 | + $result .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2128 | + $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2129 | + break; |
|
2130 | + case 'attach': |
|
2131 | + case 'inline_attach': |
|
2132 | + case 'alt_attach': |
|
2133 | + case 'alt_inline_attach': |
|
2134 | + $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); |
|
2135 | + $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2136 | + break; |
|
2137 | + case 'alt': |
|
2138 | + case 'alt_inline': |
|
2139 | + $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2140 | + $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
2141 | + break; |
|
2142 | + default: |
|
2143 | + // Catches case 'plain': and case '': |
|
2144 | + $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); |
|
2145 | + $ismultipart = false; |
|
2146 | + break; |
|
2147 | 2147 | } |
2148 | 2148 | // RFC1341 part 5 says 7bit is assumed if not specified |
2149 | 2149 | if ($this->Encoding != '7bit') { |
@@ -2238,108 +2238,108 @@ discard block |
||
2238 | 2238 | //Use this as a preamble in all multipart message types |
2239 | 2239 | $mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE; |
2240 | 2240 | switch ($this->message_type) { |
2241 | - case 'inline': |
|
2242 | - $body .= $mimepre; |
|
2243 | - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
2244 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2245 | - $body .= $this->LE . $this->LE; |
|
2246 | - $body .= $this->attachAll('inline', $this->boundary[1]); |
|
2247 | - break; |
|
2248 | - case 'attach': |
|
2249 | - $body .= $mimepre; |
|
2250 | - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
2251 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2252 | - $body .= $this->LE . $this->LE; |
|
2253 | - $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2254 | - break; |
|
2255 | - case 'inline_attach': |
|
2256 | - $body .= $mimepre; |
|
2257 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
2258 | - $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2259 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2260 | - $body .= $this->LE; |
|
2261 | - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); |
|
2262 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2263 | - $body .= $this->LE . $this->LE; |
|
2264 | - $body .= $this->attachAll('inline', $this->boundary[2]); |
|
2265 | - $body .= $this->LE; |
|
2266 | - $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2267 | - break; |
|
2268 | - case 'alt': |
|
2269 | - $body .= $mimepre; |
|
2270 | - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2271 | - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2272 | - $body .= $this->LE . $this->LE; |
|
2273 | - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2274 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2241 | + case 'inline': |
|
2242 | + $body .= $mimepre; |
|
2243 | + $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
2244 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2245 | + $body .= $this->LE . $this->LE; |
|
2246 | + $body .= $this->attachAll('inline', $this->boundary[1]); |
|
2247 | + break; |
|
2248 | + case 'attach': |
|
2249 | + $body .= $mimepre; |
|
2250 | + $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
2251 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2252 | + $body .= $this->LE . $this->LE; |
|
2253 | + $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2254 | + break; |
|
2255 | + case 'inline_attach': |
|
2256 | + $body .= $mimepre; |
|
2257 | + $body .= $this->textLine('--' . $this->boundary[1]); |
|
2258 | + $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2259 | + $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2260 | + $body .= $this->LE; |
|
2261 | + $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); |
|
2262 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2263 | + $body .= $this->LE . $this->LE; |
|
2264 | + $body .= $this->attachAll('inline', $this->boundary[2]); |
|
2265 | + $body .= $this->LE; |
|
2266 | + $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2267 | + break; |
|
2268 | + case 'alt': |
|
2269 | + $body .= $mimepre; |
|
2270 | + $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2271 | + $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2272 | + $body .= $this->LE . $this->LE; |
|
2273 | + $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2274 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2275 | + $body .= $this->LE . $this->LE; |
|
2276 | + if (!empty($this->Ical)) { |
|
2277 | + $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); |
|
2278 | + $body .= $this->encodeString($this->Ical, $this->Encoding); |
|
2275 | 2279 | $body .= $this->LE . $this->LE; |
2276 | - if (!empty($this->Ical)) { |
|
2277 | - $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); |
|
2278 | - $body .= $this->encodeString($this->Ical, $this->Encoding); |
|
2279 | - $body .= $this->LE . $this->LE; |
|
2280 | - } |
|
2281 | - $body .= $this->endBoundary($this->boundary[1]); |
|
2282 | - break; |
|
2283 | - case 'alt_inline': |
|
2284 | - $body .= $mimepre; |
|
2285 | - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2286 | - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2287 | - $body .= $this->LE . $this->LE; |
|
2288 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
2289 | - $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2290 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2291 | - $body .= $this->LE; |
|
2292 | - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2293 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2294 | - $body .= $this->LE . $this->LE; |
|
2295 | - $body .= $this->attachAll('inline', $this->boundary[2]); |
|
2296 | - $body .= $this->LE; |
|
2297 | - $body .= $this->endBoundary($this->boundary[1]); |
|
2298 | - break; |
|
2299 | - case 'alt_attach': |
|
2300 | - $body .= $mimepre; |
|
2301 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
2302 | - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2303 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2304 | - $body .= $this->LE; |
|
2305 | - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2306 | - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2307 | - $body .= $this->LE . $this->LE; |
|
2308 | - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2309 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2310 | - $body .= $this->LE . $this->LE; |
|
2311 | - $body .= $this->endBoundary($this->boundary[2]); |
|
2312 | - $body .= $this->LE; |
|
2313 | - $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2314 | - break; |
|
2315 | - case 'alt_inline_attach': |
|
2316 | - $body .= $mimepre; |
|
2317 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
2318 | - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2319 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2320 | - $body .= $this->LE; |
|
2321 | - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2322 | - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2323 | - $body .= $this->LE . $this->LE; |
|
2324 | - $body .= $this->textLine('--' . $this->boundary[2]); |
|
2325 | - $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2326 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); |
|
2327 | - $body .= $this->LE; |
|
2328 | - $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2329 | - $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2330 | - $body .= $this->LE . $this->LE; |
|
2331 | - $body .= $this->attachAll('inline', $this->boundary[3]); |
|
2332 | - $body .= $this->LE; |
|
2333 | - $body .= $this->endBoundary($this->boundary[2]); |
|
2334 | - $body .= $this->LE; |
|
2335 | - $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2336 | - break; |
|
2337 | - default: |
|
2338 | - // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types |
|
2339 | - //Reset the `Encoding` property in case we changed it for line length reasons |
|
2340 | - $this->Encoding = $bodyEncoding; |
|
2341 | - $body .= $this->encodeString($this->Body, $this->Encoding); |
|
2342 | - break; |
|
2280 | + } |
|
2281 | + $body .= $this->endBoundary($this->boundary[1]); |
|
2282 | + break; |
|
2283 | + case 'alt_inline': |
|
2284 | + $body .= $mimepre; |
|
2285 | + $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2286 | + $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2287 | + $body .= $this->LE . $this->LE; |
|
2288 | + $body .= $this->textLine('--' . $this->boundary[1]); |
|
2289 | + $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2290 | + $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2291 | + $body .= $this->LE; |
|
2292 | + $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2293 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2294 | + $body .= $this->LE . $this->LE; |
|
2295 | + $body .= $this->attachAll('inline', $this->boundary[2]); |
|
2296 | + $body .= $this->LE; |
|
2297 | + $body .= $this->endBoundary($this->boundary[1]); |
|
2298 | + break; |
|
2299 | + case 'alt_attach': |
|
2300 | + $body .= $mimepre; |
|
2301 | + $body .= $this->textLine('--' . $this->boundary[1]); |
|
2302 | + $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2303 | + $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2304 | + $body .= $this->LE; |
|
2305 | + $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2306 | + $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2307 | + $body .= $this->LE . $this->LE; |
|
2308 | + $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2309 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2310 | + $body .= $this->LE . $this->LE; |
|
2311 | + $body .= $this->endBoundary($this->boundary[2]); |
|
2312 | + $body .= $this->LE; |
|
2313 | + $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2314 | + break; |
|
2315 | + case 'alt_inline_attach': |
|
2316 | + $body .= $mimepre; |
|
2317 | + $body .= $this->textLine('--' . $this->boundary[1]); |
|
2318 | + $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
|
2319 | + $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
2320 | + $body .= $this->LE; |
|
2321 | + $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
2322 | + $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
2323 | + $body .= $this->LE . $this->LE; |
|
2324 | + $body .= $this->textLine('--' . $this->boundary[2]); |
|
2325 | + $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
|
2326 | + $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); |
|
2327 | + $body .= $this->LE; |
|
2328 | + $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); |
|
2329 | + $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
2330 | + $body .= $this->LE . $this->LE; |
|
2331 | + $body .= $this->attachAll('inline', $this->boundary[3]); |
|
2332 | + $body .= $this->LE; |
|
2333 | + $body .= $this->endBoundary($this->boundary[2]); |
|
2334 | + $body .= $this->LE; |
|
2335 | + $body .= $this->attachAll('attachment', $this->boundary[1]); |
|
2336 | + break; |
|
2337 | + default: |
|
2338 | + // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types |
|
2339 | + //Reset the `Encoding` property in case we changed it for line length reasons |
|
2340 | + $this->Encoding = $bodyEncoding; |
|
2341 | + $body .= $this->encodeString($this->Body, $this->Encoding); |
|
2342 | + break; |
|
2343 | 2343 | } |
2344 | 2344 | |
2345 | 2345 | if ($this->isError()) { |
@@ -2727,26 +2727,26 @@ discard block |
||
2727 | 2727 | { |
2728 | 2728 | $encoded = ''; |
2729 | 2729 | switch (strtolower($encoding)) { |
2730 | - case 'base64': |
|
2731 | - $encoded = chunk_split(base64_encode($str), 76, $this->LE); |
|
2732 | - break; |
|
2733 | - case '7bit': |
|
2734 | - case '8bit': |
|
2735 | - $encoded = $this->fixEOL($str); |
|
2736 | - // Make sure it ends with a line break |
|
2737 | - if (substr($encoded, -(strlen($this->LE))) != $this->LE) { |
|
2738 | - $encoded .= $this->LE; |
|
2739 | - } |
|
2740 | - break; |
|
2741 | - case 'binary': |
|
2742 | - $encoded = $str; |
|
2743 | - break; |
|
2744 | - case 'quoted-printable': |
|
2745 | - $encoded = $this->encodeQP($str); |
|
2746 | - break; |
|
2747 | - default: |
|
2748 | - $this->setError($this->lang('encoding') . $encoding); |
|
2749 | - break; |
|
2730 | + case 'base64': |
|
2731 | + $encoded = chunk_split(base64_encode($str), 76, $this->LE); |
|
2732 | + break; |
|
2733 | + case '7bit': |
|
2734 | + case '8bit': |
|
2735 | + $encoded = $this->fixEOL($str); |
|
2736 | + // Make sure it ends with a line break |
|
2737 | + if (substr($encoded, -(strlen($this->LE))) != $this->LE) { |
|
2738 | + $encoded .= $this->LE; |
|
2739 | + } |
|
2740 | + break; |
|
2741 | + case 'binary': |
|
2742 | + $encoded = $str; |
|
2743 | + break; |
|
2744 | + case 'quoted-printable': |
|
2745 | + $encoded = $this->encodeQP($str); |
|
2746 | + break; |
|
2747 | + default: |
|
2748 | + $this->setError($this->lang('encoding') . $encoding); |
|
2749 | + break; |
|
2750 | 2750 | } |
2751 | 2751 | return $encoded; |
2752 | 2752 | } |
@@ -2763,26 +2763,26 @@ discard block |
||
2763 | 2763 | { |
2764 | 2764 | $matchcount = 0; |
2765 | 2765 | switch (strtolower($position)) { |
2766 | - case 'phrase': |
|
2767 | - if (!preg_match('/[\200-\377]/', $str)) { |
|
2768 | - // Can't use addslashes as we don't know the value of magic_quotes_sybase |
|
2769 | - $encoded = addcslashes($str, "\0..\37\177\\\""); |
|
2770 | - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { |
|
2771 | - return ($encoded); |
|
2772 | - } else { |
|
2773 | - return ("\"$encoded\""); |
|
2774 | - } |
|
2766 | + case 'phrase': |
|
2767 | + if (!preg_match('/[\200-\377]/', $str)) { |
|
2768 | + // Can't use addslashes as we don't know the value of magic_quotes_sybase |
|
2769 | + $encoded = addcslashes($str, "\0..\37\177\\\""); |
|
2770 | + if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { |
|
2771 | + return ($encoded); |
|
2772 | + } else { |
|
2773 | + return ("\"$encoded\""); |
|
2775 | 2774 | } |
2776 | - $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); |
|
2777 | - break; |
|
2778 | - /** @noinspection PhpMissingBreakStatementInspection */ |
|
2779 | - case 'comment': |
|
2780 | - $matchcount = preg_match_all('/[()"]/', $str, $matches); |
|
2781 | - // Intentional fall-through |
|
2782 | - case 'text': |
|
2783 | - default: |
|
2784 | - $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); |
|
2785 | - break; |
|
2775 | + } |
|
2776 | + $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); |
|
2777 | + break; |
|
2778 | + /** @noinspection PhpMissingBreakStatementInspection */ |
|
2779 | + case 'comment': |
|
2780 | + $matchcount = preg_match_all('/[()"]/', $str, $matches); |
|
2781 | + // Intentional fall-through |
|
2782 | + case 'text': |
|
2783 | + default: |
|
2784 | + $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); |
|
2785 | + break; |
|
2786 | 2786 | } |
2787 | 2787 | |
2788 | 2788 | //There are no chars that need encoding |
@@ -2941,22 +2941,22 @@ discard block |
||
2941 | 2941 | $pattern = ''; |
2942 | 2942 | $encoded = str_replace(array("\r", "\n"), '', $str); |
2943 | 2943 | switch (strtolower($position)) { |
2944 | - case 'phrase': |
|
2945 | - // RFC 2047 section 5.3 |
|
2946 | - $pattern = '^A-Za-z0-9!*+\/ -'; |
|
2947 | - break; |
|
2948 | - /** @noinspection PhpMissingBreakStatementInspection */ |
|
2949 | - case 'comment': |
|
2950 | - // RFC 2047 section 5.2 |
|
2951 | - $pattern = '\(\)"'; |
|
2952 | - // intentional fall-through |
|
2953 | - // for this reason we build the $pattern without including delimiters and [] |
|
2954 | - case 'text': |
|
2955 | - default: |
|
2956 | - // RFC 2047 section 5.1 |
|
2957 | - // Replace every high ascii, control, =, ? and _ characters |
|
2958 | - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; |
|
2959 | - break; |
|
2944 | + case 'phrase': |
|
2945 | + // RFC 2047 section 5.3 |
|
2946 | + $pattern = '^A-Za-z0-9!*+\/ -'; |
|
2947 | + break; |
|
2948 | + /** @noinspection PhpMissingBreakStatementInspection */ |
|
2949 | + case 'comment': |
|
2950 | + // RFC 2047 section 5.2 |
|
2951 | + $pattern = '\(\)"'; |
|
2952 | + // intentional fall-through |
|
2953 | + // for this reason we build the $pattern without including delimiters and [] |
|
2954 | + case 'text': |
|
2955 | + default: |
|
2956 | + // RFC 2047 section 5.1 |
|
2957 | + // Replace every high ascii, control, =, ? and _ characters |
|
2958 | + $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; |
|
2959 | + break; |
|
2960 | 2960 | } |
2961 | 2961 | $matches = array(); |
2962 | 2962 | if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { |
@@ -3649,20 +3649,20 @@ discard block |
||
3649 | 3649 | } |
3650 | 3650 | } |
3651 | 3651 | switch ($options) { |
3652 | - case PATHINFO_DIRNAME: |
|
3653 | - case 'dirname': |
|
3654 | - return $ret['dirname']; |
|
3655 | - case PATHINFO_BASENAME: |
|
3656 | - case 'basename': |
|
3657 | - return $ret['basename']; |
|
3658 | - case PATHINFO_EXTENSION: |
|
3659 | - case 'extension': |
|
3660 | - return $ret['extension']; |
|
3661 | - case PATHINFO_FILENAME: |
|
3662 | - case 'filename': |
|
3663 | - return $ret['filename']; |
|
3664 | - default: |
|
3665 | - return $ret; |
|
3652 | + case PATHINFO_DIRNAME: |
|
3653 | + case 'dirname': |
|
3654 | + return $ret['dirname']; |
|
3655 | + case PATHINFO_BASENAME: |
|
3656 | + case 'basename': |
|
3657 | + return $ret['basename']; |
|
3658 | + case PATHINFO_EXTENSION: |
|
3659 | + case 'extension': |
|
3660 | + return $ret['extension']; |
|
3661 | + case PATHINFO_FILENAME: |
|
3662 | + case 'filename': |
|
3663 | + return $ret['filename']; |
|
3664 | + default: |
|
3665 | + return $ret; |
|
3666 | 3666 | } |
3667 | 3667 | } |
3668 | 3668 |