This PHP snippet will list all enabled themes and modules in a colophon page. You can change the first two variables to change what is displayed.
It is probably a bad idea to show this page to anonymous users!!! Pick and choose who can see this, as it could allow malicious users to utilize known vulnerabilities in installed modules and core.

  // CONFIGURATION
  // Use the following variables to customize how the colophon is displayed:
  $show_modules_list = TRUE; // Set to TRUE to show the list of modules (Default is TRUE)
  $show_themes_list = TRUE;  // Set to TRUE to show the list of themes (Default is TRUE)

  // CONTENT
  echo 'The ' . variable_get(site_name, '') . ' Website is proudly
  powered by Drupal ' . VERSION . '. Drupal can be extended
  using many different themes and modules. Below are all of the
  modules and themes enabled on this site:<br />';

  // Modules
  if ($show_modules_list) {
    $modules = module_list(FALSE, FALSE, TRUE);
    echo '<h3 style="text-align: center;">Modules:</h3>';
    echo '<table><thead><th>Name</th><th>Version</th><th>Description</th><th>URL</th></thead><tbody>';
    foreach ($modules as $item) {
      if (module_exists($item)) { // Only list the module if it's enabled
        $module_loc = drupal_get_filename('module', $item); // The location of the Module
        $info = parse_ini_file(dirname($module_loc) . '/' . $item . '.info'); // Location of the info file
        $name = $info['name'];
        $description = $info['description'];
        $version = $info['version'];
        $project = $info['project'];
        $package = $info['package'];

        echo '<tr><td>' . $name;
        if ($package) {
          echo '<br /><small>(Part of ' . $package . ')';
        }
        echo '</td><td>' . $version . '</td><td>' . $description . '</td><td><a href="http://drupal.org/project/' . $project . '">http://drupal.org/project/' . $project . '</a></td></tr>';
      }
    }
    echo '</table>';
  }

  // Themes
  if ($show_themes_list) {
    $themes = list_themes();
    echo '<h3 style="text-align: center">Themes:</h3>';
    echo '<table><thead><th>Screenshot</th><th>Name</th></thead>';
    foreach ($themes as $item) {
      // Only lists the theme if the theme is enabled
      $list = get_object_vars($item); // Drupal's list_themes() function returns an array of objects, so we extract an array from each of the objects
      if ($list['status']) {  // Only list the theme if it is enabled
        $name = $list['name'];
        if (file_exists(dirname($list['filename']) . '/screenshot-drupal.org.png')) { // List the screenshot intended for drupal.or, if available
          $screenshot = dirname($list['filename']) . '/screenshot-drupal.org.png';
        } else {
          $screenshot = dirname($list['filename']) . '/screenshot.png';
        }
        echo '<td><img src="' . $screenshot . '" alt="' . $name . ' screenshot" /></td><td>' . $name . '</td></tr>';
      }
    }
    echo '</table>';
  }

Note

You may find that $screenshot needs a '/' added in front (though that may be something specific to the host provider). You can add the line below:

$screenshot = "/" . $screenshot;

immediately before the echo '<td><img ...

Comments

fehin’s picture

subscribing

izmeez’s picture

This php snippet also works for Drupal 6.x
However, in modules that have a long description line the following error occurs.

    * warning: Error parsing sites/all/modules/admin_menu/admin_menu.info on line 3 in /home/xxx/public_html/includes/common.inc(1685) : eval()'d code on line 21.
    * warning: Error parsing sites/all/modules/checkbox_validate/checkbox_validate.info on line 3 in /home/xxx/public_html/includes/common.inc(1685) : eval()'d code on line 21.

And those modules are excluded from the list.
Any thoughts on how to fix this?
Thanks.