/** HTGMOD **/ public function ajaxLogin() { $objResponse = new JAXResponse(); $config = CFactory::getConfig(); $tmpl = new CTemplate(); $usersConfig =& JComponentHelper::getParams('com_users'); $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('config', $config); $tmpl->set('usersConfig', $usersConfig); $html = $tmpl->fetch('frontpage.guests'); $objResponse->addAssign('cWindowContent', 'innerHTML', $html); $objResponse->addScriptCall('cWindowResize', 300); $objResponse->addScriptCall('fbAsyncInit'); $objResponse->addScriptCall('onLoginWindowLoad'); return $objResponse->sendResponse(); }
public function register($data = null) { //require_once (JPATH_COMPONENT.'/libraries/profile.php'); $mainframe = JFactory::getApplication(); $my = CFactory::getUser(); $config = CFactory::getConfig(); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_REGISTER_NEW')); // Hide this form for logged in user if ($my->id) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_REGISTER_ALREADY_USER'), 'warning'); return; } // If user registration is not allowed, show 403 not authorized. $usersConfig = JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { //show warning message $this->addWarning(JText::_('COM_COMMUNITY_REGISTRATION_DISABLED')); return; } $fields = array(); $post = JRequest::get('post'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $data = array(); $data['fields'] = $fields; $data['html_field']['jsname'] = empty($post['jsname']) ? '' : $post['jsname']; $data['html_field']['jsusername'] = empty($post['jsusername']) ? '' : $post['jsusername']; $data['html_field']['jsemail'] = empty($post['jsemail']) ? '' : $post['jsemail']; $data['html_field']['jsfirstname'] = empty($post['jsfirstname']) ? '' : $post['jsfirstname']; $data['html_field']['jslastname'] = empty($post['jslastname']) ? '' : $post['jslastname']; // $js = 'assets/validate-1.5.min.js'; // CFactory::attach($js, 'js'); $recaptcha = new CRecaptchaHelper(); $recaptchaHTML = $recaptcha->html(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } $tmpl = new CTemplate(); $content = $tmpl->set('data', $data)->set('recaptchaHTML', $recaptchaHTML)->set('config', $config)->set('isUseFirstLastName', $isUseFirstLastName)->set('fbHtml', $fbHtml)->fetch('register/base'); $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(&$content); $appsLib->triggerEvent('onUserRegisterFormDisplay', $args); echo $this->_getProgressBar(1); echo $content; }
public function register($data = null) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'profile.php'; $mainframe =& JFactory::getApplication(); $my = CFactory::getUser(); $config = CFactory::getConfig(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_COMMUNITY_REGISTER_NEW')); // Hide this form for logged in user if ($my->id) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_REGISTER_ALREADY_USER'), 'warning'); return; } // If user registration is not allowed, show 403 not authorized. $usersConfig =& JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { //show warning message $this->addWarning(JText::_('COM_COMMUNITY_REGISTRATION_DISABLED')); return; } $fields = array(); $empty_html = array(); $post = JRequest::get('post'); CFactory::load('helpers', 'user'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $data = array(); $data['fields'] = $fields; $data['html_field']['jsname'] = empty($post['jsname']) ? '' : $post['jsname']; $data['html_field']['jsusername'] = empty($post['jsusername']) ? '' : $post['jsusername']; $data['html_field']['jsemail'] = empty($post['jsemail']) ? '' : $post['jsemail']; $data['html_field']['jsfirstname'] = empty($post['jsfirstname']) ? '' : $post['jsfirstname']; $data['html_field']['jslastname'] = empty($post['jslastname']) ? '' : $post['jslastname']; $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); // @rule: Load recaptcha if required. CFactory::load('helpers', 'recaptcha'); $recaptchaHTML = getRecaptchaHTMLData(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } $tmpl = new CTemplate(); $content = $tmpl->set('data', $data)->set('recaptchaHTML', $recaptchaHTML)->set('config', $config)->set('isUseFirstLastName', $isUseFirstLastName)->set('fbHtml', $fbHtml)->fetch('register.index'); $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(&$content); $appsLib->triggerEvent('onUserRegisterFormDisplay', $args); echo $this->_getProgressBar(1); echo $content; }
#joms-icon-switch"></use> </svg> </a> </div> </div> </div> <?php } else { $config = CFactory::getConfig(); $usersConfig = JComponentHelper::getParams('com_users'); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); $fbHtml = ''; foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } ?> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="498" height="144" viewBox="0 0 498 144" class="joms-hide"> <defs> <g id="joms-icon-user">
public function blockUnregister($uri = null) { $my = CFactory::getUser(); $config = CFactory::getConfig(); $usersConfig = JComponentHelper::getParams('com_users'); if ($my->id == 0) { $config = CFactory::getConfig(); if (empty($uri)) { $uri = CRoute::getURI(false); } $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); $fbHtml = ''; foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration')); $tmpl->set('useractivation', $usersConfig->get('useractivation')); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
/** * Frontpage display * @param type $tpl */ public function display($tpl = null) { /** * Init variables */ $config = CFactory::getConfig(); $document = JFactory::getDocument(); $usersConfig = JComponentHelper::getParams('com_users'); $my = CFactory::getUser(); $model = CFactory::getModel('user'); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename'))); /** * Init document */ $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); // Process headers HTML output $headerHTML = ''; $tmpl = new CTemplate(); $alreadyLogin = 0; /* User is logged */ if ($my->id != 0) { $headerHTML = $tmpl->fetch('frontpage.members'); $alreadyLogin = 1; } else { /* User is not logged */ $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; /* Facebook login */ if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } /* Joomla! Facebook Connect */ if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } //hero image $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg'; if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg'; } else { if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png'; } } //add the hero image as the image metatdata $imgMeta = '<meta property="og:image" content="' . $heroImage . '"/>'; $document->addCustomTag($imgMeta); $themeModel = CFactory::getModel('theme'); $settings = $themeModel->getSettings(); /* Generate header HTML for guest */ if ($settings['general']['enable-frontpage-login']) { $headerHTML = $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration'))->set('heroImage', $heroImage)->set('fbHtml', $fbHtml)->set('useractivation', $usersConfig->get('useractivation'))->set('return', $uri)->set('settings', $settings)->fetch('frontpage/guest'); } else { $headerHTML = ''; } } /* Get site members count */ $totalMembers = $model->getMembersCount(); $latestActivitiesData = $this->showLatestActivities(); $latestActivitiesHTML = $latestActivitiesData['HTML']; $tmpl = new CTemplate(); $tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('customActivityHTML', $this->getCustomActivityHTML()); $status = new CUserStatus(); if ($my->authorise('community.view', 'frontpage.statusbox')) { // Add default status box CUserHelper::addDefaultStatusCreator($status); if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) { $template = new CTemplate(); $template->set('customActivities', CActivityStream::getCustomActivities()); $creator = new CUserStatusCreator('custom'); $creator->title = JText::_('COM_COMMUNITY_CUSTOM'); $creator->html = $template->fetch('status.custom'); $status->addCreator($creator); } } /** * Misc variables * @since 3.3 * Move out variable init in side template into view */ $moduleCount = count(JModuleHelper::getModules('js_side_frontpage')) + count(JModuleHelper::getModules('js_side_top')) + count(JModuleHelper::getModules('js_side_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_top')) + count(JModuleHelper::getModules('js_side_frontpage_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_stacked')) + count(JModuleHelper::getModules('js_side_top_stacked')) + count(JModuleHelper::getModules('js_side_bottom_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_top_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_bottom_stacked')); $jinput = JFactory::getApplication()->input; /** * @todo 3.3 * All of these code must be provided in object. DO NOT PUT ANY CODE LOGIC HERE ! */ $cconfig = CFactory::getConfig(); $filter = $jinput->get('filter'); $filterValue = $jinput->get('value', 'default_value', 'RAW'); $filterText = JText::_("COM_COMMUNITY_FILTERBAR_ALL"); $filterHashtag = false; $filterKeyword = false; if ($filter == 'apps') { switch ($filterValue) { case 'profile': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_STATUS"); break; case 'photo': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_PHOTO"); break; case 'video': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_VIDEO"); break; case 'group': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_GROUP"); break; case 'event': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_EVENT"); break; } } else { if ($filter == 'hashtag') { $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_HASHTAG") . ' #' . $filterValue; $filterHashtag = true; } else { if ($filter == 'keyword') { $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_KEYWORD") . ' ' . $filterValue; $filterKeyword = true; } else { switch ($filterValue) { case 'me-and-friends': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_RELATIONSHIP_ME_AND_FRIENDS"); break; } } } } echo $tmpl->set('userstatus', $status)->set('moduleCount', $moduleCount)->set('class', $moduleCount > 0 ? 'span8' : 'span12')->set('filterKey', $filter)->set('filter', $filter)->set('filterText', $filterText)->set('filterHashtag', $filterHashtag)->set('filterKeyword', $filterKeyword)->set('filterValue', $filterValue)->fetch('frontpage/base'); }
/** * Edits a user details * * @access public * @param array An associative array to display the editing of the fields */ function editDetails(&$data) { $mainframe =& JFactory::getApplication(); // access check CFactory::setActiveProfile(); if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('CC EDIT DETAILS'), ''); $document =& JFactory::getDocument(); $document->setTitle(JText::_('CC EDIT DETAILS')); $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $this->showSubmenu(); $connectModel = CFactory::getModel('Connect'); $associated = $connectModel->isAssociated($my->id); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'facebook'); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use CFactory::load('helpers', 'user'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $jConfig =& JFactory::getConfig(); CFactory::load('libraries', 'apps'); $app =& CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); $tmpl->set('beforeFormDisplay', $beforeFormDisplay); $tmpl->set('afterFormDisplay', $afterFormDisplay); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('jConfig', $jConfig); $tmpl->set('params', $data->params); $tmpl->set('user', $my); $tmpl->set('config', $config); $tmpl->set('associated', $associated); $tmpl->set('isAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('offsetList', $data->offsetList); $tmpl->set('isUseFirstLastName', $isUseFirstLastName); echo $tmpl->fetch('profile.edit.details'); }
public function display() { $mainframe = JFactory::getApplication(); $config = CFactory::getConfig(); $document = JFactory::getDocument(); $usersConfig =& JComponentHelper::getParams('com_users'); $useractivation = $usersConfig->get('useractivation'); $document->setTitle(JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename'))); $my = CFactory::getUser(); $model = CFactory::getModel('user'); $avatarModel = CFactory::getModel('avatar'); $status = CFactory::getModel('status'); $frontpageUsers = intval($config->get('frontpageusers')); $document->addScriptDeclaration("var frontpageUsers\t= " . $frontpageUsers . ";"); $frontpageVideos = intval($config->get('frontpagevideos')); $document->addScriptDeclaration("var frontpageVideos\t= " . $frontpageVideos . ";"); $status = $status->get($my->id); $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); CFactory::load('libraries', 'tooltip'); CFactory::load('libraries', 'activities'); // Process headers HTML output $headerHTML = ''; $tmpl = new CTemplate(); $alreadyLogin = 0; if ($my->id != 0) { $headerHTML = $tmpl->fetch('frontpage.members'); $alreadyLogin = 1; } else { $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } $usersConfig =& JComponentHelper::getParams('com_users'); $tmpl->set('useractivation', $useractivation); $headerHTML = $tmpl->set('fbHtml', $fbHtml)->set('return', $uri)->set('config', $config)->set('usersConfig', $usersConfig)->fetch('frontpage.guests'); } $my = CFactory::getUser(); $totalMembers = $model->getMembersCount(); unset($tmpl); $latestMembersData = $this->_cachedCall('showLatestMembers', array($config->get('frontpageusers')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE)); $latestMembersHTML = $latestMembersData['HTML']; $latestGroupsData = $this->_cachedCall('showLatestGroups', array($config->get('frontpagegroups')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE)); $latestGroupsHTML = $latestGroupsData['HTML']; $latestVideoData = $this->showLatestVideos($config->get('frontpagevideos')); $latestVideoHTML = $latestVideoData['HTML']; $latestPhotosData = $this->_cachedCall('showLatestPhotos', array(false), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE)); $latestPhotosHTML = $latestPhotosData['HTML']; $latestEventsData = $this->_cachedCall('showLatestEvents', array($config->get('frontpage_events_limit')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE)); $latestEventsHTML = $latestEventsData['HTML']; $latestActivitiesData = $this->showLatestActivities(); $latestActivitiesHTML = $latestActivitiesData['HTML']; $tmpl = new CTemplate(); $tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('onlineMembers', $this->getOnlineMembers())->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('latestMembers', $latestMembersHTML)->set('latestGroups', $latestGroupsHTML)->set('latestPhotosHTML', $latestPhotosHTML)->set('latestVideosHTML', $latestVideoHTML)->set('latestEvents', $latestEventsHTML)->set('customActivityHTML', $this->getCustomActivityHTML()); /** Compatibility fix **/ CFactory::load('helpers', 'string'); /* User status */ CFactory::load('libraries', 'userstatus'); $status = new CUserStatus(); if ($my->authorise('community.view', 'frontpage.statusbox')) { // Add default status box CFactory::load('helpers', 'user'); CUserHelper::addDefaultStatusCreator($status); if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) { $template = new CTemplate(); $template->set('customActivities', CActivityStream::getCustomActivities()); $creator = new CUserStatusCreator('custom'); $creator->title = JText::_('COM_COMMUNITY_CUSTOM'); $creator->html = $template->fetch('status.custom'); $status->addCreator($creator); } } echo $tmpl->set('userstatus', $status)->fetch('frontpage.index'); }
/** * Edits a user details * * @access public * @param array An associative array to display the editing of the fields */ public function editDetails(&$data) { $mainframe = JFactory::getApplication(); // access check CFactory::setActiveProfile(); if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $userParams = $my->getParams(); $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('COM_COMMUNITY_EDIT_DETAILS'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EDIT_DETAILS')); // $js = 'assets/validate-1.5.min.js'; // CFactory::attach($js, 'js'); $this->showSubmenu(); $connectModel = CFactory::getModel('Connect'); $associated = $connectModel->isAssociated($my->id); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $jConfig = JFactory::getConfig(); //CFactory::load( 'libraries' , 'apps' ); $app = CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('fbHtml', $fbHtml)->set('fbPostStatus', $userParams->get('postFacebookStatus'))->set('jConfig', $jConfig)->set('params', $data->params)->set('user', $my)->set('config', $config)->set('associated', $associated)->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('offsetList', $data->offsetList)->set('isUseFirstLastName', $isUseFirstLastName)->fetch('profile.edit.details'); }
public function blockUnregister($uri = null) { $my = CFactory::getUser(); $config = CFactory::getConfig(); $usersConfig = JComponentHelper::getParams('com_users'); if ($my->id == 0) { $config = CFactory::getConfig(); if (empty($uri)) { $uri = CRoute::getURI(false); } $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); $fbHtml = ''; foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } //hero image $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg'; if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg'; } else { if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png'; } } $themeModel = CFactory::getModel('theme'); $settings = $themeModel->getSettings(); $tmpl->set('settings', $settings); $tmpl->set('heroImage', $heroImage); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration')); $tmpl->set('useractivation', $usersConfig->get('useractivation')); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
function display() { $mainframe = JFactory::getApplication(); $config = CFactory::getConfig(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename'))); $my = CFactory::getUser(); $model = CFactory::getModel('user'); $avatarModel = CFactory::getModel('avatar'); $status = CFactory::getModel('status'); $frontpageUsers = intval($config->get('frontpageusers')); $document->addScriptDeclaration("var frontpageUsers\t= " . $frontpageUsers . ";"); $frontpageVideos = intval($config->get('frontpagevideos')); $document->addScriptDeclaration("var frontpageVideos\t= " . $frontpageVideos . ";"); $status = $status->get($my->id); $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE RECENT ACTIVITIES FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); CFactory::load('libraries', 'tooltip'); CFactory::load('libraries', 'activities'); // Process headers HTML output $headerHTML = ''; $tmpl = new CTemplate(); $alreadyLogin = 0; if ($my->id != 0) { $headerHTML = $tmpl->fetch('frontpage.members'); $alreadyLogin = 1; } else { $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } $usersConfig =& JComponentHelper::getParams('com_users'); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('config', $config); $tmpl->set('usersConfig', $usersConfig); $headerHTML = $tmpl->fetch('frontpage.guests'); } $my = CFactory::getUser(); $totalMembers = $model->getMembersCount(); unset($tmpl); // Caching on latest members, groups, videos, activities, photos... $cache = CFactory::getCache('Core'); $permission = $my->id == 0 ? 0 : 20; // public or site members // Cache few groups to display random data because shuffle is not working after page cached. $intRandom = rand(COMMUNITY_CACHE_RANDOM_MIN, COMMUNITY_CACHE_RANDOM_MAX); if (!($latestMembersHTML = $cache->load('frontpage_showLatestMembers_' . $intRandom))) { $latestMembersHTML = $this->showLatestMembers($config->get('frontpageusers')); $cache->save($latestMembersHTML, NULL, array(COMMUNITY_CACHE_TAG_MEMBERS)); } if (!($latestGroupsHTML = $cache->load('frontpage_showLatestgroups'))) { $latestGroupsHTML = $this->showLatestGroups($config->get('frontpagegroups')); $cache->save($latestGroupsHTML, NULL, array(COMMUNITY_CACHE_TAG_GROUPS)); } if (!($latestVideoHTML = $cache->load('frontpage_showLatestVideos_' . $permission . '_' . $intRandom))) { $latestVideoHTML = $this->showLatestVideos($config->get('frontpagevideos')); $cache->save($latestVideoHTML, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } if (!($latestPhotosHTML = $cache->load('frontpage_showLatestPhotos_' . $intRandom))) { $latestPhotosHTML = $this->showLatestPhotos(); $cache->save($latestPhotosHTML, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS)); } $latestEventsHTML = $this->showLatestEvents($config->get('frontpage_events_limit')); $latestActivitiesHTML = $this->showLatestActivities(); $tmpl = new CTemplate(); $tmpl->set('totalMembers', $totalMembers); $tmpl->set('my', $my); $tmpl->set('alreadyLogin', $alreadyLogin); $tmpl->set('header', $headerHTML); $tmpl->set('onlineMembers', $this->getOnlineMembers()); $tmpl->set('userActivities', $latestActivitiesHTML); $tmpl->set('config', $config); $tmpl->set('latestMembers', $latestMembersHTML); $tmpl->set('latestGroups', $latestGroupsHTML); /** Compatibility fix **/ $tmpl->set('latestPhotos', $this->showLatestPhotos(true)); $tmpl->set('latestPhotosHTML', $latestPhotosHTML); $tmpl->set('latestVideos', $this->showLatestVideos($config->get('frontpagevideos'), true)); $tmpl->set('latestVideosHTML', $latestVideoHTML); $tmpl->set('latestEvents', $latestEventsHTML); $tmpl->set('customActivityHTML', $this->getCustomActivityHTML()); CFactory::load('helpers', 'string'); echo $tmpl->fetch('frontpage.index'); }