Exemplo n.º 1
0
 function UnsubscribeEmail($email)
 {
     if ($email != '' and $this->getPermissionObject()->Check('company', 'edit')) {
         return UserFactory::UnsubscribeEmail($email);
     }
     return FALSE;
 }
 function sendEmail($to, $headers, $body)
 {
     global $config_vars;
     if (!isset($config_vars['other']['primary_company_id'])) {
         $config_vars['other']['primary_company_id'] = 1;
     }
     try {
         $clf = TTnew('CompanyListFactory');
         $clf->getById($config_vars['other']['primary_company_id']);
         if ($clf->getRecordCount() > 0) {
             foreach ($clf as $c_obj) {
                 $company_data = array('system_version' => APPLICATION_VERSION, 'registration_key' => $this->getLocalRegistrationKey(), 'product_edition_id' => $c_obj->getProductEdition(), 'product_edition_available' => getTTProductEdition(), 'name' => $c_obj->getName(), 'short_name' => $c_obj->getShortName(), 'work_phone' => $c_obj->getWorkPhone(), 'city' => $c_obj->getCity(), 'country' => $c_obj->getCountry(), 'province' => $c_obj->getProvince(), 'postal_code' => $c_obj->getPostalCode());
             }
         }
     } catch (Exception $e) {
         Debug::Text('ERROR: Cant get company data for sending email, database is likely down...', __FILE__, __LINE__, __METHOD__, 10);
         $company_data = NULL;
     }
     if (isset($company_data) and $to != '' and $body != '') {
         $retval = $this->getSoapObject()->sendEmail($to, $headers, $body, $company_data);
         if ($retval === 'unsubscribe') {
             UserFactory::UnsubscribeEmail($to);
             $retval = FALSE;
         }
         return $retval;
     }
     return FALSE;
 }