コード例 #1
0
 function awardPoints($userid, $function, $referrence, $info)
 {
     $app =& JFactory::getApplication();
     $cwConfig =& CrosswordsHelper::get_configuration();
     if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_AUP) == 0) {
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP)) {
             require_once $api_AUP;
             $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userid);
             if ($aupid) {
                 switch ($function) {
                     case 1:
                         //New Question
                         AlphaUserPointsHelper::newpoints(AUP_NEW_QUESTION, $aupid, $referrence, $info);
                         break;
                     case 2:
                         // Solved crossword
                         AlphaUserPointsHelper::newpoints(AUP_SOLVE_CROSSWORD, $aupid, $referrence, $info);
                         break;
                 }
             }
         }
     } else {
         if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_JOMSOCIAL) == 0) {
             include_once JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
             switch ($function) {
                 case 1:
                     //New Question
                     CuserPoints::assignPoint(JSP_NEW_QUESTION, $userid);
                     break;
                 case 2:
                     // New Answer
                     CuserPoints::assignPoint(JSP_SOLVED_CROSSWORD, $userid);
                     break;
             }
         } else {
             if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_TOUCH) == 0) {
                 $API = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php';
                 if (file_exists($API)) {
                     require_once $API;
                     switch ($function) {
                         case 1:
                             //New Question
                             JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_NEW_QUESTION]);
                             break;
                         case 2:
                             // New Answer
                             JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_SOLVED_CROSSWORD]);
                             break;
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
 function addReferralBonus($user_id)
 {
     $api_AUP = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
     require_once $api_AUP;
     CuserPoints::assignPoint('enmasse.referral.add', $user_id);
     $act = new stdClass();
     $act->cmd = 'wall.write';
     $act->actor = $user_id;
     $act->target = 0;
     $act->title = JText::_('{actor} have just point for referral bonus');
     $act->content = '';
     $act->app = 'wall';
     $act->cid = 0;
     CFactory::load('libraries', 'activities');
     CActivityStream::add($act);
 }
コード例 #3
0
ファイル: functions.php プロジェクト: pguilford/vcomcc
 /**
  * Award points to the user using selected points system. The user id and required parameters should be passed based on points system selected.
  *
  * Parameters array should be an associative array which can include
  * <ul>
  * 	<li>function: the function name used to award points.</li>
  * 	<li>points: points awarded to the user. For jomsocial this has no effect as the points are taken from xml rule.</li>
  * 	<li>reference: the reference string for AUP rule</li>
  * 	<li>info: Brief information about this point.</li>
  * </ul>
  *
  * @param string $system
  * @param int $userid
  * @param array $params
  */
 public static function award_points($system, $userid, $params = array())
 {
     switch ($system) {
         case 'cjblog':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $points = !empty($params['points']) ? $params['points'] : 0;
                 $reference = !empty($params['reference']) ? $params['reference'] : null;
                 $description = !empty($params['info']) ? $params['info'] : null;
                 CjBlogApi::award_points($params['function'], $userid, $points, $reference, $description);
             }
             break;
         case 'jomsocial':
             $api = JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
             if (file_exists($api) && !empty($params['function'])) {
                 include_once $api;
                 CuserPoints::assignPoint($params['function'], $userid);
             }
             break;
         case 'aup':
             $api = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api) && !empty($params['function']) && isset($params['info'])) {
                 require_once $api;
                 $reference = !empty($params['reference']) ? $params['reference'] : null;
                 $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userid);
                 AlphaUserPointsHelper::newpoints($params['function'], $aupid, $reference, $params['info'], $params['points']);
             }
             break;
         case 'touch':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php';
             if (file_exists($api) && !empty($params['points'])) {
                 require_once $api;
                 JSCommunityApi::increaseKarma($userid, $params['points']);
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 Foundry::points()->assign($params['function'], $params['component'], $userid);
             }
             break;
     }
 }
コード例 #4
0
ファイル: jahelper.php プロジェクト: jomsocial/JSVoice
 public static function JomSocial_addActivityStream($actor, $title, $cid, $action = 'add')
 {
     global $javconfig;
     if (JAVoiceHelpers::checkComponent('com_community') && (!isset($javconfig['plugin']) || $javconfig['plugin']->get('enable_activity_stream', 1))) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'activities.php';
         include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
         $act = new stdClass();
         $act->cmd = 'com_javoice.voice.' . $action;
         $userPointModel = CFactory::getModel('Userpoints');
         // Test command, with userpoint command. If is unpublished do not proceed into adding to activity stream.
         $point = $userPointModel->getPointData($act->cmd);
         $points = 0;
         if ($point && !$point->published) {
             $points = 1;
         } elseif ($point) {
             $points = $point->points;
         }
         $act->actor = $actor;
         $act->target = $actor;
         // no target
         $act->title = JText::_($title);
         $act->content = JText::_('THIS_IS_THE_BODY');
         $act->app = 'com_javoice.voice';
         $act->cid = $cid;
         $act->points = $points;
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
         /* Add points for user */
         CuserPoints::assignPoint($act->cmd, $actor);
     }
 }
コード例 #5
0
ファイル: jomsocial.php プロジェクト: atikahmed/joomla-probid
 function _plgReviewAfterSave(&$model)
 {
     $content = '';
     $activity_thumb = '';
     $stream = Sanitize::getInt($this->c->Config, 'jomsocial_reviews');
     /**
      * Check if there's something to do and run the query only if necessary. Then set it in the
      * controller (viewVars) to make it available in other plugins
      */
     if ($stream || $this->points) {
         $review = $this->_getReview($model);
     }
     /**
      * Publish activity to JomSocial stream
      */
     if ($stream) {
         // Treat moderated reviews as new
         $this->inAdmin and Sanitize::getBool($model->data, 'moderation') and $model->isNew = true;
         if ($stream == 1 && (!isset($model->isNew) || !$model->isNew)) {
             return;
         }
         // Don't run for edits
         if ($stream == 1 && $review['Review']['modified'] != NULL_DATE) {
             return;
         }
         // Don't run for edits
         if ($stream == 2 && (!isset($model->isNew) || !$model->isNew) && $this->c->_user->id != $review['User']['user_id']) {
             return;
         }
         // Don't run for edits by users other than the owner of this post
         if (isset($model->isNew) && $review['Review']['published'] == 1) {
             $listing_link = $this->Html->sefLink($review['Listing']['title'], $review['Listing']['url']);
             !empty($review['Listing']['images']) and $activity_thumb = $this->Thumbnail->thumb($review, 0, array('tn_mode' => $this->c->Config->jomsocial_tnmode, 'location' => 'activity', 'dimensions' => array($this->c->Config->jomsocial_tnsize)));
             $thumb_link = $activity_thumb ? $this->Html->sefLink($activity_thumb, $review['Listing']['url']) : '';
             if (isset($model->isNew) && $model->isNew && $review['Review']['modified'] == NULL_DATE) {
                 $title = sprintf($this->activities['review_new'], $listing_link);
             } else {
                 $title = sprintf($this->activities['review_edit'], $listing_link);
             }
             if ($activity_thumb || $review['Review']['comments'] != '') {
                 $content = '<ul class="cDetailList clrfix">';
                 $thumb_link and $content .= '<li style="float:left;">' . $thumb_link . '</li>';
                 $thumb_link and $content .= '<li class="detailWrap">';
                 $review['Review']['comments'] != '' and $content .= '<div class="newsfeed-quote">' . $this->Text->truncateWords($review['Review']['comments'], 25) . '</div>';
                 $thumb_link and $content .= '</li>';
                 $content .= '</ul>';
             }
             //begin activity stream
             $act = new stdClass();
             $act->cmd = 'wall.write';
             $act->actor = $review['User']['user_id'];
             $act->target = 0;
             // no target
             $act->title = $title;
             $act->content = $content;
             $act->app = 'wall';
             $act->cid = 0;
             CFactory::load('libraries', 'activities');
             CActivityStream::add($act);
         }
     }
     if ($this->points) {
         if (isset($model->isNew) && $model->isNew && $review['Review']['published'] == 1) {
             // Begin add points
             CuserPoints::assignPoint('jreviews.review.add', $review['User']['user_id']);
         }
     }
 }
コード例 #6
0
 public function addpoints(JUser $receiver, $options = array())
 {
     CFactory::load('libraries', 'userpoints');
     CFactory::load('libraries', 'notification');
     CuserPoints::assignPoint($options['command'], $receiver->id);
 }
コード例 #7
0
ファイル: api.php プロジェクト: pguilford/vcomcc
 public function awardPoints($app, $userId, $options)
 {
     $points = !empty($options['points']) ? $options['points'] : 0;
     $reference = !empty($options['reference']) ? $options['reference'] : null;
     $title = !empty($options['title']) ? $options['title'] : null;
     $description = !empty($options['info']) ? $options['info'] : null;
     switch ($app) {
         case 'cjforum':
             $api = JPATH_ROOT . '/components/com_cjforum/lib/api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $pointsApi = CjForumApi::getPointsApi();
                 $pointsApi->awardPoints($options['function'], $userId, $points, $reference, $title, $description);
             }
             break;
         case 'cjblog':
             $api = JPATH_ROOT . '/components/com_cjblog/api.php';
             if (file_exists($api)) {
                 include_once $api;
                 CjBlogApi::award_points($options['function'], $userId, $points, $reference, $description);
             }
             break;
         case 'jomsocial':
             $api = JPATH_SITE . '/components/com_community/libraries/userpoints.php';
             if (file_exists($api) && !empty($options['function'])) {
                 include_once $api;
                 CuserPoints::assignPoint($options['function'], $userId);
             }
             break;
         case 'aup':
             $api = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
             if (file_exists($api) && !empty($options['function'])) {
                 require_once $api;
                 $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userId);
                 AlphaUserPointsHelper::newpoints($options['function'], $aupid, $reference, $description, $points);
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 Foundry::points()->assign($options['function'], $options['component'], $userId);
             }
             break;
     }
 }
コード例 #8
0
ファイル: post.php プロジェクト: kaantunc/MYK-BOR
                 $act->target = 0;
                 // no target
                 $act->title = JText::_('{actor} ' . _KUNENA_JS_ACTIVITYSTREAM_CREATE_MSG1 . ' <a href="' . $JSPostLink . '">' . stripslashes($subject) . '</a> ' . _KUNENA_JS_ACTIVITYSTREAM_CREATE_MSG2);
                 $act->content = $content;
                 $act->app = 'wall';
                 $act->cid = 0;
                 CFactory::load('libraries', 'activities');
                 CActivityStream::add($act);
             }
         }
     }
 } else {
     // if JomScoial integration is active integrate user points and activity stream
     if ($fbConfig->pm_component == 'jomsocial' || $fbConfig->fb_profile == 'jomsocial' || $fbConfig->avatar_src == 'jomsocial') {
         include_once KUNENA_ROOT_PATH . DS . 'components/com_community/libraries/userpoints.php';
         CuserPoints::assignPoint('com_kunena.thread.reply');
         // Check for permisions of the current category - activity only if public
         if ($thisCat->getPubAccess() == 0 && $fbConfig->js_actstr_integration) {
             if ($fbConfig->js_actstr_integration) {
                 //activity stream - reply post
                 $JSPostLink = CKunenaLink::GetThreadPageURL($fbConfig, 'view', $catid, $thread, 1);
                 $content = stripslashes($message);
                 $content = smile::smileReplace($content, 0, $fbConfig->disemoticons, $smileyList);
                 $content = nl2br($content);
                 $act = new stdClass();
                 $act->cmd = 'wall.write';
                 $act->actor = $kunena_my->id;
                 $act->target = 0;
                 // no target
                 $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . _KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1 . ' <a href="' . $JSPostLink . '">' . stripslashes($subject) . '</a> ' . _KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2);
                 $act->content = $content;
コード例 #9
0
ファイル: events.php プロジェクト: rkern21/videoeditor
    function onAfterVideoApproval($params)
    {
		global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename, $mainframe;
		$c = hwd_vs_Config::get_instance();
		$my = & JFactory::getUser();
  		$db =& JFactory::getDBO();

		JPluginHelper::importPlugin( 'system' );
		$dispatcher =& JDispatcher::getInstance();
		$results = $dispatcher->trigger( 'onAfterVideoApproval', array( $params ) );
		$results = $dispatcher->trigger( 'onAfterVideoUpload', array( $params ) );

		// perform maintenance
		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($params->category_id);

		// AUP 'new video' points
		$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
		if ( file_exists($api_AUP))
		{
			if (!isset($params->user_id))
			{
				$params->user_id = $my->id;
			}
			$db->SetQuery( 'SELECT referreid FROM #__alpha_userpoints WHERE userid = '.$params->user_id );
			$referreid = $db->loadResult();

			require_once ($api_AUP);
			AlphaUserPointsHelper::newpoints( 'plgaup_addVideo_hwdvs', $referreid );
		}

		// JomSocial activity stream
		if ($c->cbint == 2) {
			require_once( JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php' );
			require_once( JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'error.php' );

			$act = new stdClass();
			$act->cmd 	= 'video.upload';
			$act->actor 	= $params->user_id;
			$act->target 	= 0; // no target
			$act->content 	= '';
			$act->app 	= 'hwdvideoshare';
			$act->cid 	= $params->id;

			$single_video = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' {app} '._HWDVIDS_JS_AS3;
			$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' {count} '._HWDVIDS_JS_AS5.' {app} '._HWDVIDS_JS_AS4;

			$link = JRoute::_('index.php?option=com_hwdvideoshare&task=viewvideo&Itemid='.$Itemid.'&video_id='.$params->id);
			$title = stripslashes($params->title);

			//// Variation 1
			//$single_video    = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' <a href="'.$link.'">'._HWDVIDS_JS_AS3.'</a>';
			//$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' {count} <a href="'.$link.'">'._HWDVIDS_JS_AS4.'</a>';

			//// Variation 2
			//$single_video    = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' '._HWDVIDS_JS_AS3.' called <a href="'.$link.'">'.$title.'</a>';
			//$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' '._HWDVIDS_JS_AS3.' called <a href="'.$link.'">'.$title.'</a>';

			//// Variation 3
			//$single_video    = '{actor} has uploaded video <a href="'.$link.'">'.$title.'</a>';
			//$multiple_videos = '{actor} has uploaded video <a href="'.$link.'">'.$title.'</a>';

			// insert into activity stream
			$act->title 	= JText::_('{single}'.$single_video.'{/single}{multiple}'.$multiple_videos.'{/multiple}');
			$act->content 	= "{getActivityContentHTML}";

			CFactory::load('libraries', 'activities');
			CActivityStream::add($act);

			include_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php');
			CuserPoints::assignPoint('com_hwdvideoshare.onAfterVideoApproval', $my->id);

		}
	}