Rule #1, don't create branches you don't need.
Rule #2, don't create nesting blocks (what JS re-re's called "closures" that have nothing to do with closing a damned thing) you don't need.
Rule #3, formatting is your friend.
Rule #4, when a function returns boolean true or false, you don't need to !== false on it.
MODULES[REQUEST]['path'] . '/' . MODULES[REQUEST]['file'] . '.php'
); else mainIndex($db);
Again, array_key_exists literally only returns boolean, so I've no clue why you had "!== false" on it.