Drupal: how to get the modules list
You can use drush pm-list --type=Module --status=enabled
command for getting a list of installed modules.
For further options, please check out http://www.drupaltonight.com/drupal-articles/using-drush-get-list-enabled-modules
Install "Drush" (a good option in any case, once you get used to it, you'll love it). It has a build in command to list all installed modules themes.
If you need to see the list of modules to display it elsewhere (this can be a security issue!), you can look into the way how drush does it (pm.drush.inc:218).
Furthermore there is a core function, but I don't know if this is what you want.