Thread: Show Thread Enhancements - Graffiti: Anonymous Thread Commentary
View Single Post
  #5  
Old 07-17-2011, 02:28 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works in 3.7.3 and 4.1.4 with some changes, so I'm not sure why it wasn't working in 3.8.6.

I've modified the main plug-in and it still works in 3.7.3 and I think it should solve the problem.

Go to Plug-in Manager, find "Graffiti main", clear it out and paste in this:

PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
    
'bit'                   => TYPE_NOHTML,
    
'threadid'              => TYPE_INT
));
//$threadid       = $vbulletin->GPC['threadid'];
$userid     $vbulletin->userinfo['userid'];
$username     $vbulletin->userinfo['username'];
$bitlimit     $vbulletin->options['graffiti_max_entries'];
$charlimit     $vbulletin->options['graffiti_max_chars'];
$show_name    $vbulletin->options['graffiti_showname'];
$showname_group explode(','$vbulletin->options['graffiti_showname_group']);
$bit        $vbulletin->GPC['bit'];
//$bit         = substr(convert_urlencoded_unicode($bit), 0, $charlimit);
$bit            htmlentities(substr(html_entity_decode($bit), 0$charlimit));
$bit            '<strong>' $username ': </strong>' $bit;
$bit         addslashes(convert_urlencoded_unicode($bit));

function 
select_graffiti()
{
    global 
$threadid$userid$username;
    global 
$userstr$countstr$graffiti_text;
    global 
$vbulletin;
    
$db $vbulletin->db;

    
$result =
    
$db->query_read  ("
                SELECT *
                FROM " 
TABLE_PREFIX "graffiti
                WHERE threadid = '
$threadid'    
            "
)or die(mysql_error());
    
$graffiti     $db->fetch_array($result);
    
$graffiti_text    $graffiti['string'];
    
$userstr    $graffiti['users'];
    
$countstr    $graffiti['counts'];

}
  
function 
insert_graffiti($bit)
{
    global 
$threadid$userid$username,  $bit;
    global 
$vbulletin;
    
$db $vbulletin->db;    
    
    
$db->query_write  ("
                INSERT INTO " 
TABLE_PREFIX "graffiti
                (
                    threadid, 
                    users, 
                    counts, 
                    string 
                )
                VALUES 
                (
                    '
$threadid',
                    '
$userid',
                    '1',
                    '
$bit'
                )
            "
)or die(mysql_error());
}

function 
update_graffiti()
{
    global 
$threadid$userid,  $username;
    global 
$userstr$countstr$graffiti_text;
    global 
$vbulletin;
    
$db $vbulletin->db;
    
$db->query_write  ("
                UPDATE " 
TABLE_PREFIX "graffiti
                SET  
                    users         = '
$userstr', 
                    counts         = '
$countstr', 
                    string         = '
$graffiti_text'
                WHERE 
                    threadid     = '
$threadid'
            "
)or die(mysql_error());
}
function 
add_graffiti()
{
    global 
$bitlimit$charlimit;
    global 
$userid$threadid$bit;
    global 
$userstr$countstr$graffiti_text$show_name$showname_group;
    global 
$vbulletin;
    
$db $vbulletin->db;
    
select_graffiti();
    
$userarray explode(","$userstr);
    
$count 0;
    
$ii = -1;
    for(
$i 0$i count($userarray); $i++)
    {
        if(
$userid == $userarray[$i]) $ii $i;
        
$count $countarray[$ii];
    }
    
$countarray explode(","$countstr);


    if(
$graffiti_text == NULL)
    {
        
insert_graffiti($bit);
        
$bit stripslashes($bit);
        
$return $bit;
    }
    else
    {
        
$graffiti_text $db->escape_string($graffiti_text); 
        
$graffiti_text .= ' ? ' $bit;
        if(
$ii == -1)
        { 
            
$countarray[] = 1;
            
$userarray[] = $userid;
        }
        else
        {
            
$countarray[$ii]++;
        }
        
$countstr     implode(','$countarray);
        
$userstr     implode(','$userarray);
        if(
$countarray[$ii] <= $bitlimitupdate_graffiti();
        
$return stripslashes($graffiti_text);    
    }
    
$showname1;
    if(!(
$show_name == OR in_array($vbulletin->userinfo['usergroupid'], $showname_group)))
    {
        
$return preg_replace('/<strong>[^>]+<\/strong>/'''$return);
        
$showname 0;
    }
    return 
$return;    
}
if(
$_REQUEST['do'] == 'addnew'
{
$threadid       $vbulletin->GPC['threadid'];
    
$return add_graffiti();
        die(
$return);
}
elseif(
$vbulletin->options['graffiti_onoff'] == 1
AND !in_array($vbulletin->userinfo['usergroupid'],explode(',',$vbulletin->options['graffiti_no_show']))
AND !
in_array($forumidexplode(','$vbulletin->options['graffiti_forum_noshow'])))
{
    
select_graffiti();
    
$showname 1;
    if(!(
$show_name == OR in_array($vbulletin->userinfo['usergroupid'], $showname_group)))
    {
        
$graffiti_text preg_replace('/<strong>[^>]+<\/strong>/'''$graffiti_text);
        
$showname 0;
    }
    
$usercounts array_combine(explode(','$userstr), explode(','$countstr));
    
$count 0;
    if(
$usercounts[$userid]) {$count $usercounts[$userid];}
    
$bitlimit $vbulletin->options['graffiti_max_entries'] - $count;
    
$inputdisplay '';
    if(
$bitlimit == 0
    
OR $vbulletin->userinfo['usergroupid'] == 1
    
OR in_array($vbulletin->userinfo['usergroupid'], explode(',',$vbulletin->options['graffiti_no_post']))
    OR 
in_array($vbulletin->userinfo['userid'],explode(',',$vbulletin->options['graffiti_banned'])))
    {
$inputdisplay 'none';}         
    eval(
'$graffiti = "' fetch_template('graffiti') . '";');

Let me know if it works and I will upload a cleaned up version and you can overwrite the present one.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02196 seconds
  • Memory Usage 1,892KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete