当前位置: 首页>>代码示例>>PHP>>正文


PHP Friend_Service_Friend类代码示例

本文整理汇总了PHP中Friend_Service_Friend的典型用法代码示例。如果您正苦于以下问题:PHP Friend_Service_Friend类的具体用法?PHP Friend_Service_Friend怎么用?PHP Friend_Service_Friend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Friend_Service_Friend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get($iPage = 0, $iLimit = 5, $iRequestId = 0)
 {
     $aCond = array();
     ($sPlugin = Phpfox_Plugin::get('friend.service_request_request_get')) ? eval($sPlugin) : false;
     $aCond[] = 'fr.user_id = ' . Phpfox::getUserId() . ' AND fr.is_ignore = 0';
     if ($iRequestId > 0) {
         $aCond[] = 'AND fr.request_id = ' . (int) $iRequestId;
     }
     $iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable, 'fr')->where($aCond)->execute('getSlaveField');
     $aRows = $this->database()->select('fr.request_id, fr.is_seen, fr.message, fr.friend_user_id, fr.time_stamp, fr.relation_data_id , ' . Phpfox::getUserField())->from($this->_sTable, 'fr')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = fr.friend_user_id')->where($aCond)->limit($iPage, $iLimit, $iCnt)->order('fr.is_seen ASC, fr.time_stamp DESC')->group('fr.request_id')->execute('getSlaveRows');
     $sIds = '';
     foreach ($aRows as $iKey => $aRow) {
         $sIds .= $aRow['request_id'] . ',';
         list($iTotal, $aMutual) = Friend_Service_Friend::instance()->getMutualFriends($aRow['friend_user_id'], 5);
         $aRows[$iKey]['mutual_friends'] = array('total' => $iTotal, 'friends' => $aMutual);
         if ($sPlugin = Phpfox_Plugin::get('friend.service_request_get__2')) {
             eval($sPlugin);
         }
     }
     $sIds = rtrim($sIds, ',');
     if (!empty($sIds)) {
         $this->database()->update(Phpfox::getT('friend_request'), array('is_seen' => '1'), 'request_id IN(' . $sIds . ')');
     }
     if ($sPlugin = Phpfox_Plugin::get('friend.service_request_get__3')) {
         eval($sPlugin);
     }
     return array($iCnt, $aRows);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:28,代码来源:request.class.php

示例2: doPoke

 public function doPoke()
 {
     if (!Phpfox::getUserParam('poke.can_poke')) {
         return Phpfox_Error::display(Phpfox::getPhrase('poke.you_are_not_allowed_to_send_pokes'));
     }
     if (Phpfox::getUserParam('poke.can_only_poke_friends') && !Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $this->get('user_id'))) {
         return Phpfox_Error::display(Phpfox::getPhrase('poke.you_can_only_poke_your_own_friends'));
     }
     if (Phpfox::getService('poke.process')->sendPoke($this->get('user_id'))) {
         /* Type 1 is when poking back from the display block*/
         if ($this->get('type') == '1') {
             $this->call('$("#poke_' . $this->get('user_id') . '").hide().remove();');
         } else {
             $this->call('$("#liPoke").hide().remove();');
             $this->alert(Phpfox::getPhrase('poke.poke_sent'));
         }
     } else {
         $this->alert(Phpfox::getPhrase('poke.poke_could_not_be_sent'));
     }
     list($iTotalPokes, $aPokes) = Phpfox::getService('poke')->getPokesForUser(Phpfox::getUserId());
     if (!$iTotalPokes) {
         $this->call('$("#js_block_border_poke_display").remove();');
     } else {
         $this->call('$("#poke_' . $this->get('user_id') . '").hide().remove();');
     }
 }
开发者ID:Goudarzi-hahram,项目名称:phpfox,代码行数:26,代码来源:ajax.class.php

示例3: process

 /**
  * Controller
  */
 public function process()
 {
     ($sPlugin = Phpfox_Plugin::get('friend.component_block_mini_process')) ? eval($sPlugin) : false;
     if (isset($bHideThisBlock)) {
         return false;
     }
     if (Phpfox::getUserBy('profile_page_id')) {
         return false;
     }
     if (!Phpfox::isUser()) {
         return false;
     }
     $iTotal = 20;
     if (Phpfox::getParam('friend.load_friends_online_ajax') && !PHPFOX_IS_AJAX) {
         $aRows = array();
         $iCnt = 0;
     } else {
         list($iCnt, $aRows) = Friend_Service_Friend::instance()->get('friend.is_page = 0 AND friend.user_id = ' . Phpfox::getUserId(), 'ls.last_activity DESC', 0, $iTotal, true, false, true);
     }
     if (!$iCnt) {
         return false;
     }
     $this->template()->assign(array('sHeader' => '' . Phpfox::getPhrase('friend.friends_online') . ' (<span id="js_total_block_friends_onlin">' . $iCnt . '</span>)', 'aFriends' => $aRows, 'iTotalFriendsOnline' => $iCnt));
     return 'block';
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:28,代码来源:mini.class.php

示例4: process

 /**
  * Controller
  */
 public function process()
 {
     if (!defined('PHPFOX_IS_USER_PROFILE') && !Phpfox::isUser()) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     $iTotal = (int) Phpfox::getComponentSetting(defined('PHPFOX_IS_USER_PROFILE') ? $aUser['user_id'] : Phpfox::getUserId(), 'friend.friend_display_limit_profile', Phpfox::getParam('friend.friend_display_limit'));
     $aTopFriends = Friend_Service_Friend::instance()->getTop(defined('PHPFOX_IS_USER_PROFILE') ? $aUser['user_id'] : Phpfox::getUserId(), $iTotal);
     $iCount = count($aTopFriends);
     if (defined('PHPFOX_IS_USER_PROFILE') && !$iCount) {
         return false;
     }
     $this->template()->assign(array('aTopFriends' => $aTopFriends));
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $this->template()->assign(array('bMoveCursor' => false));
     } else {
         $this->template()->assign(array('bMoveCursor' => true));
     }
     if (!$this->getParam('bIsAjax')) {
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('friend.top_friends'), 'sBlockJsId' => 'top_friends'));
         $bCanEditSettings = false;
         if (defined('PHPFOX_IS_USER_PROFILE')) {
             if ($aUser['user_id'] == Phpfox::getUserId()) {
                 // $bCanEditSettings = true;
             }
             $bCanEditSettings = false;
         } else {
             $bCanEditSettings = true;
         }
         if ($bCanEditSettings) {
             $this->template()->assign(array('aEditBar' => array('ajax_call' => 'friend.getEditBar', 'params' => '&amp;type_id=profile&amp;no_delete_link=true&amp;is_edit_top=true')));
         }
         return 'block';
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:38,代码来源:top.class.php

示例5: process

 /**
  * Controller
  */
 public function process()
 {
     $aUser = PHPFOX_IS_AJAX ? Phpfox::getService('user')->get(Phpfox::getUserId(), true) : $this->getParam('aUser');
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'friend.view_friend')) {
         return false;
     }
     $iTotal = (int) Phpfox::getComponentSetting($aUser['user_id'], 'friend.friend_display_limit_profile', Phpfox::getParam('friend.friend_display_limit'));
     $aRows = Friend_Service_Friend::instance()->get('friend.is_page = 0 AND friend.user_id = ' . $aUser['user_id'], 'friend.is_top_friend DESC, friend.ordering ASC, RAND()', 0, $iTotal, false);
     $iCount = count($aRows);
     if (!$iCount) {
         return false;
     }
     $sFriendsLink = Phpfox::getService('user')->getLink($aUser['user_id'], $aUser['user_name'], 'friend');
     $this->template()->assign(array('sHeader' => '<a href="' . $this->url()->makeUrl($aUser['user_name'], 'friend') . '">' . Phpfox::getPhrase('friend.friends') . '<span>' . $aUser['total_friend'] . '</span></a>', 'aFriends' => $aRows, 'sFriendsLink' => $sFriendsLink, 'sBlockJsId' => 'profile_friend'));
     /*
     if (Phpfox::getUserParam('friend.can_remove_friends_from_profile') && $aUser['user_id'] == Phpfox::getUserId())
     {
     	$this->template()->assign(array(
     			'aEditBar' => array(
     				'ajax_call' => 'friend.getEditBar',
     				'params' => '&amp;type_id=profile'
     			)				
     		)
     	);
     	
     	$this->template()->assign('sDeleteBlock', 'profile');
     }
     */
     return 'block';
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:33,代码来源:small.class.php

示例6: getQueryJoins

 public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
 {
     if (Phpfox::isModule('friend') && Friend_Service_Friend::instance()->queryJoin($bNoQueryFriend)) {
         $this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = m.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
     }
     if ($this->_sCategory !== null) {
         $this->database()->innerJoin(Phpfox::getT('event_category_data'), 'mcd', 'mcd.event_id = m.event_id');
         if (!$bIsCount) {
             $this->database()->group('m.event_id');
         }
     }
     if ($this->_iAttending !== null) {
         $this->database()->innerJoin(Phpfox::getT('event_invite'), 'ei', 'ei.event_id = m.event_id AND ei.rsvp_id = ' . (int) $this->_iAttending . ' AND ei.invited_user_id = ' . Phpfox::getUserId());
         if (!$bIsCount) {
             $this->database()->select('ei.rsvp_id, ');
             $this->database()->group('m.event_id');
         }
     } else {
         if (Phpfox::isUser()) {
             $this->database()->leftJoin(Phpfox::getT('event_invite'), 'ei', 'ei.event_id = m.event_id AND ei.invited_user_id = ' . Phpfox::getUserId());
             if (!$bIsCount) {
                 $this->database()->select('ei.rsvp_id, ');
                 $this->database()->group('m.event_id');
             }
         }
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:27,代码来源:browse.class.php

示例7: process

 public function process()
 {
     Phpfox::isUser(true);
     // get the request for just one message
     $iId = (int) $this->request()->get('id');
     $aMessages = Friend_Service_Friend::instance()->getBirthdayMessages(Phpfox::getUserId(), $iId);
     $this->template()->assign(array('aMessages' => $aMessages))->setBreadcrumb(Phpfox::getPhrase('friend.my_friends'), $this->url()->makeUrl('friend'))->setBreadCrumb(Phpfox::getPhrase('friend.birthday_e_cards'), $this->url()->makeUrl('friend.mybirthday'), true)->setTitle(Phpfox::getPhrase('friend.birthday_e_cards'));
     Phpfox::isModule('notification') ? Phpfox::getService('notification.process')->delete('friend_birthday', $iId, Phpfox::getUserId()) : null;
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:9,代码来源:mybirthday.class.php

示例8: process

 public function process()
 {
     if (!Phpfox::getParam('friend.enable_birthday_notices')) {
         return false;
     }
     if (!Phpfox::isUser()) {
         return false;
     }
     $aBirthdays = Friend_Service_Friend::instance()->getBirthdays(Phpfox::getuserId());
     $bIsEventSection = true;
     /*
     $bIsEventSection = (Phpfox_Module::instance()->getFullControllerName() == 'event.index' ? true : false);
     if (!Phpfox::isModule('event'))
     {
     	$bIsEventSection = true;
     }
     */
     if ($bIsEventSection && empty($aBirthdays) && Phpfox::getParam('friend.show_empty_birthdays') == false) {
         return false;
     }
     $aUpcomingEvents = array();
     if (!$bIsEventSection) {
         if (Phpfox::isUser()) {
             $sEventCacheId = Phpfox::getLib('cache')->set(array('events', Phpfox::getUserId()));
             if (!($aUpcomingEvents = Phpfox::getLib('cache')->get($sEventCacheId, Phpfox::getParam('event.cache_upcoming_events_info') * 60))) {
                 $this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'sort' => array('latest' => array('m.start_time', 'Latest', 'ASC')), 'show' => array(5))));
                 $aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
                 $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
                 $this->search()->browse()->params($aBrowseParams)->execute();
                 $aUpcomingEvents = $this->search()->browse()->getRows();
                 // http://www.phpfox.com/tracker/view/14796/
                 // iterate among dates
                 foreach ($aUpcomingEvents as $sUpcomingDate => $aEvents) {
                     // iterate among events
                     foreach ($aEvents as $iKey => $aUpcomingEvent) {
                         // if the event is in a page
                         if (Phpfox::isModule('pages') && $aUpcomingEvent['module_id'] == 'pages') {
                             // if current user is not member or admin, remove the event from the upcoming block
                             if (!Phpfox::getService('pages')->isMember($aUpcomingEvent['profile_page_id']) && !Phpfox::getService('pages')->isAdmin($aUpcomingEvent['profile_page_id'])) {
                                 // if only one event in the date, erase the date
                                 if (count($aUpcomingEvents[$sUpcomingDate]) == 1) {
                                     unset($aUpcomingEvents[$sUpcomingDate]);
                                 } else {
                                     unset($aUpcomingEvents[$sUpcomingDate][$iKey]);
                                 }
                             }
                         }
                     }
                 }
                 Phpfox::getLib('cache')->save($sEventCacheId, $aUpcomingEvents);
             }
         }
     }
     $this->template()->assign(array('aSearchTool' => '', 'aUpcomingEvents' => is_bool($aUpcomingEvents) ? array() : $aUpcomingEvents, 'aBirthdays' => $aBirthdays, 'bIsEventSection' => $bIsEventSection, 'sHeader' => $bIsEventSection ? Phpfox::getPhrase('friend.birthdays') : Phpfox::getPhrase('event.upcoming_events')));
     return 'block';
 }
开发者ID:lev1976g,项目名称:core,代码行数:56,代码来源:birthday.class.php

示例9: process

 /**
  * Controller
  */
 public function process()
 {
     $iPage = $this->request()->getInt('page');
     $iPageSize = 5;
     $aCond = array();
     $aCond[] = 'AND friend.user_id = ' . Phpfox::getUserId();
     list($iCnt, $aFriends) = Friend_Service_Friend::instance()->get($aCond, 'friend.time_stamp DESC', $iPage, $iPageSize, true, false, false, $this->request()->getInt('user_id'));
     Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'ajax' => 'friend.getMutualFriends'));
     $this->template()->assign(array('aFriends' => $aFriends, 'iPage' => $iPage));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:13,代码来源:mutual-browse.class.php

示例10: process

 /**
  * Controller
  */
 public function process()
 {
     define('PHPFOX_PROFILE_PRIVACY', true);
     $aUser = $this->getParam('aUser');
     $bCanFrRequest = true;
     if (Phpfox::getService('user.block')->isBlocked($aUser['user_id'], Phpfox::getUserId()) && (Phpfox::isModule('friend') && Phpfox::getParam('friend.allow_blocked_user_to_friend_request') == false)) {
         $bCanFrRequest = false;
     }
     $this->template()->setTitle($aUser['full_name'])->assign(array('aUser' => $aUser, 'bIsFriend' => Phpfox::getUserId() && Phpfox::isModule('friend') ? Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aUser['user_id']) : false, 'bIsBlocked' => Phpfox::isUser() ? Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $aUser['user_id']) : false, 'bCanFrRequest' => $bCanFrRequest));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:13,代码来源:private.class.php

示例11: process

 /**
  * Controller
  */
 public function process()
 {
     $oUser = User_Service_User::instance();
     $aUser = $oUser->getByUserName($this->request()->get('user_name'));
     $bIsPage = $aUser['profile_page_id'] > 0 ? true : false;
     if ($bIsPage) {
         $aUser['page'] = Phpfox::getService('pages')->getPage($aUser['profile_page_id']);
         // list($iTotalMembers, $aMembers) = Phpfox::getService('pages')->getMembers($aUser['page']['page_id']);
         // $aUser['page_members'] = $aMembers;
     }
     $aUser['birthday_time_stamp'] = $aUser['birthday'];
     $aUser['birthday'] = $oUser->age($aUser['birthday']);
     $aUser['gender_name'] = $oUser->gender($aUser['gender']);
     $aUser['birthdate_display'] = $oUser->getProfileBirthDate($aUser);
     $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country');
     if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) {
         $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']);
     }
     $aUser['is_friend'] = false;
     $iTotal = 0;
     $aMutual = array();
     if ($aUser['user_id'] != Phpfox::getUserId() && !$bIsPage) {
         if (Phpfox::isUser() && Phpfox::isModule('friend')) {
             $aUser['is_friend'] = Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aUser['user_id']);
             if (!$aUser['is_friend']) {
                 $aUser['is_friend'] = Phpfox::getService('friend.request')->isRequested(Phpfox::getUserId(), $aUser['user_id']) ? 2 : false;
             }
         }
         list($iTotal, $aMutual) = Friend_Service_Friend::instance()->getMutualFriends($aUser['user_id'], 4);
     }
     $bShowBDayInput = false;
     if (!empty($aUser['birthday'])) {
         $iDays = Phpfox::getLib('date')->daysToDate($aUser['birthday'], null, false);
     } else {
         $iDays = 999;
     }
     if ($iDays < 1 && $iDays > 0) {
         $bShowBDayInput = true;
     }
     if (empty($aUser['dob_setting'])) {
         switch (Phpfox::getParam('user.default_privacy_brithdate')) {
             case 'month_day':
                 $aUser['dob_setting'] = '1';
                 break;
             case 'show_age':
                 $aUser['dob_setting'] = '2';
                 break;
             case 'hide':
                 $aUser['dob_setting'] = '3';
                 break;
         }
     }
     ($sPlugin = Phpfox_Plugin::get('user.component_block_tooltip_1')) ? eval($sPlugin) : false;
     $this->template()->assign(array('bIsPage' => $bIsPage, 'aUser' => $aUser, 'iMutualTotal' => $iTotal, 'aMutualFriends' => $aMutual, 'bShowBDay' => $bShowBDayInput));
 }
开发者ID:lev1976g,项目名称:core,代码行数:58,代码来源:tooltip.class.php

示例12: getQueryJoins

 public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
 {
     if (Phpfox::isModule('friend') && Friend_Service_Friend::instance()->queryJoin($bNoQueryFriend)) {
         $this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = pa.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
     }
     // http://www.phpfox.com/tracker/view/14733/
     if (Phpfox::isModule('like')) {
         $this->database()->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = "photo_album" AND l.item_id = pa.album_id AND l.user_id = ' . Phpfox::getUserId() . '');
     }
     // END
 }
开发者ID:lev1976g,项目名称:core,代码行数:11,代码来源:browse.class.php

示例13: process

 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     $aUser = Phpfox::getService('user')->getUser($this->request()->get('id'));
     if (empty($aUser)) {
         return Phpfox_Error::display(Phpfox::getPhrase('friend.not_a_valid_user_to_be_friends_with'));
     }
     if (Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aUser['user_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('friend.you_are_already_friends_with_this_user'));
     }
     $this->template()->setBreadcrumb(Phpfox::getPhrase('friend.friends_request'))->setTitle(Phpfox::getPhrase('friend.friends_request'))->assign(array('aUser' => $aUser));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:15,代码来源:request.class.php

示例14: add

 public function add($sType, $iItemId, $iUserId = null)
 {
     $bIsNotNull = false;
     if ($iUserId === null) {
         $iUserId = Phpfox::getUserId();
         $bIsNotNull = true;
     }
     if ($sType == 'pages') {
         $bIsNotNull = false;
     }
     // check if iUserId can Like this item
     $aFeed = $this->database()->select('privacy, user_id')->from(Phpfox::getT('feed'))->where('item_id = ' . (int) $iItemId . ' AND type_id = "' . Phpfox::getLib('parse.input')->clean($sType) . '"')->execute('getSlaveRow');
     /* if (($sType != 'pages') && $sType != 'event' && empty($aFeed))
     		{
     			return Phpfox_Error::display('Item does not exist.');
     		}
     		*/
     if (!empty($aFeed) && isset($aFeed['privacy']) && !empty($aFeed['privacy']) && !empty($aFeed['user_id']) && $aFeed['user_id'] != $iUserId) {
         if ($aFeed['privacy'] == 1 && Friend_Service_Friend::instance()->isFriend($iUserId, $aFeed['user_id']) != true) {
             return Phpfox_Error::display('Not allowed to like this item.');
         } else {
             if ($aFeed['privacy'] == 2 && Friend_Service_Friend::instance()->isFriendOfFriend($iUserId) != true) {
                 return Phpfox_Error::display('Not allowed to like this item.');
             } else {
                 if ($aFeed['privacy'] == 3 && $aFeed['user_id'] != Phpfox::getUserId()) {
                     return Phpfox_Error::display('Not allowed to like this item.');
                 } else {
                     if ($aFeed['privacy'] == 4 && ($bCheck = Privacy_Service_Privacy::instance()->check($sType, $iItemId, $aFeed['user_id'], $aFeed['privacy'], null, true)) != true) {
                         return Phpfox_Error::display('Not allowed to like this item.');
                     }
                 }
             }
         }
     }
     $iCheck = $this->database()->select('COUNT(*)')->from(Phpfox::getT('like'))->where('type_id = \'' . $this->database()->escape($sType) . '\' AND item_id = ' . (int) $iItemId . ' AND user_id = ' . $iUserId)->execute('getField');
     if ($iCheck) {
         return Phpfox_Error::set(Phpfox::getPhrase('feed.you_have_already_liked_this_feed'));
     }
     $iCnt = (int) $this->database()->select('COUNT(*)')->from(Phpfox::getT('like_cache'))->where('type_id = \'' . $this->database()->escape($sType) . '\' AND item_id = ' . (int) $iItemId . ' AND user_id = ' . (int) $iUserId)->execute('getSlaveField');
     $this->database()->insert($this->_sTable, array('type_id' => $sType, 'item_id' => (int) $iItemId, 'user_id' => $iUserId, 'time_stamp' => PHPFOX_TIME));
     $iCnt = 0;
     if (!$iCnt) {
         $this->database()->insert(Phpfox::getT('like_cache'), array('type_id' => $sType, 'item_id' => (int) $iItemId, 'user_id' => $iUserId));
     }
     Phpfox::getService('feed.process')->clearCache($sType, $iItemId);
     if ($sPlugin = Phpfox_Plugin::get('like.service_process_add__1')) {
         eval($sPlugin);
     }
     Phpfox::callback($sType . '.addLike', $iItemId, $iCnt ? true : false, $bIsNotNull ? null : $iUserId);
     return true;
 }
开发者ID:lev1976g,项目名称:core,代码行数:51,代码来源:process.class.php

示例15: process

 /**
  * Controller
  */
 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_Search::instance()->set(array('type' => 'friend', 'filters' => $aFilters, 'search' => 'search'));
     if ($bMutual === true) {
         $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) = Friend_Service_Friend::instance()->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_Pager::instance()->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'])));
     if (Phpfox::getUserId() == $aUser['user_id']) {
         // $this->template()->assign('lists', Friend_Service_List_List::instance()->get());
         $this->template()->menu('Manage Friends', $this->url()->makeUrl('friend'));
     }
     $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'), 'activeList' => $this->request()->get('list')));
 }
开发者ID:lev1976g,项目名称:core,代码行数:53,代码来源:profile.class.php


注:本文中的Friend_Service_Friend类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。