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


PHP FD::points方法代码示例

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


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

示例1: create_report

 public function create_report()
 {
     $app = JFactory::getApplication();
     $msg = $app->input->get('message', '', 'STRING');
     $title = $app->input->get('user_title', '', 'STRING');
     $item_id = $app->input->get('itemId', 0, 'INT');
     $log_user = $this->plugin->get('user')->id;
     $data = array();
     $data['message'] = $msg;
     $data['uid'] = $item_id;
     $data['type'] = 'stream';
     $data['title'] = $title;
     $data['extension'] = 'com_easysocial';
     //build share url use for share post through app
     $sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
     $url = $sharing->url;
     $data['url'] = $url;
     // Get the reports model
     $model = FD::model('Reports');
     // Determine if this user has the permissions to submit reports.
     $access = FD::access();
     // Determine if this user has exceeded the number of reports that they can submit
     $total = $model->getCount(array('created_by' => $log_user));
     if ($access->exceeded('reports.limit', $total)) {
         $final_result['message'] = "Limit exceeds";
         $final_result['status'] = true;
         return $final_result;
     }
     // Create the report
     $report = FD::table('Report');
     $report->bind($data);
     // Set the creator id.
     $report->created_by = $log_user;
     // Set the default state of the report to new
     $report->state = 0;
     // Try to store the report.
     $state = $report->store();
     // If there's an error, throw it
     if (!$state) {
         $final_result['message'] = "Can't save report";
         $final_result['status'] = true;
         return $final_result;
     }
     // @badge: reports.create
     // Add badge for the author when a report is created.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
     // @points: reports.create
     // Add points for the author when a report is created.
     $points = FD::points();
     $points->assign('reports.create', 'com_easysocial', $log_user);
     // Determine if we should send an email
     $config = FD::config();
     if ($config->get('reports.notifications.moderators')) {
         $report->notify();
     }
     $final_result['message'] = "Report logged successfully!";
     $final_result['status'] = true;
     return $final_result;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:60,代码来源:report.php

示例2: remove

 /**
  * Deletes reports
  *
  * @since	1.0
  * @access	public
  */
 public function remove()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current view.
     $view = $this->getCurrentView();
     // Get the id from the request
     $ids = JRequest::getVar('cid');
     // If the user is deleting with the checkbox, find similar reports
     $model = FD::model('Reports');
     foreach ($ids as $id) {
         $tmpReport = FD::table('Report');
         $tmpReport->load($id);
         // Load all related reports
         $reports = $model->getReporters($tmpReport->extension, $tmpReport->uid, $tmpReport->type);
         foreach ($reports as $report) {
             $report->delete();
             // @points: reports.delete
             // Deduct points from the author when their report is deleted.
             $points = FD::points();
             $points->assign('reports.delete', 'com_easysocial', $report->created_by);
         }
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_REPORT_ITEM_HAS_BEEN_DELETED'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:32,代码来源:reports.php

示例3: store

 /**
  * Stores the user object
  *
  * @since	1.0
  * @access	public
  */
 public function store()
 {
     // Check for request forgeries
     FD::checkToken();
     // Load front end's language file
     FD::language()->loadSite();
     // Get the current task
     $task = $this->getTask();
     // Determine if this is an edited user.
     $id = $this->input->get('id', 0, 'int');
     $id = !$id ? null : $id;
     // Get the posted data
     $post = $this->input->getArray('post');
     // this should come from backend user management page only.
     $autoApproval = isset($post['autoapproval']) ? $post['autoapproval'] : 0;
     // Create an options array for custom fields
     $options = array();
     if (!$id) {
         $user = new SocialUser();
         // Get the profile id
         $profileId = $this->input->get('profileId');
     } else {
         // Here we assume that the user record already exists.
         $user = FD::user($id);
         // Get the profile id from the user
         $profileId = $user->getProfile()->id;
         $options['data'] = true;
         $options['dataId'] = $id;
         $options['dataType'] = SOCIAL_TYPE_USER;
     }
     // Set the profile id
     $options['profile_id'] = $profileId;
     // Set the group
     $options['group'] = SOCIAL_FIELDS_GROUP_USER;
     // Load the profile
     $profile = FD::table('Profile');
     $profile->load($profileId);
     // Set the visibility
     // since this is at backend so we assume admin is editing someone else.
     if (!$id) {
         $options['visible'] = SOCIAL_PROFILES_VIEW_REGISTRATION;
     }
     // Get fields model
     $fieldsModel = ES::model('Fields');
     // Get the custom fields
     $fields = $fieldsModel->getCustomFields($options);
     // Initialize default registry
     $registry = ES::registry();
     // Get disallowed keys so we wont get wrong values.
     $disallowed = array(ES::token(), 'option', 'task', 'controller', 'autoapproval');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = json_encode($value);
             }
             $registry->set($key, $value);
         }
     }
     // Test to see if the points has changed.
     $points = $this->input->get('points', 0, 'int');
     // Lets get the difference of the points
     $userPoints = $user->getPoints();
     // If there is a difference, the admin may have altered the user points
     if ($userPoints != $points) {
         // Insert a new points record for this new adjustments.
         if ($points > $userPoints) {
             // If the result points is larger, we always need to subtract and get the balance.
             $totalPoints = $points - $userPoints;
         } else {
             // If the result points is smaller, we always need to subtract.
             $totalPoints = -($userPoints - $points);
         }
         $pointsLib = FD::points();
         $pointsLib->assignCustom($user->id, $totalPoints, JText::_('COM_EASYSOCIAL_POINTS_ADJUSTMENTS'));
         $user->points = $points;
     }
     // Convert the values into an array.
     $data = $registry->toArray();
     // Get the fields lib
     $fieldsLib = FD::fields();
     // Build arguments to be passed to the field apps.
     $args = array(&$data, &$user);
     // @trigger onAdminEditValidate
     $errors = $fieldsLib->trigger('onAdminEditValidate', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $this->view->call('form', $errors);
     }
     // @trigger onAdminEditBeforeSave
     $errors = $fieldsLib->trigger('onAdminEditBeforeSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:users.php

示例4: submit

 /**
  * Submits a reply
  *
  * @since	1.2
  * @access	public
  * @return
  */
 public function submit()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     // Get the group
     $groupId = JRequest::getInt('groupId');
     $group = FD::group($groupId);
     // Get the discussion
     $id = JRequest::getInt('id');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the current user
     $my = FD::user();
     // Check whether the viewer can really reply to the discussion
     if (!$group->isMember()) {
         return $this->reject();
     }
     // Test for locked discussion.
     if ($discussion->lock && !$group->isAdmin()) {
         $obj = new stdClass();
         $obj->message = JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_IS_LOCKED');
         $obj->type = SOCIAL_MSG_ERROR;
         return $ajax->reject($obj);
     }
     // Get the content
     // $content 	= JRequest::getVar( 'content' , '' );
     $content = JRequest::getVar('content', '', 'post', 'none', JREQUEST_ALLOWRAW);
     if (empty($content)) {
         $obj = new stdClass();
         $obj->message = JText::_('APP_GROUP_DISCUSSIONS_EMPTY_REPLY_ERROR');
         $obj->type = SOCIAL_MSG_ERROR;
         return $ajax->reject($obj);
     }
     $reply = FD::table('Discussion');
     $reply->uid = $discussion->uid;
     $reply->type = $discussion->type;
     $reply->content = $content;
     $reply->created_by = $my->id;
     $reply->parent_id = $discussion->id;
     $reply->state = SOCIAL_STATE_PUBLISHED;
     // Save the reply.
     $reply->store();
     if (!$id) {
         // @points: groups.discussion.reply
         // Earn points when posting a reply
         $points = FD::points();
         $points->assign('groups.discussion.reply', 'com_easysocial', $reply->created_by);
     }
     // Create a new stream item for this discussion
     $stream = FD::stream();
     // Get the stream template
     $tpl = $stream->getTemplate();
     // Someone just joined the group
     $tpl->setActor($my->id, SOCIAL_TYPE_USER);
     // Set the context
     $tpl->setContext($discussion->id, 'discussions');
     // Set the cluster
     $tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
     // Set the verb
     $tpl->setVerb('reply');
     // Set the params to cache the group data
     $registry = FD::registry();
     $registry->set('group', $group);
     $registry->set('reply', $reply);
     $registry->set('discussion', $discussion);
     $tpl->setParams($registry);
     $tpl->setAccess('core.view');
     // Add the stream
     $stream->add($tpl);
     // Update the parent's reply counter.
     $discussion->sync($reply);
     // Before we populate the output, we need to format it according to the theme's specs.
     $reply->author = $my;
     // Load the contents
     $theme = FD::themes();
     // Since this reply is new, we don't have an answer for this item.
     $answer = false;
     $theme->set('question', $discussion);
     $theme->set('group', $group);
     $theme->set('answer', $answer);
     $theme->set('reply', $reply);
     $contents = $theme->output('apps/group/discussions/canvas/item.reply');
     // Send notification to group members
     $options = array();
     $options['permalink'] = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->getApp()->getAlias(), 'discussionId' => $discussion->id, 'external' => true), false);
     $options['title'] = $discussion->title;
     $options['content'] = $reply->getContent();
     $options['discussionId'] = $reply->id;
     $options['userId'] = $reply->created_by;
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:reply.php

示例5: save

 /**
  * Creates a new discussion
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function save()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     // Load the discussion
     $id = JRequest::getInt('id');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the current logged in user.
     $my = FD::user();
     // Get the group
     $groupId = JRequest::getInt('cluster_id', 0);
     $group = FD::group($groupId);
     // Only allow owner and admin to modify the
     if ($discussion->id) {
         if ($discussion->created_by != $my->id && !$group->isAdmin() && !$my->isSiteAdmin()) {
             return $this->redirect($group->getPermalink(false));
         }
     }
     // Check if the user is allowed to create a discussion
     if (!$group->isMember()) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_NOT_ALLOWED_CREATE'), SOCIAL_MSG_ERROR);
         // Perform a redirection
         return JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     // Assign discussion properties
     $discussion->uid = $group->id;
     $discussion->type = SOCIAL_TYPE_GROUP;
     $discussion->title = JRequest::getVar('title', '');
     $discussion->content = JRequest::getVar('content', '', 'POST', 'none', JREQUEST_ALLOWRAW);
     // If discussion is edited, we don't want to modify the following items
     if (!$discussion->id) {
         $discussion->created_by = $my->id;
         $discussion->parent_id = 0;
         $discussion->hits = 0;
         $discussion->state = SOCIAL_STATE_PUBLISHED;
         $discussion->votes = 0;
         $discussion->lock = false;
     }
     $app = $this->getApp();
     // Ensure that the title is valid
     if (!$discussion->title) {
         Foundry::info()->set(JText::_('APP_GROUP_DISCUSSIONS_INVALID_TITLE'), SOCIAL_MSG_ERROR);
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'create', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Lock the discussion
     $state = $discussion->store();
     if (!$state) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_FAILED'));
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Process any files that needs to be created.
     $discussion->mapFiles();
     // Get the app
     $app = $this->getApp();
     // If it is a new discussion, we want to run some other stuffs here.
     if (!$id) {
         // @points: groups.discussion.create
         // Add points to the user that updated the group
         $points = FD::points();
         $points->assign('groups.discussion.create', 'com_easysocial', $my->id);
         // Create a new stream item for this discussion
         $stream = FD::stream();
         // Get the stream template
         $tpl = $stream->getTemplate();
         // Someone just joined the group
         $tpl->setActor($my->id, SOCIAL_TYPE_USER);
         // Set the context
         $tpl->setContext($discussion->id, 'discussions');
         // Set the cluster
         $tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
         // Set the verb
         $tpl->setVerb('create');
         // Set the params to cache the group data
         $registry = FD::registry();
         $registry->set('group', $group);
         $registry->set('discussion', $discussion);
         $tpl->setParams($registry);
         $tpl->setAccess('core.view');
         // Add the stream
         $stream->add($tpl);
         // Set info message
         FD::info()->set(false, JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_SUCCESS'), SOCIAL_MSG_SUCCESS);
         // Send notification to group members only if it is new discussion
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:discussion.php

示例6: unfollow

 /**
  * Allows a user to unfollow an object.
  *
  * @since	1.0
  * @access	public
  */
 public function unfollow()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Ensure that the user needs to be logged in.
     FD::requireLogin();
     // Get current logged in user.
     $my = FD::user();
     // Get the current view.
     $view = $this->getCurrentView();
     // Get the object identifier.
     $id = JRequest::getInt('id');
     // Get the target that is being unfollowed
     $user = FD::user($id);
     $type = JRequest::getVar('type');
     $group = JRequest::getVar('group', SOCIAL_APPS_GROUP_USER);
     $subscribe = FD::get('Subscriptions');
     $state = $subscribe->unfollow($id, $type, $group, $my->id);
     if (!$state) {
         $view->setMessage('COM_EASYSOCIAL_UNFOLLOW_ERROR', SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // @points: profile.unfollow
     // Assign points when user starts new conversation
     $points = FD::points();
     $points->assign('profile.unfollow', 'com_easysocial', $my->id);
     // @points: profile.unfollowed
     // Assign points when user starts new conversation
     $points->assign('profile.unfollowed', 'com_easysocial', $user->id);
     return $view->call(__FUNCTION__);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:37,代码来源:profile.php

示例7: post


//.........这里部分代码省略.........
                 }
             }
             //validate friends
             $friends = array();
             if (!empty($friends_tags)) {
                 // Get the friends model
                 $model = FD::model('Friends');
                 // Check if the user is really a friend of him / her.
                 foreach ($friends_tags as $id) {
                     if (!$model->isFriends($log_usr, $id)) {
                         continue;
                     }
                     $friends[] = $id;
                 }
             } else {
                 $friends = null;
             }
             $privacyRule = $type == 'photos' ? 'photos.view' : 'story.view';
             //for hashtag mentions
             $mentions = null;
             //if($type == 'hashtag' || !empty($content))
             if (!empty($content)) {
                 //$type = 'story';
                 $start = 0;
                 $posn = array();
                 //code adjust for 0 position hashtag
                 $content = 'a ' . $content;
                 while ($pos = strpos($content, '#', $start)) {
                     //echo 'Found # at position '.$pos."\n";
                     $posn[] = $pos - 2;
                     $start = $pos + 1;
                 }
                 $content = substr($content, 2);
                 //
                 //$pos = strpos(($content),'#',$start);
                 $cont_arr = explode(' ', $content);
                 $indx = 0;
                 foreach ($cont_arr as $val) {
                     if (preg_match('/[\'^#,|=_+¬-]/', $val)) {
                         //$vsl = substr_count($val,'#');
                         $val_arr = array_filter(explode('#', $val));
                         foreach ($val_arr as $subval) {
                             $subval = '#' . $subval;
                             $mention = new stdClass();
                             $mention->start = $posn[$indx++];
                             $mention->length = strlen($subval) - 0;
                             $mention->value = str_replace('#', '', $subval);
                             $mention->type = 'hashtag';
                             $mentions[] = $mention;
                         }
                     }
                 }
                 //print_r( $mentions );die("in share api");
             }
             $contextIds = 0;
             if ($type == 'photos') {
                 $photo_obj = $this->uploadPhoto($log_usr, 'user');
                 $photo_ids[] = $photo_obj->id;
                 $contextIds = count($photo_ids) ? $photo_ids : null;
             } else {
                 $type = 'story';
             }
             // Process moods here
             $mood = FD::table('Mood');
             // Options that should be sent to the stream lib
             $args = array('content' => $content, 'actorId' => $log_usr, 'targetId' => $targetId, 'location' => null, 'with' => $friends, 'mentions' => $mentions, 'cluster' => $cluster, 'clusterType' => $clusterType, 'mood' => null, 'privacyRule' => $privacyRule, 'privacyValue' => 'public', 'privacyCustom' => '');
             $photo_ids = array();
             $args['actorId'] = $log_usr;
             $args['contextIds'] = $contextIds;
             $args['contextType'] = $type;
             // Create the stream item
             $stream = $story->create($args);
             // Privacy is only applicable to normal postings
             if (!$isCluster) {
                 $privacyLib = FD::privacy();
                 if ($type == 'photos') {
                     $photoIds = FD::makeArray($contextIds);
                     foreach ($photoIds as $photoId) {
                         $privacyLib->add($privacyRule, $photoId, $type, 'public', null, '');
                     }
                 } else {
                     $privacyLib->add($privacyRule, $stream->uid, $type, 'public', null, '');
                 }
             }
             // Add badge for the author when a report is created.
             $badge = FD::badges();
             $badge->log('com_easysocial', 'story.create', $log_usr, JText::_('Posted a new update'));
             // @points: story.create
             // Add points for the author when a report is created.
             $points = FD::points();
             $points->assign('story.create', 'com_easysocial', $log_usr);
             if ($stream->id) {
                 $result->id = $stream->id;
                 $result->status = 1;
                 $result->message = 'data share successfully';
             }
         }
     }
     $this->plugin->setResponse($result);
 }
开发者ID:bellodox,项目名称:com_api-plugins,代码行数:101,代码来源:share.php

示例8: assignPoints

 /**
  * Assign points
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 private function assignPoints($command, $userId = null)
 {
     if (is_null($userId)) {
         $userId = FD::user()->id;
     }
     return FD::points()->assign($command, 'com_content', $userId);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:15,代码来源:easysocial.php

示例9: quickRegister

 /**
  * This is the registration API for modules. We allow modules to allow quick registration
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function quickRegister()
 {
     // Get the current view
     $view = $this->getCurrentView();
     // Get current user's session
     $session = JFactory::getSession();
     // Get necessary info about the current registration process.
     $registration = FD::table('Registration');
     $registration->load($session->getId());
     // Get a new registry object
     $params = FD::get('Registry');
     if (!empty($registration->values)) {
         $params->load($registration->values);
     }
     // The profile id is definitely required otherwise we will skip this.
     $profileId = $registration->profile_id;
     if (empty($profileId)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATIONS_MODULE_PROFILE_TYPE_REQUIRED'), SOCIAL_MSG_ERROR);
         return $view->call('selectProfile');
     }
     $data = $params->toArray();
     // Trigger onRegisterValidate first
     // Get the fields
     $fieldsModel = FD::model('Fields');
     $fields = $fieldsModel->getCustomFields(array('profile_id' => $profileId, 'visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION));
     $fieldsLib = FD::fields();
     // Get the trigger handler
     $handler = $fieldsLib->getHandler();
     $args = array(&$data, &$registration);
     // Get error messages
     $errors = $fieldsLib->trigger('onRegisterMiniValidate', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     $registration->setErrors($errors);
     // The values needs to be stored in a JSON notation.
     $registration->values = FD::json()->encode($data);
     // Store registration into the temporary table.
     $registration->store();
     // Saving was intercepted by one of the field applications.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATION_FORM_ERROR_PROCEED_WITH_REGISTRATION'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load up the registration model
     $model = FD::model('Registration');
     $user = $model->createUser($registration);
     if (!$user) {
         $view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Redirection will be dependent on the profile type's registration behavior.
     // If the profile type is auto login, we need to log the user in
     $profile = FD::table('Profile');
     $profile->load($profileId);
     // Force unset on the user first to reload the user object
     SocialUser::$userInstances[$user->id] = null;
     // Get the current registered user data.
     $my = FD::user($user->id);
     // We need to send the user an email with their password
     $my->password_clear = $user->password_clear;
     // Send notification to admin if necessary.
     if ($profile->getParams()->get('email.moderators', true)) {
         $model->notifyAdmins($data, $my, $profile);
     }
     // If everything goes through fine, we need to send notification emails out now.
     $model->notify($data, $my, $profile);
     // add new registered user into indexer
     $my->syncIndex();
     // We need to log the user in after they have successfully registered.
     if ($profile->getRegistrationType() == 'auto') {
         // @points: user.register
         // Assign points when user registers on the site.
         $points = FD::points();
         $points->assign('user.registration', 'com_easysocial', $my->id);
         // @badge: registration.create
         // Assign badge for the person that initiated the friend request.
         $badge = FD::badges();
         $badge->log('com_easysocial', 'registration.create', $my->id, JText::_('COM_EASYSOCIAL_REGISTRATION_BADGE_REGISTERED'));
         // Get configuration object.
         $config = FD::config();
         // Add activity logging when a uer registers on the site.
         if ($config->get('registrations.stream.create')) {
             $stream = FD::stream();
             $streamTemplate = $stream->getTemplate();
             // Set the actor
             $streamTemplate->setActor($my->id, SOCIAL_TYPE_USER);
             // Set the context
             $streamTemplate->setContext($my->id, SOCIAL_TYPE_PROFILES);
             // Set the verb
             $streamTemplate->setVerb('register');
             $streamTemplate->setSiteWide();
             $streamTemplate->setAccess('core.view');
             // Add stream template.
             $stream->add($streamTemplate);
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:registration.php

示例10: approve

 /**
  * Approves a user's registration application
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function approve($sendEmail = true)
 {
     // Check if the user already approved or not.
     if ($this->block == 0 && $this->state == SOCIAL_USER_STATE_ENABLED) {
         //already approved.
         return true;
     }
     // Update the JUser object.
     $this->block = 0;
     // Update the current state property.
     $this->state = SOCIAL_USER_STATE_ENABLED;
     // If set to admin approve, user should be activated regardless of whether user activates or not.
     $this->activation = 0;
     // Store the block status
     $this->save();
     // Activity logging.
     // Announce to the world when a new user registered on the site.
     $config = FD::config();
     // Get the application params
     $app = FD::table('App');
     $options = array('element' => 'profiles', 'group' => SOCIAL_TYPE_USER);
     $app->load($options);
     $params = $app->getParams();
     // If not allowed, we will not want to proceed here.
     if ($params->get('stream_register', true)) {
         $stream = FD::stream();
         // Get stream template
         $streamTemplate = $stream->getTemplate();
         // Set the actors.
         $streamTemplate->setActor($this->id, SOCIAL_TYPE_USER);
         // Set the context for the stream.
         $streamTemplate->setContext($this->id, SOCIAL_TYPE_PROFILES);
         // Set the verb for this action as this is some sort of identifier.
         $streamTemplate->setVerb('register');
         $streamTemplate->setSiteWide();
         $streamTemplate->setAccess('core.view');
         // Add the stream item.
         $stream->add($streamTemplate);
     }
     // add user into com_finder index
     $this->syncIndex();
     // @points: user.register
     // Assign points when user registers on the site.
     $points = FD::points();
     $points->assign('user.registration', 'com_easysocial', $this->id);
     // @badge: registration.create
     // Assign badge for the person that initiated the friend request.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'registration.create', $this->id, JText::_('COM_EASYSOCIAL_REGISTRATION_BADGE_REGISTERED'));
     // If we need to send email to the user, we need to process this here.
     if ($sendEmail) {
         // Get the application data.
         $jConfig = FD::jConfig();
         // Get the current profile this user has registered on.
         $profile = $this->getProfile();
         // Push arguments to template variables so users can use these arguments
         $params = array('site' => $jConfig->getValue('sitename'), 'username' => $this->username, 'name' => $this->getName(), 'avatar' => $this->getAvatar(SOCIAL_AVATAR_LARGE), 'email' => $this->email, 'profileType' => $profile->get('title'), 'manageAlerts' => false);
         JFactory::getLanguage()->load('com_easysocial', JPATH_ROOT);
         // Get the email title.
         $title = JText::_('COM_EASYSOCIAL_EMAILS_REGISTRATION_APPLICATION_APPROVED');
         // Immediately send out emails
         $mailer = FD::mailer();
         $mailTemplate = $mailer->getTemplate();
         $mailTemplate->setTitle($title);
         $mailTemplate->setRecipient($this->getName(), $this->email);
         $mailTemplate->setTemplate('site/registration/approved', $params);
         $mailTemplate->setLanguage($this->getLanguage());
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email now.
         $mailer->create($mailTemplate);
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:82,代码来源:user.php

示例11: uninstallUserApp

 /**
  * Allows the caller to uninstall the app from the user.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function uninstallUserApp($userId = null)
 {
     $config = FD::config();
     $user = FD::user($userId);
     $userId = $user->id;
     // Delete user mapping
     $map = FD::table('appsmap');
     $map->load(array('app_id' => $this->id, 'uid' => $userId));
     $state = $map->delete();
     // Give points to the author when uninstalling apps
     if ($state) {
         $points = FD::points();
         $points->assign('apps.uninstall', 'com_easysocial', $userId);
     }
     // Delete any stream that's related to the user installing this app
     $stream = FD::stream();
     $stream->delete($this->id, SOCIAL_TYPE_APPS, $userId);
     return $state;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:27,代码来源:app.php

示例12: respondInvitation

 /**
  * Allows caller to response to invitation
  *
  * @since	1.2
  * @access	public
  */
 public function respondInvitation()
 {
     $email = JRequest::getVar('email', '');
     if (!$email) {
         // Check for request forgeries
         FD::checkToken();
     }
     // Only registered users are allowed to do this
     FD::requireLogin();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the current user
     $my = FD::user();
     // Get the group
     $id = JRequest::getInt('id');
     $group = FD::group($id);
     if (!$id || !$group) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $member = FD::table('GroupMember');
     $member->load(array('cluster_id' => $group->id, 'uid' => $my->id));
     if (!$member->id) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_NOT_INVITED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Get the response action
     $action = JRequest::getWord('action');
     // If user rejected, just delete the invitation record.
     if ($action == 'reject') {
         $member->delete();
         $message = JText::sprintf('COM_EASYSOCIAL_GROUPS_REJECT_RESPONSE_SUCCESS', $group->getName());
     }
     if ($action == 'accept') {
         $member->state = SOCIAL_GROUPS_MEMBER_PUBLISHED;
         $member->store();
         // Create stream when user accepts the invitation
         $group->createStream($my->id, 'join');
         // @points: groups.join
         // Add points when user joins a group
         $points = FD::points();
         $points->assign('groups.join', 'com_easysocial', $my->id);
         // Notify members when a new member is added
         $group->notifyMembers('join', array('userId' => $my->id));
         $message = JText::sprintf('COM_EASYSOCIAL_GROUPS_ACCEPT_RESPONSE_SUCCESS', $group->getName());
     }
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $group, $action);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:55,代码来源:groups.php

示例13: massAssign

 /**
  * Mass assign points for users
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function massAssign()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the file from the request
     $file = JRequest::getVar('package', '', 'FILES');
     // Format the csv data now.
     $data = FD::parseCSV($file['tmp_name'], false, false);
     if (!$data) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_POINTS_INVALID_CSV_FILE'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load up the points library
     $points = FD::points();
     // Collect the list of failed and successfull items
     $failed = array();
     $success = array();
     foreach ($data as $row) {
         $userId = isset($row[0]) ? $row[0] : false;
         $value = isset($row[1]) ? $row[1] : false;
         $message = isset($row[2]) ? $row[2] : false;
         $obj = (object) $row;
         // Skip this
         if (!$userId || !$points) {
             $failed[] = $obj;
             continue;
         }
         $points->assignCustom($userId, $value, $message);
         $success[] = $obj;
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_POINTS_CSV_FILE_PARSED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $success, $failed);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:43,代码来源:points.php

示例14: addbadges

 public function addbadges($user, $log_user, $sub_id)
 {
     $my = FD::user($log_user);
     // @badge: followers.follow
     $badge = FD::badges();
     $badge->log('com_easysocial', 'followers.follow', $my->id, JText::_('COM_EASYSOCIAL_FOLLOWERS_BADGE_FOLLOWING_USER'));
     // @badge: followers.followed
     $badge->log('com_easysocial', 'followers.followed', $user->id, JText::_('COM_EASYSOCIAL_FOLLOWERS_BADGE_FOLLOWED'));
     // @points: profile.follow
     // Assign points when user follows another person
     $points = FD::points();
     $points->assign('profile.follow', 'com_easysocial', $my->id);
     // @points: profile.followed
     // Assign points when user is being followed by another person
     $points->assign('profile.followed', 'com_easysocial', $user->id);
     // check if admin want to add stream on following a user or not.
     $config = FD::config();
     if ($config->get('users.stream.following')) {
         // Share this on the stream.
         $stream = FD::stream();
         $streamTemplate = $stream->getTemplate();
         // Set the actor.
         $streamTemplate->setActor($my->id, SOCIAL_TYPE_USER);
         // Set the context.
         $streamTemplate->setContext($sub_id, SOCIAL_TYPE_FOLLOWERS);
         // Set the verb.
         $streamTemplate->setVerb('follow');
         $streamTemplate->setAccess('followers.view');
         // Create the stream data.
         $stream->add($streamTemplate);
     }
     // Set the email options
     $emailOptions = array('title' => 'COM_EASYSOCIAL_EMAILS_NEW_FOLLOWER_SUBJECT', 'template' => 'site/followers/new.followers', 'actor' => $my->getName(), 'actorAvatar' => $my->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $my->getPermalink(true, true), 'target' => $user->getName(), 'targetLink' => $user->getPermalink(true, true), 'totalFriends' => $my->getTotalFriends(), 'totalFollowing' => $my->getTotalFollowing(), 'totalFollowers' => $my->getTotalFollowers());
     $state = FD::notify('profile.followed', array($user->id), $emailOptions, array('url' => $my->getPermalink(false, false, false), 'actor_id' => $my->id, 'uid' => $user->id));
     return $state;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:36,代码来源:follower.php

示例15: store

 /**
  * Stores a submitted report
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function store()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get data from $_POST
     $post = JRequest::get('post');
     // Get current view.
     $view = $this->getCurrentView();
     // Get the current logged in user
     $my = FD::user();
     // Determine if the user is a guest
     $config = FD::config();
     if (!$my->id && !$config->get('reports.guests', false)) {
         return;
     }
     // Determine if this user has the permissions to submit reports.
     $access = FD::access();
     if (!$access->allowed('reports.submit')) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_NOT_ALLOWED_TO_SUBMIT_REPORTS'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Get the reports model
     $model = FD::model('Reports');
     // Determine if this user has exceeded the number of reports that they can submit
     $total = $model->getCount(array('created_by' => $my->id));
     if ($access->exceeded('reports.limit', $total)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_LIMIT_EXCEEDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Create the report
     $report = FD::table('Report');
     $report->bind($post);
     // Try to get the user's ip address.
     $report->ip = JRequest::getVar('REMOTE_ADDR', '', 'SERVER');
     // Set the creator id.
     $report->created_by = $my->id;
     // Set the default state of the report to new
     $report->state = 0;
     // Try to store the report.
     $state = $report->store();
     // If there's an error, throw it
     if (!$state) {
         $view->setMessage($report->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // @badge: reports.create
     // Add badge for the author when a report is created.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'reports.create', $my->id, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
     // @points: reports.create
     // Add points for the author when a report is created.
     $points = FD::points();
     $points->assign('reports.create', 'com_easysocial', $my->id);
     // Determine if we should send an email
     $config = FD::config();
     if ($config->get('reports.notifications.moderators')) {
         $report->notify();
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_STORED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:69,代码来源:reports.php


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