Recent Topics

Option to display debugging informations for Admin only

Started by on Jun 09, 2008 – Contents updated: Jun 09, 2008

Jun 09, 2008 00:16    

Something like $debug=3;

I don't think it's too hard ;) but sure it would be very useful ( I need it right now :( ).

Jun 09, 2008 14:07

Great Idea. I use it on coppermine-gallery. it helps.

Jun 10, 2008 13:01

inc/_main.inc.php add the new bits (around line 626):

PHP

// Display login errors (and form). This uses $io_charset, so it's at the end.
 
if( $Messages->count'login_error' ) )
{
    require $htsrv_path.'login.php';
    exit();
}
 
 
if( $debug == && ( !is_logged_in() || $current_User->group_ID != ) )
{
    $Debuglog = & new Log_noop'note' );
}
 
$Timer->pause'_main.inc');

¥

Jun 10, 2008 13:25

Thanks
It seems easy, but doesn't work.

Jun 10, 2008 20:34

Hmmm, I wonder if $debug is hard coded somewhere for < 3, try changing the if( $debug ==3 .... to if( $debug .... and seeing if that works, if not then I'll have a play with it later and see if I can get it working

¥

Jun 10, 2008 20:54

Just as a reminder:

Afwas> No Debug at all with if( $debug && ( [...]
<yabs> I assume you are logged in as an admin group user?
<Afwas> admin
<Afwas> There wasn't any Debug with debug == 3 either

Jun 10, 2008 21:25

I set $debug = 1 and tried to change inc/_main.inc.php line 167
It displays debug either with true or false. How does it work?

PHP

if( true )
{
    $Debuglog = & new Log_noop'note' );
}

Jun 11, 2008 08:27

New day, new head, new snippet ;)

PHP

if( $debug == && ( !is_logged_in() || $current_User->group_ID != ) )
{
    $debug 0;
    $Debuglog = & new Log_noop'note' );
}

¥

Jun 11, 2008 10:01

Perfect! :) Now it does what I want :cookie:

Jun 12, 2008 18:57

Minor correction to the above, the code needs to be moved slightly otherwise non-admins *could* still be shown debug output on the login form :

PHP

if( $debug == && ( !is_logged_in() || $current_User->group_ID != ) )
{
        $debug 0;
    $Debuglog = & new Log_noop'note' );
}
 
// Display login errors (and form). This uses $io_charset, so it's at the end.
 
if( $Messages->count'login_error' ) )
{
    require $htsrv_path.'login.php';
    exit();
}

¥

Jun 13, 2008 04:54

Just another reminder:

<Afwas> ¥åßßå, what's this: waning: register_shutdown_function() [function.register-shutdown-function]: Invalid shutdown callback 'shutdown' passed in /home/hemmi3/public_html/blog/inc/_main.inc.php on line 247
<Afwas> That's your proposed change
<yabs> you get that from the code change in profiles plugin?
<Afwas> No the debug thing when moving your code up a few lines
<Afwas> / Init charset handling:
<Afwas> init_charsets( $current_charset );
<Afwas> if( $debug == 3 && ( !is_logged_in() || $current_User->group_ID != 1 ) )
<Afwas> {
<Afwas> $debug = 0;
<Afwas> $Debuglog = & new Log_noop( 'note' );
<Afwas> }
<Afwas> / Display login errors (and form). This uses $io_charset, so it's at the end.
<Afwas> if( $Messages->count( 'login_error' ) )
<Afwas> {
<Afwas> require $htsrv_path.'login.php';
<Afwas> exit(0);
<Afwas> }
<yabs> ahhh, hmmm, that was a smidge untested, but it shouldn't have thrown that error
<yabs> I'll have to have a look when I get a free moment
<yabs> mind you, I'm still baffled as to why "$debug = 0" is required, it *really* shouldn't be
<yabs> ( not found the cause of that yet either )
<Afwas> funny
<yabs> I *think* it's sumat to do with $Session, but not narrowed it down ... might ask FG on dev list
<Afwas> go ahead, might even be interesting
<yabs> lol, yeah, might even provoke a reply! ;)

Jun 13, 2008 08:36

Hmmmm, I've just tried replicating this and failed miserably, I even tried it on your server and still failed to replicate it.

A search of all files in /inc/ gives this :

My editor of choice wrote:

Found 3 occurrences in 2 files for the word: register_shutdown_function
Yabba:/public_html/inc/plugins/model/_plugins.class.php (1716) register_shutdown_function( array(&$Plugin, 'CacheObjects'),
Yabba:/public_html/inc/plugins/model/_plugins.class.php (1740) register_shutdown_function( array(&$Plugin, 'CacheObjects'),
Yabba:/public_html/inc/sessions/model/_session.class.php (225) register_shutdown_function( array( & $this, 'dbsave' ) );

¥


Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.