Current Path :
/
home
/
develito
/
httpdocs
/
components
/
com_raforms
/
controllers
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/httpdocs/components/com_raforms/controllers/fform.raw.php
<?php /* ------------------------------------------------------------------------ # com_raforms - rootArea Forms # ------------------------------------------------------------------------ # author Markus Döhla # copyright Copyright (C) 2012 rootarea.de. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # @license - Please read policy about plugins development in administrator/components/com_raforms/license-plugins.txt carefully # @license - Additional EULA on www.rootarea.de DOES NOT apply to ANY lite packages # Websites: http://www.rootarea.de # Technical Support: Forum - http://www.rootarea.de/en/forum ------------------------------------------------------------------------- */ //-- No direct access defined('_JEXEC') or die('=;)'); jimport('joomla.application.component.controller'); class RAformsControllerFForm extends JControllerLegacy { function plugin() { $app = JFactory::getApplication(); $Itemid = JRequest::getVar('Itemid'); $format = JRequest::getVar('format'); $plugin = JRequest::getVar('plugin'); $pluginTask = JRequest::getVar('ptask', 'defaultTask'); $menu = $app->getMenu(); $params = $menu->getParams($Itemid); // try to get the form id if called from category view $this->formid = $params->get('formid'); $this->formid = (empty($this->formid)) ? JRequest::getVar('formid') : $this->formid; $app->setUserState('com_raforms.formid', $this->formid); $ids = $this->checkRoute(); //if (!in_array($Itemid, $ids) && $format != 'raw') if ($format != 'raw') { $link = JRoute::_('index.php?Itemid='.$ids[0], false); $msg = JText::_('RAFORMS_RESTRICTED'); $msg .= '<br>'; $msg .= 'Itemid: ' . $Itemid . ' ;; ids: ' . print_r($ids); $error = 'error'; $this->setRedirect($link, $msg, $error); $this->redirect(); } else { // load plugin model and let it do its work JLoader::import('joomla.application.component.model'); JLoader::import( $plugin . 'Model', JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'extension' . DIRECTORY_SEPARATOR . 'raforms_' . $plugin . DIRECTORY_SEPARATOR . 'site'); $pluginModel = JModelLegacy::getInstance( $plugin, 'RAformsModelPlugin' ); $pluginModel->$pluginTask(); } } protected function checkRoute() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $ids = array(); $sql = $db->getQuery(true); $sql->select('a.id'); $sql->from('#__menu a'); $sql->join('left', '#__extensions b on a.component_id = b.extension_id'); $sql->where('b.element = ' . $db->quote('com_raforms')); $sql->where('b.type = ' . $db->quote('component')); $sql->where('a.menutype != ' . $db->quote('main')); $sql->where('a.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')'); $db->setQuery($sql); $ids = $db->loadColumn(); return $ids; } }