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


PHP AlphaUserPointsHelper::userpoints方法代码示例

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


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

示例1: onAfterProcess

 /**
  * Run right at the end of the form processing
  * form needs to be set to record in database for this to hook to be called
  *
  * @throws Exception
  *
  * @return	bool
  */
 public function onAfterProcess()
 {
     $params = $this->getParams();
     $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
     if (JFile::exists($api_AUP)) {
         $w = new FabrikWorker();
         $this->data = $this->getProcessData();
         require_once $api_AUP;
         $aup = new AlphaUserPointsHelper();
         // Define which user will receive the points.
         $userId = $params->get('user_id', '');
         $userId = (int) $w->parseMessageForPlaceholder($userId, $this->data, false);
         $aupId = $aup->getAnyUserReferreID($userId);
         // Replace these if you want to show a specific reference for the attributed points - doesn't seem to effect anything
         $keyReference = '';
         // Shown in the user details page - description of what the point is for
         $dataReference = $params->get('data_reference', '');
         $dataReference = $w->parseMessageForPlaceholder($dataReference, $this->data, false);
         // Override the plugin default points
         $randomPoints = $params->get('random_points', 0);
         if ($params->get('random_points_eval', '0') == '1') {
             if (!empty($randomPoints)) {
                 $randomPoints = $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
                 $randomPoints = @eval($randomPoints);
                 FabrikWorker::logEval($randomPoints, 'Caught exception on eval in aup plugin : %s');
             }
             $randomPoints = (double) $randomPoints;
         } else {
             $randomPoints = (double) $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
         }
         // If set to be greater than $randompoints then this is the # of points assigned (not sure when this would be used - commenting out for now)
         $referralUserPoints = 0;
         $aupPlugin = $params->get('aup_plugin', 'plgaup_fabrik');
         $aupPlugin = $w->parseMessageForPlaceholder($aupPlugin, $this->data, false);
         if (!$aup->checkRuleEnabled($aupPlugin, 0, $aupId)) {
             throw new Exception('Alpha User Points plugin not published');
         }
         $aup->userpoints($aupPlugin, $aupId, $referralUserPoints, $keyReference, $dataReference, $randomPoints);
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:48,代码来源:alphauserpoints.php

示例2: updateUserPoints

 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);
     }
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:helper.php

示例3: _save_profile

 function _save_profile()
 {
     $app = JFactory::getApplication();
     // initialize variables
     $db = JFactory::getDBO();
     $post = JRequest::get('post');
     $profilecomplete = 0;
     if ($post['referreid'] == '') {
         echo "<script>window.history.go(-1);</script>\n";
         exit;
     }
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables');
     $row = JTable::getInstance('userspoints');
     if (!isset($post['gender'])) {
         $post['gender'] = 0;
     }
     if ($post['birthdate'] == '') {
         $post['birthdate'] = '0000-00-00';
     } elseif ($post['birthdate'] != '') {
         // Check format date to save
         $valdat = $post['birthdate'];
         $format = substr($valdat, -5, 1);
         if ($format == '-' || $format == '/') {
             // french format
             $cday = substr($valdat, -10, 2);
             $cmonth = substr($valdat, -7, 2);
             $cyear = substr($valdat, -4, 4);
             $post['birthdate'] = $cyear . '-' . $cmonth . '-' . $cday;
         }
     }
     $curdate = date("Y-m-d");
     if ($post['birthdate'] >= $curdate) {
         $post['birthdate'] = '0000-00-00';
     }
     if (!$row->bind($post)) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $app->enqueueMessage(JText::_('AUP_CHANGE_SAVED'));
     // check if all field are complete for the profile complete rule
     if ($post['gender'] > 0 && $post['birthdate'] != '' && $post['birthdate'] != '0000-00-00' && $post['aboutme'] != '' && $post['city'] != '' && $post['avatar'] != '' && $post['job'] != '' && $post['education'] != '' && $post['graduationyear'] != '') {
         $profilecomplete = 1;
     }
     // rules for Profile
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     if ($profilecomplete) {
         // assigns points when the user upload his avatar: this rule can be assigned only once per user
         AlphaUserPointsHelper::userpoints('sysplgaup_profilecomplete', '', 0, $post['referreid']);
     } else {
         // remove points if profile has been complete and now remove required fields for profile complete -> return state incomplete
         $rule = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_profilecomplete');
         if ($rule) {
             // rule published
             // get ID of rule named 'sysplgaup_profilecomplete'
             $rule_id = $rule[0]->id;
             $query = "DELETE FROM #__alpha_userpoints_details WHERE rule='" . $rule_id . "' AND referreid='" . $post['referreid'] . "' AND keyreference='" . $post['referreid'] . "'";
             $db->setQuery($query);
             $db->query();
             // recount for this user
             $this->checkNewTotal($post['referreid'], $rule_id);
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:alphauserpoints.php

示例4: savecustompoints

 public function savecustompoints()
 {
     // specific user
     $app = JFactory::getApplication();
     $referrerid = JFactory::getApplication()->input->get('cid', '', 'string');
     $name = JFactory::getApplication()->input->get('name', '', 'string');
     $points = JFactory::getApplication()->input->get('points', 0, 'float');
     $reason = JFactory::getApplication()->input->get('reason', '', 'SAFE_HTML ');
     if ($referrerid) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         AlphaUserPointsHelper::userpoints('sysplgaup_custom', $referrerid, 0, '', $reason, $points);
         AlphaUserPointsHelper::checkRankMedal($referrerid);
     }
     $this->setRedirect('index.php?option=com_alphauserpoints&task=showdetails&cid=' . $referrerid . '&name=' . $name);
     $this->redirect();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:16,代码来源:controller.php

示例5: uploadavatar

 public function uploadavatar()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     // load language for component media
     $lang = JFactory::getLanguage();
     $lang->load('com_media', JPATH_SITE);
     $lang = JFactory::getLanguage();
     $lang->load('com_media', JPATH_ADMINISTRATOR);
     $params = JComponentHelper::getParams('com_media');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_media' . DS . 'helpers' . DS . 'media.php';
     define('COM_AUP_MEDIA_BASE_IMAGE', JPATH_ROOT . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'assets' . DS . 'images');
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     $files = JFactory::getApplication()->input->files->get('filedata', '', 'array');
     $file = $files[0];
     $folder = JFactory::getApplication()->input->get('folder', 'avatars', 'path');
     $format = JFactory::getApplication()->input->get('format', 'html', 'cmd');
     $return = JFactory::getApplication()->input->get('return-url', null, 'base64');
     $referrerid = JFactory::getApplication()->input->get('referrerid', '', 'string');
     $err = null;
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     // Make the filename safe
     jimport('joomla.filesystem.file');
     $file['name'] = JFile::makeSafe($file['name']);
     if (isset($file['name']) && $referrerid != '') {
         $extention = JFile::getExt($file['name']);
         $newnameavatar = strtolower($referrerid . '.' . $extention);
         //chmod (COM_AUP_MEDIA_BASE_IMAGE.DS.$folder, 0755) ;
         $filepath = JPath::clean(COM_AUP_MEDIA_BASE_IMAGE . DS . $folder . DS . $newnameavatar);
         // erase old avatar
         if (file_exists($filepath)) {
             @unlink($filepath);
         }
         if (!MediaHelper::canUpload($file, $err)) {
             if ($format == 'json') {
                 jimport('joomla.error.log');
                 $log = JLog::getInstance('upload.error.php');
                 $log->addEntry(array('comment' => 'Invalid: ' . $filepath . ': ' . $err));
                 header('HTTP/1.0 415 Unsupported Media Type');
                 jexit('Error. Unsupported Media Type!');
             } else {
                 JError::raiseNotice(100, JText::_($err));
                 // REDIRECT
                 if ($return) {
                     $this->setRedirect(base64_decode($return));
                     $this->redirect();
                 }
                 return;
             }
         }
         if (JFile::exists($filepath)) {
             if ($format == 'json') {
                 jimport('joomla.error.log');
                 $log = JLog::getInstance('upload.error.php');
                 $log->addEntry(array('comment' => 'File already exists: ' . $filepath));
                 header('HTTP/1.0 409 Conflict');
                 jexit('Error. File already exists');
             } else {
                 JError::raiseNotice(100, JText::_('UPLOAD FAILED. FILE ALREADY EXISTS'));
                 // REDIRECT
                 if ($return) {
                     $this->setRedirect(base64_decode($return));
                     $this->redirect();
                 }
                 return;
             }
         }
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             if ($format == 'json') {
                 jimport('joomla.error.log');
                 $log = JLog::getInstance('upload.error.php');
                 $log->addEntry(array('comment' => 'Cannot upload: ' . $filepath));
                 header('HTTP/1.0 400 Bad Request');
                 jexit('ERROR. UNABLE TO UPLOAD FILE');
             } else {
                 JError::raiseWarning(100, JText::_('ERROR. UNABLE TO UPLOAD FILE'));
                 // REDIRECT
                 if ($return) {
                     $this->setRedirect(base64_decode($return));
                     $this->redirect();
                 }
                 return;
             }
         } else {
             // SAVE IN PROFIL USER ALPHAUSERPOINTS
             $query = "UPDATE #__alpha_userpoints" . "\n SET avatar='" . $newnameavatar . "'" . "\n WHERE referreid='" . $referrerid . "' AND userid='" . $user->id . "'";
             $db->setQuery($query);
             if (!$db->query()) {
                 JError::raiseError(500, $db->getErrorMsg());
                 return false;
             }
             require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if ($format == 'json') {
                 jimport('joomla.error.log');
                 $log = JLog::getInstance();
                 $log->addEntry(array('comment' => $folder));
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:account.php

示例6: sysplgaup_invitewithsuccess

 public function sysplgaup_invitewithsuccess($referrerid, $data)
 {
     $ip = $_SERVER["REMOTE_ADDR"];
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     $keyreference = AlphaUserPointsHelper::buildKeyreference('sysplgaup_invitewithsuccess', $ip);
     AlphaUserPointsHelper::userpoints('sysplgaup_invitewithsuccess', $referrerid, 0, $ip, $data);
 }
开发者ID:q0821,项目名称:esportshop,代码行数:7,代码来源:sysplgaup_newregistered.php

示例7: _customrulepoints

 function _customrulepoints($cids, $reason, $points)
 {
     $app = JFactory::getApplication();
     // initialize variables
     $db = JFactory::getDBO();
     $query = "SELECT `id` FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_custom'";
     $db->setQuery($query);
     $rule_id = $db->loadResult();
     JArrayHelper::toInteger($cids);
     if (count($cids)) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         foreach ($cids as $cid) {
             $query = "SELECT referreid FROM #__alpha_userpoints WHERE id='" . $cid . "'";
             $db->setQuery($query);
             $referrerid = $db->loadResult();
             if ($referrerid) {
                 AlphaUserPointsHelper::userpoints('sysplgaup_custom', $referrerid, 0, '', $reason, $points);
                 $this->checkTotalAfterRecalculate($referrerid, $rule_id);
             }
         }
         $app->enqueueMessage(JText::_('AUP_RECALCULATION_MADE'));
     }
     $redirecturl = "index.php?option=com_alphauserpoints&task=statistics";
     JControllerLegacy::setRedirect($redirecturl);
     JControllerLegacy::redirect();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:26,代码来源:helper.php

示例8: sendinvite

 public function sendinvite()
 {
     $app = JFactory::getApplication();
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // active user
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     jimport('joomla.mail.helper');
     $model = $this->getModel('alphauserpoints');
     $view = $this->getView('invite', 'html');
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $jnow = JFactory::getDate();
     $now = $jnow->toSql();
     $uri = JURI::getInstance();
     $base = $uri->toString(array('scheme', 'host', 'port'));
     $params = $model->_getParamsAUP();
     $cparams = JComponentHelper::getParams('com_alphauserpoints');
     $referrerid = $model->_getReferreid();
     if ($referrerid) {
         $link = getLinkToInvite($referrerid, $cparams->get('systemregistration'));
     } else {
         $link = $base . JRoute::_('');
     }
     if ($params->get('userecaptcha') == 1 || $params->get('userecaptcha') == 2 && !$user->id) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'assets' . DS . 'recaptcha' . DS . 'recaptchalib.php';
         $privatekey = $params->get('privkey');
         // the response from reCAPTCHA
         $resp = null;
         // the error code from reCAPTCHA, if any
         $error = null;
         // was there a reCAPTCHA response?
         $recaptcha_response_field = JFactory::getApplication()->input->get('recaptcha_response_field', '', 'string');
         //if ($_POST["recaptcha_response_field"]) {
         if ($recaptcha_response_field) {
             $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $recaptcha_response_field);
             if (!$resp->is_valid) {
                 // set the error code so that we can display it
                 $error = $resp->error;
                 JError::raiseWarning(0, $error);
                 return $this->display();
             }
         } else {
             JError::raiseWarning(0, 'Captcha');
             return $this->display();
         }
     }
     // An array of e-mail headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we fine one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos(@$_POST[$field], $header) !== false) {
                 JError::raiseError(403, '');
             }
         }
     }
     /*
      * Free up memory
      */
     unset($headers, $fields);
     $imported_emails = $_POST['importedemails'];
     $other_emails = JRequest::getString('other_recipients', '', 'post');
     $sender = JRequest::getString('sender', '', 'post');
     // Check for a valid to address
     $errorMail = false;
     // build list emails
     if ($imported_emails == '' && $other_emails != '') {
         $emails = $other_emails;
     } elseif ($other_emails == '' && $imported_emails != '') {
         $emails = $imported_emails;
     } elseif ($imported_emails != '' && $other_emails != '') {
         $emails = $imported_emails . "," . $other_emails;
     } else {
         $emails = "";
         $errorMail = JText::_('AUP_EMAIL_INVALID');
         JError::raiseWarning(0, $errorMail);
     }
     $emails = @explode(',', $emails);
     // Check for a valid from address
     if (!$MailFrom || !JMailHelper::isEmailAddress($MailFrom)) {
         $errorMail = JText::sprintf('AUP_EMAIL_INVALID', $MailFrom);
         JError::raiseWarning(0, $errorMail);
     }
     if ($errorMail) {
         return $this->display();
     }
     // Build the message to send
     $msg = JText::_('AUP_EMAIL_MSG_INVITE');
     $custommessage = JRequest::getString('custommessage', '', 'post');
     $formatMail = '0';
     $bcc2admin = '0';
     if ($params->get('templateinvite', 0)) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:invite.php


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