fix #8131 - chinese translations
[Pman.Core] / NotifySend.php
1 <?php
2 require_once 'Pman.php';
3
4 /**
5  * notification script sender - designed to be run by the Notify script - with many children running
6  * in parallel.
7  *
8  * called with an id of a core_notify element
9  *
10  * uses core_notify - to find an event to object and person.
11  *
12  * uses Events table to log failures
13  * 
14  * 
15  * calls $object->toEmail($person,$last_send, $notify) to generate an email struct with
16  *  array (
17  *      headers =>
18  *      recipients =>
19  *      body =>
20  *  )
21  *
22  *
23  * Note uses configuration
24  *
25  * Pman_Core_NotifySend[host] = 'localhost' << to override direct sending..
26  * Mail[helo] << helo host name
27  * Mail[socket_options] << any socket option.
28  */
29 class Pman_Core_NotifySend_Exception_Success extends Exception {}
30 class Pman_Core_NotifySend_Exception_Fail extends Exception {}
31
32
33 class Pman_Core_NotifySend extends Pman
34 {
35     static $cli_desc = "Send out single notification email (usually called from  Core/Notify)";
36     
37     static $cli_opts = array(
38         'debug' => array(
39             'desc' => 'Turn on debugging (see DataObjects debugLevel )',
40             'default' => 0,
41             'short' => 'v',
42             'min' => 0,
43             'max' => 0,
44             
45         ),
46         'DB_DataObject-debug' => array(
47             'desc' => 'Turn on debugging (see DataObjects debugLevel )',
48             'default' => 0,
49             'short' => 'd',
50             'min' => 1,
51             'max' => 1,
52             
53         ),
54         'force' => array(
55             'desc' => 'Force redelivery, even if it has been sent before or not queued...',
56             'default' => 0,
57             'short' => 'f',
58             'min' => 0,
59             'max' => 0,
60         ),
61         'send-to' => array(
62             'desc' => 'Send the message to this address, rather than the one listed.',
63             'default' => '',
64             'short' => 't',
65             'min' => 0,
66             'max' => 1,
67         )
68         
69         
70         
71     );
72     var $table = 'core_notify';
73     var $error_handler = 'die';
74     var $poolname = 'core';
75     var $server; // core_notify_server
76     
77     function getAuth()
78     {
79         $ff = HTML_FlexyFramework::get();
80         if (!$ff->cli) {
81             $this->errorHandler("access denied");
82         }
83         //HTML_FlexyFramework::ensureSingle(__FILE__, $this);
84         return true;
85         
86     }
87    
88     function get($id,$opts=array())
89     {
90         //if ($this->database_is_locked()) {
91         //    die("LATER - DATABASE IS LOCKED");
92        // }
93         //print_r($opts);
94         if (!empty($opts['DB_DataObject-debug'])) {
95             DB_DataObject::debugLevel($opts['DB_DataObject-debug']);
96         }
97         
98         //DB_DataObject::debugLevel(1);
99         //date_default_timezone_set('UTC');
100         // phpinfo();exit;
101         $force = empty($opts['force']) ? 0 : 1;
102         
103         $w = DB_DataObject::factory($this->table);
104
105         if (!$w->get($id)) {
106             $this->errorHandler("invalid id\n");
107         }
108
109         if (!$force && !empty($w->sent) && strtotime($w->act_when) < strtotime($w->sent)) {
110              
111             $this->errorHandler("already sent - repeat to early\n");
112         }
113         
114         $this->server = DB_DataObject::Factory('core_notify_server')->getCurrent($this, $force);
115         if (!$force &&  $w->server_id != $this->server->id) {
116             $this->errorHandler("Server id does not match - use force to try again\n");
117         }
118         
119         
120         if (!empty($opts['debug'])) {
121             print_r($w);
122             $ff = HTML_FlexyFramework::get();
123             if (!isset($ff->Core_Mailer)) {
124                 $ff->Core_Mailer = array();
125             }
126             HTML_FlexyFramework::get()->Core_Mailer['debug'] = true;
127         }
128         
129         $sent = (empty($w->sent) || strtotime( $w->sent) < 100 ) ? false : true;
130         
131         if (!$force && (!empty($w->msgid) || $sent)) {
132             $ww = clone($w);
133             if (!$sent) {   // fix sent.
134                 $w->sent = strtotime( $w->sent) < 100 ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
135                 $w->update($ww);
136             }    
137             $this->errorHandler("message has been sent already.\n");
138         }
139         
140         // we have a bug with msgid not getting filled.
141         $cev = DB_DataObject::Factory('Events');
142         $cev->on_table =  $this->table;
143         $cev->on_id =  $w->id;
144         $cev->whereAdd("action IN ('NOTIFYSENT', 'NOTIFYFAIL')");
145         $cev->limit(1);
146         if ($cev->count()) {
147             $cev->find(true);
148             $w->flagDone($cev, $cev->action == 'NOTIFYSENT' ? 'alreadysent' : '');
149             $this->errorHandler( $cev->action . " (fix old) ".  $cev->remarks);
150         }
151         
152         
153         $o = $w->object();
154         
155         if ($o === false)  {
156              
157             $ev = $this->addEvent('NOTIFY', $w,   "Notification event cleared (underlying object does not exist)" );
158             $w->flagDone($ev, '');
159             $this->errorHandler(  $ev->remarks);
160         }
161      
162         
163         
164         $p = $w->person();
165         
166         if (isset($p->active) && empty($p->active)) {
167             $ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (not user not active any more)" );;
168              $w->flagDone($ev, '');
169             $this->errorHandler(  $ev->remarks);
170         }
171         // has it failed mutliple times..
172         
173         if (!empty($w->field) && isset($p->{$w->field .'_fails'}) && $p->{$w->field .'_fails'} > 9) {
174             $ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (user has to many failures)" );;
175             $w->flagDone($ev, '');
176             $this->errorHandler(  $ev->remarks);
177         }
178         
179         // let's work out the last notification sent to this user..
180         $l = DB_DataObject::factory($this->table);
181         
182         $lar = array(
183                 'ontable' => $w->ontable,
184                 'onid' => $w->onid,
185         );
186         // only newer version of the database us this..
187         if (isset($w->person_table)) {
188             $personid_col = strtolower($w->person_table).'_id';
189             if (isset($w->{$personid_col})) {
190                 $lar[$personid_col] = $w->{$personid_col};
191             }
192         }
193         
194         
195         $l->setFrom( $lar );       
196         $l->whereAdd('id != '. $w->id);
197         $l->orderBy('sent DESC');
198         $l->limit(1);
199         $ar = $l->fetchAll('sent');
200         $last = empty($ar) ? date('Y-m-d H:i:s', 0) : $ar[0];
201         
202         // find last event..
203         $ev = DB_DataObject::factory('Events');
204         $ev->on_id = $w->id;                           // int(11)
205         $ev->on_table = $this->table;
206         $ev->limit(1);
207         $ev->orderBy('event_when DESC');
208         $ar = $ev->fetchAll('event_when');
209         $last_event = empty($ar) ? 0 : $ar[0];
210         $next_try_min = 5;
211         if ($last_event) {
212             $next_try_min = floor((time() - strtotime($last_event)) / 60) * 2;
213         }
214         $next_try = $next_try_min . ' MINUTES';
215          
216         // this may modify $p->email. (it will not update it though)
217         $email =  $this->makeEmail($o, $p, $last, $w, $force);
218         
219         if ($email === true)  {
220             $ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (not required any more) - toEmail=true" );;
221             $w->flagDone($ev, '');
222             $this->errorHandler( $ev->remarks);
223         }
224         if (is_a($email, 'PEAR_Error')) {
225             $email =array(
226                 'error' => $email->toString()
227             );
228         }
229         
230         if (empty($p) && !empty($email['recipients'])) {
231             // make a fake person..
232             $p = (object) array(
233                 'email' => $email['recipients']
234             );
235         }
236          
237         if ($email === false || isset($email['error']) || empty($p)) {
238             // object returned 'false' - it does not know how to send it..
239             $ev = $this->addEvent('NOTIFYFAIL', $w, isset($email['error'])  ? $email['error'] : "INTERNAL ERROR  - We can not handle " . $w->ontable); 
240             $w->flagDone($ev, '');
241             $this->errorHandler(  $ev->remarks);
242         }
243         
244          
245         
246         if (isset($email['later'])) {
247              
248             $this->server->updateNotifyToNextServer($w, $email['later'],true);
249              
250             $this->errorHandler("Delivery postponed by email creator to {$email['later']}");
251         }
252         
253          
254         if (empty($email['headers']['Message-Id'])) {
255             $HOST = gethostname();
256             $email['headers']['Message-Id'] = "<{$this->table}-{$id}@{$HOST}>";
257             
258         }
259         
260         
261             
262         
263         //$p->email = 'alan@akbkhome.com'; //for testing..
264         //print_r($email);exit;
265         // should we fetch the watch that caused it.. - which should contain the method to call..
266         // --send-to=test@xxx.com
267        
268         if (!empty($email['send-to'])) {
269             $p->email = $email['send-to'];
270         }
271          if (!empty($opts['send-to'])) {
272             $p->email = $opts['send-to'];
273         }
274         
275             // since some of them have spaces?!?!
276         $p->email = trim($p->email);
277         $ww = clone($w);
278         $ww->to_email = empty($ww->to_email) ? $p->email : $ww->to_email;
279         $explode_email = explode('@', $ww->to_email);
280         $dom = array_pop($explode_email);
281         
282         $core_domain = DB_DataObject::factory('core_domain')->loadOrCreate($dom);
283
284         
285         $ww->domain_id = $core_domain->id;
286         // if to_email has not been set!?
287         $ww->update($w); // if nothing has changed this will not do anything.
288         $w = clone($ww);
289     
290       
291         
292         require_once 'Validate.php';
293         if (!Validate::email($p->email, true)) {
294             $ev = $this->addEvent('NOTIFYFAIL', $w, "INVALID ADDRESS: " . $p->email);
295             $w->flagDone($ev, '');
296             $this->errorHandler($ev->remarks);
297             
298         }
299         
300         
301         $ff = HTML_FlexyFramework::get();
302         
303      
304         $mxs = $this->mxs($dom);
305         $ww = clone($w);
306
307         // we might fail doing this...
308         // need to handle temporary failure..
309        
310         
311           // we try for 2 days..
312         $retry = 15;
313         if (strtotime($w->act_start) <  strtotime('NOW - 1 HOUR')) {
314             // older that 1 hour.
315             $retry = 60;
316         }
317         
318         if (strtotime($w->act_start) <  strtotime('NOW - 1 DAY')) {
319             // older that 1 day.
320             $retry = 120;
321         }
322         if (strtotime($w->act_start) <  strtotime('NOW - 2 DAY')) {
323             // older that 1 day.
324             $retry = 240;
325         }
326         
327         if (empty($mxs)) {
328             // only retry for 1 day if the MX issue..
329             if ($retry < 240) {
330                 $this->addEvent('NOTIFY', $w, 'MX LOOKUP FAILED ' . $dom );
331                 $w->flagLater(date('Y-m-d H:i:s', strtotime('NOW + ' . $retry . ' MINUTES')));
332                 $this->errorHandler($ev->remarks);
333             }
334             
335             $ev = $this->addEvent('NOTIFYFAIL', $w, "BAD ADDRESS - BAD DOMAIN - ". $p->email );
336             $w->flagDone($ev, '');
337             $this->errorHandler($ev->remarks);
338             
339             
340         }
341         
342         
343         
344         
345         if (!$force && strtotime($w->act_start) <  strtotime('NOW - 3 DAY')) {
346             $ev = $this->addEvent('NOTIFYFAIL', $w, "BAD ADDRESS - GIVE UP - ". $p->email );
347             $w->flagDone($ev, '');
348             $this->errorHandler(  $ev->remarks);
349         }
350         
351         $retry_when = date('Y-m-d H:i:s', strtotime('NOW + ' . $retry . ' MINUTES'));
352         
353         //$this->addEvent('NOTIFY', $w, 'GREYLISTED ' . $p->email . ' ' . $res->toString());
354         // we can only update act_when if it has not been sent already (only happens when running in force mode..)
355         // set act when if it's empty...
356         $w->act_when =  (!$w->act_when || $w->act_when == '0000-00-00 00:00:00') ? $retry_when : $w->act_when;
357         
358         $w->update($ww);
359         
360         $ww = clone($w);   
361         
362         $fail = false;
363         require_once 'Mail.php';
364         
365         
366         $this->server->initHelo();
367         
368         if (!isset($ff->Mail['helo'])) {
369             $this->errorHandler("config Mail[helo] is not set");
370         }
371         
372         $email = DB_DataObject::factory('core_notify_sender')->filterEmail($email, $w);
373             
374                         
375         foreach($mxs as $mx) {
376             
377            
378             $this->debug_str = '';
379             $this->debug("Trying SMTP: $mx / HELO {$ff->Mail['helo']}");
380             $mailer = Mail::factory('smtp', array(
381                     'host'    => $mx ,
382                     'localhost' => $ff->Mail['helo'],
383                     'timeout' => 15,
384                     'socket_options' =>  isset($ff->Mail['socket_options']) ? $ff->Mail['socket_options'] : null,
385                     //'debug' => isset($opts['debug']) ?  1 : 0,
386                     'debug' => 1,
387                     'debug_handler' => array($this, 'debugHandler')
388             ));
389             
390             // if the host is the mail host + it's authenticated add auth details
391             // this normally will happen if you sent  Pman_Core_NotifySend['host']
392              
393             
394             if (isset($ff->Mail['host']) && $ff->Mail['host'] == $mx && !empty($ff->Mail['auth'] )) {
395                 
396                 $mailer->auth = true;
397                 $mailer->username = $ff->Mail['username'];
398                 $mailer->password = $ff->Mail['password'];        
399             }
400             
401             if(!empty($ff->Core_Notify) && !empty($ff->Core_Notify['routes'])){
402                 
403                 // we might want to regex 'office365 as a mx host 
404                 foreach ($ff->Core_Notify['routes'] as $server => $settings){
405                     if(!in_array($dom, $settings['domains'])){
406                         continue;
407                     }
408                     
409                     // what's the minimum timespan.. - if we have 60/hour.. that's 1 every minute.
410                     // if it's newer that '1' minute...
411                     // then shunt it..
412                     
413                     $settings['rate'] = isset( $settings['rate']) ?  $settings['rate']  : 360;
414                     
415                     $seconds = floor((60 * 60) / $settings['rate']);
416                     
417                     $core_notify = DB_DataObject::factory($this->table);
418                     $core_notify->domain_id = $core_domain->id;
419                     $core_notify->server_id = $this->server->id;
420                     $core_notify->whereAdd("
421                         sent >= NOW() - INTERVAL $seconds SECOND
422                     ");
423                     
424                     if($core_notify->count()){
425                         $this->server->updateNotifyToNextServer( $w , date("Y-m-d H:i:s", time() + $seconds), true);
426                         $this->errorHandler( " Too many emails sent by {$dom} - requeing");
427                     }
428                      
429                     
430                     
431                     $mailer->host = $server;
432                     $mailer->auth = isset($settings['auth']) ? $settings['auth'] : true;
433                     $mailer->username = $settings['username'];
434                     $mailer->password = $settings['password'];
435                     if (isset($settings['port'])) {
436                         $mailer->port = $settings['port'];
437                     }
438                     if (isset($settings['socket_options'])) {
439                         $mailer->socket_options = $settings['socket_options'];
440                         
441                     }
442                     
443                     
444                     break;
445                 }
446                 
447             }
448         
449            
450             
451             
452             $res = $mailer->send($p->email, $email['headers'], $email['body']);
453             if (is_object($res)) {
454                 $res->backtrace = array(); 
455             }
456             $this->debug("GOT response to send: ". print_r($res,true)); 
457             
458             if ($res === true) {
459                 // success....
460                 
461                 $successEventName = (empty($email['successEventName'])) ? 'NOTIFYSENT' : $email['successEventName'];
462                 
463                 $ev = $this->addEvent($successEventName, $w, "{$w->to_email} - {$email['headers']['Subject']}");
464                 
465                 $ev->writeEventLog($this->debug_str);
466                  
467                 $w->flagDone($ev, $email['headers']['Message-Id']);
468                 
469                  
470                 // enable cc in notify..
471                 if (!empty($email['headers']['Cc'])) {
472                     $cmailer = Mail::factory('smtp',  isset($ff->Mail) ? $ff->Mail : array() );
473                     $email['headers']['Subject'] = "(CC): " . $email['headers']['Subject'];
474                     $cmailer->send($email['headers']['Cc'],    $email['headers'], $email['body']);
475                     
476                 }
477                 
478                 if (!empty($email['bcc'])) {
479                     $cmailer = Mail::factory('smtp', isset($ff->Mail) ? $ff->Mail : array() );
480                     $email['headers']['Subject'] = "(CC): " . $email['headers']['Subject'];
481                     $res = $cmailer->send($email['bcc'],  $email['headers'], $email['body']);
482                     if (!$res || is_a($res, 'PEAR_Error')) {
483                         echo "could not send bcc..\n";
484                     } else {
485                         echo "Sent BCC to {$email['bcc']}\n";
486                     }
487                 }
488                  
489                 $this->errorHandler( " SENT {$w->id} - {$ev->remarks}", true);
490             }
491             // what type of error..
492             $code = empty($res->userinfo['smtpcode']) ? -1 : $res->userinfo['smtpcode'];
493             if (!empty($res->code) && $res->code == 10001) {
494                 // fake greylist if timed out.
495                 $code = -1; 
496             }
497             
498             if ($code < 0) {
499                 $this->debug($res->message);
500                 continue; // try next mx... ??? should we wait??? - nope we did not even connect..
501             }
502             // give up after 2 days..
503             if (in_array($code, array( 421, 450, 451, 452))   && $next_try_min < (2*24*60)) {
504                 // try again later..
505                 // check last event for this item..
506                 //$errmsg=  $fail ? ($res->userinfo['smtpcode'] . ': ' .$res->toString()) :  " - UNKNOWN ERROR";
507                 $errmsg=  $res->userinfo['smtpcode'] . ': ' .$res->message ;
508                 if (!empty($res->userinfo['smtptext'])) {
509                     $errmsg=  $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
510                 }
511                 //print_r($res);
512                 $ev = $this->addEvent('NOTIFY', $w, 'GREYLISTED - ' . $errmsg);
513                 
514                 $this->server->updateNotifyToNextServer($w,  $retry_when,true);
515                 
516                 $this->errorHandler(  $ev->remarks);
517             }
518             
519             $fail = true;
520             break;
521         }
522         
523         // after trying all mxs - could not connect...
524         if  (!$fail && ($next_try_min > (2*24*60) || strtotime($w->act_start) < strtotime('NOW - 3 DAYS'))) {
525             
526             $errmsg=  " - UNKNOWN ERROR";
527             if (isset($res->userinfo['smtptext'])) {
528                 $errmsg=  $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
529             }
530             
531             $ev = $this->addEvent('NOTIFYFAIL', $w,  "RETRY TIME EXCEEDED - " .  $errmsg);
532             $w->flagDone($ev, '');
533             $this->errorHandler( $ev->remarks);
534         }
535         
536         if ($fail) { //// !!!!<<< BLACKLIST DETECT?
537         // fail.. = log and give up..
538             $errmsg=   $res->userinfo['smtpcode'] . ': ' .$res->toString();
539             if (isset($res->userinfo['smtptext'])) {
540                 $errmsg=  $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
541             }
542             
543             if ( $res->userinfo['smtpcode']> 500 ) {
544                 
545                 DB_DataObject::factory('core_notify_sender')->checkSmtpResponse($email, $w, $errmsg);
546
547                 
548                 if ($this->server->checkSmtpResponse($errmsg, $core_domain)) {
549                     $ev = $this->addEvent('NOTIFY', $w, 'BLACKLISTED  - ' . $errmsg);
550                     $this->server->updateNotifyToNextServer($w,  $retry_when,true);
551                     $this->errorHandler( $ev->remarks);
552                 }
553             }
554              
555             $ev = $this->addEvent('NOTIFYFAIL', $w, ($fail ? "FAILED - " : "RETRY TIME EXCEEDED - ") .  $errmsg);
556             $w->flagDone($ev, '');
557              
558             $this->errorHandler( $ev->remarks);
559         }
560         
561         // at this point we just could not find any MX records..
562         
563         
564         // try again.
565         
566         $ev = $this->addEvent('NOTIFY', $w, 'GREYLIST - NO HOST CAN BE CONTACTED:' . $p->email);
567         
568         $this->server->updateNotifyToNextServer($w,  $retry_when ,true);
569
570         
571          
572         $this->errorHandler($ev->remarks);
573
574         
575     }
576     function mxs($fqdn)
577     {
578         $ff = HTML_FlexyFramework::get();
579         if (isset($ff->Pman_Core_NotifySend['host'])) {
580             return array($ff->Pman_Core_NotifySend['host']);
581         }
582         
583         $mx_records = array();
584         $mx_weight = array();
585         $mxs = array();
586         if (!getmxrr($fqdn, $mx_records, $mx_weight)) {
587             if (!checkdnsrr($fqdn)) {
588                 return false;
589             }
590             return array($fqdn);
591         }
592         
593         asort($mx_weight,SORT_NUMERIC);
594         
595         foreach($mx_weight as $k => $weight) {
596             if (!empty($mx_records[$k])) {
597                 $mxs[] = $mx_records[$k];
598             }
599         }
600         return empty($mxs) ? false : $mxs;
601     }
602     
603     /**
604      * wrapper to call object->toEmail()
605      *
606      * return
607      *   {
608         headers : {AssocArray},
609         body: {String}
610         
611         // optional..
612         error :  {String} // error message in log.
613         send-to: {String} // use to override rcpt
614          
615      }
616      **/
617     function makeEmail($object, $rcpt, $last_sent_date, $notify, $force =false)
618     {
619         $m = 'notify'. $notify->evtype;
620         //var_dump(get_class($object) . '::' .$m);
621         if (!empty($notify->evtype) && method_exists($object,$m)) {
622             echo "calling :" . get_class($object) . '::' .$m . "\n";
623             return $object->$m($rcpt, $last_sent_date, $notify, $force);
624         }
625         
626         $type = explode('::', $notify->evtype);
627         
628         if(!empty($type[1]) && method_exists($object,$type[1])){
629             $m = $type[1];
630             echo "calling :" . get_class($object) . '::' .$m . "\n";
631             return $object->$m($rcpt, $last_sent_date, $notify, $force);
632         }
633         // fallback if evtype is empty..
634         
635         if (method_exists($object, 'toMailerData')) {
636             return $object->toMailerData(array(
637                 'rcpts'=>$rcpt,
638                 'person'=>$rcpt, // added as mediaoutreach used this?
639             )); //this is core_email - i think it's only used for testing...
640             //var_Dump($object);
641             //exit;
642         }
643         if (method_exists($object, 'toEmail')) {
644             return $object->toEmail($rcpt, $last_sent_date, $notify, $force);
645         }
646         // no way to send this.. - this needs to handle core_notify how we have used it for the approval stuff..
647         
648         return false;
649     }
650     
651     function debug($str)
652     {
653         if (empty($this->cli_args['debug'])) {
654             return;
655             
656         }
657         echo $str . "\n";
658     }
659     function output()
660     {
661         $this->errorHandler("done\n");
662     }
663     var $debug_str = '';
664     
665     function debugHandler ($smtp, $message)
666     {
667         $this->debug_str .= strlen($this->debug_str) ? "\n" : '';
668         $this->debug_str .= $message;
669         //echo $message ."\n";
670     }
671     
672     function errorHandler($msg, $success = false)
673     {
674         if($this->error_handler == 'exception'){
675             if($success){
676                 throw new Pman_Core_NotifySend_Exception_Success($msg);
677             }
678             
679             throw new Pman_Core_NotifySend_Exception_Fail($msg);
680         }
681         
682         die(date('Y-m-d h:i:s') . ' ' . $msg ."\n");
683         
684         
685     }
686     
687     function updateServer($w)
688     {
689         $ff = HTML_FlexyFramework::get();
690          
691         if (empty($ff->Core_Notify['servers'])) {
692             return;
693         }
694         // some classes dont support server routing
695         if (!property_exists($w, 'server_id')) {
696             return;
697         }
698         // next server..
699         $w->server_id = ($w->server_id + 1) % count(array_keys($ff->Core_Notify['servers']));
700          
701     }
702     
703
704     
705 }