/**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (Phpfox::isPackage(array('1', '2'))) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'friend.view_friend')) {
         return false;
     }
     if (Phpfox::getUserId() == $aUser['user_id'] && !defined('PHPFOX_IN_DESIGN_MODE')) {
         return false;
     }
     if (Phpfox::getUserId() == $aUser['user_id']) {
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('friend.mutual_friends'), 'sDeleteBlock' => 'profile'));
         return 'block';
     }
     list($iTotal, $aRows) = Phpfox::getService('friend')->getMutualFriends($aUser['user_id']);
     if (!$iTotal) {
         return false;
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('friend.mutual_friends'), 'sDeleteBlock' => 'profile', 'aMutualFriends' => $aRows, 'iTotalMutualFriends' => $iTotal));
     if ($iTotal > 3) {
         $this->template()->assign(array('aFooter' => array(Phpfox::getPhrase('friend.view_all') => $this->url()->makeUrl($aUser['user_name'], array('friend', 'mutual')))));
     }
     return 'block';
 }
Example #2
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (Phpfox::isPackage(array('1', '2'))) {
         return Phpfox_Error::display('Not able to use this feature.');
     }
     $this->template()->setTitle(Phpfox::getPhrase('friend.friend_suggestions'))->setBreadcrumb(Phpfox::getPhrase('friend.my_friends'), $this->url()->makeUrl('friend'))->setBreadcrumb(Phpfox::getPhrase('friend.suggestions'), null, true)->assign(array('aSuggestions' => Phpfox::getService('friend.suggestion')->get()));
 }
Example #3
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     $iPageSize = 12;
     $iPage = $this->request()->getInt('page');
     $aUser = $this->getParam('aUser');
     $bMutual = $this->request()->get('req3') == 'mutual' ? true : false;
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'friend.view_friend')) {
         return Phpfox_Error::display('<div class="extra_info">' . Phpfox::getService('user')->getFirstName($aUser['full_name']) . ' has closed ' . Phpfox::getService('user')->gender($aUser['gender'], true) . ' friends section.</div>');
     }
     $aFilters = array('sort' => array('type' => 'select', 'options' => array(), 'default' => 'full_name', 'alias' => 'u'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'ASC'), 'search' => array('type' => 'input:text', 'search' => '(u.full_name LIKE \'%[VALUE]%\' OR u.email LIKE \'%[VALUE]%\') AND', 'size' => '15', 'onclick' => 'Search'));
     $oFilter = Phpfox::getLib('search')->set(array('type' => 'friend', 'filters' => $aFilters, 'search' => 'search'));
     if ($bMutual === true) {
         if (Phpfox::isPackage(array('1', '2'))) {
             return Phpfox_Error::display('Not able to use this feature.');
         }
         $oFilter->setCondition('friend.is_page = 0 AND friend.user_id = ' . Phpfox::getUserId());
         $this->template()->setBreadcrumb(Phpfox::getPhrase('friend.mutual_friends'), null, true);
     } else {
         $oFilter->setCondition('friend.is_page = 0 AND friend.user_id = ' . (int) $aUser['user_id']);
         if ($this->request()->get('view')) {
             $this->template()->setBreadcrumb(Phpfox::getPhrase('friend.friends_online'), null, true);
         }
     }
     if (($iListId = $this->request()->getInt('list')) && ($aList = Phpfox::getService('friend.list')->getList($iListId, Phpfox::getUserId())) && isset($aList['list_id'])) {
         $this->search()->setCondition('AND fld.list_id = ' . (int) $aList['list_id'] . ' AND friend.user_id = ' . $aUser['user_id']);
         $this->template()->setTitle($aList['name'])->setBreadcrumb($aList['name'], $this->url()->makeUrl('friend', array('view' => 'list', 'id' => $iListId)), true);
     }
     list($iCnt, $aFriends) = Phpfox::getService('friend')->get($oFilter->getConditions(), $oFilter->getSort(), $oFilter->getPage(), $iPageSize, true, true, $this->request()->get('view') ? true : false, $bMutual === true ? $aUser['user_id'] : null);
     $iCnt = $oFilter->getSearchTotal($iCnt);
     Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt));
     $this->setParam('aTotalFriends', $iCnt);
     $this->template()->setMeta('keywords', Phpfox::getPhrase('friend.full_name_s_friends', array('full_name' => $aUser['full_name'])));
     $this->template()->setMeta('keywords', Phpfox::getParam('friend.friend_meta_keywords'));
     $this->template()->setMeta('description', Phpfox::getPhrase('friend.full_name_is_on_site_title_and_has_total_friends', array('full_name' => $aUser['full_name'], 'site_title' => Phpfox::getParam('core.site_title'), 'total' => $iCnt)));
     if ($iCnt) {
         $sCustomFriends = '';
         foreach ($aFriends as $aFriend) {
             $sCustomFriends .= $aFriend['full_name'] . ', ';
         }
         $sCustomFriends = rtrim($sCustomFriends, ', ');
         $this->template()->setMeta('description', Phpfox::getPhrase('friend.full_name_is_connected_with_friends', array('full_name' => $aUser['full_name'], 'friends' => $sCustomFriends)));
     }
     $this->template()->setMeta('description', Phpfox::getPhrase('friend.sign_up_on_site_title_and_connect_with_full_name_message_full_name_or_add_full_name_as_you', array('site_title' => Phpfox::getParam('core.site_title'), 'full_name' => $aUser['full_name'])));
     $this->template()->setTitle(Phpfox::getPhrase('friend.full_name_s_friends', array('full_name' => $aUser['full_name'])))->setBreadcrumb(Phpfox::getPhrase('friend.friends'))->setHeader('cache', array('pager.css' => 'style_css', 'friend.css' => 'style_css'))->assign(array('aFriends' => $aFriends, 'sFriendView' => $this->request()->get('view')));
 }
Example #4
0
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{			
		if (Phpfox::isPackage(array('1', '2')))
		{
			return false;
		}		
		
		if (!Phpfox::getParam('friend.enable_friend_suggestion'))
		{
			return false;
		}
		
		if ($this->getParam('reload'))
		{
			Phpfox::getService('friend.suggestion')->reBuild();
		}
		
		$aSuggestion = Phpfox::getService('friend.suggestion')->getSingle();			

		if ($aSuggestion === false)
		{			
			if (PHPFOX_IS_AJAX)
			{
				echo '<div class="extra_info">' . Phpfox::getPhrase('friend.we_are_unable_to_find_any_friends_to_suggest_at_this_time_once_we_do_you_will_be_notified_within_our_dashboard') . '</div>';
				return;
			}			
						
			return false;
		}			
					
		$this->template()->assign(array(
				'sHeader' => Phpfox::getPhrase('friend.suggestions'),
				'sDeleteBlock' => 'dashboard',
				'aSuggestion' => $aSuggestion,
				'aFooter' => array(
					Phpfox::getPhrase('friend.view_all') => $this->url()->makeUrl('friend.suggestion')
				)
			)
		);	
		
		if (!PHPFOX_IS_AJAX)
		{
			return 'block';
		}
	}
Example #5
0
 /**
  * Cache all the active modules based on the package the client is using.
  *
  */
 public function _cacheModules()
 {
     $oCache = Phpfox::getLib('cache');
     $iCachedId = $oCache->set('module');
     if (!($this->_aModules = $oCache->get($iCachedId))) {
         $aModules = array();
         $aRows = Phpfox_Database::instance()->select('m.module_id')->from(Phpfox::getT('module'), 'm')->join(Phpfox::getT('product'), 'p', 'm.product_id = p.product_id AND p.is_active = 1')->where('m.is_active = 1')->order('m.module_id')->execute('getRows');
         foreach ($aRows as $aRow) {
             switch ($aRow['module_id']) {
                 case 'im':
                 case 'music':
                 case 'shoutbox':
                 case 'subscribe':
                 case 'video':
                 case 'forum':
                     if (Phpfox::isPackage(array('premium'))) {
                         Phpfox_Database::instance()->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'' . $aRow['module_id'] . '\'');
                         continue;
                     }
                     break;
             }
             $this->_aModules[$aRow['module_id']] = $aRow['module_id'];
         }
         $oCache->save($iCachedId, $this->_aModules);
     }
 }
Example #6
0
	public function get($bUninstalled = false)
	{		
		$aProductCache = array();
		$aProducts = $this->database()->select('product_id, title')
			->from(Phpfox::getT('product'))
			->execute('getRows');
		foreach ($aProducts as $aProduct)
		{
			$aProductCache[$aProduct['product_id']] = $aProduct['title'];
		}
		
		$aRows = $this->database()->select('m.*, p.title AS product_title, COUNT(s.setting_id) AS total_setting')
			->from($this->_sTable, 'm')
			->leftJoin(Phpfox::getT('product'), 'p', 'p.product_id = m.product_id')
			->leftJoin(Phpfox::getT('setting'), 's', 's.module_id = m.module_id')
			->order('m.module_id ASC')
			->group('m.module_id')
			->execute('getRows');
		
		$aModules = array();
		$aCache = array();
		foreach ($aRows as $aRow)
		{
			$aCache[$aRow['module_id']] = true;
			
			switch ($aRow['module_id'])
			{
				case 'ad':			
				case 'blog':
				case 'marketplace':
				case 'poll':
				case 'quiz':
				case 'attachment':
				case 'forum':					
					if (Phpfox::isPackage('1'))
					{					
						continue 2;
					}
					break;
				case 'im':
				case 'music':			
				case 'shoutbox':
				case 'subscribe':
				case 'video':							
					if (Phpfox::isPackage(array('1', '2')))
					{							
						continue 2;							
					}						
					break;					
			}			
				
			$aModules[($aRow['is_core'] ? 'core' : '3rdparty')][] = $aRow;			
		}		
		
		if ($bUninstalled === true)
		{
			$aNotInstalled = array();
			$hDir = opendir(PHPFOX_DIR_MODULE);
			while ($sModule = readdir($hDir))
			{
				if ($sModule == '.' || $sModule == '..')
				{
					continue;
				}
				
				if (!file_exists(PHPFOX_DIR_MODULE . $sModule . PHPFOX_DS . 'install' . PHPFOX_DS . 'phpfox.xml.php'))
				{
					continue;
				}				
				
				if (isset($aCache[$sModule]))
				{
					continue;
				}
				
				$aModuleDetails = Phpfox::getLib('xml.parser')->parse(file_get_contents(PHPFOX_DIR_MODULE . $sModule . PHPFOX_DS . 'install' . PHPFOX_DS . 'phpfox.xml.php'));				
				if (isset($aModuleDetails['data']))
				{
					$aModuleDetails['data']['is_not_installed'] = true;
					$aModuleDetails['data']['product_title'] = (isset($aProductCache[$aModuleDetails['data']['product_id']]) ? $aProductCache[$aModuleDetails['data']['product_id']] : $aModuleDetails['data']['product_id']);
					
					$aNotInstalled[] = $aModuleDetails['data'];
				}
			}
			closedir($hDir);
			
			if (count($aNotInstalled))
			{
				foreach ($aNotInstalled as $aModule)
				{
					$aModules['3rdparty'][] = $aModule;
				}
			}
		}		
					
		return $aModules;
	}	
Example #7
0
 /**
  * Get a setting and its value.
  *
  * @param mixed $mVar STRING name of the setting or ARRAY name of the setting.
  * @param string $sDef Default value in case the setting cannot be found.
  * @return nixed Returns the value of the setting, which can be a STRING, ARRAY, BOOL or INT.
  */
 public function getParam($mVar, $sDef = '')
 {
     if ($mVar == 'core.branding' && Phpfox::isPackage(array('premium', 'ultimate'))) {
         return true;
     }
     if ($mVar == 'im.enable_im_in_footer_bar' && Phpfox::isMobile()) {
         return false;
     }
     // http://www.phpfox.com/tracker/view/15079/
     /*if ($mVar == 'core.wysiwyg' && !defined('PHPFOX_INSTALLER') && Phpfox::isMobile())
     		{
     			return 'default';
     		}*/
     if ($mVar == 'core.phpfox_is_hosted') {
         return $this->getParam('core.is_auto_hosted');
     }
     if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
         /*
         if ($mVar == 'core.url_static_script')
         {
         	return Phpfox::getCdnPath() . 'static/jscript/';
         }
         */
         if ($mVar == 'core.setting_session_prefix') {
             return PHPFOX_IS_HOSTED_SCRIPT;
         } elseif ($mVar == 'video.allow_video_uploading') {
             return true;
         }
         /*
         elseif ($mVar == 'core.cache_js_css')
         {
         	return true;			
         }
         */
     }
     if (defined('PHPFOX_INSTALLER') && $mVar == 'core.cache_js_css') {
         return false;
     }
     if (is_array($mVar)) {
         $sParam = isset($this->_aParams[$mVar[0]][$mVar[1]]) ? $this->_aParams[$mVar[0]][$mVar[1]] : (isset($this->_aDefaults[$mVar[0]][$mVar[1]]) ? $this->_aDefaults[$mVar[0]][$mVar[1]] : Phpfox_Error::trigger('Missing Param: ' . $mVar[0] . '][' . $mVar[1]));
     } else {
         $sParam = isset($this->_aParams[$mVar]) ? $this->_aParams[$mVar] : (isset($this->_aDefaults[$mVar]) ? $this->_aDefaults[$mVar] : Phpfox_Error::trigger('Missing Param: ' . $mVar));
         if (!defined('PHPFOX_INSTALLER') && ($mVar == 'core.footer_bar_site_name' || $mVar == 'core.site_copyright')) {
             $sParam = Phpfox_Locale::instance()->convert($sParam);
         }
         if ($mVar == 'admincp.admin_cp') {
             $sParam = strtolower($sParam);
         }
         if ($mVar == 'user.points_conversion_rate') {
             $sParam = empty($sParam) ? array() : json_decode($sParam, true);
         }
     }
     if ($mVar == 'core.wysiwyg' && !defined('PHPFOX_INSTALLER') && $sParam == 'tiny_mce' && !Phpfox::isModule('tinymce')) {
         return 'default';
     }
     return $sParam;
 }
Example #8
0
 /**
  * Cache all the active modules based on the package the client is using.
  *
  */
 public function _cacheModules()
 {
     $oCache = Phpfox::getLib('cache');
     $iCachedId = $oCache->set('module');
     if (!($this->_aModules = $oCache->get($iCachedId))) {
         $aModules = array();
         $aRows = Phpfox::getLib('database')->select('m.module_id')->from(Phpfox::getT('module'), 'm')->join(Phpfox::getT('product'), 'p', 'm.product_id = p.product_id AND p.is_active = 1')->where('m.is_active = 1')->order('m.module_id')->execute('getRows');
         foreach ($aRows as $aRow) {
             if (Phpfox::getParam('core.is_auto_hosted')) {
                 switch ($aRow['module_id']) {
                     case 'im':
                     case 'music':
                     case 'shoutbox':
                     case 'rss':
                     case 'quiz':
                     case 'marketplace':
                     case 'blog':
                     case 'poll':
                         Phpfox::getLib('database')->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'' . $aRow['module_id'] . '\'');
                         continue 2;
                         break;
                 }
             }
             switch ($aRow['module_id']) {
                 case 'ad':
                 case 'blog':
                 case 'marketplace':
                 case 'poll':
                 case 'quiz':
                 case 'attachment':
                 case 'forum':
                     if (Phpfox::isPackage('1')) {
                         Phpfox::getLib('database')->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'' . $aRow['module_id'] . '\'');
                         continue;
                     }
                     break;
                 case 'im':
                 case 'music':
                 case 'shoutbox':
                 case 'subscribe':
                 case 'video':
                     if (Phpfox::isPackage(array('1', '2'))) {
                         Phpfox::getLib('database')->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'' . $aRow['module_id'] . '\'');
                         continue;
                     }
                     break;
             }
             $this->_aModules[$aRow['module_id']] = $aRow['module_id'];
         }
         $oCache->save($iCachedId, $this->_aModules);
     }
 }