Example #1
0
 public static function getEmails($list_id = 0)
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     //get Acymailing subscribers email
     $query->select('s.email')->from('#__acymailing_subscriber AS s')->join('LEFT', '#__acymailing_listsub AS l ON s.subid = l.subid')->where('l.listid = ' . (int) $list_id)->where('l.status = 1')->where('s.enabled = 1')->where('s.accept = 1');
     $db->setQuery($query);
     try {
         $emails = $db->loadColumn();
     } catch (RuntimeException $e) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Acymailing query error: ' . $e->getMessage());
         }
         return false;
     }
     if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Acymailing query error: ' . $error);
         }
         return false;
     }
     if (is_array($emails) and count($emails)) {
         return $emails;
     }
     return false;
 }
Example #2
0
 public static function getEmail($profile_id = 0)
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     //get JomSocial user email
     $query->select('u.email')->from('#__users AS u')->where('u.id = ' . (int) $profile_id);
     $db->setQuery($query);
     try {
         $email = $db->loadResult();
     } catch (RuntimeException $e) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('JomSocial query error: ' . $e->getMessage());
         }
         return false;
     }
     if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('JomSocial query error: ' . $error);
         }
         return false;
     }
     if (!empty($email)) {
         return $email;
     }
     return false;
 }
Example #3
0
 public static function getEmail($entry_id = 0)
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     //get SobiPro entry email
     $query->select('d.baseData')->from('#__sobipro_field AS f')->join('LEFT', '#__sobipro_field_data AS d ON d.fid = f.fid')->where('d.sid = ' . (int) $entry_id)->where('f.enabled = 1')->where('(f.fieldType = ' . $db->quote('email') . ' OR f.filter = ' . $db->quote('email') . ')');
     $db->setQuery($query);
     try {
         $email = $db->loadResult();
     } catch (RuntimeException $e) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('SobiPro query error: ' . $e->getMessage());
         }
         return false;
     }
     if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('SobiPro query error: ' . $error);
         }
         return false;
     }
     if (!empty($email)) {
         if (JMailHelper::isEmailAddress($email)) {
             return $email;
         } else {
             $result = self::unserialize($email);
             if ($result !== false && is_array($result)) {
                 foreach ($result as $a) {
                     if (JMailHelper::isEmailAddress($a)) {
                         return $a;
                     }
                 }
             }
         }
     }
     //get SobiPro entry owner email
     $query = $db->getQuery(true);
     $query->select('u.email')->from('#__sobipro_object AS o')->join('LEFT', '#__users AS u ON u.id = o.owner')->where('o.id = ' . (int) $entry_id);
     $db->setQuery($query);
     try {
         $email = $db->loadResult();
     } catch (RuntimeException $e) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('SobiPro query error: ' . $e->getMessage());
         }
         return false;
     }
     if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('SobiPro query error: ' . $error);
         }
         return false;
     }
     if (!empty($email)) {
         return $email;
     }
     return false;
 }
Example #4
0
 public static function getEmail($item_id = 0)
 {
     // load config
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     // get app
     $zoo = App::getInstance('zoo');
     // get current Zoo item
     $item = $zoo->table->item->get($item_id);
     if ($item) {
         if (!in_array($item->type, array('author', 'employee'))) {
             $elements = $item->getElements();
             $email = $item = null;
             foreach ($elements as $element) {
                 // Find email for current Zoo item
                 if ($element->getElementType() == 'email') {
                     $email = $element->get('value');
                     if ($item) {
                         break;
                     }
                 }
                 // Find author or employee ID for current Zoo item
                 if (in_array(strtolower($element->config->get('name')), array('author', 'employee'))) {
                     if ($element->getElementType() == 'relateditems') {
                         $relateditems = $element->get('item', array());
                         if (isset($relateditems[0])) {
                             // get author or employee Zoo item
                             $item = $zoo->table->item->get($relateditems[0]);
                             if ($email) {
                                 break;
                             }
                         }
                     }
                 }
             }
             if ($email) {
                 return $email;
             }
         }
         if ($item) {
             // get email for Zoo author or employee
             $elements = $item->getElements();
             foreach ($elements as $element) {
                 if ($element->getElementType() == 'email') {
                     return $element->get('value');
                 }
             }
         }
     }
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     //get Zoo created by user email
     $query->select('u.email')->from('#__zoo_item AS i')->join('LEFT', '#__users AS u ON u.id = i.created_by')->where('i.id = ' . (int) $item_id);
     $db->setQuery($query);
     try {
         $email = $db->loadResult();
     } catch (RuntimeException $e) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Zoo query error: ' . $e->getMessage());
         }
         return false;
     }
     if (version_compare(JVERSION, '3.0.0') == -1 and $error = $db->getErrorMsg()) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Zoo query error: ' . $error);
         }
         return false;
     }
     if (!empty($email)) {
         return $email;
     }
     return false;
 }
Example #5
0
 public function delete($print_response = true)
 {
     if (PWEBCONTACT_DEBUG) {
         modPwebcontactHelper::setLog('Deleting file');
     }
     return parent::delete($print_response);
 }