/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { //Load pane behavior jimport('joomla.html.pane'); $pane =& JPane::getInstance('sliders'); $document =& JFactory::getDocument(); // Load tooltips JHTML::_('behavior.tooltip', '.hasTip'); $params = $this->get('Params'); //user's email privacy setting CFactory::load('libraries', 'emailtypes'); $emailtypes = new CEmailTypes(); // Add submenu $contents = ''; ob_start(); require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'views' . DS . 'configuration' . DS . 'tmpl' . DS . 'navigation.php'; $contents = ob_get_contents(); ob_end_clean(); $document =& JFactory::getDocument(); $document->setBuffer($contents, 'modules', 'submenu'); $lists = array(); for ($i = 1; $i <= 31; $i++) { $qscale[] = JHTML::_('select.option', $i, $i); } $lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11')); $videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)')); $lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize')); $imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High')); $lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality')); // Group discussion order option $groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first')); $lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order')); $dstOffset = array(); $counter = -4; for ($i = 0; $i <= 8; $i++) { $dstOffset[] = JHTML::_('select.option', $counter, $counter); $counter++; } $lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset')); $networkModel = $this->getModel('network', false); $JSNInfo =& $networkModel->getJSNInfo(); $JSON_output =& $networkModel->getJSON(); $lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']); $uploadLimit = ini_get('upload_max_filesize'); $uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit); $this->assignRef('JSNInfo', $JSNInfo); $this->assignRef('JSON_output', $JSON_output); $this->assignRef('lists', $lists); $this->assign('uploadLimit', $uploadLimit); $this->assign('config', $params); $this->assign('emailtypes', $emailtypes->getEmailTypes()); parent::display($tpl); }
/** * Inititalize the user JUser object * return true if the user is a new */ public function init($initObj = null) { $isNewUser = false; if (!$this->_init) { $config = CFactory::getConfig(); $db =& JFactory::getDBO(); $obj = $initObj; if ($initObj == null) { $query = 'SELECT ' . ' a.' . $db->nameQuote('userid') . ' as _userid , ' . ' a.' . $db->nameQuote('status') . ' as _status , ' . ' a.' . $db->nameQuote('points') . ' as _points, ' . ' a.' . $db->nameQuote('posted_on') . ' as _posted_on, ' . ' a.' . $db->nameQuote('avatar') . ' as _avatar , ' . ' a.' . $db->nameQuote('thumb') . ' as _thumb , ' . ' a.' . $db->nameQuote('invite') . ' as _invite, ' . ' a.' . $db->nameQuote('params') . ' as _cparams, ' . ' a.' . $db->nameQuote('view') . ' as _view, ' . ' a.' . $db->nameQuote('friends') . ' as _friends, ' . ' a.' . $db->nameQuote('groups') . ' as _groups, ' . ' a.' . $db->nameQuote('events') . ' as _events, ' . ' a.' . $db->nameQuote('friendcount') . ' as _friendcount, ' . ' a.' . $db->nameQuote('alias') . ' as _alias, ' . ' a.' . $db->nameQuote('profile_id') . ' as _profile_id, ' . ' a.' . $db->nameQuote('storage') . ' as _storage, ' . ' a.' . $db->nameQuote('watermark_hash') . ' as _watermark_hash, ' . ' a.' . $db->nameQuote('search_email') . ' as _search_email, ' . ' s.' . $db->nameQuote('userid') . ' as _isonline, u.* ' . ' FROM ' . $db->nameQuote('#__community_users') . ' as a ' . ' LEFT JOIN ' . $db->nameQuote('#__users') . ' u ' . ' ON u.' . $db->nameQuote('id') . '=a.' . $db->nameQuote('userid') . ' LEFT OUTER JOIN ' . $db->nameQuote('#__session') . ' s ' . ' ON s.' . $db->nameQuote('userid') . '=a.' . $db->nameQuote('userid') . ' AND s.' . $db->nameQuote('client_id') . ' !=' . $db->Quote('1') . ' WHERE a.' . $db->nameQuote('userid') . '=' . $db->Quote($this->id); $db->setQuery($query); $obj = $db->loadObject(); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } } // Initialise new user if (empty($obj)) { if (!$obj && $this->id != 0) { // @rule: ensure that the id given is correct and exists in #__users $existQuery = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__users') . ' ' . 'WHERE ' . $db->nameQuote('id') . '=' . $db->Quote($this->id); $db->setQuery($existQuery); $isValid = $db->loadResult() > 0 ? true : false; if ($isValid) { // We need to create a new record for this specific user first. $obj = new stdClass(); $obj->userid = $this->id; $obj->points = $this->_points; $obj->thumb = ''; $obj->avatar = ''; // Load default params $obj->params = "notifyEmailSystem=" . $config->get('privacyemail') . "\n" . "privacyProfileView=" . $config->get('privacyprofile') . "\n" . "privacyPhotoView=" . $config->get('privacyphotos') . "\n" . "privacyFriendsView=" . $config->get('privacyfriends') . "\n" . "privacyGroupsView=" . $config->get('privacy_groups_list') . "\n" . "privacyVideoView=" . $config->get('privacyvideos') . "\n" . "notifyEmailMessage=" . $config->get('privacyemailpm') . "\n" . "notifyEmailApps=" . $config->get('privacyapps') . "\n" . "notifyWallComment=" . $config->get('privacywallcomment') . "\n"; //load default email privacy settings CFactory::load('libraries', 'emailtypes'); $emailtypes = new CEmailTypes(); $obj->params .= $emailtypes->convertToParamsString(); $db->insertObject('#__community_users', $obj); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } // Reload the object $db->setQuery($query); $obj = $db->loadObject(); $isNewUser = true; } } } if ($obj) { $thisVars = get_object_vars($this); // load cparams $this->_cparams = new CParameter($obj->_cparams); // fix a bug where privacyVideoView = 1 if ($this->_cparams->get('privacyVideoView') == 1) { $this->_cparams->set('privacyVideoView', 0); } unset($obj->_cparams); // load user params $this->_params = new CParameter($obj->params); unset($obj->params); foreach ($thisVars as $key => $val) { if (isset($obj->{$key})) { $this->{$key} = $obj->{$key}; } } #correct the friendcount here because blocked user are still counted in "friendcount" //$model = CFactory::getModel( 'friends' ); //$realfriendcount = $model->getFriendsCount($this->id); //$this->_friendcount = $realfriendcount; // Update group list if we haven't get if ($this->_params->get('update_cache_list', 0) == 0) { //dont load updateGroupList in the backend if (strpos(JURI::current(), 'administrator') == false) { $this->updateGroupList(); $this->updateEventList(); } $this->_params->set('update_cache_list', 1); $this->save(); } // Set FB post param to default system value if it is not yet set if ($this->_cparams->get('postFacebookStatus', null) == null) { $this->_cparams->set('postFacebookStatus', $config->get('fbconnectpoststatus')); } } else { // this is a visitor, we still have to create params object for them $this->_cparams = new CParameter(''); $this->_params = new CParameter(''); } $this->_init = true; } return $isNewUser; }