Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2002, 05:47 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default No Permission Error on WOL

I've been trying without much luck to get the text No Permission in front of a users loaction on the WOL page if they have the standard no permission error, like vB3 has.

Anyone have any ideas/know how to do this?
Reply With Quote
  #2  
Old 10-10-2002, 07:13 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

err... do you mean for the users that are trying to view the wol or the users that have permission and view other users that get wol permission errors? i haven't seen the vb3 wol in the works yet sorry

but should be able to do somethign within the function included in the online.php

the varaiable...

$userinfo[activity]

thats in the whosonlinebit

in the php file find...

PHP Code:
return $userinfo
above it try adding...

PHP Code:
if($bbuserinfo['userid'] == 0)
  
$userinfo[activity] == "No Permission"
not sure if you can do anything with that... but i would approach the situation somewhere along those lines regards...

g-force2k2
Reply With Quote
  #3  
Old 10-10-2002, 07:17 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, i think they use another session system within vb3..

perhaps an idea:

open admin/functions.php
find:
PHP Code:
// ###################### Start show_nopermission #######################
function show_nopermission() {
  global 
$bbtitle,$logincode,$url,$scriptpath,$bbuserinfo,$session;

  
// generate 'logged in as:' box or username and pwd box
  
if (!$logincode) {
    
$logincode=makelogincode();
  } 
below add:
PHP Code:
$DB_site->query("UPDATE session SET location=CONCAT('nop-',location) WHERE sessionhash='$session[sessionhash]'"); 
then in online.php
find:
PHP Code:
        $userinfo[$key][location] = $user[location]; 
and replace with:
PHP Code:
if (strstr($user[location],'nop-')) {
        
$userinfo[$key][location] = substr($user[location],4);
        
$userinfo[$key][nop] = 'No Permission - ';
} else {
        
$userinfo[$key][location] = $user[location];
        
$userinfo[$key][nop] = '';


then edit your whosonlinebit template and add
$userinfo[nop] before $userinfo[where]

i'm not sure if it works correct, but the idea should work, maybe small bugs in
Reply With Quote
  #4  
Old 10-10-2002, 07:20 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

then again Xenon's code is probably alot more affective for one it uses the show_nopermission function so yeah his code is more effecient and effective oh well i tried...

g-force2k2
Reply With Quote
  #5  
Old 10-10-2002, 07:40 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As long as the guardians solve the problems it's good

also take up the competition pal, it'll train our both skills
Reply With Quote
  #6  
Old 10-10-2002, 08:00 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help Xenon and g-force2k2.

I started out along the same lines as what Xenon posted, the problem is that the query that adds nop- to the start of the location gets overwritten by the final query that is run for the page, which updates the users session and therefore re-setting the location without the nop- preceding it.

I can't seem to see anyway around it where the nop- will get removed when the session is updated and the users hasn't got the show_nopermission(); message.
Reply With Quote
  #7  
Old 10-10-2002, 08:10 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it is?

hmm the query within the function show_nopermission should be the last query, because there's an exit call in it...

hmm
*subscribing to the thread*
i'll test it out tomorrow perhaps i can find a way
Reply With Quote
  #8  
Old 10-10-2002, 09:11 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I turned debug on to see and it was about 8th out of the 13 queries that were being run.

Thanks for the help Xenon
Reply With Quote
  #9  
Old 10-11-2002, 08:39 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@NTLDR: This is a good hack idea, I can use this one too. I can't convince my Super Moderators that user in whoisonline is not actually in that location when he's not allowed.

@Xenon: Your algorithm is very good, congratulations.

And the solution:
The problem why your solutions do not apply is related to the PHP's register_shutdown_function(). To recap, in PHP you can set the script to run a couple of commands before its execution is terminated. This is done via register_shutdown_function and allows the developer to arrange things before the script ends.. So even if you put an "EXIT" command right after

$DB_site->query("UPDATE session SET location=CONCAT('nop-',location) WHERE sessionhash='$session[sessionhash]'");

You'll find that the location field is still overwritten. This is because the function doshutdown() runs right before the script ends (as a part of register_shutdown configuration) and it overwrites your table field since there is another session update in that function.

The solution as you might guess is to hack that function too.. It's in function.php.

BTW. I like threads like this, they are good for our brain..
Reply With Quote
  #10  
Old 10-11-2002, 10:05 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thx pal

i didn't know the how the shutdownfunction works, now i see why you always have to reload the who's online to show yourself viewing who's online ...


well i think then it shouldn't be so hard to fix this bug:

instead of this line
PHP Code:
$DB_site->query("UPDATE session SET location=CONCAT('nop-',location) WHERE sessionhash='$session[sessionhash]'"); 
you have to use this i think:
PHP Code:
    if ($noshutdownfunc) {
$DB_site->query("UPDATE session SET location=CONCAT('nop-',location) WHERE sessionhash='$session[sessionhash]'");
} else {
$shutdownqueries[]="UPDATE session SET location=CONCAT('nop-',location) WHERE sessionhash='$session[sessionhash]'";

then you have to change also in show_nopermission function:
PHP Code:
  global $bbtitle,$logincode,$url,$scriptpath,$bbuserinfo,$session
into
PHP Code:
  global $bbtitle,$logincode,$url,$scriptpath,$bbuserinfo,$session,$noshutdownfunc,$shutdownqueries
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04547 seconds
  • Memory Usage 2,285KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete