-
Notifications
You must be signed in to change notification settings - Fork 0
/
secure.class.reports.php
1515 lines (1267 loc) · 40.1 KB
/
secure.class.reports.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @package SECUREPHP
* @author Alexander Münch
* @copyright Alexander Münch
* @version 2.0
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
{
use AUTOFLOW\SECUREPHP;
/**
* Version of current reports class.
*/
define('SECUREPHP_REPORTS_VERSION', '2.0');
/**
* Class RAISABLE
* @inherit Exception
*/
trait RAISABLE_TRAIT
{
// TRAIT HEAD
/**
* @todo change to protected, @see set_state
* Statusmeldung.
* @var string
*/
public $state = '';
/**
* @var string
*/
protected $note = '';
/**
* @todo implement
* @var string date()
*/
protected $date;
/**
* Benutzerdefinierter Fehlercode, da Exception-Code durch status ersetzt.
* @var int
*/
protected $error_code = NULL;
/**
* @todo change to protected,
* @todo @see add_params, @see add_param
* Weitere benutzerdefinierte Parameter
* @var array
*/
public $params = ARRAY();
/**
* Individueller Timeout.
* @var $timeout NULL
*/
protected $timeout = NULL;
/**
* Nachricht wurde gesendet.
* @var bool
*/
protected $flag_has_raised = false;
/**
* @var string
*/
protected $application;
// TRAIT MAGIC METHODS
/**
* @return string
*/
final public function __toString()
{
return $this->toString($this);
}
// TRAIT METHODS
/**
* @param int|null $timeout
* @return void
* @throws \Exception
*/
final public function raise($timeout = NULL)
{
if(true == $this->has_raised())
{
return;
}
elseif(false == defined('SECUREPHP'))
{
throw new Exception('sending report failed due to missing installation. report library is not available', false, $this);
}
elseif(false == SECUREPHP\BOOTSTRAP::getInstance())
{
throw new Exception('sending report failed due to missing initialisation. could not initialise report library', NULL, $this);
}
else
{
SECUREPHP\PROTECT::getInstance()->in_progress(true);
if(NULL === $timeout) $timeout = $this->get_timeout();
SECUREPHP\PROTECT::getInstance()->notify($this->get_send_to(), $this, $timeout);
SECUREPHP\PROTECT::getInstance()->in_progress(false);
$this->has_raised(true);
}
}
/**
* @param \Exception | \RAISABLE_TRAIT | \BatchReport $e
* @return string
*/
final public function toString($e)
{
$message = '';
$flag_is_raiseable = (bool) (is_a($e, 'Raisable') OR is_a($e, 'RaisableError'));
if($e->getPrevious());
elseif($flag_is_raiseable AND $e->flag_details)
{
$message .= sprintf
("* %s %s %s, %s %s" . SECUREPHP_LINE_BREAK,
SECUREPHP\CONFIG::getInstance()->_($e->description),
SECUREPHP\CONFIG::getInstance()->_('within'),
('test' == SECUREPHP\CONFIG::getInstance()->locale() ? basename($e->getFile()) : $e->getFile()),
SECUREPHP\CONFIG::getInstance()->_('line'),
$e->getLine()
);
}
elseif($flag_is_raiseable AND !$e->flag_details);
else
{
$message .= sprintf
('* %s %s %s, %s %s ' . SECUREPHP_LINE_BREAK,
get_class($e),
SECUREPHP\CONFIG::getInstance()->_('within'),
$e->getFile(),
SECUREPHP\CONFIG::getInstance()->_('line'),
$e->getLine()
);
}
$message .= sprintf
('* %s: %s' . SECUREPHP_LINE_BREAK,
SECUREPHP\CONFIG::getInstance()->_('description'),
$e->getMessage()
);
if($flag_is_raiseable AND $e->get_note())
{
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= sprintf
('* %s: %s' . SECUREPHP_LINE_BREAK,
SECUREPHP\CONFIG::getInstance()->_('notes'),
$e->get_note()
);
}
if($flag_is_raiseable AND $e->get_status())
{
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= sprintf
('* %s: %s' . SECUREPHP_LINE_BREAK,
SECUREPHP\CONFIG::getInstance()->_('state'),
$e->get_status()
);
}
if($e->getPrevious());
elseif(($flag_is_raiseable AND $e->flag_details ) OR !$flag_is_raiseable)
{
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= '* '. SECUREPHP\CONFIG::getInstance()->_('trace') . ':' . SECUREPHP_LINE_BREAK;
$message .= $this->formatTrace($e);
}
if(is_a($e, 'BatchReport') AND $e->has_next())
{
$i = 0;
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('contents') . ': ' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP_LINE_BREAK;
foreach ($e->get_attachments() AS $attachement)
{
$message .= '* ' . SECUREPHP_LINE_BREAK;
$message .= '* ' . ++$i . ') ' . get_class($attachement) . SECUREPHP_LINE_BREAK;
$message .= '* '. SECUREPHP_LINE_BREAK . (string) $attachement;
$message .= '* ' . SECUREPHP_LINE_BREAK;
}
}
if(is_a($e, 'ConfigError') AND count($e->params))
{
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('config notes') . ':' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('obsolete configuration') . SECUREPHP_LINE_BREAK;
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('config file') . ': ' . ($e->config_file ? : SECUREPHP\CONFIG::getInstance()->_('not present')) . SECUREPHP_LINE_BREAK;
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('current configuration') .': ' . SECUREPHP_LINE_BREAK;
if( count($e->params) > 0 )
{
$count = 1;
$message .= '*' . SECUREPHP_LINE_BREAK;
foreach($e->params AS $name => $value)
{
$message .= '* '. $count .') '.$name .': '.(string) $value . SECUREPHP_LINE_BREAK;
$count++;
}
}
else
{
$message .= SECUREPHP\CONFIG::getInstance()->_('not present') . SECUREPHP_LINE_BREAK;
}
}
if ($e->getPrevious())
{
$message .= SECUREPHP_LINE_BREAK;
$message .= '* ' . SECUREPHP\CONFIG::getInstance()->_('previous') . ':' . SECUREPHP_LINE_BREAK;
$message .= '*' . SECUREPHP_LINE_BREAK;
$message .= $this->toString($e->getPrevious());
}
return $message . "";
}
/**
* @param null $flag
* @return bool
*/
final protected function has_raised($flag = NULL)
{
if(NULL === $flag) return $this->flag_has_raised;
else
{
$this->flag_has_raised = $flag;
return true;
}
}
// TRAIT GETTERS & SETTERS
/**
* @return string
*/
final public function get_md5()
{
// Nach adden von reminder funktioniert diese Zeile nicht mehr ..
#return md5(serialize($this));
// neu:
return md5(($this->__toString()));
}
/**
* Ermöglicht das Überschreiben
* der Empfängerliste eines Berichtes.
*
* @param string $users
* @return bool
*/
final public function send_to($users)
{
$this->send_to = $users;
return true;
}
/**
* @return string
*/
final public function get_send_to()
{
return $this->send_to;
}
/**
* @param null $flag
* @return bool
*/
final public function details($flag = NULL)
{
if(NULL === $flag)
{
return (bool) $this->flag_details;
}
else
{
$this->flag_details = (bool) $flag;
return true;
}
}
/**
* @param int $code
* @return bool
*/
final public function set_error_code($code)
{
$this->error_code = $code;
return true;
}
/**
* @return int
*/
final protected function get_error_code()
{
return $this->error_code;
}
/**
* @param string $state
* @return bool
*/
final public function set_state($state)
{
$this->state = $state;
return true;
}
/**
* @return null|string
*/
final protected function get_status()
{
return $this->state;
}
/**
* @param $note
* @return bool
*/
final public function set_note($note)
{
$this->note = $note;
return true;
}
/**
* @return string
*/
final protected function get_note()
{
return $this->note;
}
/**
* @param null|int $timeout
* @return bool
*/
final public function set_timeout($timeout = NULL)
{
$this->timeout = $timeout;
return true;
}
/**
* @return int|null
*/
final protected function get_timeout()
{
return $this->timeout;
}
/**
* @param array[]
* @return bool
*/
final public function add_params(ARRAY $params)
{
$this->params = $params;
return true;
}
/**
* @param string $name
* @param string $value
* @return bool
*/
final public function add_param($name='default', $value='')
{
$this->params[$name] = (string) $value;
return true;
}
/**
* @return array
*/
final public function get_params()
{
return $this->params;
}
/**
* @return string
*/
public function get_mail_header()
{
return 'Neue Nachricht von ' . SECUREPHP;
}
/**
* @param string $notice
* @return string
*/
public function get_mail_message($notice=NULL)
{
$message = '';
$message .= $this->get_mail_message_header();
if(!empty($notice))
{
$message .= SECUREPHP_MAIL_EOL;
$message .= $notice;
$message .= SECUREPHP_MAIL_EOL;
}
$message .= $this->get_mail_message_details();
$message .= $this->get_mail_message_params();
if($prev = $this->getPrevious())
{
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Vorrausgehende Fehler: ' . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $this->get_mail_message_previous($prev);
}
$message .= $this->get_mail_message_footer();
return $message;
}
/**
* @param string $title
* @return string
*/
final protected function get_mail_message_header($title=NULL)
{
$message = '';
if(!empty($title))
{
$message .= $title . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
}
$message .= SECUREPHP\PROTECT::getInstance()->get_app() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $this->getMessage() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
if($this->get_note())
{
$message .= 'Information und Hinweis:' . SECUREPHP_MAIL_EOL;
$message .= $this->get_note() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
}
$message .= 'Ausführende Anwendung oder Script:' . SECUREPHP_MAIL_EOL;
$message .= AUTOFLOW\SECUREPHP\BOOTSTRAP::getInstance()->get_abs_path() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= 'gesendet von: ' . ErrorInfo::get_host() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
return $message;
}
/**
* @return string
*/
final protected function get_mail_message_details()
{
$message = SECUREPHP_MAIL_EOL;
$message .= 'Diese Nachricht wurde ausgelöst durch:' . SECUREPHP_MAIL_EOL;
$message .= 'Datei: ' . ($this->getFile()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
$message .= 'Zeile: ' . ($this->getLine()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
$message .= 'Trace: ' . ($this->getTraceAsString()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
return $message;
}
/**
* @param \Exception | \Raisable | \RaisableError | \BatchReport $e
* @param string|null $level
* @return string
*/
final public function get_mail_message_previous($e, $level = NULL)
{
$level = ($level ? chr(ord($level) + 1) : 'A');
$message = "";
$message .= $level . ')' . SECUREPHP_MAIL_EOL;
if(is_a($e, 'ErrorTicket'))
{
$message .= $e->getMessage() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $e->get_mail_message_details();
$message .= $e->get_mail_message_params();
if (is_a($e, 'ErrorReport') AND $e->has_next())
{
$message .= $e->get_mail_message_attachments();
}
if($prev = $e->getPrevious())
{
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Vorrausgehende Fehler: ' . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $e->get_mail_message_previous($prev, $level);
}
}
else
{
$message .= $e->getMessage() . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Diese Nachricht wurde ausgelöst durch:' . SECUREPHP_MAIL_EOL;
$message .= 'Datei: ' . ($e->getFile()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
$message .= 'Zeile: ' . ($e->getLine()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
$message .= 'Trace: ' . ($e->getTraceAsString()?:'kein Wert vorhanden') . SECUREPHP_MAIL_EOL;
if($prev = $e->getPrevious())
{
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Vorrausgehende Fehler: ' . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $e->getPrevious();
}
}
if (isset($e->status))
{
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Statushinweis: ' . ($e->status ?: 'nicht vorhanden') . SECUREPHP_MAIL_EOL;
}
return $message;
}
/**
* @return string
*/
final public function get_mail_message_params()
{
if(0 < count($this->get_params()))
{
$message = SECUREPHP_MAIL_EOL;
$message .= 'Zusätzliche Parameter: ' . SECUREPHP_MAIL_EOL;
$count = 1;
$message .= SECUREPHP_MAIL_EOL;
foreach($this->get_params() AS $name => $value)
{
$message .= $count++ . ') ' . $name .': '.(string) $value . SECUREPHP_MAIL_EOL;
}
return $message;
}
else return '';
}
/**
* @return string
*/
final protected function get_mail_message_receipients()
{
$users = explode(',', $this->send_to);
foreach($users AS $user)
{
$user = trim($user);
if('all' == $user AND "all" == $this->send_to)
{
$_admins = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_admin();
$_users = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_user();
foreach(AUTOFLOW\SECUREPHP\MAIL::getInstance()->userlist AS $_user => $email) $_recipients[] = $_user . ' [' .$email. ']';
break;
}
elseif(strpos($user, '>'))
{
$_list = explode('>', $user);
foreach($_list AS $name)
{
if('admin' == $name AND !empty(AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_admin()))
{
$_admins = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_admin();
break;
}
elseif('user' == $name AND !empty(AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_user()))
{
$_users = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_user();
break;
}
elseif('log' == $name);
elseif($_email = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_cc_mail($name))
{
$_recipients[] = $name . ' ['.$_email.']';
break;
}
}
}
else
{
if('admin' == $user)
{
$_admins = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_admin();
}
elseif('user' == $user)
{
$_users = AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_user();
}
elseif('log' == $user);
else
{
$_recipients[] = $user . ' [' .AUTOFLOW\SECUREPHP\MAIL::getInstance()->get_cc_mail($user) .']';
}
}
}
$message = "";
$message .= 'Administratoren: ' . (!empty($_admins)?$_admins:'') . SECUREPHP_MAIL_EOL;
$message .= 'Mitarbeiter: ' . (!empty($_users)?$_users:'') . SECUREPHP_MAIL_EOL;
$message .= 'Weitere Empfänger: ' . (!empty($_recipients)?implode(',', $_recipients):'') . SECUREPHP_MAIL_EOL;
return $message;
}
/**
* @return string
*/
final protected function get_mail_message_footer()
{
$message = SECUREPHP_MAIL_EOL;
$message .= 'Statusinformation: ' . ($this->get_status()?:'keine Informationen vorhanden') . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Empfänger dieser Nachricht:' . SECUREPHP_MAIL_EOL;
$message .= $this->get_mail_message_receipients();
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Diese Nachricht wurde gesendet durch: ' . SECUREPHP . ' von ' . ErrorInfo::get_host() . SECUREPHP_MAIL_EOL;
return $message;
}
}
/**
* Base class E_RAISABLE.
*/
class Raisable extends SECUREPHP\EXCEPTION
{
// E_RAISEABLE HEAD
use \RAISABLE_TRAIT;
}
/**
* Base class E_RAISABLE_ERROR.
*/
class RaisableError extends SECUREPHP\ERROR_EXCEPTION
{
// E_RAISEABLE_ERROR HEAD
use \RAISABLE_TRAIT;
}
/**
* Class ErrorInfo.
*/
final class ErrorInfo
{
/**
* @return string
*/
final public static function get_host()
{
return (gethostname()? gethostname() .' (' .getHostByName(getHostName()).')':'unbekannt');
}
}
/**
* Class ErrorTicket
*/
class ErrorTicket extends \Raisable
{
/**
* @var string
*/
public $description = 'error ticket';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "admin,log";
/**
* @var bool
*/
protected $flag_details = true;
// ERRORTICKET MAGIC METHODS
/**
* @param string $message
* @param string $status
* @param \Exception $previous
* @extend Exception
*/
public function __construct($message=NULL, $status=NULL, \Exception $previous=NULL)
{
parent::__construct($message, NULL, $previous);
$this->application = SECUREPHP\PROTECT::getInstance()->get_app();
$this->state = $status;
}
}
/**
* Class UserTicket
* @inherit \ErrorTicket
*/
class UserTicket extends \ErrorTicket
{
/**
* @var string
*/
public $description = 'user info';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "user";
/**
* @var bool
*/
protected $flag_details = false;
}
/**
* Class SuccessTicket
* @inherit \ErrorTicket
*/
final class SuccessTicket extends \ErrorTicket
{
/**
* @var string
*/
public $description = 'confirmation ticket';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "user";
/**
* @var bool
*/
protected $flag_details = true;
/**
* @param string $notice
* @return string
*/
final public function get_mail_message($notice = NULL)
{
$message = '';
$message .= $this->get_mail_message_header('ALLES OK');
$message .= $this->get_mail_message_params();
if($this->getPrevious())
{
$message .= SECUREPHP_MAIL_EOL;
$message .= 'Vorrausgegangene Meldungen:' . SECUREPHP_MAIL_EOL;
$message .= SECUREPHP_MAIL_EOL;
$message .= $this->get_mail_message_previous($this->getPrevious());
}
$message .= $this->get_mail_message_footer();
return $message;
}
}
/**
* Class Warning.
* @inherit \ErrorTicket
*/
final class Warning extends \ErrorTicket
{
/**
* @var string
*/
public $description = 'warning';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "admin,log";
/**
* @var bool
*/
protected $flag_details = true;
}
/**
* Class Notice.
* @inherit \ErrorTicket
*/
final class Notice extends \ErrorTicket
{
/**
* @var string
*/
public $description = 'notice';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "admin,log";
/**
* @var bool
*/
protected $flag_details = true;
}
/**
* Class ConfigError
* @inherit \ErrorTicket
*/
final class ConfigError extends \ErrorTicket
{
// CONFIGERROR HEAD
/**
* @var string
*/
public $description = 'config error';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "admin,log";
/**
* @var bool
*/
protected $flag_details = true;
/**
* @var string
*/
public $config_file;
/**
* @var array[]
*/
public $config_params;
// CONFIGERROR METHODS
/**
* @param string|null $notice
* @return string
*/
final public function get_mail_message($notice=NULL)
{
$message = '';
$message .= 'Hinweise zur Konfiguration' . SECUREPHP_MAIL_EOL;
$message .= 'Möglicherweise sind die Verbindungsparameter nicht aktuell.' . SECUREPHP_MAIL_EOL;
$message .= 'Hinweise zur manuellen Änderung finden sie im Folgenden:' . SECUREPHP_MAIL_EOL;
$message .= 'Konfigurationsdatei: ' . ($this->config_file?:'Wert nicht angegeben') . SECUREPHP_MAIL_EOL;
$message .= 'aktuelle Konfigurationsparameter: ';
if( count($this->config_params) > 0 )
{
$count = 1;
$message .= SECUREPHP_MAIL_EOL;
foreach($this->config_params AS $name => $value)
{
$message .= $count .') '.$name .': '.(string) $value . SECUREPHP_MAIL_EOL;
$count++;
}
}
else
{
$message .= 'nicht vorhanden' . SECUREPHP_MAIL_EOL;
}
return parent::get_mail_message($message);
}
// GETTERS & SETTERS
/**
* @param string $file
* @return bool
*/
public function set_config_file($file)
{
$this->config_file = $file;
return true;
}
}
/**
* Class InitError.
*
* Verbindungsfehler etc.
* Definiert allgemeine Fehler, die in der
* Prüfschleife, vor der Verarbeitungsschleife,
* auftreten.
*
* @inherit \ErrorTicket
*/
final class InitError extends \ErrorTicket
{
/**
* @var string
*/
public $description = 'init error';
/**
* Report-Empfänger.
* @var string
*/
protected $send_to = "admin>user,log";
/**
* @var bool
*/
protected $flag_details = true;
}
/**
* Class TransitionError.
*
* Fehler bei Übergängen.
* Z.B. Verzeichniswechsel oder Statusübergänge.
* Auch Updatefehler bei Datenbanken.
*
* @inherit \ErrorTicket
*/
final class TransitionError extends \ErrorTicket
{