You..actually use globals?
Sometimes complexity makes code suck, you need to realize this. Developing some huge class hierarchy for some things is not only a complete waste of time, but you get caught up in doing that and it makes the entire system run slower and less efficiently.
This is straight from SMF's Sources/Profile.php. Unmodified (but clipped because I didn't want to copy the entire function).
function saveProfileChanges(&$profile_vars, &$post_errors, $memID)
{
global $db_prefix, $user_info, $txt, $modSettings, $user_profile, $newpassemail, $valida$
// These make life easier....
$old_profile = &$user_profile[$memID];
// Permissions...
if ($context['user']['is_owner'])
{
$changeIdentity = allowedTo(array('profile_identity_any', 'profile_identity_own'$
$changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
}
else
{
$changeIdentity = allowedTo('profile_identity_any');
$changeOther = allowedTo('profile_extra_any');
}
Note the global.
Don't think that I'm not capable of developing a class hierarchy, because it's quite easy. However, there's just some things in which it's worth isn't quite good enough.