/** * Retrieve joomla standard user parameters so that they can be displayed in user edit mode. * @param int $ui 1 for front-end, 2 for back-end * @param moscomprofilerUser $user the user being displayed * @param string $name Name of variable * @return array of user parameter attributes (title,value) */ function _getUserParams($ui, $user, $name = "params") { global $_CB_framework; $result = array(); // in case not Joomla if (class_exists("JUser")) { // Joomla 1.5 and 1.6: if ($user->id) { $juser = JUser::getInstance($user->id); } else { $juser = JUser::getInstance(); } if (checkJversion() == 2) { // Joomla 1.6: $result = array(); jimport('joomla.form.form'); JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_users/models/forms'); $form = JForm::getInstance('com_users.params', 'user', array('load_data' => true)); $params = $juser->getParameters(true)->toArray(); if ($params) { foreach ($params as $k => $v) { $form->setValue($k, 'params', $v); } } $fields = $form->getFieldset('settings'); if ($fields) { foreach ($fields as $field) { $admin_field = strpos($field->name, 'admin') || strpos($field->name, 'help'); if ($admin_field && ($juser->authorise('canManageUsers') || !$user->id) || !$admin_field) { $result[] = array($field->label, $field->input, $field->description, $field->name); } } } } else { // Joomla 1.5: $params =& $juser->getParameters(true); // $result = $params->render( 'params' ); if (is_callable(array($params, "getParams"))) { $result = $params->getParams($name); //BBB new API submited to Jinx 17.4.2006. } else { foreach ($params->_xml->param as $param) { //BBB still needs core help... accessing private variable _xml . $result[] = $params->renderParam($param, $name); } } } } else { if (file_exists($_CB_framework->getCfg('absolute_path') . '/administrator/components/com_users/users.class.php')) { require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_users/users.class.php'; } if (class_exists('mosUserParameters')) { // Joomla 1.0 : global $mainframe; $file = $mainframe->getPath('com_xml', 'com_users'); $userParams = new mosUserParameters($user->params, $file, 'component'); if (isset($userParams->_path) && $userParams->_path) { // Joomla 1.0 if (!is_object($userParams->_xmlElem)) { require_once $_CB_framework->getCfg('absolute_path') . '/includes/domit/xml_domit_lite_include.php'; $xmlDoc = new DOMIT_Lite_Document(); $xmlDoc->resolveErrors(true); if ($xmlDoc->loadXML($userParams->_path, false, true)) { $root =& $xmlDoc->documentElement; $tagName = $root->getTagName(); $isParamsFile = $tagName == 'mosinstall' || $tagName == 'mosparams'; if ($isParamsFile && $root->getAttribute('type') == $userParams->_type) { $params =& $root->getElementsByPath('params', 1); if ($params) { $userParams->_xmlElem =& $params; } } } } } $result = array(); if (isset($userParams->_xmlElem) && is_object($userParams->_xmlElem)) { // Joomla 1.0 $element =& $userParams->_xmlElem; //$params = mosParseParams( $row->params ); $userParams->_methods = get_class_methods("mosUserParameters"); foreach ($element->childNodes as $param) { $result[] = $userParams->renderParam($param, $name); } } } } return $result; }