vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Major Additions - vBExperience 4 (https://vborg.vbsupport.ru/showthread.php?t=245023)

Phalynx 02-14-2012 07:13 AM

This has been already addressed in 4.1.0
However, vBExperience was never vulnerable to SQL, just remote cross-site scripting (XSS). Thats a big difference.

Vowgaming 02-14-2012 10:13 AM

Hi was wondering if I could get a hand on modding the code slightly.

My users Love the Mod but have raised a concern with activity showing up as negative points when a few things get changed or deleted

Was hopping for some pointers on what file or where I need to edit to modify this.

I also have coded up a ventrilo add on if someone would like a look at the raw basic code im happy to post.

Phalynx 02-14-2012 11:00 AM

There is no real possibility to disallow negative points, as vBExperience always recalculates all points from beginning. But you could do something with the hooks to save the points before they are wiped and only save if its get higher...

Would be great to see what you have done with Ventrilo.

Vowgaming 02-14-2012 11:52 AM

Warning This code is very poor in some ways. I'm not a professional coder at all just hack and play till i get it working.

firstly you need to use this in conjunction with http://www.ventrilo.com/dlprod.php?id=201

PHP Code:

<?php

include "ventrilostatus.php";

include 
"ventriloinfo_ex1.php";
include 
"ventrilodisplay_ex1.php";
include 
"ventrilodisplay_ex2.php";

$filename '/home/vowgamin/public_html/vent/ventrilo_status';

$current_timestamp=mktime(date("H"), date("i"), 0date("m"), date("d"), date("Y"));


function 
toArray($data) {
    if (
is_object($data)) $data get_object_vars($data);
    return 
is_array($data) ? array_map(__FUNCTION__$data) : $data;
}

function 
myTruncate($string$limit$break="."$pad="...")
{
// return with no change if string is shorter than $limit
    
if(strlen($string) <= $limit) return $string;
// is $break present between $limit and the end of the string?
    
if(false !== ($breakpoint strpos($string$break$limit))) {
        if(
$breakpoint strlen($string) - 1) {
$string substr($string0$breakpoint);
        }
    }
return 
$string;
}

$stat = new CVentriloStatus;
$stat->m_cmdprog    "/home/vowgamin/public_html/vent/ventrilo_status";    // Adjust accordingly.
$stat->m_cmdcode    "2";                    // Detail mode.
$stat->m_cmdhost    "Vent server address";            // Assume ventrilo server on same machine.
$stat->m_cmdport    "port";                // Port to be statused.
$stat->m_cmdpass    "";                    // Status password if necessary.

$rc $stat->Request();


$data toArray($stat);

// This code truncates the user names removing anything after the _ key
$i=0;
while (list(
$key$val) = each($data[m_clientlist]))
  {
  
$users[$i][name]=myTruncate($val[m_name],1"_");
  
$users[$i][chan]=myTruncate($val[m_cid],1"_");
  
$i=$i+1;
  }

$i=0;
foreach (
$users as $value) {

// the following checks ventrilo channel name if it is not the parent channel get the parent channel name
foreach ($data[m_channellist] as $k => $v)
{
    if (
$users[$i][chan] == $v[m_cid])
    {
        if (
$v[m_pid] == 0)
        {
            
$users[$i][chananme]=$v[m_name];
        }
        else
        {
            
$chan2=$v[m_pid];
            foreach (
$data[m_channellist] as $j => $b)
            {
            if (
$chan2 == $b[m_cid]) $users[$i][chananme]=$b[m_name];
            }
        }
    }
}
    
$i=$i+1;
  }

// connect to the database and pull out all the data assigning it to the forum array for searching latter
$link mysql_connect('localhost''********''**********');
if (!
$link) {
    die(
'Could not connect: ' mysql_error());
}
mysql_select_db("vowgamin_Vbulletin"$link);
$query "SELECT * FROM user";
$result mysql_query($query) or die(mysql_error());
$i=0;
while(
$row mysql_fetch_array($result)){
$forum[$i]['username']=$row['username'];
$forum[$i]['xperience']=$row['xperience'];
$forum[$i]['userid']=$row['userid'];
$forum[$i]['usergroupid']=$row['usergroupid'];
    
    
$i=$i+1;
    }

$size0;
$size20;
$size sizeof($users); // set the size of the upcoming for loops
$size2 sizeof($forum);

// go through all users on the vent server looking for a case insensitive match
for ($h 0$h <= $size$h++)
{
  for (
$i 0$i <= $size2$i++)
    {
    if (
strcasecmp($users[$h]['name'], $forum[$i]['username']) == 0)
    {
      
$m[$h]['username'] =$forum[$i]['username'];
      
$m[$h]['xperience'] =$forum[$i]['xperience'];
      
$m[$h]['channame'] =$users[$h]['chananme'];
      
$m[$h]['userid'] =$forum[$i]['userid'];
      
$m[$h]['usergroupid'] =$forum[$i]['usergroupid'];
    }

    if (
$users[$h]['name']=="Match")
    {
        
$match=4// the multiplier for clan matches
        
$chan=$users[$h][chananme]; // record the channel name down where match bot is located
    
}
    }
}

$array=array_filter($m);

$size3sizeof($array);
for (
$j 0$j <= $size3$j++)
{
$points=3// default points per cron job
$message"Ventrilo Participation";
$experience $array[$j]['xperience'];
$userid $array[$j]['userid'];

// Check to see if the match bot is in the chanel and change message plus points
if ($array[$j][channame] == $chan)
{
   
$message="Ventrilo Clan Match Participation";
    
$points=5*$match;
}
// adjust points to 1 for users sitting in afk channel
if ($array[$j][channame] == "AFK")
{
    
$points=1;
    
$message="AFK user";
}
if (
$array[$j][channame] == "Members Lounge")
{
    
$points=2;
    
$message="Members Lounge Ventrilo";
}
if (
$array[$j][channame] == "Sulk Room")
{
    
$points=-20;
    
$message="Members Lounge Ventrilo";
}
// adjust points for boot camp users to stop them ranking up to quick
if ($array[$j]['usergroupid'] == "55")
{
    
$points=1;
    
$message="Boot Camp User";
}

// check to make sure a user exists then enter data into the database
if ($userid)
{
$query2 "INSERT INTO xperience_custompoints (userid, points_misc_custom, adminid, comment, dateline) VALUES ( $userid$points , 1, '$message', $current_timestamp)";
//echo $query2."<br />";

mysql_query($query2);
}
}
mysql_close($link);


You will need to add your own server and port for ventrilo setup and change the ***** to your details for the database.

I have also hard coded this for the names of our vent channels and have included a check to see if a user match bot is part of the channel if it is increase the points

This script is run by a cron job every 15 mins and it adds points to the custom point table. (This is becoming an issue as the table is getting quite large)

Vowgaming 02-14-2012 12:13 PM

Quote:

Originally Posted by Phalynx (Post 2299544)
There is no real possibility to disallow negative points, as vBExperience always recalculates all points from beginning. But you could do something with the hooks to save the points before they are wiped and only save if its get higher...

Would be great to see what you have done with Ventrilo.

As you can see from the Ventrillo post above I'm ok a getting things modded can you give me a tip on where to start with this. I have looked through most of the php scripts and hooks. was hopping to find a place just before it wrote the info into the database and check if <0 skip the sql write

Iron Star 02-16-2012 06:27 AM

Hi,

I installed it and GG! Very good script.

I got bugs on xperience.php page:

- link to member profiles aren't correct in "recent activity"
- the template doesn't close correctly and footer is broken

How can I correct that?

Thank a lot.

Vowgaming 02-18-2012 04:30 AM

Quote:

Originally Posted by Vowgaming (Post 2299536)
Hi was wondering if I could get a hand on modding the code slightly.

My users Love the Mod but have raised a concern with activity showing up as negative points when a few things get changed or deleted

Was hopping for some pointers on what file or where I need to edit to modify this.

Found it in class_xperience.php

find this code
PHP Code:

($hook vBulletinHook::fetch_hook('xperience_calcdata_stats')) ? eval($hook) : false;
    
        if (
count($xperience_old) > AND count($xperience_new) > 0)
        {
            foreach(
$xperience_old AS $fieldk => $fielde)
            {
                if (!
in_array($fieldk$fields_notallowed))
                {
                    if (
$xperience_new[$fieldk] > $fielde OR $xperience_new[$fieldk] < $fielde)
                    {
                        
$difference $xperience_new[$fieldk] - $fielde

and add this line at the end

PHP Code:

if ($difference "0"$difference ="0"

That way if some one receives experience less then 0 it will be recorded as 0

I hope this is correct please tell me if i need to change anything else

Iron Star 02-18-2012 07:56 AM

Quote:

Originally Posted by Iron Star (Post 2300156)
Hi,


- link to member profiles aren't correct in "recent activity"


Thank a lot.

I found the pb in xperience_activity_x_earn template:

replace "<a href="{1}">{2}</a> earns {3}" with "<a href="member.php?u={1}">{2}</a> earns {3}"

JonUrban 02-18-2012 10:39 AM

I installed this and it seems to be working fine. It took about a week to get everyone's "Experience" level icons up to speed. It was interesting to see it happen over the week.

One thing that would be nice is if it could somehow subtract points for those who don't login anymore or have left the forum. I noticed that some members who have not logged in for years have large experience scores because they used to post a lot. Removing points for inactivity would be something that I would think would be a good feature.

Other than that, this is a great mod.

bposner 02-18-2012 06:58 PM

Seems achievement icons are not displaying, everything else seem fine. Seen screen shot:

http://screencast.com/t/t1pBz5bm


All times are GMT. The time now is 04:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04908 seconds
  • Memory Usage 1,834KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete