/** 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(); }
/** * Method is called during the status update triggers. **/ public function onProfileStatusUpdate($userid, $oldMessage, $newMessage) { $config = CFactory::getConfig(); $my = CFactory::getUser(); if ($config->get('fbconnectpoststatus')) { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); if ($facebook) { $fbuserid = $facebook->getUser(); $connectModel = CFactory::getModel('Connect'); $connectTable = JTable::getInstance('Connect', 'CTable'); $connectTable->load($fbuserid); // Make sure the FB session match the user session if ($connectTable->userid == $my->id) { /** * Check post status to facebook settings */ //echo "posting to facebook"; exit; $targetUser = CFactory::getUser($my->id); $userParams = $targetUser->getParams(); if ($userParams->get('postFacebookStatus')) { $result = $facebook->postStatus($newMessage); //print_r($result); exit; } } } } }
public function test() { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); $facebook->hasPermission('read_stream'); //$facebook->setStatus( 'hello world again from Jomsocial API' ); }
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; }
/** * Method is called during the status update triggers. **/ public function onProfileStatusUpdate($userid, $oldMessage, $newMessage) { $config = CFactory::getConfig(); if ($config->get('fbconnectpoststatus')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); if ($facebook) { $facebook->postStatus($newMessage); } } }
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; }
function isFacebookUser() { $my = CFactory::getUser(); // Script needs to be here if they are //CFactory::load( 'libraries' , 'facebook' ); //CFactory::load( 'models' , 'connect' ); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $connectTable = JTable::getInstance('Connect', 'CTable'); $facebook = new CFacebook(); $fbUser = $facebook->getUser(); if (!$fbUser) { return false; } $connectTable->load($fbUser['id']); $isFacebookUser = $connectTable->userid == $my->id ? true : false; return $isFacebookUser; }
public function update() { $config = CFactory::getConfig(); CFactory::load('libraries', 'facebook'); jimport('joomla.user.helper'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectModel = CFactory::getModel('Connect'); $connectTable =& JTable::getInstance('Connect', 'CTable'); $mainframe =& JFactory::getApplication(); $config = CFactory::getConfig(); $connectId = $facebook->getUserId(); $connectTable->load($connectId); CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fields = array('first_name', 'last_name', 'birthday', 'current_location', 'status', 'pic', 'sex', 'name', 'pic_square', 'profile_url', 'pic_big', 'current_location'); $user = $facebook->getUserInfo($fields); $tmpl = new CTemplate(); echo $tmpl->set('user', $user)->fetch('facebook.update'); }
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; }
public function ajaxImportData($importStatus, $importAvatar) { $response = new JAXResponse(); $filter = JFilterInput::getInstance(); $importStatus = $filter->clean($importStatus, 'boolean'); $importAvatar = $filter->clean($importAvatar, 'boolean'); $config = CFactory::getConfig(); // @rule: When administrator disables status imports, we should not allow user to import status if (!$config->get('fbconnectupdatestatus')) { $importStatus = false; } CFactory::load('libraries', 'facebook'); jimport('joomla.user.helper'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectModel = CFactory::getModel('Connect'); $connectTable =& JTable::getInstance('Connect', 'CTable'); $mainframe =& JFactory::getApplication(); $config = CFactory::getConfig(); $userId = $facebook->getUser(); $connectTable->load($userId); $fields = array('first_name', 'last_name', 'birthday_date', 'current_location', 'status', 'pic', 'sex', 'name', 'pic_square', 'profile_url', 'pic_big', 'current_location'); $userInfo = $facebook->getUserInfo($fields, $userId); $my = CFactory::getUser(); $redirect = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); if (COwnerHelper::isCommunityAdmin($connectTable->userid)) { $tmpl = new CTemplate(); $content = $tmpl->fetch('facebook.link.notallowed'); $actions = '<input type="button" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '" class="button" onclick="cWindowHide();" />'; $response->addScriptCall('cWindowAddContent', $content, $actions); return $response->sendResponse(); } if ($importAvatar) { $facebook->mapAvatar($userInfo['pic_big'], $my->id, $config->get('fbwatermark')); } if ($importStatus) { $facebook->mapStatus($my->id); } if (!JString::stristr($my->email, '@foo.bar')) { $response->addScriptCall('cWindowHide();'); $response->addScriptCall('window.location.href = "' . $redirect . '";'); return $response->sendResponse(); } // Deprecated since 1.6.x // In older releases, connected users uses the email @foo.bar by default. // If it passes the above, the user definitely needs to edit the e-mail. $tmpl = new CTemplate(); $tmpl->set('my', $my); $content = $tmpl->fetch('facebook.emailupdate'); $actions = '<form name="jsform-connect-ajaximportdata" method="post" action="' . $redirect . '" style="float:right;">'; $actions .= '<input type="submit" value="' . JText::_('COM_COMMUNITY_SKIP_BUTTON') . '" class="button" name="Submit"/>'; $actions .= '</form>'; $actions .= '<input type="button" value="' . JText::_('COM_COMMUNITY_UPDATE_EMAIL_BUTTON') . '" class="button" onclick="joms.connect.updateEmail();" />'; // Add invite button $response->addAssign('cwin_logo', 'innerHTML', $config->get('sitename')); $response->addScriptCall('cWindowAddContent', $content, $actions); $response->sendResponse(); }
function jomsocialtoolbar($template) { //Load Language file. $toolbarstyling = 'components/com_community/templates/'.$template.'/css/style.css'; $lang =& JFactory::getLanguage(); $lang->load( 'com_community' ); require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'); $my = CFactory::getUser(); // initiate toolbar $customToolbar =& CFactory::getToolbar(); // get Jomsocial configuration $config =& CFactory::getConfig(); // Include CAppPlugins library require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'apps.php'); $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); // Only trigger applications and set active URI when needed $args = array(); $appsLib->triggerEvent( 'onSystemStart' , $args ); // Set active URI CFactory::setCurrentURI(); // Include templates require_once (JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries'.DS.'template.php'); // Include templates require_once (JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries'.DS.'miniheader.php'); require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'tooltip.php'); require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'toolbar.php'); // Script needs to be here if they are CFactory::load( 'libraries' , 'facebook' ); CFactory::load( 'models' , 'connect' ); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectTable =& JTable::getInstance( 'Connect' , 'CTable' ); $fbUser = $facebook->getUser(); $connectTable->load( $fbUser ); $isFacebookUser = ( $connectTable->userid == $my->id ); $logoutLink = CRoute::_( 'index.php?option=com_community&view=frontpage' , false ); $logoutLink = base64_encode( $logoutLink ); $document = & JFactory::getDocument(); if($toolbarstyling !== ""){$document->addStyleSheet( JURI::base() . $toolbarstyling );} $document->addStyleSheet( JURI::base() . 'components/com_community/assets/autocomplete.css' ); $document->addStyleSheet( JURI::base() . 'components/com_community/assets/window.css' ); $document->addStyleSheet( JURI::base() . 'components/com_community/templates/default/css/style.green.css' ); //$document->addScript( JURI::base() . 'components/com_community/assets/jquery-1.3.2.pack.js' ); $document->addScript( JURI::base() . 'components/com_community/assets/joms.jquery.js' ); $document->addScript( JURI::base() . 'components/com_community/assets/joms.ajax.js' ); $document->addScript( JURI::base() . 'components/com_community/assets/window-1.0.pack.js' ); $document->addScript( JURI::base() . 'components/com_community/assets/script-1.2.pack.js' ); //$document->addScript( JURI::base() . 'components/com_community/assets/jquery.qtip-1.0.0-rc3.min.js' ); ?> <div id="community-wrap" style="display:inline"> <?php $db =& JFactory::getDBO(); $query = 'SELECT ' . $db->nameQuote( 'params' ) . ' FROM ' . $db->nameQuote( '#__community_config' ) . ' WHERE ' . $db->nameQuote( 'name' ) . ' = ' . $db->quote('config'); $db->setQuery( $query ); $row = $db->loadResult(); $params = new JParameter( $row ); $showToolbar = $params->get('showToolbar', '1'); $xml=simplexml_load_file(JPATH_SITE . '/administrator/components/com_community/community.xml'); $version=$xml->version; $version=str_replace('.','',$version); if($version >= 224) { CFactory::load( 'libraries' , 'toolbar' ); $toolbar_lib = CToolbarLibrary::getInstance(); echo $toolbar_lib->getHTML( ); } else { CFactory::load( 'libraries' , 'toolbar' ); echo CToolbarLibrary::getHTML( ); } $menus = CToolbarLibrary::getItems(); CToolbarLibrary::addLegacyToolbars( $menus ); //$showToolbar=1; //print_r($menus); if(file_exists(JPATH_SITE . '/components/com_community/templates/'.$template.'/toolbar.index.php')) { require_once (JPATH_ROOT .'/components/com_community/templates/'.$template.'/toolbar.index.php'); } else { require_once (JPATH_ROOT .'/components/com_community/templates/default/toolbar.index.php'); } ?> </div> <?php }
/** * 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'); }
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; }
/** * 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'); }
<?php $fb =& CFotobox::getInstance(); $fl =& CFlix::getInstance(); $facebook =& CFacebook::getInstance(); if (!isset($_GET['auth_token'])) { echo 'Please <a href="' . $facebook->login_url . '">login</a> at facebook.'; } else { if ($_FF_SESSION->value('facebook_session_key') == '') { $session = $facebook->getSession($_GET['auth_token']); $sessionArr = simplexml_load_string($session); $fSessionKey = (string) $sessionArr->session_key; $tmp = explode('-', $fSessionKey); $fUserId = $tmp[1]; $_FF_SESSION->register('facebook_session_key', $fSessionKey); $_FF_SESSION->register('facebook_uid', $fUserId); } else { $fUserId = $_FF_SESSION->value('facebook_uid'); $fSessionKey = $_FF_SESSION->value('facebook_session_key'); } if ($fUserId > 0) { $photos = $fb->fotosSearch(array('USER_ID' => $_USER_ID, 'ORDER' => 'P_TAKEN_BY_DAY', 'LIMIT' => '25')); $slideshows = $fl->search(array('USER_ID' => $_USER_ID, 'ORDER_BY' => 'modified', 'LIMIT' => '5')); $friends = $facebook->getFriends($fUserId, $fSessionKey); $friendsArr = simplexml_load_string($friends); echo '<div style="float:left; width:600px;"> Slideshows<br/> <div id="slideshows">'; foreach ($slideshows as $v) { echo $v['US_NAME'] . '<br/>'; }
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die('Restricted access'); require_once JPATH_ROOT . '/components/com_community/libraries/core.php'; require_once JPATH_ROOT . '/components/com_community/libraries/window.php'; CWindow::load(); // Script needs to be here if they are //CFactory::load( 'libraries' , 'facebook' ); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(false); $my = CFactory::getUser(); $config = CFactory::getConfig(); $fbUser = $facebook->getUser(); require JModuleHelper::getLayoutPath('mod_jomsocialconnect', $params->get('layout', 'default'));
function showToolbar($data = null) { $mySQLVer = 0; if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php'; require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php'; $format = JRequest::getVar('format', 'html', 'get'); if ($format == 'json') { return; } $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', ''); $user = CFactory::getUser($userid); // Get the configuration object. $config = CFactory::getConfig(); //JHTML::_('behavior.tooltip'); $js = 'assets/window-1.0'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = 'assets/script-1.2'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = '<script type=\'text/javascript\'>'; $js .= '/*<![CDATA[*/'; $js .= 'var js_viewerId = ' . $my->id . '; '; $js .= 'var js_profileId = ' . $user->id . ';'; $js .= '/*]]>*/'; $js .= '</script>'; $mainframe->addCustomHeadTag($js); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } // FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded // if(JRequest::getVar('screen')=='mobile') // { // $document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' ); // } // This need to be loaded in main messaging library CFactory::load('libraries', 'window'); CWindow::load(); $template = new CTemplateHelper(); $styleIE7 = $template->getTemplateAsset('styleIE7', 'css'); $styleIE6 = $template->getTemplateAsset('styleIE6', 'css'); $css = '<!-- Jom Social --> <!--[if IE 7.0]> <link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" /> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" /> <![endif]-->'; $mainframe->addCustomHeadTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); $task = JRequest::getVar('task', '', 'GET'); $groupId = JRequest::getInt('groupid', '', 'GET'); // Hide the toolbar from unregistered user // but still show the mini header if (empty($my->id)) { if (!empty($groupId) && $task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); echo CMiniHeader::showGroupMiniHeader($groupId); return; } echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser); return; } /** * Inbox unread count */ $inboxUnread = 0; if (!empty($data['inbox'])) { $inboxUnread = $data['inbox']; } /** * Notification alert */ $notiAlert = 0; $notiAlert = $this->_newNotification(); if (!empty($notiAlert) && $notiAlert > 0) { CFactory::load('libraries', 'window'); CWindow::load(); } $config = CFactory::getConfig(); $logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false); $logoutLink = base64_encode($logoutLink); $isFacebookUser = false; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); CFactory::load('models', 'connect'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectTable =& JTable::getInstance('Connect', 'CTable'); $fbUser = $facebook->getUser(); $connectTable->load($fbUser); $isFacebookUser = $connectTable->userid == $my->id; } $groupMiniHeader = ''; // Show miniheader if ($task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); } $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id)); $tmpl->set('config', $config); $tmpl->set('inboxUnread', $inboxUnread); $tmpl->set('notiAlert', $notiAlert); $tmpl->set('miniheader', CMiniHeader::showMiniHeader($this->_showMiniHeaderUser)); $tmpl->set('groupMiniHeader', $groupMiniHeader); $tmpl->set('showAdvanceSearch', $mySQLVer > 4.1 ? 1 : 0); $tmpl->set('logoutLink', $logoutLink); $tmpl->set('isFacebookUser', $isFacebookUser); $toolbar = CFactory::getToolbar(); $tmpl->set('customToolbar', $toolbar); echo $tmpl->fetch('toolbar.index'); }
?> #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>
/** * 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() { $my = CFactory::getUser(); $config = CFactory::getConfig(); if ($my->id == 0) { $config = CFactory::getConfig(); $uri = CRoute::getURI(false); $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(FACEBOOK_LOGIN_NOT_REQUIRED); $fbHtml = $facebook->getButtonHTML(); } $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('config', $config); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
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'); }
public function ajaxImportData($importStatus, $importAvatar) { $response = new JAXResponse(); $importStatus = (bool) $importStatus; $importAvatar = (bool) $importAvatar; $config = CFactory::getConfig(); // @rule: When administrator disables status imports, we should not allow user to import status if (!$config->get('fbconnectupdatestatus')) { $importStatus = false; } CFactory::load('libraries', 'facebook'); jimport('joomla.user.helper'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectModel = CFactory::getModel('Connect'); $connectTable =& JTable::getInstance('Connect', 'CTable'); $mainframe =& JFactory::getApplication(); $config = CFactory::getConfig(); $userId = $facebook->getUser(); $connectTable->load($userId); $fields = array('first_name', 'last_name', 'birthday', 'current_location', 'status', 'pic', 'sex', 'name', 'pic_square', 'profile_url', 'pic_big', 'current_location'); $userInfo = $facebook->getUserInfo($fields, $userId); //@todo: configurable redirect for continue button $my = CFactory::getUser(); $redirect = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id, false); if (COwnerHelper::isCommunityAdmin($connectTable->userid)) { $tmpl = new CTemplate(); $content = $tmpl->fetch('facebook.link.notallowed'); $buttons = '<input type="button" value="' . JText::_('CC BUTTON CLOSE') . '" class="button" onclick="cWindowHide();" />'; $response->addScriptCall('cWindowActions', $buttons); $response->addAssign('cWindowContent', 'innerHTML', $content); $response->addScriptCall('cWindowResize', 150); return $response->sendResponse(); } if ($importAvatar) { $facebook->mapAvatar($userInfo['pic_big'], $my->id, $config->get('fbwatermark')); } if ($importStatus) { $facebook->mapStatus($my->id); } if (!JString::stristr($my->email, '@foo.bar')) { /** HTGMOD **/ // Start Hooked Modfication $device = JFactory::getSession()->get('device', ''); if ($device == 'ios') { JFactory::getSession()->set('device', ''); $db = JFactory::getDBO(); $query = "SELECT hash FROM #__api_keys WHERE user_id = " . $db->Quote($my->id); $db->setQuery($query); $apikey = $db->loadResult(); if (!$apikey) { jimport('joomla.application.component.model'); JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables'); JModel::addIncludePath(JPATH_SITE . '/components/com_api/models'); JLoader::register('ApiModel', JPATH_SITE . '/components/com_api/libraries/model.php'); $model = JModel::getInstance('Key', 'ApiModel'); $data = array('user_id' => $my->id, 'domain' => 'localhost', 'published' => 1); $key = $model->save($data); $apikey = $key->hash; } $redirect = 'hooked://' . $apikey; } // End Hooked modification /** END HTGMOD **/ $response->addScriptCall('cWindowHide();'); $response->addScriptCall('window.location.href = "' . $redirect . '";'); return $response->sendResponse(); } // Deprecated since 1.6.x // In older releases, connected users uses the email @foo.bar by default. // If it passes the above, the user definitely needs to edit the e-mail. $tmpl = new CTemplate(); $tmpl->set('my', $my); $content = $tmpl->fetch('facebook.emailupdate'); $buttons = '<form name="jsform-connect-ajaximportdata" method="post" action="' . $redirect . '" style="float:right;">'; $buttons .= '<input type="submit" value="' . JText::_('CC SKIP BUTTON') . '" class="button" name="Submit"/>'; $buttons .= '</form>'; $buttons .= '<input type="button" value="' . JText::_('CC UPDATE EMAIL BUTTON') . '" class="button" onclick="joms.connect.updateEmail();" />'; // Add invite button $response->addScriptCall('cWindowResize', 150); $response->addAssign('cWindowContent', 'innerHTML', $content); $response->addScriptCall('joms.jQuery("#cwin_logo").html("' . $config->get('sitename') . '");'); $response->addScriptCall('cWindowActions', $buttons); $response->sendResponse(); }
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'); }