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


PHP FD::badges方法代码示例

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


在下文中一共展示了FD::badges方法的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: 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_BADGES_INVALID_CSV_FILE'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load up the points library
     $badges = FD::badges();
     // Collect the list of failed and successfull items
     $failed = array();
     $success = array();
     foreach ($data as $row) {
         $userId = isset($row[0]) ? $row[0] : false;
         $badgeId = isset($row[1]) ? $row[1] : false;
         $dateAchieved = isset($row[2]) ? $row[2] : false;
         $message = isset($row[3]) ? $row[3] : false;
         $publishStream = isset($row[4]) && $row[4] == 1 ? true : false;
         $obj = (object) $row;
         $badge = FD::table('Badge');
         $badge->load($badgeId);
         // Skip this
         if (!$userId || !$badgeId || !$badge->id) {
             $failed[] = $obj;
             continue;
         }
         $user = FD::user($userId);
         $badges->create($badge, $user, $message, $dateAchieved);
         if ($publishStream) {
             $badges->addStream($badge, $user->id);
         }
         $success[] = $obj;
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_BADGES_CSV_FILE_PARSED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $success, $failed);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:51,代码来源:badges.php

示例3: assign

 /**
  * Assign points to a specific user.
  *
  * @since	1.0
  * @access	public
  * @param	int		The command to be executed. Refer to `#__social_points_commands`.`command`
  * @param	string	The extension or app name. Refer to `#__social_points_commands`.`extension`
  * @param	int 	The target user's id.
  * @return	bool	True if point is given. False otherwise.
  */
 public function assign($command, $extension, $userId)
 {
     $config = FD::config();
     // Check if points system is enabled.
     if (!$config->get('points.enabled')) {
         return false;
     }
     // If user id is empty or 0, we shouldn't assign anything
     if (!$userId) {
         return false;
     }
     // Retrieve the points table.
     $points = FD::table('Points');
     $state = $points->load(array('command' => $command, 'extension' => $extension));
     // Check the command and extension and see if it is valid.
     if (!$state) {
         return false;
     }
     // Check the rule and see if it is published.
     if ($points->state != SOCIAL_STATE_PUBLISHED) {
         return false;
     }
     // @TODO: Check points threshold.
     if ($points->threshold) {
     }
     // @TODO: Check the interval to see if the user has achieved this for how many times.
     if ($points->interval != SOCIAL_POINTS_EVERY_TIME) {
     }
     // @TODO: Customizable point system where only users from specific profile type may achieve this point.
     // Add history.
     $history = FD::table('PointsHistory');
     $history->points_id = $points->id;
     $history->user_id = $userId;
     $history->points = $points->points;
     $history->state = SOCIAL_STATE_PUBLISHED;
     $history->store();
     $this->updateUserPoints($userId, $points->points);
     // Assign a badge to the user for earning points.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'points.achieve', $userId, JText::_('COM_EASYSOCIAL_POINTS_BADGE_EARNED_POINT'));
     return true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:52,代码来源:points.php

示例4: display

 /**
  * Displays a user profile to a 3rd person perspective.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  **/
 public function display($tpl = null)
 {
     // Get the user's id.
     $id = $this->input->get('id', 0, 'int');
     // The current logged in user might be viewing their own profile.
     if ($id == 0) {
         $id = FD::user()->id;
     }
     // When the user tries to view his own profile but if he isn't logged in, throw a login page.
     if ($id == 0) {
         return FD::requireLogin();
     }
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the user's object.
     $user = FD::user($id);
     // If the user still don't exist, throw a 404
     if (!$user->id) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     if (Foundry::user()->id != $user->id) {
         if (FD::user()->isBlockedBy($user->id)) {
             return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
         }
     }
     if ($user->isBlock()) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_PROFILE_USER_NOT_EXIST', $user->getName()), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Set the page title
     FD::page()->title(FD::string()->escape($user->getName()));
     // Set the page breadcrumb
     FD::page()->breadcrumb(FD::string()->escape($user->getName()));
     // Apply opengraph tags.
     FD::opengraph()->addProfile($user);
     // Get the current logged in user's object.
     $my = FD::user();
     // Do not assign badge if i view myself.
     if ($user->id != $my->id && $my->id) {
         // @badge: profile.view
         $badge = FD::badges();
         $badge->log('com_easysocial', 'profile.view', $my->id, JText::_('COM_EASYSOCIAL_PROFILE_VIEWED_A_PROFILE'));
     }
     $startlimit = JRequest::getInt('limitstart', 0);
     // Determine if the current request is to load an app
     $appId = JRequest::getInt('appId');
     // Get site configuration
     $config = FD::config();
     // Get the apps library.
     $appsLib = FD::apps();
     $contents = '';
     if ($appId) {
         // Load the app
         $app = FD::table('App');
         $app->load($appId);
         // Check if the user has access to this app
         if (!$app->accessible($user->id)) {
             FD::info()->set(null, JText::_('COM_EASYSOCIAL_PROFILE_APP_IS_NOT_INSTALLED_BY_USER'), SOCIAL_MSG_ERROR);
             return $this->redirect(FRoute::profile(array('id' => $user->getAlias()), false));
         }
         // Set the page title
         FD::page()->title(FD::string()->escape($user->getName()) . ' - ' . $app->get('title'));
         $contents = $appsLib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'profile', $app, array('userId' => $user->id));
     }
     $layout = JRequest::getCmd('layout');
     // @since 1.3.7
     // If layout is empty, means we want to get the default view
     // Previously timeline is always the default
     if (empty($appId) && empty($layout)) {
         $defaultDisplay = FD::config()->get('users.profile.display', 'timeline');
         $layout = $defaultDisplay;
     }
     if ($layout === 'about') {
         FD::language()->loadAdmin();
         $currentStep = JRequest::getInt('step', 1);
         $steps = FD::model('Steps')->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);
         $fieldsLib = FD::fields();
         $fieldsModel = FD::model('Fields');
         $index = 1;
         foreach ($steps as $step) {
             $step->fields = $fieldsModel->getCustomFields(array('step_id' => $step->id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY));
             if (!empty($step->fields)) {
                 $args = array($user);
                 $fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_USER, $step->fields, $args);
             }
             $step->hide = true;
             foreach ($step->fields as $field) {
                 // As long as one of the field in the step has an output, then this step shouldn't be hidden
                 // If step has been marked false, then no point marking it as false again
                 // We don't break from the loop here because there is other checking going on
                 if (!empty($field->output) && $step->hide === true) {
                     $step->hide = false;
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:view.html.php

示例5: assignBadge

 /**
  * Creates a badge record
  *
  * @since   1.0
  * @access  public
  * @param   string
  * @return
  */
 public function assignBadge($rule, $actorId)
 {
     if ($rule == 'photos.create') {
         // @badge: photos.create
         $badge = FD::badges();
         $badge->log('com_easysocial', 'photos.create', $actorId, JText::_('COM_EASYSOCIAL_PHOTOS_BADGE_UPLOADED'));
     }
     if ($rule == 'photos.browse') {
         // @badge: photos.browse
         $badge = FD::badges();
         $badge->log('com_easysocial', 'photos.browse', $actorId, JText::_('COM_EASYSOCIAL_PHOTOS_BADGE_BROWSE'));
     }
     if ($rule == 'photos.tag') {
         // @badge: photos.tag
         $badge = FD::badges();
         $badge->log('com_easysocial', 'photos.tag', $actorId, JText::_('COM_EASYSOCIAL_PHOTOS_BADGE_TAG'));
     }
     if ($rule == 'photos.superstar') {
         // @badge: photos.tag
         $badge = FD::badges();
         $badge->log('com_easysocial', 'photos.tag', $actorId, JText::_('COM_EASYSOCIAL_PHOTOS_BADGE_TAG'));
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:31,代码来源:photo.php

示例6: getItems

 /**
  * get activity logs.
  *
  * @since	1.0
  * @access	public
  */
 public function getItems()
 {
     // Check for request forgeries!
     FD::checkToken();
     // search controller do not need to check islogin.
     // Get the current view
     $view = $this->getCurrentView();
     // Get current logged in user
     $my = FD::user();
     // 7:EasyBlog
     $type = JRequest::getInt('type', 0);
     $keywords = JRequest::getVar('q', '');
     $next_limit = JRequest::getVar('next_limit', '');
     $last_type = JRequest::getVar('last_type', '');
     $isloadmore = JRequest::getVar('loadmore', false);
     $ismini = JRequest::getVar('mini', false);
     $highlight = $ismini ? false : true;
     $limit = $ismini ? FD::themes()->getConfig()->get('search_toolbarlimit') : FD::themes()->getConfig()->get('search_limit');
     // @badge: search.create
     // Assign badge for the person that initiated the friend request.
     if (!$isloadmore) {
         $badge = FD::badges();
         $badge->log('com_easysocial', 'search.create', $my->id, JText::_('COM_EASYSOCIAL_SEARCH_BADGE_SEARCHED_ITEM'));
     }
     $results = array();
     $pagination = null;
     $count = 0;
     $data = array();
     $isFinderEnabled = JComponentHelper::isEnabled('com_finder');
     if ($isFinderEnabled) {
         jimport('joomla.application.component.model');
         $searchAdapter = FD::get('Search');
         $path = JPATH_ROOT . '/components/com_finder/models/search.php';
         require_once $path;
         $jModel = new FinderModelSearch();
         $state = $jModel->getState();
         $query = $jModel->getQuery();
         // this line need to be here. so that the indexer can get the correct value
         if (!$query->terms) {
             // if there is no terms match. lets check if smart search suggested any terms or not. if yes, lets use it.
             if (isset($query->included) && count($query->included) > 0) {
                 $suggestion = '';
                 foreach ($query->included as $item) {
                     if (isset($item->suggestion) && !empty($item->suggestion)) {
                         $suggestion = $item->suggestion;
                     }
                 }
                 if ($suggestion) {
                     //reset the query string.
                     $app = JFactory::getApplication();
                     $input = $app->input;
                     $input->request->set('q', $suggestion);
                     //refresh
                     $jModel = new FinderModelSearch();
                     $state = $jModel->getState();
                     $query = $jModel->getQuery();
                     // this line need to be here. so that the indexer can get the correct value
                 }
             }
         }
         //reset the pagination state.
         $state->{'list.start'} = $next_limit;
         $state->{'list.limit'} = $limit;
         if ($type) {
             // 7:EasyBlog
             $typeAlias = JRequest::getVar('type', '');
             $typeAlias = explode(':', $typeAlias);
             $typeAlias = $typeAlias[1];
             $typeArr['Type'] = array($typeAlias => $type);
             $query->filters = $typeArr;
         }
         $results = $jModel->getResults();
         $count = $jModel->getTotal();
         $pagination = $jModel->getPagination();
         if (FD::isJoomla30()) {
             $pagination->{'pages.total'} = $pagination->pagesTotal;
             $pagination->{'pages.current'} = $pagination->pagesCurrent;
         }
         if ($results) {
             $data = $searchAdapter->format($results, $query, $highlight);
             if ($pagination->{'pages.total'} == 1 || $pagination->{'pages.total'} == $pagination->{'pages.current'}) {
                 $next_limit = '-1';
             } else {
                 $next_limit = $pagination->limitstart + $pagination->limit;
             }
         }
     }
     return $view->call(__FUNCTION__, $data, $last_type, $next_limit, $isloadmore, $ismini, $count);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:95,代码来源:search.php

示例7: assignBadge

 public function assignBadge($command, $message, $target = null)
 {
     $user = FD::user($target);
     $badge = FD::badges();
     return $badge->log('com_kunena', $command, $user->id, $user->id);
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:6,代码来源:activity.php

示例8: addParticipant

 /**
  * Adds a participant into an existing conversation
  *
  * @since	1.0
  * @access	public
  * @param	int			The creator's user id.
  * @param	int			The recipient's user id.
  * @return	boolean		True on success, false otherwise.
  */
 public function addParticipant($created_by, $userId)
 {
     // Create a new participant record.
     $participant = FD::table('ConversationParticipant');
     // Try to load and see if the participant has already been added to the system.
     $participant->load(array('user_id' => $userId, 'conversation_id' => $this->id));
     $participant->conversation_id = $this->id;
     $participant->user_id = $userId;
     $participant->state = SOCIAL_STATE_PUBLISHED;
     // Try to save the participant
     $state = $participant->store();
     if (!$state) {
         $this->setError($participant->getError());
         return $state;
     }
     // @badge: conversation.invite
     $badge = FD::badges();
     $badge->log('com_easysocial', 'conversation.invite', $created_by, JText::_('COM_EASYSOCIAL_CONVERSATIONS_BADGE_INVITED_USER_TO_CONVERSATION'));
     // @points: conversation.invite
     // Assign points when user starts new conversation
     $points = FD::points();
     $points->assign('conversation.invite', 'com_easysocial', $created_by);
     // Once the participant is created, we need to create a
     // a new conversation message with the type of join so that others would know
     // that a new user is added to the conversation.
     $message = FD::table('ConversationMessage');
     $message->conversation_id = $this->id;
     $message->message = $userId;
     $message->type = SOCIAL_CONVERSATION_TYPE_JOIN;
     $message->created_by = $created_by;
     // Try to store the new message
     $state = $message->store();
     if (!$state) {
         $this->setError($message->getError());
         return $state;
     }
     // Get conversation model
     $model = FD::model('Conversations');
     // Get existing participants.
     $participants = $model->getParticipants($this->id);
     // Finally, we need to add the message maps
     $model->addMessageMaps($this->id, $message->id, $participants, $created_by);
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:53,代码来源:conversation.php

示例9: install

 /**
  * Installs the app
  *
  * @since	1.0
  * @access	public
  * @param	int		User id
  * @return	bool	Result
  */
 public function install($userId = null)
 {
     $user = FD::user($userId);
     $userId = $user->id;
     $config = FD::config();
     $map = FD::table('appsmap');
     $map->app_id = $this->id;
     $map->uid = $userId;
     $map->type = SOCIAL_APPS_GROUP_USER;
     $map->created = FD::date()->toSql();
     $state = $map->store();
     if (!$state) {
         return false;
     }
     // @badge: apps.install
     // Assign a badge to the user when they install apps.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'apps.install', $userId, JText::_('COM_EASYSOCIAL_APPS_BADGE_INSTALLED'));
     // Give points to the author when installing apps
     $points = FD::points();
     $points->assign('apps.install', 'com_easysocial', $userId);
     // Get the application settings
     $app = FD::table('App');
     $app->load(array('type' => SOCIAL_TYPE_APPS, 'group' => SOCIAL_TYPE_USER, 'element' => SOCIAL_TYPE_APPS));
     $params = $app->getParams();
     // If configured to publish on the stream, share this to the world.
     if ($app->id && $params->get('stream_install', true)) {
         // lets add a stream item here.
         $stream = FD::stream();
         $template = $stream->getTemplate();
         $template->setActor($user->id, SOCIAL_TYPE_USER);
         $template->setContext($this->id, SOCIAL_TYPE_APPS);
         $template->setVerb('install');
         $template->setType(SOCIAL_STREAM_DISPLAY_MINI);
         $template->setAggregate(false);
         $template->setParams($this);
         $template->setAccess('core.view');
         $stream->add($template);
     }
     return true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:49,代码来源:app.php

示例10: 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

示例11: 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

示例12: removeBadge

 /**
  * Allows caller to remove a badge
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function removeBadge()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the badge id.
     $id = JRequest::getInt('id');
     $userId = JRequest::getInt('userid');
     // Load up the badge library
     $badge = FD::badges();
     $badge->remove($id, $userId);
     $view->setMessage(JText::_('Achievement removed from user successfully.'));
     $view->call(__FUNCTION__);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:23,代码来源:users.php

示例13: display

 /**
  * Displays a user profile to a 3rd person perspective.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  **/
 public function display($tpl = null)
 {
     // Get the user's id.
     $id = $this->input->get('id', 0, 'int');
     // Check if there is any stream filtering or not.
     $filter = $this->input->get('type', '', 'word');
     // The current logged in user might be viewing their own profile.
     if ($id == 0) {
         $id = FD::user()->id;
     }
     // When the user tries to view his own profile but if he isn't logged in, throw a login page.
     if ($id == 0) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the user's object.
     $user = FD::user($id);
     // If the user doesn't exist throw an error
     if (!$user->id) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // If the user is blocked or the user doesn't have community access
     if ($this->my->id != $user->id && $this->my->isBlockedBy($user->id) || !$user->hasCommunityAccess()) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // If the user is blocked, they should not be accessible
     if ($user->isBlock()) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // Set the page properties
     $this->page->title($this->string->escape($user->getName()));
     $this->page->breadcrumb($this->string->escape($user->getName()));
     // Get the current user's privacy object
     $privacy = $this->my->getPrivacy();
     // Let's test if the current viewer is allowed to view this profile.
     if ($this->my->id != $user->id && !$privacy->validate('profiles.view', $user->id, SOCIAL_TYPE_USER)) {
         $this->set('user', $user);
         return parent::display('site/profile/restricted');
     }
     // Apply opengraph tags.
     FD::opengraph()->addProfile($user);
     // Do not assign badge if i view myself.
     if ($user->id != $this->my->id && $this->my->id) {
         // @badge: profile.view
         $badge = FD::badges();
         $badge->log('com_easysocial', 'profile.view', $this->my->id, JText::_('COM_EASYSOCIAL_PROFILE_VIEWED_A_PROFILE'));
     }
     // Get the limit start
     $startLimit = $this->input->get('limitstart', 0, 'int');
     // Determine if the current request is to load an app
     $appId = $this->input->get('appId', 0, 'int');
     // Get the apps library.
     $appsLib = FD::apps();
     // Default contents
     $contents = '';
     // Load the app when necessary
     if ($appId) {
         $app = FD::table('App');
         $app->load($appId);
         // Check if the user has access to this app
         if (!$app->accessible($user->id)) {
             FD::info()->set(false, JText::_('COM_EASYSOCIAL_PROFILE_APP_IS_NOT_INSTALLED_BY_USER'), SOCIAL_MSG_ERROR);
             $redirect = FRoute::profile(array('id' => $user->getAlias()), false);
             return $this->redirect($redirect);
         }
         // Set the page title
         $this->page->title(FD::string()->escape($user->getName()) . ' - ' . $app->get('title'));
         // Render the app contents
         $contents = $appsLib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'profile', $app, array('userId' => $user->id));
     }
     // Get the layout
     $layout = $this->input->get('layout', '', 'cmd');
     // @since 1.3.7
     // If layout is empty, means we want to get the default view
     // Previously timeline is always the default
     if (empty($appId) && empty($layout) && $filter != 'appFilter') {
         $defaultDisplay = $this->config->get('users.profile.display', 'timeline');
         $layout = $defaultDisplay;
     }
     // Default variables
     $timeline = null;
     $newCover = false;
     // Viewing info of a user.
     if ($layout === 'about') {
         $showTimeline = false;
         $usersModel = FD::model('Users');
         $steps = $usersModel->getAbout($user);
         // We should generate a canonical link if user is viewing the about section and the default page is about
         if ($this->config->get('users.profile.display') == 'about') {
             $this->page->canonical($user->getPermalink(false, true));
         }
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:view.html.php

示例14: post

 /**
  * Function post for create user record.
  *
  * @return void
  */
 public function post()
 {
     $error_messages = array();
     $fieldname = array();
     $response = null;
     $validated = true;
     $userid = null;
     $data = array();
     //$log_user = $this->plugin->get('user')->id;
     $app = JFactory::getApplication();
     $data['username'] = $app->input->get('username', '', 'STRING');
     $data['password'] = $app->input->get('password', '', 'STRING');
     $data['name'] = $app->input->get('name', '', 'STRING');
     $data['email'] = $app->input->get('email', '', 'STRING');
     $data['enabled'] = $app->input->get('enabled', 1, 'INT');
     $data['activation'] = $app->input->get('activation', 0, 'INT');
     $data['app'] = $app->input->get('app_name', 'Easysocial App', 'STRING');
     global $message;
     $eobj = new stdClass();
     if ($data['username'] == '' || $data['password'] == '' || $data['name'] == '' || $data['email'] == '') {
         $eobj->status = false;
         $eobj->id = 0;
         $eobj->code = '403';
         $eobj->message = 'Required data is empty';
         $this->plugin->setResponse($eobj);
         return;
     }
     jimport('joomla.user.helper');
     $authorize = JFactory::getACL();
     $user = clone JFactory::getUser();
     $user->set('username', $data['username']);
     $user->set('password', $data['password']);
     $user->set('name', $data['name']);
     $user->set('email', $data['email']);
     $user->set('block', $data['enabled']);
     $user->set('activation', $data['activation']);
     // Password encryption
     $salt = JUserHelper::genRandomPassword(32);
     $crypt = JUserHelper::getCryptedPassword($user->password, $salt);
     $user->password = "{$crypt}:{$salt}";
     // User group/type
     $user->set('id', '');
     $user->set('usertype', 'Registered');
     if (JVERSION >= '1.6.0') {
         $userConfig = JComponentHelper::getParams('com_users');
         // Default to Registered.
         $defaultUserGroup = $userConfig->get('new_usertype', 2);
         $user->set('groups', array($defaultUserGroup));
     } else {
         $user->set('gid', $authorize->get_group_id('', 'Registered', 'ARO'));
     }
     $date = JFactory::getDate();
     $user->set('registerDate', $date->toSql());
     //print_r($_POST);die("in api after save");
     // True on success, false otherwise
     if (!$user->save()) {
         //$message = "not created because of " . $user->getError();
         $message = $user->getError();
         $eobj->status = false;
         $eobj->id = 0;
         $eobj->code = '403';
         $eobj->message = $message;
         $this->plugin->setResponse($eobj);
         return;
     } else {
         /*
         // Auto registration
         if( $data['activation'] == 0)
         { 
         	$emailSubject = 'Email Subject for registration successfully';
         	$emailBody = 'Email body for registration successfully';                       
         	$return = JFactory::getMailer()->sendMail('sender email', 'sender name', $user->email, $emailSubject, $emailBody);
         	
         }
         else if( $data['activation'] == 1)
         {
         	$emailSubject = 'Email Subject for activate the account';
         	$emailBody = 'Email body for for activate the account';     
         	$user_activation_url = JURI::base().JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $user->activation, false);  // Append this URL in your email body
         	$return = JFactory::getMailer()->sendMail('sender email', 'sender name', $user->email, $emailSubject, $emailBody);                             
         	
         }
         */
         $mail_sent = $this->sendRegisterEmail($data);
         $easysocial = JPATH_ADMINISTRATOR . '/components/com_easysocial/easysocial.php';
         //eb version
         if (JFile::exists($easysocial)) {
             $pobj = $this->createEsprofile($user->id);
             //$message = "created of username-" . $user->username .",send mail of details please check";
             $message = "Congratulations! Your account has been created successfully";
         } else {
             $message = "Congratulations! Your account has been created successfully";
         }
         // Assign badge for the person.
         $badge = FD::badges();
//.........这里部分代码省略.........
开发者ID:yalive,项目名称:com_api-plugins,代码行数:101,代码来源:users.php

示例15: 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


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