/** * @param \JUser $user * @return UserEntity */ protected function _convertToEntity(\JUser $user) { $id = (int) $user->id; if ($entity = $this->_getEntity($id)) { return $entity; } $isAdmin = $user->authorise('core.login.admin', 'root.1') || $user->authorise('core.admin', 'root.1'); $data = new Data(['id' => $id, 'login' => $user->username, 'name' => $user->name, 'email' => $user->email, 'is_admin' => $isAdmin]); $this->_users[$id] = new UserEntity($data); return $this->_users[$id]; }
/** * Gets a list of the actions that can be performed. * * @param \JUser $user The user object. * @param string $component The component access file path, component base path or option name. * @param string $assetName The asset name * @param integer $categoryId The category ID. * @param integer $id The item ID. * * @return Object */ public static function getActions(\JUser $user, $component, $assetName, $categoryId = 0, $id = 0) { $result = new Object(); // New rules: If path is access file $path = $component; if (!is_file($path)) { // New rules: If path is component base path $path = $path . '/access.xml'; } if (!is_file($path)) { $path = PathHelper::getAdmin($component) . '/etc/access.xml'; } if (!is_file($path)) { $path = PathHelper::getAdmin($component) . '/access.xml'; } if (!$id && !$categoryId) { $section = 'component'; } elseif (!$id && $categoryId) { $section = 'category'; $assetName .= '.category.' . $categoryId; } elseif ($id && !$categoryId) { $section = $assetName; $assetName .= '.' . $assetName . '.' . $id; } else { $section = $assetName; $assetName .= '.' . $assetName; } $actions = \JAccess::getActionsFromFile($path, "/access/section[@name='" . $section . "']/"); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Return parameters for client side as JSON format * @return string */ private function _getJSConfiguration() { $input = $this->_application->input; $defaultStyles = $this->_getDefaultStyles(); $installedComponents = PoweradminHelper::getInstalledComponents(); $supportedExtList = JSNPaExtensionsHelper::getSupportedExtList(); if (!$this->_params->get('search_coverage')) { $coverages = PoweradminHelper::getSearchCoverages(); } else { $coverages = json_decode($this->_params->get('search_coverage', PoweradminHelper::getSearchCoverages())); } foreach ($supportedExtList as $_supportedExt => $value) { $supportedExtAlias = str_replace('com_', JSN_3RD_EXTENSION_STRING . '-', $_supportedExt); $_extShortName = str_ireplace('com_', '', $_supportedExt); $_plg = JPluginHelper::getPlugin('jsnpoweradmin', $_extShortName); if (in_array($_supportedExt, $installedComponents) && !in_array($_supportedExt, $coverages) && !count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) { array_push($coverages, JSN_3RD_EXTENSION_NOT_INSTALLED_STRING . '-' . $_extShortName); } if (in_array($_supportedExt, $installedComponents) && count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) { array_push($coverages, JSN_3RD_EXTENSION_NOT_ENABLED_STRING . '-' . $_extShortName); } } $logoFile = $this->_params->get('logo_file', 'administrator/components/com_poweradmin/assets/images/logo-jsnpoweradmin.png'); $logoFile = $logoFile == 'N/A' ? '' : JURI::root(true) . '/' . $logoFile; $canInstall = $this->_user->authorise('core.manage', 'com_installer'); // Get editors $curEditor = JFactory::getUser()->getParam('editor'); $editorOptions = array(); foreach ($this->_getEditorOptions() as $option) { $_isAtive = $curEditor == $option->value ? true : false; $editorOptions[] = array('value' => $option->value, 'name' => $option->text, 'active' => $_isAtive); } $conf = array('currentUrl' => $_SERVER["REQUEST_URI"], 'baseUrl' => JURI::base(true) . '/', 'rootUrl' => JURI::root(true) . '/', 'userId' => $this->_user->id, 'protected' => $this->_getProtectedComponents(), 'defaultStyles' => $defaultStyles, 'logoFile' => $logoFile, 'logoLink' => $this->_params->get('logo_link', 'http://www.joomlashine.com/joomla-extensions/jsn-poweradmin.html'), 'logoLinkTarget' => $this->_params->get('logo_target', '_blank'), 'logoTitle' => JText::_($this->_params->get('logo_slogan', JText::_('PLG_JSNADMINBAR_CONFIG_LOGO_SLOGAN_DEFAULT'))), 'allowUninstall' => $this->_params->get('allow_uninstall', true) && $canInstall, 'linkTarget' => $this->_target, 'preloadImages' => array('bg-overlay.png', 'loader.gif', 'dark-loader.gif', 'ui-window-buttons.png'), 'pinned' => $this->_params->get('pinned_bar', true), 'sessionInfinite' => $this->_params->get('admin_session_timer_infinite', false), 'warningTime' => $this->_params->get('session_timeout_warning', 1), 'disableWarning' => $this->_params->get('admin_session_timeout_warning_disabled', false), 'searchCoverages' => $coverages, 'sitemenu' => array('preview' => $this->_preview->getPreviewLink(), 'manager' => JRoute::_('index.php?option=com_poweradmin&view=rawmode', false)), 'usermenu' => array('messages' => $this->_getMessagesCount(), 'profileLink' => "index.php?option=com_admin&task=profile.edit&id={$this->_user->id}&tmpl=component", 'messageLink' => "index.php?option=com_messages", 'logoutLink' => "index.php?option=com_login&task=logout&" . JSession::getFormToken() . "=1"), 'history' => array('url' => 'index.php?option=com_poweradmin&task=history.load'), 'spotlight' => array('limit' => $this->_params->get('search_result_num', 10)), 'urlparams' => array('option' => $input->getVar('option', ''), 'task' => $input->getVar('task', ''), 'view' => $input->getVar('view', ''), 'layout' => $input->getVar('layout', ''), 'id' => $input->getInt('id', 0)), 'editors' => $editorOptions); return json_encode($conf); }
/** * Checks if this entity is authorized to perform $task on $asset * * @param string $action Action to perform on $asset * @param string $asset Asset to perform $task on * @return boolean True: Authorized, False: Not authorized */ public function isAuthorizedToPerformActionOnAsset($action, $asset) { if ($asset == 'root') { $asset = null; } return $this->cmsOwnUser->authorise($action, $asset); }
/** * Add a preferences button */ protected function addToolbarPreferences() { // Add a preferences button if (!$this->user->authorise('core.admin', 'com_media') && !$this->user->authorise('core.options', 'com_media')) { return; } JToolbarHelper::preferences('com_media'); JToolbarHelper::divider(); }
/** * Add a delete button */ private function addToolbarDelete() { // Add a delete button if (!$this->user->authorise('core.delete', 'com_media')) { return; } JToolbarHelper::custom('file.delete', 'delete', 'delete', 'JACTION_DELETE', false); JToolbarHelper::divider(); }
public static function cancel($params) { $result = array(); $result['success'] = true; if (empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_("Error"); return $result; } unset($params['allow_work']); $member_id = $params['member_id']; $user = new JUser($member_id); $iAmSuperAdmin = $user->authorise('core.admin'); if ($iAmSuperAdmin) { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_("Done"); return $result; } $db = oseDB::instance(); $query = "SELECT * FROM `#__extensions` WHERE `name` = 'com_users' AND `type` = 'component'"; $db->setQuery($query); $data = $db->loadObject(); $data = oseJson::decode($data->params); $group['groups'] = (array) $data->new_usertype; $member = oseRegistry::call('member'); $member->instance($member_id); $Mscs = $member->getAllOwnedMsc(false, 1, 'obj'); foreach ($Mscs as $Msc) { if ($Msc->msc_id == $params['msc_id']) { continue; } $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$Msc->msc_id}' AND `type` = 'jgroup'"; $db->setQuery($query); $ext = $db->loadObject(); if (!empty($ext)) { $ext = oseJson::decode($ext->params); $group['groups'] = array_merge($group['groups'], (array) $ext->jgroup_id); } } $group['groups'] = array_unique($group['groups']); //$user = JUser::getInstance($member_id); $user->bind($group); //$user->groups = array_flip($data->jgroup_id); if (!$user->save()) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_("Error"); return $result; } $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_("Done"); return $result; }
/** * Checks if a user is allowed to edit a certain issue. * * @param JUser $user The user whose permissions should be checked. * @param int $id ID of the relevant issue. If left empty or set to 0, * the permission to create a new issue is checked. * * @return bool True, if the user is allowed to edit the issue, false if not. */ public function canEdit($user, $id = 0) { $id = (int) $id; // If ID is 0, we create a new issue. if ($id == 0) { return $user->authorise('issue.create', 'com_monitor'); } // If user is not allowed to edit... if (!$user->authorise('issue.edit', 'com_monitor')) { if (!$user->authorise('issue.edit.own', 'com_monitor')) { return false; } // ...but to edit own issue... $infoQuery = $this->db->getQuery(true)->select('author_id, classification')->from('#__monitor_issues')->where('id = ' . $id); $this->db->setQuery($infoQuery); $this->db->execute(); $result = $this->db->loadObject(); // ...check if the issue belongs to the user. if ($result->author_id != $user->id) { return false; } } // Check if the user has access to the issue according to its classification. if (!isset($result)) { $infoQuery = $this->db->getQuery(true)->select('author_id, classification')->from('#__monitor_issues')->where('id = ' . $id); $this->db->setQuery($infoQuery); $this->db->execute(); $result = $this->db->loadObject(); } if (!in_array($result->classification, $user->getAuthorisedViewLevels())) { // Users can edit their own classifications, regardless of the classification. if ($result->author_id != $user->id) { return false; } } return true; }
/** * Adds the ip address on hover to the post title if an administrator. * * @param JUser $user The user ID. * @param string $ip The ip address of the shout. * * @return string The title to assign. * * @since 1.0.1 */ public function shouttitle($user, $ip) { $title = null; if ($user->authorise('core.admin')) { $title = ' title="' . $ip . '"'; } return $title; }
/** * Tests JUser::authorise(). * * @param integer $userId User id of user to test * @param string $action Action to get aithorized for this user * @param string $asset Asset to get authorization for * @param boolean $expected Expected return from the authorization check * * @return void * * @since 12.1 * * @covers JUser::authorise * @dataProvider casesAuthorise */ public function testAuthorise($userId, $action, $asset, $expected) { // Set up user 99 to be root_user from configuration $testConfig = $this->getMock('JConfig', array('get')); $testConfig->expects($this->any())->method('get')->will($this->returnValue(99)); JFactory::$config = $testConfig; // Run through test cases $user = new JUser($userId); $this->assertThat($user->authorise($action, $asset), $this->equalTo($expected), 'Line: ' . __LINE__ . ' Failed for user ' . $user->id); }
/** * Run when a list is emptied/truncated * Delete's all JUsers found in the list, except Admins * * @throws Exception * * @return bool */ public function onBeforeTruncate() { $params = $this->getParams(); if ($params->get('juser_field_userid') != '' && $params->get('juser_delete_user', false)) { $formModel = $this->getModel(); $listModel = $formModel->getListModel(); $db = $listModel->getDb(); $query = $db->getQuery(true); $userIdField = FabrikString::safeColName($this->getFieldName('juser_field_userid')); $query->select($userIdField)->from($listModel->getTable()->db_table_name); $userIds = $db->setQuery($query)->loadColumn(); foreach ($userIds as $userId) { $user = new JUser((int) $userId); $isRoot = $user->authorise('core.admin'); if (!$isRoot) { if (!$user->delete()) { $this->app->enqueueMessage('Unable to delete user id ' . $userId, 'error'); } } } } return true; }
/** * Check if the user is a joomla super administrator * * @param JUser $user The user to check * * @return boolean If the user is a super administrator * * @since 1.0.0 */ public function isJoomlaSuperAdmin(JUser $user) { return $user->authorise('core.admin', 'root.1'); }
/** * If category need authorize, we can write in this method. * * @param array $data Category record. * @param string $key Preimary key name. * * @return boolean Can edit or not. */ public function allowCategoryAdd($data, $key = 'catid') { return $this->user->authorise('core.create', $this->option . '.category.' . $data[$key]); }
/** * Method to check CUser object authorisation against an access control * * @param string $action The name of the action to check for permission. * @param string $assetname The name of the asset on which to perform the action. * * @return boolean True if authorised * @since Jomsocial 2.4 */ public function authorise($action, $assetname = null, $assetObject = null) { // Check is similar call has been made before. if (is_string($assetname) && isset($_cacheAction[$action . $assetname])) { return $_cacheAction[$action . $assetname]; } $access = CAccess::check($this->_userid, $action, $assetname, $assetObject); $_cacheAction[$action . $assetname] = $access; // If asset not found , get Joomla authorise. if ($access === null && method_exists('Juser', 'authorise')) { return parent::authorise($action, $assetname); } return $access; }
/** * Tests JUser::authorise(). * * @param integer $userId User id of user to test * @param string $action Action to get aithorized for this user * @param string $asset Asset to get authorization for * @param boolean $expected Expected return from the authorization check * * @return void * * @since 12.1 * * @dataProvider casesAuthorise */ public function testAuthorise($userId, $action, $asset, $expected) { // Run through test cases $user = new JUser($userId); $this->assertThat($user->authorise($action, $asset), $this->equalTo($expected), 'Line: ' . __LINE__ . ' Failed for user ' . $user->id); }
/** * Method to save the JUser object to the database * * @param boolean $updateOnly Save the object only if not a new user * Currently only used in the user reset password method. * * @return boolean True on success * * @since 11.1 * @throws exception */ public function save($updateOnly = false) { // Create the user table object $table = $this->getTable(); $this->params = (string) $this->_params; $table->bind($this->getProperties()); // Allow an exception to be thrown. try { // Check and store the object. if (!$table->check()) { $this->setError($table->getError()); return false; } // If user is made a Super Admin group and user is NOT a Super Admin // // @todo ACL - this needs to be acl checked // $my = JFactory::getUser(); //are we creating a new user $isNew = empty($this->id); // If we aren't allowed to create new users return if ($isNew && $updateOnly) { return true; } // Get the old user $oldUser = new JUser($this->id); // // Access Checks // // The only mandatory check is that only Super Admins can operate on other Super Admin accounts. // To add additional business rules, use a user plugin and throw an Exception with onUserBeforeSave. // Check if I am a Super Admin $iAmSuperAdmin = $my->authorise('core.admin'); $iAmRehashingSuperadmin = false; if ($my->id == 0 && !$isNew && $this->id == $oldUser->id && $oldUser->authorise('core.admin') && $oldUser->password != $this->password) { $iAmRehashingSuperadmin = true; } // We are only worried about edits to this account if I am not a Super Admin. if ($iAmSuperAdmin != true && $iAmRehashingSuperadmin != true) { if ($isNew) { // Check if the new user is being put into a Super Admin group. foreach ($this->groups as $groupId) { if (JAccess::checkGroup($groupId, 'core.admin')) { throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN')); } } } else { // I am not a Super Admin, and this one is, so fail. if (JAccess::check($this->id, 'core.admin')) { throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN')); } if ($this->groups != null) { // I am not a Super Admin and I'm trying to make one. foreach ($this->groups as $groupId) { if (JAccess::checkGroup($groupId, 'core.admin')) { throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN')); } } } } } // Fire the onUserBeforeSave event. JPluginHelper::importPlugin('user'); $dispatcher = JDispatcher::getInstance(); $result = $dispatcher->trigger('onUserBeforeSave', array($oldUser->getProperties(), $isNew, $this->getProperties())); if (in_array(false, $result, true)) { // Plugin will have to raise its own error or throw an exception. return false; } // Store the user data in the database if (!($result = $table->store())) { throw new Exception($table->getError()); } // Set the id for the JUser object in case we created a new user. if (empty($this->id)) { $this->id = $table->get('id'); } if ($my->id == $table->id) { $registry = new JRegistry(); $registry->loadString($table->params); $my->setParameters($registry); } // Fire the onUserAfterSave event $dispatcher->trigger('onUserAfterSave', array($this->getProperties(), $isNew, $result, $this->getError())); } catch (Exception $e) { $this->setError($e->getMessage()); return false; } return $result; }
/** * Checks if a user is allowed to edit a certain comment. * * @param JUser $user The user whose permissions should be checked. * @param int $id ID of the relevant comment. * * @return bool True, if the user is allowed to edit the given comment, false otherwise. */ public function canEdit($user, $id) { // If ID is 0, we create a new comment. if ($id == 0) { return $user->authorise('comment.create', 'com_monitor'); } else { // If user is not allowed to edit... if (!$user->authorise('comment.edit', 'com_monitor')) { if (!$user->authorise('comment.edit.own', 'com_monitor')) { return false; } // ...but to edit own comments... $authorQuery = $this->db->getQuery(true)->select('author_id')->from('#__monitor_comments')->where('id = ' . $id); $this->db->setQuery($authorQuery); $this->db->execute(); // ...check if the comment belongs to the user. if ($this->db->loadResult() !== $user->id) { return false; } } } return true; }
/** * Check action permission. For some component, this work differently than * core authorise(...) */ public function authorise($action, $asset = null) { jimport('joomla.filesystem.file'); // Check if $action is one of those we need to override, // if not, just pass it to parent $actions = explode('.', $action); // @todo: check and make sure it is exploded properly $comName = $actions[0]; $libPath = JPATH_ROOT . DS . 'components' . DS . 'com_' . $comName . DS . 'access.php'; if (!JFile::exists($libPath)) { return parent::authorise($action, $asset); } include_once $libPath; $className = ucfirst($comName) . 'Access'; // Shorten the action name and remove the first 'component name' part unset($actions[0]); $action = implode('.', $actions); // For some reason, php 5.2 doesn't like the code below // $className::check($this->id, $action, $asset) // SO, lets just instantiate the object $accessObj = new $className(); return $accessObj->check($this->id, $action, $asset); }
public function apply() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $mainframe = JFactory::getApplication(); $db = DiscussHelper::getDBO(); $my = JFactory::getUser(); $acl = JFactory::getACL(); $config = DiscussHelper::getConfig(); // Create a new JUser object $user = new JUser(JRequest::getVar('id', 0, 'post', 'int')); $original_gid = $user->get('gid'); $post = JRequest::get('post'); $user->name = $post['fullname']; if (DiscussHelper::getJoomlaVersion() >= '1.6') { $jformPost = JRequest::getVar('jform', array(), 'post', 'array'); $post['params'] = $jformPost['params']; } if (!$user->bind($post)) { DiscussHelper::setMessageQueue($user->getError(), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } if (DiscussHelper::getJoomlaVersion() >= '1.6') { if ($user->get('id') == $my->get('id') && $user->get('block') == 1) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_BLOCK_YOURSELF'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } else { if ($user->authorise('core.admin') && $user->get('block') == 1) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_BLOCK_SUPERUSER'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } else { if ($user->authorise('core.admin') && !$my->authorise('core.admin')) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_EDIT_SUPERUSER'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } } } //replacing thr group name with group id so it is save correctly into the Joomla group table. $jformPost = JRequest::getVar('jform', array(), 'post', 'array'); if (!empty($jformPost['groups'])) { $user->groups = array(); foreach ($jformPost['groups'] as $groupid) { $user->groups[$groupid] = $groupid; } } } else { $objectID = $acl->get_object_id('users', $user->get('id'), 'ARO'); $groups = $acl->get_object_groups($objectID, 'ARO'); $this_group = strtolower($acl->get_group_name($groups[0], 'ARO')); if ($user->get('id') == $my->get('id') && $user->get('block') == 1) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_BLOCK_YOURSELF'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } else { if ($this_group == 'super administrator' && $user->get('block') == 1) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_BLOCK_SUPERUSER'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } else { if ($this_group == 'administrator' && $my->get('gid') == 24 && $user->get('block') == 1) { DiscussHelper::setMessageQueue(JText::_('WARNBLOCK'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } else { if ($this_group == 'super administrator' && $my->get('gid') != 25) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_EDIT_SUPERUSER'), DISCUSS_QUEUE_ERROR); $this->_saveError($user->id); } } } } } // Are we dealing with a new user which we need to create? $isNew = $user->get('id') < 1; if (DiscussHelper::getJoomlaVersion() <= '1.5') { // do this step only for J1.5 if (!$isNew) { // if group has been changed and where original group was a Super Admin if ($user->get('gid') != $original_gid && $original_gid == 25) { // count number of active super admins $query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0'; $db->setQuery($query); $count = $db->loadResult(); if ($count <= 1) { DiscussHelper::setMessageQueue(JText::_('WARN_ONLY_SUPER'), DISCUSS_QUEUE_ERROR); // disallow change if only one Super Admin exists $this->setRedirect('index.php?option=com_easydiscuss&view=users'); return false; } } } } /* * Lets save the JUser object */ if (!$user->save()) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CANNOT_SAVE_THE_USER_INFORMATION'), DISCUSS_QUEUE_ERROR); return $this->execute('edit'); } // If updating self, load the new user object into the session if (DiscussHelper::getJoomlaVersion() <= '1.5') { // If updating self, load the new user object into the session if ($user->get('id') == $my->get('id')) { // Get an ACL object $acl = JFactory::getACL(); // Get the user group from the ACL $grp = $acl->getAroGroup($user->get('id')); // Mark the user as logged in $user->set('guest', 0); $user->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')) { $user->set('aid', 2); } // Set the usertype based on the ACL group name $user->set('usertype', $grp->name); $session = JFactory::getSession(); $session->set('user', $user); } } $post = JRequest::get('post'); if ($isNew) { // if this is a new account, we unset the id so // that profile jtable will add new record properly. unset($post['id']); } $profile = DiscussHelper::getTable('Profile'); $profile->load($user->id); $profile->bind($post); $file = JRequest::getVar('Filedata', '', 'Files', 'array'); if (!empty($file['name'])) { $newAvatar = DiscussHelper::uploadAvatar($profile, true); $profile->avatar = $newAvatar; } //save params $userparams = DiscussHelper::getRegistry(''); if (isset($post['facebook'])) { $userparams->set('facebook', $post['facebook']); } if (isset($post['show_facebook'])) { $userparams->set('show_facebook', $post['show_facebook']); } if (isset($post['twitter'])) { $userparams->set('twitter', $post['twitter']); } if (isset($post['show_twitter'])) { $userparams->set('show_twitter', $post['show_twitter']); } if (isset($post['linkedin'])) { $userparams->set('linkedin', $post['linkedin']); } if (isset($post['show_linkedin'])) { $userparams->set('show_linkedin', $post['show_linkedin']); } if (isset($post['skype'])) { $userparams->set('skype', $post['skype']); } if (isset($post['show_skype'])) { $userparams->set('show_skype', $post['show_skype']); } if (isset($post['website'])) { $userparams->set('website', $post['website']); } if (isset($post['show_website'])) { $userparams->set('show_website', $post['show_website']); } $profile->params = $userparams->toString(); // Save site details $siteDetails = DiscussHelper::getRegistry(''); if (isset($post['siteUrl'])) { $siteDetails->set('siteUrl', $post['siteUrl']); } if (isset($post['siteUsername'])) { $siteDetails->set('siteUsername', $post['siteUsername']); } if (isset($post['sitePassword'])) { $siteDetails->set('sitePassword', $post['sitePassword']); } if (isset($post['ftpUrl'])) { $siteDetails->set('ftpUrl', $post['ftpUrl']); } if (isset($post['ftpUsername'])) { $siteDetails->set('ftpUsername', $post['ftpUsername']); } if (isset($post['ftpPassword'])) { $siteDetails->set('ftpPassword', $post['ftpPassword']); } if (isset($post['optional'])) { $siteDetails->set('optional', $post['optional']); } $profile->site = $siteDetails->toString(); $profile->store(); // Update points DiscussHelper::getHelper('ranks')->assignRank($profile->id, 'points'); $app = JFactory::getApplication(); $task = $this->getTask(); $url = $task == 'apply' ? 'index.php?option=com_easydiscuss&view=user&id=' . $profile->id : 'index.php?option=com_easydiscuss&view=users'; DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_USER_INFORMATION_SAVED'), DISCUSS_QUEUE_SUCCESS); $app->redirect($url); }