vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   No Permission Error on WOL (https://vborg.vbsupport.ru/showthread.php?t=44479)

NTLDR 10-10-2002 05:47 PM

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?

g-force2k2 10-10-2002 07:13 PM

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 :p

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

Xenon 10-10-2002 07:17 PM

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 ;)

g-force2k2 10-10-2002 07:20 PM

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

g-force2k2

Xenon 10-10-2002 07:40 PM

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

also take up the competition pal, it'll train our both skills ;););)

NTLDR 10-10-2002 08:00 PM

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.

Xenon 10-10-2002 08:10 PM

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 :)

NTLDR 10-10-2002 09:11 PM

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 :)

Logician 10-11-2002 08:39 AM

@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.. :)

Xenon 10-11-2002 10:05 AM

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



All times are GMT. The time now is 10:03 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.01224 seconds
  • Memory Usage 1,762KB
  • 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
  • (10)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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