[Submited] Debug Mod via ACP

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

[Submited] Debug Mod via ACP

Post by morpheus2matrix » Sun Sep 22, 2002 5:42 pm

ok, solike you can read in the title, this mod llow you to turn on/off the debug mod via admin control panel.

This is the mod :

Code: Select all

##############################################################
## MOD Title: Debug Mod via ACP
## MOD Author: morpheus2matrix <morpheus2matrix@yahoo.fr> - http://forum.2037.biz
## MOD Description: This mod will allow you to activate or desactivate the debug mod via the ACP
## MOD Version: 0.0.7
## Installation Level: Easy
## Installation Time: 
## Files to Edit: includes/functions.php,
##                admin/admin_board.php,
##                lang_english/lang_admin.php,
##                templates/admin/board_config_body.tpl
## Included Files: 
## Generator: MODEdit by Andareed <and_a_reed@hotmail.com>
########################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes: Thanks to netclectic and others who have tried to help me
## 
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('debug_mod','0');
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
# This action must be done 2 times so i put the code to do 2 times. 

#
#-----[ FIND ]------------------------------------------
#
if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( ($board_config['debug_mod'] == '1' || DEBUG) && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
#
#-----[ FIND ]------------------------------------------
#
if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( ($board_config['debug_mod'] == '1' || DEBUG) && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
$smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$debug_mod_yes = ( $new['debug_mod'] ) ? "checked=\"checked\"" : "";
$debug_mod_no = ( !$new['debug_mod'] ) ? "checked=\"checked\"" : "";
#
#-----[ FIND ]------------------------------------------
#
"L_SUBMIT" => $lang['Submit'], 
"L_RESET" => $lang['Reset'], 
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_DEBUG_MOD" => $lang['Debug_Mod'], 
"L_DEBUG_MOD_EXPLAIN" => $lang['Debug_Mod_explain'],
#
#-----[ FIND ]------------------------------------------
#
"S_COOKIE_SECURE_ENABLED" => $cookie_secure_yes, 
"S_COOKIE_SECURE_DISABLED" => $cookie_secure_no,
#
#-----[ AFTER, ADD ]------------------------------------------
#
"S_DEBUG_MOD_ENABLED" => $debug_mod_yes,
"S_DEBUG_MOD_DISABLED" => $debug_mod_no,
#
#-----[ OPEN ]------------------------------------------
#
lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Cookie_secure'] = 'Cookie secure';
$lang['Cookie_secure_explain'] = 'If your server is running via SSL set this to enabled else leave as disabled';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Debug_Mod'] = 'Debug Mod';
$lang['Debug_Mod_explain'] = 'By choosing yes, you will be able to turn on the debug mod';
#
#-----[ OPEN ]------------------------------------------
#
templates/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
	<td class="row1">{L_DISABLE_BOARD}<br /><span class="gensmall">{L_DISABLE_BOARD_EXPLAIN}</span></td>
	<td class="row2"><input type="radio" name="board_disable" value="1" {S_DISABLE_BOARD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="board_disable" value="0" {S_DISABLE_BOARD_NO} /> {L_NO}</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
	<td class="row1">{L_DEBUG_MOD}<br /><span class="gensmall">{L_DEBUG_MOD_EXPLAIN}</span></td>
	<td class="row2"><input type="radio" name="debug_mod" value="0" {S_DEBUG_MOD_DISABLED} />{L_DISABLED}&nbsp; &nbsp;<input type="radio" name="debug_mod" value="1" {S_DEBUG_MOD_ENABLED} />{L_ENABLED}</td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
#
# EoM

i've just a little problem with this mod :

if i put :

Code: Select all

if ( $board_config['debug_mod'] == '1')
{
	$debug_mod = 1;
}
else
{
	$debug_mod = 0;
}
define('DEBUG', $debug_mod);
debug mod is not working even if, in the db, it's to 1 (like if i choose "Active" in ACP)

but if i change that by :

Code: Select all

if ( $board_config['debug_mod'] = 1)
{
	$debug_mod = 1;
}
else
{
	$debug_mod = 0;
}
define('DEBUG', $debug_mod);
debug mod is active even if iin the db, it set to 0 (like is "Not Active" in ACP)

anyone cn help me ?


Bye.
Last edited by morpheus2matrix on Mon Sep 23, 2002 7:16 pm, edited 2 times in total.
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

nexialys
Registered User
Posts: 209
Joined: Tue May 21, 2002 1:26 pm
Location: Québec, between sky and hell...
Contact:

Post by nexialys » Sun Sep 22, 2002 5:54 pm

good thing, i hate4 to modify files by hand...

this is great to have this as a perf, instead of changing a file code...

i will not be able to test it, my website is perfect.. lol so no debug performs.. lol

but i like this feature!
-=nexia=-

i'm not god, i'm a nexialist... god is perfect.. i try to make it weak.

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Sun Sep 22, 2002 7:37 pm

thanks for your support :wink:


but have you any idea for my problem ?
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

Mohd
Registered User
Posts: 263
Joined: Mon Jul 15, 2002 9:06 pm
Contact:

Post by Mohd » Sun Sep 22, 2002 8:26 pm

I am not sure the one in constant file I thing they should be removed and about = it means you assgin 0 to debug mod so it will be always 0 and for the constant file also.


edit:

for the debug mod the value is taken from the constant file not from the database.

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Sun Sep 22, 2002 8:30 pm

squall wrote: edit:

for the debug mod the value is taken from the constant file not from the database.


yes, but with this mod, i'm tried to stored it in the database, and it work.

But, the code in constants.php is not working :cry:
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

Mohd
Registered User
Posts: 263
Joined: Mon Jul 15, 2002 9:06 pm
Contact:

Post by Mohd » Sun Sep 22, 2002 8:32 pm

morpheus2matrix wrote:
squall wrote:edit:

for the debug mod the value is taken from the constant file not from the database.


yes, but with this mod, i'm tried to stored it in the database, and it work.

But, the code in constants.php is not working :cry:


may you should define this variable in constant file like this

Code: Select all

define('DEBUG', $debug_mod); 

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Sun Sep 22, 2002 8:36 pm

it's work like that actually :wink:
Mod wrote: #-----[ FIND ]------------------------------------------
#
// Debug Level
//define('DEBUG', 1); // Debugging on
define('DEBUG', 0); // Debugging off
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $board_config['debug_mod'] == '1')
{
$debug_mod = 1;
}
else
{
$debug_mod = 0;
}
define('DEBUG', $debug_mod);
#
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

Mohd
Registered User
Posts: 263
Joined: Mon Jul 15, 2002 9:06 pm
Contact:

Post by Mohd » Sun Sep 22, 2002 8:41 pm

morpheus2matrix wrote: it's work like that actually :wink:
Mod wrote:
#-----[ FIND ]------------------------------------------
#
// Debug Level
//define('DEBUG', 1); // Debugging on
define('DEBUG', 0); // Debugging off
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $board_config['debug_mod'] == '1')
{
$debug_mod = 1;
}
else
{
$debug_mod = 0;
}
define('DEBUG', $debug_mod);
#


remove the qoute from the number 1 this quote only used for charcters i think

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Sun Sep 22, 2002 9:01 pm

same thing :cry:
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

Mohd
Registered User
Posts: 263
Joined: Mon Jul 15, 2002 9:06 pm
Contact:

Post by Mohd » Sun Sep 22, 2002 9:07 pm

morpheus2matrix wrote: same thing :cry:



write it in this way (not sure)

Code: Select all

#-----[ FIND ]------------------------------------------ 
# 
// Debug Level 
//define('DEBUG', 1); // Debugging on 
define('DEBUG', 0); // Debugging off 


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
if ( $board_config['debug_mod'] == '1') 
{ 
define('DEBUG', 1);
} 
else 
{ 
define('DEBUG', 0);
} 
# 
[/code]

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Sun Sep 22, 2002 9:26 pm

same thing : not working (i've already tried before posting the mod but in doubt, i've re-tried and no, this doesn't work)
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

nexialys
Registered User
Posts: 209
Joined: Tue May 21, 2002 1:26 pm
Location: Québec, between sky and hell...
Contact:

Post by nexialys » Sun Sep 22, 2002 9:44 pm

as i hate to define many times a variable, i'd suggest this...:

Code: Select all

if ( $board_config['debug_mod'] == 1 ) 
{ 
define('DEBUG', 1); 
} 
else 
{ 
define('DEBUG', 0);
} 
 
but as you tried, i'm not sure how to do it... hum...
-=nexia=-

i'm not god, i'm a nexialist... god is perfect.. i try to make it weak.

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic » Sun Sep 22, 2002 11:46 pm

Your problem stems from the fact that the constants file is included before the board config is setup. You will see this in common.php.

To get around this you should remove the debug line from the constants file and do this...

in includes/functions.php
find (x2 - do this twice!!!!!!)

Code: Select all

if ( DEBUG
replace with

Code: Select all

if ( $board_config['debug_mod'] == '1'
Defend the game:
Image

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Mon Sep 23, 2002 7:19 am

ok, i will give it a try ASAP, thanks for your help.
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Mon Sep 23, 2002 5:05 pm

ok i've try your code netclectic and it work !!

i've corrected my post above to include the change.

Someone can test it to see if all is ok ?


Bye.
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

Post Reply

Return to “[2.0.x] MODs in Development”