Esempio n. 1
0
File: k2.php Progetto: emavro/k2
    function onAfterDispatch()
    {
        $mainframe = JFactory::getApplication();
        if ($mainframe->isAdmin()) {
            return;
        }
        $params = JComponentHelper::getParams('com_k2');
        if (!$params->get('K2UserProfile')) {
            return;
        }
        $option = JRequest::getCmd('option');
        $view = JRequest::getCmd('view');
        $task = JRequest::getCmd('task');
        $layout = JRequest::getCmd('layout');
        $user = JFactory::getUser();
        if (K2_JVERSION != '15') {
            $active = JFactory::getApplication()->getMenu()->getActive();
            if (isset($active->query['layout'])) {
                $layout = $active->query['layout'];
            }
        }
        if ($option == 'com_user' && $view == 'register' || $option == 'com_users' && $view == 'registration') {
            if ($params->get('recaptchaOnRegistration') && $params->get('recaptcha_public_key')) {
                $document = JFactory::getDocument();
                $document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js');
                $js = '
				function showRecaptcha(){
					Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
						theme: "' . $params->get('recaptcha_theme', 'clean') . '"
					});
				}
				$K2(document).ready(function() {
					showRecaptcha();
				});
				';
                $document->addScriptDeclaration($js);
            }
            if (!$user->guest) {
                $mainframe->enqueueMessage(JText::_('K2_YOU_ARE_ALREADY_REGISTERED_AS_A_MEMBER'), 'notice');
                $mainframe->redirect(JURI::root());
                $mainframe->close();
            }
            if (K2_JVERSION != '15') {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
                $controller = new UsersController();
            } else {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
                $controller = new UserController();
            }
            $view = $controller->getView($view, 'html');
            $view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
            $view->setLayout('register');
            $K2User = new JObject();
            $K2User->description = '';
            $K2User->gender = 'm';
            $K2User->image = '';
            $K2User->url = '';
            $K2User->plugins = '';
            $wysiwyg = JFactory::getEditor();
            $editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
            $view->assignRef('editor', $editor);
            $lists = array();
            $genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
            $genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
            $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
            $view->assignRef('lists', $lists);
            $view->assignRef('K2Params', $params);
            JPluginHelper::importPlugin('k2');
            $dispatcher = JDispatcher::getInstance();
            $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
            $view->assignRef('K2Plugins', $K2Plugins);
            $view->assignRef('K2User', $K2User);
            if (K2_JVERSION != '15') {
                $view->assignRef('user', $user);
            }
            $pathway = $mainframe->getPathway();
            $pathway->setPathway(NULL);
            $nameFieldName = K2_JVERSION != '15' ? 'jform[name]' : 'name';
            $view->assignRef('nameFieldName', $nameFieldName);
            $usernameFieldName = K2_JVERSION != '15' ? 'jform[username]' : 'username';
            $view->assignRef('usernameFieldName', $usernameFieldName);
            $emailFieldName = K2_JVERSION != '15' ? 'jform[email1]' : 'email';
            $view->assignRef('emailFieldName', $emailFieldName);
            $passwordFieldName = K2_JVERSION != '15' ? 'jform[password1]' : 'password';
            $view->assignRef('passwordFieldName', $passwordFieldName);
            $passwordVerifyFieldName = K2_JVERSION != '15' ? 'jform[password2]' : 'password2';
            $view->assignRef('passwordVerifyFieldName', $passwordVerifyFieldName);
            $optionValue = K2_JVERSION != '15' ? 'com_users' : 'com_user';
            $view->assignRef('optionValue', $optionValue);
            $taskValue = K2_JVERSION != '15' ? 'registration.register' : 'register_save';
            $view->assignRef('taskValue', $taskValue);
            ob_start();
            $view->display();
            $contents = ob_get_clean();
            $document = JFactory::getDocument();
            $document->setBuffer($contents, 'component');
        }
        if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form') || $option == 'com_users' && $view == 'profile' && ($layout == 'edit' || $task == 'profile.edit')) {
            if ($user->guest) {
                $uri = JFactory::getURI();
                if (K2_JVERSION != '15') {
                    $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString());
                } else {
                    $url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString());
                }
                $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
                $mainframe->redirect(JRoute::_($url, false));
            }
            if (K2_JVERSION != '15') {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
                $controller = new UsersController();
            } else {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
                $controller = new UserController();
            }
            /*
            // TO DO - We open the profile editing page in a modal, so let's define some CSS
            $document = JFactory::getDocument();
            $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.frontend.css?v=2.7.0');
            $document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css');
            $document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css');
            if(K2_JVERSION != '15') {
            $document->addStyleSheet(JURI::root(true).'/administrator/templates/bluestork/css/template.css');
            $document->addStyleSheet(JURI::root(true).'/media/system/css/system.css');
            } else {
            $document->addStyleSheet(JURI::root(true).'/administrator/templates/khepri/css/general.css');
            }
            */
            $view = $controller->getView($view, 'html');
            $view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
            $view->setLayout('profile');
            $model = K2Model::getInstance('Itemlist', 'K2Model');
            $K2User = $model->getUserProfile($user->id);
            if (!is_object($K2User)) {
                $K2User = new Jobject();
                $K2User->description = '';
                $K2User->gender = 'm';
                $K2User->url = '';
                $K2User->image = NULL;
            }
            if (K2_JVERSION == '15') {
                JFilterOutput::objectHTMLSafe($K2User);
            } else {
                JFilterOutput::objectHTMLSafe($K2User, ENT_QUOTES, array('params', 'plugins'));
            }
            $wysiwyg = JFactory::getEditor();
            $editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
            $view->assignRef('editor', $editor);
            $lists = array();
            $genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
            $genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
            $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
            $view->assignRef('lists', $lists);
            JPluginHelper::importPlugin('k2');
            $dispatcher = JDispatcher::getInstance();
            $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
            $view->assignRef('K2Plugins', $K2Plugins);
            $view->assignRef('K2User', $K2User);
            // Asssign some variables depending on Joomla! version
            $nameFieldName = K2_JVERSION != '15' ? 'jform[name]' : 'name';
            $view->assignRef('nameFieldName', $nameFieldName);
            $emailFieldName = K2_JVERSION != '15' ? 'jform[email1]' : 'email';
            $view->assignRef('emailFieldName', $emailFieldName);
            $passwordFieldName = K2_JVERSION != '15' ? 'jform[password1]' : 'password';
            $view->assignRef('passwordFieldName', $passwordFieldName);
            $passwordVerifyFieldName = K2_JVERSION != '15' ? 'jform[password2]' : 'password2';
            $view->assignRef('passwordVerifyFieldName', $passwordVerifyFieldName);
            $usernameFieldName = K2_JVERSION != '15' ? 'jform[username]' : 'username';
            $view->assignRef('usernameFieldName', $usernameFieldName);
            $idFieldName = K2_JVERSION != '15' ? 'jform[id]' : 'id';
            $view->assignRef('idFieldName', $idFieldName);
            $optionValue = K2_JVERSION != '15' ? 'com_users' : 'com_user';
            $view->assignRef('optionValue', $optionValue);
            $taskValue = K2_JVERSION != '15' ? 'profile.save' : 'save';
            $view->assignRef('taskValue', $taskValue);
            ob_start();
            if (K2_JVERSION != '15') {
                $active = JFactory::getApplication()->getMenu()->getActive();
                if (isset($active->query['layout']) && $active->query['layout'] != 'profile') {
                    $active->query['layout'] = 'profile';
                }
                $view->assignRef('user', $user);
                $view->display();
            } else {
                $view->_displayForm();
            }
            $contents = ob_get_clean();
            $document = JFactory::getDocument();
            $document->setBuffer($contents, 'component');
        }
    }
Esempio n. 2
0
 function onAfterDispatch()
 {
     $mainframe =& JFactory::getApplication();
     if ($mainframe->isAdmin()) {
         return;
     }
     JPlugin::loadLanguage('com_k2');
     $params =& JComponentHelper::getParams('com_k2');
     if (!$params->get('K2UserProfile')) {
         return;
     }
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     $task = JRequest::getCmd('task');
     $layout = JRequest::getCmd('layout');
     $user =& JFactory::getUser();
     if ($option == 'com_user' && $view == 'register') {
         if (!$user->guest) {
             $mainframe->redirect(JURI::root(), JText::_('You are already registered as a member.'), 'notice');
             $mainframe->close();
         }
         require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
         $controller = new UserController();
         $view = $controller->getView('register', 'html');
         $view->_addPath('template', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
         $view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
         $view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
         $view->setLayout('register');
         $K2User = new JObject();
         $K2User->description = '';
         $K2User->gender = 'm';
         $K2User->image = '';
         $K2User->url = '';
         $K2User->plugins = '';
         $wysiwyg =& JFactory::getEditor();
         $editor = $wysiwyg->display('description', $K2User->description, '100%', '250', '40', '5', false);
         $view->assignRef('editor', $editor);
         $lists = array();
         $genderOptions[] = JHTML::_('select.option', 'm', JText::_('Male'));
         $genderOptions[] = JHTML::_('select.option', 'f', JText::_('Female'));
         $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
         $view->assignRef('lists', $lists);
         JPluginHelper::importPlugin('k2');
         $dispatcher =& JDispatcher::getInstance();
         $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
         $view->assignRef('K2Plugins', $K2Plugins);
         $view->assignRef('K2User', $K2User);
         $pathway =& $mainframe->getPathway();
         $pathway->setPathway(NULL);
         ob_start();
         $view->display();
         $contents = ob_get_clean();
         $document =& JFactory::getDocument();
         $document->setBuffer($contents, 'component');
     }
     if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form')) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
         $controller = new UserController();
         $view = $controller->getView('user', 'html');
         $view->_addPath('template', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
         $view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
         $view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
         $view->setLayout('profile');
         require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'itemlist.php';
         $model = new K2ModelItemlist();
         $K2User = $model->getUserProfile($user->id);
         if (!is_object($K2User)) {
             $K2User = new Jobject();
             $K2User->description = '';
             $K2User->gender = 'm';
             $K2User->url = '';
             $K2User->image = NULL;
         }
         $wysiwyg =& JFactory::getEditor();
         $editor = $wysiwyg->display('description', $K2User->description, '100%', '250', '40', '5', false);
         $view->assignRef('editor', $editor);
         $lists = array();
         $genderOptions[] = JHTML::_('select.option', 'm', JText::_('Male'));
         $genderOptions[] = JHTML::_('select.option', 'f', JText::_('Female'));
         $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
         $view->assignRef('lists', $lists);
         JPluginHelper::importPlugin('k2');
         $dispatcher =& JDispatcher::getInstance();
         $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
         $view->assignRef('K2Plugins', $K2Plugins);
         $view->assignRef('K2User', $K2User);
         ob_start();
         $view->_displayForm();
         $contents = ob_get_clean();
         $document =& JFactory::getDocument();
         $document->setBuffer($contents, 'component');
     }
 }
	function onAfterDispatch() {

                jimport('joomla.filesystem.file');
                if(!JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php')) {
                    return;
                }
		$mainframe = &JFactory::getApplication();

		if($mainframe->isAdmin()) return;

		$option = JRequest::getCmd('option');
		$view = JRequest::getCmd('view');
		$task = JRequest::getCmd('task');
		$layout = JRequest::getCmd('layout');
		$user = &JFactory::getUser();

		$plugin = JPluginHelper::getPlugin( 'system' , 'joomailermailchimpsignup' );

		$api = $this->api();

		$k2plugin = false;
		jimport('joomla.filesystem.file');
		if(JFile::exists( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'admin.k2.php')){
		    $k2params = JComponentHelper::getParams( 'com_k2' );
		    $k2plugin = $k2params->get('K2UserProfile');
		}

		if (!$k2plugin && ($option == 'com_user' && ($view == 'register' || $view == 'user')))
		{
			$template =& $mainframe->getTemplate();
			if($view == 'register') {
				$v = 'register';
				$l = ($template == 'morph') ? 'register_morph' : 'register';
			} else {
				$v = 'user';
				$l = 'profile';
			}
			require_once (JPATH_SITE.DS.'components'.DS.'com_user'.DS.'controller.php');
			$controller = new UserController;
			$view = $controller->getView($v, 'html');
			$view->_addPath('template', JPATH_SITE.DS.'components'.DS.'com_joomailermailchimpsignup'.DS.'templates');
			$view->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_joomailermailchimpsignup'.DS.'templates');
			$view->setLayout($l);

			$listId = $this->params->get('listid');

			$mergefields = $api->listMergeVars( $listId );
			$mergeids = $this->params->get('fields');

			$interests = $api->listInterestGroupings( $listId );
			$interestids = $this->params->get('interests');

			$ihtml = '';
			$checked = '';
			$groupings = '';
			$usermerges = array();

			//Check if the user is subscribed
			if($user->email){

				$userlists = $api->listsForEmail($user->email);

				if($userlists && in_array($listId,$userlists)) {
					$checked = 'checked="checked"';
				}
				$userinfo = $api->listMemberInfo($listId, $user->email);
				$usermerges = $userinfo['merges'];
				$groupings = $userinfo['merges']['GROUPINGS'];
			}

			$lang = & JFactory::getLanguage();
			$lang->load('plg_system_joomailermailchimpsignup', JPATH_ADMINISTRATOR);

			if($template == 'morph'){
			    $ihtml = '<li class="label"><label for="newsletter">';
			    $ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
			    $ihtml.= '</label></li>';
			    $ihtml.= '<li>';
			    $ihtml.= "<input type='checkbox' name='newsletter' id='newsletter' value='1' ".$checked." />";
			    $ihtml.= '&nbsp;&nbsp;<label for="newsletter">';
			    $ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
			    $ihtml.= '</label>';
			    $ihtml.= "</li>";
			} else {
			    $ihtml = "<tr><td height='40'><label for='newsletter'>";
			    $ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
			    $ihtml.= '</label></td>';
			    $ihtml.= '<td height="40">';
			    $ihtml.= "<input type='checkbox' name='newsletter' id='newsletter' value='1' ".$checked." /><input type='hidden' name='oldEmail' value='".$user->email."' />";
			    $ihtml.= "</td></tr>";
			}

			//Merge Fields
			if($mergefields){
				$ihtml .= $this->buildMergeVarsHTML( $mergefields, $usermerges, $mergeids );
			}

			//Groups
			if($interests){
				//Build the HTML for the interests
				$ihtml .= $this->buildInterestsHTML( $interests, $groupings, $interestids );
			}
			$view->assignRef('ihtml', $ihtml);

			$pathway = &$mainframe->getPathway();
			$pathway->setPathway(NULL);

			ob_start();
			$view->display();
			$contents = ob_get_clean();
			$document = &JFactory::getDocument();
			$document->setBuffer($contents, 'component');
		}
	}
Esempio n. 4
0
    function onAfterDispatch()
    {
        $mainframe =& JFactory::getApplication();
        if ($mainframe->isAdmin()) {
            return;
        }
        $params =& JComponentHelper::getParams('com_k2');
        if (!$params->get('K2UserProfile')) {
            return;
        }
        $option = JRequest::getCmd('option');
        $view = JRequest::getCmd('view');
        $task = JRequest::getCmd('task');
        $layout = JRequest::getCmd('layout');
        $user =& JFactory::getUser();
        if ($option == 'com_user' && $view == 'register' || $option == 'com_users' && $view == 'registration') {
            if ($params->get('recaptchaOnRegistration') && $params->get('recaptcha_public_key')) {
                $document =& JFactory::getDocument();
                $document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js');
                $js = '
				function showRecaptcha(){
					Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
						theme: "' . $params->get('recaptcha_theme', 'clean') . '"
					});
				}
				$K2(document).ready(function() {
					showRecaptcha();
				});
				';
                $document->addScriptDeclaration($js);
            }
            if (!$user->guest) {
                $mainframe->redirect(JURI::root(), JText::_('K2_YOU_ARE_ALREADY_REGISTERED_AS_A_MEMBER'), 'notice');
                $mainframe->close();
            }
            if (K2_JVERSION == '16') {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
                $controller = new UsersController();
            } else {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
                $controller = new UserController();
            }
            $view = $controller->getView($view, 'html');
            $view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
            $view->setLayout('register');
            $K2User = new JObject();
            $K2User->description = '';
            $K2User->gender = 'm';
            $K2User->image = '';
            $K2User->url = '';
            $K2User->plugins = '';
            $wysiwyg =& JFactory::getEditor();
            $editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
            $view->assignRef('editor', $editor);
            $lists = array();
            $genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
            $genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
            $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
            $view->assignRef('lists', $lists);
            $view->assignRef('K2Params', $params);
            JPluginHelper::importPlugin('k2');
            $dispatcher =& JDispatcher::getInstance();
            $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
            $view->assignRef('K2Plugins', $K2Plugins);
            $view->assignRef('K2User', $K2User);
            if (K2_JVERSION == '16') {
                $view->assignRef('user', $user);
            }
            $pathway =& $mainframe->getPathway();
            $pathway->setPathway(NULL);
            ob_start();
            $view->display();
            $contents = ob_get_clean();
            $document =& JFactory::getDocument();
            $document->setBuffer($contents, 'component');
        }
        if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form') || $option == 'com_users' && $view == 'profile' && $layout == 'edit') {
            if ($user->guest) {
                JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
            }
            if (K2_JVERSION == '16') {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
                $controller = new UsersController();
            } else {
                require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
                $controller = new UserController();
            }
            /*
            // TO DO - We open the profile editing page in a modal, so let's define some CSS
            $document = &JFactory::getDocument();
            $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.frontend.css');
            $document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css');
            $document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css');
            if(K2_JVERSION == '16') {
            	$document->addStyleSheet(JURI::root(true).'/administrator/templates/bluestork/css/template.css');
            	$document->addStyleSheet(JURI::root(true).'/media/system/css/system.css');
            } else {
            	$document->addStyleSheet(JURI::root(true).'/administrator/templates/khepri/css/general.css');
            }
            */
            $view = $controller->getView($view, 'html');
            $view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
            $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
            $view->setLayout('profile');
            require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'itemlist.php';
            $model = new K2ModelItemlist();
            $K2User = $model->getUserProfile($user->id);
            if (!is_object($K2User)) {
                $K2User = new Jobject();
                $K2User->description = '';
                $K2User->gender = 'm';
                $K2User->url = '';
                $K2User->image = NULL;
            }
            $wysiwyg =& JFactory::getEditor();
            $editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
            $view->assignRef('editor', $editor);
            $lists = array();
            $genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
            $genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
            $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
            $view->assignRef('lists', $lists);
            JPluginHelper::importPlugin('k2');
            $dispatcher =& JDispatcher::getInstance();
            $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
            $view->assignRef('K2Plugins', $K2Plugins);
            $view->assignRef('K2User', $K2User);
            ob_start();
            if (K2_JVERSION == '16') {
                $view->assignRef('user', $user);
                $view->display();
            } else {
                $view->_displayForm();
            }
            $contents = ob_get_clean();
            $document =& JFactory::getDocument();
            $document->setBuffer($contents, 'component');
        }
    }