/** * Returns a list of the actions that can be performed * * @param string $type The type of the content to check * @param int $id The ID of the content (category or image) * @return JObject An object holding the results of the check * @since 2.0 */ public static function getActions($type = 'component', $id = 0) { static $cache = array(); // Create a unique key for the this pair of parameters $key = $type . ':' . $id; if (isset($cache[$key])) { return $cache[$key]; } $user = JFactory::getUser(); $result = new JObject(); $actions = array('core.admin', 'core.manage', 'joom.upload', 'joom.upload.inown', 'core.create', 'joom.create.inown', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'); switch ($type) { case 'category': $assetName = _JOOM_OPTION . '.category.' . $id; break; case 'image': $assetName = _JOOM_OPTION . '.image.' . $id; break; default: $assetName = _JOOM_OPTION; break; } foreach ($actions as $action) { $result->set($action, $user->authorise($action, $assetName)); } // Store the result for better performance $cache[$key] = $result; return $result; }
function display($tpl = null) { global $mainframe; $id = JRequest::getVar('id', 0, '', 'int'); $chemOptions = new JObject(); $chemOptions->set('carbonLabelVisible', JRequest::getVar('carbonLabelVisible', 0, '', 'int')); $chemOptions->set('cpkColoring', JRequest::getVar('cpkColoring', 1, '', 'int')); $chemOptions->set('implicitHydrogen', JRequest::getVar('implicitHydrogen', 'TERMINAL_AND_HETERO', '', 'string')); $chemOptions->set('displayMode', JREquest::getVar('displayMode', 'WIREFRAME', '', 'string')); $chemOptions->set('bgrcolor', JRequest::getVar('bgrcolor', '#ffffff', '', 'string')); $chemOptions->set('zoomMode', JRequest::getVar('zoomMode', 'fit', '', 'string')); $chemOptions->set('width', JRequest::getVar('width', 300, '', 'int')); $chemOptions->set('height', JRequest::getVar('height', 300, '', 'int')); $this->setLayout('jsme'); $db =& JFactory::getDBO(); $document =& JFactory::getDocument(); $pathway =& $mainframe->getPathway(); // Adds parameter handling $params = $mainframe->getParams(); //Set page title information $menus =& JSite::getMenu(); $menu = $menus->getActive(); // $params->set('page_title','Chem'); $document->setTitle($params->get('page_title')); $params->def('show_page_title', 1); //$params->def( 'page_title', 'Chem Title' ); $where = $id !== 0 ? ' where id=' . $id : ''; $query = 'SELECT * ' . ' FROM #__chem a' . $where; $db->setQuery($query); $chem = $db->loadObjectList(); $this->assignRef('request', $chem); $this->assignRef('params', $params); $this->assignRef('chemoptions', $chemOptions); parent::display($tpl); }
/** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void * * @since 1.6 */ public function display($tpl = null) { $user = JFactory::getUser(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->modules = $this->get('Modules'); $this->levels = $this->get('ViewLevels'); $this->state = $this->get('State'); $this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid')); // Check if we're allowed to edit this item // No need to check for create, because then the moduletype select is empty if (!empty($this->item->id) && !$this->canDo->get('core.edit')) { throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } if ($this->getLayout() == 'modal') { // If we are forcing a language in modal (used for associations). if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { // Set the language field to the forcedLanguage and disable changing it. $this->form->setValue('language', null, $forcedLanguage); $this->form->setFieldAttribute('language', 'readonly', 'true'); // Only allow to select categories with All language or with the forced language. $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage); } } elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) { $this->form->setFieldAttribute('language', 'readonly', 'true'); } parent::display($tpl); $this->addToolbar(); }
function addTag() { $mainframe =& JFactory::getApplication(); $tag = JRequest::getString('tag'); $tag = str_replace('-', '', $tag); $response = new JObject(); $response->set('name', $tag); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'JSON.php'; $json = new Services_JSON(); if (empty($tag)) { $response->set('msg', JText::_('You need to enter a tag!', true)); echo $json->encode($response); $mainframe->close(); } $db =& JFactory::getDBO(); $query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=" . $db->Quote($tag); $db->setQuery($query); $result = $db->loadResult(); if ($result > 0) { $response->set('msg', JText::_('Tag already exists!', true)); echo $json->encode($response); $mainframe->close(); } $row =& JTable::getInstance('K2Tag', 'Table'); $row->name = $tag; $row->published = 1; $row->store(); $cache =& JFactory::getCache('com_k2'); $cache->clean(); $response->set('id', $row->id); $response->set('status', 'success'); $response->set('msg', JText::_('Tag added to available tags list!', true)); echo $json->encode($response); $mainframe->close(); }
/** * Gets a list of the actions that can be performed. * * @param integer The category ID. * * @return JObject * @since 1.6 */ public static function getActions($categoryId = 0) { $user = JFactory::getUser(); $result = new JObject; if (empty($categoryId)) { $assetName = 'com_mvceditor'; $level = 'component'; } else { $assetName = 'com_mvceditor.category.'.(int) $categoryId; $level = 'category'; } $actions = JAccess::getActions('com_mvceditor', $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * @todo Implement test__toString(). */ public function test__construct() { $this->object = new JObject(array('property1' => 'value1', 'property2' => 5)); $this->assertThat( $this->object->get('property1'), $this->equalTo('value1') ); }
/** * Returns a singleton with all settings * * @return JObject - loads a singleton object with all settings */ private static function _loadSettings() { $db = JFactory::getDBO(); $settings = new JObject(); $query = ' SELECT st.title, st.value' . ' FROM #__matukio_settings AS st' . ' ORDER BY st.id'; $db->setQuery($query); $data = $db->loadObjectList(); foreach ($data as $value) { $settings->set($value->title, $value->value); } // Grab the settings from the menu and merge them in the object $app = JFactory::getApplication(); $menu = $app->getMenu(); if (is_object($menu)) { if ($item = $menu->getActive()) { $menuParams = $menu->getParams($item->id); foreach ($menuParams->toArray() as $key => $value) { if ($key == 'show_page_heading') { $key = 'show_page_title'; } $settings->set($key, $value); } } } return $settings; }
function _loadData() { global $mainframe; // Lets load the content if it doesn't already exist if (empty($this->_data)) { // Lets load the content if it doesn't already exist if (empty($this->_data)) { $query = 'SELECT p.filename as filename' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id; $this->_db->setQuery($query); $filename_object = $this->_db->loadObject(); //Get Folder settings and File resize settings $path = PhocaGalleryHelper::getPathSet(); $file = new JObject(); //Create thumbnail if it doesn't exists but originalfile must exist $orig_path = $path['orig_abs_ds']; $refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&cid[]=' . $this->_id; //Creata thumbnails if not exist PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $filename_object->filename, $refresh_url, 1, 1, 1); jimport('joomla.filesystem.file'); if (!isset($filename_object->filename)) { $file->set('linkthumbnailpath', ''); } else { $thumbnail_file = PhocaGalleryHelper::getThumbnailName($filename_object->filename, 'large'); $file->set('linkthumbnailpath', $thumbnail_file['rel']); } } if (isset($file)) { $this->_data = $file; } else { $this->_data = ''; } return (bool) $this->_data; } return true; }
/** * Get property state value escaped. * * @param string $name property name * @return mized */ public function getState($name) { if (isset($this->state)) { return $this->escape($this->state->get($this->getStateName($name))); } return null; }
protected function addSidebar() { JHtmlSidebar::setAction('index.php?option=com_prp&view=tables'); JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_AUTHOR'), 'filter_user', JHtml::_( 'select.options', $this->get('Users'), 'value', 'text', $this->state->get('filter.user'), false ) ); JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_( 'select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true ) ); return JHtmlSidebar::render(); }
/** * @param null $tpl * * @return bool * @throws Exception */ function display($tpl = null) { $this->state = $this->get('State'); $this->params = $this->state->get('params'); $this->item = $this->get('Item'); $this->items = $this->get('Items'); $this->sitemapItems = $this->get('SitemapItems'); $this->extensions = $this->get('Extensions'); $input = JFactory::getApplication()->input; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $app = JFactory::getApplication(); $app->clearHeaders(); $app->setHeader('Content-Type', 'application/xml; charset=UTF-8'); $app->sendHeaders(); $this->displayer = new XmapDisplayerXml($this->item, $this->items, $this->extensions); $this->displayer->displayAsNews($input->getBool('news')); $this->displayer->displayAsImages($input->getBool('images')); $this->displayer->displayAsVideos($input->getBool('videos')); $this->displayer->displayAsMobile($input->getBool('mobile')); $this->displayer->setSitemapItems($this->sitemapItems); parent::display($tpl); $this->getModel()->hit($this->displayer->getCount()); $app->close(); }
/** * Display the toolbar. * * @return void * * @since 2.5 */ protected function addToolbar() { $input = JFactory::getApplication()->input; $input->set('hidemainmenu', 1); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id); JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) { JToolbarHelper::apply('note.apply'); JToolbarHelper::save('note.save'); } if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) { JToolbarHelper::save2new('note.save2new'); } // If an existing item, can save to a copy. if (!$isNew && count($user->getAuthorisedCategories('com_users', 'core.create')) > 0) { JToolbarHelper::save2copy('note.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('note.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_users.note', $this->item->id); } JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT'); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $input = JFactory::getApplication()->input; $input->set('hidemainmenu', true); $isNew = $this->item->id == 0; JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu'); // If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid. if ($isNew && $this->canDo->get('core.create')) { if ($this->canDo->get('core.edit')) { JToolbarHelper::apply('menu.apply'); } JToolbarHelper::save('menu.save'); } // If user can edit, can save the item. if (!$isNew && $this->canDo->get('core.edit')) { JToolbarHelper::apply('menu.apply'); JToolbarHelper::save('menu.save'); } // If the user can create new items, allow them to see Save & New if ($this->canDo->get('core.create')) { JToolbarHelper::save2new('menu.save2new'); } if ($isNew) { JToolbarHelper::cancel('menu.cancel'); } else { JToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT'); }
/** * Gets a list of the actions that can be performed. * * @param int The category ID. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $result->set('core.admin', $user->authorise('core.admin', 'com_favicon')); return $result; }
/** * Получаем доступы для действий. * * @param int $categoryId Id категории. * @param int $messageId Id сообщения. * * @return object */ public static function getActions($categoryId = 0, $messageId = 0) { // Определяем имя ассета (ресурса). if (empty($messageId) && empty($categoryId)) { $assetName = 'com_helloworld'; $section = 'component'; } elseif (empty($messageId)) { $assetName = 'com_helloworld.category.' . (int) $categoryId; $section = 'category'; } else { $assetName = 'com_helloworld.message.' . (int) $messageId; $section = 'message'; } if (empty(self::$actions)) { // Получаем список доступных действий для компонента. $accessFile = JPATH_ADMINISTRATOR . '/components/com_helloworld/access.xml'; $actions = JAccess::getActionsFromFile($accessFile, "/access/section[@name='" . $section . "']/"); // Для сообщения и категорий добавляем действие core.admin. if ($section == 'category' || $section == 'message') { $adminAction = new stdClass(); $adminAction->name = 'core.admin'; array_push($actions, $adminAction); } self::$actions = new JObject(); foreach ($actions as $action) { // Устанавливаем доступы пользователя для действий. self::$actions->set($action->name, JFactory::getUser()->authorise($action->name, $assetName)); } } return self::$actions; }
protected function addToolbar() { $state = $this->get('State'); JToolBarHelper::title(JText::_('COM_XMAP_SITEMAPS_TITLE'), 'list'); $canDo = JHelperContent::getActions('com_xmap', 'sitemap'); JToolBarHelper::addNew('sitemap.add'); JToolbarHelper::editList('sitemap.edit'); if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('sitemaps.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('sitemaps.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'sitemaps.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('sitemaps.trash'); } if ($canDo->get('core.manage')) { JToolbarHelper::custom('sitemaps.ping', 'heart', 'heart', JText::_('COM_XMAP_TOOLBAR_PING')); } if (JFactory::getUser()->authorise('core.admin')) { JToolbarHelper::preferences('com_xmap'); } if (JHelperContent::getActions('com_plugins')->get('core.edit.state')) { JToolbarHelper::custom('sitemaps.plugins', 'power-cord', 'power-cord', JText::_('COM_XMAP_TOOLBAR_PLUGINS'), false); } JHtmlSidebar::setAction('index.php?option=com_xmap&view=sitemaps'); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', XmapHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); $this->sidebar = JHtmlSidebar::render(); }
function onDisplay($name) { $application = JFactory::getApplication(); $my_first_daughters_name = "Anna"; $user =& JFactory::getUser(); $prefix = ''; if ($application->isAdmin()) { $prefix = '../'; } // needed because of user friendly urls!! Relative urls for the css does not work then. $relative_dir = parse_url(JURI::base()); $relative_dir = $relative_dir['path']; $relative_dir = rtrim($relative_dir,"\\/.") . '/'; // we replace to get a consistent output with different php versions! $css = ".button2-left .jfuButton { background: transparent url(".$relative_dir.$prefix."plugins/editors-xtd/jfuploader_editor/jfuploader_editor.png) no-repeat 100% 0px; }"; // we need to use the right part to get the right user!! if ($application->isAdmin()) { // front and admin do not have the sames session. I have to create a secret token to check that the request is not modified $jConfig = new JConfig(); $secret = $jConfig->secret; $ts =time(); $token = md5($user->username . $my_first_daughters_name . $secret . $ts); $stub = $prefix. "index.php"; $link = $stub . '?option=com_jfuploader&tmpl=component&type=jfuploader_editor&e_name='.$name .'&ts='.$ts.'&myid=' . $user->username . '&mytoken=' . $token; } else { $stub = "index.php"; $link = $prefix.$stub . '?option=com_jfuploader&tmpl=component&type=jfuploader_editor&e_name='.$name; } $popup_width = 680; $popup_height = 520; if(@$this->params){ if(@$this->params->get('popup_width') > 0){ $popup_width = (int)@$this->params->get('popup_width'); } if(@$this->params->get('popup_height') > 0){ $popup_height = (int)@$this->params->get('popup_height'); } } $doc = & JFactory::getDocument(); if ($application->isAdmin()) { $doc->addStyleDeclaration($css); } $button = new JObject(); $button->set('modal', true); $button->set('text', JText::_('JFUploader')); $button->set('name', 'jfuButton'); $button->set('options', "{handler: 'iframe',size: {x: $popup_width, y: $popup_height}}"); $button->set('link', $link); return $button; }
/** * Get the alternate title for the module * * @param JObject $params The module parameters. * @param JObject $module The module. * * @return string The alternate title for the module. */ public static function getTitle($params, $module) { $key = $params->get('context', 'mod_quickicon') . '_title'; if (JFactory::getLanguage()->hasKey($key)) { return JText::_($key); } else { return $module->title; } }
public static function readXML($params) { $temppath = JPATH_BASE . DS . "cache/mod_bps_kiyoh/"; if (!is_dir($temppath)) { mkdir($temppath); } $xmlUrl = $params->get('xmlUrl', ''); $cacheTime = (int) $params->get('cacheTime', 480) * 60; $filename = md5($xmlUrl . $params->toString()); $tempfile = $temppath . $filename; if (file_exists($tempfile)) { $mtime = filemtime($tempfile); if (time() - $mtime < $cacheTime) { $aXmlData = unserialize(file_get_contents($tempfile)); return $aXmlData; } } if (!($oXml = simplexml_load_file($xmlUrl))) { echo 'Geen xml geladen'; return false; } $oXmlInfo = new JObject(); $oXmlInfo->set('naam', (string) $oXml->company->name); $oXmlInfo->set('kiyohLink', (string) $oXml->company->url); $oXmlInfo->set('total_score', (double) $oXml->company->total_score); $oXmlInfo->set('total_reviews', (int) $oXml->company->total_reviews); $oXmlInfo->set('total_views', (int) $oXml->company->total_views); $aReviews = array(); $iReviewCount = 0; foreach ($oXml->review_list->review as $oReview) { $oReviewInfo = new JObject(); $oReviewInfo->set('naam', (string) $oReview->customer->name); $oReviewInfo->set('place', (string) $oReview->customer->place); $oReviewInfo->set('date', JHtml::_('date', (string) $oReview->customer->date, '%d %b')); $oReviewInfo->set('dateRaw', JHtml::_('date', (string) $oReview->customer->date, '%Y-%m-%d')); $oReviewInfo->set('total_score', (int) $oReview->total_score); $oReviewInfo->set('recommendation', (string) $oReview->recommendation); $oReviewInfo->set('positive', (string) $oReview->positive); $oReviewInfo->set('negative', (string) $oReview->negative); $iReviewCount++; if ($params->get('reviewOnly', false) && ($oReviewInfo->positive == '' && $oReviewInfo->negative == '')) { continue; } $aReviews[] = $oReviewInfo->getProperties(); } $oXmlInfo->set('reviewCount', $iReviewCount); $oXmlInfo->set('aReviews', $aReviews); $aXmlData = $oXmlInfo->getProperties(); //in file zetten $file = fopen($tempfile, 'w'); fwrite($file, serialize($aXmlData)); fclose($file); // print_r_pre($aXmlData); // print_r_pre($oXml->review_list); return $aXmlData; }
/** * Add Attachment button * * @return a button */ function onDisplay($name, $asset, $author) { // Avoid displaying the button for anything except content articles $option = JRequest::getVar('option'); if ($option != 'com_content') { return new JObject(); } // Get the article ID $cid = JRequest::getVar('cid', array(0), '', 'array'); $id = 0; if (count($cid) > 0) { $id = intval($cid[0]); } if ($id == 0) { $nid = JRequest::getVar('id', null); if (!is_null($nid)) { $id = intval($nid); } } JHtml::_('behavior.modal'); // Create the button object $button = new JObject(); // Figure out where we are and construct the right link and set // up the style sheet (to get the visual for the button working) $document =& JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $document->addStyleSheet(JURI::root() . '/media/com_cedtag/css/admintag.css'); if ($id == 0) { $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); $link = "index.php?option=com_cedtag&controller=tag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING"; } else { $button->set('options', "{handler: 'iframe', size: {x: 600, y: 300}}"); $link = "index.php?option=com_cedtag&controller=tag&task=add&article_id=" . $id . "&tmpl=component"; } } else { $CedTagThemes = new CedTagThemes(); $CedTagThemes->addCss(); //return $button; if ($id == 0) { $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); $msg = JText::_('SAVE ARTICLE BEFORE ADD TAGS'); $link = "index.php?option=com_cedtag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING"; } else { $button->set('options', "{handler: 'iframe', size: {x: 500, y: 300}}"); $link = "index.php?option=com_cedtag&tmpl=component&task=add&article_id=" . $id; } } $button->set('modal', true); $button->set('class', 'modal'); $button->set('text', JText::_('Add Tags')); $button->set('name', 'add_Tags'); $button->set('link', $link); //$button->set('image', ''); return $button; }
/** * Returns a list of the actions that can be performed. * * @return JObject An object with each action as a property, with boolean * values telling whether the current user is authorised or not for * that action. */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.delete', 'simplecustomrouter.test'); foreach ($actions as $action) { $result->set($action, $user->authorise($action, 'com_simplecustomrouter')); } return $result; }
/** * Make sure that the data contains CamelCase properties * * @param mixed $data Data to sanitize * * @return JObject */ protected function sanitizeConstructorData($data) { $data = new JObject($data); $properties = $data->getProperties(); $sanitizeData = new JObject(); foreach ($properties as $property => $value) { $sanitizeData->set(NenoHelper::convertDatabaseColumnNameToPropertyName($property), $value); } return $sanitizeData; }
public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = array('core.admin', 'core.manage'); foreach ($actions as $action) { $result->set($action, $user->authorise($action, 'com_jvrelatives')); } return $result; }
/** * Get the actions for ACL */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_sichtweiten/access.xml', "/access/section[@name='component']/"); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, 'com_sichtweiten')); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'); foreach ($actions as $action) { $result->set($action, $user->authorise($action, 'com_advancedmodules')); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = JAccess::getActions('com_messages'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, 'com_messages')); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param string $option Action option. * * @return JObject */ public static function getActions($option = 'com_remoteimage') { $user = JFactory::getUser(); $result = new \JObject(); $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'); foreach ($actions as $action) { $result->set($action, $user->authorise($action, $option)); } return $result; }
/** * This method should handle any login logic and report back to the subject * * @access public * @param array holds the user data * @param array array holding options (autoregister, group) * @return boolean True on success * @since 1.5 */ function onLoginUser($user, $options = array()) { jimport('joomla.user.helper'); $instance =& $this->_getUser($user, $options); // if _getUser returned an error, then pass it back. if (JError::isError($instance)) { return $instance; } // If the user is blocked, redirect with an error if ($instance->get('block') == 1) { return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_NOLOGIN_BLOCKED')); } // Get an ACL object $acl =& JFactory::getACL(); // Get the user group from the ACL if ($instance->get('tmp_user') == 1) { $grp = new JObject(); // This should be configurable at some point $grp->set('name', 'Registered'); } else { $grp = $acl->getAroGroup($instance->get('id')); } //Authorise the user based on the group information if (!isset($options['group'])) { $options['group'] = 'USERS'; } if (!$acl->is_group_child_of($grp->name, $options['group'])) { return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_NOLOGIN_ACCESS')); } //Mark the user as logged in $instance->set('guest', 0); $instance->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) { $instance->set('aid', 2); } //Set the usertype based on the ACL group name $instance->set('usertype', $grp->name); // Register the needed session variables $session =& JFactory::getSession(); $session->set('user', $instance); $session->set('site', $options['site']); // Get the session object $table =& JTable::getInstance('session'); $table->load($session->getId()); $table->guest = $instance->get('guest'); $table->username = $instance->get('username'); $table->userid = intval($instance->get('id')); $table->usertype = $instance->get('usertype'); $table->gid = intval($instance->get('gid')); $table->update(); // Hit the user last visit field $instance->setLastVisit(); return true; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $assetName = 'com_redirect'; $actions = JAccess::getActions($assetName); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return JObject * @since 1.6 */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $assetName = 'com_available_assets'; $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'); foreach ($actions as $action) { $result->set($action, $user->authorise($action, $assetName)); } return $result; }