Exemple #1
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;
 }
Exemple #2
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;
 }
Exemple #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;
 }
Exemple #4
0
    ?>
 <span class="icon-chevron-right"></span></button>
					</div>
				<?php 
}
?>
			</div>
			
			<?php 
if ($params->get('msg_position', 'after') == 'after') {
    echo $message;
}
?>
			
			<?php 
echo modPwebcontactHelper::getHiddenFields();
?>
			<input type="hidden" name="<?php 
echo JSession::getFormToken();
?>
" value="1" id="pwebcontact<?php 
echo $module->id;
?>
_token">
		</form>
		
		<?php 
if ($params->get('show_upload', 0)) {
    ?>
		<div class="pweb-dropzone" aria-hidden="true"><div><?php 
    echo JText::_('MOD_PWEBCONTACT_DROP_FILES');
Exemple #5
0
// Toggler tab name
$toggler_name = explode('|', $params->get('toggler_name', 'MOD_PWEBCONTACT_TOGGLER'));
$params->def('toggler_name_open', str_replace('"', '', JText::_($toggler_name[0])));
$params->def('toggler_name_close', array_key_exists(1, $toggler_name) ? str_replace('"', '', JText::_($toggler_name[1])) : null);
// Set media path
$media_path = JPATH_ROOT . '/media/mod_pwebcontact/';
$params->set('media_path', $media_path);
$media_url = JUri::base(true) . '/media/mod_pwebcontact/';
$params->set('media_url', $media_url);
// Captcha
$captcha_plugin = $params->get('captcha', 0);
if ($captcha_plugin == -1) {
    $captcha_plugin = $app->getCfg('captcha', 0);
    $params->set('captcha', $captcha_plugin);
}
if ($captcha_plugin and ($captcha = JCaptcha::getInstance($captcha_plugin)) == null) {
    $params->set('captcha', 0);
}
// Set params
modPwebcontactHelper::setParams($params);
// Get JavaScript init code
$script = modPwebcontactHelper::getScript();
// Load CSS and JS files and JS translations
modPwebcontactHelper::initHeader();
// Module CSS classes
modPwebcontactHelper::initCssClassess();
$positionClass = $params->get('positionClass');
$moduleClass = $params->get('moduleClass');
// Load fields
$fields = modPwebcontactHelper::getFields();
require JModuleHelper::getLayoutPath('mod_pwebcontact', $params->get('layout', 'default'));
Exemple #6
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;
 }
Exemple #7
0
 protected function getInput()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $html = $params = null;
     if (version_compare(JVERSION, '2.5.5') == -1) {
         // Joomla minimal version
         $app->enqueueMessage(JText::sprintf('MOD_PWEBCONTACT_CONFIG_MSG_JOOMLA_VERSION', '2.5.5', '<a href="index.php?option=com_joomlaupdate" target="_blank">', '</a>'), 'error');
     } else {
         JHtml::_('stylesheet', 'jui/icomoon.css', array(), true);
         // check Joomla Global Mailer configuration
         $this->checkMailer();
         // Module ID
         $module_id = $app->input->getInt('id', 0);
         // check module configuration
         if ($module_id > 0) {
             // get params
             require_once JPATH_ROOT . '/modules/mod_pwebcontact/helper.php';
             $params = modPwebcontactHelper::getParams($module_id);
             if ($params->get('rtl', 2) == 2) {
                 // warn about auto RTL
                 $langs = JLanguage::getKnownLanguages(JPATH_ROOT);
                 foreach ($langs as $lang) {
                     if ((bool) $lang['rtl']) {
                         $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_RTL_TIP'), 'notice');
                         break;
                     }
                 }
             }
             // check if debug mode is enabled
             if ($params->get('debug', 0)) {
                 $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_MSG_DISABLE_DEBUG'), 'notice');
             }
             // check if demo mode is enabled
             if ($params->get('demo', 0)) {
                 $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_MSG_DEMO'), 'warning');
             }
             // check if upload directory is writable
             if ($params->get('show_upload', 0)) {
                 $this->checkUploadPath('/media/mod_pwebcontact/upload/' . $module_id . '/');
             }
             // check Admin Tools Pro exception
             if (is_file(JPATH_ROOT . '/components/com_ajax/ajax.php')) {
                 $this->checkAdminToolsPro();
             } elseif ($params->get('root_path', 0)) {
                 $this->checkAdminToolsPro('mod_pwebcontact_ajax.php');
             } else {
                 $this->checkAdminToolsPro('modules/mod_pwebcontact/ajax.php');
             }
             // check JoomlArt T3 Framework templates
             $this->checkJAT3v2CacheExclude('mod_pwebcontact');
             // check module details configuration
             $this->checkModuleDetails($module_id);
         }
         // check if Ajax Interface is installed and enabled
         if ($this->checkAjaxComponent() === true or version_compare(JVERSION, '3.2.0') >= 0) {
             // Hide root path option
             $doc->addScriptDeclaration('jQuery(document).ready(function($){' . '$("#' . $this->formControl . '_' . $this->group . '_root_path").closest("li,div.control-group").hide();' . '});');
         }
         // check if Bootstrap is updated to version 2.3.1
         if (version_compare(JVERSION, '3.0.0') >= 0 and version_compare(JVERSION, '3.1.4') == -1) {
             $this->checkBootstrap();
         }
         // check functions for image creation
         $this->checkImageTextCreation();
         // check if cache directory is writable
         // check if direct access to files in cache directory is allowed
         $this->checkCacheDir();
     }
     // add documentation toolbar button
     if (version_compare(JVERSION, '3.0.0') == -1) {
         $button = '<a href="' . $this->documentation . '" style="font-weight:bold;border-color:#025A8D;background-color:#DBE4E9;" target="_blank"><span class="icon-32-help"> </span> ' . JText::_('MOD_PWEBCONTACT_DOCUMENTATION') . '</a>';
     } else {
         $button = '<a href="' . $this->documentation . '" class="btn btn-small btn-info" target="_blank"><i class="icon-support"></i> ' . JText::_('MOD_PWEBCONTACT_DOCUMENTATION') . '</a>';
     }
     $bar = JToolBar::getInstance();
     $bar->appendButton('Custom', $button, $this->extension . '-docs');
     JText::script('MOD_PWEBCONTACT_PREVIEW_BUTTON');
     JText::script('MOD_PWEBCONTACT_COPY_BUTTON');
     JText::script('MOD_PWEBCONTACT_INTEGRATION_COMPONENT_VIEW');
     // add admin styles and script
     $doc->addStyleSheet(JUri::root(true) . '/media/mod_pwebcontact/css/admin.css');
     if (class_exists('JHtmlJquery')) {
         JHtml::_('jquery.framework');
         $doc->addScript(JUri::root(true) . '/media/mod_pwebcontact/js/jquery.admin.js');
     }
     // disable Joomla Form Validator which slows down saving big forms
     $doc->addScriptDeclaration('window.addEvent("domready", function(){' . 'document.forms.adminForm.className = document.forms.adminForm.className.replace("form-validate", "");' . 'document.formvalidator = {' . 'setHandler: function(name, fn, en){},' . 'attachToForm: function(form){},' . 'validate: function(el){return true},' . 'isValid: function(form){return true},' . 'handleResponse: function(state, el){}' . '};' . '});');
     // check if user is authorized to manage extensions
     if (JFactory::getUser()->authorise('core.manage', 'com_installer')) {
         // add feeds script
         if ($this->value == 1 or $this->value == 3) {
             require_once JPATH_ROOT . '/modules/mod_pwebcontact/helpers/updateserver.php';
             $updateServer = new modPWebContactUpdateServer();
             $doc->addScriptDeclaration($updateServer->getFeedScript());
         }
     } else {
         $doc->addScriptDeclaration('if(typeof jQuery!=="undefined"){' . 'jQuery(document).ready(function($){' . '$("#' . $this->formControl . '_' . $this->group . '_feed").closest("li,div.control-group").hide();' . '})}');
     }
     return parent::getInput() . $html;
 }
Exemple #8
0
 public function delete($print_response = true)
 {
     if (PWEBCONTACT_DEBUG) {
         modPwebcontactHelper::setLog('Deleting file');
     }
     return parent::delete($print_response);
 }
Exemple #9
0
 protected static function getSystemInfo()
 {
     if (!self::$sys_info) {
         self::$sys_info = array('Joomla! version ' . JVERSION);
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         // get extension details
         $query->select('manifest_cache')->from('#__extensions')->where('type = ' . $db->quote('module'))->where('element = ' . $db->quote('mod_pwebcontact'));
         $db->setQuery($query);
         try {
             if ($manifest_cache = $db->loadResult()) {
                 $manifest = new JRegistry($manifest_cache);
                 if ($version = $manifest->get('version')) {
                     self::$sys_info[] = 'Contact Form version ' . $version;
                 }
             }
         } catch (RuntimeException $e) {
         }
     }
     return self::$sys_info;
 }