Exemple #1
0
 // Trigger system start
 if (function_exists('xdebug_memory_usage')) {
     $mem = xdebug_memory_usage();
     $tm = xdebug_time_index();
     $db = JFactory::getDBO();
     $db->debug(1);
 }
 require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'apps.php';
 $appsLib =& CAppPlugins::getInstance();
 $appsLib->loadApplications();
 // Only trigger applications and set active URI when needed
 if ($tmpl != 'component') {
     $args = array();
     $appsLib->triggerEvent('onSystemStart', $args);
     // Set active URI
     CFactory::setCurrentURI();
 }
 // Normal call
 // Component configuration
 $config = array('name' => JString::strtolower(JRequest::getCmd('view', 'frontpage')));
 // Create the controller
 $viewController = JString::strtolower($config['name']);
 if (JFile::exists(JPATH_COMPONENT . DS . 'controllers' . DS . $viewController . '.php')) {
     // If the controller is one of our controller, include the file
     // If not, it could be other 3rd party controller. Do not throw error message yet
     require_once JPATH_COMPONENT . DS . 'controllers' . DS . $viewController . '.php';
 }
 $viewController = JString::ucfirst($viewController);
 $viewController = 'Community' . $viewController . 'Controller';
 // Trigger onBeforeControllerCreate (pass controller name by reference to allow override)
 $args = array();
	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 }