vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Warning Hack V1.5 (https://vborg.vbsupport.ru/showthread.php?t=65336)

Neutral Singh 10-01-2004 05:58 AM

Gr8 Hack !! Aman Clicks Install !!

I see warning options on each post but when a member clicks on these links he gets no permission message. What is use of showing it when they can not view it. Is there any option which makes it possible only for admin to view those links on each post or can an admin give permissions for users to view their warnings. i am a newbie, so kindly bear with me, please guide me.

Best Regards

Regards

sv1cec 10-01-2004 06:16 AM

Quote:

Originally Posted by amanpartaps
Gr8 Hack !! Aman Clicks Install !!

I see warning options on each post but when a member clicks on these links he gets no permission message. What is use of showing it when they can not view it. Is there any option which makes it possible only for admin to view those links on each post or can an admin give permissions for users to view their warnings. i am a newbie, so kindly bear with me, please guide me.

Best Regards

Regards

It all depends on your postbit conditionals. If you use the conditionals below, the admins and mods can see the "Warn XYZ" and "View XYZ Warnings", but a normal member can only see the "View my warnings" link.

PHP Code:

<if condition="$post[usergroupid]!=6 AND $post[usergroupid]!=7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])"><a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'>Warn $post[username]</a> ? 
</if>
<if 
condition="$post[usergroupid]!=6 AND $post[usergroupid]!=7 AND ($bbuserinfo[usergroupid]==7 OR $bbuserinfo[usergroupid]==6)">
<
a href='Warn.php?do=ViewWarnings&id=$post[userid]'>View $post[username]'s Warnings</a> ?</if>
<if condition="$post[userid]==$bbuserinfo[userid] AND $post[usergroupid]==2 AND $post[warning_level]>0">
<a href='
Warn.php?do=ViewMyWarnings'>View your Warnings</a> ?</if> 

Oh yes, the moderators can see the "Warn XYZ" link, only in the forums they are assigned as moderators. Please make sure that your admin and mod usergroups are 6 and 7, otherwise change these accordingly.

I hope this helps.
------------
John

fridayweb 10-02-2004 02:36 AM

That's not it though... I've changed the conditionals and my regular users can see it, they can click on it, but they can't get to the actual warn.php listing. Is it because of the 'canadmin' conditional in that .php file?

sv1cec 10-02-2004 10:17 AM

Quote:

Originally Posted by fridayweb
That's not it though... I've changed the conditionals and my regular users can see it, they can click on it, but they can't get to the actual warn.php listing. Is it because of the 'canadmin' conditional in that .php file?

I am not sure I understand you. With the conditionals I posted, a normal user can see only his own warnings, via the link "View your warnings". Let's analyze that a bit:

PHP Code:

<if condition="$post[usergroupid]!=6 AND $post[usergroupid]!=7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])"><a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'>Warn $post[username]</a> ?
</if> 

This checks if the person who posted is an admin or a mod (if they are, they cannot be warned) and if they are not, then it checks if the viewer has the right to moderate that particular forum. If he has the rights (i.e. he is either a mod for that forum or an admin), he gets the Warn User link.

PHP Code:

<if condition="$post[usergroupid]!=6 AND $post[usergroupid]!=7 AND ($bbuserinfo[usergroupid]==7 OR $bbuserinfo[usergroupid]==6)">
<
a href='Warn.php?do=ViewWarnings&id=$post[userid]'>View $post[username]'s Warnings</a> ?</if> 

This checks if the poster is not an admin or a mod, and if the user is an admin or a mod. In that case, it shows the "View User Warnings". In other words an admin or a moderator can always view the "View User Warnings" link, except if the poster is himself and admin or a moderator.

PHP Code:

<if condition="$post[userid]==$bbuserinfo[userid] AND $post[usergroupid]==2 AND $post[warning_level]>0">
<
a href='Warn.php?do=ViewMyWarnings'>View your Warnings</a> ?</if> 

This checks if the poster user is the same with the viewing user. and that this user is a registered user. If he is, he only gets the "View Your Warnings" link, which allows him to see his own warnings only. If he clicks on that link, he will be shown his warnings.

Isn't that what happens in your setup?

Rgds

fridayweb 10-02-2004 02:47 PM

I understand everything you said, and I appreciate the break down. Yes users can currently see their own warnings. All users can see "View Warnings" if that person has greater than 0 points.

I want ALL users to be able to see ALL warnings of any other user. I'm sorry to be a bother, I'm just trying to get this worked out.

They still keep getting a No Permission - "you do not have permission to access this page." Error.

I think it has to do with "Warn.php?do=ViewWarnings&id=3732" .... the do ViewWarnings is set up in the .php code to be associated with canmoderate. I want to separate that out so that I can set it up by usergroups as well. Does that make sense?

sv1cec 10-03-2004 05:18 AM

Quote:

Originally Posted by fridayweb
I understand everything you said, and I appreciate the break down. Yes users can currently see their own warnings. All users can see "View Warnings" if that person has greater than 0 points.

I want ALL users to be able to see ALL warnings of any other user. I'm sorry to be a bother, I'm just trying to get this worked out.

They still keep getting a No Permission - "you do not have permission to access this page." Error.

I think it has to do with "Warn.php?do=ViewWarnings&id=3732" .... the do ViewWarnings is set up in the .php code to be associated with canmoderate. I want to separate that out so that I can set it up by usergroups as well. Does that make sense?

Oh, OK, that's simple enough. In your Warn.php file, find:

PHP Code:

// You have permission to warn o_O
if($_GET['do']!='ViewMyWarnings'){
if(!
can_moderate(  )){
print_no_permission(  );
}


Replace that with :

PHP Code:

// // You have permission to warn o_O
// if($_GET['do']!='ViewMyWarnings'){
// if(!can_moderate(  )){
// print_no_permission(  );
// }
// } 

I hope this gets it for you.

Rgds
------------
John

msimplay 10-03-2004 06:55 AM

any news on how to stop people from warning the same post twice ?

Anek 10-03-2004 10:02 AM

Quote:

Originally Posted by sv1cec
One issue I had with this hack, is the fact that it uses a separate table, to maintain those members which get banned. If you do that, then you have to manually change their status to unbanned, when the banning period expires.

Why can't we use the normal table, in which vB stores the banned users, called "userban"? In that way, we can have the vB's cron job take care of the unbanning.

For those who are interested in this, all you have to do, is the followings:

In your warn.php file, find the following line:

PHP Code:

$DB->query("insert into ".TABLE_PREFIX."banned_members values ('','{$user['userid']}','".time()."','{$time_unban}')"); 

Replace it, with the followings:

PHP Code:

        if($warn_type['warn_permban']=="Yes")
            {
$liftdate=0;
             }
            else
            {
$liftdate=$time_unban;
             }
                 
$usergroupid=8
        $DB_site
->query("
            INSERT INTO " 
TABLE_PREFIX "userban
            (userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate)
            VALUES
            (
$user[userid]$user[usergroupid]$user[displaygroupid]$user[customtitle], '" addslashes($user['usertitle']) . "', $bbuserinfo[userid], " TIMENOW ", $liftdate)");
        
$DB_site->query("
                UPDATE " 
TABLE_PREFIX "user SET
                usergroupid = 
$usergroupid,
                displaygroupid = 
$usergroupid
                WHERE userid = 
$user[userid]
            "
); 

Of course, in this case, ...etc


Hi.
I replaced the code but now when I click on "warn XYZ" or "View XYZ's Warnings" it give me this error

Code:

Parse error: parse error, unexpected T_VARIABLE in /home/www/.........../Warn.php on line 278
where line 278 is the first line of your code... any idea?

Thx

sv1cec 10-03-2004 04:02 PM

Quote:

Originally Posted by Anek
Hi.
I replaced the code but now when I click on "warn XYZ" or "View XYZ's Warnings" it give me this error

Code:

Parse error: parse error, unexpected T_VARIABLE in /home/www/.........../Warn.php on line 278
where line 278 is the first line of your code... any idea?

Thx

Yes, as I said before, I have made several changes in this hack, to make it more suitable for my needs. One such change is the addition of a new field, warn_permban in the table, which indicates if the offence of the user deserves (and gives him) a permanent ban. You obviously do not have that field in your database and you get that error.

You may remove that part of the code, and use it. Just replace:

PHP Code:

if($warn_type['warn_permban']=="Yes")
            {
$liftdate=0;
             }
            else
            {
$liftdate=$time_unban;
             } 

with

PHP Code:

            $liftdate=$time_unban

That should do it.

Let me know if it works.

Rgds
------------
John

fridayweb 10-03-2004 04:19 PM

Quote:

Originally Posted by sv1cec
Oh, OK, that's simple enough. In your Warn.php file, find:

PHP Code:

// You have permission to warn o_O
if($_GET['do']!='ViewMyWarnings'){
if(!
can_moderate(  )){
print_no_permission(  );
}


Replace that with :

PHP Code:

// // You have permission to warn o_O
// if($_GET['do']!='ViewMyWarnings'){
// if(!can_moderate(  )){
// print_no_permission(  );
// }
// } 

I hope this gets it for you.

Rgds
------------
John


Worked like a charm, thank you so much. Stupid me, I didn't think to comment it out, I thought I had to change it to usergroups or something. Thanks again!!


All times are GMT. The time now is 12:47 PM.

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.01689 seconds
  • Memory Usage 1,806KB
  • 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
  • (2)bbcode_code_printable
  • (12)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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