本文整理汇总了PHP中Phpfox::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::getUserId方法的具体用法?PHP Phpfox::getUserId怎么用?PHP Phpfox::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::getUserId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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' => '&type_id=profile&no_delete_link=true&is_edit_top=true')));
}
return 'block';
}
}
示例2: process
public function process()
{
$aUser = $this->getParam('aUser');
if (empty($aUser))
{
$aUser = $this->request()->get('iUser');
}
//$iUser = (PHPFOX_IS_AJAX ? $this->request()->get('iUser') : $this->getParam('iUser'));
$this->template()->assign(array(
'iUser' => $aUser['user_id']
)
);
if (!PHPFOX_IS_AJAX)
{
if (Phpfox::getService('friend')->isBirthdaySent(Phpfox::getUserId(), $aUser['user_id']))
{
return false;
}
$this->template()->assign(array(
'sHeader' => 'Birthday Notification'
)
);
return 'block';
}
}
示例3: sendEmail
public function sendEmail($sType)
{
$this->database()->update($this->_sTable, array(
'send_email' => (int) $sType
), 'user_id = ' . Phpfox::getUserId()
);
if ((int) $sType === 2)
{
$aUserInfo = Phpfox::getService('facebook.api')->getUserInfo();
if (Phpfox::getService('facebook')->checkEmail($aUserInfo['email']) !== false)
{
return false;
}
$this->database()->update(Phpfox::getT('user'), array(
'email' => $aUserInfo['email']
), 'user_id = ' . Phpfox::getUserId()
);
if ($aUserInfo['email'] == $aUserInfo['proxied_email'])
{
$this->database()->update($this->_sTable, array(
'is_proxy_email' => '1'
), 'user_id = ' . Phpfox::getUserId()
);
}
}
return true;
}
示例4: getRandomLink
protected function getRandomLink($sType)
{
$sField = $sType . '_id';
$sTable = Phpfox::getT($sType);
$sLink = $sType;
switch ($sType) {
case 'pages':
$sField = 'page_id';
break;
case 'music_song':
$sField = 'song_id';
$sLink = 'music';
break;
case 'mail':
$this->database()->where('owner_user_id = ' . Phpfox::getUserId() . ' OR ' . 'viewer_user_id = ' . Phpfox::getUserId());
$sLink = 'mail.view';
break;
case 'forum_thread':
$sField = 'thread_id';
$sLink = 'forum.thread';
break;
}
$id = $this->database()->select($sField)->from($sTable)->order('RAND()')->execute('getField');
if (!$id) {
return false;
}
$sUrl = Phpfox::getLib('url')->makeUrl($sLink, array($id));
return $sUrl;
}
示例5: get
public function get()
{
/*
@title
@info Get all the messages of the user that is logged in.
@method GET
@extra
@return id=#{Message ID#|int}&subject=#{Subject|string}&preview=#{Preview of the message|string}&from=#{From|string}&from_url=#{Profile link of the person who sent the message|string}&permalink=#{Link to the message|string}&new=#{Check to see if the message is read or not. <b>True</b> is a new message|bool}
*/
$iUserId = Phpfox::getUserId();
$aCond = array();
if (Phpfox::getParam('mail.threaded_mail_conversation')) {
$aCond[] = 'AND m.viewer_user_id = ' . $iUserId . ' AND m.is_archive = 0';
} else {
$aCond[] = 'AND m.viewer_folder_id = 0 AND m.viewer_user_id = ' . $iUserId . ' AND m.viewer_type_id = 0';
}
$aMessages = array();
list($iTotal, $aMessageRows, $aTotals) = Phpfox::getService('mail')->get($aCond);
foreach ($aMessageRows as $iKey => $aMessageRow) {
$aMessages[$iKey] = array('id' => Phpfox::getParam('mail.threaded_mail_conversation') ? $aMessageRow['thread_id'] : $aMessageRow['mail_id'], 'subject' => Phpfox::getParam('mail.threaded_mail_conversation') ? '' : $aMessageRow['subject'], 'preview' => $aMessageRow['preview'], 'from' => $aMessageRow['full_name'], 'from_url' => Phpfox::getLib('url')->makeUrl($aMessageRow['user_name']), 'permalink' => Phpfox::getParam('mail.threaded_mail_conversation') ? Phpfox::getLib('url')->makeUrl('mail.thread', array('id' => $aMessageRow['thread_id'])) : Phpfox::getLib('url')->makeUrl('mail.view.' . $aMessageRow['mail_id']), 'new' => $aMessageRow['viewer_is_new'] ? true : false);
if (Phpfox::getParam('mail.threaded_mail_conversation')) {
unset($aMessages[$iKey]['subject']);
}
}
return $aMessages;
}
示例6: getNotificationAction
/** This function catches all the "actions" (Dislike, and in the future maybe others)
* */
public function getNotificationAction($aNotification)
{
//d($aNotification);die();
// get the type of item that was marked ("blog", "photo"...)
$aAction = $this->database()->select('*')->from(Phpfox::getT('action'))->where('action_id = ' . (int) $aNotification['item_id'])->limit(1)->execute('getSlaveRow');
if (empty($aAction) || !isset($aAction['item_type_id'])) {
return false;
throw new Exception('No type for this action (' . print_r($aAction, true) . ')');
}
// Check if the module is a sub module
if (preg_match('/(?P<module>[a-z]+)[_]?(?P<submodule>[a-z]{0,99})/i', $aAction['item_type_id'], $aMatch) < 1) {
throw new Exception('Malformed item_type');
}
// Call the module and get the title
if (!Phpfox::isModule($aMatch['module'])) {
return false;
}
$aRow = Phpfox::getService($aMatch['module'])->getInfoForAction($aAction);
$sUsers = Phpfox::getService('notification')->getUsers($aNotification);
$sTitle = Phpfox::getLib('parse.output')->shorten($aRow['title'], Phpfox::getParam('notification.total_notification_title_length'), '...');
$sPhrase = '';
if ($aNotification['user_id'] == $aRow['user_id']) {
// {users} disliked {gender} own {item} "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_gender_own_item_title', array('users' => $sUsers, 'gender' => Phpfox::getService('user')->gender($aRow['gender'], 1), 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} elseif ($aRow['user_id'] == Phpfox::getUserId()) {
// {users} liked your blog "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_your_item_title', array('users' => $sUsers, 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} else {
$sPhrase = Phpfox::getPhrase('like.users_disliked_users_item', array('users' => $sUsers, 'row_full_name' => $aRow['full_name'], 'title' => $sTitle, 'item' => $aAction['item_type_id']));
}
return array('link' => $aRow['link'], 'message' => $sPhrase, 'icon' => Phpfox_Template::instance()->getStyle('image', 'activity.png', 'blog'));
}
示例7: process
/**
* Controller
*/
public function process()
{
$this->url()->send('music');
Phpfox::isUser(true);
if (Phpfox::getParam('music.music_user_group_id') == Phpfox::getUserBy('user_group_id')) {
$this->url()->send('music');
}
$aUser = array('full_name' => Phpfox::getUserBy('full_name'));
$aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), Phpfox::getUserId(), Phpfox::getParam('music.music_user_group_id'));
$aParams = array('full_name' => Phpfox::getPhrase('music.provide_a_artist_band_name'), 'agree' => Phpfox::getPhrase('music.tick_the_box_to_agree_to_our_terms_and_privacy_policy'));
foreach ($aSettings as $sKey => $aSetting) {
if ($aSetting['is_required']) {
$aParams['custom_field_' . $aSetting['field_id']] = array('title' => Phpfox::getPhrase('music.provide_a_value_for') . ': ' . Phpfox::getPhrase($aSetting['phrase_var_name']), 'def' => 'required', 'php_id' => 'custom[' . $aSetting['field_id'] . ']');
}
}
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aParams));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if (Music_Service_Process::instance()->convertMember($aVals, $this->request()->getArray('custom'))) {
$this->url()->send('music', null, Phpfox::getPhrase('music.you_have_successfully_converted_your_account'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('music.musician_registration'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $this->url()->makeUrl('music'))->setBreadcrumb(Phpfox::getPhrase('music.registration'), null, true)->setFullSite()->assign(array('aForms' => $aUser, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aSettings' => $aSettings));
}
示例8: check
public function check()
{
if (!Phpfox::getParam('user.check_promotion_system')) {
return false;
}
if (!Phpfox::isUser()) {
return false;
}
$sCacheId = $this->cache()->set('promotion_' . Phpfox::getUserBy('user_group_id'));
$aPromotion = array();
if (!($aPromotion = $this->cache()->get($sCacheId))) {
$aPromotion = $this->database()->select('*')->from($this->_sTable)->where('user_group_id = ' . Phpfox::getUserBy('user_group_id'))->execute('getSlaveRow');
$this->cache()->save($sCacheId, $aPromotion);
}
if (isset($aPromotion['promotion_id'])) {
if ((int) Phpfox::getUserBy('activity_points') >= (int) $aPromotion['total_activity'] && (int) $aPromotion['total_activity']) {
$this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
Phpfox_Url::instance()->send('user.promotion');
} else {
if ((int) $aPromotion['total_day'] > 0) {
if (str_replace('-', '', Phpfox::getUserBy('joined') - PHPFOX_TIME) >= $aPromotion['total_day'] * 86400) {
$this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
Phpfox_Url::instance()->send('user.promotion');
}
}
}
}
}
示例9: render
public function render($name, array $params = array())
{
$params['ActiveUser'] = (new \Api\User())->get(\Phpfox::getUserId());
$params['isPager'] = isset($_GET['page']) ? true : false;
$params['Is'] = new \Core\Is();
return $this->loadTemplate($name)->render($params);
}
示例10: get
public function get($iUserId = null)
{
if ($iUserId === null) {
$iUserId = Phpfox::getUserId();
}
return $this->database()->select('ub.block_user_id, ' . Phpfox::getUserField())->from($this->_sTable, 'ub')->join(Phpfox::getT('user'), 'u', 'u.user_id = ub.block_user_id')->where('ub.user_id = ' . (int) $iUserId)->execute('getSlaveRows');
}
示例11: update
public function update($sTable, $iId, $iUserId = null)
{
$this->database()->update(Phpfox::getT($sTable), array(
'time_stamp' => PHPFOX_TIME
), 'item_id = ' . (int) $iId . ' AND user_id = ' . Phpfox::getUserId()
);
}
示例12: 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' => '&type_id=profile'
)
)
);
$this->template()->assign('sDeleteBlock', 'profile');
}
*/
return 'block';
}
示例13: process
/**
* Controller
*/
public function process()
{
Phpfox::isUser(true);
// http://www.phpfox.com/tracker/view/15093/
$bIsThickBox = $this->getParam('bIsThickBox');
$this->template()->assign(array('bIsThickBox' => $bIsThickBox));
if ($this->request()->getInt('purchase_id')) {
if (!($aPackage = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('purchase_id'), true))) {
return Phpfox_Error::set(Phpfox::getPhrase('subscribe.unable_to_find_the_purchase_you_are_looking_for'));
}
$iPurchaseId = $aPackage['purchase_id'];
} else {
if (!($aPackage = Phpfox::getService('subscribe')->getPackage($this->request()->getInt('id')))) {
return Phpfox_Error::set(Phpfox::getPhrase('subscribe.unable_to_find_the_package_you_are_looking_for'));
}
if (Phpfox::getUserBy('user_group_id') == $aPackage['user_group_id']) {
return Phpfox_Error::set(Phpfox::getPhrase('subscribe.attempting_to_upgrade_to_the_same_user_group_you_are_already_in'));
}
$aPackage['default_currency_id'] = isset($aPackage['default_currency_id']) ? $aPackage['default_currency_id'] : $aPackage['price'][0]['alternative_currency_id'];
$aPackage['default_cost'] = isset($aPackage['default_cost']) ? $aPackage['default_cost'] : $aPackage['price'][0]['alternative_cost'];
$iPurchaseId = Phpfox::getService('subscribe.purchase.process')->add(array('package_id' => $aPackage['package_id'], 'currency_id' => $aPackage['default_currency_id'], 'price' => $aPackage['default_cost']));
/* Make sure we mark it as free only if the default cost is free and its not a recurring charge */
if ($aPackage['default_cost'] == '0.00' && $aPackage['recurring_period'] == 0) {
$this->template()->assign('bIsFree', true);
$this->template()->assign('iPurchaseId', $iPurchaseId);
Phpfox::getService('subscribe.purchase.process')->update($iPurchaseId, $aPackage['package_id'], 'completed', Phpfox::getUserId(), $aPackage['user_group_id'], $aPackage['fail_user_group']);
return;
}
}
/* Load the gateway only if its not free */
if (($aPackage['default_cost'] != '0.00' || $aPackage['recurring_period'] != 0) && $iPurchaseId) {
$this->setParam('gateway_data', array('item_number' => 'subscribe|' . $iPurchaseId, 'currency_code' => $aPackage['default_currency_id'], 'amount' => $aPackage['default_cost'], 'item_name' => $aPackage['title'], 'return' => $this->url()->makeUrl('subscribe.complete'), 'recurring' => $aPackage['recurring_period'], 'recurring_cost' => isset($aPackage['default_recurring_cost']) ? $aPackage['default_recurring_cost'] : '', 'alternative_cost' => isset($aPackage['price'][0]) ? serialize($aPackage['price']) : '', 'alternative_recurring_cost' => isset($aPackage['recurring_price'][0]) ? serialize($aPackage['recurring_price']) : ''));
}
}
示例14: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$aCond = array();
$iPage = $this->request()->getInt('page');
$iPageSize = 10;
$bIsSentbox = $this->request()->get('req2') == 'sent' ? true : false;
$bIsSearch = false;
if ($bIsSentbox) {
$aCond[] = 'm.owner_user_id = ' . Phpfox::getUserId() . ' AND m.owner_type_id = 0';
} else {
$aCond[] = 'm.viewer_folder_id = 0 AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 0';
}
if (($sSearch = $this->request()->get('search')) || $this->request()->get('search-query')) {
if ($this->request()->get('search-query')) {
$sSearch = Phpfox::getLib('session')->get('mfsearch');
}
$bIsSearch = true;
$aCond[] = "AND (m.subject LIKE '%" . Phpfox::getLib('database')->escape($sSearch) . "%' OR m.preview LIKE '%" . Phpfox::getLib('database')->escape($sSearch) . "%')";
$this->url()->setParam('search-query', 'true');
Phpfox::getLib('session')->set('mfsearch', $sSearch);
}
if ($bIsSearch == false) {
Phpfox::getLib('session')->remove('mfsearch');
}
list($iCnt, $aMessages, $aInputs) = Phpfox::getService('mail')->get($aCond, 'm.time_updated DESC', $iPage, $iPageSize, $bIsSentbox);
Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt));
$this->template()->assign(array('bMobileInboxIsActive' => true, 'aMessages' => $aMessages, 'bIsSearch' => $bIsSearch, 'bIsSentbox' => $bIsSentbox, 'aMobileSubMenus' => array($this->url()->makeUrl('mail') => Phpfox::getPhrase('mail.mobile_messages'), $this->url()->makeUrl('mail', 'sent') => Phpfox::getPhrase('mail.sent'), $this->url()->makeUrl('mail', 'compose') => Phpfox::getPhrase('mail.compose')), 'sActiveMobileSubMenu' => $this->url()->makeUrl('mail', $this->request()->get('req2') == '' ? null : $this->request()->get('req2'))));
}
示例15: getQueryJoins
public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
{
if (Phpfox::isModule('friend') && Phpfox::getService('friend')->queryJoin($bNoQueryFriend))
{
$this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = q.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
}
}