示例#1
1
 public function store($log = true)
 {
     // @rule: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $config = EasyBlogHelper::getConfig();
     $under_approval = false;
     if (isset($this->under_approval)) {
         $under_approval = true;
         // now we need to reset this variable from the blog object.
         unset($this->under_approval);
     }
     // @trigger: onBeforeSave
     $this->triggerBeforeSave();
     // @rule: Determine if this record is new or not.
     if (empty($this->isnew)) {
         $isNew = empty($this->id) ? true : false;
     } else {
         $isNew = true;
     }
     // @rule: Get the rulesets for this user.
     $acl = EasyBlogACLHelper::getRuleSet();
     // @rule: Process badword filters for title here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->title);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_TITLE_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Check for minimum words in the content if required.
     if ($config->get('main_post_min')) {
         $minimum = $config->get('main_post_length');
         $total = JString::strlen(strip_tags($this->intro . $this->content));
         if ($total < $minimum) {
             $this->setError(JText::sprintf('COM_EASYBLOG_CONTENT_LESS_THAN_MIN_LENGTH', $minimum));
             return false;
         }
     }
     // @rule: Check for invalid title
     if (empty($this->title) || $this->title == JText::_('COM_EASYBLOG_DASHBOARD_WRITE_DEFAULT_TITLE')) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'));
         return false;
     }
     // @rule: For edited blogs, ensure that they have permissions to edit it.
     if (!$isNew && $this->created_by != JFactory::getUser()->id && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
         if (!class_exists('EasyBlogModelTeamBlogs')) {
             jimport('joomla.application.component.model');
             JLoader::import('blog', EBLOG_ROOT . DIRECTORY_SEPARATOR . 'models');
         }
         // @task: Only throw error when this blog post is not a team blog post and it's not owned by the current logged in user.
         JModel::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models');
         $model = JModel::getInstance('TeamBlogs', 'EasyBlogModel');
         $contribution = $model->getBlogContributed($this->id);
         if (!$contribution || !$model->checkIsTeamAdmin(JFactory::getUser()->id, $contribution->team_id)) {
             $this->setError(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_BLOG'));
             return false;
         }
     }
     // @rule: Every blog post must be assigned to a category
     if (empty($this->category_id)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_CATEGORY_ERROR'));
         return false;
     }
     // Filter / strip contents that are not allowed
     $filterTags = EasyBlogHelper::getHelper('Acl')->getFilterTags();
     $filterAttributes = EasyBlogHelper::getHelper('Acl')->getFilterAttributes();
     // @rule: Apply filtering on contents
     jimport('joomla.filter.filterinput');
     $inputFilter = JFilterInput::getInstance($filterTags, $filterAttributes, 1, 1, 0);
     $inputFilter->tagBlacklist = $filterTags;
     $inputFilter->attrBlacklist = $filterAttributes;
     if (count($filterTags) > 0 && !empty($filterTags[0]) || count($filterAttributes) > 0 && !empty($filterAttributes[0])) {
         $this->intro = $inputFilter->clean($this->intro);
         $this->content = $inputFilter->clean($this->content);
     }
     // @rule: Process badword filters for content here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Test for the empty-ness
     if (empty($this->intro) && empty($this->content)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
     }
     // alway set this to false no matter what! TODO: remove this column.
     $this->ispending = '0';
     $state = parent::store();
     $source = JRequest::getVar('blog_contribute_source', 'easyblog');
     // @trigger: onBeforeSave
     $this->triggerAfterSave();
     // if this is blog edit, then we should see the column isnew to determine
     // whether the post is really new or not.
     if (!$isNew) {
         $isNew = $this->isnew;
     }
     // @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
     if ($config->get('main_autofeatured', 0) && EasyBlogHelper::isFeatured('blogger', $this->created_by) && !EasyBlogHelper::isFeatured('post', $this->id)) {
         EasyBlogHelper::makeFeatured('post', $this->id);
     }
     // @task: This is when the blog is either created or updated.
     if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $log) {
         // @rule: Add new stream item in jomsocial
         EasyBlogHelper::addJomSocialActivityBlog($this, $isNew);
         // @rule: Log new stream item into EasyBlog
         $activity = new stdClass();
         $activity->actor_id = $this->created_by;
         $activity->target_id = '0';
         $activity->context_type = 'post';
         $activity->context_id = $this->id;
         $activity->verb = $isNew ? 'add' : 'update';
         $activity->uuid = $this->title;
         EasyBlogHelper::activityLog($activity);
     }
     if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $isNew && $log) {
         // @rule: Send email notifications out to subscribers.
         $author = EasyBlogHelper::getTable('Profile');
         $author->load($this->created_by);
         // @rule: Ping pingomatic
         if ($config->get('main_pingomatic')) {
             if (!EasyBlogHelper::getHelper('Pingomatic')->ping($this->title, EasyBlogHelper::getExternalLink('index.php?option=com_easyblog&view=entry&id=' . $this->id, true))) {
                 EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_PINGOMATIC_ERROR'), 'error');
             }
         }
         // Assign EasySocial points
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         $easysocial->assignPoints('blog.create', $this->created_by);
         // @rule: Add userpoints for jomsocial
         if ($config->get('main_jomsocial_userpoint')) {
             $path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
             if (JFile::exists($path)) {
                 require_once $path;
                 CUserPoints::assignPoint('com_easyblog.blog.add', $this->created_by);
             }
         }
         $link = $this->getExternalBlogLink('index.php?option=com_easyblog&view=entry&id=' . $this->id);
         // @rule: Add notifications for jomsocial 2.6
         if ($config->get('integrations_jomsocial_notification_blog')) {
             // Get list of users who subscribed to this blog.
             $target = $this->getRegisteredSubscribers('new', array($this->created_by));
             EasyBlogHelper::getHelper('JomSocial')->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_BLOG', $author->getName(), $link, $this->title), 'easyblog_new_blog', $target, $this->created_by, $link);
         }
         // @rule: Mighty Touch karma points
         EasyBlogHelper::getHelper('MightyTouch')->setKarma($this->created_by, 'new_blog');
         // @rule: Integrations with EasyDiscuss
         EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.blog', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_BLOG', $this->title));
         EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.blog', $this->created_by);
         EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.blog', $this->created_by);
         // Assign badge for users that report blog post.
         // Only give points if the viewer is viewing another person's blog post.
         EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.create', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_CREATE_BLOG_POST'));
         if ($config->get('integrations_easydiscuss_notification_blog')) {
             // Get list of users who subscribed to this blog.
             $target = $this->getRegisteredSubscribers('new', array($this->created_by));
             EasyBlogHelper::getHelper('EasyDiscuss')->addNotification($this, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_BLOG', $author->getName(), $this->title), EBLOG_NOTIFICATIONS_TYPE_BLOG, $target, $this->created_by, $link);
         }
         $my = JFactory::getUser();
         // @rule: Add points for AlphaUserPoints
         if ($my->id == $this->created_by && EasyBlogHelper::isAUPEnabled()) {
             // get blog post URL
             $url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $this->id);
             $aupid = AlphaUserPointsHelper::getAnyUserReferreID($this->created_by);
             AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_blog', $aupid, 'easyblog_add_blog_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_BLOG_CREATED', $url, $this->title));
         }
         // @rule: Process trackbacks
         $this->processTrackbacks();
         // Update the isnew column so that if user edits this entry again, it doesn't send any notifications the second time.
         $this->isnew = 0;
         $this->store(false);
     }
     return $state;
 }
示例#2
0
 function save()
 {
     $model = $this->getModel('muzeededi');
     $db = $model->connectMuzeeli();
     $dedicace = JRequest::getVar('dedicace', '', '', 'string');
     $params =& JComponentHelper::getParams('com_muzeededi');
     $moderer_site = $params->get('moderer_site');
     $moderer = $moderer_site == "yes" ? "0" : "1";
     $q_dedicace = $db->Quote($dedicace);
     $query = "INSERT INTO #__muzeededi (id,dedicace,moderer) VALUES ('',{$q_dedicace},'{$moderer}')";
     $test = $db->SetQuery($query);
     $test2 = $db->query();
     $msg = "";
     if ($test2 === true) {
         //point alphauserpoints
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP)) {
             require_once $api_AUP;
             AlphaUserPointsHelper::newpoints('plgaup_muzeededi', '', '', 'Dédicace');
         }
         //fin alphauserpoints
         if ($moderer == "0") {
             $msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_ENREGISTREE");
         } else {
             $texte = $model->getDedicaces($db);
             $creer_txt = $model->creerFichier($texte);
             $msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_PUBLIE");
         }
         $mail = $this->alerteMail($dedicace, $moderer);
     } else {
         $msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_ERREUR");
     }
     $link = 'index.php?option=com_muzeededi';
     $this->setRedirect($link, $msg);
 }
示例#3
0
 function remove()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('comment');
     $comments = JRequest::getVar('cid', '', 'POST');
     $message = '';
     $type = 'message';
     if (empty($comments)) {
         $message = JText::_('Invalid comment id');
         $type = 'error';
     } else {
         $table = EasyBlogHelper::getTable('Comment', 'Table');
         foreach ($comments as $comment) {
             $table->load($comment);
             // AlphaUserPoints
             // since 1.2
             if (!empty($table->created_by) && EasyBlogHelper::isAUPEnabled()) {
                 $aupid = AlphaUserPointsHelper::getAnyUserReferreID($table->created_by);
                 AlphaUserPointsHelper::newpoints('plgaup_easyblog_delete_comment', $aupid, '', JText::_('COM_EASYBLOG_AUP_COMMENT_DELETED'));
             }
             if (!$table->delete()) {
                 $message = JText::_('COM_EASYBLOG_COMMENTS_COMMENT_REMOVE_ERROR');
                 $type = 'error';
                 $this->setRedirect('index.php?option=com_easyblog&view=comments', $message, $type);
                 return;
             }
             $message = JText::_('COM_EASYBLOG_COMMENTS_COMMENT_REMOVED');
         }
     }
     $this->setRedirect('index.php?option=com_easyblog&view=comments', $message, $type);
 }
示例#4
0
 public function assign($cmd, $msg, $cmdSingle, $text)
 {
     if (!$this->enabled()) {
         return false;
     }
     $state = AlphaUserPointsHelper::newpoints($cmd, $msg, $cmdSingle, $text);
     return $state;
 }
 function refundDeal($user_id, $point)
 {
     $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     require_once $api_AUP;
     $aupid = AlphaUserPointsHelper::getAnyUserReferreID($user_id);
     if ($aupid) {
         AlphaUserPointsHelper::newpoints('plgaup_com_enmasse_refund_by_point', $aupid, '', '', $point);
     }
 }
示例#6
0
 public static function checkcoupon($params, $coupon)
 {
     $app = JFactory::getApplication();
     // check if user is logged in
     $user = JFactory::getUser();
     if (!$user->id) {
         echo "<script> alert('" . JText::_('MODAUP_CP_YOU_MUST_BE_LOGGED') . "'); </script>";
         return;
     }
     // insert API AlphaUserPoint
     $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     if (file_exists($api_AUP)) {
         require_once $api_AUP;
         $db = JFactory::getDBO();
         $nullDate = $db->getNullDate();
         $date = JFactory::getDate();
         $now = $date->toSql();
         $query = "SELECT * FROM #__alpha_userpoints_coupons WHERE `couponcode`='{$coupon}' AND (`expires`>='{$now}' OR `expires`='0000-00-00 00:00:00')";
         $db->setQuery($query);
         $result = $db->loadObjectList();
         if ($result) {
             $resultCouponExist = 0;
             // active user
             $referrerid = @$_SESSION['referrerid'];
             // check if public or private coupon
             if (!$result[0]->public) {
                 // private -> usable once per one user
                 $query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$coupon}'";
                 $db->setQuery($query);
                 $resultCouponExist = $db->loadResult();
                 if (!$resultCouponExist) {
                     // insert points
                     AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $result[0]->couponcode, $result[0]->description, $result[0]->points);
                 } else {
                     $app->enqueueMessage(JText::_('MODAUP_CP_THIS_COUPON_WAS_ALREADY_USED'));
                 }
             } elseif ($result[0]->public) {
                 // public -> usable once per all users
                 $keyreference = $coupon . "##" . $user->id;
                 $query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$keyreference}'";
                 $db->setQuery($query);
                 $resultCouponExist = $db->loadResult();
                 if (!$resultCouponExist) {
                     // insert points
                     AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $keyreference, $result[0]->description, $result[0]->points);
                 } else {
                     $app->enqueueMessage(JText::_('MODAUP_CP_THIS_COUPON_WAS_ALREADY_USED'));
                 }
             }
         } else {
             $app->enqueueMessage(JText::_('MODAUP_CP_PLEASE_CHECK_YOUR_COUPON'));
             return;
         }
     }
 }
 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;
                     }
                 }
             }
         }
     }
 }
示例#8
0
 function onAfterVote($poll, $option_id)
 {
     $user =& JFactory::getUser();
     $aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
     if ($this->params->get('points', '0') == '1' && file_exists($aup)) {
         require_once $aup;
         $aup_id = AlphaUserPointsHelper::getAnyUserReferreID($user->id);
         if ($aup_id) {
             AlphaUserPointsHelper::newpoints('sysplgaup_votepoll', $aup_id, '', JText::_('COM_MIJOPOLLS_CAST_VOTE_AUP') . ' ' . $poll->id, $this->params->get('points_value', '0'), true);
         }
     }
 }
示例#9
0
 public function awardPoints($userId, $name, $args)
 {
     require_once $this->_componentFile;
     $key = $args->get('key', '');
     $name = str_replace(".", "_", $name);
     $name = 'plgaup_jfbconnect_' . $name;
     $keyreference = AlphaUserPointsHelper::buildKeyreference($name, $key);
     // get the current user's Referrerid always, for now.
     $profile = AlphaUserPointsHelper::getUserInfo('', $userId);
     $referrerId = $profile->referreid;
     $return = AlphaUserPointsHelper::newpoints($name, $referrerId, $keyreference);
 }
示例#10
0
 public function assign($rule, $userId, $title)
 {
     if (!$this->exists || !isset($this->rules[$rule])) {
         return false;
     }
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     // TODO: Fixed strict standard issue.
     $aup = new AlphaUserPointsHelper();
     $id = $aup->getAnyUserReferreID($userId);
     //$id	= AlphaUserPointsHelper::getAnyUserReferreID( $userId );
     $rule = $this->rules[$rule];
     $aup->newpoints('plgaup_easydiscuss_' . strtolower($rule), $id, '', JText::sprintf('COM_EASYDISCUSS_AUP_' . strtoupper($rule), $title));
 }
示例#11
0
 public function vote($value, $uid, $type, $elementId)
 {
     $ajax = new Ejax();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->load($uid);
     if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
         if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
             echo 'Invalid Access.';
             exit;
         }
     }
     $rating = EasyBlogHelper::getTable('Ratings', 'Table');
     // Do not allow guest to vote, or if the voter already voted.
     if ($rating->fill($my->id, $uid, $type, JFactory::getSession()->getId()) || $my->id < 1 && !$config->get('main_ratings_guests')) {
         // We wouldn't allow user to vote more than once so don't do anything here
         $ajax->send();
     }
     $rating->set('created_by', $my->id);
     $rating->set('type', $type);
     $rating->set('uid', $uid);
     $rating->set('ip', @$_SERVER['REMOTE_ADDR']);
     $rating->set('value', (int) $value);
     $rating->set('sessionid', JFactory::getSession()->getId());
     $rating->set('created', EasyBlogHelper::getDate()->toMySQL());
     $rating->set('published', 1);
     $rating->store();
     $model = EasyBlogHelper::getModel('Ratings');
     $ratingValue = $model->getRatingValues($uid, $type);
     $total = $ratingValue->total;
     $rating = $ratingValue->ratings;
     // Assign badge for users that report blog post.
     // Only give points if the viewer is viewing another person's blog post.
     EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
     $ajax->script('eblog.loader.doneLoading("' . $elementId . '-command .ratings-text")');
     $ajax->script('eblog.ratings.update("' . $elementId . '", "' . $type . '" , "' . $rating . '" , "' . JText::_('COM_EASYBLOG_RATINGS_RATED_THANK_YOU') . '");');
     $ajax->assign($elementId . ' .ratings-value', '<i></i>' . $total . '<b>&radic;</b>');
     if (EasyBlogHelper::isAUPEnabled()) {
         $id = AlphaUserPointsHelper::getAnyUserReferreID($my->id);
         AlphaUserPointsHelper::newpoints('plgaup_easyblog_rate_blog', $id, '', JText::sprintf('COM_EASYBLOG_AUP_BLOG_RATED'), '');
     }
     $ajax->send();
 }
示例#12
0
	public function onAfterThankyou($actor, $target, $message) {
		$infoTargetUser = JText::_('COM_KUNENA_THANKYOU_GOT_FROM').': ' . KunenaFactory::getUser($actor)->username;
		$infoRootUser = JText::_('COM_KUNENA_THANKYOU_SAID_TO').': ' . KunenaFactory::getUser($target)->username;
		if ($this->_checkPermissions($message)) {
			$aupactor = AlphaUserPointsHelper::getAnyUserReferreID($actor);
			$auptarget = AlphaUserPointsHelper::getAnyUserReferreID($target);

			$ruleName = 'plgaup_kunena_message_thankyou';

			$usertargetpoints = intval($this->_getPointsOnThankyou($ruleName));

			if ( $usertargetpoints && $this->_checkRuleEnabled($ruleName) ) {
				// for target user
				if ($auptarget) AlphaUserPointsHelper::newpoints($ruleName , $auptarget, '', $infoTargetUser, $usertargetpoints);
				// for who has gived the thank you
				if ($aupactor) AlphaUserPointsHelper::newpoints($ruleName , $aupactor, '', $infoRootUser );
			}
		}
	}
示例#13
0
 function save()
 {
     $model = $this->getModel('mzpromoradio');
     $db = $model->connectMuzeeli();
     $nom = JRequest::getVar('nom', '', '', 'string');
     $description = JRequest::getVar('description', '', '', 'string');
     $uid = JRequest::getVar('uid', '', '', 'string');
     $nom_site = JRequest::getVar('nom_site', '', '', 'string');
     $lien_site = JRequest::getVar('lien_site', '', '', 'string');
     $id_user = JRequest::getVar('id_abonnes', '', '', 'int');
     $flux = JREQUEST::getVar('flux', '', '', 'flux');
     //$params = &JComponentHelper::getParams( 'com_muzeededi' );
     $q_nom = $db->Quote(htmlspecialchars($nom));
     $q_description = $db->Quote(htmlspecialchars($description));
     $q_uid = $db->Quote(htmlspecialchars($uid));
     $q_nom_site = $db->Quote(htmlspecialchars($nom_site));
     $q_lien_site = $db->Quote(htmlspecialchars($lien_site));
     $q_flux = $db->Quote(htmlspecialchars($flux));
     $query = "INSERT INTO #__mzpromoradio (id,nom,description,uid,nom_site,lien_site,id_user,flux) VALUES ('',{$q_nom},{$q_description},{$q_uid},{$q_nom_site},{$q_lien_site},'{$id_user}',{$q_flux})";
     $test = $db->SetQuery($query);
     $test2 = $db->query();
     $msg = "";
     if ($test2 === true) {
         //point alphauserpoints
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP)) {
             require_once $api_AUP;
             AlphaUserPointsHelper::newpoints('plgaup_mzpromoradio', '', $uid, 'Promo Radio');
         }
         //fin alphauserpoints
         $mail = $this->alerteMail($nom);
         $msg = JTEXT::_("COM_MZPROMORADIO_PROMO_ENREGISTREE");
     } else {
         $msg = JTEXT::_("COM_MZPROMORADIO_PROMO_ERREUR");
     }
     $link = 'index.php?option=com_mzpromoradio';
     $this->setRedirect($link, $msg);
 }
示例#14
0
 /**
  * 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;
     }
 }
示例#15
0
	public function onAfterThankyou($target, $actor, $message) {
		$infoTargetUser = (JText::_ ( 'COM_KUNENA_THANKYOU_GOT' ).': ' . KunenaFactory::getUser($target)->username );
		$infoRootUser = ( JText::_ ( 'COM_KUNENA_THANKYOU_SAID' ).': ' . KunenaFactory::getUser($actor)->username );
		$category = $message->getCategory();
		if ($category->pub_access == 0 || $category->pub_access == - 1) {
			$auptarget = AlphaUserPointsHelper::getAnyUserReferreID( $target );
			$aupactor = AlphaUserPointsHelper::getAnyUserReferreID( $actor );

			if ( $this->_getAUPversion() < '1.5.12' ) {
				$ruleName = 'plgaup_thankyou_kunena';
				$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( $ruleName );
				$usertargetpoints = intval($ruleEnabled[0]->content_items);
			} elseif ( $this->_getAUPversion() >= '1.5.12' ) {
				$ruleName = 'plgaup_kunena_message_thankyou';
				$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( $ruleName );
				$usertargetpoints = intval($ruleEnabled[0]->content_items);
			} else {
				return;
			}

			if ( $usertargetpoints && $ruleEnabled ) {
				// for target user
				if ($auptarget) AlphaUserPointsHelper::newpoints($ruleName , $auptarget, '', $infoTargetUser, $usertargetpoints);
				// for who has gived the thank you
				if ($aupactor) AlphaUserPointsHelper::newpoints($ruleName , $aupactor, '', $infoRootUser );
			}
		}
	}
示例#16
0
 function save_vote()
 {
     //receive datas and saves it
     $model = $this->getModel('muzeetop');
     $db = $model->connectMuzeeli();
     $app =& JFactory::getApplication('site');
     $params =& $app->getParams('com_muzeetop');
     $delai = $params->get('delai');
     $id_utilisateur = $model->getUserId();
     $remote_addr = $_SERVER['REMOTE_ADDR'];
     $id = JRequest::getVar('id', 0, '', 'int');
     $artiste = JRequest::getVar('artiste', '', '', 'string');
     $chanson = JRequest::getVar('chanson', '', '', 'string');
     $mp3 = JRequest::getVar('mp3', '', 'POST', 'string');
     $website = JRequest::getVar('website', '', 'POST', 'string');
     $vote = JRequest::getVar('vote', 0, '', 'string');
     $id_categorie = JRequest::getVar('categorie', '', '', 'int');
     $Itemid = JRequest::getVar('Itemid', '', '', 'int');
     //transforme "plus" and "moins" with values to add to number of points
     switch ($vote) {
         case "plus":
             $add = 1;
             break;
         case "moins":
             $add = -1;
             break;
         default:
             $add = 0;
     }
     if ($id == 0 or $id == "") {
         $id = 0;
         $id = $this->chercheTop($db, $artiste, $chanson, $id_categorie);
         if ($id == 0) {
             $id = $this->ajouteTop($db, $artiste, $chanson, $mp3, $website, $id_categorie);
         }
     }
     $app =& JFactory::getApplication('site');
     $params =& $app->getParams('com_muzeetop');
     $nb_vote_possible = $params->get('nb_vote_possible');
     $nb_vote_possible_connecte = $params->get('nb_vote_possible_connecte');
     $type_vote = $params->get('type_vote');
     $nb_vote = $this->verifVotant($db, $remote_addr, $id_utilisateur, $id, $type_vote, $id_categorie, $delai);
     //$votant=$votant[0];
     if ($id_utilisateur == 0 && $nb_vote < $nb_vote_possible && $id != 0 or $id_utilisateur != 0 && $nb_vote < $nb_vote_possible_connecte && $id != 0 or $nb_vote == 0 && $id != 0) {
         $nb_vote_idtop = $this->getNbVote($db, $id);
         if ($nb_vote_idtop == 0 && $vote == "moins") {
             $msg = JTEXT::_('COM_MUZEETOP_MINIMUM');
         } else {
             $ajout_votant = $this->ajouteVotant($db, $remote_addr, $id_utilisateur, $nb_vote, $id, $add);
             $test = $this->voteTop($db, $id, $vote);
             //point alphauserpoints
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 AlphaUserPointsHelper::newpoints('plgaup_muzeetop', '', '', 'Vote muzeeTop');
             }
             //fin alphauserpoints
             $msg = JTEXT::_("COM_MUZEETOP_VOTE_COMPTABILISE");
         }
     } else {
         $msg = $id == 0 ? JTEXT::_('COM_MUZEETOP_ERREUR_VOTE_IMPOSSIBLE') : JTEXT::_("COM_MUZEETOP_VOTE_IMPOSSIBLE");
     }
     $link = 'index.php?option=com_muzeetop&Itemid=' . $Itemid . '&categorie=' . $id_categorie;
     $this->setRedirect($link, $msg);
 }
示例#17
0
<?php

/** simple alpha user points scritp to award points when submitting a form */
$api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
if (JFile::exists($api_AUP)) {
    require_once $api_AUP;
    AlphaUserPointsHelper::newpoints('plgaup_fabrik_points');
}
示例#18
0
 public static function updateUserPoints($result, $referrerid, $assignpoints, $now, $referraluserpoints, $autoapproved, $rule_plugin = '', $rule_id = '', $rule_name = '', $datareference = '', $frontmessage = '')
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     $user = JFactory::getUser();
     $username = $user->id ? $user->username : '';
     $displaymsg = $result->displaymsg;
     $msg = str_replace('{username}', $username, $result->msg);
     $method = $result->method;
     $db = JFactory::getDBO();
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $query = "SELECT id FROM #__alpha_userpoints WHERE `referreid`='{$referrerid}'";
     $db->setQuery($query);
     $referrerUser = $db->loadResult();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables');
     $row = JTable::getInstance('userspoints');
     // update points into alpha_userpoints table
     $row->load(intval($referrerUser));
     $referraluser = $row->referraluser;
     $newtotal = !$referraluserpoints ? $row->points + $assignpoints : $row->points + $referraluserpoints;
     $row->last_update = $now;
     $checkWinner = 0;
     if ($row->max_points >= 1 && $newtotal > $row->max_points) {
         // Max total was reached !
         //$newtotal = $row->max_points;
         if (AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_winnernotification', 0, $referrerid)) {
             // get email admins in rule
             $query = "SELECT `content_items` FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_winnernotification'";
             $db->setQuery($query);
             $emailadmins = $db->loadResult();
             if ($autoapproved || $referraluserpoints) {
                 AlphaUserPointsHelper::sendwinnernotification($referrerid, $assignpoints, $newtotal, $emailadmins);
                 // Uddeim notification integration
                 if ($params->get('sendMsgUddeim', 0)) {
                     AlphaUserPointsHelper::sendUddeimWinnerNotification($referrerid, $assignpoints, $newtotal);
                 }
                 $checkWinner = 1;
             }
         }
     }
     if ($autoapproved) {
         if ($rule_plugin == 'sysplgaup_invitewithsuccess') {
             $row->referrees = $row->referrees + 1;
         }
         $row->points = $newtotal;
         $db->updateObject('#__alpha_userpoints', $row, 'id');
     }
     if ($displaymsg && !$referraluserpoints) {
         $realcurrentreferrerid = AlphaUserPointsHelper::getAnyUserReferreID($user->id);
         switch ($rule_plugin) {
             case 'sysplgaup_bonuspoints':
             case 'sysplgaup_recommend':
             case 'sysplgaup_reader2author':
             case 'sysplgaup_buypointswithpaypal':
             case 'sysplgaup_invite':
                 // No need congratulation...
                 break;
             case 'sysplgaup_invitewithsuccess':
                 // number points in message = assign points to new user
                 $numpoints = AlphaUserPointsHelper::getPointsRule('sysplgaup_newregistered');
                 if ($numpoints && $user->id) {
                     if ($msg != '') {
                         $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($numpoints), JText::_($msg));
                         $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                         $app->enqueueMessage($msg);
                     } else {
                         $app->enqueueMessage(sprintf(JText::_('AUP_CONGRATULATION'), AlphaUserPointsHelper::getFPoints($numpoints)));
                     }
                 }
                 break;
             default:
                 if ($referrerid == $realcurrentreferrerid && $user->id) {
                     if ($assignpoints > 0) {
                         if ($msg != '') {
                             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($assignpoints), JText::_($msg));
                             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                             $app->enqueueMessage($msg);
                         } else {
                             $app->enqueueMessage(sprintf(JText::_('AUP_CONGRATULATION'), AlphaUserPointsHelper::getFPoints($assignpoints)));
                             if ($rule_plugin == 'sysplgaup_happybirthday') {
                                 $frontmessage = JText::_('AUP_HAPPYBIRTHDAY');
                             }
                         }
                     } elseif ($assignpoints < 0) {
                         if ($msg != '') {
                             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints(abs($assignpoints)), JText::_($msg));
                             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                             $app->enqueueMessage($msg);
                         } else {
                             $app->enqueueMessage(sprintf(JText::_('AUP_X_POINTS_HAS_BEEN_DEDUCTED_FROM_YOUR_ACCOUNT'), AlphaUserPointsHelper::getFPoints(abs($assignpoints))));
                         }
                     }
                 }
         }
     }
     if ($rule_plugin == 'sysplgaup_custom' && $datareference) {
         $rule_name = JText::_($datareference);
     }
     // email notification
     if ($result->notification && !$checkWinner) {
         $result->datareference = JText::_($datareference);
         AlphaUserPointsHelper::sendnotification($referrerid, $assignpoints, $newtotal, $result);
         // load external plugins
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('alphauserpoints');
         $results = $dispatcher->trigger('onSendNotificationAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $newtotal, $referrerid, $user->id));
     }
     // Uddeim notification integration
     if ($params->get('sendMsgUddeim', 0) && !$checkWinner) {
         AlphaUserPointsHelper::sendUddeimNotification($referrerid, $assignpoints, $newtotal, $rule_name);
     }
     // load external plugins
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('alphauserpoints');
     $results = $dispatcher->trigger('onUpdateAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $referrerid, $user->id));
     // checking rank and medals and update if necessary
     if ($rule_id == '') {
         $rule_id = AlphaUserPointsHelper::getRuleID($rule_plugin);
     }
     AlphaUserPointsHelper::checkRankMedal($referrerid, $rule_id);
     // referral points rule
     if ($referraluser != '' && $rule_plugin != 'sysplgaup_buypointswithpaypal' && $rule_plugin != 'sysplgaup_raffle' && $assignpoints > 0) {
         // if not already assigned
         $query = "SELECT * FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_referralpoints' AND `published`='1' AND (`rule_expire`>'{$now}' OR `rule_expire`='0000-00-00 00:00:00')";
         $db->setQuery($query);
         $referralpoints = $db->loadObjectList();
         if ($referralpoints) {
             $referraluserpoints = round($assignpoints * $referralpoints[0]->points / 100, 2);
             if ($referraluserpoints > 0) {
                 AlphaUserPointsHelper::userpoints('sysplgaup_referralpoints', $referraluser, $referraluserpoints);
             }
         }
     }
     // check change user group rule
     //if ( $rule_plugin!='sysplgaup_changelevel1' && $rule_plugin!='sysplgaup_changelevel2' && $rule_plugin!='sysplgaup_changelevel3' )
     //{
     AlphaUserPointsHelper::checkChangeLevel($referrerid, AlphaUserPointsHelper::getCurrentTotalPoints($referrerid));
     //}
     if ($frontmessage != '') {
         AlphaUserPointsHelper::displayMessageSystem($frontmessage);
     }
     // load external plugins
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('alphauserpoints');
     $results = $dispatcher->trigger('onAfterUpdateAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $referrerid, $user->id));
     // link up rule
     if ($result->linkup) {
         $plugin_function_linkup = AlphaUserPointsHelper::getPluginFunction($result->linkup);
         AlphaUserPointsHelper::newpoints($plugin_function_linkup, $referrerid);
     }
 }
示例#19
0
 public static function addAUP($plugin_function = '', $referrerid = '', $keyreference = '', $datareference = '')
 {
     $my = JFactory::getUser();
     if (!empty($referrerid)) {
         $my = JFactory::getUser($referrerid);
     }
     if ($my->id != 0) {
         $aup = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_alphauserpoints' . DIRECTORY_SEPARATOR . 'helper.php';
         if (JFile::exists($aup)) {
             require_once $aup;
             AlphaUserPointsHelper::newpoints($plugin_function, AlphaUserPointsHelper::getAnyUserReferreID($referrerid), $keyreference, $datareference);
         }
     }
 }
示例#20
0
 /**
  * Assign points to the file uploader when a user download his file and use the price field  
  * 
  * @param mixed $files
  */
 public static function setAUPPointsDownloaderToUploaderPrice($files)
 {
     $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     if (file_exists($api_AUP)) {
         require_once $api_AUP;
         foreach ($files as $file) {
             if ($file->submitted_by) {
                 $referreid = AlphaUserPointsHelper::getAnyUserReferreID((int) $file->submitted_by);
                 if ($referreid) {
                     $key_reference = AlphaUserPointsHelper::buildKeyreference('plgaup_jdownloads_downloader_to_uploader_use_price', $file->file_id, (int) $file->submitted_by);
                     $rule_id = AlphaUserPointsHelper::getRuleID('plgaup_jdownloads_downloader_to_uploader_use_price');
                     $check_aup_reference = AlphaUserPointsHelper::checkReference($referreid, $key_reference, $rule_id);
                     // check the method when a prior download process is found
                     if ($check_aup_reference > 0) {
                         $method = (int) AlphaUserPointsHelper::getMethod('plgaup_jdownloads_downloader_to_uploader_use_price');
                         switch ($method) {
                             case 1:
                                 // ONCE PER USER
                                 // has already payed
                                 return;
                                 break;
                             case '2':
                                 // ONCE PER DAY AND PER USER'
                                 return;
                                 break;
                             case '3':
                                 // ONCE A DAY FOR A SINGLE USER ON ALL USERS
                                 return;
                                 break;
                             case '5':
                                 // ONCE PER USER PER WEEK
                                 return;
                                 break;
                             case '6':
                                 // ONCE PER USER PER MONTH
                                 return;
                                 break;
                             case '7':
                                 // ONCE PER USER PER YEAR
                                 return;
                                 break;
                                 /*
                                 case '4':       // WHENEVER
                                 case '0':
                                 default:                            
                                     // points must be payed always
                                 */
                         }
                     }
                     $text = JText::_('COM_JDOWNLOADS_BACKEND_SET_AUP_DOWNLOAD_TEXT');
                     $text = sprintf($text, $file->file_title);
                     $price = floatval($file->price);
                     AlphaUserPointsHelper::newpoints('plgaup_jdownloads_downloader_to_uploader_use_price', $referreid, $key_reference, $text, '+' . $price, $text);
                 }
             }
         }
     }
 }
 public function onPurchase($args = null, $user = null, $status = null)
 {
     // Split up the arguments
     $args = explode(';', $args);
     $rule = $args[0];
     $points = $args[1];
     $sku = $args[2];
     $aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
     if (file_exists($aup)) {
         require_once $aup;
         $aupid = AlphaUserPointsHelper::getAnyUserReferreID($user->id);
         if ($aupid) {
             AlphaUserPointsHelper::newpoints($rule, $aupid, $sku, null, $points);
         }
     }
     return true;
 }
示例#22
0
	function addphotowalllike()
	{
		$db		=& JFactory :: getDBO();
		$user =& JFactory::getUser();
		$photoid=$_REQUEST['photoID'];
		$uid=$_REQUEST['uID'];
		$sql="select count(*) from #__awd_jomalbum_photo_wall_like  where photoid=".$photoid." and userid=".$uid;
		//echo $sql;exit;
		$db->setQuery($sql);
		$totRec=$db->loadResult();
		if($totRec==0)
		{		
			$sql="insert into #__awd_jomalbum_photo_wall_like(photoid,userid) values($photoid,$uid)";
			$db->setQuery($sql);
			if (!$db->query()) {
			return JError::raiseWarning( 500, $db->getError() );
			}	
			
				// AUP POINTS
				$query='select wall_id from #__awd_wall_images where id='.$photoid;
				$db->setQuery($query);
				$wall_id = $db->loadResult();
				$query='select commenter_id from #__awd_wall where id='.$wall_id.' and wall_date IS NOT NULL';
				$db->setQuery($query);
				$commenter_id = $db->loadResult();
				if($commenter_id!=$user->id)
				{
					$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
					if ( file_exists($api_AUP)){				
						require_once ($api_AUP);
						
				$keyreference  = AlphaUserPointsHelper::buildKeyreference('plgaup_points4jomwallphotolike', $photoid );
				 AlphaUserPointsHelper::newpoints('plgaup_points4jomwallphotolike','', $keyreference);
						 
						 }
				}
			
		}
		
		
		$sql="select * from #__awd_jomalbum_photo_wall_like where photoid=".$photoid." order by id desc Limit 5";
		$db->setQuery($sql);
		$rows=$db->loadObjectList();
	
		$sql="select count(*) from #__awd_jomalbum_photo_wall_like where photoid=".$photoid;
		$db->setQuery($sql);
		$totLike=$db->loadResult();
		
		$link='index.php?option=com_awdwall&controller=colors';
		$db->setQuery("SELECT params FROM #__menu WHERE `link`='".$link."'");
		$params = json_decode( $db->loadResult(), true );
		for($i=1; $i<=14; $i++)
		{
			$str_color = 'color'.$i;			
			$color[$i]= $params[$str_color];
		}
		?>
		<div style="background-color:#<?php echo $color[12];?>;margin-bottom:5px;">
		<?php 
		$user =& JFactory::getUser();
		?>
		<div style="width:100%; text-align:left;padding-bottom:3px;"><span  class="likespan"><?php echo $totLike.'&nbsp;'.JText::_('People like this photo');?></span></div>
		<?php
		foreach($rows as $row)
		{
		$userprofileLinkAWDCUser=JRoute::_('index.php?option=com_awdwall&view=awdwall&layout=mywall&wuid='.$row->userid.'&Itemid='.AwdwallHelperUser::getComItemId());
				 $values=getCurrentUserDetails($row->userid);  
				 $avatarTable=$values[2];
				 $userprofileLinkCUser=$values[1];
			
			$values1=getUserDetails($row->userid,$avatarTable,$user->id); 
			$imgPath1=$values1[0];
			 
			?>
			<a href="<?php echo $userprofileLinkCUser; ?>" style="padding-right:5px;"><img  src="<?php echo $imgPath1; ?>" height="32" width="32" border="0"/></a>
			<?php
		}
		
		?></div><?php
		exit;
		}
示例#23
0
 function _plgReviewAfterSave(&$model)
 {
     $review = $this->_getReview($model);
     // Treat moderated reviews as new
     $this->inAdmin and Sanitize::getBool($model->data, 'moderation') and $model->isNew = true;
     if (isset($model->isNew) && $model->isNew && $review['Review']['published'] == 1) {
         // Begin add points
         $aupid = AlphaUserPointsHelper::getAnyUserReferreID($review['User']['user_id']);
         if ($aupid) {
             AlphaUserPointsHelper::newpoints('plgaup_jreviews_review_add', $aupid);
         }
     }
 }
示例#24
0
 public function store($updateNulls = false)
 {
     if (!empty($this->created)) {
         $offset = EasyBlogDateHelper::getOffSet();
         $newDate = EasyBlogHelper::getDate($this->created, $offset);
         $this->created = $newDate->toMySQL();
     } else {
         $newDate = EasyBlogHelper::getDate();
         $this->created = $newDate->toMySQL();
     }
     $my = JFactory::getUser();
     // Add point integrations for new categories
     if ($this->id == 0 && $my->id > 0) {
         JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
         $config = EasyBlogHelper::getConfig();
         // @rule: Integrations with EasyDiscuss
         EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.category', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_CATEGORY', $this->title));
         EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.category', $my->id);
         EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.category', $my->id);
         // @since 1.2
         // AlphaUserPoints
         if (EasyBlogHelper::isAUPEnabled()) {
             AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_category', '', 'easyblog_add_category_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_CATEGORY_CREATED', $this->title));
         }
         if ($config->get('main_jomsocial_userpoint')) {
             $path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
             if (JFile::exists($path)) {
                 require_once $path;
                 CUserPoints::assignPoint('com_easyblog.category.add', $my->id);
             }
         }
         // Assign EasySocial points
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         $easysocial->assignPoints('category.create', $my->id);
     }
     // Figure out the proper nested set model
     if ($this->id == 0 && $this->lft == 0) {
         // No parent id, we use the current lft,rgt
         if ($this->parent_id) {
             $left = $this->getLeft($this->parent_id);
             $this->lft = $left;
             $this->rgt = $this->lft + 1;
             // Update parent's right
             $this->updateRight($left);
             $this->updateLeft($left);
         } else {
             $this->lft = $this->getLeft() + 1;
             $this->rgt = $this->lft + 1;
         }
     }
     $isNew = empty($this->id) ? true : false;
     $return = parent::store();
     //activity logging.
     $activity = new stdClass();
     $activity->actor_id = $my->id;
     $activity->target_id = '0';
     $activity->context_type = 'category';
     $activity->context_id = $this->id;
     $activity->verb = $isNew ? 'add' : 'update';
     $activity->uuid = $this->title;
     EasyBlogHelper::activityLog($activity);
     return $return;
 }
示例#25
0
文件: xmlrpc.php 项目: Tommar/vino2
 public static function editPost($postid, $username, $password, $content, $publish)
 {
     $mainframe = JFactory::getApplication();
     global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
     EasyBlogXMLRPCHelper::loginUser($username, $password);
     jimport('joomla.application.component.model');
     $my = JFactory::getUser($username);
     $acl = EasyBlogACLHelper::getRuleSet($my->id);
     if (empty($my->id)) {
         return new xmlrpcresp(0, $xmlrpcerruser + 1, JText::_('NO PERMISSION TO CREATE BLOG'));
     }
     if (empty($acl->rules->add_entry)) {
         return new xmlrpcresp(0, $xmlrpcerruser + 1, JText::_('NO PERMISSION TO CREATE BLOG'));
     }
     $isNew = true;
     // create a new blog jtable object
     $isDraft = false;
     $blog = '';
     if (empty($acl->rules->publish_entry)) {
         // Try to load this draft to see if it exists
         $blog = EasyBlogHelper::getTable('Draft');
         $isDraft = true;
     } else {
         $blog = EasyBlogHelper::getTable('Blog', 'Table');
     }
     if (isset($postid) && !empty($postid)) {
         $isNew = false;
         //we are doing editing
         $blog->load($postid);
     }
     //prepare initial blog settings.
     $config = EasyBlogHelper::getConfig();
     $isPrivate = $config->get('main_blogprivacy', '0');
     $allowComment = $config->get('main_comment', 1);
     $allowSubscribe = $config->get('main_subscription', 1);
     $showFrontpage = $config->get('main_newblogonfrontpage', 0);
     $sendEmails = $config->get('main_sendemailnotifications', 1);
     //check if user have permission to enable privacy.
     $aclBlogPrivacy = $acl->rules->enable_privacy;
     $isPrivate = empty($aclBlogPrivacy) ? '0' : $isPrivate;
     $showFrontpage = empty($acl->rules->contribute_frontpage) ? '0' : $showFrontpage;
     /**
      * Map the data input into blog's recognised data format
      */
     $post = array();
     $post['permalink'] = $blog->permalink;
     if (isset($content["wp_slug"])) {
         $post['permalink'] = $content["wp_slug"];
     }
     //check if comment is allow on this blog
     if (isset($content["mt_allow_comments"])) {
         if (!is_numeric($content["mt_allow_comments"])) {
             switch ($content["mt_allow_comments"]) {
                 case "closed":
                     $post['allowcomment'] = 0;
                     break;
                 case "open":
                     $post['allowcomment'] = 1;
                     break;
                 default:
                     $post['allowcomment'] = $allowComment;
                     break;
             }
         } else {
             switch ((int) $content["mt_allow_comments"]) {
                 case 0:
                 case 2:
                     $post['allowcomment'] = 0;
                     break;
                 case 1:
                     $post['allowcomment'] = 1;
                     break;
                 default:
                     $post['allowcomment'] = $allowComment;
                     break;
             }
         }
     }
     //end if allowcomment
     $post['title'] = $content['title'];
     $post['intro'] = '';
     $post['content'] = '';
     if (isset($content['mt_text_more']) && $content['mt_text_more']) {
         $post['intro'] = $content['description'];
         $post['content'] = $content['mt_text_more'];
     } else {
         if (isset($content['more_text']) && $content['more_text']) {
             $post['intro'] = $content['description'];
             $post['content'] = $content['more_text'];
         } else {
             $post['content'] = $content['description'];
         }
     }
     // if introtext still empty and excerpt is provide, then we use it.
     if (empty($post['intro']) && isset($content['mt_excerpt'])) {
         $post['intro'] = $content['mt_excerpt'];
     }
     //set category
     if (isset($content['categories'])) {
         $categoryTitle = '';
         if (is_array($content['categories'])) {
             //always get the 1st option. currently not supported multi categories
             $categoryTitle = @$content['categories'][0];
         } else {
             $categoryTitle = $content['categories'];
         }
         if (empty($categoryTitle)) {
             if ($isNew) {
                 $post['category_id'] = 1;
             }
             // by default the 1 is the uncategorised.
         } else {
             $db = EasyBlogHelper::db();
             $query = 'SELECT `id` FROM `#__easyblog_category`';
             $query .= ' WHERE `title` = ' . $db->Quote($categoryTitle);
             $db->setQuery($query);
             $result = $db->loadResult();
             if (!empty($result)) {
                 $post['category_id'] = $result;
             } else {
                 $post['category_id'] = 1;
             }
         }
     } else {
         if ($isNew) {
             $post['category_id'] = 1;
         }
     }
     $post['published'] = $publish;
     $post['private'] = $isPrivate;
     if (isset($content["post_status"])) {
         switch ($content["post_status"]) {
             case 'publish':
                 $post['published'] = 1;
                 break;
             case 'private':
                 $post['published'] = 1;
                 $post['private'] = 1;
                 break;
             case 'draft':
                 $post['published'] = 0;
                 break;
             case 'schedule':
                 $post['published'] = 2;
                 break;
             case 'pending':
             default:
                 $post['published'] = 0;
                 break;
         }
     }
     // echo '<pre>';
     // var_dump($post['published']);
     // var_dump($post['content']);
     // echo '</pre>';
     // exit;
     // Do some timestamp voodoo
     $tzoffset = EasyBlogDateHelper::getOffSet();
     $overwriteDate = false;
     if (!empty($content['date_created_gmt'])) {
         $date = EasyBlogHelper::getDate($content['date_created_gmt']);
         $blog->created = $date->toFormat();
     } else {
         if (!empty($content['dateCreated'])) {
             $date = EasyBlogHelper::getDate($content['dateCreated']);
             //$date   = EasyBlogDateHelper::dateWithOffSet( $content['dateCreated'] );
             $today = EasyBlogHelper::getDate();
             // somehow blogsy time always return the current time 5 sec faster.
             if ($date->toUnix() > $today->toUnix() + 5) {
                 $post['published'] = 2;
                 $overwriteDate['created'] = $today->toFormat();
                 $overwriteDate['publish_up'] = $date->toFormat();
             } else {
                 $blog->created = $date->toFormat();
                 $overwriteDate['created'] = $date->toFormat();
             }
             // echo $date->toUnix();
             // echo '##';
             // echo $date->toFormat();
             // echo '##';
             // echo $today->toFormat();
             // echo '##';
             // echo $today->toUnix();
             // echo '##';
             // echo $today->toUnix() + 5;
             // exit;
         } else {
             if (!$isNew) {
                 $date = EasyBlogDateHelper::dateWithOffSet($blog->created);
                 $blog->created = $date->toFormat();
                 $date = EasyBlogDateHelper::dateWithOffSet($blog->publish_up);
                 $blog->publish_up = $date->toFormat();
             }
         }
     }
     // we bind this attribute incase if easyblog was a old version.
     $post['issitewide'] = '1';
     //bind the inputs
     $blog->bind($post, true);
     $blog->intro = $post['intro'];
     $blog->content = $post['content'];
     $blog->created_by = $my->id;
     $blog->ispending = 0;
     //(empty($acl->rules->publish_entry)) ? 1 : 0;
     $blog->published = $post['published'];
     if ($overwriteDate !== false) {
         $blog->created = $overwriteDate['created'];
         if (isset($overwriteDate['publish_up'])) {
             $blog->publish_up = $overwriteDate['publish_up'];
         }
     }
     $blog->subscription = $allowSubscribe;
     $blog->frontpage = $showFrontpage;
     $blog->send_notification_emails = $sendEmails;
     $blog->permalink = empty($post['permalink']) ? EasyBlogHelper::getPermalink($blog->title) : $post['permalink'];
     // add in fancy box style.
     $postcontent = $blog->intro . $blog->content;
     // cater for wlw
     $pattern = '#<a.*?\\><img[^>]*><\\/a>#i';
     preg_match_all($pattern, $postcontent, $matches);
     if ($matches && count($matches[0]) > 0) {
         foreach ($matches[0] as $match) {
             $input = $match;
             $largeImgPath = '';
             //getting large image path
             $pattern = '#<a[^>]*>#i';
             preg_match($pattern, $input, $anchors);
             if ($anchors) {
                 preg_match('/href\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $anchors[0], $adata);
                 if ($adata) {
                     $largeImgPath = $adata[1];
                 }
             }
             $input = $match;
             $pattern = '#<img[^>]*>#i';
             preg_match($pattern, $input, $images);
             if ($images) {
                 preg_match('/src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $images[0], $data);
                 if ($data) {
                     $largeImgPath = empty($largeImgPath) ? $data[1] : $largeImgPath;
                     $largeImgPath = urldecode($largeImgPath);
                     $largeImgPath = str_replace(' ', '-', $largeImgPath);
                     $encodedurl = urldecode($data[1]);
                     $encodedurl = str_replace(' ', '-', $encodedurl);
                     $images[0] = str_replace($data[1], $encodedurl, $images[0]);
                     $blog->intro = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $largeImgPath . '">' . $images[0] . '</a>', $blog->intro);
                     $blog->content = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $largeImgPath . '">' . $images[0] . '</a>', $blog->content);
                 }
             }
         }
     } else {
         $pattern = '#<img[^>]*>#i';
         preg_match_all($pattern, $postcontent, $matches);
         if ($matches && count($matches[0]) > 0) {
             foreach ($matches[0] as $match) {
                 $input = $match;
                 preg_match('/src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $input, $data);
                 if ($data) {
                     $oriImage = $data[1];
                     $data[1] = urldecode($data[1]);
                     $data[1] = str_replace(' ', '-', $data[1]);
                     $encodedurl = urldecode($oriImage);
                     $encodedurl = str_replace(' ', '-', $encodedurl);
                     $imageurl = str_replace($oriImage, $encodedurl, $input);
                     $blog->intro = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $data[1] . '">' . $imageurl . '</a>', $blog->intro);
                     $blog->content = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $data[1] . '">' . $imageurl . '</a>', $blog->content);
                 }
             }
         }
     }
     if ($isDraft) {
         $blog->pending_approval = true;
         // we need to process trackbacks and tags here.
         //adding trackback.
         if (!empty($acl->rules->add_trackback)) {
             $trackback = isset($content['mt_tb_ping_urls']) ? $content['mt_tb_ping_urls'] : '';
             if (!empty($trackback) && count($trackback) > 0) {
                 $trackback = implode("\n", $trackback);
                 $blog->trackbacks = $trackback;
             }
         }
         // add new tag
         $tags = isset($content['mt_keywords']) ? $content['mt_keywords'] : '';
         $blog->tags = $tags;
     }
     if (!$blog->store()) {
         $msg = $blog->getError();
         $msg = empty($msg) ? 'Post store failed' : $msg;
         return new xmlrpcresp(0, $xmlrpcerruser + 1, $msg);
     }
     if ($isDraft && !empty($blog->id)) {
         // if this post is under moderation, we will stop here.
         return new xmlrpcresp(new xmlrpcval($blog->id, $xmlrpcString));
     }
     /**
      * JomSocial userpoint.
      */
     if ($isNew && $blog->published == '1' && $my->id != 0) {
         // Assign EasySocial points
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         $easysocial->assignPoints('blog.create', $my->id);
         if ($config->get('main_jomsocial_userpoint')) {
             $jsUserPoint = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
             if (JFile::exists($jsUserPoint)) {
                 require_once $jsUserPoint;
                 CUserPoints::assignPoint('com_easyblog.blog.add', $my->id);
             }
         }
         // @rule: Integrations with EasyDiscuss
         EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.blog', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_BLOG', $blog->title));
         EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.blog', $my->id);
         EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.blog', $my->id);
         // Assign badge for users that report blog post.
         // Only give points if the viewer is viewing another person's blog post.
         EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.create', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_CREATE_BLOG_POST'));
         // @rule: Mighty Touch karma points
         EasyBlogHelper::getHelper('MightyTouch')->setKarma($my->id, 'new_blog');
     }
     //add jomsocial activities
     if ($blog->published == '1' && $config->get('main_jomsocial_activity')) {
         EasyBlogXMLRPCHelper::addJomsocialActivities($blog, $isNew);
     }
     // AlphaUserPoints
     // since 1.2
     if (EasyBlogHelper::isAUPEnabled()) {
         // get blog post URL
         $url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
         AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_blog', '', 'easyblog_add_blog_' . $blog->id, JText::sprintf('AUP NEW BLOG CREATED', $url, $blog->title));
     }
     //adding trackback.
     if (!empty($acl->rules->add_trackback)) {
         $trackback = isset($content['mt_tb_ping_urls']) ? $content['mt_tb_ping_urls'] : '';
         EasyBlogXMLRPCHelper::addTrackback($trackback, $blog, $my);
     }
     // add new tag
     $date = EasyBlogHelper::getDate();
     $tags = isset($content['mt_keywords']) ? $content['mt_keywords'] : '';
     $postTagModel = EasyBlogHelper::getModel('PostTag');
     if ($blog->id != '0') {
         //Delete existing associated tags.
         $postTagModel->deletePostTag($blog->id);
     }
     if (!empty($tags)) {
         $arrTags = explode(',', $tags);
         $tagModel = EasyBlogHelper::getModel('Tags');
         foreach ($arrTags as $tag) {
             if (!empty($tag)) {
                 $table = EasyBlogHelper::getTable('Tag', 'Table');
                 //@task: Only add tags if it doesn't exist.
                 if (!$table->exists($tag)) {
                     if ($acl->rules->create_tag) {
                         $tagInfo['created_by'] = $my->id;
                         $tagInfo['title'] = JString::trim($tag);
                         $tagInfo['created'] = $date->toMySQL();
                         $table->bind($tagInfo);
                         $table->published = 1;
                         $table->status = '';
                         $table->store();
                     }
                 } else {
                     $table->load($tag, true);
                 }
                 //@task: Store in the post tag
                 $postTagModel->add($table->id, $blog->id, $date->toMySQL());
             }
         }
     }
     if ($blog->published) {
         $allowed = array(EBLOG_OAUTH_LINKEDIN, EBLOG_OAUTH_FACEBOOK, EBLOG_OAUTH_TWITTER);
         $blog->autopost($allowed, $allowed);
     }
     return new xmlrpcresp(new xmlrpcval($blog->id, $xmlrpcString));
 }
示例#26
0
 function remove()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('category');
     $categories = JRequest::getVar('cid', '', 'POST');
     $message = '';
     $type = 'info';
     if (empty($categories)) {
         $message = JText::_('COM_EASYBLOG_CATEGORIES_INVALID_CATEGORY');
         $type = 'error';
     } else {
         $table = EasyBlogHelper::getTable('Category', 'Table');
         foreach ($categories as $category) {
             $table->load($category);
             if ($table->getPostCount()) {
                 $message = JText::sprintf('COM_EASYBLOG_CATEGORIES_DELETE_ERROR_POST_NOT_EMPTY', $table->title);
                 $type = 'error';
                 $this->setRedirect('index.php?option=com_easyblog&view=categories', $message, $type);
                 return;
             }
             if ($table->getChildCount()) {
                 $message = JText::sprintf('COM_EASYBLOG_CATEGORIES_DELETE_ERROR_CHILD_NOT_EMPTY', $table->title);
                 $type = 'error';
                 $this->setRedirect('index.php?option=com_easyblog&view=categories', $message, $type);
                 return;
             }
             if (!$table->delete()) {
                 $message = JText::_('COM_EASYBLOG_CATEGORIES_DELETE_ERROR');
                 $type = 'error';
                 $this->setRedirect('index.php?option=com_easyblog&view=categories', $message, $type);
                 return;
             } else {
                 // AlphaUserPoints
                 // since 1.2
                 if (EasyBlogHelper::isAUPEnabled()) {
                     $aupid = AlphaUserPointsHelper::getAnyUserReferreID($table->created_by);
                     AlphaUserPointsHelper::newpoints('plgaup_easyblog_delete_category', $aupid, '', JText::sprintf('AUP CATEGORY DELETED', $table->title));
                 }
             }
         }
         $message = JText::_('COM_EASYBLOG_CATEGORIES_DELETE_SUCCESS');
     }
     $this->setRedirect('index.php?option=com_easyblog&view=categories', $message, $type);
 }
示例#27
0
$added = $sum == 0 ? 0 : $count + 1;
// if it is an array i.e. already has entries the push in another value
$useridstring = "uid" . $userid . ";";
is_array($checkIP) ? array_push($checkIP, $ip_num, $useridstring) : ($checkIP = array($ip_num, $useridstring));
$insertip = serialize($checkIP);
$user_registered = $userid > 0 ? " OR used_ips LIKE '%uid" . $userid . ";%'" : "";
//IP check when voting
$query = "SELECT used_ips FROM #__alpha_rating WHERE ( used_ips LIKE '%" . $ip_num . "%'" . $user_registered . " ) AND id='" . $id_sent . "' AND component='" . $component . "' AND cid='" . $cid . "' AND rid='" . $rid . "'";
$db->setQuery($query);
$voted = $db->loadResult();
if (!$voted) {
    //if the user hasn't yet voted, then vote normally...
    if ($vote_sent >= 1 && $vote_sent <= $units) {
        // keep votes within range
        $query = "UPDATE #__alpha_rating SET total_votes='" . $added . "', total_value='" . $sum . "', used_ips='" . $insertip . "', component='" . $component . "' WHERE id='" . $id_sent . "' AND component='" . $component . "' AND cid='" . $cid . "' AND rid='" . $rid . "'";
        $db->setQuery($query);
        $db->query();
    }
    // Add rule for AlphaUserPoints component
    $api_AUP = JPATH_BASE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
    if (file_exists($api_AUP) && $userid > 0) {
        require_once $api_AUP;
        $referreid = AlphaUserPointsHelper::getAnyUserReferreID($userid);
        $keyreference = $id_sent . $component . $cid . $rid;
        AlphaUserPointsHelper::newpoints('plgaup_voting_ac', $referreid, $keyreference);
    }
    header("Location: {$referer}");
    // go back to the page we came from
    exit;
}
//end for the "if(!$voted)"
 function onTP_Processpayment($data)
 {
     $db = JFactory::getDBO();
     $query = "SELECT points FROM #__alpha_userpoints where userid=" . $data['user_id'];
     $db->setQuery($query);
     $points_count = $db->loadResult();
     $convert_val = $this->params->get('conversion');
     $points_charge = $data['total'] * $convert_val;
     if ($points_charge <= $points_count) {
         //$count = $points_count - $points_charge;
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP)) {
             require_once $api_AUP;
             if (AlphaUserPointsHelper::newpoints($data['client'] . '_aup', '', '', JText::_("PUB_AD"), -$points_charge, true, '', JText::_("SUCCSESS"))) {
                 $payment_status = $this->translateResponse('Success');
             } else {
                 $payment_status = $this->translateResponse('Failure');
             }
         } else {
             $payment_status = $this->translateResponse('Failure');
         }
     } else {
         $payment_status = $this->translateResponse('Failure');
     }
     $result = array('transaction_id' => '', 'order_id' => $data['order_id'], 'status' => $payment_status, 'total_paid_amt' => $data['total'], 'raw_data' => json_encode($data), 'error' => '', 'return' => $data['return']);
     return $result;
 }
示例#29
0
 private function givePoints($user_id, $points, $data = null, $mode = null)
 {
     if ($points === 0) {
         return true;
     }
     $points_mode = @$this->plugin_params->mode;
     if ($mode !== null) {
         $points_mode = $mode;
     }
     if ($points_mode == 'aup') {
         if ($this->getAUP(true)) {
             $aupid = AlphaUserPointsHelper::getAnyUserReferreID($user_id);
             AlphaUserPointsHelper::newpoints('plgaup_orderValidation', $aupid, '', $data, $points);
             return true;
         }
         return false;
     }
     if ($points_mode == 'hks') {
         if (hikaserial::initShop()) {
             $app = JFactory::getApplication();
             $ret = true;
             $userClass = hikaserial::get('shop.class.user');
             $oldUser = $userClass->get($user_id, 'cms');
             if (!isset($oldUser->user_points) && !in_array('user_points', array_keys(get_object_vars($oldUser)))) {
                 return false;
             }
             if (empty($oldUser->user_points)) {
                 $oldUser->user_points = 0;
             }
             $user = new stdClass();
             $user->user_id = $oldUser->user_id;
             $user->user_points = (int) $oldUser->user_points + $points;
             if ($user->user_points < 0) {
                 $app->enqueueMessage(JText::_('CANT_HAVE_NEGATIVE_POINTS'), 'error');
                 $points = -$oldUser->user_points;
                 $user->user_points = 0;
                 $ret = false;
             } else {
                 $app->enqueueMessage(JText::sprintf('HIKAPOINTS_EARN_X_POINTS', $points), 'success');
             }
             $userClass->save($user);
             return $ret;
         }
         return false;
     }
     if ($points_mode == 'hkp') {
         if (hikaserial::initPoints()) {
             return hikapoints::trigger($user_id, 'hikaserial_points_consumer', $points);
         }
         return false;
     }
     if (substr($points_mode, 0, 4) == 'hkp.') {
         if (hikaserial::initPoints()) {
             $category_id = (int) substr($points_mode, 4);
             $pointsClass = hikapoints::get('class.points');
             return $pointsClass->add($user_id, $category_id, $points);
         }
         return false;
     }
     return false;
 }
示例#30
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function removeFavourite()
	{
	global $database, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename;
	$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();

		if (!$my->id) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_LOG2REMF, "exclamation.png", 1);
			return;
		}

		$userid = $my->id;
		$videoid = JRequest::getInt( 'videoid', 0, 'request' );

		$where = ' WHERE userid = '.$userid;
		$where .= ' AND videoid = '.$videoid;

		$db->SetQuery( 'DELETE FROM #__hwdvidsfavorites'
							. $where
						    );

		if ( !$db->query() ) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
		if ( file_exists($api_AUP))
		{
			require_once ($api_AUP);
			AlphaUserPointsHelper::newpoints( 'plgaup_removeVideoFavourite_hwdvs' );
		}

		hwd_vs_tools::logFavour( $videoid, -1 );
		hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_FAVREM, "exclamation.png", 1);
		return;
	}