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


PHP FD::user方法代码示例

本文整理汇总了PHP中FD::user方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::user方法的具体用法?PHP FD::user怎么用?PHP FD::user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FD的用法示例。


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

示例1: insertMember

 /**
  * Method to add a member into an existing profile type.
  *
  * @param   null    All parameters are from HTTP $_POST
  * @return  JSON    JSON encoded string.
  */
 public function insertMember()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Get the id from request.
     $id = JRequest::getInt('id');
     // Get the profile id.
     $profile_id = JRequest::getInt('profile_id');
     // Get the current view.
     $view = $this->getCurrentView();
     if (!$id) {
         $view->setMessage(JText::_('Please enter a valid user id.'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // @TODO: Try to remove user from any other existing profile maps.
     $model = FD::model('Profiles');
     $model->removeUserFromProfiles($id);
     $table = FD::table('ProfileMap');
     $table->user_id = $id;
     $table->profile_id = $profile_id;
     $table->state = SOCIAL_STATE_PUBLISHED;
     // @rule: Store user profile bindings
     $table->store();
     $user = FD::user($id);
     return $view->call(__FUNCTION__, $user);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:32,代码来源:profiles.php

示例2: isValid

 /**
  * Validates the username.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	JSON	A jsong encoded string.
  *
  * @author	Jason Rey <jasonrey@stackideas.com>
  */
 public function isValid()
 {
     // Render the ajax lib.
     $ajax = FD::getInstance('Ajax');
     // Get the userid
     $userid = JRequest::getInt('userid', 0);
     // Get the event
     $event = JRequest::getString('event');
     // Set the current username
     $current = '';
     if (!empty($userid)) {
         $user = FD::user($userid);
         $current = $user->username;
     }
     // Get the provided username that the user has typed.
     $username = JRequest::getVar('username', '');
     // Username is required, check if username is empty
     if (JString::strlen($username) < $this->params->get('min')) {
         return $ajax->reject(JText::sprintf('PLG_FIELDS_JOOMLA_USERNAME_MIN_CHARACTERS', $this->params->get('min')));
     }
     // Test if username is allowed (by pass for adminedit).
     if ($event !== 'onAdminEdit' && !SocialFieldsUserJoomlaUsernameHelper::allowed($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_ALLOWED'));
     }
     // Test if username exists.
     if (SocialFieldsUserJoomlaUsernameHelper::exists($username, $current)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_AVAILABLE'));
     }
     // Test if the username is valid
     if (!SocialFieldsUserJoomlaUsernameHelper::isValid($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_IS_INVALID'));
     }
     $text = JText::_('PLG_FIELDS_JOOMLA_USERNAME_AVAILABLE');
     return $ajax->resolve($text);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:45,代码来源:ajax.php

示例3: execute

 public function execute($item, $calendar)
 {
     $model = FD::model('comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     // Include the notification actor
     $users[] = $item->actor_id;
     // Exclude the current user
     $users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
     $names = FD::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     $content = '';
     if (count($users) == 1 && !empty($item->content)) {
         $content = JString::substr(strip_tags($item->content), 0, 30);
         if (JString::strlen($item->content) > 30) {
             $content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
         }
     }
     $item->content = $content;
     if ($calendar->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_YOUR_EVENT' . $plurality, $names);
         return $item;
     }
     if ($calendar->user_id == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_OWNER_COMMENTED_ON_EVENT' . FD::user($calendar->user_id)->getGendarLang(), $names);
         return $item;
     }
     $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_USER_EVENT' . $plurality, $names, FD::user($calendar->user_id)->getName());
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:notification.comments.php

示例4: auth

 /**
  * Allows remote user to authenticate via a normal http request and returns with an authentication code.
  *
  * @since	1.2.8
  * @access	public
  * @param	string
  * @return
  */
 public function auth()
 {
     $username = JRequest::getVar('username');
     $password = JRequest::getVar('password');
     $data = array('username' => $username, 'password' => $password);
     $app = JFactory::getApplication();
     $state = $app->login($data);
     if ($state === false) {
         $this->set('code', 403);
         $this->set('message', JText::_('Invalid username or password provided'));
         return parent::display();
     }
     // Get the user's id based on the username.
     $model = FD::model('Users');
     $id = $model->getUserId('username', $username);
     if (!$id) {
         $this->set('code', 403);
         $this->set('message', JText::_('Unable to locate the user id with the given username.'));
         return parent::display();
     }
     $user = FD::user($id);
     // User logs in successfully. Generate an authentication code for the user
     $user->auth = md5($user->password . JFactory::getDate()->toSql());
     $user->store();
     $this->set('auth', $user->auth);
     $this->set('code', 200);
     $this->set('id', $user->id);
     return parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:37,代码来源:view.json.php

示例5: execute

 public function execute($item)
 {
     $model = FD::model('likes');
     $users = $model->getLikerIds($item->uid, $item->context_type);
     $users[] = $item->actor_id;
     $users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
     $names = FD::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     list($element, $group, $verb) = explode('.', $item->context_type);
     $streamItem = FD::table('streamitem');
     $state = $streamItem->load(array('context_type' => $element, 'actor_type' => $group, 'verb' => $verb, 'context_id' => $item->uid));
     if (!$state) {
         return;
     }
     $owner = $streamItem->actor_id;
     if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner) {
         $item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_YOUR_ITEM' . $plurality, $names);
         return $item;
     }
     if ($item->actor_id == $owner && count($users) == 1) {
         $item->title = JText::sprintf('APP_USER_ARTICLE_OWNER_LIKES_ITEM' . FD::user($owner)->getGenderLang(), $names);
         return $item;
     }
     $item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_USER_ITEM' . $plurality, $names, FD::user($owner)->getName());
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:26,代码来源:notification.likes.php

示例6: __construct

 public function __construct($config = array())
 {
     // Initialize page.
     $page = new stdClass();
     // Initialize page values.
     $page->icon = '';
     $page->iconUrl = '';
     $page->heading = '';
     $page->description = '';
     $this->page = $page;
     $this->my = FD::user();
     // Initialize the breadcrumbs
     $this->breadcrumbs = array();
     $view = $this->getName();
     // Disallow access if user does not have sufficient permissions
     $rule = 'easysocial.access.' . $view;
     // For fields, it uses a different view
     if ($view == 'fields') {
         $rule = 'easysocial.access.profiles';
     }
     if (!$this->authorise($rule)) {
         $this->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     parent::__construct($config);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:25,代码来源:views.php

示例7: _getURL

 protected function _getURL($user, $sizex, $sizey)
 {
     $user = KunenaFactory::getUser($user);
     $user = FD::user($user->userid);
     $avatar = $user->getAvatar(SOCIAL_AVATAR_LARGE);
     return $avatar;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:7,代码来源:avatar.php

示例8: execute

 public function execute($item)
 {
     // Get comment participants
     $model = FD::model('Likes');
     $users = $model->getLikerIds($item->uid, $item->context_type);
     // Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
     $users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
     // Convert the names to stream-ish
     $names = FD::string()->namesToNotifications($users);
     list($element, $group, $verb) = explode('.', $item->context_type);
     $event = FD::event($item->uid);
     $owner = FD::user($item->getParams()->get('owner_id'));
     // Verbs
     // makeadmin
     // going
     // notgoing
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_PLURAL
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_PLURAL
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_PLURAL
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_PLURAL
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_PLURAL
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_SINGULAR
     // APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_PLURAL
     if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
         $item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
         return $item;
     }
     $item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:notification.likes.php

示例9: display

 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     $event = FD::event($uid);
     // Get the article item
     $news = FD::table('EventNews');
     $news->load($this->input->get('newsId', 0, 'int'));
     // Check if the user is really allowed to view this item
     if (!$event->canViewItem()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Get the author of the article
     $author = FD::user($news->created_by);
     // Get the url for the article
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
     // Apply comments for the article
     $comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT, array('url' => $url));
     // Apply likes for the article
     $likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT);
     // Set the page title
     FD::page()->title($news->get('title'));
     // Retrieve the params
     $params = $this->app->getParams();
     $this->set('app', $this->app);
     $this->set('params', $params);
     $this->set('event', $event);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('author', $author);
     $this->set('news', $news);
     echo parent::display('canvas/item');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:38,代码来源:view.html.php

示例10: sidebarBottom

 public function sidebarBottom($groupId)
 {
     $params = $this->getParams();
     if (!$params->get('widget', true)) {
         return;
     }
     $group = FD::group($groupId);
     if (!$group->getAccess()->get('events.groupevent', true)) {
         return;
     }
     $my = FD::user();
     $days = $params->get('widget_days', 14);
     $total = $params->get('widget_total', 5);
     $date = FD::date();
     $now = $date->toSql();
     $future = FD::date($date->toUnix() + $days * 24 * 60 * 60)->toSql();
     $options = array();
     $options['start-after'] = $now;
     $options['start-before'] = $future;
     $options['limit'] = $total;
     $options['state'] = SOCIAL_STATE_PUBLISHED;
     $options['ordering'] = 'start';
     $options['group_id'] = $groupId;
     $events = FD::model('Events')->getEvents($options);
     if (empty($events)) {
         return;
     }
     $theme = FD::themes();
     $theme->set('events', $events);
     $theme->set('app', $this->app);
     echo $theme->output('themes:/apps/user/events/widgets/dashboard/upcoming');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:32,代码来源:view.html.php

示例11: getGroups

 /**
  * Retrieves the list of groups
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getGroups($user, $params)
 {
     $model = FD::model('Groups');
     $isUserAViewer = FD::user()->id == $user->id ? true : false;
     $groupOptions = array('uid' => $user->id, 'state' => SOCIAL_CLUSTER_PUBLISHED);
     // if $user is the current viewer, we will get all the groups
     if ($isUserAViewer) {
         $groupOptions['types'] = 'all';
     }
     $groups = $model->getGroups($groupOptions);
     $limit = $params->get('widget_profile_total', 5);
     // Get the total groups the user owns
     $groupCntOptions = array('types' => 'open');
     // if $user is the current viewer, we will get all the groups
     if ($isUserAViewer) {
         $groupCntOptions = array();
     }
     $total = $user->getTotalGroups($groupCntOptions);
     $theme = FD::themes();
     $theme->set('user', $user);
     $theme->set('limit', $limit);
     $theme->set('groups', $groups);
     $theme->set('total', $total);
     return $theme->output('themes:/apps/user/groups/widgets/profile/groups');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:view.html.php

示例12: display

 /**
  * Displays the application output in the canvas.
  *
  * @since	1.0
  * @access	public
  * @param	int		The user id that is currently being viewed.
  */
 public function display($userId = null, $docType = null)
 {
     // Require user to be logged in
     FD::requireLogin();
     $id = JRequest::getVar('schedule_id');
     // Get the user that's being accessed.
     $user = FD::user($userId);
     $calendar = FD::table('Calendar');
     $calendar->load($id);
     if (!$calendar->id || !$id) {
         FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
         return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     $result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
     if (!$result) {
         FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
         JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     FD::page()->title($calendar->title);
     // Render the comments and likes
     $likes = FD::likes();
     $likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
     // Apply comments on the stream
     $comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('calendar', $calendar);
     $this->set('user', $user);
     echo parent::display('canvas/item/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:41,代码来源:view.html.php

示例13: getTitle

 /**
  * Retrieve the title of the stream
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getTitle()
 {
     // Get the actors
     $actors = $this->item->actors;
     // Get the source id
     $sourceId = $this->share->uid;
     // Load the stream
     $stream = FD::table('Stream');
     $stream->load($sourceId);
     // If stream cannot be loaded, skip this altogether
     if (!$stream->id) {
         return;
     }
     // Build the permalink to the stream item
     $link = FRoute::stream(array('layout' => 'item', 'id' => $sourceId));
     // Get the target user.
     $target = FD::user($stream->actor_id);
     $actor = $actors[0];
     $theme = FD::get('Themes');
     $theme->set('actor', $actor);
     $theme->set('link', $link);
     $theme->set('target', $target);
     $title = $theme->output('apps/group/shares/streams/stream/title');
     return $title;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:stream.php

示例14: route

 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $id = JRequest::getInt('id');
     $table = FD::table('Notification');
     $table->load($id);
     if (!$id || !$table->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Check if the user is allowed to view this notification item.
     $my = FD::user();
     if ($table->target_id != $my->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all &amp; are replaced with &
     $url = str_ireplace('&amp;', '&', $table->url);
     $this->redirect(FRoute::_($url, false));
     $this->close();
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:34,代码来源:view.html.php

示例15: onAfterCommentSave

 /**
  * Triggered before comments notify subscribers
  *
  * @since	1.0
  * @access	public
  * @param	SocialTableComments	The comment object
  * @return
  */
 public function onAfterCommentSave(&$comment)
 {
     $allowed = array('files.user.create');
     if (!in_array($comment->element, $allowed)) {
         return;
     }
     // For likes on albums when user uploads multiple photos within an album
     if ($comment->element == 'files.user.create') {
         // Since the uid is tied to the album we can get the album object
         $stream = FD::table('Stream');
         $stream->load($comment->uid);
         // Get the actor of the likes
         $actor = FD::user($comment->created_by);
         $owner = FD::user($stream->actor_id);
         // Set the email options
         $emailOptions = array('title' => 'APP_USER_FILES_EMAILS_COMMENT_STREAM_SUBJECT', 'template' => 'apps/user/files/comment.status.item', 'permalink' => $stream->getPermalink(true, true), 'comment' => $comment->comment, 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'target' => $owner->getName(), 'targetLink' => $owner->getPermalink(true, true));
         $systemOptions = array('context_type' => $comment->element, 'context_ids' => $comment->id, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
         // Notify the owner of the photo first
         if ($stream->actor_id != $comment->created_by) {
             FD::notify('comments.item', array($stream->actor_id), $emailOptions, $systemOptions);
         }
         // Get a list of recipients to be notified for this stream item
         // We exclude the owner of the note and the actor of the like here
         $recipients = $this->getStreamNotificationTargets($comment->uid, 'files', 'user', 'create', array(), array($stream->actor_id, $comment->created_by));
         $emailOptions['title'] = 'APP_USER_FILES_EMAILS_COMMENT_STREAM_INVOLVED_SUBJECT';
         $emailOptions['template'] = 'apps/user/files/comment.status.involved';
         // Notify other participating users
         FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
         return;
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:39,代码来源:files.php


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