Exemplo n.º 1
0
 public static function executeCronTask()
 {
     global $cookie;
     if (!Configuration::get('TS_SEND_SEPERATE_MAIL')) {
         return true;
     }
     $to_remove = array();
     $alerts_infos = RatingAlert::_getAlertsInformations((int) Configuration::get('TS_SEND_SEPERATE_MAIL_DELAY'));
     $ts_module = new TrustedShops();
     foreach ($alerts_infos as $infos) {
         $cookie->id_lang = $infos['id_lang'];
         $subject = $ts_module->getL('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->getL('title_part_2');
         $template_vars = array('{ts_id}' => Configuration::get('TS_ID_' . (int) $infos['id_lang']), '{button_url}' => TrustedShops::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/img', '{rating_url}' => $ts_module->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
         $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], NULL, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__) . '/mails/');
         if ($result) {
             $to_remove[] = (int) $infos['id_alert'];
         }
     }
     if (sizeof($to_remove) > 0) {
         self::removeAlerts($to_remove);
     }
     return sizeof($to_remove) == sizeof($alerts_infos);
 }