Exemple #1
0
 public static function getHiddenField()
 {
     $app = JFactory::getApplication();
     $params = modPwebcontactHelper::getParams();
     $html = '';
     if ($params->get('sobipro') && ($entry_id = $app->input->getInt('sid', 0))) {
         if ($params->get('sobipro_entry')) {
             $html = '<input type="hidden" name="sobipro" value="' . $entry_id . '">';
         } elseif ($app->input->get('option') == 'com_sobipro') {
             $db = JFactory::getDBO();
             $query = $db->getQuery(true);
             //get SobiPro object type
             $query->select('oType')->from('#__sobipro_object')->where('id = ' . (int) $entry_id);
             $db->setQuery($query);
             try {
                 $type = $db->loadResult();
             } catch (RuntimeException $e) {
                 return null;
             }
             if ($type == 'entry') {
                 $html = '<input type="hidden" name="sobipro" value="' . $entry_id . '">';
             }
         }
     }
     return $html;
 }
Exemple #2
0
 public static function getHiddenField()
 {
     $app = JFactory::getApplication();
     $params = modPwebcontactHelper::getParams();
     $html = '';
     if ($params->get('zoo') && ($item_id = $app->input->getInt('item_id', 0))) {
         if ($params->get('zoo_item') == 2) {
             $html = '<input type="hidden" name="zoo" value="' . $item_id . '">';
         } elseif ($app->input->get('option') == 'com_zoo' and $app->input->get('task') == 'item') {
             $html = '<input type="hidden" name="zoo" value="' . $item_id . '">';
         }
     }
     return $html;
 }
Exemple #3
0
 public static function getHiddenField()
 {
     $app = JFactory::getApplication();
     $params = modPwebcontactHelper::getParams();
     $html = '';
     if ($params->get('jomsocial') and $profile_id = $app->input->getInt('userid', 0)) {
         if ($params->get('jomsocial') == 2) {
             $html = '<input type="hidden" name="jomsocial" value="' . $profile_id . '">';
         } elseif ($app->input->get('option') == 'com_community' and $app->input->get('view') == 'profile') {
             //check if current user has access rights
             if (self::hasAccessRights($profile_id)) {
                 $html = '<input type="hidden" name="jomsocial" value="' . $profile_id . '">';
             }
         }
     }
     return $html;
 }
Exemple #4
0
 public static function getHiddenField()
 {
     $app = JFactory::getApplication();
     $params = modPwebcontactHelper::getParams();
     $html = '';
     if ($params->get('comprofiler') && ($profile_id = $app->input->getInt('user', 0))) {
         if ($params->get('comprofiler') == 2) {
             $html = '<input type="hidden" name="comprofiler" value="' . $profile_id . '">';
         } elseif ($app->input->get('option') == 'com_comprofiler' && $app->input->get('task') == 'userprofile') {
             //check if current user has access rights
             if (self::hasAccessRights($profile_id)) {
                 $html = '<input type="hidden" name="comprofiler" value="' . $profile_id . '">';
             }
         }
     }
     return $html;
 }
Exemple #5
0
 public static function deleteAttachments()
 {
     $app = JFactory::getApplication();
     $attachments = $app->input->get('attachments', array(), 'array');
     if (count($attachments)) {
         jimport('joomla.filesystem.file');
         $params = modPwebcontactHelper::getParams();
         $path = $params->get('upload_path');
         foreach ($attachments as $file) {
             JFile::delete($path . $file);
         }
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Deleted ' . count($attachments) . ' files');
         }
     } elseif (PWEBCONTACT_DEBUG) {
         modPwebcontactHelper::setLog('No files to delete');
     }
 }
Exemple #6
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;
 }