function display($tpl = null) { global $mainframe, $option; JToolBarHelper::title(JText::_('NOIXACL_VIEWS_ADAPTERS_TITLE_ADAPTERS'), 'install.png'); JToolBarHelper::deleteList('', 'remove', 'Uninstall'); $db =& JFactory::getDBO(); $controlAdapter = new Adapters(); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int'); $where = array(); $sql = "SELECT id, title, adapter, enabled FROM #__noixacl_adapters"; $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : ''; $sql .= $where; $db->setQuery($sql); $adapters = $db->loadObjectList(); $total = count($adapters); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $sql .= " ORDER BY ordering"; $db->setQuery($sql, $pagination->limitstart, $pagination->limit); $adapters = $db->loadObjectList(); foreach ($adapters as $adapter) { $adapterFile = JPATH_COMPONENT_ADMINISTRATOR . DS . "adapters" . DS . $adapter->adapter . DS . $adapter->adapter . ".xml"; $adapter->xmlData = $controlAdapter->parseXMLInstallFile($adapterFile); if (empty($adapter->xmlData) || !$adapter->xmlData) { unset($adapter); } } $this->assignRef('items', $adapters); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { $db = JFactory::getDBO(); /** * Get Viewname */ $viewName = ucfirst($this->getName()); /** * Get Adapter Name */ $adapterName = "modules"; /** * Positions List */ $positions = $this->getPositionsModulesList(); $adapterControl = new Adapters(); $xml = $adapterControl->parseXMLInstallFile(NOIXACL_APADTER_PATH . DS . "modules" . DS . "modules.xml"); $list["positions"] = JHTML::_('select.genericlist', $positions, $adapterName . $viewName . 'TableModules', 'class="inputbox" size="1" onchange="showPositionModules();"', 'id', 'title'); $this->assignRef("positionsList", $positions); $this->assignRef("tasks", $xml["tasks"]["site"]); $this->assignRef("adapterControl", $adapterControl); $this->assignRef("lists", $list); $this->assignRef("viewName", $viewName); $this->assignRef("adapterName", $adapterName); parent::display($tpl); }
function display($tpl = null) { $db = JFactory::getDBO(); /** * Get Viewname */ $viewName = ucfirst($this->getName()); /** * Adapter Name */ $adapterName = "content"; /** * Sections List */ $sectionsList = $this->getSectionsList(); /** * Instance Adapter Control */ $adapterControl = new Adapters(); $xml = $adapterControl->parseXMLInstallFile(JPATH_COMPONENT_ADMINISTRATOR . DS . "adapters" . DS . "content" . DS . "content.xml"); $list["sections"] = JHTML::_('select.genericlist', $sectionsList, $adapterName . $viewName . 'TableSection', 'class="inputbox" size="1" onchange="showContentAdmin();"', 'id', 'title'); $this->assignRef("sectionsList", $sectionsList); $this->assignRef("tasks", $xml["tasks"]["admin"]); $this->assignRef("adapterControl", $adapterControl); $this->assignRef("lists", $list); $this->assignRef("viewName", $viewName); $this->assignRef("adapterName", $adapterName); parent::display($tpl); }
/** * Uninstall a Adapter */ function remove() { /** * Getting Limitstart */ $limitstart = JRequest::getInt('limitstart'); /** * Get Number ID of Adapter */ $cid = JRequest::getInt('cid'); if (!$cid) { JError::raiseError(JText::_('noixACL'), JText::_("NOIXACL_ADAPTERS_CID_ERROR")); return false; } /** * 1) Load Table; 2) Get Adapter Folder Name */ $tableAdapter = JTable::getInstance('adapters', 'table'); $tableAdapter->load($cid); /** * Remove Rules of Adapter */ $AdaptersController = new Adapters(); $AdaptersController->deleteAdaptersRules($tableAdapter->adapter); /** * Delete Folder of Adapter */ $deleteFolder = JFolder::delete(JPATH_COMPONENT_ADMINISTRATOR . DS . 'adapters' . DS . "{$tableAdapter->adapter}"); if (!$deleteFolder) { JError::raiseError(JText::_('noixACL'), JText::_("NOIXACL_ADAPTERS_DONT_EXISTS")); return false; } /** * Remove Adapter From DataBase */ if (!$tableAdapter->delete($cid)) { JError::raiseError(JText::_('noixACL'), JText::_("NOIXACL_ADAPTERS_EXECUTE_QUERY_ERROR")); return false; } $link = "index.php?option=com_noixacl&controller=adapters"; $msg = JText::_("NOIXACL_ADAPTERS_UNINSTALL_SUCESSFULL"); if ($limitstart) { $link .= "&limitstart={$limitstart}"; } $this->setRedirect($link, $msg); }
function display($tpl = null) { $db = JFactory::getDBO(); /** * Get Viewname */ $viewName = ucfirst($this->getName()); /** * Adapter Name */ $adapterName = "menu"; /** * Sections List */ $menuTypes = $this->getMenuTypeList(); $adapterControl = new Adapters(); $xml = $adapterControl->parseXMLInstallFile(NOIXACL_APADTER_PATH . DS . "menu" . DS . "menu.xml"); $this->assignRef("menuTypesList", $menuTypes); $this->assignRef("tasks", $xml["tasks"]["admin"]); $this->assignRef("adapterControl", $adapterControl); $this->assignRef("viewName", $viewName); $this->assignRef("adapterName", $adapterName); parent::display($tpl); }
public function executeAdapterPlugin($myAdapter, $checkRule = true) { //instance application $app =& JFactory::getApplication(); //get component $option = JRequest::getCMD('option'); //instance adapters lib $adapterControl = new Adapters(); //get name of application $applicationName = $app->getName(); if (is_object($myAdapter)) { //include file if (!file_exists($myAdapter->xmlData['pathPlugin'])) { JError::raiseError('noixACL', JText::_('Plugin adapter file not exists')); return false; } //include adapter plugin file // MIKE CHANGE include to include_once include_once $myAdapter->xmlData['pathPlugin']; //instance a plugin $instancePlugin = new $myAdapter->xmlData['plugin'](); //call method same name of application in plugin of adapter if (method_exists($instancePlugin, $applicationName)) { //get params from $pluginParams = $instancePlugin->{$applicationName}(); if ($checkRule) { //checking rulle access //rrr if ($this->globArrMultiGroups) { $pluginParams['groups'] = $this->globArrMultiGroups; } $canAccess = $adapterControl->checkRule($applicationName, $myAdapter, $pluginParams); /** * block access */ if (!$canAccess) { // MIKE ADDED code for redirect instead of errorpage // commented raiserror line global $mainframe; if ($applicationName = 'com_content' && JRequest::getCMD('task') == 'apply') { $mainframe->redirect('index.php?option=com_content§ionid=' . JRequest::getVar('redirect', JRequest::getVar('sectionid', 0, '', 'int'), 'post', 'int') . '&task=edit&cid[]=' . JRequest::getVar('cid', array(0), '', 'array'), JText::_('You dont have permission to access')); } else { $mainframe->redirect($_SERVER['HTTP_REFERER'], JText::_('You dont have permission to access')); } //JError::raiseError('noixACL',JText::_('You dont have permission to access')); return false; } } } } }
/** * Saves the record */ function save() { global $mainframe; /** * Check for request forgeries */ JRequest::checkToken() or jexit('Invalid Token'); $option = JRequest::getCmd('option'); /** * Initialize some variables */ $me =& JFactory::getUser(); $db = JFactory::getDBO(); $acl =& JFactory::getACL(); $post = JRequest::get('post'); $groupID = JRequest::getInt('id', 0, 'post', 'int'); $parentID = JRequest::getInt('parent_id', 30, 'post', 'int'); $groupName = JRequest::getVar('name'); /** * Creating a new group */ if ($groupID == 0) { /** * Add New Group */ $acl->add_group($groupName, $groupName, $parentID); } else { /** * Get Group Name By ID */ $queryGetGorupName = "SELECT name FROM #__core_acl_aro_groups WHERE id =" . $groupID; $db->setQuery($queryGetGorupName); $oldGroupName = $db->loadResult(); /** * Edit a Group */ $acl->edit_group($groupID, $groupName, $groupName, $parentID); } /** * Instance Adapter Helper */ $adaptersControl = new Adapters(); /** * Get a List of Adapters */ $adaptersList = $adaptersControl->listAdapters(); /** * Gets Total */ $totalAdapters = count($adaptersList); if ($totalAdapters > 0) { foreach ($adaptersList as $adapters) { /** * Include Adapters Controller */ include $adapters->xmlData["pathController"]; /** * Get Instance of Adapter Controller */ $adapterController = new $adapters->xmlData["controller"](); /** * Call Save Method in Adapter Controller */ if (isset($oldGroupName)) { $adapterController->delete($oldGroupName); } $adapterController->save($groupName); unset($adapterController); } } /** * Redirect by task */ switch ($this->getTask()) { case 'apply': $msg = JText::sprintf('NOIXACL_GROUPS_APPLY_SUCCESS') . " " . $groupName; $this->setRedirect("index.php?option={$option}&view=group&task=edit&cid[]=" . $groupID, $msg); break; case 'save': default: $msg = JText::sprintf('NOIXACL_GROUPS_SAVE_SUCCESS', $groupName); $this->setRedirect("index.php?option={$option}", $msg); break; } }
/** * Displays a view */ function display() { parent::display(); }