Guest User

Untitled

a guest
Jan 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. foreach ($parts[$i]->dparameters as $object) {
  2. if (strtolower($object->attribute) == 'filename') {
  3. $file = $object->value;
  4. $filename = pathinfo($file, PATHINFO_FILENAME);
  5. $ext = pathinfo($file, PATHINFO_EXTENSION);
  6. $dst = 'files'. '/' . $filename . "." . $ext;
  7.  
  8. /* don't overwrite */
  9. if (!file_exists($dst)) {
  10. $fp = fopen($dst, 'w');
  11. $body = imap_fetchbody($mbox, imap_msgno($mbox, $id), $fpos);
  12. $data = $this->get_decode_value($body, $object->type);
  13. fputs($fp, $data);
  14. fclose($fp);
  15. }
  16. }
  17.  
  18. object(stdClass)#276 (11) {
  19. ["type"] =>
  20. int(1)
  21. ["encoding"] =>
  22. int(0)
  23. ["ifsubtype"] =>
  24. int(1)
  25. ["subtype"] =>
  26. string(7) "RELATED"
  27. ["ifdescription"] =>
  28. int(0)
  29. ["ifid"] =>
  30. int(0)
  31. ["ifdisposition"] =>
  32. int(0)
  33. ["ifdparameters"] =>
  34. int(0)
  35. ["ifparameters"] =>
  36. int(1)
  37. ["parameters"] =>
  38. array(1) {
  39. [0] =>
  40. object(stdClass)#275 (2) {
  41. ["attribute"] =>
  42. string(8) "boundary"
  43. ["value"] =>
  44. string(36) "------------06304D14834AD529353E49FD"
  45. }
  46. }
  47. ["parts"] =>
  48. array(2) {
  49. [0] =>
  50. object(stdClass)#274 (12) {
  51. ["type"] =>
  52. int(0)
  53. ["encoding"] =>
  54. int(1)
  55. ["ifsubtype"] =>
  56. int(1)
  57. ["subtype"] =>
  58. string(4) "HTML"
  59. ["ifdescription"] =>
  60. int(0)
  61. ["ifid"] =>
  62. int(0)
  63. ["lines"] =>
  64. int(18)
  65. ["bytes"] =>
  66. int(487)
  67. ["ifdisposition"] =>
  68. int(0)
  69. ["ifdparameters"] =>
  70. int(0)
  71. ["ifparameters"] =>
  72. int(1)
  73. ["parameters"] =>
  74. array(1) {
  75. [0] =>
  76. object(stdClass)#273 (2) {
  77. ["attribute"] =>
  78. string(7) "charset"
  79. ["value"] =>
  80. string(5) "utf-8"
  81. }
  82. }
  83. }
  84. [1] =>
  85. object(stdClass)#272 (14) {
  86. ["type"] =>
  87. int(5)
  88. ["encoding"] =>
  89. int(3)
  90. ["ifsubtype"] =>
  91. int(1)
  92. ["subtype"] =>
  93. string(4) "JPEG"
  94. ["ifdescription"] =>
  95. int(0)
  96. ["ifid"] =>
  97. int(1)
  98. ["id"] =>
  99. string(37) ""
  100. ["bytes"] =>
  101. int(171440)
  102. ["ifdisposition"] =>
  103. int(1)
  104. ["disposition"] =>
  105. string(6) "inline"
  106. ["ifdparameters"] =>
  107. int(1)
  108. ["dparameters"] =>
  109. array(1) {
  110. [0] =>
  111. object(stdClass)#271 (2) {
  112. ["attribute"] =>
  113. string(8) "filename"
  114. ["value"] =>
  115. string(21) "revised8 10.43.39.jpg"
  116. }
  117. }
  118. ["ifparameters"] =>
  119. int(1)
  120. ["parameters"] =>
  121. array(1) {
  122. [0] =>
  123. object(stdClass)#270 (2) {
  124. ["attribute"] =>
  125. string(4) "name"
  126. ["value"] =>
  127. string(21) "revised8 10.43.39.jpg"
  128. }
  129. }
  130. }
  131. }
  132. }
Add Comment
Please, Sign In to add comment