
You will have to use PAM to authenticate your IMAP users too. Have a look at how your IMAP server can authenticate users. It is really server dependant.
Concerning security: if you are running inside a corporate network with no access to the Internet a NIS server properly configured would be definitively secure enough !!!
But PAM is indeed much powerfull and flexible. The problem is that the PHP pam_auth does not seems to be as flexible (reading the doc - never tried so I might be wrong).
Another remark: if you use PAM and you make your password travel in clear over the network (without HTTPS for XOOPS for instance or with IMAP), you will weaken the security of all your infrastructure. If the authentication repository behind your PAM module is known to be secure, it won't be anymore... Take care of what you are doing and think that the security level is defined by the weakest part of the architecture.
Hope this will help you to make the right choices according to your needs and requirements.
Benoit