Postie - Version 1.5.23

Version Description

(2014.08.11) = * Remove PEAR/PEAR5 dependency which was causing errors on some systems * Call wp_handle_upload_prefilter before adding images to WP * Temporary new post is now draft status.

Download this release

Release Info

Developer WayneAllen
Plugin Icon 128x128 Postie
Version 1.5.23
Comparing to
See all releases

Code changes from version 1.5.22 to 1.5.23

Files changed (13) hide show
  1. PEAR.php +0 -1129
  2. PEAR5.php +0 -33
  3. Revision +0 -2
  4. config_form.php +4 -0
  5. docs/Changes.txt +5 -0
  6. docs/Postie.txt +1 -1
  7. docs/TODO.txt +14 -0
  8. mimedecode.php +8 -15
  9. package.xml +0 -438
  10. postie-functions.php +24 -19
  11. postie.php +3 -3
  12. readme.html +2 -3
  13. readme.txt +6 -1
PEAR.php DELETED
@@ -1,1129 +0,0 @@
1
- <?php
2
- /**
3
- * PEAR, the PHP Extension and Application Repository
4
- *
5
- * PEAR class and PEAR_Error class
6
- *
7
- * PHP versions 4 and 5
8
- *
9
- * @category pear
10
- * @package PEAR
11
- * @author Sterling Hughes <sterling@php.net>
12
- * @author Stig Bakken <ssb@php.net>
13
- * @author Tomas V.V.Cox <cox@idecnet.com>
14
- * @author Greg Beaver <cellog@php.net>
15
- * @copyright 1997-2009 The Authors
16
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
17
- * @version CVS: $Id: PEAR.php,v 1.112 2009/04/15 04:05:13 dufuz Exp $
18
- * @link http://pear.php.net/package/PEAR
19
- * @since File available since Release 0.1
20
- */
21
-
22
- /**#@+
23
- * ERROR constants
24
- */
25
- define('PEAR_ERROR_RETURN', 1);
26
- define('PEAR_ERROR_PRINT', 2);
27
- define('PEAR_ERROR_TRIGGER', 4);
28
- define('PEAR_ERROR_DIE', 8);
29
- define('PEAR_ERROR_CALLBACK', 16);
30
- /**
31
- * WARNING: obsolete
32
- * @deprecated
33
- */
34
- define('PEAR_ERROR_EXCEPTION', 32);
35
- /**#@-*/
36
- define('PEAR_ZE2', (function_exists('version_compare') &&
37
- version_compare(zend_version(), "2-dev", "ge")));
38
-
39
- if (substr(PHP_OS, 0, 3) == 'WIN') {
40
- define('OS_WINDOWS', true);
41
- define('OS_UNIX', false);
42
- define('PEAR_OS', 'Windows');
43
- } else {
44
- define('OS_WINDOWS', false);
45
- define('OS_UNIX', true);
46
- define('PEAR_OS', 'Unix'); // blatant assumption
47
- }
48
-
49
- $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
50
- $GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
51
- $GLOBALS['_PEAR_destructor_object_list'] = array();
52
- $GLOBALS['_PEAR_shutdown_funcs'] = array();
53
- $GLOBALS['_PEAR_error_handler_stack'] = array();
54
-
55
- @ini_set('track_errors', true);
56
-
57
- /**
58
- * Base class for other PEAR classes. Provides rudimentary
59
- * emulation of destructors.
60
- *
61
- * If you want a destructor in your class, inherit PEAR and make a
62
- * destructor method called _yourclassname (same name as the
63
- * constructor, but with a "_" prefix). Also, in your constructor you
64
- * have to call the PEAR constructor: $this->PEAR();.
65
- * The destructor method will be called without parameters. Note that
66
- * at in some SAPI implementations (such as Apache), any output during
67
- * the request shutdown (in which destructors are called) seems to be
68
- * discarded. If you need to get any debug information from your
69
- * destructor, use error_log(), syslog() or something similar.
70
- *
71
- * IMPORTANT! To use the emulated destructors you need to create the
72
- * objects by reference: $obj =& new PEAR_child;
73
- *
74
- * @category pear
75
- * @package PEAR
76
- * @author Stig Bakken <ssb@php.net>
77
- * @author Tomas V.V. Cox <cox@idecnet.com>
78
- * @author Greg Beaver <cellog@php.net>
79
- * @copyright 1997-2006 The PHP Group
80
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
81
- * @version Release: 1.8.1
82
- * @link http://pear.php.net/package/PEAR
83
- * @see PEAR_Error
84
- * @since Class available since PHP 4.0.2
85
- * @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear
86
- */
87
- class PEAR
88
- {
89
- // {{{ properties
90
-
91
- /**
92
- * Whether to enable internal debug messages.
93
- *
94
- * @var bool
95
- * @access private
96
- */
97
- var $_debug = false;
98
-
99
- /**
100
- * Default error mode for this object.
101
- *
102
- * @var int
103
- * @access private
104
- */
105
- var $_default_error_mode = null;
106
-
107
- /**
108
- * Default error options used for this object when error mode
109
- * is PEAR_ERROR_TRIGGER.
110
- *
111
- * @var int
112
- * @access private
113
- */
114
- var $_default_error_options = null;
115
-
116
- /**
117
- * Default error handler (callback) for this object, if error mode is
118
- * PEAR_ERROR_CALLBACK.
119
- *
120
- * @var string
121
- * @access private
122
- */
123
- var $_default_error_handler = '';
124
-
125
- /**
126
- * Which class to use for error objects.
127
- *
128
- * @var string
129
- * @access private
130
- */
131
- var $_error_class = 'PEAR_Error';
132
-
133
- /**
134
- * An array of expected errors.
135
- *
136
- * @var array
137
- * @access private
138
- */
139
- var $_expected_errors = array();
140
-
141
- // }}}
142
-
143
- // {{{ constructor
144
-
145
- /**
146
- * Constructor. Registers this object in
147
- * $_PEAR_destructor_object_list for destructor emulation if a
148
- * destructor object exists.
149
- *
150
- * @param string $error_class (optional) which class to use for
151
- * error objects, defaults to PEAR_Error.
152
- * @access public
153
- * @return void
154
- */
155
- function PEAR($error_class = null)
156
- {
157
- $classname = strtolower(get_class($this));
158
- if ($this->_debug) {
159
- print "PEAR constructor called, class=$classname\n";
160
- }
161
- if ($error_class !== null) {
162
- $this->_error_class = $error_class;
163
- }
164
- while ($classname && strcasecmp($classname, "pear")) {
165
- $destructor = "_$classname";
166
- if (method_exists($this, $destructor)) {
167
- global $_PEAR_destructor_object_list;
168
- $_PEAR_destructor_object_list[] = &$this;
169
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
170
- register_shutdown_function("_PEAR_call_destructors");
171
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
172
- }
173
- break;
174
- } else {
175
- $classname = get_parent_class($classname);
176
- }
177
- }
178
- }
179
-
180
- // }}}
181
- // {{{ destructor
182
-
183
- /**
184
- * Destructor (the emulated type of...). Does nothing right now,
185
- * but is included for forward compatibility, so subclass
186
- * destructors should always call it.
187
- *
188
- * See the note in the class desciption about output from
189
- * destructors.
190
- *
191
- * @access public
192
- * @return void
193
- */
194
- function _PEAR() {
195
- if ($this->_debug) {
196
- printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
197
- }
198
- }
199
-
200
- // }}}
201
- // {{{ getStaticProperty()
202
-
203
- /**
204
- * If you have a class that's mostly/entirely static, and you need static
205
- * properties, you can use this method to simulate them. Eg. in your method(s)
206
- * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
207
- * You MUST use a reference, or they will not persist!
208
- *
209
- * @access public
210
- * @param string $class The calling classname, to prevent clashes
211
- * @param string $var The variable to retrieve.
212
- * @return mixed A reference to the variable. If not set it will be
213
- * auto initialised to NULL.
214
- */
215
- function &getStaticProperty($class, $var)
216
- {
217
- static $properties;
218
- if (!isset($properties[$class])) {
219
- $properties[$class] = array();
220
- }
221
-
222
- if (!array_key_exists($var, $properties[$class])) {
223
- $properties[$class][$var] = null;
224
- }
225
-
226
- return $properties[$class][$var];
227
- }
228
-
229
- // }}}
230
- // {{{ registerShutdownFunc()
231
-
232
- /**
233
- * Use this function to register a shutdown method for static
234
- * classes.
235
- *
236
- * @access public
237
- * @param mixed $func The function name (or array of class/method) to call
238
- * @param mixed $args The arguments to pass to the function
239
- * @return void
240
- */
241
- function registerShutdownFunc($func, $args = array())
242
- {
243
- // if we are called statically, there is a potential
244
- // that no shutdown func is registered. Bug #6445
245
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
246
- register_shutdown_function("_PEAR_call_destructors");
247
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
248
- }
249
- $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
250
- }
251
-
252
- // }}}
253
- // {{{ isError()
254
-
255
- /**
256
- * Tell whether a value is a PEAR error.
257
- *
258
- * @param mixed $data the value to test
259
- * @param int $code if $data is an error object, return true
260
- * only if $code is a string and
261
- * $obj->getMessage() == $code or
262
- * $code is an integer and $obj->getCode() == $code
263
- * @access public
264
- * @return bool true if parameter is an error
265
- */
266
- function isError($data, $code = null)
267
- {
268
- if (!is_a($data, 'PEAR_Error')) {
269
- return false;
270
- }
271
-
272
- if (is_null($code)) {
273
- return true;
274
- } elseif (is_string($code)) {
275
- return $data->getMessage() == $code;
276
- }
277
-
278
- return $data->getCode() == $code;
279
- }
280
-
281
- // }}}
282
- // {{{ setErrorHandling()
283
-
284
- /**
285
- * Sets how errors generated by this object should be handled.
286
- * Can be invoked both in objects and statically. If called
287
- * statically, setErrorHandling sets the default behaviour for all
288
- * PEAR objects. If called in an object, setErrorHandling sets
289
- * the default behaviour for that object.
290
- *
291
- * @param int $mode
292
- * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
293
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
294
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
295
- *
296
- * @param mixed $options
297
- * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
298
- * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
299
- *
300
- * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
301
- * to be the callback function or method. A callback
302
- * function is a string with the name of the function, a
303
- * callback method is an array of two elements: the element
304
- * at index 0 is the object, and the element at index 1 is
305
- * the name of the method to call in the object.
306
- *
307
- * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
308
- * a printf format string used when printing the error
309
- * message.
310
- *
311
- * @access public
312
- * @return void
313
- * @see PEAR_ERROR_RETURN
314
- * @see PEAR_ERROR_PRINT
315
- * @see PEAR_ERROR_TRIGGER
316
- * @see PEAR_ERROR_DIE
317
- * @see PEAR_ERROR_CALLBACK
318
- * @see PEAR_ERROR_EXCEPTION
319
- *
320
- * @since PHP 4.0.5
321
- */
322
-
323
- function setErrorHandling($mode = null, $options = null)
324
- {
325
- if (isset($this) && is_a($this, 'PEAR')) {
326
- $setmode = &$this->_default_error_mode;
327
- $setoptions = &$this->_default_error_options;
328
- } else {
329
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
330
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
331
- }
332
-
333
- switch ($mode) {
334
- case PEAR_ERROR_EXCEPTION:
335
- case PEAR_ERROR_RETURN:
336
- case PEAR_ERROR_PRINT:
337
- case PEAR_ERROR_TRIGGER:
338
- case PEAR_ERROR_DIE:
339
- case null:
340
- $setmode = $mode;
341
- $setoptions = $options;
342
- break;
343
-
344
- case PEAR_ERROR_CALLBACK:
345
- $setmode = $mode;
346
- // class/object method callback
347
- if (is_callable($options)) {
348
- $setoptions = $options;
349
- } else {
350
- trigger_error("invalid error callback", E_USER_WARNING);
351
- }
352
- break;
353
-
354
- default:
355
- trigger_error("invalid error mode", E_USER_WARNING);
356
- break;
357
- }
358
- }
359
-
360
- // }}}
361
- // {{{ expectError()
362
-
363
- /**
364
- * This method is used to tell which errors you expect to get.
365
- * Expected errors are always returned with error mode
366
- * PEAR_ERROR_RETURN. Expected error codes are stored in a stack,
367
- * and this method pushes a new element onto it. The list of
368
- * expected errors are in effect until they are popped off the
369
- * stack with the popExpect() method.
370
- *
371
- * Note that this method can not be called statically
372
- *
373
- * @param mixed $code a single error code or an array of error codes to expect
374
- *
375
- * @return int the new depth of the "expected errors" stack
376
- * @access public
377
- */
378
- function expectError($code = '*')
379
- {
380
- if (is_array($code)) {
381
- array_push($this->_expected_errors, $code);
382
- } else {
383
- array_push($this->_expected_errors, array($code));
384
- }
385
- return sizeof($this->_expected_errors);
386
- }
387
-
388
- // }}}
389
- // {{{ popExpect()
390
-
391
- /**
392
- * This method pops one element off the expected error codes
393
- * stack.
394
- *
395
- * @return array the list of error codes that were popped
396
- */
397
- function popExpect()
398
- {
399
- return array_pop($this->_expected_errors);
400
- }
401
-
402
- // }}}
403
- // {{{ _checkDelExpect()
404
-
405
- /**
406
- * This method checks unsets an error code if available
407
- *
408
- * @param mixed error code
409
- * @return bool true if the error code was unset, false otherwise
410
- * @access private
411
- * @since PHP 4.3.0
412
- */
413
- function _checkDelExpect($error_code)
414
- {
415
- $deleted = false;
416
-
417
- foreach ($this->_expected_errors AS $key => $error_array) {
418
- if (in_array($error_code, $error_array)) {
419
- unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
420
- $deleted = true;
421
- }
422
-
423
- // clean up empty arrays
424
- if (0 == count($this->_expected_errors[$key])) {
425
- unset($this->_expected_errors[$key]);
426
- }
427
- }
428
- return $deleted;
429
- }
430
-
431
- // }}}
432
- // {{{ delExpect()
433
-
434
- /**
435
- * This method deletes all occurences of the specified element from
436
- * the expected error codes stack.
437
- *
438
- * @param mixed $error_code error code that should be deleted
439
- * @return mixed list of error codes that were deleted or error
440
- * @access public
441
- * @since PHP 4.3.0
442
- */
443
- function delExpect($error_code)
444
- {
445
- $deleted = false;
446
- if ((is_array($error_code) && (0 != count($error_code)))) {
447
- // $error_code is a non-empty array here;
448
- // we walk through it trying to unset all
449
- // values
450
- foreach($error_code as $key => $error) {
451
- if ($this->_checkDelExpect($error)) {
452
- $deleted = true;
453
- } else {
454
- $deleted = false;
455
- }
456
- }
457
- return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
458
- } elseif (!empty($error_code)) {
459
- // $error_code comes alone, trying to unset it
460
- if ($this->_checkDelExpect($error_code)) {
461
- return true;
462
- } else {
463
- return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
464
- }
465
- }
466
-
467
- // $error_code is empty
468
- return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
469
- }
470
-
471
- // }}}
472
- // {{{ raiseError()
473
-
474
- /**
475
- * This method is a wrapper that returns an instance of the
476
- * configured error class with this object's default error
477
- * handling applied. If the $mode and $options parameters are not
478
- * specified, the object's defaults are used.
479
- *
480
- * @param mixed $message a text error message or a PEAR error object
481
- *
482
- * @param int $code a numeric error code (it is up to your class
483
- * to define these if you want to use codes)
484
- *
485
- * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
486
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
487
- * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
488
- *
489
- * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
490
- * specifies the PHP-internal error level (one of
491
- * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
492
- * If $mode is PEAR_ERROR_CALLBACK, this
493
- * parameter specifies the callback function or
494
- * method. In other error modes this parameter
495
- * is ignored.
496
- *
497
- * @param string $userinfo If you need to pass along for example debug
498
- * information, this parameter is meant for that.
499
- *
500
- * @param string $error_class The returned error object will be
501
- * instantiated from this class, if specified.
502
- *
503
- * @param bool $skipmsg If true, raiseError will only pass error codes,
504
- * the error message parameter will be dropped.
505
- *
506
- * @access public
507
- * @return object a PEAR error object
508
- * @see PEAR::setErrorHandling
509
- * @since PHP 4.0.5
510
- */
511
- function &raiseError($message = null,
512
- $code = null,
513
- $mode = null,
514
- $options = null,
515
- $userinfo = null,
516
- $error_class = null,
517
- $skipmsg = false)
518
- {
519
- // The error is yet a PEAR error object
520
- if (is_object($message)) {
521
- $code = $message->getCode();
522
- $userinfo = $message->getUserInfo();
523
- $error_class = $message->getType();
524
- $message->error_message_prefix = '';
525
- $message = $message->getMessage();
526
- }
527
-
528
- if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
529
- if ($exp[0] == "*" ||
530
- (is_int(reset($exp)) && in_array($code, $exp)) ||
531
- (is_string(reset($exp)) && in_array($message, $exp))) {
532
- $mode = PEAR_ERROR_RETURN;
533
- }
534
- }
535
-
536
- // No mode given, try global ones
537
- if ($mode === null) {
538
- // Class error handler
539
- if (isset($this) && isset($this->_default_error_mode)) {
540
- $mode = $this->_default_error_mode;
541
- $options = $this->_default_error_options;
542
- // Global error handler
543
- } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
544
- $mode = $GLOBALS['_PEAR_default_error_mode'];
545
- $options = $GLOBALS['_PEAR_default_error_options'];
546
- }
547
- }
548
-
549
- if ($error_class !== null) {
550
- $ec = $error_class;
551
- } elseif (isset($this) && isset($this->_error_class)) {
552
- $ec = $this->_error_class;
553
- } else {
554
- $ec = 'PEAR_Error';
555
- }
556
-
557
- if (intval(PHP_VERSION) < 5) {
558
- // little non-eval hack to fix bug #12147
559
- include 'PEAR/FixPHP5PEARWarnings.php';
560
- return $a;
561
- }
562
-
563
- if ($skipmsg) {
564
- $a = new $ec($code, $mode, $options, $userinfo);
565
- } else {
566
- $a = new $ec($message, $code, $mode, $options, $userinfo);
567
- }
568
-
569
- return $a;
570
- }
571
-
572
- // }}}
573
- // {{{ throwError()
574
-
575
- /**
576
- * Simpler form of raiseError with fewer options. In most cases
577
- * message, code and userinfo are enough.
578
- *
579
- * @param string $message
580
- *
581
- */
582
- function &throwError($message = null,
583
- $code = null,
584
- $userinfo = null)
585
- {
586
- if (isset($this) && is_a($this, 'PEAR')) {
587
- $a = &$this->raiseError($message, $code, null, null, $userinfo);
588
- return $a;
589
- }
590
-
591
- $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
592
- return $a;
593
- }
594
-
595
- // }}}
596
- function staticPushErrorHandling($mode, $options = null)
597
- {
598
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
599
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
600
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
601
- $stack[] = array($def_mode, $def_options);
602
- switch ($mode) {
603
- case PEAR_ERROR_EXCEPTION:
604
- case PEAR_ERROR_RETURN:
605
- case PEAR_ERROR_PRINT:
606
- case PEAR_ERROR_TRIGGER:
607
- case PEAR_ERROR_DIE:
608
- case null:
609
- $def_mode = $mode;
610
- $def_options = $options;
611
- break;
612
-
613
- case PEAR_ERROR_CALLBACK:
614
- $def_mode = $mode;
615
- // class/object method callback
616
- if (is_callable($options)) {
617
- $def_options = $options;
618
- } else {
619
- trigger_error("invalid error callback", E_USER_WARNING);
620
- }
621
- break;
622
-
623
- default:
624
- trigger_error("invalid error mode", E_USER_WARNING);
625
- break;
626
- }
627
- $stack[] = array($mode, $options);
628
- return true;
629
- }
630
-
631
- function staticPopErrorHandling()
632
- {
633
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
634
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
635
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
636
- array_pop($stack);
637
- list($mode, $options) = $stack[sizeof($stack) - 1];
638
- array_pop($stack);
639
- switch ($mode) {
640
- case PEAR_ERROR_EXCEPTION:
641
- case PEAR_ERROR_RETURN:
642
- case PEAR_ERROR_PRINT:
643
- case PEAR_ERROR_TRIGGER:
644
- case PEAR_ERROR_DIE:
645
- case null:
646
- $setmode = $mode;
647
- $setoptions = $options;
648
- break;
649
-
650
- case PEAR_ERROR_CALLBACK:
651
- $setmode = $mode;
652
- // class/object method callback
653
- if (is_callable($options)) {
654
- $setoptions = $options;
655
- } else {
656
- trigger_error("invalid error callback", E_USER_WARNING);
657
- }
658
- break;
659
-
660
- default:
661
- trigger_error("invalid error mode", E_USER_WARNING);
662
- break;
663
- }
664
- return true;
665
- }
666
-
667
- // {{{ pushErrorHandling()
668
-
669
- /**
670
- * Push a new error handler on top of the error handler options stack. With this
671
- * you can easily override the actual error handler for some code and restore
672
- * it later with popErrorHandling.
673
- *
674
- * @param mixed $mode (same as setErrorHandling)
675
- * @param mixed $options (same as setErrorHandling)
676
- *
677
- * @return bool Always true
678
- *
679
- * @see PEAR::setErrorHandling
680
- */
681
- function pushErrorHandling($mode, $options = null)
682
- {
683
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
684
- if (isset($this) && is_a($this, 'PEAR')) {
685
- $def_mode = &$this->_default_error_mode;
686
- $def_options = &$this->_default_error_options;
687
- } else {
688
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
689
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
690
- }
691
- $stack[] = array($def_mode, $def_options);
692
-
693
- if (isset($this) && is_a($this, 'PEAR')) {
694
- $this->setErrorHandling($mode, $options);
695
- } else {
696
- PEAR::setErrorHandling($mode, $options);
697
- }
698
- $stack[] = array($mode, $options);
699
- return true;
700
- }
701
-
702
- // }}}
703
- // {{{ popErrorHandling()
704
-
705
- /**
706
- * Pop the last error handler used
707
- *
708
- * @return bool Always true
709
- *
710
- * @see PEAR::pushErrorHandling
711
- */
712
- function popErrorHandling()
713
- {
714
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
715
- array_pop($stack);
716
- list($mode, $options) = $stack[sizeof($stack) - 1];
717
- array_pop($stack);
718
- if (isset($this) && is_a($this, 'PEAR')) {
719
- $this->setErrorHandling($mode, $options);
720
- } else {
721
- PEAR::setErrorHandling($mode, $options);
722
- }
723
- return true;
724
- }
725
-
726
- // }}}
727
- // {{{ loadExtension()
728
-
729
- /**
730
- * OS independant PHP extension load. Remember to take care
731
- * on the correct extension name for case sensitive OSes.
732
- *
733
- * @param string $ext The extension name
734
- * @return bool Success or not on the dl() call
735
- */
736
- function loadExtension($ext)
737
- {
738
- if (!extension_loaded($ext)) {
739
- // if either returns true dl() will produce a FATAL error, stop that
740
- if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
741
- return false;
742
- }
743
-
744
- if (OS_WINDOWS) {
745
- $suffix = '.dll';
746
- } elseif (PHP_OS == 'HP-UX') {
747
- $suffix = '.sl';
748
- } elseif (PHP_OS == 'AIX') {
749
- $suffix = '.a';
750
- } elseif (PHP_OS == 'OSX') {
751
- $suffix = '.bundle';
752
- } else {
753
- $suffix = '.so';
754
- }
755
-
756
- return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
757
- }
758
-
759
- return true;
760
- }
761
-
762
- // }}}
763
- }
764
-
765
- if (PEAR_ZE2) {
766
- include_once 'PEAR5.php';
767
- }
768
-
769
- // {{{ _PEAR_call_destructors()
770
-
771
- function _PEAR_call_destructors()
772
- {
773
- global $_PEAR_destructor_object_list;
774
- if (is_array($_PEAR_destructor_object_list) &&
775
- sizeof($_PEAR_destructor_object_list))
776
- {
777
- reset($_PEAR_destructor_object_list);
778
- if (PEAR_ZE2) {
779
- $destructLifoExists = PEAR5::getStaticProperty('PEAR', 'destructlifo');
780
- } else {
781
- $destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
782
- }
783
-
784
- if ($destructLifoExists) {
785
- $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
786
- }
787
-
788
- while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
789
- $classname = get_class($objref);
790
- while ($classname) {
791
- $destructor = "_$classname";
792
- if (method_exists($objref, $destructor)) {
793
- $objref->$destructor();
794
- break;
795
- } else {
796
- $classname = get_parent_class($classname);
797
- }
798
- }
799
- }
800
- // Empty the object list to ensure that destructors are
801
- // not called more than once.
802
- $_PEAR_destructor_object_list = array();
803
- }
804
-
805
- // Now call the shutdown functions
806
- if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
807
- foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
808
- call_user_func_array($value[0], $value[1]);
809
- }
810
- }
811
- }
812
-
813
- // }}}
814
- /**
815
- * Standard PEAR error class for PHP 4
816
- *
817
- * This class is supserseded by {@link PEAR_Exception} in PHP 5
818
- *
819
- * @category pear
820
- * @package PEAR
821
- * @author Stig Bakken <ssb@php.net>
822
- * @author Tomas V.V. Cox <cox@idecnet.com>
823
- * @author Gregory Beaver <cellog@php.net>
824
- * @copyright 1997-2006 The PHP Group
825
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
826
- * @version Release: 1.8.1
827
- * @link http://pear.php.net/manual/en/core.pear.pear-error.php
828
- * @see PEAR::raiseError(), PEAR::throwError()
829
- * @since Class available since PHP 4.0.2
830
- */
831
- class PEAR_Error
832
- {
833
- // {{{ properties
834
-
835
- var $error_message_prefix = '';
836
- var $mode = PEAR_ERROR_RETURN;
837
- var $level = E_USER_NOTICE;
838
- var $code = -1;
839
- var $message = '';
840
- var $userinfo = '';
841
- var $backtrace = null;
842
-
843
- // }}}
844
- // {{{ constructor
845
-
846
- /**
847
- * PEAR_Error constructor
848
- *
849
- * @param string $message message
850
- *
851
- * @param int $code (optional) error code
852
- *
853
- * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
854
- * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
855
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
856
- *
857
- * @param mixed $options (optional) error level, _OR_ in the case of
858
- * PEAR_ERROR_CALLBACK, the callback function or object/method
859
- * tuple.
860
- *
861
- * @param string $userinfo (optional) additional user/debug info
862
- *
863
- * @access public
864
- *
865
- */
866
- function PEAR_Error($message = 'unknown error', $code = null,
867
- $mode = null, $options = null, $userinfo = null)
868
- {
869
- if ($mode === null) {
870
- $mode = PEAR_ERROR_RETURN;
871
- }
872
- $this->message = $message;
873
- $this->code = $code;
874
- $this->mode = $mode;
875
- $this->userinfo = $userinfo;
876
-
877
- if (PEAR_ZE2) {
878
- $skiptrace = PEAR5::getStaticProperty('PEAR_Error', 'skiptrace');
879
- } else {
880
- $skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
881
- }
882
-
883
- if (!$skiptrace) {
884
- $this->backtrace = debug_backtrace();
885
- if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) {
886
- unset($this->backtrace[0]['object']);
887
- }
888
- }
889
- if ($mode & PEAR_ERROR_CALLBACK) {
890
- $this->level = E_USER_NOTICE;
891
- $this->callback = $options;
892
- } else {
893
- if ($options === null) {
894
- $options = E_USER_NOTICE;
895
- }
896
- $this->level = $options;
897
- $this->callback = null;
898
- }
899
- if ($this->mode & PEAR_ERROR_PRINT) {
900
- if (is_null($options) || is_int($options)) {
901
- $format = "%s";
902
- } else {
903
- $format = $options;
904
- }
905
- printf($format, $this->getMessage());
906
- }
907
- if ($this->mode & PEAR_ERROR_TRIGGER) {
908
- trigger_error($this->getMessage(), $this->level);
909
- }
910
- if ($this->mode & PEAR_ERROR_DIE) {
911
- $msg = $this->getMessage();
912
- if (is_null($options) || is_int($options)) {
913
- $format = "%s";
914
- if (substr($msg, -1) != "\n") {
915
- $msg .= "\n";
916
- }
917
- } else {
918
- $format = $options;
919
- }
920
- die(sprintf($format, $msg));
921
- }
922
- if ($this->mode & PEAR_ERROR_CALLBACK) {
923
- if (is_callable($this->callback)) {
924
- call_user_func($this->callback, $this);
925
- }
926
- }
927
- if ($this->mode & PEAR_ERROR_EXCEPTION) {
928
- trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
929
- eval('$e = new Exception($this->message, $this->code);throw($e);');
930
- }
931
- }
932
-
933
- // }}}
934
- // {{{ getMode()
935
-
936
- /**
937
- * Get the error mode from an error object.
938
- *
939
- * @return int error mode
940
- * @access public
941
- */
942
- function getMode() {
943
- return $this->mode;
944
- }
945
-
946
- // }}}
947
- // {{{ getCallback()
948
-
949
- /**
950
- * Get the callback function/method from an error object.
951
- *
952
- * @return mixed callback function or object/method array
953
- * @access public
954
- */
955
- function getCallback() {
956
- return $this->callback;
957
- }
958
-
959
- // }}}
960
- // {{{ getMessage()
961
-
962
-
963
- /**
964
- * Get the error message from an error object.
965
- *
966
- * @return string full error message
967
- * @access public
968
- */
969
- function getMessage()
970
- {
971
- return ($this->error_message_prefix . $this->message);
972
- }
973
-
974
-
975
- // }}}
976
- // {{{ getCode()
977
-
978
- /**
979
- * Get error code from an error object
980
- *
981
- * @return int error code
982
- * @access public
983
- */
984
- function getCode()
985
- {
986
- return $this->code;
987
- }
988
-
989
- // }}}
990
- // {{{ getType()
991
-
992
- /**
993
- * Get the name of this error/exception.
994
- *
995
- * @return string error/exception name (type)
996
- * @access public
997
- */
998
- function getType()
999
- {
1000
- return get_class($this);
1001
- }
1002
-
1003
- // }}}
1004
- // {{{ getUserInfo()
1005
-
1006
- /**
1007
- * Get additional user-supplied information.
1008
- *
1009
- * @return string user-supplied information
1010
- * @access public
1011
- */
1012
- function getUserInfo()
1013
- {
1014
- return $this->userinfo;
1015
- }
1016
-
1017
- // }}}
1018
- // {{{ getDebugInfo()
1019
-
1020
- /**
1021
- * Get additional debug information supplied by the application.
1022
- *
1023
- * @return string debug information
1024
- * @access public
1025
- */
1026
- function getDebugInfo()
1027
- {
1028
- return $this->getUserInfo();
1029
- }
1030
-
1031
- // }}}
1032
- // {{{ getBacktrace()
1033
-
1034
- /**
1035
- * Get the call backtrace from where the error was generated.
1036
- * Supported with PHP 4.3.0 or newer.
1037
- *
1038
- * @param int $frame (optional) what frame to fetch
1039
- * @return array Backtrace, or NULL if not available.
1040
- * @access public
1041
- */
1042
- function getBacktrace($frame = null)
1043
- {
1044
- if (defined('PEAR_IGNORE_BACKTRACE')) {
1045
- return null;
1046
- }
1047
- if ($frame === null) {
1048
- return $this->backtrace;
1049
- }
1050
- return $this->backtrace[$frame];
1051
- }
1052
-
1053
- // }}}
1054
- // {{{ addUserInfo()
1055
-
1056
- function addUserInfo($info)
1057
- {
1058
- if (empty($this->userinfo)) {
1059
- $this->userinfo = $info;
1060
- } else {
1061
- $this->userinfo .= " ** $info";
1062
- }
1063
- }
1064
-
1065
- // }}}
1066
- // {{{ toString()
1067
- function __toString()
1068
- {
1069
- return $this->getMessage();
1070
- }
1071
- // }}}
1072
- // {{{ toString()
1073
-
1074
- /**
1075
- * Make a string representation of this object.
1076
- *
1077
- * @return string a string with an object summary
1078
- * @access public
1079
- */
1080
- function toString() {
1081
- $modes = array();
1082
- $levels = array(E_USER_NOTICE => 'notice',
1083
- E_USER_WARNING => 'warning',
1084
- E_USER_ERROR => 'error');
1085
- if ($this->mode & PEAR_ERROR_CALLBACK) {
1086
- if (is_array($this->callback)) {
1087
- $callback = (is_object($this->callback[0]) ?
1088
- strtolower(get_class($this->callback[0])) :
1089
- $this->callback[0]) . '::' .
1090
- $this->callback[1];
1091
- } else {
1092
- $callback = $this->callback;
1093
- }
1094
- return sprintf('[%s: message="%s" code=%d mode=callback '.
1095
- 'callback=%s prefix="%s" info="%s"]',
1096
- strtolower(get_class($this)), $this->message, $this->code,
1097
- $callback, $this->error_message_prefix,
1098
- $this->userinfo);
1099
- }
1100
- if ($this->mode & PEAR_ERROR_PRINT) {
1101
- $modes[] = 'print';
1102
- }
1103
- if ($this->mode & PEAR_ERROR_TRIGGER) {
1104
- $modes[] = 'trigger';
1105
- }
1106
- if ($this->mode & PEAR_ERROR_DIE) {
1107
- $modes[] = 'die';
1108
- }
1109
- if ($this->mode & PEAR_ERROR_RETURN) {
1110
- $modes[] = 'return';
1111
- }
1112
- return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
1113
- 'prefix="%s" info="%s"]',
1114
- strtolower(get_class($this)), $this->message, $this->code,
1115
- implode("|", $modes), $levels[$this->level],
1116
- $this->error_message_prefix,
1117
- $this->userinfo);
1118
- }
1119
-
1120
- // }}}
1121
- }
1122
-
1123
- /*
1124
- * Local Variables:
1125
- * mode: php
1126
- * tab-width: 4
1127
- * c-basic-offset: 4
1128
- * End:
1129
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
PEAR5.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /**
3
- * This is only meant for PHP 5 to get rid of certain strict warning
4
- * that doesn't get hidden since it's in the shutdown function
5
- */
6
- class PEAR5
7
- {
8
- /**
9
- * If you have a class that's mostly/entirely static, and you need static
10
- * properties, you can use this method to simulate them. Eg. in your method(s)
11
- * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
12
- * You MUST use a reference, or they will not persist!
13
- *
14
- * @access public
15
- * @param string $class The calling classname, to prevent clashes
16
- * @param string $var The variable to retrieve.
17
- * @return mixed A reference to the variable. If not set it will be
18
- * auto initialised to NULL.
19
- */
20
- static function &getStaticProperty($class, $var)
21
- {
22
- static $properties;
23
- if (!isset($properties[$class])) {
24
- $properties[$class] = array();
25
- }
26
-
27
- if (!array_key_exists($var, $properties[$class])) {
28
- $properties[$class][$var] = null;
29
- }
30
-
31
- return $properties[$class][$var];
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Revision CHANGED
@@ -1,2 +0,0 @@
1
- Revision: 905814
2
- Last Changed Date: 2014-04-30 12:15:38 -0700 (Wed, 30 Apr 2014)
 
 
config_form.php CHANGED
@@ -108,6 +108,10 @@
108
  </form>
109
 
110
  <form name="postie-options" method="post" action='options.php' autocomplete="off">
 
 
 
 
111
  <?php settings_fields('postie-settings'); ?>
112
  <input type="hidden" name="action" value="config" />
113
  <div id="simpleTabs">
108
  </form>
109
 
110
  <form name="postie-options" method="post" action='options.php' autocomplete="off">
111
+ <!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
112
+ <input style="display:none" type="text" name="fakeusernameremembered"/>
113
+ <input style="display:none" type="password" name="fakepasswordremembered"/>
114
+
115
  <?php settings_fields('postie-settings'); ?>
116
  <input type="hidden" name="action" value="config" />
117
  <div id="simpleTabs">
docs/Changes.txt CHANGED
@@ -22,6 +22,11 @@ All script, style and body tags are stripped from html emails.
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
 
 
 
 
 
25
  = 1.5.22 (2014.06.10) =
26
  * Fix missing attachments for html messages
27
 
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+ = 1.5.23 (2014.08.11) =
26
+ * Remove PEAR/PEAR5 dependency which was causing errors on some systems
27
+ * Call wp_handle_upload_prefilter before adding images to WP
28
+ * Temporary new post is now draft status.
29
+
30
  = 1.5.22 (2014.06.10) =
31
  * Fix missing attachments for html messages
32
 
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.9.1
9
- Stable tag: 1.5.22
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.9.1
9
+ Stable tag: 1.5.23
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -41,6 +41,20 @@ hook for actions
41
  collect and send last debug log and system info (see http://wordpress.org/plugins/send-system-info/)
42
  Support EXIF orientation via PHP Exif Library https://github.com/lsolesen/pel
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  =========
45
  AddOn Ideas
46
  (done) Google Alerts - turn each alert into a post
41
  collect and send last debug log and system info (see http://wordpress.org/plugins/send-system-info/)
42
  Support EXIF orientation via PHP Exif Library https://github.com/lsolesen/pel
43
 
44
+ =========
45
+ Revised parsing logic
46
+
47
+ convert all logic to filters
48
+ before session filter
49
+ before mail filter
50
+ email/account filter
51
+ attachment filter
52
+ iterate through each html element (p, div, etc) and apply all filters and buffer output
53
+ after mail filter
54
+ after session filter
55
+
56
+ convert plain text to html using same logic as wp - i.e. all text is html
57
+ Original text is never modified
58
  =========
59
  AddOn Ideas
60
  (done) Google Alerts - turn each alert into a post
mimedecode.php CHANGED
@@ -58,12 +58,7 @@
58
  * @version CVS: $Id: mimeDecode.php 305875 2010-12-01 07:17:10Z alan_k $
59
  * @link http://pear.php.net/package/Mail_mime
60
  */
61
- /**
62
- * require PEAR
63
- *
64
- * This package depends on PEAR to raise errors.
65
- */
66
- require_once 'PEAR.php';
67
 
68
  /**
69
  * The Mail_mimeDecode class is used to decode mail/mime messages
@@ -88,7 +83,7 @@ require_once 'PEAR.php';
88
  * @version Release: @package_version@
89
  * @link http://pear.php.net/package/Mail_mimeDecode
90
  */
91
- class Mail_mimeDecode extends PEAR {
92
 
93
  /**
94
  * The raw email to decode
@@ -206,7 +201,7 @@ class Mail_mimeDecode extends PEAR {
206
 
207
  // Called statically but no input
208
  } elseif ($isStatic) {
209
- return PEAR::raiseError('Called statically and no input given');
210
 
211
  // Called via an object
212
  } else {
@@ -221,7 +216,7 @@ class Mail_mimeDecode extends PEAR {
221
 
222
  $structure = $this->_decode($this->_header, $this->_body);
223
  if ($structure === false) {
224
- $structure = $this->raiseError($this->_error);
225
  }
226
  }
227
 
@@ -245,7 +240,7 @@ class Mail_mimeDecode extends PEAR {
245
 
246
  foreach ($headers as $value) {
247
  $value['value'] = $this->_decode_headers ? $this->_decodeHeader($value['value']) : $value['value'];
248
- if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) {
249
  $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]);
250
  $return->headers[strtolower($value['name'])][] = $value['value'];
251
  } elseif (isset($return->headers[strtolower($value['name'])])) {
@@ -323,8 +318,9 @@ class Mail_mimeDecode extends PEAR {
323
  for ($i = 0; $i < count($parts); $i++) {
324
  list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]);
325
  $part = $this->_decode($part_header, $part_body, $default_ctype);
326
- if ($part === false)
327
  $part = $this->raiseError($this->_error);
 
328
  $return->parts[] = $part;
329
  }
330
  break;
@@ -724,15 +720,12 @@ class Mail_mimeDecode extends PEAR {
724
  switch (strtolower($encoding)) {
725
  case '7bit':
726
  return $input;
727
- break;
728
 
729
  case 'quoted-printable':
730
  return $this->_quotedPrintableDecode($input);
731
- break;
732
 
733
  case 'base64':
734
  return base64_decode($input);
735
- break;
736
 
737
  default:
738
  return $input;
@@ -791,7 +784,7 @@ class Mail_mimeDecode extends PEAR {
791
  $d = 0;
792
  $len = (int) (((ord(substr($str[$i], 0, 1)) - 32) - ' ') & 077);
793
 
794
- while (($d + 3 <= $len) AND ($pos + 4 <= strlen($str[$i]))) {
795
  $c0 = (ord(substr($str[$i], $pos, 1)) ^ 0x20);
796
  $c1 = (ord(substr($str[$i], $pos + 1, 1)) ^ 0x20);
797
  $c2 = (ord(substr($str[$i], $pos + 2, 1)) ^ 0x20);
58
  * @version CVS: $Id: mimeDecode.php 305875 2010-12-01 07:17:10Z alan_k $
59
  * @link http://pear.php.net/package/Mail_mime
60
  */
61
+
 
 
 
 
 
62
 
63
  /**
64
  * The Mail_mimeDecode class is used to decode mail/mime messages
83
  * @version Release: @package_version@
84
  * @link http://pear.php.net/package/Mail_mimeDecode
85
  */
86
+ class Mail_mimeDecode {
87
 
88
  /**
89
  * The raw email to decode
201
 
202
  // Called statically but no input
203
  } elseif ($isStatic) {
204
+ throw new Exception('Called statically and no input given');
205
 
206
  // Called via an object
207
  } else {
216
 
217
  $structure = $this->_decode($this->_header, $this->_body);
218
  if ($structure === false) {
219
+ throw new Exception($this->_error);
220
  }
221
  }
222
 
240
 
241
  foreach ($headers as $value) {
242
  $value['value'] = $this->_decode_headers ? $this->_decodeHeader($value['value']) : $value['value'];
243
+ if (isset($return->headers[strtolower($value['name'])]) AND ! is_array($return->headers[strtolower($value['name'])])) {
244
  $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]);
245
  $return->headers[strtolower($value['name'])][] = $value['value'];
246
  } elseif (isset($return->headers[strtolower($value['name'])])) {
318
  for ($i = 0; $i < count($parts); $i++) {
319
  list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]);
320
  $part = $this->_decode($part_header, $part_body, $default_ctype);
321
+ if ($part === false) {
322
  $part = $this->raiseError($this->_error);
323
+ }
324
  $return->parts[] = $part;
325
  }
326
  break;
720
  switch (strtolower($encoding)) {
721
  case '7bit':
722
  return $input;
 
723
 
724
  case 'quoted-printable':
725
  return $this->_quotedPrintableDecode($input);
 
726
 
727
  case 'base64':
728
  return base64_decode($input);
 
729
 
730
  default:
731
  return $input;
784
  $d = 0;
785
  $len = (int) (((ord(substr($str[$i], 0, 1)) - 32) - ' ') & 077);
786
 
787
+ while (($d + 3 <= $len) AND ( $pos + 4 <= strlen($str[$i]))) {
788
  $c0 = (ord(substr($str[$i], $pos, 1)) ^ 0x20);
789
  $c1 = (ord(substr($str[$i], $pos + 1, 1)) ^ 0x20);
790
  $c2 = (ord(substr($str[$i], $pos + 2, 1)) ^ 0x20);
package.xml DELETED
@@ -1,438 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <package packagerversion="1.6.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
3
- <name>Mail_Mime</name>
4
- <channel>pear.php.net</channel>
5
- <summary>Mail_Mime provides classes to create mime messages.</summary>
6
- <description>Mail_Mime provides classes to deal with the creation and manipulation of mime messages.
7
- It allows people to create Email messages consisting of:
8
- * Text Parts
9
- * HTML Parts
10
- * Inline HTML Images
11
- * Attachments
12
- * Attached messages
13
-
14
- Starting with version 1.4.0, it also allows non US-ASCII chars in filenames, subjects, recipients, etc, etc.
15
- </description>
16
- <lead>
17
- <name>Cipriano Groenendal</name>
18
- <user>cipri</user>
19
- <email>cipri@php.net</email>
20
- <active>yes</active>
21
- </lead>
22
- <date>2007-06-21</date>
23
- <time>21:10:11</time>
24
- <version>
25
- <release>1.5.2</release>
26
- <api>1.3.1</api>
27
- </version>
28
- <stability>
29
- <release>stable</release>
30
- <api>stable</api>
31
- </stability>
32
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
33
- <notes>* Fix Bug #11381: domain name is attached to content-id, trailing greater-than sign is
34
- not remove [cipri]
35
- </notes>
36
- <contents>
37
- <dir name="/">
38
- <file baseinstalldir="Mail" md5sum="a2899bc69329c9533205aeb4221ab775" name="scripts/phail.php" role="doc" />
39
- <file baseinstalldir="Mail" md5sum="edd138f6c5497ae2b5d63620a67a931e" name="tests/class-filename.phpt" role="test" />
40
- <file baseinstalldir="Mail" md5sum="494526cc12e4edec45e0207f569d57d9" name="tests/encoding_case.phpt" role="test" />
41
- <file baseinstalldir="Mail" md5sum="1016a2a921d414f52fbc6d3a028945f4" name="tests/sleep_wakeup_EOL-bug3488-part1.phpt" role="test" />
42
- <file baseinstalldir="Mail" md5sum="61c745f92e8162e6e2971464a15990d4" name="tests/sleep_wakeup_EOL-bug3488-part2.phpt" role="test" />
43
- <file baseinstalldir="Mail" md5sum="494526cc12e4edec45e0207f569d57d9" name="tests/tabs_quoted_printable.phpt" role="test" />
44
- <file baseinstalldir="Mail" md5sum="844305aaa9ca4820a1672ba6da0a94c7" name="tests/test_Bug_30_1.phpt" role="test" />
45
- <file baseinstalldir="Mail" md5sum="2d0bd00382e3f9c5f2e3e9512b731d68" name="tests/test_Bug_30_2.phpt" role="test" />
46
- <file baseinstalldir="Mail" md5sum="83d326b6ca7d9f704ff2544edeb601ab" name="tests/test_Bug_30_3.phpt" role="test" />
47
- <file baseinstalldir="Mail" md5sum="c2ea41bc1d78cb2b88e4514d8044a98d" name="tests/test_Bug_30_4.phpt" role="test" />
48
- <file baseinstalldir="Mail" md5sum="6af58588ed4e35df8845f6704d7384ba" name="tests/test_Bug_3513_1.phpt" role="test" />
49
- <file baseinstalldir="Mail" md5sum="efaa5d82baea0b46560752817d455bf4" name="tests/test_Bug_3513_2.phpt" role="test" />
50
- <file baseinstalldir="Mail" md5sum="27020435d9432ebece744308e803030f" name="tests/test_Bug_3513_3.phpt" role="test" />
51
- <file baseinstalldir="Mail" md5sum="dc2b1be6fab962386f16f6d710cf2d0a" name="tests/test_Bug_7561_1.phpt" role="test" />
52
- <file baseinstalldir="Mail" md5sum="cd9c56b628649f92f067920d2e8a6214" name="tests/test_Bug_8223_1.phpt" role="test" />
53
- <file baseinstalldir="Mail" md5sum="51888d86ce4fb58fc89a366736f5910a" name="tests/test_Bug_8386_1.phpt" role="test" />
54
- <file baseinstalldir="Mail" md5sum="440c46d4ea863539caec007af431b307" name="tests/test_Bug_8541_1.phpt" role="test" />
55
- <file baseinstalldir="Mail" md5sum="a1f598cf82774fde322ac4f3f3a7e0be" name="tests/test_Bug_9558_1.phpt" role="test" />
56
- <file baseinstalldir="Mail" md5sum="5adfb0668904b72d2c04073f55f8144c" name="tests/test_Bug_9722_1.phpt" role="test" />
57
- <file baseinstalldir="Mail" md5sum="18160c212dd0042bf21eb703e58de9ce" name="tests/test_Bug_9725_1.phpt" role="test" />
58
- <file baseinstalldir="Mail" md5sum="e07949f077db4cfeaad0bffe9d4d37da" name="tests/test_Bug_9976_1.phpt" role="test" />
59
- <file baseinstalldir="Mail" md5sum="fcc6eeedeb8ae7ddcf1637c048ab7f93" name="tests/test_Bug_10298_1.phpt" role="test" />
60
- <file baseinstalldir="Mail" md5sum="c64c1115b7fe7f3a8d8c6fd8f8d7c268" name="tests/test_Bug_10596_1.phpt" role="test" />
61
- <file baseinstalldir="Mail" md5sum="0eacb8c485ade073b61fe2daeae3124f" name="tests/test_Bug_10816_1.phpt" role="test" />
62
- <file baseinstalldir="Mail" md5sum="93a00275edb0d9e94364ae11175741d1" name="mime.php" role="php" />
63
- <file baseinstalldir="Mail" md5sum="53aedbcc104a9bd15cf96e5511b6498b" name="mimePart.php" role="php" />
64
- <file baseinstalldir="Mail" md5sum="194810c478066eaeb28f51116b88e25a" name="xmail.dtd" role="data" />
65
- <file baseinstalldir="Mail" md5sum="61cea06fb6b4bd3a4b5e2d37384e14a9" name="xmail.xsl" role="data" />
66
- </dir>
67
- </contents>
68
- <dependencies>
69
- <required>
70
- <php>
71
- <min>4.0.0</min>
72
- </php>
73
- <pearinstaller>
74
- <min>1.6.0</min>
75
- </pearinstaller>
76
- <subpackage>
77
- <name>Mail_mimeDecode</name>
78
- <channel>pear.php.net</channel>
79
- </subpackage>
80
- </required>
81
- </dependencies>
82
- <phprelease />
83
- <changelog>
84
- <release>
85
- <version>
86
- <release>1.0</release>
87
- <api>1.0</api>
88
- </version>
89
- <stability>
90
- <release>stable</release>
91
- <api>stable</api>
92
- </stability>
93
- <date>2001-12-28</date>
94
- <license uri="http://www.php.net/license">PHP</license>
95
- <notes>This is the initial release of the Mime_Mail package.</notes>
96
- </release>
97
- <release>
98
- <version>
99
- <release>1.1</release>
100
- <api>1.1</api>
101
- </version>
102
- <stability>
103
- <release>stable</release>
104
- <api>stable</api>
105
- </stability>
106
- <date>2002-04-03</date>
107
- <license uri="http://www.php.net/license">PHP</license>
108
- <notes>This is a maintenance release with various bugfixes and minor enhancements.</notes>
109
- </release>
110
- <release>
111
- <version>
112
- <release>1.2</release>
113
- <api>1.2</api>
114
- </version>
115
- <stability>
116
- <release>stable</release>
117
- <api>stable</api>
118
- </stability>
119
- <date>2002-07-14</date>
120
- <license uri="http://www.php.net/license">PHP</license>
121
- <notes>o Added header encoding
122
- o Altered mimePart to put boundary parameter on newline
123
- o Changed addFrom() to setFrom()
124
- o Added setSubject()
125
- o Made mimePart inherit crlf setting from mime
126
- </notes>
127
- </release>
128
- <release>
129
- <version>
130
- <release>1.2.1</release>
131
- <api>1.2.1</api>
132
- </version>
133
- <stability>
134
- <release>stable</release>
135
- <api>stable</api>
136
- </stability>
137
- <date>2002-07-27</date>
138
- <license uri="http://www.php.net/license">PHP</license>
139
- <notes>o License change
140
- o Applied a few changes From Ilia Alshanetsky
141
- </notes>
142
- </release>
143
- <release>
144
- <version>
145
- <release>1.3.0RC1</release>
146
- <api>1.3.0RC1</api>
147
- </version>
148
- <stability>
149
- <release>beta</release>
150
- <api>beta</api>
151
- </stability>
152
- <date>2005-03-20</date>
153
- <license uri="http://www.php.net/license">PHP</license>
154
- <notes>o First release in over 2.5 years (!)
155
- o MANY bugfixes (see the bugtracker)
156
- o added a few tests
157
- </notes>
158
- </release>
159
- <release>
160
- <version>
161
- <release>1.3.0</release>
162
- <api>1.3.0</api>
163
- </version>
164
- <stability>
165
- <release>stable</release>
166
- <api>stable</api>
167
- </stability>
168
- <date>2005-04-01</date>
169
- <license uri="http://www.php.net/license">PHP</license>
170
- <notes>o First (stable) release in over 2.5 years (!)
171
- o MANY bugfixes (see the bugtracker)
172
- o added a few tests
173
- o one small fix after RC1 (bug #3940)
174
- </notes>
175
- </release>
176
- <release>
177
- <version>
178
- <release>1.3.1</release>
179
- <api>1.3.1</api>
180
- </version>
181
- <stability>
182
- <release>stable</release>
183
- <api>stable</api>
184
- </stability>
185
- <date>2005-07-13</date>
186
- <license uri="http://www.php.net/license">PHP</license>
187
- <notes>A bugfix release:</notes>
188
- </release>
189
- <release>
190
- <version>
191
- <release>1.4.0a1</release>
192
- <api>1.3.1</api>
193
- </version>
194
- <stability>
195
- <release>alpha</release>
196
- <api>stable</api>
197
- </stability>
198
- <date>2007-03-08</date>
199
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
200
- <notes>* Changed License to BSD Style license, as that&apos;s what the code was since the beginning [cipri]
201
- * Fix Bug #30: Mail_Mime: _encodeHeaders is not RFC-2047 compliant. [cipri]
202
- * Fix Bug #3513: support of RFC2231 in header fields. [cipri]
203
- * Fix Bug #4696: addAttachment crash [cipri]
204
- * Fix Bug #5333: Only variables should be returned by reference; triggers notices since php 4.4.0 [cipri]
205
- * Fix Bug #7561: Mail_mimePart::_quotedPrintableEncode() misbehavior with mbstring overload [cipri]
206
- * Fix Bug #8223: Incorrectly encoded quoted-printable headers [cipri]
207
- * Fix Bug #8386: HTML body not correctly encoded if attachments present [cipri]
208
- * Fix Bug #8541: mimePart.php line delimiter is \r [cipri]
209
- * Fix Bug #9347: Notices about references [cweiske]
210
- * Fix Bug #9558: Broken multiline headers [cipri]
211
- * Fix Bug #9956: Notices being thrown [cipri]
212
- * Fix Bug #9976: Subject encoded twice [cipri]
213
- * Implement Feature #2952: Mail_mime::headers() saves extra headers [cipri]
214
- * Implement Feature #3636: Allow specification of charsets and encoding [cipri]
215
- * Implement Feature #4057: Mail_Mime: Add name parameter for Content-Type [cipri]
216
- * Implement Feature #4504: addHTMLImage does not work in cases when filename contains a path [cipri]
217
- * Implement Feature #5837: Mail_Mime: Build message for Net_SMTP [cipri]
218
- * Implement Feature #5934: Mail_Mime: choice for content disposition [cipri]
219
- * Implement Feature #6568: Mail_Mime: inline images referenced in CSS definitions not replaced. [cipri]
220
- </notes>
221
- </release>
222
- <release>
223
- <version>
224
- <release>1.4.0a2</release>
225
- <api>1.3.1</api>
226
- </version>
227
- <stability>
228
- <release>alpha</release>
229
- <api>stable</api>
230
- </stability>
231
- <date>2007-04-05</date>
232
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
233
- <notes>* Fix Bug #9722: _quotedPrintableEncode does not encode dot at start of line on Windows
234
- platform [cipri]
235
- * Fix Bug #9725: multipart/related &amp; alternative wrong order [cipri]
236
- * Fix Bug #10146: mbstring fails to recognize encodings. [cipri]
237
- * Fix Bug #10158: Inline images not displayed on Mozilla Thunderbird [cipri]
238
- * Fix Bug #10298: Mail_mime, double Quotes and Specialchars in from and to Adress [cipri]
239
- * Fix Bug #10306: Strings with Double Quotes get encoded wrongly [cipri]
240
- * Fix Bug #10596: Incorrect handling of text and html &apos;0&apos; bodies [cipri]
241
- </notes>
242
- </release>
243
- <release>
244
- <version>
245
- <release>1.4.0a3</release>
246
- <api>1.3.1</api>
247
- </version>
248
- <stability>
249
- <release>alpha</release>
250
- <api>stable</api>
251
- </stability>
252
- <date>2007-04-05</date>
253
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
254
- <notes>* Fix Bug #10298: Mail_mime, double Quotes and Specialchars in from and to Adress [cipri]
255
- * Fix Bug #10306: Strings with Double Quotes get encoded wrongly [cipri]
256
- </notes>
257
- </release>
258
- <release>
259
- <version>
260
- <release>1.4.0RC1</release>
261
- <api>1.3.1</api>
262
- </version>
263
- <stability>
264
- <release>beta</release>
265
- <api>stable</api>
266
- </stability>
267
- <date>2007-04-12</date>
268
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
269
- <notes>* Fix Bug #10232: Gmail creates double line break when \r\n is used [cipri]</notes>
270
- </release>
271
- <release>
272
- <version>
273
- <release>1.4.0RC2</release>
274
- <api>1.3.1</api>
275
- </version>
276
- <stability>
277
- <release>beta</release>
278
- <api>stable</api>
279
- </stability>
280
- <date>2007-04-22</date>
281
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
282
- <notes>* Fix Bug #10791: Unit tests fail [cipri]
283
- * Fix Bug #10792: No unit tests for recently fixed bugs [cipri]
284
- * Fix Bug #10793: Long headers don&apos;t get wrapped since fix for Bug #10298 [cipri]
285
- </notes>
286
- </release>
287
- <release>
288
- <version>
289
- <release>1.4.0RC3</release>
290
- <api>1.3.1</api>
291
- </version>
292
- <stability>
293
- <release>beta</release>
294
- <api>stable</api>
295
- </stability>
296
- <date>2007-04-24</date>
297
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
298
- <notes>* Fix Bug #10816: Unwanted linebreak at the end of output [cipri]</notes>
299
- </release>
300
- <release>
301
- <version>
302
- <release>1.4.0RC4</release>
303
- <api>1.3.1</api>
304
- </version>
305
- <stability>
306
- <release>beta</release>
307
- <api>stable</api>
308
- </stability>
309
- <date>2007-04-28</date>
310
- <license uri="http://www.opensource.org/licenses/bsd-license.php">bsd style</license>
311
- <notes>* Fix Bug #3513: support of RFC2231 in header fields. [cipri]
312
- * Fix Bug #10838: bad use of MIME encoding in header. [cipri]
313
- </notes>
314
- </release>
315
- <release>
316
- <version>
317
- <release>1.4.0</release>
318
- <api>1.3.1</api>
319
- </version>
320
- <stability>
321
- <release>stable</release>
322
- <api>stable</api>
323
- </stability>
324
- <date>2007-05-05</date>
325
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
326
- <notes>Release nots:
327
- * No more notices in PHP 5 /4.4.0.
328
- * Improved inline HTML image function.
329
- * Improved header encoding with foreign charsets.
330
- * Improved long header rendering.
331
- * More control over used Charsets and encoding schemes.
332
- * More configurable attachments and inline images.
333
- * Full RFC 2047 Support
334
- * Full RFC 2231 Support
335
- * Unit-tests
336
-
337
- Fixed bugs:
338
- * Fix Bug #30: Mail_Mime: _encodeHeaders is not RFC-2047 compliant. [cipri]
339
- * Fix Bug #3513: support of RFC2231 in header fields. [cipri]
340
- * Fix Bug #4696: addAttachment crash [cipri]
341
- * Fix Bug #5333: Only variables should be returned by reference; triggers notices since
342
- php 4.4.0 [cipri]
343
- * Fix Bug #5400: Do not return function reference [cipri]
344
- * Fix Bug #5710: Little reference bugs [cipri]
345
- * Fix Bug #5890: Only variable references should be returned by reference [cipri]
346
- * Fix Bug #6260: Just a notice with PHP5 [cipri]
347
- * Fix Bug #6261: php 5.1.1 upgrade [cipri]
348
- * Fix Bug #6663: Notice about reference passing [cipri]
349
- * Fix Bug #7561: Mail_mimePart::_quotedPrintableEncode() misbehavior with mbstring
350
- overload [cipri]
351
- * Fix Bug #7713: PHP5 Notice: Only variable references should be returned by reference [cipri]
352
- * Fix Bug #8223: Incorrectly encoded quoted-printable headers [cipri]
353
- * Fix Bug #8386: HTML body not correctly encoded if attachments present [cipri]
354
- * Fix Bug #8541: mimePart.php line delimiter is \r [cipri]
355
- * Fix Bug #8812: user header updates overwritten [cipri]
356
- * Fix Bug #9347: Notices about references [cweiske]
357
- * Fix Bug #9558: Broken multiline headers [cipri]
358
- * Fix Bug #9722: _quotedPrintableEncode does not encode dot at start of line on Windows
359
- platform [cipri]
360
- * Fix Bug #9725: multipart/related &amp; alternative wrong order [cipri]
361
- * Fix Bug #9956: Notices being thrown [cipri]
362
- * Fix Bug #9976: Subject encoded twice [cipri]
363
- * Fix Bug #10146: mbstring fails to recognize encodings. [cipri]
364
- * Fix Bug #10158: Inline images not displayed on Mozilla Thunderbird [cipri]
365
- * Fix Bug #10232: Gmail creates double line break when \r\n is used [cipri]
366
- * Fix Bug #10298: Mail_mime, double Quotes and Specialchars in from and to Adress [cipri]
367
- * Fix Bug #10306: Strings with Double Quotes get encoded wrongly [cipri]
368
- * Fix Bug #10596: Incorrect handling of text and html &apos;0&apos; bodies [cipri]
369
- * Fix Bug #10791: Unit tests fail [cipri]
370
- * Fix Bug #10792: No unit tests for recently fixed bugs [cipri]
371
- * Fix Bug #10793: Long headers don&apos;t get wrapped since fix for Bug #10298 [cipri]
372
- * Fix Bug #10816: Unwanted linebreak at the end of output [cipri]
373
- * Fix Bug #10838: bad use of MIME encoding in header. [cipri]
374
- Implemented Features:
375
- * Implement Feature #2952: Mail_mime::headers() saves extra headers [cipri]
376
- * Implement Feature #3636: Allow specification of charsets and encoding [cipri]
377
- * Implement Feature #4057: Mail_Mime: Add name parameter for Content-Type [cipri]
378
- * Implement Feature #4504: addHTMLImage does not work in cases when filename contains a path [cipri]
379
- * Implement Feature #5837: Mail_Mime: Build message for Net_SMTP [cipri]
380
- * Implement Feature #5934: Mail_Mime: choice for content disposition [cipri]
381
- * Implement Feature #6568: Mail_Mime: inline images referenced in CSS definitions not replaced. [cipri]
382
- * Implement Feature #10604: Put an option to specify Content-Location in the header [cipri]
383
- </notes>
384
- </release>
385
- <release>
386
- <version>
387
- <release>1.5.0a1</release>
388
- <api>1.3.1</api>
389
- </version>
390
- <stability>
391
- <release>alpha</release>
392
- <api>stable</api>
393
- </stability>
394
- <date>2007-06-10</date>
395
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
396
- <notes>Split off mail_MimeDecode</notes>
397
- </release>
398
- <release>
399
- <version>
400
- <release>1.5.0RC1</release>
401
- <api>1.3.1</api>
402
- </version>
403
- <stability>
404
- <release>beta</release>
405
- <api>stable</api>
406
- </stability>
407
- <date>2007-06-10</date>
408
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
409
- <notes>Split off mail_MimeDecode</notes>
410
- </release>
411
- <release>
412
- <version>
413
- <release>1.5.0</release>
414
- <api>1.3.1</api>
415
- </version>
416
- <stability>
417
- <release>stable</release>
418
- <api>stable</api>
419
- </stability>
420
- <date>2007-06-17</date>
421
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
422
- <notes>Split off Mail_MimeDecode</notes>
423
- </release>
424
- <release>
425
- <version>
426
- <release>1.5.1</release>
427
- <api>1.3.1</api>
428
- </version>
429
- <stability>
430
- <release>stable</release>
431
- <api>stable</api>
432
- </stability>
433
- <date>2007-06-20</date>
434
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
435
- <notes>* Fix Bug #11344: Error at line 644 in mime.php [cipri]</notes>
436
- </release>
437
- </changelog>
438
- </package>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 929978 2014-06-10 23:06:02Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -216,7 +216,7 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
216
  }
217
  }
218
 
219
- filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
220
  if ($fulldebugdump) {
221
  DebugDump($mimeDecodedEmail);
222
  }
@@ -257,7 +257,7 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
257
  }
258
  $message_date = tag_Date($content, $message_date);
259
 
260
- list($post_date, $post_date_gmt, $delay) = filter_Delay($content, $message_date, $time_offset);
261
  if ($fulldebug) {
262
  DebugEcho("post date: $content");
263
  }
@@ -267,12 +267,12 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
267
  DebugEcho("post ubb: $content");
268
  }
269
 
270
- $post_categories = tag_Categories($subject, $default_post_category, $category_match);
271
  if ($fulldebug) {
272
  DebugEcho("post category: $content");
273
  }
274
 
275
- $post_tags = tag_Tags($content, $default_post_tags);
276
  if ($fulldebug) {
277
  DebugEcho("post tag: $content");
278
  }
@@ -287,8 +287,8 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
287
  DebugEcho("post status: $content");
288
  }
289
 
290
- if ($converturls) {
291
- $content = filter_Videos($content, $shortcode); //videos first so linkify doesn't mess with them
292
  if ($fulldebug) {
293
  DebugEcho("post video: $content");
294
  }
@@ -323,8 +323,8 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
323
  if (empty($id)) {
324
  $id = $post_id;
325
  $is_reply = false;
326
- if ($add_meta == 'yes') {
327
- if ($wrap_pre == 'yes') {
328
  $content = $postAuthorDetails['content'] . "<pre>\n" . $content . "</pre>\n";
329
  $content = "<pre>\n" . $content . "</pre>\n";
330
  } else {
@@ -332,7 +332,7 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
332
  $content = $content;
333
  }
334
  } else {
335
- if ($wrap_pre == 'yes') {
336
  $content = "<pre>\n" . $content . "</pre>\n";
337
  }
338
  }
@@ -374,7 +374,7 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
374
  DebugEcho("post end: $content");
375
  }
376
 
377
- DebugEcho("prefer_text_type: $prefer_text_type");
378
 
379
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config, $id, $config['image_placeholder'], true);
380
  if ($fulldebug) {
@@ -391,8 +391,8 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
391
  DebugEcho("excerpt: $post_excerpt");
392
 
393
  if (trim($subject) == "") {
394
- $subject = $default_title;
395
- DebugEcho("post parsing subject is blank using: $default_title");
396
  }
397
 
398
  $details = array(
@@ -428,9 +428,9 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
428
 
429
  /* in order to do attachments correctly, we need to associate the
430
  attachments with a post. So we add the post here, then update it */
431
- $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost');
432
  $post_id = wp_insert_post($tmpPost);
433
- DebugEcho("new post id is $post_id");
434
 
435
  $is_reply = false;
436
  $postmodifiers = new PostiePostModifiers();
@@ -1890,6 +1890,7 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1890
  }
1891
 
1892
  }
 
1893
 
1894
  // You may define your own function and pass the name in $overrides['upload_error_handler']
1895
  $upload_error_handler = 'wp_handle_upload_error';
@@ -1950,7 +1951,7 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1950
 
1951
  // Move the file to the uploads dir
1952
  $new_file = $uploads['path'] . "/$filename";
1953
- if (false === rename($file['tmp_name'], $new_file)) {
1954
  DebugEcho("upload: rename failed");
1955
  DebugEcho("old file: " . $file['tmp_name']);
1956
  DebugEcho("new file: $new_file");
@@ -1964,8 +1965,11 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1964
  // Set correct file permissions
1965
  $stat = stat(dirname($new_file));
1966
  $perms = $stat['mode'] & 0000666;
1967
- chmod($new_file, $perms);
1968
- DebugEcho("upload: permissions changed");
 
 
 
1969
 
1970
  // Compute the URL
1971
  $url = $uploads['url'] . "/$filename";
@@ -2131,8 +2135,9 @@ function DecodeMIMEMail($email) {
2131
  $params['input'] = $email;
2132
  $md = new Mail_mimeDecode($email);
2133
  $decoded = $md->decode($params);
2134
- if (empty($decoded->parts))
2135
  $decoded->parts = array(); // have an empty array at minimum, so that it is safe for "foreach"
 
2136
  return $decoded;
2137
  }
2138
 
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 964278 2014-08-12 03:40:08Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
216
  }
217
  }
218
 
219
+ filter_PreferedText($mimeDecodedEmail, $config['prefer_text_type']);
220
  if ($fulldebugdump) {
221
  DebugDump($mimeDecodedEmail);
222
  }
257
  }
258
  $message_date = tag_Date($content, $message_date);
259
 
260
+ list($post_date, $post_date_gmt, $delay) = filter_Delay($content, $message_date, $config['time_offset']);
261
  if ($fulldebug) {
262
  DebugEcho("post date: $content");
263
  }
267
  DebugEcho("post ubb: $content");
268
  }
269
 
270
+ $post_categories = tag_Categories($subject, $config['default_post_category'], $config['category_match']);
271
  if ($fulldebug) {
272
  DebugEcho("post category: $content");
273
  }
274
 
275
+ $post_tags = tag_Tags($content, $config['default_post_tags']);
276
  if ($fulldebug) {
277
  DebugEcho("post tag: $content");
278
  }
287
  DebugEcho("post status: $content");
288
  }
289
 
290
+ if ($config['converturls']) {
291
+ $content = filter_Videos($content, $config['shortcode']); //videos first so linkify doesn't mess with them
292
  if ($fulldebug) {
293
  DebugEcho("post video: $content");
294
  }
323
  if (empty($id)) {
324
  $id = $post_id;
325
  $is_reply = false;
326
+ if ($config['add_meta'] == 'yes') {
327
+ if ($config['wrap_pre'] == 'yes') {
328
  $content = $postAuthorDetails['content'] . "<pre>\n" . $content . "</pre>\n";
329
  $content = "<pre>\n" . $content . "</pre>\n";
330
  } else {
332
  $content = $content;
333
  }
334
  } else {
335
+ if ($config['wrap_pre'] == 'yes') {
336
  $content = "<pre>\n" . $content . "</pre>\n";
337
  }
338
  }
374
  DebugEcho("post end: $content");
375
  }
376
 
377
+ DebugEcho("prefer_text_type: " . $config['prefer_text_type']);
378
 
379
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config, $id, $config['image_placeholder'], true);
380
  if ($fulldebug) {
391
  DebugEcho("excerpt: $post_excerpt");
392
 
393
  if (trim($subject) == "") {
394
+ $subject = $config['default_title'];
395
+ DebugEcho("post parsing subject is blank using: " . $config['default_title']);
396
  }
397
 
398
  $details = array(
428
 
429
  /* in order to do attachments correctly, we need to associate the
430
  attachments with a post. So we add the post here, then update it */
431
+ $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost', 'post_status' => 'draft');
432
  $post_id = wp_insert_post($tmpPost);
433
+ DebugEcho("tmp post id is $post_id");
434
 
435
  $is_reply = false;
436
  $postmodifiers = new PostiePostModifiers();
1890
  }
1891
 
1892
  }
1893
+ $file = apply_filters('wp_handle_upload_prefilter', $file);
1894
 
1895
  // You may define your own function and pass the name in $overrides['upload_error_handler']
1896
  $upload_error_handler = 'wp_handle_upload_error';
1951
 
1952
  // Move the file to the uploads dir
1953
  $new_file = $uploads['path'] . "/$filename";
1954
+ if (false === move_uploaded_file($file['tmp_name'], $new_file)) {
1955
  DebugEcho("upload: rename failed");
1956
  DebugEcho("old file: " . $file['tmp_name']);
1957
  DebugEcho("new file: $new_file");
1965
  // Set correct file permissions
1966
  $stat = stat(dirname($new_file));
1967
  $perms = $stat['mode'] & 0000666;
1968
+ if (chmod($new_file, $perms)) {
1969
+ DebugEcho("upload: permissions changed");
1970
+ } else {
1971
+ DebugEcho("upload: permissions not changed $new_file");
1972
+ }
1973
 
1974
  // Compute the URL
1975
  $url = $uploads['url'] . "/$filename";
2135
  $params['input'] = $email;
2136
  $md = new Mail_mimeDecode($email);
2137
  $decoded = $md->decode($params);
2138
+ if (empty($decoded->parts)) {
2139
  $decoded->parts = array(); // have an empty array at minimum, so that it is safe for "foreach"
2140
+ }
2141
  return $decoded;
2142
  }
2143
 
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
- Version: 1.5.22
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,10 +27,10 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 929978 2014-06-10 23:06:02Z WayneAllen $
31
  */
32
 
33
- define('POSTIE_VERSION', '1.5.22');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
+ Version: 1.5.23
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 964314 2014-08-12 05:11:31Z WayneAllen $
31
  */
32
 
33
+ define('POSTIE_VERSION', '1.5.23');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
readme.html CHANGED
@@ -163,7 +163,7 @@ will get placed in the more recent post.</li>
163
 
164
  <h4>Post type/format</h4>
165
 
166
- <p>You can specify the post type or format by including it as the first part of the subject.
167
  E.g. aside//real subject</p>
168
 
169
  <h4>Categories</h4>
@@ -250,13 +250,12 @@ class='imagecaption'&gt;{CAPTION}&lt;/div&gt;&lt;/div&gt;</code></p>
250
  <li>{MEDIUMWIDTH} gets replaced with the width of a medium image</li>
251
  <li>{MEDIUM} gets replaced with the url to the medium-sized image</li>
252
  <li>{PAGELINK} gets replaced with the URL of the file in WordPress</li>
253
- <li>{POSTTITLE} gets replaced with the post title (subject)</li>
254
  <li>{RELFILENAME} gets replaced with the relative path to the full-size image</li>
255
  <li>{THUMBHEIGHT} gets replaced with the height of a thumbnail image</li>
256
  <li>{THUMB} gets replaced with the url to the thumbnail image</li>
257
  <li>{THUMBNAIL} same as {THUMB}</li>
258
  <li>{THUMBWIDTH} gets replaced with the width of a thumbnail image</li>
259
- <li>{TITLE} same as {POSTTITLE}</li>
260
  <li>{URL} same as {FILELINK}</li>
261
  <li>{WIDTH} gets replaced with width of the photo</li>
262
  <li>{ICON} insert the icon for the attachment (for non-audio/image/video attachments only)</li>
163
 
164
  <h4>Post type/format</h4>
165
 
166
+ <p>You can specify the post type or format by including it as the first part of the subject followed by 2 forward slashes (//).
167
  E.g. aside//real subject</p>
168
 
169
  <h4>Categories</h4>
250
  <li>{MEDIUMWIDTH} gets replaced with the width of a medium image</li>
251
  <li>{MEDIUM} gets replaced with the url to the medium-sized image</li>
252
  <li>{PAGELINK} gets replaced with the URL of the file in WordPress</li>
 
253
  <li>{RELFILENAME} gets replaced with the relative path to the full-size image</li>
254
  <li>{THUMBHEIGHT} gets replaced with the height of a thumbnail image</li>
255
  <li>{THUMB} gets replaced with the url to the thumbnail image</li>
256
  <li>{THUMBNAIL} same as {THUMB}</li>
257
  <li>{THUMBWIDTH} gets replaced with the width of a thumbnail image</li>
258
+ <li>{TITLE} same as {FILENAME}</li>
259
  <li>{URL} same as {FILELINK}</li>
260
  <li>{WIDTH} gets replaced with width of the photo</li>
261
  <li>{ICON} insert the icon for the attachment (for non-audio/image/video attachments only)</li>
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.9.1
9
- Stable tag: 1.5.22
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -444,6 +444,11 @@ All script, style and body tags are stripped from html emails.
444
  Attachments are now processed in the order they were attached.
445
 
446
  == CHANGELOG ==
 
 
 
 
 
447
  = 1.5.22 (2014.06.10) =
448
  * Fix missing attachments for html messages
449
 
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.9.1
9
+ Stable tag: 1.5.23
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
444
  Attachments are now processed in the order they were attached.
445
 
446
  == CHANGELOG ==
447
+ = 1.5.23 (2014.08.11) =
448
+ * Remove PEAR/PEAR5 dependency which was causing errors on some systems
449
+ * Call wp_handle_upload_prefilter before adding images to WP
450
+ * Temporary new post is now draft status.
451
+
452
  = 1.5.22 (2014.06.10) =
453
  * Fix missing attachments for html messages
454