-
Notifications
You must be signed in to change notification settings - Fork 3
/
overview.php
51 lines (40 loc) · 1.03 KB
/
overview.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
<?php
class Overview{
private $a;
public function __construct(){
$this->a = array();
}
public function addMail( $to, $subject, $from, $tag ){
if( !isset( $this->a[$to] ) ){
$this->a[$to] = array();
}
$this->a[$to][] = array(
'subject' => TelegramBot::cleanHeaderField( $subject ),
'from' => TelegramBot::cleanHeaderField( $from ),
'tag' => $tag
);
}
public function send(){
$telebot = new TelegramBot();
foreach( $this->a as $to => $msg ){
$cont = '*Mailoverview*'."\n";
$count = 0;
foreach( $msg as $v ){
$n = '- ' . $v['tag'] . ' *' . $v['subject'] .'* _'. $v['from'] .'_ '. "\n";
if(mb_strlen($cont . $n) > 4096){
$r = $telebot->sendMessage( $cont, $to );
Logger::logOverview( $r, $to, $cont, $telebot->getLastResponse() );
$cont = '*Mailoverview*'."\n";
$count = 0;
}
$cont .= $n;
$count++;
}
if($count > 0){
$r = $telebot->sendMessage($cont, $to );
Logger::logOverview( $r, $to, $cont, $telebot->getLastResponse() );
}
}
}
}
?>