/** * 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; } } } } }
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; }
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'); }
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 }
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(); }
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(); }
<?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'));