Exemple #1
2
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     JToolBarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
         JToolBarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         JToolBarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'users.delete');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_users');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_USERS_USER_MANAGER');
 }
Exemple #2
2
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/users.php';
     // Load the submenu.
     UsersHelper::addSubmenu(JRequest::getCmd('view', 'users'));
     $view = JRequest::getCmd('view', 'users');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     if (!$this->canView($view)) {
         JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         return;
     }
     // Check for edit form.
     if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false));
         return false;
     } elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=groups', false));
         return false;
     } elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=levels', false));
         return false;
     }
     return parent::display();
 }
Exemple #3
0
 function defaultTpl($tpl = null)
 {
     JToolBarHelper::title(JText::_('STOP WORDS'), 'tag.png');
     $canDo = UsersHelper::getActions();
     if ($canDo->get('core.create')) {
         JToolBarHelper::apply();
         JToolBarHelper::spacer();
         JToolBarHelper::save();
         JToolBarHelper::spacer();
         JToolBarHelper::custom('restore', 'default', '', JText::_('RESTORE DEFAULT'), false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
     $lang = strval(JFactory::getLanguage()->getDefault());
     $file = JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_' . $lang . '.php';
     if (!is_file($file)) {
         JFile::copy(JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_en-GB-default.php', $file);
     }
     $isWritable = is_writable($file);
     $FileContent = trim(file_get_contents($file));
     $this->assign('isWritable', $isWritable);
     $this->assignRef('FileName', $file);
     $this->assignRef('FileContent', $FileContent);
     parent::display($tpl);
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     Toolbar::title(Lang::txt($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         Toolbar::apply('level.apply');
         Toolbar::save('level.save');
     }
     if ($canDo->get('core.create')) {
         Toolbar::save2new('level.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('level.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('level.cancel');
     } else {
         Toolbar::cancel('level.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('level');
 }
Exemple #5
0
 /**
  * Method to display the view.
  *
  * @param   string	The template file to include
  * @since   1.5
  */
 public function display($tpl = null)
 {
     // Get the view data.
     $this->user = JFactory::getUser();
     $this->form = $this->get('Form');
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Check for layout override
     $active = JFactory::getApplication()->getMenu()->getActive();
     if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
     }
     require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
     $tfa = UsersHelper::getTwoFactorMethods();
     $this->tfa = is_array($tfa) && count($tfa) > 1;
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
 }
Exemple #6
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     JToolBarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolBarHelper::apply('level.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('level.save', 'JTOOLBAR_SAVE');
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('level.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('level.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('level.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_USERS_ACCESS_LEVELS_EDIT');
 }
 /**
  * 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.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     JToolbarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolbarHelper::apply('level.apply');
         JToolbarHelper::save('level.save');
     }
     if ($canDo->get('core.create')) {
         JToolbarHelper::save2new('level.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('level.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('level.cancel');
     } else {
         JToolbarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_USERS_ACCESS_LEVELS_EDIT');
 }
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $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);
     Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
         Toolbar::apply('note.apply');
         Toolbar::save('note.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
         Toolbar::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
         Toolbar::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('note.cancel');
     } else {
         Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('note');
 }
Exemple #10
0
 /**
  * Override the display method for the view.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @since   2.5
  */
 public function display($tpl = null)
 {
     // Initialise view variables.
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->user = $this->get('User');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     UsersHelper::addSubmenu('notes');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors), 500);
     }
     // Get the component HTML helpers
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     // Turn parameters into registry objects
     foreach ($this->items as $item) {
         $item->cparams = new Registry();
         $item->cparams->loadString($item->category_params);
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     Toolbar::title(Lang::txt('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         //Toolbar::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('users.approve', 'COM_USERS_TOOLBAR_APPROVE', true);
         Toolbar::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         Toolbar::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         Toolbar::divider();
     }
     if ($canDo->get('core.delete')) {
         Toolbar::deleteList('', 'users.delete');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_users');
         Toolbar::divider();
     }
     Toolbar::help('users');
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     JToolBarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_GROUP_TITLE' : 'COM_USERS_VIEW_EDIT_GROUP_TITLE'), 'groups-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolBarHelper::apply('group.apply');
         JToolBarHelper::save('group.save');
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::save2new('group.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('group.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('group.cancel');
     } else {
         JToolBarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_USERS_GROUPS_EDIT');
 }
Exemple #13
0
 /**
  * Setup the Toolbar.
  */
 protected function _setToolbar()
 {
     $canDo = UsersHelper::getActions();
     JToolBarHelper::title(JText::_('Users_View_Users_Title'), 'user');
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::custom('users.activate', 'publish.png', 'publish_f2.png', 'Activate', true);
         JToolBarHelper::custom('users.block', 'unpublish.png', 'unpublish_f2.png', 'Block', true);
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('user.add', 'new.png', 'new_f2.png', 'New', false);
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::custom('user.edit', 'edit.png', 'edit_f2.png', 'Edit', true);
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'users.delete');
     }
     JToolBarHelper::divider();
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_users');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('screen.users.users');
 }
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     Toolbar::title(Lang::txt('COM_USERS_VIEW_NOTES_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         Toolbar::addNew('note.add');
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('note.edit');
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('notes.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         Toolbar::divider();
         Toolbar::archiveList('notes.archive');
         Toolbar::checkin('notes.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::trash('notes.trash');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_users');
         Toolbar::divider();
     }
     Toolbar::help('notes');
 }
Exemple #15
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::divider();
         JToolbarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
         JToolbarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         JToolbarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'users.delete');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_users');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_users&view=users');
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_STATE'), 'filter_state', JHtml::_('select.options', UsersHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_ACTIVE'), 'filter_active', JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_USERGROUP'), 'filter_group_id', JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_FILTER_DATE'), 'filter_range', JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.range')));
 }
Exemple #16
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @return  Object
  *
  * @since   1.6
  * @todo    Refactor to work with notes
  */
 public static function getActions()
 {
     if (empty(self::$actions)) {
         self::$actions = new \Hubzero\Base\Object();
         $actions = JAccess::getActions('com_users');
         foreach ($actions as $action) {
             self::$actions->set($action->name, User::authorise($action->name, 'com_users'));
         }
     }
     return self::$actions;
 }
Exemple #17
0
 function addToolbar()
 {
     JToolBarHelper::title(JText::_('EXPORT TAGS TO OTHER COMPONENTS'), 'tag.png');
     $canDo = UsersHelper::getActions();
     if ($canDo->get('core.create')) {
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Confirm', JText::_('Are you sure you want to export?'), 'default', JText::_('Export'), 'export', false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
 }
Exemple #18
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @return  JObject
  *
  * @since   1.6
  * @todo    Refactor to work with notes
  */
 public static function getActions()
 {
     if (empty(self::$actions)) {
         $user = JFactory::getUser();
         self::$actions = new JObject();
         $actions = JAccess::getActions('com_users');
         foreach ($actions as $action) {
             self::$actions->set($action->name, $user->authorise($action->name, 'com_users'));
         }
     }
     return self::$actions;
 }
Exemple #19
0
 public function prepareValueForDisplay($value, $field)
 {
     $value = (array) $value;
     JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php');
     $texts = array();
     foreach (UsersHelper::getGroups() as $group) {
         if (in_array($group->value, $value)) {
             $texts[] = parent::prepareValueForDisplay(trim($group->text, '- '), $field);
         }
     }
     return parent::prepareValueForDisplay($texts, $field);
 }
Exemple #20
0
 function defaultTpl($tpl = null)
 {
     JToolBarHelper::title(JText::_('IMPORT TAGS FROM OTHER COMPONENTS'), 'tag.png');
     $canDo = UsersHelper::getActions();
     if ($canDo->get('core.create')) {
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Confirm', JText::_('Are you sure you want to import?'), 'default', JText::_('Import'), 'import', false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
     parent::display($tpl);
 }
Exemple #21
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @return  JObject
  *
  * @since   1.6
  * @todo    Refactor to work with notes
  */
 public static function getActions()
 {
     if (empty(self::$actions)) {
         $user = JFactory::getUser();
         self::$actions = new JObject();
         $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
         foreach ($actions as $action) {
             self::$actions->set($action, $user->authorise($action, 'com_users'));
         }
     }
     return self::$actions;
 }
Exemple #22
0
 /**
  * Check if the two factor authentication by Joomla! is enabled
  */
 public static function tfaEnabled()
 {
     //tfa is not supported before 3.2
     if (version_compare(JVERSION, '3.2', '<')) {
         return false;
     }
     //check for two way authentication
     require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
     $tfa = UsersHelper::getTwoFactorMethods();
     if (isset($tfa) && is_array($tfa) && count($tfa) > 1) {
         return true;
     }
     return false;
 }
Exemple #23
0
 function addToolbar()
 {
     JToolBarHelper::title(JText::_('Maintenance'), 'tag.png');
     $canDo = UsersHelper::getActions();
     /*
      if ($canDo->get('core.create')) {
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Confirm', JText::_('Are you sure?'), 'execute', JText::_('Execute'), 'execute', false);
         JToolBarHelper::spacer();
         JToolBarHelper::divider();
     }
     */
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
 }
Exemple #24
0
 function addToolbar()
 {
     JToolBarHelper::title(JText::_('TEMPLATE MANAGER'), 'tag.png');
     $canDo = UsersHelper::getActions();
     if ($canDo->get('core.create')) {
         JToolBarHelper::apply();
         JToolBarHelper::spacer();
         JToolBarHelper::save();
         JToolBarHelper::spacer();
         JToolBarHelper::custom('restore', 'default', '', JText::_('RESTORE DEFAULT'), false);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
 }
Exemple #25
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     UsersHelper::addSubmenu('levels');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Exemple #26
0
 /**
  * Checks whether a user can see this view.
  *
  * @param	string	$view	The view name.
  *
  * @return	boolean
  * @since	1.6
  */
 protected function canView($view)
 {
     $canDo = UsersHelper::getActions();
     switch ($view) {
         // Special permissions.
         case 'groups':
         case 'group':
         case 'levels':
         case 'level':
             return $canDo->get('core.admin');
             break;
             // Default permissions.
         // Default permissions.
         default:
             return true;
     }
 }
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed   A string if successful, otherwise an Error object.
  *
  * @since   1.6
  */
 public function display($tpl = null)
 {
     // Get the view data.
     $this->data = $this->get('Data');
     $this->form = $this->get('Form');
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     $this->twofactorform = $this->get('Twofactorform');
     $this->twofactormethods = UsersHelper::getTwoFactorMethods();
     $this->otpConfig = $this->get('OtpConfig');
     $this->db = JFactory::getDbo();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // View also takes responsibility for checking if the user logged in with remember me.
     $user = JFactory::getUser();
     $cookieLogin = $user->get('cookieLogin');
     if (!empty($cookieLogin)) {
         // If so, the user must login to edit the password and other data.
         // What should happen here? Should we force a logout which destroys the cookies?
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'), 'message');
         $app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
         return false;
     }
     // Check if a user was found.
     if (!$this->data->id) {
         JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND'));
         return false;
     }
     $this->data->tags = new JHelperTags();
     $this->data->tags->getItemTags('com_users.user.', $this->data->id);
     // Check for layout override
     $active = JFactory::getApplication()->getMenu()->getActive();
     if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
     }
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     return parent::display($tpl);
 }
Exemple #28
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     $isNew = $this->item->id == 0;
     $isProfile = $this->item->id == $user->id;
     JToolBarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_USER_TITLE' : ($isProfile ? 'COM_USERS_VIEW_EDIT_PROFILE_TITLE' : 'User Manager: Edit User')), $isNew ? 'user-add' : ($isProfile ? 'user-profile' : 'user-edit'));
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolBarHelper::apply('user.apply');
         JToolBarHelper::save('user.save');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('user.cancel');
     } else {
         JToolBarHelper::cancel('user.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #29
0
 function defaultTpl($tpl = null)
 {
     JToolBarHelper::title(JText::_('TERM MANAGER'), 'tag.png');
     $canDo = UsersHelper::getActions();
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('batchadd', 'new', '', JText::_('Batch Add'), false);
         JToolBarHelper::spacer();
         JToolBarHelper::custom('autofilldescription', 'new', '', JText::_('Wikipedia: AutoFill All Descriptions'), false);
         JToolBarHelper::spacer();
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editListX();
         JToolBarHelper::spacer();
     }
     if ($canDo->get('core.edit.state')) {
         //publish / unpublish / archiveList / checkin
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('Confirm Suppression'), 'remove', JText::_('Delete'));
         JToolBarHelper::spacer();
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Confirm', JText::_('Remove all Terms? this will also remove all Tags for all Articles!'), 'clearall', JText::_('Clear all'), 'clearall', false);
         JToolBarHelper::spacer();
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.edit.state')) {
         //trash
     }
     if ($canDo->get('core.admin')) {
         //preference
     }
     JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
     //get params
     $params = JComponentHelper::getParams('com_cedtag');
     $this->assignRef('params', $params);
     //get data
     $termList = $this->get('termList');
     $this->assignRef('termList', $termList);
     $this->state = $this->get('State');
     $this->pagination = $this->get('Pagination');
     parent::display($tpl);
 }
Exemple #30
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     $this->canDo = JHelperContent::getActions('com_users');
     UsersHelper::addSubmenu('users');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Include the component HTML helpers.
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }