22
Got it.
And, in fine XOOPS tradition, I'll observe that you can find an explanation in the forums, at least a partial one,
hereBut the core problem is that block code is not the same as module code. It's not running with the same context as module code (no $xoopsModule), and it is included from within a function, so the code in system.php that you THINK is at global scope, is really within a function.
So, to fix:
1) Take references to xoopsModule out of system.php, if you are going to include it from block code. (You don't use it there anyway)
2) Move ALL CODE in system.php into functions (which is a good idea anyway). That way you will realize you have to have all the needed "global" statements.
I'd actually like to see this changed in 2.07, as it adds a lot of confusion, and compicates code sharing, but that's another long post.
Tom
p.s. As a "quick fix", in system.php comment out the $mid line, and then add
globalĀ $xoopsDB;
Then once you see that it works better, go back and fix it right.