示例#1
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));
 }
示例#2
0
 public static function getList($params)
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $count = intval($params->get('count', 5));
     $usrname = trim($params->get('usrname', 'name'));
     $allmembers = intval($params->get('showallmembers', 1));
     $nullDate = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSql();
     $currentuser = $user->id;
     $selecteduser = "";
     if ($currentuser && !$allmembers) {
         $selecteduser = "******" . $currentuser . "' ";
     }
     $displayactivity = '';
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     $version = AlphaUserPointsHelper::getAupVersion();
     if (version_compare($version, '2.0.2', '>=')) {
         $displayactivity = " AND r.displayactivity='1'";
     }
     $query = "SELECT a.insert_date, a.referreid, aup.userid, a.points AS last_points, a.datareference, u." . $usrname . " AS usrname, r.rule_name, r.plugin_function, r.category" . " FROM #__alpha_userpoints_details AS a, #__alpha_userpoints AS aup, #__users AS u, #__alpha_userpoints_rules AS r" . " WHERE aup.referreid=a.referreid " . $selecteduser . "AND aup.userid=u.id AND aup.published='1' AND a.approved='1' AND (a.expire_date>='" . $now . "' OR a.expire_date='0000-00-00 00:00:00') AND r.id=a.rule" . $displayactivity . " ORDER BY a.insert_date DESC";
     $db->setQuery($query, 0, $count);
     $rows = $db->loadObjectList();
     return $rows;
 }
示例#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);
 }
 function getPoint($user_id)
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     $profile = AlphaUserPointsHelper::getUserInfo('', $user_id);
     $point = $profile->points;
     return $point;
 }
示例#5
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);
 }
 private function sendNotificationOnUpdateRank($userinfo, $result)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     jimport('joomla.mail.helper');
     require_once JPATH_ROOT . '/components/com_alphauserpoints/helper.php';
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $jsNotification = $params->get('jsNotification', 0);
     $jsNotificationAdmin = $params->get('fromIdUddeim', 0);
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $sef = $app->getCfg('sef');
     $email = $userinfo->email;
     $subject = $result->emailsubject;
     $body = $result->emailbody;
     $formatMail = $result->emailformat;
     $bcc2admin = $result->bcc2admin;
     $subject = str_replace('{username}', $userinfo->username, $subject);
     $subject = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $subject);
     $body = str_replace('{username}', $userinfo->username, $body);
     $body = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $body);
     $subject = JMailHelper::cleanSubject($subject);
     if (!$jsNotification) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->setSubject($subject);
         $mailer->isHTML((bool) $formatMail);
         $mailer->CharSet = "utf-8";
         $mailer->setBody($body);
         $mailer->addRecipient($email);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT email" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->email);
             }
         }
         $send = $mailer->Send();
     } else {
         require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
         $params = new CParameter('');
         CNotificationLibrary::add('system_messaging', $jsNotificationAdmin, $userinfo->id, $subject, $body, '', $params);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT id" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->id);
                 CNotificationLibrary::add('system_messaging', $userinfo->id, $rowsAdmin->id, $subject, $body, '', $params);
             }
         }
     }
 }
示例#7
0
	function getDisplayTab($tab,$user,$ui)
	{

		$params=$this->params;

		global $_CB_framework,$_CB_database;

		$livesite = JURI::base();
		JPlugin::loadLanguage( 'com_alphauserpoints', JPATH_SITE );
		$tableclass = $params->get('tableclass', 1);
		$count_activity = $params->get('count_activity', 20);
		$return ="";
		$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';

		if ( file_exists($api_AUP)) {
			require_once ($api_AUP);
			$listActivity = AlphaUserPointsHelper::getListActivity('all', $user->id, $count_activity);
		}
		
		if(count($listActivity) >0) {
			$return .='<table width="95%" cellspacing="0" border="0">';
			$return .= '<tr class=\'sectiontableheader\'><th>';
			$return .='</th><th width="20%">';
			$return .= JText::_( 'AUP_DATE' );
			$return .='</th><th width="20%">';
			$return .= JText::_( 'AUP_ACTION' );
			$return .='</th><th width="6%">';
			$return .= JText::_( 'AUP_POINTS_UPPER' );
			$return .='</th><th>';
			$return .= JText::_( 'AUP_DETAIL' );
			$return .='</th></tr>';
			$i=0;
			foreach ( $listActivity as $activity ) {
				$i++;
				if($i>2) $i=1;
				$return .='<tr';
				if($tableclass) $return .=' class="sectiontableentry'.$i.'"';
				$return .=' ><td>';
					$icon = ( $activity->category!='' ) ? '<img src="'.JURI::base(true).DS.'components'.DS.'com_alphauserpoints'.DS.'assets'.DS.'images'.DS.'categories'.DS.$activity->category.'.gif" alt="" />' : '';
				$return .= $icon;
				$return .='</td><td>';
				$return .= '<span style="color:#333;">'.JHTML::_('date', $activity->insert_date, JText::_('d.m.Y')).'</span>&nbsp;<span style="color:#777;font-style:oblique;">'.JHTML::_('date', $activity->insert_date, JText::_('H:i:s')).'</span>';
					$color = $activity->points>0 ? "#009900" : ($activity->points<0 ? "#ff0000" : ($activity->points==0.00 ? "#777" : "#777"));
				$return .='</td><td style="color:'. $color .';">';
				$return .= JText::_( $activity->rule_name );
				$return .='</td><td style="text-align: right; color:'. $color .';">';
				$return .= $activity->points;
				$return .='&nbsp;&nbsp;</td><td  style="color:#777;">';
				$return .= $activity->datareference;
				$return .='</td></tr>';
			}
			$return .='</table>';
			$return .= '<br />' . JHTML::_('date', 'now', JText::_('l d.m.Y H:i'));
		} else $return .='<div align="center"><p>'.JText::_( 'AUP_THIS_INFORMATION_HAS_NOT_BEEN_PROVIDED' ).'</p></div>';
		return $return;
	}
示例#8
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;
                     }
                 }
             }
         }
     }
 }
示例#10
0
	public function getProfileURL($user, $task = '', $xhtml = true) {
		if ($user == 0)
			return false;
		$user = KunenaFactory::getUser ( $user );
		$my = JFactory::getUser ();
		if ($user === false)
			return false;
		$userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : '';
		$AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil ();
		return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml );
	}
示例#11
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);
         }
     }
 }
示例#12
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);
 }
示例#13
0
 /**
  * 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);
     }
 }
示例#14
0
 public function getLink($user, $class = '', $sizex = 90, $sizey = 90)
 {
     $user = KunenaFactory::getUser($user);
     $size = $this->getSize($sizex, $sizey);
     if ($size->y > 100) {
         $avatar = AlphaUserPointsHelper::getAupAvatar($user->userid, 0, 100 * (double) $size->x / (double) $size->y, '100');
     } else {
         $avatar = AlphaUserPointsHelper::getAupAvatar($user->userid, 0, $size->x, $size->y);
     }
     if (!$avatar) {
         $avatar = '<img border="0" width="100" height="100" alt="" src="' . JUri::root() . 'components/com_alphauserpoints/assets/images/avatars/generic_gravatar_grey.png">';
     }
     return $avatar;
 }
示例#15
0
文件: avatar.php 项目: rich20/Kunena
	public function getLink($user, $class='', $sizex=90, $sizey=90)
	{
		$user = KunenaFactory::getUser($user);
		$size = $this->getSize($sizex, $sizey);
		if ($size->y > 100) {
			$avatar = AlphaUserPointsHelper::getAupAvatar ( $user->userid, 0, 100*(float)$size->x/(float)$size->y, '100'  );
		} else {
			$avatar = AlphaUserPointsHelper::getAupAvatar ( $user->userid, 0, $size->x, $size->y  );
		}
		if (!$avatar) {
			// FIXME: need a better way to do this
			$avatar = '<img border="0" width="100" height="100" alt="" src="http://kunena16cb/components/com_alphauserpoints/assets/images/avatars/generic_gravatar_grey.gif">';
		}
		return $avatar;
	}
示例#16
0
文件: aup.php 项目: Tommar/vino2
 public function getRanks($userId)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('main_alpha_userpoint_ranks')) {
         return false;
     }
     if (!$this->loadHelper()) {
         return false;
     }
     if (!method_exists('AlphaUserPointsHelper', 'getUserRank')) {
         return false;
     }
     $rank = AlphaUserPointsHelper::getUserRank('', $userId);
     $theme = new CodeThemes();
     $theme->set('rank', $rank);
     return $theme->fetch('author.aup.ranks.php');
 }
示例#17
0
文件: profile.php 项目: rich20/Kunena
	public function getProfileURL($user, $task = '', $xhtml = true) {
		if ($user == 0)
			return false;
		$user = KunenaFactory::getUser ( $user );
		$my = JFactory::getUser ();
		if ($user === false)
			return false;
		$userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : '';
		if (method_exists ( 'AlphaUserPointsHelper', 'getItemidAupProfil' )) {
			$AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil ();
		} else {
			$db = JFactory::getDBO ();
			$query = "SELECT id FROM #__menu WHERE link='index.php?option=com_alphauserpoints&view=account' AND type='component' AND published='1'";
			$db->setQuery ( $query );
			$AUP_itemid = intval ( $db->loadResult () );
		}
		return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml );
	}
示例#18
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();
 }
示例#19
0
 function validerRadio($db)
 {
     $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     if (file_exists($api_AUP)) {
         require_once $api_AUP;
         $query = "SELECT id_user FROM #__mzpromoradio where valide='0' GROUP BY id_user";
         $db->setQuery($query);
         $users = $db->loadResultArray();
         foreach ($users as $u) {
             $u = (int) $u;
             //$referreid = AlphaUserPointsHelper::getAnyUserReferreID( $u );
             $profil = AlphaUserPointsHelper::getUserInfo('', $u);
             if ($profil->points > 299) {
                 $query = "UPDATE #__mzpromoradio SET valide='1' WHERE id_user='******'";
                 $db->setQuery($query);
                 $test = $db->query();
             }
         }
     }
 }
示例#20
0
 function _display($tpl = null)
 {
     $document = JFactory::getDocument();
     $lang = $document->getLanguage();
     $displ = "view";
     $points = 0;
     JHtml::_('behavior.framework', true);
     $document->addStyleSheet(JURI::base(true) . '/components/com_alphauserpoints/assets/css/alphauserpoints.css');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     $result = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_invite');
     if ($result) {
         $points = $result[0]->points;
     }
     JHTML::_('behavior.formvalidation');
     // reCaptcha script
     if ($this->params->get('userecaptcha', 1)) {
         if ($this->params->get('recaptchaajax ', 0)) {
             $document->addScript("http://api.recaptcha.net/js/recaptcha_ajax.js");
             $paramsReCaptcha = "\r\n\t\t\t\t\twindow.onload = function () {\r\n\t\t\t\t\tRecaptcha.create('" . $this->params->get('pubkey') . "',\r\n\t\t\t\t\t'recaptcha_div', {\r\n\t\t\t\t\t theme: '" . $this->params->get('themerecaptcha', 'red') . "',\r\n\t\t\t\t\t callback: Recaptcha.focus_response_field\r\n\t\t\t\t\t});\r\n\t\t\t\t\t}";
         } else {
             $paramsReCaptcha = "\r\n\t\t\t\tvar RecaptchaOptions = {\r\n\t\t\t\t   theme : '" . $this->params->get('themerecaptcha', 'red') . "',\r\n\t\t\t\t   lang  : '" . substr($lang, 0, 2) . "'\r\n\t\t\t\t};\r\n\t\t\t\t";
         }
         $document->addScriptDeclaration($paramsReCaptcha, '');
     }
     /*
     $document->addScript(JURI::base(true).'/media/system/js/mootools-core.js');
     $document->addStyleSheet(JURI::base(true).'/media/system/css/modal.css');
     $document->addScript(JURI::base(true).'/media/system/js/modal.js');
     */
     JHTML::_('behavior.modal');
     $setModal = "window.addEvent('domready', function() {\r\n\t\t\tSqueezeBox.initialize({});\r\n\r\n\t\t\t\$\$('a.modal').each(function(el) {\r\n\t\t\t\tel.addEvent('click', function(e) {\r\n\t\t\t\t\tnew Event(e).stop();\r\n\t\t\t\t\tSqueezeBox.fromElement(el);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\t\t";
     $document->addScriptDeclaration($setModal);
     $this->assignRef('params', $this->params);
     $this->assignRef('referreid', $this->referreid);
     $this->assignRef('user_name', $this->user_name);
     $this->assignRef('points', $points);
     $this->assignRef('displ', $displ);
     $this->assignRef('referrer_link', $this->referrer_link);
     parent::display($tpl);
 }
示例#21
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);
 }
示例#22
0
 private function _getPointsOnThankyou($ruleName)
 {
     $ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled($ruleName);
     if (!empty($ruleEnabled[0]->published)) {
         return $ruleEnabled[0]->points2;
     }
     return null;
 }
示例#23
0
function Recalc($start, $tempsExec)
{
    global $mainframe;
    global $base;
    // check time execute
    list($usec, $sec) = explode(' ', microtime());
    $start_time = (double) $usec + (double) $sec;
    $new_time = $start_time;
    $db = JFactory::getDBO();
    $jnow = JFactory::getDate();
    $now = $jnow->toSql();
    // get params definitions
    $params = JComponentHelper::getParams('com_alphauserpoints');
    $prefixNewReferreid = strtoupper($params->get('prefix_selfregister'));
    //$prefixNewReferreid = "AUPRS-";
    if ($start) {
        $i = $start;
    } else {
        $i = 0;
    }
    $query = "SELECT referreid FROM #__alpha_userpoints WHERE referreid!='GUEST'";
    $db->setQuery($query);
    $users = $db->loadObjectList();
    $numusers = count($users);
    if ($users) {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
        $allowNegativeAccount = $params->get('allowNegativeAccount', 0);
        for ($i, $n = $numusers; $i < $n; $i++) {
            if ($new_time - $start_time < $tempsExec) {
                $user = $users[$i];
                // real sum for each user
                $query = "SELECT SUM(points) FROM #__alpha_userpoints_details WHERE `referreid`='" . $user->referreid . "' AND `approved`='1' AND (`expire_date`>'{$now}' OR `expire_date`='0000-00-00 00:00:00')";
                $db->setQuery($query);
                $newtotal = $db->loadResult();
                if (!$allowNegativeAccount && $newtotal < 0) {
                    $newtotal = 0;
                }
                $query = "UPDATE #__alpha_userpoints SET `points`='" . $newtotal . "', `last_update`='{$now}' WHERE `referreid`='" . $user->referreid . "'";
                $db->setQuery($query);
                if (!$db->query()) {
                    $error = 'ERROR : update not complete';
                    echo '<script language="Javascript">
					<!--
					parent.document.location.replace("' . $base . 'index.php?option=com_alphauserpoints&task=cpanel&recalculate=' . $error . '");							
					// -->
					</script>';
                    exit;
                }
                // update Ranks / Medals if necessary
                AlphaUserPointsHelper::checkRankMedal($user->referreid);
            } else {
                // time ?
                break;
            }
            list($usec, $sec) = explode(" ", microtime());
            $new_time = (double) $usec + (double) $sec;
        }
        // for $i=
        if ($i == $numusers) {
            $start = -1;
        } else {
            $start = $i;
        }
        return $start;
    }
    // if users
}
示例#24
0
 function check_user_credits($userid = 0)
 {
     $app = JFactory::getApplication();
     if (!$userid) {
         $user = JFactory::getUser();
         $userid = $user->id;
     }
     $params = JComponentHelper::getParams(S_APP_NAME);
     $points_per_credit = (int) $params->get('points_per_credit', 0);
     if (!$points_per_credit) {
         return -1;
     }
     switch ($params->get('points_system', 'none')) {
         case 'cjblog':
             $api = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_cjblog' . DIRECTORY_SEPARATOR . 'api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $profile = CjBlogApi::get_user_profile($userid);
                 if (!empty($profile)) {
                     return floor($profile['points'] / $points_per_credit);
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 $profile = AlphaUserPointsHelper::getUserInfo('', $userid);
                 if (!empty($profile)) {
                     return floor($profile->points / $points_per_credit);
                 }
             }
             break;
         case 'jomsocial':
             $query = 'select points from #__community_users where userid=' . $userid;
             $this->_db->setQuery($query);
             $points = (int) $this->_db->loadResult();
             return floor($points / $points_per_credit);
         case 'easysocial':
             $query = 'select sum(points) from #__social_points_history where user_id = ' . $userid . ' and state = 1';
             $this->_db->setQuery($query);
             $points = (int) $this->_db->loadResult();
             return floor($points / $points_per_credit);
     }
     return -1;
 }
示例#25
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;
 }
 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;
 }
示例#27
0
function generateSystemReport()
{
    jimport('joomla.filesystem.file');
    $kunena_config = KunenaFactory::getConfig();
    $kunena_app = JFactory::getApplication();
    $kunena_db = JFactory::getDBO();
    $JVersion = new JVersion();
    $jversion = $JVersion->PRODUCT . ' ' . $JVersion->RELEASE . '.' . $JVersion->DEV_LEVEL . ' ' . $JVersion->DEV_STATUS . ' [ ' . $JVersion->CODENAME . ' ] ' . $JVersion->RELDATE;
    if ($kunena_app->getCfg('legacy')) {
        $jconfig_legacy = '[color=#FF0000]Enabled[/color]';
    } else {
        $jconfig_legacy = 'Disabled';
    }
    if (!$kunena_app->getCfg('smtpuser')) {
        $jconfig_smtpuser = '******';
    } else {
        $jconfig_smtpuser = $kunena_app->getCfg('smtpuser');
    }
    if ($kunena_app->getCfg('ftp_enable')) {
        $jconfig_ftp = 'Enabled';
    } else {
        $jconfig_ftp = 'Disabled';
    }
    if ($kunena_app->getCfg('sef')) {
        $jconfig_sef = 'Enabled';
    } else {
        $jconfig_sef = 'Disabled';
    }
    if ($kunena_app->getCfg('sef_rewrite')) {
        $jconfig_sef_rewrite = 'Enabled';
    } else {
        $jconfig_sef_rewrite = 'Disabled';
    }
    if (file_exists(JPATH_ROOT . '/.htaccess')) {
        $htaccess = 'Exists';
    } else {
        $htaccess = 'Missing';
    }
    if (ini_get('register_globals')) {
        $register_globals = '[u]register_globals:[/u] [color=#FF0000]On[/color]';
    } else {
        $register_globals = '[u]register_globals:[/u] Off';
    }
    if (ini_get('safe_mode')) {
        $safe_mode = '[u]safe_mode:[/u] [color=#FF0000]On[/color]';
    } else {
        $safe_mode = '[u]safe_mode:[/u] Off';
    }
    if (extension_loaded('mbstring')) {
        $mbstring = '[u]mbstring:[/u] Enabled';
    } else {
        $mbstring = '[u]mbstring:[/u] [color=#FF0000]Not installed[/color]';
    }
    if (extension_loaded('gd')) {
        $gd_info = gd_info();
        $gd_support = '[u]GD:[/u] ' . $gd_info['GD Version'];
    } else {
        $gd_support = '[u]GD:[/u] [color=#FF0000]Not installed[/color]';
    }
    $maxExecTime = ini_get('max_execution_time');
    $maxExecMem = ini_get('memory_limit');
    $fileuploads = ini_get('upload_max_filesize');
    $kunenaVersionInfo = CKunenaVersion::versionArray();
    //get all the config settings for Kunena
    $kunena_db->setQuery("SHOW TABLES LIKE '" . $kunena_db->getPrefix() . "kunena_config'");
    $table_config = $kunena_db->loadResult();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    if ($table_config) {
        $kunena_db->setQuery("SELECT * FROM #__kunena_config");
        $kconfig = (object) $kunena_db->loadObject();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
        $kconfigsettings = '[table]';
        $kconfigsettings .= '[th]Kunena config settings:[/th]';
        foreach ($kconfig as $key => $value) {
            if ($key != 'id' && $key != 'board_title' && $key != 'email' && $key != 'offline_message' && $key != 'recaptcha_publickey' && $key != 'recaptcha_privatekey' && $key != 'email_visible_addres' && $key != 'recaptcha_theme') {
                $kconfigsettings .= '[tr][td]' . $key . '[/td][td]' . $value . '[/td][/tr]';
            }
        }
        $kconfigsettings .= '[/table]';
    } else {
        $kconfigsettings = 'Your configuration settings aren\'t yet recorded in the database';
    }
    // Get Kunena default template
    $ktemplate = KunenaFactory::getTemplate();
    $ktempaltedetails = $ktemplate->getTemplateDetails();
    // Get database collation
    $collation = getTablesCollation();
    // Get Joomla! template details
    $templatedetails = getJoomlaTemplate();
    // Get Joomla! menu details
    $joomlamenudetails = getJoomlaMenuDetails();
    // Check if Mootools plugins and others kunena plugins are enabled, and get the version of this modules
    jimport('joomla.plugin.helper');
    jimport('joomla.application.module.helper');
    jimport('joomla.application.component.helper');
    $plg = array();
    if (JPluginHelper::isEnabled('system', 'mtupgrade')) {
        $plg['mtupgrade'] = '[u]System - Mootools Upgrade:[/u] Enabled';
    } else {
        $plg['mtupgrade'] = '[u]System - Mootools Upgrade:[/u] Disabled';
    }
    if (JPluginHelper::isEnabled('system', 'mootools12')) {
        $plg['mt12'] = '[u]System - Mootools12:[/u] Enabled';
    } else {
        $plg['mt12'] = '[u]System - Mootools12:[/u] Disabled';
    }
    $plg['jfirephp'] = checkThirdPartyVersion('jfirephp', 'jfirephp', 'JFirePHP', 'plugins/system', 'system', 0, 0, 1);
    $plg['ksearch'] = checkThirdPartyVersion('kunenasearch', 'kunenasearch', 'Kunena Search', 'plugins/search', 'search', 0, 0, 1);
    $plg['kdiscuss'] = checkThirdPartyVersion('kunenadiscuss', 'kunenadiscuss', 'Kunena Discuss', 'plugins/content', 'content', 0, 0, 1);
    $plg['jxfinderkunena'] = checkThirdPartyVersion('plg_jxfinder_kunena', 'plg_jxfinder_kunena', 'Finder Kunena Posts', 'plugins/finder', 'finder', 0, 0, 1);
    $plg['kjomsocialmenu'] = checkThirdPartyVersion('kunenamenu', 'kunenamenu', 'My Kunena Forum Menu', 'plugins/community', 'community', 0, 0, 1);
    $plg['kjomsocialmykunena'] = checkThirdPartyVersion('mykunena', 'mykunena', 'My Kunena Forum Posts', 'plugins/community', 'community', 0, 0, 1);
    $plg['kjomsocialgroups'] = checkThirdPartyVersion('kunenagroups', 'kunenagroups', 'Kunena Groups', 'plugins/community', 'community', 0, 0, 1);
    foreach ($plg as $id => $item) {
        if (empty($item)) {
            unset($plg[$id]);
        }
    }
    if (!empty($plg)) {
        $plgtext = '[quote][b]Plugins:[/b] ' . implode(' | ', $plg) . ' [/quote]';
    } else {
        $plgtext = '[quote][b]Plugins:[/b] None [/quote]';
    }
    $mod = array();
    $mod['kunenalatest'] = checkThirdPartyVersion('mod_kunenalatest', 'mod_kunenalatest', 'Kunena Latest', 'modules/mod_kunenalatest', null, 0, 1, 0);
    $mod['kunenastats'] = checkThirdPartyVersion('mod_kunenastats', 'mod_kunenastats', 'Kunena Stats', 'modules/mod_kunenastats', null, 0, 1, 0);
    $mod['kunenalogin'] = checkThirdPartyVersion('mod_kunenalogin', 'mod_kunenalogin', 'Kunena Login', 'modules/mod_kunenalogin', null, 0, 1, 0);
    $mod['kunenasearch'] = checkThirdPartyVersion('mod_kunenasearch', 'mod_kunenasearch', 'Kunena Search', 'modules/mod_kunenasearch', null, 0, 1, 0);
    foreach ($mod as $id => $item) {
        if (empty($item)) {
            unset($mod[$id]);
        }
    }
    if (!empty($mod)) {
        $modtext = '[quote][b]Modules:[/b] ' . implode(' | ', $mod) . ' [/quote]';
    } else {
        $modtext = '[quote][b]Modules:[/b] None [/quote]';
    }
    $thirdparty = array();
    if (JFile::exists(JPATH_SITE . '/components/com_alphauserpoints/helper.php')) {
        require_once JPATH_SITE . '/components/com_alphauserpoints/helper.php';
        $aup = new AlphaUserPointsHelper();
        $thirdparty['aup'] = '[u]AlphaUserPoints[/u] ' . $aup->getAupVersion();
    } else {
        $thirdparty['aup'] = checkThirdPartyVersion('alphauserpoints', array('manifest', 'alphauserpoints'), 'AlphaUserPoints', 'components/com_alphauserpoints', null, 1, 0, 0);
    }
    $thirdparty['cb'] = checkThirdPartyVersion('comprofiler', array('comprofilej', 'comprofileg'), 'CommunityBuilder', 'components/com_comprofiler', null, 1, 0, 0);
    $thirdparty['jomsocial'] = checkThirdPartyVersion('community', array('community'), 'Jomsocial', 'components/com_community', null, 1, 0, 0);
    if (JFile::exists(JPATH_SITE . '/components/com_uddeim/uddeim.api.php')) {
        require_once JPATH_SITE . '/components/com_uddeim/uddeim.api.php';
        $uddeim = new uddeIMAPI();
        $api_version = $uddeim->version();
        if ($api_version >= '3') {
            $uddeim_version = $uddeim->mainVersion();
            $thirdparty['uddeim'] = '[u]UddeIm[/u] ' . $uddeim_version['version'];
        } else {
            $thirdparty['uddeim'] = checkThirdPartyVersion('uddeim', array('uddeim.j15', 'uddeim'), 'UddeIm', 'components/com_uddeim', null, 1, 0, 0);
        }
    } else {
        $thirdparty['uddeim'] = checkThirdPartyVersion('uddeim', array('uddeim.j15', 'uddeim'), 'UddeIm', 'components/com_uddeim', null, 1, 0, 0);
    }
    foreach ($thirdparty as $id => $item) {
        if (empty($item)) {
            unset($thirdparty[$id]);
        }
    }
    if (!empty($thirdparty)) {
        $thirdpartytext = '[quote][b]Third-party components:[/b] ' . implode(' | ', $thirdparty) . ' [/quote]';
    } else {
        $thirdpartytext = '[quote][b]Third-party components:[/b] None [/quote]';
    }
    $sef = array();
    $sef['sh404sef'] = checkThirdPartyVersion('sh404sef', 'sh404sef', 'sh404sef', 'components/com_sh404sef', null, 1, 0, 0);
    $sef['joomsef'] = checkThirdPartyVersion('joomsef', 'sef', 'ARTIO JoomSEF', 'components/com_sef', null, 1, 0, 0);
    $sef['acesef'] = checkThirdPartyVersion('acesef', 'acesef', 'AceSEF', 'components/com_acesef', null, 1, 0, 0);
    foreach ($sef as $id => $item) {
        if (empty($item)) {
            unset($sef[$id]);
        }
    }
    if (!empty($sef)) {
        $seftext = '[quote][b]Third-party SEF components:[/b] ' . implode(' | ', $sef) . ' [/quote]';
    } else {
        $seftext = '[quote][b]Third-party SEF components:[/b] None [/quote]';
    }
    $report = '[confidential][b]Joomla! version:[/b] ' . $jversion . ' [b]Platform:[/b] ' . $_SERVER['SERVER_SOFTWARE'] . ' (' . $_SERVER['SERVER_NAME'] . ') [b]PHP version:[/b] ' . phpversion() . ' | ' . $safe_mode . ' | ' . $register_globals . ' | ' . $mbstring . ' | ' . $gd_support . ' | [b]MySQL version:[/b] ' . $kunena_db->getVersion() . '[/confidential][quote][b]Database collation check:[/b] ' . $collation . '
		[/quote][quote][b]Legacy mode:[/b] ' . $jconfig_legacy . ' | [b]Joomla! SEF:[/b] ' . $jconfig_sef . ' | [b]Joomla! SEF rewrite:[/b] ' . $jconfig_sef_rewrite . ' | [b]FTP layer:[/b] ' . $jconfig_ftp . ' |[confidential][b]Mailer:[/b] ' . $kunena_app->getCfg('mailer') . ' | [b]From name:[/b] ' . $kunena_app->getCfg('fromname') . ' | [b]SMTP Secure:[/b] ' . $kunena_app->getCfg('smtpsecure') . ' | [b]SMTP Port:[/b] ' . $kunena_app->getCfg('smtpport') . ' | [b]SMTP User:[/b] ' . $jconfig_smtpuser . ' | [b]SMTP Host:[/b] ' . $kunena_app->getCfg('smtphost') . ' [/confidential] [b]htaccess:[/b] ' . $htaccess . ' | [b]PHP environment:[/b] [u]Max execution time:[/u] ' . $maxExecTime . ' seconds | [u]Max execution memory:[/u] ' . $maxExecMem . ' | [u]Max file upload:[/u] ' . $fileuploads . ' [/quote][confidential][b]Kunena menu details[/b]:[spoiler] ' . $joomlamenudetails . '[/spoiler][/confidential][quote][b]Joomla default template details :[/b] ' . $templatedetails->name . ' | [u]author:[/u] ' . $templatedetails->author . ' | [u]version:[/u] ' . $templatedetails->version . ' | [u]creationdate:[/u] ' . $templatedetails->creationdate . ' [/quote][quote][b]Kunena default template details :[/b] ' . $ktempaltedetails->name . ' | [u]author:[/u] ' . $ktempaltedetails->author . ' | [u]version:[/u] ' . $ktempaltedetails->version . ' | [u]creationdate:[/u] ' . $ktempaltedetails->creationDate . ' [/quote][quote] [b]Kunena version detailled:[/b] [u]Installed version:[/u] ' . $kunenaVersionInfo->version . ' | [u]Build:[/u] ' . $kunenaVersionInfo->build . ' | [u]Version name:[/u] ' . $kunenaVersionInfo->name . ' | [u]Kunena detailled configuration:[/u] [spoiler] ' . $kconfigsettings . '[/spoiler][/quote]' . $thirdpartytext . ' ' . $seftext . ' ' . $plgtext . ' ' . $modtext;
    return $report;
}
示例#28
0
 function _get_inactive_members()
 {
     $inactive_members = 0;
     $num_days = 0;
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     $inactive_user_rule = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_inactiveuser');
     if ($inactive_user_rule && $inactive_user_rule[0]->published) {
         $num_days = intval($inactive_user_rule[0]->content_items);
         $db = JFactory::getDBO();
         $query = "SELECT COUNT(id) FROM #__alpha_userpoints WHERE userid > 0 AND published='1' AND referreid!='GUEST' AND (TO_DAYS(NOW()) - TO_DAYS(last_update)) > " . intval($inactive_user_rule[0]->content_items);
         $db->setQuery($query);
         $inactive_members = $db->loadResult();
     }
     return array($inactive_members, $num_days);
 }
示例#29
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);
         }
     }
 }
示例#30
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));
 }