Nukemods Forum  
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 53
4 members and 49 guests
bea9qgchcomberc, peardir46, ral6qkeighqenpa, whyjjinternetvi
Most users ever online was 611, 03-21-2008 at 10:10 PM.
» .::.
» .:.

Go Back   Nukemods Forum > NM Staff > Purged Topics

Reply
 
LinkBack Thread Tools Display Modes
Rewriting admin core, help with bug needed
Old
  (#1 (permalink))
Junior Member
 
Status: Offline
Posts: 1
Join Date: Dec 2002
Rewriting admin core, help with bug needed - 12-02-2002, 07:43 AM

Hi all,

(this post was originally written for a general PHP forum, i know you don't need the nuke architecture recap Also, FYI, the rewritten admin part will be called MantiCore and released as GPL, if i get to make it work)

background: i'm tweaking the phpnuke 6.0 core, so the admin permissions are registered as MySql records rather than in the filesystem

Platform is: W2K, Apache 1.3.27, PHP 4.2.3 with register_globals = On


(short) the problem: after the tweak some variables dissapear (set but empty) inside functions, in spite of being declared as globals inside them and being set and assigned right before the function call.

Code:
function whatever(){
global $x;
echo $x; --------------->doesn't work
print_r(get_defined_vars()); ---> shows $x is set, but empty


}


switch($op){

case "whatever":
$x =1;
echo $x; -----------------> it works right before the call!
whatever();
break;

}

(long) the problem:

PHPNuke has a quite messy and inflexible method of assigning perms to admins and building the control panel. It's based on a single file (admin.php) that receives always receives at least a $op variable (via $_GET) . Depending on the value of $op it will switch and include one of a set of files, which will in turn switch again and call the destiny function for that op. (Lost already? )

My alternate system is built around three tables and two php functions:

the tables: one of them "describing" the admin modules (name, id, default op, icon, etc..); another one relating admins to their allowed modules and another one relating one or many $ops to the correspondent module.

the functions: one of then acts as the switcher in admin.php; it receives the op and picks the corresponding file, then includes it. The other function resides in the header of every included module and check if your admin id is allowed to that module.

Everything is working alrigth for about 80% of use cases. The big bummer is that sometimes variables are lost the way show above in the individual module files. As an extra creepy feature, everything is OK if i declare the variable global at the very start of the included file (before it being even assigned)

I tried to pass an array with all defined vars to my switcher function and extract() it right before including the file. Still doesn't work.


I know it's a very general description of a very abstract problem and my english is not that good, but any, i mean any (PHP bug, globals misunderstanding, plain idiocy of mine) hint would be hugely appreciated
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admin User Permissions not letting me set myself as Admin MurphDog Purged Topics 8 01-10-2006 01:37 AM
Anyone know what core.XXXX files are? nickyu Open topics 1 12-11-2005 03:28 PM
Gallery Help needed McSpuds Nuke 7.x - General 1 10-06-2004 08:57 AM
Your Opinion Needed JerseyNB Purged Topics 3 06-04-2003 09:57 AM
Tutorial mod needed... joigudni Purged Topics 1 01-08-2003 04:38 PM




vBulletin Skin developed by: vBStyles.com


LinkBacks Enabled by vBSEO 3.3.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31