diff --git a/release/includes/admin.settings.inc b/release/includes/admin.settings.inc
index b808771..7aea136 100644
--- a/release/includes/admin.settings.inc
+++ b/release/includes/admin.settings.inc
@@ -8,7 +8,7 @@
 /**
  * Build the form for the project_release settings administration page.
  */
-function project_release_settings_form() {
+function project_release_settings_form($form, &$form_state) {
   if ($rel_dir = variable_get('project_release_directory', '')) {
     $form['project_release_directory'] = array(
       '#type' => 'textfield',
@@ -25,7 +25,7 @@ function project_release_settings_form() {
     '#default_value' => variable_get('project_release_default_version_format', PROJECT_RELEASE_DEFAULT_VERSION_FORMAT),
     '#size' => 50,
     '#maxlength' => 255,
-    '#description' => t('Customize the default format of the version strings for releases of projects on this site. Users with "administer projects" permissions can override this setting for each project.') .' '. PROJECT_RELEASE_VERSION_FORMAT_HELP,
+    '#description' => t('Customize the default format of the version strings for releases of projects on this site. Users with "administer projects" permissions can override this setting for each project.') . ' ' . PROJECT_RELEASE_VERSION_FORMAT_HELP,
   );
 
   $form['project_release_file_extensions'] = array(
@@ -105,7 +105,7 @@ function project_release_settings_form_validate($form, &$form_state) {
   // If set, the project_release_download_base must end with a '/'
   if (!empty($form_state['values']['project_release_download_base'])) {
     if (substr($form_state['values']['project_release_download_base'], -1) != '/') {
-       form_set_error('project_release_download_base', t('The <em>Download link base URL</em> should end with a slash.'));
+      form_set_error('project_release_download_base', t('The <em>Download link base URL</em> should end with a slash.'));
     }
   }
 }
diff --git a/release/includes/packager.inc b/release/includes/packager.inc
index 894e83e..4900e66 100644
--- a/release/includes/packager.inc
+++ b/release/includes/packager.inc
@@ -170,19 +170,61 @@ function project_release_packager_update_node($release_node, $file_destination_d
       $file_mime = file_get_mimetype($full_path);
 
       // First, see if we already have this file for this release node
-      $file_data = db_fetch_object(db_query("SELECT prf.* FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE prf.nid = %d AND f.filename = '%s'", $release_node->nid, $file_name));
+      $file_data = db_fetch_object(db_query("SELECT prf.* FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE prf.nid = :prf.nid AND f.filename = :f.filename", array(':prf.nid' => $release_node->nid, ':f.filename' => $file_name)));
 
       // Insert or update the record in the DB as need.
       if (empty($file_data)) {
         // Don't have this file, insert a new record.
-        db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', %d, %d, %d)", $release_node->uid, $file_name, $file_path, $file_mime, $file_size, FILE_STATUS_PERMANENT, $file_date);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', %d, %d, %d)", $release_node->uid, $file_name, $file_path, $file_mime, $file_size, FILE_STATUS_PERMANENT, $file_date) */
+        $id = db_insert('files')
+  ->fields(array(
+          'uid' => $release_node->uid,
+          'filename' => $file_name,
+          'filepath' => $file_path,
+          'filemime' => $file_mime,
+          'filesize' => $file_size,
+          'status' => FILE_STATUS_PERMANENT,
+          'timestamp' => $file_date,
+        ))
+  ->execute();
         $fid = db_last_insert_id('files', 'fid');
-        db_query("INSERT INTO {project_release_file} (fid, nid, filehash, weight) VALUES (%d, %d, '%s', %d)", $fid, $release_node->nid, $file_hash, $file_weight);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("INSERT INTO {project_release_file} (fid, nid, filehash, weight) VALUES (%d, %d, '%s', %d)", $fid, $release_node->nid, $file_hash, $file_weight) */
+        $id = db_insert('project_release_file')
+  ->fields(array(
+          'fid' => $fid,
+          'nid' => $release_node->nid,
+          'filehash' => $file_hash,
+          'weight' => $file_weight,
+        ))
+  ->execute();
       }
       else {
         // Already have this file for this release, update it.
-        db_query("UPDATE {files} SET uid = %d, filename = '%s', filepath = '%s', filemime = '%s', filesize = %d, status = %d, timestamp = %d WHERE fid = %d", $release_node->uid, $file_name, $file_path, $file_mime, $file_size, FILE_STATUS_PERMANENT, $file_date, $file_data->fid);
-        db_query("UPDATE {project_release_file} SET filehash = '%s', weight = %d WHERE fid = %d", $file_hash, $file_weight, $file_data->fid);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("UPDATE {files} SET uid = %d, filename = '%s', filepath = '%s', filemime = '%s', filesize = %d, status = %d, timestamp = %d WHERE fid = %d", $release_node->uid, $file_name, $file_path, $file_mime, $file_size, FILE_STATUS_PERMANENT, $file_date, $file_data->fid) */
+        db_update('files')
+  ->fields(array(
+          'uid' => $release_node->uid,
+          'filename' => $file_name,
+          'filepath' => $file_path,
+          'filemime' => $file_mime,
+          'filesize' => $file_size,
+          'status' => FILE_STATUS_PERMANENT,
+          'timestamp' => $file_date,
+        ))
+  ->condition('fid', $file_data->fid)
+  ->execute();
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("UPDATE {project_release_file} SET filehash = '%s', weight = %d WHERE fid = %d", $file_hash, $file_weight, $file_data->fid) */
+        db_update('project_release_file')
+  ->fields(array(
+          'filehash' => $file_hash,
+          'weight' => $file_weight,
+        ))
+  ->condition('fid', $file_data->fid)
+  ->execute();
       }
     }
   }
@@ -190,7 +232,14 @@ function project_release_packager_update_node($release_node, $file_destination_d
   // Store package contents if necessary.
   if (!empty($package_contents) && module_exists('project_package')) {
     foreach ($package_contents as $item_nid) {
-      db_query("INSERT INTO {project_package_local_release_item} (package_nid, item_nid) VALUES (%d, %d)", $release_node->nid, $item_nid);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("INSERT INTO {project_package_local_release_item} (package_nid, item_nid) VALUES (%d, %d)", $release_node->nid, $item_nid) */
+      $id = db_insert('project_package_local_release_item')
+  ->fields(array(
+        'package_nid' => $release_node->nid,
+        'item_nid' => $item_nid,
+      ))
+  ->execute();
     }
   }
 
diff --git a/release/includes/project_edit_releases.inc b/release/includes/project_edit_releases.inc
index ed99063..7daf1b0 100644
--- a/release/includes/project_edit_releases.inc
+++ b/release/includes/project_edit_releases.inc
@@ -10,11 +10,15 @@
  */
 function project_release_project_edit_releases($node) {
   project_project_set_breadcrumb($node);
-  drupal_set_title(check_plain($node->title));
+  drupal_set_title($node->title);
   return drupal_get_form('project_release_project_edit_form', $node);
 }
 
-function project_release_project_edit_form($form_state, $node) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function project_release_project_edit_form($form, $form_state, $node) {
   $active_tids = project_release_compatibility_list();
   if (count($active_tids) > 0) {
     // Get all the data about major versions for this project.
@@ -61,11 +65,14 @@ function project_release_project_edit_form($form_state, $node) {
       '#default_value' => $node->project_release['version_format'],
       '#size' => 50,
       '#maxlength' => 255,
-      '#description' => t('Customize the format of the version strings for releases of this project.') .' '. PROJECT_RELEASE_VERSION_FORMAT_HELP .' '. t('If blank, this project will use the site-wide default (currently set to: %default)', array('%default' => variable_get('project_release_default_version_format', PROJECT_RELEASE_DEFAULT_VERSION_FORMAT))),
+      '#description' => t('Customize the format of the version strings for releases of this project.') . ' ' . PROJECT_RELEASE_VERSION_FORMAT_HELP . ' ' . t('If blank, this project will use the site-wide default (currently set to: %default)', array('%default' => variable_get('project_release_default_version_format', PROJECT_RELEASE_DEFAULT_VERSION_FORMAT))),
     );
   }
 
-  $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
+  $form['nid'] = array(
+    '#type' => 'value',
+    '#value' => $node->nid,
+  );
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save'),
@@ -83,10 +90,11 @@ function _project_release_get_version_major_data($node) {
   $active_tids = project_release_compatibility_list();
   $tid_where = '';
   if (!empty($active_tids)) {
-    $tid_where = 'prsv.tid IN ('. db_placeholders($active_tids) .')';
+    $tid_where = 'prsv.tid IN (' . db_placeholders($active_tids) . ')';
     $params = array_merge($params, array_keys($active_tids));
   }
-  $result = db_query("SELECT prsv.*, td.name AS term_name FROM {project_release_supported_versions} prsv INNER JOIN {term_data} td ON prsv.tid = td.tid WHERE prsv.nid = %d AND $tid_where ORDER BY td.weight, td.name", $params);
+  // TODO Please convert this statement to the D7 database API syntax.
+  $result = db_query("SELECT prsv.*, td.name AS term_name FROM {project_release_supported_versions} prsv INNER JOIN {taxonomy_term_data} td ON prsv.tid = td.tid WHERE prsv.nid = %d AND $tid_where ORDER BY td.weight, td.name", $params);
   while ($obj = db_fetch_object($result)) {
     $tid = $obj->tid;
     if (empty($data[$tid])) {
@@ -105,8 +113,8 @@ function _project_release_get_version_major_data($node) {
 }
 
 function _project_release_edit_version_major_form($data) {
-// Since this form is used relatively infrequently, don't allow the js to be aggregated.
-  drupal_add_js(drupal_get_path('module', 'project_release') .'/project_release.js', 'module', 'header', FALSE, TRUE, FALSE);
+  // Since this form is used relatively infrequently, don't allow the js to be aggregated.
+  drupal_add_js(drupal_get_path('module', 'project_release') . '/project_release.js', array('preprocess' => FALSE));
   $form = array();
 
   $node = $data['node'];
@@ -172,15 +180,25 @@ function _project_release_edit_version_major_form($data) {
   return $form;
 }
 
-function theme_project_release_form_value($element) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_project_release_form_value($variables) {
+  $element = $variables['element'];
   return check_plain($element['#value']);
 }
 
-function theme_project_release_project_edit_form($form) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_project_release_project_edit_form($variables) {
+  $form = $variables['form'];
   $output = '';
   if (!empty($form['api'])) {
-    $output .= '<h3>'. drupal_render($form['header']) ."</h3>\n";
-    $output .= '<p>'. drupal_render($form['help']) ."</p>\n";
+    $output .= '<h3>' . drupal_render($form['header']) . "</h3>\n";
+    $output .= '<p>' . drupal_render($form['help']) . "</p>\n";
 
     $header = array(
       t('Major version'),
@@ -192,7 +210,7 @@ function theme_project_release_project_edit_form($form) {
       ),
     );
     foreach (element_children($form['api']) as $tid) {
-      $output .= '<h3>'. $form['api'][$tid]['#api_term_name'] .'</h3>';
+      $output .= '<h3>' . $form['api'][$tid]['#api_term_name'] . '</h3>';
       $rows = array();
       krsort($form['api'][$tid]['major']);
       foreach (element_children($form['api'][$tid]['major']) as $major) {
@@ -214,13 +232,13 @@ function theme_project_release_project_edit_form($form) {
         'colspan' => 5,
       );
       $rows[] = $row;
-      $output .= theme('table', $header, $rows);
+      $output .= theme('table', array('header' => $header, 'rows' => $rows));
     }
     unset($form['api']);
   }
 
   $output .= drupal_render($form['advanced']);
-  $output .= drupal_render($form);
+  $output .= drupal_render_children($form);
   return $output;
 }
 
@@ -241,7 +259,7 @@ function project_release_project_edit_form_validate($form, &$form_state) {
       foreach ($api_info['major'] as $major => $flags) {
         // At least 1 major is supported, so validate the settings.
         if ($flags['supported'] == FALSE && $flags['snapshot'] == TRUE) {
-          $element = 'api]['. $tid .'][major]['. $major .'][snapshot';
+          $element = 'api][' . $tid . '][major][' . $major . '][snapshot';
           form_set_error($element, t('You can not show a snapshot release for a major version that is not supported for %api_term_name.', array('%api_term_name' => $form_state['values']['api'][$tid]['#api_term_name'])));
         }
         if ($flags['supported'] == FALSE && $api_info['recommended'] == $major) {
@@ -259,11 +277,27 @@ function project_release_project_edit_form_validate($form, &$form_state) {
  */
 function project_release_project_edit_form_submit($form, &$form_state) {
   $nid = $form_state['values']['nid'];
-  db_query("UPDATE {project_release_projects} SET releases = %d, version_format = '%s' WHERE nid = %d", $form_state['values']['releases'], $form_state['values']['version_format'], $nid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {project_release_projects} SET releases = %d, version_format = '%s' WHERE nid = %d", $form_state['values']['releases'], $form_state['values']['version_format'], $nid) */
+  db_update('project_release_projects')
+  ->fields(array(
+    'releases' => $form_state['values']['releases'],
+    'version_format' => $form_state['values']['version_format'],
+  ))
+  ->condition('nid', $nid)
+  ->execute();
   if (!db_affected_rows()) {
     // It's possible there's no record in {project_release_projects} if this
     // particular project was created before project_issue.module was enabled.
-    db_query("INSERT INTO {project_release_projects} (nid, releases, version_format) VALUES (%d, %d, '%s')", $nid, $form_values['releases'], $form_values['version_format']);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("INSERT INTO {project_release_projects} (nid, releases, version_format) VALUES (%d, %d, '%s')", $nid, $form_values['releases'], $form_values['version_format']) */
+    $id = db_insert('project_release_projects')
+  ->fields(array(
+      'nid' => $nid,
+      'releases' => $form_values['releases'],
+      'version_format' => $form_values['version_format'],
+    ))
+  ->execute();
   }
 
   if (!empty($form_state['values']['api'])) {
@@ -271,23 +305,52 @@ function project_release_project_edit_form_submit($form, &$form_state) {
       if (!empty($values['major'])) {
         foreach ($values['major'] as $major => $major_values) {
           $major_values['recommended'] = ($values['recommended'] == $major) ? 1 : 0;
-          if ($obj = db_fetch_object(db_query("SELECT * FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d AND major = %d", $nid, $tid, $major))) {
+          if ($obj = db_fetch_object(db_query("SELECT * FROM {project_release_supported_versions} WHERE nid = :nid AND tid = :tid AND major = :major", array(':nid' => $nid, ':tid' => $tid, ':major' => $major)))) {
             if ($obj->supported != $major_values['supported']
-                || $obj->recommended != $major_values['recommended']
-                || $obj->snapshot != $major_values['snapshot']) {
-              db_query("UPDATE {project_release_supported_versions} SET supported = %d, recommended = %d, snapshot = %d WHERE nid = %d AND tid = %d AND major = %d", $major_values['supported'], $major_values['recommended'], $major_values['snapshot'], $nid, $tid, $major);
+                  || $obj->recommended != $major_values['recommended']
+                  || $obj->snapshot != $major_values['snapshot']) {
+              // TODO Please review the conversion of this statement to the D7 database API syntax.
+              /* db_query("UPDATE {project_release_supported_versions} SET supported = %d, recommended = %d, snapshot = %d WHERE nid = %d AND tid = %d AND major = %d", $major_values['supported'], $major_values['recommended'], $major_values['snapshot'], $nid, $tid, $major) */
+              db_update('project_release_supported_versions')
+  ->fields(array(
+                'supported' => $major_values['supported'],
+                'recommended' => $major_values['recommended'],
+                'snapshot' => $major_values['snapshot'],
+              ))
+  ->condition('nid', $nid)
+  ->condition('tid', $tid)
+  ->condition('major', $major)
+  ->execute();
             }
           }
           else {
-            db_query("INSERT INTO {project_release_supported_versions} (nid, tid, major, supported, recommended, snapshot) VALUES (%d, %d, %d, %d, %d, %d)", $nid, $tid, $major, $major_values['supported'], $major_values['recommended'], $major_values['snapshot']);
+            // TODO Please review the conversion of this statement to the D7 database API syntax.
+            /* db_query("INSERT INTO {project_release_supported_versions} (nid, tid, major, supported, recommended, snapshot) VALUES (%d, %d, %d, %d, %d, %d)", $nid, $tid, $major, $major_values['supported'], $major_values['recommended'], $major_values['snapshot']) */
+            $id = db_insert('project_release_supported_versions')
+  ->fields(array(
+              'nid' => $nid,
+              'tid' => $tid,
+              'major' => $major,
+              'supported' => $major_values['supported'],
+              'recommended' => $major_values['recommended'],
+              'snapshot' => $major_values['snapshot'],
+            ))
+  ->execute();
           }
         }
       }
     }
   }
-  db_query("UPDATE {node} SET changed = %d WHERE nid = %d", time(), $form_state['values']['nid']);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {node} SET changed = %d WHERE nid = %d", REQUEST_TIME, $form_state['values']['nid']) */
+  db_update('node')
+  ->fields(array(
+    'changed' => REQUEST_TIME,
+  ))
+  ->condition('nid', $form_state['values']['nid'])
+  ->execute();
 
-  $cid = 'table:'. $form_state['values']['nid'] .':';
+  $cid = 'table:' . $form_state['values']['nid'] . ':';
   cache_clear_all($cid, 'cache_project_release', TRUE);
 
   drupal_set_message(t('Release settings have been saved.'));
diff --git a/release/includes/release_node_form.inc b/release/includes/release_node_form.inc
index 04eac03..7434f86 100644
--- a/release/includes/release_node_form.inc
+++ b/release/includes/release_node_form.inc
@@ -37,8 +37,8 @@ function _project_release_form(&$release, &$form_state) {
     $admin = user_access('administer projects');
     $is_edit = TRUE;
     $project = node_load($release->project_release['pid']);
-    $breadcrumb[] = l($project->title, 'node/'. $project->nid);
-    $breadcrumb[] = l(t('Releases'), 'node/'. $project->nid . '/release');
+    $breadcrumb[] = l($project->title, 'node/' . $project->nid);
+    $breadcrumb[] = l(t('Releases'), 'node/' . $project->nid . '/release');
     project_project_set_breadcrumb($project, $breadcrumb);
     $format = project_release_get_version_format($project);
   }
@@ -123,7 +123,7 @@ function _project_release_form(&$release, &$form_state) {
         $file = project_release_load_file($file);
       }
       $form['project_release_files'][$fid]['file_info'] = array(
-        '#value' => theme('project_release_download_file', $file, FALSE),
+        '#value' => theme('project_release_download_file', array('file' => $file, 'download_link' => FALSE)),
       );
       if ($admin) {
         $form['project_release_files'][$fid]['delete'] = array(
@@ -150,7 +150,7 @@ function _project_release_form(&$release, &$form_state) {
       $new_file = $form_state['project_release']['new_file'];
     }
     elseif (!empty($release->project_release_files['temp'])) {
-      $new_file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", $release->project_release_files['temp']));
+      $new_file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = :fid", array(':fid' => $release->project_release_files['temp'])));
     }
     $form['project_release_files']['file'] = array(
       '#title' => t('File'),
@@ -194,7 +194,7 @@ function _project_release_form(&$release, &$form_state) {
  * @param $required Boolean for if the form element should be required
  */
 function _project_release_form_add_version_element(&$form, $release, $modify, $format, $name, $title, $description = '', $size = 10, $required = FALSE) {
-  $var_name = 'version_'. $name;
+  $var_name = 'version_' . $name;
   $regexp = "@.*[!#%]$name.*@";
   if (preg_match($regexp, $format)) {
     $form['project_release'][$var_name] = array(
@@ -262,7 +262,7 @@ function _project_release_form_add_text_element(&$form, $title, $value, $is_edit
       '#size' => $size,
       '#maxlength' => $maxlength,
     );
-    if(!$admin) {
+    if (!$admin) {
       $form['#attributes']['disabled'] = 'disabled';
       $form['#value'] = $value;
     }
@@ -308,7 +308,10 @@ function _project_release_node_form_validate(&$form, &$form_state) {
     form_set_error('project_release][version_major', t('You must fill in some version information.'));
     // TODO: find a better form value to mark as the error?
   }
-  foreach (array('version_major' => t('Major version number'), 'version_minor' => t('Minor version number')) as $field => $name) {
+  foreach (array(
+    'version_major' => t('Major version number'),
+    'version_minor' => t('Minor version number'),
+  ) as $field => $name) {
     $val = $project_release[$field];
     if (isset($val) && $val !== '' && !is_numeric($val)) {
       form_set_error("project_release][$field", t('%name must be a number.', array('%name' => $name)));
@@ -372,7 +375,7 @@ function _project_release_node_form_validate(&$form, &$form_state) {
     // TODO: Magic re-setting to "%project_name %version" ??
   }
   elseif (isset($project_release['version']) && $project_release['version'] !== '') {
-    form_set_value($form['title'], $project_name .' '. $project_release['version'], $form_state);
+    form_set_value($form['title'], $project_name . ' ' . $project_release['version'], $form_state);
   }
   elseif (!empty($project)) {
     $version = project_release_get_version((object) $project_release, $project);
@@ -382,18 +385,26 @@ function _project_release_node_form_validate(&$form, &$form_state) {
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_validate_file_extension($file) {
   // Make sure that the extension on the file is one of the allowed
   // extensions for release files. Most of this validation code was
   // modified from the code in file_check_upload().
   $extensions = variable_get('project_release_file_extensions', PROJECT_RELEASE_FILE_EXTENSIONS);
-  $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
+  $regex = '/\.(' . ereg_replace(' +', '|', preg_quote($extensions)) . ')$/i';
   if (!preg_match($regex, $file->filename)) {
     return array(t('It is only possible to attach files with the following extensions: %files-allowed.', array('%files-allowed' => $extensions)));
   }
   return array();
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_node_submit(&$form, $form_state) {
   // Get rid of the file upload item, not needed.
   unset($form_state['values']['project_release_files']['file']);
@@ -404,7 +415,7 @@ function project_release_node_submit(&$form, $form_state) {
   elseif (!empty($form_state['values']['project_release_files']['temp'])) {
     $temp = $form_state['values']['project_release_files']['temp'];
     // Have to ensure the temp file hasn't been wiped from the files table.
-    if ($temp_file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", $temp))) {
+    if ($temp_file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = :fid", array(':fid' => $temp)))) {
       $new_file = $temp_file;
     }
     unset($form_state['values']['project_release_files']['temp']);
@@ -414,14 +425,15 @@ function project_release_node_submit(&$form, $form_state) {
   if (isset($existing_files)) {
     foreach ($existing_files as $fid => $values) {
       if ($values['delete']) {
-        $file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", $fid));
+        $file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = :fid", array(':fid' => $fid)));
         project_release_file_delete($file);
       }
     }
   }
   // Add new files.
   if (isset($new_file)) {
-    $status_updated = file_set_status($new_file, FILE_STATUS_PERMANENT);
+    $new_file->status &= FILE_STATUS_PERMANENT;
+    $status_updated = $new_file = file_save($new_file);
     if ($status_updated) {
       $new_file->nid = $form_state['nid'];
       $filepath = file_create_path($new_file->filepath);
@@ -456,7 +468,10 @@ function project_release_db_save($node, $is_new) {
     unset($node->project_release['version_patch']);
   }
 
-  $types = array('pid' => "%d", 'version' => "'%s'", 'tag' => "'%s'",
+  $types = array(
+    'pid' => "%d",
+    'version' => "'%s'",
+    'tag' => "'%s'",
     'rebuild' => "%d",
   );
   $values = array(
@@ -482,7 +497,7 @@ function project_release_db_save($node, $is_new) {
           $api_tid = reset($node->taxonomy[$vid]);
         }
         else {
-          $api_tid = (int)$node->taxonomy[$vid];
+          $api_tid = (int) $node->taxonomy[$vid];
         }
         $types['version_api_tid'] = '%d';
         $values['version_api_tid'] = $api_tid;
@@ -528,16 +543,17 @@ function project_release_db_save($node, $is_new) {
 
   if ($is_new) {
     $types['nid'] = "%d";
-    $sql = 'INSERT INTO {project_release_nodes} ('. implode(', ', array_keys($types)) .') VALUES ('. implode(', ', $types) .')';
+    $sql = 'INSERT INTO {project_release_nodes} (' . implode(', ', array_keys($types)) . ') VALUES (' . implode(', ', $types) . ')';
   }
   else {
-   $arr = array();
-   foreach ($types as $key => $value) {
-     $arr[] = $key .' = '. $value;
-   }
-   $sql = 'UPDATE {project_release_nodes} SET '. implode(',', $arr) .' WHERE nid = %d';
+    $arr = array();
+    foreach ($types as $key => $value) {
+      $arr[] = $key . ' = ' . $value;
+    }
+    $sql = 'UPDATE {project_release_nodes} SET ' . implode(',', $arr) . ' WHERE nid = %d';
   }
   $values['nid'] = $node->nid;
+  // TODO Please convert this statement to the D7 database API syntax.
   db_query($sql, $values);
 }
 
@@ -556,7 +572,7 @@ function project_release_add_redirect_page() {
 function project_release_pick_project_form() {
   $form = array();
 
-  drupal_set_title(t('Submit @name', array('@name' => node_get_types('name', 'project_release'))));
+  drupal_set_title(t('Submit @name', array('@name' => node_type_get_name('project_release'))), PASS_THROUGH);
 
   // Fetch a list of all projects.
   $uris = NULL;
@@ -578,6 +594,10 @@ function project_release_pick_project_form() {
   return $form;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_pick_project_form_validate($form, &$form_state) {
   if (empty($form_state['values']['pid'])) {
     form_set_error('pid', t('You must select a project.'));
@@ -588,6 +608,10 @@ function project_release_pick_project_form_validate($form, &$form_state) {
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_pick_project_form_submit($form, &$form_state) {
-  $form_state['redirect'] = 'node/add/project-release/'. $form_state['values']['pid'];
+  $form_state['redirect'] = 'node/add/project-release/' . $form_state['values']['pid'];
 }
diff --git a/release/metrics/ProjectReleaseMetricNewReleases.class.php b/release/metrics/ProjectReleaseMetricNewReleases.class.php
index 4e1b628..f180f60 100644
--- a/release/metrics/ProjectReleaseMetricNewReleases.class.php
+++ b/release/metrics/ProjectReleaseMetricNewReleases.class.php
@@ -29,7 +29,7 @@ class ProjectReleaseMetricNewReleases extends ProjectReleaseMetric {
 
     // Restrict to only the passed project nids.
     if (!empty($options['object_ids'])) {
-      $where = " WHERE prn.pid IN (". db_placeholders($options['object_ids']) .")";
+      $where = " WHERE prn.pid IN (" . db_placeholders($options['object_ids']) . ")";
       $args = array_merge($args, $options['object_ids']);
     }
     else {
@@ -37,9 +37,10 @@ class ProjectReleaseMetricNewReleases extends ProjectReleaseMetric {
     }
 
     // Pull all release nodes created during the specified time.
+    // TODO Please convert this statement to the D7 database API syntax.
     $nodes = db_query("SELECT prn.pid, COUNT(nr.nid) AS releases FROM {project_release_nodes} prn INNER JOIN {node} nr ON prn.nid = nr.nid AND nr.created >= %d AND nr.created < %d$where GROUP BY prn.pid", $args);
     while ($node = db_fetch_object($nodes)) {
-      $this->currentSample->values[$node->pid]['releases'] = (int)$node->releases;
+      $this->currentSample->values[$node->pid]['releases'] = (int) $node->releases;
     }
   }
 }
diff --git a/release/package-release-nodes.php b/release/package-release-nodes.php
index 8e41341..8b13789 100755
--- a/release/package-release-nodes.php
+++ b/release/package-release-nodes.php
@@ -1,391 +1 @@
-#!/usr/bin/php
-<?php
 
-
-/**
- * @file
- * Automated packaging script to generate tarballs from release nodes.
- *
- * @author Derek Wright (http://drupal.org/user/46549)
- */
-
-// ------------------------------------------------------------
-// Required customization
-// ------------------------------------------------------------
-
-// The root of your Drupal installation, so we can properly bootstrap
-// Drupal. This should be the full path to the directory that holds
-// your index.php file, the "includes" subdirectory, etc.
-$drupal_root = '';
-
-// The name of your site. Required so that when we bootstrap Drupal in
-// this script, we find the right settings.php file in your sites folder.
-// For example, on drupal.org:
-// $site_name = 'drupal.org';
-$site_name = '';
-
-// Root of the temporary directory where you want packages to be
-// made. Subdirectories will be created depending on the task.
-$tmp_root = '';
-
-// ------------------------------------------------------------
-// Optional customization
-// ------------------------------------------------------------
-
-// ----------------
-// File destination
-// ----------------
-// This assumes you want to install the packaged releases in the
-// "files/projects" directory of your root Drupal installation. If
-// that's not the case, you should customize these.
-$dest_root = $drupal_root;
-$dest_rel = 'files/projects';
-
-// --------------
-// External tools
-// --------------
-// If you want this program to always use absolute paths for all the
-// tools it invokes, provide a full path for each one. Otherwise,
-// the script will find these tools in your PATH.
-$rm = '/bin/rm';
-$php = '/usr/bin/php';
-
-// If you are using project-release-create-history.php to generate XML release
-// history files, if you include the full path to your copy of that script
-// here, after all the packages are re(generated), this script will regenerate
-// the XML release history files for any projects with new/updated releases.
-$project_release_create_history = '';
-
-
-// ------------------------------------------------------------
-// Initialization
-// (Real work begins here, nothing else to customize)
-// ------------------------------------------------------------
-
-// Check if all required variables are defined
-$vars = array(
-  'drupal_root' => $drupal_root,
-  'site_name' => $site_name,
-  'tmp_root' => $tmp_root,
-);
-foreach ($vars as $name => $val) {
-  if (empty($val)) {
-    print "ERROR: \"\$$name\" variable not set, aborting\n";
-    $fatal_err = true;
-  }
-}
-if (!empty($fatal_err)) {
-  exit(1);
-}
-
-$script_name = $argv[0];
-
-// Find what kind of packaging we need to do
-if (!empty($argv[1])) {
-  $task = $argv[1];
-}
-else {
-  $task = 'tag';
-}
-switch($task) {
-  case 'tag':
-  case 'branch':
-    break;
-
-  default:
-    print "ERROR: $argv[0] invoked with invalid argument: \"$task\"\n";
-    exit (1);
-}
-
-$project_id = 0;
-if (!empty($argv[2])) {
-  $project_id = $argv[2];
-}
-
-// Setup variables for Drupal bootstrap
-$_SERVER['HTTP_HOST'] = $site_name;
-$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
-$_SERVER['REQUEST_METHOD']  = 'GET';
-$_SERVER['REQUEST_URI'] = '/' . $script_name;
-$_SERVER['SERVER_SOFTWARE'] = 'PHP CLI';
-$_SERVER['QUERY_STRING']    = '';
-$_SERVER['SCRIPT_NAME'] = '/' . $script_name;
-$_SERVER['PHP_SELF'] = '/' . $script_name;
-$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] . '/' . $script_name;
-$_SERVER['PATH_TRANSLATED'] = $_SERVER['SCRIPT_FILENAME'];
-
-
-if (!chdir($drupal_root)) {
-  print "ERROR: Can't chdir($drupal_root): aborting.\n";
-  exit(1);
-}
-
-// Force the right umask while this script runs, so that everything is created
-// with sane file permissions.
-umask(0022);
-
-require_once 'includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-// We have to initialize the theme() system before we leave $drupal_root
-$hack = theme('placeholder', 'hack');
-
-// Load the include file for packager-related helper functions.
-module_load_include('inc', 'project_release', 'includes/packager');
-
-initialize_tmp_dir($task);
-package_releases($task, $project_id);
-// Now that we're done, clean out the tmp/task dir we created
-chdir($tmp_root);
-drupal_exec("$rm -rf $tmp_dir");
-
-if ($task == 'branch') {
-  // Clear any cached data set to expire.
-  cache_clear_all(NULL, 'cache_project_release');
-}
-
-// ------------------------------------------------------------
-// Functions: main work
-// ------------------------------------------------------------
-
-function package_releases($type, $project_id = 0) {
-  global $drupal_root, $dest_root, $dest_rel, $tmp_dir, $wd_err_msg;
-  global $php, $project_release_create_history;
-
-  if (!empty($project_id)) {
-    if (is_numeric($project_id)) {
-      $project_nid = $project_id;
-    }
-    else {
-      $project_nid = db_result(db_query("SELECT nid FROM {project_projects} WHERE uri = '%s'", $project_id));
-    }
-    // We repeatedly clear the node_load() cache, but we have our own cache
-    // for loading the project nodes since those tend to repeat and we need to
-    // load less of them.
-    $project_node = project_release_packager_node_load($project_nid);
-    if (empty($project_node)) {
-      wd_err('ERROR: Project ID %id not found', array('%id' => $project_id));
-      return FALSE;
-    }
-  }
-
-  $rel_node_join = '';
-  $where_args = array();
-  if ($type == 'tag') {
-    $where = " AND (prn.rebuild = %d) AND (f.filepath IS NULL OR f.filepath = '')";
-    $where_args[] = 0;  // prn.rebuild
-    $plural = t('tags');
-  }
-  elseif ($type == 'branch') {
-    $rel_node_join = " INNER JOIN {node} nr ON prn.nid = nr.nid";
-    $where = " AND (prn.rebuild = %d) AND ((f.filepath IS NULL) OR (f.filepath = '') OR (nr.status = %d))";
-    $where_args[] = 1;  // prn.rebuild
-    $where_args[] = 1;  // nr.status
-    $plural = t('branches');
-    if (empty($project_node)) {
-      wd_msg("Starting to package all snapshot releases.");
-    }
-    else {
-      wd_msg("Starting to package snapshot releases for project id: %project_short_name.", array('%project_short_name' => $project_node->project['uri']), l(t('view'), 'node/' . $project_node->nid));
-    }
-  }
-  else {
-    wd_err("ERROR: package_releases() called with unknown type: %type", array('%type' => $type));
-    return FALSE;
-  }
-  $args = array();
-  $args[] = 1;    // Account for np.status = 1.
-  $args[] = 1;    // Account for prp.releases = 1.
-  if (!empty($project_node)) {
-    $where .= ' AND prn.pid = %d';
-    $where_args[] = $project_node->nid;
-  }
-  $args = array_merge($args, $where_args);
-  $query = db_query("SELECT prn.nid FROM {project_release_nodes} prn $rel_node_join LEFT JOIN {project_release_file} prf ON prn.nid = prf.nid LEFT JOIN {files} f ON prf.fid = f.fid INNER JOIN {project_projects} pp ON prn.pid = pp.nid INNER JOIN {node} np ON prn.pid = np.nid INNER JOIN {project_release_projects} prp ON prp.nid = prn.pid WHERE np.status = %d AND prp.releases = %d " . $where . ' ORDER BY pp.uri', $args);
-
-  $num_built = 0;
-  $num_considered = 0;
-  $project_nids = array();
-
-  // Read everything out of the query immediately so that we don't leave the
-  // query object/connection open while doing other queries.
-  $releases = array();
-  while ($release = db_fetch_object($query)) {
-    // This query could pull multiple rows of the same release since multiple
-    // files per release node are allowed. Account for this by keying on
-    // release nid.
-    $releases[$release->nid] = $release->nid;
-  }
-  foreach ($releases as $release_nid) {
-    $wd_err_msg = array();
-
-    // We don't want to waste too much RAM by leaving all these loaded nodes
-    // in RAM, so we reset the node_load() cache each time we call it.
-    $release_node = node_load($release_nid, NULL, TRUE);
-    if (empty($release_node)) {
-      wd_err("ERROR: Can't load release node for release ID %nid", array('%nid' => $release_nid));
-      continue;
-    }
-
-    $packager = project_release_get_packager_plugin($release_node, $dest_root, $dest_rel, $tmp_dir);
-    if (empty($packager)) {
-      wd_err("ERROR: Can't find packager plugin to use for %release", array('%release' => $release_node->title));
-      continue;
-    }
-
-    db_query("DELETE FROM {project_release_package_errors} WHERE nid = %d", $release_node->nid);
-
-    chdir($drupal_root);
-    $files = array();
-    $contents = array();
-    $rval = $packager->createPackage($files, $contents);
-    $num_considered++;
-    chdir($drupal_root);
-
-    switch ($rval) {
-      case 'success':
-      case 'rebuild':
-        project_release_packager_update_node($release_node, $dest_root, $files, $contents);
-        module_invoke_all('project_release_create_package', $project_node, $release_node);
-        $num_built++;
-        $packager->cleanupSuccessfulBuild();
-        $release_pid = $release_node->project_release['pid'];
-        $project_nids[$release_pid] = TRUE;
-        $release_node_view_link = l(t('View'), 'node/' . $release_node->nid);
-        if ($rval == 'rebuild') {
-          $msg = '%release_title has changed, re-packaged.';
-        }
-        else {
-          $msg = 'Packaged %release_title.';
-        }
-        wd_msg($msg, array('%release_title' => $release_node->title), $release_node_view_link);
-        break;
-
-      case 'error':
-        $packager->cleanupFailedBuild();
-        break;
-
-    }
-
-    if (count($wd_err_msg)) {
-      db_query("INSERT INTO {project_release_package_errors} (nid, messages) values (%d, '%s')", $release_node->nid, serialize($wd_err_msg));
-    }
-  }
-
-  if ($num_built || $type == 'branch') {
-    if (!empty($project_node)) {
-      wd_msg("Done packaging releases for @project_short_name from !plural: !num_built built, !num_considered considered.", array('@project_short_name' => $project_node->project['uri'], '!plural' => $plural, '!num_built' => $num_built, '!num_considered' => $num_considered));
-    }
-    else {
-      wd_msg("Done packaging releases from !plural: !num_built built, !num_considered considered.", array('!plural' => $plural, '!num_built' => $num_built, '!num_considered' => $num_considered));
-    }
-  }
-
-  // Finally, regenerate release history XML files for all projects we touched.
-  if (!empty($project_nids) && !empty($project_release_create_history)) {
-    wd_msg('Re-generating release history XML files');
-    $i = $fails = 0;
-    foreach ($project_nids as $project_nid => $value) {
-      if (drupal_exec("$php $project_release_create_history $project_nid")) {
-        $i++;
-      }
-      else {
-        $fails++;
-      }
-    }
-    if (!empty($fails)) {
-      wd_msg('ERROR: Failed to re-generate release history XML files for !num project(s)', array('!num' => $fails));
-    }
-    wd_msg('Done re-generating release history XML files for !num project(s)', array('!num' => $i));
-  }
-}
-
-// ------------------------------------------------------------
-// Functions: utility methods
-// ------------------------------------------------------------
-
-/**
- * Wrapper for exec() that logs errors to the watchdog.
- * @param $cmd
- *   String of the command to execute (assumed to be safe, the caller is
- *   responsible for calling escapeshellcmd() if necessary).
- * @return true if the command was successful (0 exit status), else false.
- */
-function drupal_exec($cmd) {
-  // Made sure we grab stderr, too...
-  exec("$cmd 2>&1", $output, $rval);
-  if ($rval) {
-    wd_err("ERROR: %cmd failed with status !rval" . '<pre>' . implode("\n", array_map('htmlspecialchars', $output)), array('%cmd' => $cmd, '!rval' => $rval));
-    return false;
-  }
-  return true;
-}
-
-/**
- * Wrapper for chdir() that logs errors to the watchdog.
- * @param $dir Directory to change into.
- * @return true if the command was successful (0 exit status), else false.
- */
-function drupal_chdir($dir) {
-  if (!chdir($dir)) {
-    wd_err("ERROR: Can't chdir(@dir)", array('@dir' => $dir));
-    return false;
-  }
-  return true;
-}
-
-/// TODO: remove this before the final script goes live -- debugging only.
-function wprint($var) {
-  watchdog('package_debug', '<pre>' . var_export($var, TRUE));
-}
-
-/**
- * Wrapper function for watchdog() to log notice messages. Uses a
- * different watchdog message type depending on the task (branch vs. tag).
- */
-function wd_msg($msg, $variables = array(), $link = NULL) {
-  global $task;
-  watchdog('package_' . $task, $msg, $variables, WATCHDOG_NOTICE, $link);
-  echo t($msg, $variables) . "\n";
-}
-
-/**
- * Wrapper function for watchdog() to log error messages.
- */
-function wd_err($msg, $variables = array(), $link = NULL) {
-  global $wd_err_msg;
-  if (!isset($wd_err_msg)) {
-    $wd_err_msg = array();
-  }
-  watchdog('package_error', $msg, $variables, WATCHDOG_ERROR, $link);
-  echo t($msg, $variables) . "\n";
-  $wd_err_msg[] = t($msg, $variables);
-}
-
-/**
- * Initialize the tmp directory. Use different subdirs for building
- * snapshots than official tags, so there's no potential directory
- * collisions and race conditions if both are running at the same time
- * (due to how long it takes to complete a branch snapshot run, and
- * how often we run this for tag-based releases).
- */
-function initialize_tmp_dir($task) {
-  global $tmp_dir, $tmp_root, $rm;
-
-  if (!is_dir($tmp_root) && !@mkdir($tmp_root, 0777, TRUE)) {
-    wd_err("ERROR: mkdir(@dir) (tmp_root) failed", array('@dir' => $tmp_root));
-    exit(1);
-  }
-
-  // Use a tmp directory *specific* to this invocation, so that we don't
-  // clobber other runs if the script is invoked twice (e.g. via cron and
-  // manually, etc).
-  $tmp_dir = $tmp_root . '/' . $task . '.' . getmypid();
-  if (is_dir($tmp_dir)) {
-    // Make sure we start with a clean slate
-    drupal_exec("$rm -rf $tmp_dir/*");
-  }
-  else if (!@mkdir($tmp_dir, 0777, TRUE)) {
-    wd_err("ERROR: mkdir(@dir) failed", array('@dir' => $tmp_dir));
-    exit(1);
-  }
-}
diff --git a/release/project-release-create-history.php b/release/project-release-create-history.php
index 72b73cb..8b13789 100755
--- a/release/project-release-create-history.php
+++ b/release/project-release-create-history.php
@@ -1,715 +1 @@
-#!/usr/bin/php
-<?php
-
-
-/**
- * @file
- * Dumps out a complete history of releases for a given project.  Each
- * file is an XML representation of all relevant release data for
- * update status checking, security notification, etc.  Every project
- * creates a separate file for the releases for each unique API
- * compatibility term (e.g. for Drupal: 5.x, 6.x, etc).
- *
- * @author Derek Wright (http://drupal.org/user/46549)
- *
- */
-
-// ------------------------------------------------------------
-// Required customization
-// ------------------------------------------------------------
-
-// Root of the directory tree for the XML history files.
-define('HISTORY_ROOT', '');
-
-// The root of your Drupal installation, so we can properly bootstrap
-// Drupal. This should be the full path to the directory that holds
-// your index.php file, the "includes" subdirectory, etc.
-define('DRUPAL_ROOT', '');
-
-// The name of your site. Required so that when we bootstrap Drupal in
-// this script, we find the right settings.php file in your sites folder.
-define('SITE_NAME', '');
-
-
-// ------------------------------------------------------------
-// Initialization
-// (Real work begins here, nothing else to customize)
-// ------------------------------------------------------------
-
-// Check if all required variables are defined
-$vars = array(
-  'DRUPAL_ROOT' => DRUPAL_ROOT,
-  'SITE_NAME' => SITE_NAME,
-);
-$fatal_err = FALSE;
-foreach ($vars as $name => $val) {
-  if (empty($val)) {
-    print "ERROR: \"$name\" constant not defined, aborting\n";
-    $fatal_err = TRUE;
-  }
-}
-if ($fatal_err) {
-  exit(1);
-}
-
-$script_name = $argv[0];
-
-// See if we're being restricted to a single project.
-$project_id = 0;
-if (!empty($argv[1])) {
-  $project_id = $argv[1];
-}
-
-// Setup variables for Drupal bootstrap
-$_SERVER['HTTP_HOST'] = SITE_NAME;
-$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
-$_SERVER['REQUEST_URI'] = '/' . $script_name;
-$_SERVER['SCRIPT_NAME'] = '/' . $script_name;
-$_SERVER['PHP_SELF'] = '/' . $script_name;
-$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] .'/'. $script_name;
-$_SERVER['PATH_TRANSLATED'] = $_SERVER['SCRIPT_FILENAME'];
-
-if (!chdir(DRUPAL_ROOT)) {
-  print "ERROR: Can't chdir(DRUPAL_ROOT), aborting.\n";
-  exit(1);
-}
-// Make sure our umask is sane for generating directories and files.
-umask(022);
-
-require_once 'includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-if (!is_dir(HISTORY_ROOT)) {
-  if (!mkdir(HISTORY_ROOT)) {
-    wd_err(array('message' => "ERROR: Could not create history directory (%directory).\n", 'args' => array('%directory' => HISTORY_ROOT)));
-    exit(1);
-  }
-}
-
-project_release_history_generate_all($project_id);
-if (empty($project_id)) {
-  // If we're operating on all projects, generate the huge list, too.
-  project_list_generate();
-}
-
-
-// ------------------------------------------------------------
-// Functions: main work
-// ------------------------------------------------------------
-
-/**
- * Figure out what project and API terms to generate the history for.
- */
-function project_release_history_generate_all($project_id = 0) {
-  if (!empty($project_id)) {
-    if (is_numeric($project_id)) {
-      $project_nid = $project_id;
-    }
-    else {
-      $project_nid = db_result(db_query("SELECT nid FROM {project_projects} WHERE uri = '%s'", $project_id));
-    }
-    if (empty($project_nid)) {
-      wd_err(array('message' => 'Project ID %id not found', 'args' => array('%id' => $project_id)));
-      return FALSE;
-    }
-    wd_msg(array('message' => 'Generating XML release history files for project: %id.', 'args' => array('%id' => $project_id)));
-  }
-  else {
-    wd_msg(array('message' => 'Generating XML release history files for all projects.', 'args' => array()));
-  }
-
-  $api_terms = project_release_compatibility_list();
-
-  $i = 0;
-  if (empty($project_nid)) {
-    // Generate all.xml files for projects with releases.
-    $query = db_query("SELECT DISTINCT(pid) FROM {project_release_nodes}");
-    while ($project = db_fetch_object($query)) {
-      project_release_history_generate_project_xml($project->pid);
-      $i++;
-    }
-  }
-  else {
-    project_release_history_generate_project_xml($project_nid);
-    $i++;
-  }
-
-  if ($i == 1) {
-    wd_msg(array('message' => 'Generated an XML release history summary for a project.'));
-  }
-  else {
-    wd_msg(array('message' => 'Generated XML release history summaries for @count projects.', 'args' => array('@count' => $i)));
-  }
-
-  // Generate XML files based on API compatibility.
-  $i = 0;
-  $args = array_keys($api_terms);
-  $placeholders = db_placeholders($args);
-  $where = '';
-  if (!empty($project_nid)) {
-    $args[] = $project_nid;
-    $where = 'AND pid = %d';
-  }
-  $query = db_query("SELECT DISTINCT(pid), version_api_tid FROM {project_release_nodes} WHERE version_api_tid IN ($placeholders) $where", $args);
-  while ($project = db_fetch_object($query)) {
-    project_release_history_generate_project_xml($project->pid, $project->version_api_tid);
-    $i++;
-  }
-  if ($i == 1) {
-    wd_msg(array('message' => 'Completed XML release history files for 1 project/version pair'));
-  }
-  else {
-    wd_msg(array('message' => 'Completed XML release history files for @count project/version pairs', 'args' => array('@count' => $i)));
-  }
-}
-
-/**
- * Generate the XML history file for a given project name and API
- * compatibility term.
- *
- * @todo If a history file already exists for this combination, this
- * function will generate a new history and atomically replace the old
- * one (currently, just logs to watchdog for debugging).
- *
- * @todo If there's no subdirectory in the directory tree for this
- * project yet, this function creates one.
- *
- * @param $project_nid
- *   Project ID (node id of the project node) to generate history for.
- * @param $api_tid
- *   Taxonomy id (tid) of the API compatibility term to use, or NULL if
- *   all terms are considered.
- */
-function project_release_history_generate_project_xml($project_nid, $api_tid = NULL) {
-  $api_vid = _project_release_get_api_vid();
-  /// @todo: This is a drupal.org-specific hack.
-  /// @see http://drupal.org/node/1003764
-  $is_profile = FALSE;
-
-  if (isset($api_tid)) {
-    // Restrict output to a specific API compatibility term.
-    $api_terms = project_release_compatibility_list();
-    if (!isset($api_terms[$api_tid])) {
-      wd_err(array('message' => 'API compatibility term %tid not found.', 'args' => array('%tid' => $api_tid)));
-      return FALSE;
-    }
-    $api_version = $api_terms[$api_tid];
-
-    // Get project-wide data:
-    $sql = "SELECT DISTINCT n.title, n.nid, n.vid, n.status, p.uri, u.name AS username FROM {node} n INNER JOIN {project_projects} p ON n.nid = p.nid INNER JOIN {project_release_supported_versions} prsv ON prsv.nid = n.nid INNER JOIN {users} u ON n.uid = u.uid WHERE prsv.tid = %d AND prsv.nid = %d";
-    $query = db_query($sql, $api_tid, $project_nid);
-  }
-  else {
-    // Consider all API compatibility terms.
-    $api_version = 'all';
-    $sql = "SELECT n.title, n.nid, n.vid, n.status, p.uri, u.name AS username FROM {node} n INNER JOIN {project_projects} p ON n.nid = p.nid INNER JOIN {users} u ON n.uid = u.uid WHERE p.nid = %d";
-    $query = db_query($sql, $project_nid);
-  }
-
-  $project = db_fetch_object($query);
-  if (empty($project)) {
-    if (empty($api_tid)) {
-      wd_err(array('message' => 'Project ID @pid not found', 'args' => array('@pid' => $project_nid)));
-    }
-    else {
-      wd_err(array('message' => 'Project ID @pid has no supported releases for API term ID @api_tid', 'args' => array('@pid' => $project_nid, '@api_tid' => $api_tid)));
-    return FALSE;
-    }
-  }
-
-  $xml = '<title>'. check_plain($project->title) ."</title>\n";
-  $xml .= '<short_name>'. check_plain($project->uri) ."</short_name>\n";
-  $xml .= '<dc:creator>'. check_plain($project->username) ."</dc:creator>\n";
-  $xml .= '<api_version>'. check_plain($api_version) ."</api_version>\n";
-  if (!$project->status) {
-    // If it's not published, we can skip the rest of this and bail.
-    $xml .= "<project_status>unpublished</project_status>\n";
-    project_release_history_write_xml($xml, $project, $api_version);
-    return;
-  }
-
-  $project_status = 'published';
-  if (isset($api_tid)) {
-    // Include the info about supported and recommended major versions.
-    $query = db_query("SELECT major, supported, recommended FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d", $project_nid, $api_tid);
-    $supported_majors = array();
-    while ($version_info = db_fetch_object($query)) {
-      if ($version_info->supported) {
-        $supported_majors[] = $version_info->major;
-      }
-      if ($version_info->recommended) {
-        $recommended_major = $version_info->major;
-      }
-    }
-    if (isset($recommended_major)) {
-      $xml .= '<recommended_major>'. $recommended_major ."</recommended_major>\n";
-    }
-    if (empty($supported_majors)) {
-      $project_status = 'unsupported';
-    }
-    else {
-      $xml .= '<supported_majors>'. implode(',', $supported_majors) ."</supported_majors>\n";
-      // To avoid confusing existing clients, include <default_major>, too.
-      $xml .= '<default_major>'. min($supported_majors) ."</default_major>\n";
-    }
-  }
-
-  $xml .= '<project_status>'. $project_status ."</project_status>\n";
-  $xml .= '<link>'. prch_url("node/$project->nid") ."</link>\n";
-
-  // To prevent the update(_status) module from having problems parsing the XML,
-  // the terms need to be at the end of the information for the project.
-  $term_query = db_query("SELECT v.name AS vocab_name, v.vid, td.name AS term_name, td.tid FROM {term_node} tn INNER JOIN {term_data} td ON tn.tid = td.tid INNER JOIN {vocabulary} v ON td.vid = v.vid WHERE tn.vid = %d", $project->vid);
-  $xml_terms = '';
-  while ($term = db_fetch_object($term_query)) {
-    /// @todo: This is a drupal.org-specific hack.
-    /// @see http://drupal.org/node/1003764
-    if ($term->term_name == 'Installation profiles') {
-      $is_profile = TRUE;
-    }
-    $xml_terms .= '   <term><name>'. check_plain($term->vocab_name) .'</name>';
-    $xml_terms .= '<value>'. check_plain($term->term_name) ."</value></term>\n";
-  }
-  if (!empty($xml_terms)) {
-    $xml .= "  <terms>\n". $xml_terms ."  </terms>\n";
-  }
-
-  // Now, build the query for all the releases for this project and term.
-  $joins = array();
-  $where = array();
-  $parameters = array();
-  $fields = array(
-    'n.nid',
-    'n.vid',
-    'prn.rebuild',
-    'prn.version',
-    'prn.version_major',
-    'prn.version_minor',
-    'prn.version_patch',
-    'prn.version_extra',
-    'prn.version_extra_weight',
-    'prn.version_extra_delta',
-    'prn.tag',
-    'n.title',
-    'n.status',
-  );
-
-  $joins[] = "INNER JOIN {project_release_nodes} prn ON n.nid = prn.nid";
-  $where[] = "prn.pid = '%d'";
-  $parameters[] = $project->nid;
-
-  // Restrict releases to the specified API version.
-  if (isset($api_tid)) {
-    $where[] = 'prn.version_api_tid = %d';
-    $parameters[] = $api_tid;
-  }
-  else {
-    // If we're building a list for all versions, then we also need to sort
-    // our releases based on the API term's weight.
-    $joins[] = "INNER JOIN {term_data} td ON prn.version_api_tid = td.tid";
-    $fields[] = 'td.weight';
-  }
-
-  $query = "SELECT ". implode(', ', $fields) ." FROM {node} n ";
-  $query .= implode(' ', $joins);
-  $query .= " WHERE " . implode(' AND ', $where);
-  $result = db_query($query, $parameters);
-
-  $releases = array();
-  while ($release = db_fetch_object($result)) {
-    $releases[] = $release;
-  }
-
-  if (empty($releases)) {
-    // Nothing more to include for this project, wrap up and return.
-    project_release_history_write_xml($xml, $project, $api_version);
-    return;
-  }
-
-  // Sort the releases based on our custom sorting function.
-  usort($releases, "_release_sort");
-
-  $xml .= "<releases>\n";
-  foreach ($releases as $release) {
-    $xml .= " <release>\n";
-    $xml .= '  <name>'. check_plain($release->title) ."</name>\n";
-    $xml .= '  <version>'. check_plain($release->version) ."</version>\n";
-    if (!empty($release->tag) && $tag = check_plain($release->tag)) {
-      $xml .= '  <tag>'. $tag ."</tag>\n";
-    }
-    foreach (array('major', 'minor', 'patch', 'extra') as $type) {
-      $vers_type = "version_$type";
-      if (isset($release->$vers_type)) {
-        $xml .= "  <$vers_type>". check_plain($release->$vers_type) ."</$vers_type>\n";
-      }
-    }
-
-    // Need to fetch list of files for this release
-    $files_query = db_query("SELECT prf.filehash, f.filepath, f.filesize, f.timestamp FROM {project_release_file} prf INNER JOIN {files} f on prf.fid = f.fid WHERE prf.nid = %d ORDER BY prf.weight", $release->nid);
-
-    $files = array();
-    while ($file = db_fetch_object($files_query)) {
-      $files[] = $file;
-    }
-
-    if ($release->status) {
-      // Published, so we should include the links.
-      $xml .= "  <status>published</status>\n";
-      $xml .= '  <release_link>'. prch_url("node/$release->nid") ."</release_link>\n";
-      if (!empty($files[0]->filepath)) {
-        $download_link = theme('project_release_download_link', $files[0]->filepath, NULL, TRUE);
-        $xml .= '  <download_link>'. $download_link['href'] ."</download_link>\n";
-      }
-    }
-    else {
-      $xml .= "  <status>unpublished</status>\n";
-    }
-    // We want to include the rest of these regardless of the status.
-    if (!empty($files[0]->timestamp)) {
-      $xml .= '  <date>'. check_plain($files[0]->timestamp) ."</date>\n";
-    }
-    if (!empty($files[0]->filehash)) {
-      $xml .= '  <mdhash>'. check_plain($files[0]->filehash) ."</mdhash>\n";
-    }
-    if (isset($files[0]->filesize)) {
-      $xml .= '  <filesize>'. check_plain($files[0]->filesize) ."</filesize>\n";
-    }
-
-    $xml .= "  <files>\n";
-    foreach ($files as $file) {
-      $xml .= "   <file>\n";
-      if ($release->status && !empty($file->filepath)) {
-        $download_link = theme('project_release_download_link', $file->filepath, NULL, TRUE);
-        $xml .= '    <url>' . $download_link['href'] . "</url>\n";
-      }
-      if (!empty($file->filepath)) {
-        $file_parts = explode('.', basename($file->filepath));
-        $archive_type = array_pop($file_parts);
-        // See if the previous extension is '.tar' and if so, add that, so we
-        // see 'tar.gz' or 'tar.bz2' instead of just 'gz' or 'bz2'.
-        $previous_ext = array_pop($file_parts);
-        if ($previous_ext == 'tar') {
-          $archive_type = $previous_ext . '.' . $archive_type;
-        }
-        else {
-          // Put it back on the array, so our profile logic below still works.
-          array_push($file_parts, $previous_ext);
-        }
-        $xml .= '    <archive_type>' . $archive_type . "</archive_type>\n";
-
-        /// @todo: This is a drupal.org-specific hack.
-        /// @see http://drupal.org/node/1003764
-        if ($is_profile) {
-          $variant_chunk = array_pop($file_parts);
-          if (strrpos($variant_chunk, 'no-core') !== FALSE) {
-            $variant = 'projects';
-          }
-          elseif (strrpos($variant_chunk, 'core') !== FALSE) {
-            $variant = 'full';
-          }
-          else {
-            $variant = 'profile-only';
-          }
-          $xml .= '    <variant>' . $variant . "</variant>\n";
-        }
-      }
-      if (!empty($file->filehash)) {
-        $xml .= '    <md5>' . check_plain($file->filehash) . "</md5>\n";
-      }
-      if (isset($file->filesize)) {
-        $xml .= '    <size>' . check_plain($file->filesize) . "</size>\n";
-      }
-      if (!empty($file->timestamp)) {
-        $xml .= '    <filedate>' . check_plain($file->timestamp) . "</filedate>\n";
-      }
-      $xml .= "   </file>\n";
-    }
-    $xml .= "  </files>\n";
-
-    $term_query = db_query("SELECT v.name AS vocab_name, v.vid, td.name AS term_name, td.tid FROM {term_node} tn INNER JOIN {term_data} td ON tn.tid = td.tid INNER JOIN {vocabulary} v ON td.vid = v.vid WHERE tn.vid = %d AND v.vid != %d", $release->vid, $api_vid);
-    $xml_terms = '';
-    while ($term = db_fetch_object($term_query)) {
-      $xml_terms .= '   <term><name>'. check_plain($term->vocab_name) .'</name>';
-      $xml_terms .= '<value>'. check_plain($term->term_name) ."</value></term>\n";
-    }
-    if (!empty($xml_terms)) {
-      $xml .= "  <terms>\n". $xml_terms ."  </terms>\n";
-    }
-    $xml .= " </release>\n";
-  }
-  $xml .= "</releases>\n";
-  project_release_history_write_xml($xml, $project, $api_version);
-}
-
-
-/**
- * Write out the XML history for a given project and version to a file.
- *
- * @param $xml
- *   String containing the XML representation of the history.
- * @param $project
- *   An object containing (at least) the title and uri of project.
- * @param $api_version
- *   The API compatibility version the history is for.
- */
-function project_release_history_write_xml($xml, $project = NULL, $api_version = NULL) {
-
-  // Dublin core namespace according to http://dublincore.org/documents/dcmi-namespace/
-  $dc_namespace = 'xmlns:dc="http://purl.org/dc/elements/1.1/"';
-  if (!isset($project)) {
-    // We are outputting a global project list.
-    $project_dir = HISTORY_ROOT .'/project-list';
-    $filename = $project_dir .'/project-list-all.xml';
-    $tmp_filename = $filename .'.new';
-    $errors = array(
-      'mkdir' => array(
-        'message' => 'ERROR: mkdir(@dir) failed, cannot write project list.',
-        'args' => array('@dir' => $project_dir),
-      ),
-      'unlink' => array(
-        'message' => 'ERROR: unlink(@file) failed, cannot write project list.',
-        'args' => array('@file' => $tmp_filename),
-      ),
-      'rename' => array(
-        'message' => 'ERROR: rename(@old, @new) failed, cannot write project list.',
-        'args' => array('@old' => $tmp_filename, '@new' => $filename),
-      ),
-    );
-    $full_xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
-    $full_xml .= '<projects '. $dc_namespace .">\n" . $xml . "</projects>\n";
-  }
-  else {
-    // Setup the filenames we'll be using.  Normally, we'd have to be
-    // extra careful with $project->uri to avoid malice here, however,
-    // that's validated on the project edit form to prevent any funny
-    // characters, so that much is safe.  The rest of these paths are
-    // just from the global variables at the top of this script, so we
-    // can trust those.  The only one we should be careful of is the
-    // taxonomy term for the API compatibility.
-    $safe_api_vers = strtr($api_version, '/', '_');
-    $project_dir = HISTORY_ROOT .'/'. $project->uri;
-    $project_id = $project->uri .'-'. $safe_api_vers .'.xml';
-    $filename = $project_dir .'/'. $project_id;
-    $tmp_filename = $filename .'.new';
-    $errors = array(
-      'mkdir'  => array(
-        'message' => "ERROR: mkdir(@dir) failed, can't write history for %project.",
-        'args' => array('@dir' => $project_dir, '%project' => $project->title),
-      ),
-      'unlink' => array(
-        'message' => "ERROR: unlink(@file) failed, can't write history for %project.",
-        'args' => array('@file' => $tmp_filename, '%project' => $project->title),
-      ),
-      'rename' => array(
-        'message' => "ERROR: rename(@old, @new) failed, can't write history for %project.",
-        'args' => array('@old' => $tmp_filename, '@new' => $filename, '%project' => $project->title),
-      ),
-    );
-    $full_xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
-    $full_xml .= '<project '. $dc_namespace .">\n" . $xml . "</project>\n";
-  }
-
-  // Make sure we've got the right project-specific subdirectory.
-  if (!is_dir($project_dir) && !mkdir($project_dir)) {
-    wd_err($errors['mkdir']);
-    return FALSE;
-  }
-  // Make sure the "[project]-[version].xml.new" file doesn't exist.
-  if (is_file($tmp_filename) && !unlink($tmp_filename)) {
-    wd_err($errors['unlink']);
-    return FALSE;
-  }
-  // Write the XML history to "[project]-[version].xml.new".
-  if (!$hist_fd = fopen($tmp_filename, 'xb')) {
-    wd_err(array('message' => "ERROR: fopen(@file, 'xb') failed", 'args' => array('@file' => $tmp_filename)));
-    return FALSE;
-  }
-  if (!fwrite($hist_fd, $full_xml)) {
-    wd_err(array('message' => "ERROR: fwrite(@file) failed" . '<pre>' . check_plain($full_xml), 'args' => array('@file' => $tmp_filename)));
-    return FALSE;
-  }
-  // We have to close this handle before we can rename().
-  fclose($hist_fd);
-
-  // Now we can atomically rename the .new into place in the "live" spot.
-  if (!_rename($tmp_filename, $filename)) {
-    wd_err($errors['rename']);
-    return FALSE;
-  }
-  return TRUE;
-}
-
-/**
- * Generate a list of all projects available on this server.
- */
-function project_list_generate() {
-  $api_vid = _project_release_get_api_vid();
-  
-  $query = db_query("SELECT n.title, n.nid, n.vid, n.status, p.uri, u.name AS username FROM {node} n INNER JOIN {project_projects} p ON n.nid = p.nid INNER JOIN {users} u ON n.uid = u.uid");
-
-  $xml = '';
-  while ($project = db_fetch_object($query)) {
-    $xml .= " <project>\n";
-    $xml .= '  <title>'. check_plain($project->title) ."</title>\n";
-    $xml .= '  <short_name>'. check_plain($project->uri) ."</short_name>\n";
-    $xml .= '  <link>'. prch_url("node/$project->nid") ."</link>\n";
-    $xml .= '  <dc:creator>'. check_plain($project->username). "</dc:creator>\n";
-    $term_query = db_query("SELECT v.name AS vocab_name, v.vid, td.name AS term_name, td.tid FROM {term_node} tn INNER JOIN {term_data} td ON tn.tid = td.tid INNER JOIN {vocabulary} v ON td.vid = v.vid WHERE tn.vid = %d", $project->vid);
-    $xml_terms = '';
-    while ($term = db_fetch_object($term_query)) {
-      $xml_terms .= '   <term><name>'. check_plain($term->vocab_name) .'</name>';
-      $xml_terms .= '<value>'. check_plain($term->term_name) ."</value></term>\n";
-    }
-    if (!empty($xml_terms)) {
-      $xml .= "  <terms>\n". $xml_terms ."  </terms>\n";
-    }
-    if (!$project->status) {
-      // If it's not published, we can skip the rest for this project.
-      $xml .= "  <project_status>unpublished</project_status>\n";
-    }
-    else {
-      $xml .= "  <project_status>published</project_status>\n";
-      // Include a list of API terms if available.
-      $term_query = db_query("SELECT DISTINCT(td.tid), td.name AS term_name FROM {project_release_nodes} prn INNER JOIN {term_data} td ON prn.version_api_tid = td.tid WHERE prn.pid = %d AND td.vid = %d ORDER BY td.weight ASC", $project->nid, $api_vid);
-      $xml_api_terms = '';
-      while ($api_term = db_fetch_object($term_query)) {
-        $xml_api_terms .= '   <api_version>'. check_plain($api_term->term_name) ."</api_version>\n";
-      }
-      if (!empty($xml_api_terms)) {
-        $xml .= "  <api_versions>\n". $xml_api_terms ."  </api_versions>\n";
-      }
-    }
-    
-    $xml .= " </project>\n";
-  }
-  if (empty($xml)) {
-    wd_err(array('message' => 'No projects found on this server.'));
-    return FALSE;
-  }
-  project_release_history_write_xml($xml);
-}
-
-// ------------------------------------------------------------
-// Functions: utility methods
-// ------------------------------------------------------------
-
-/**
- * Wrapper function for watchdog() to log notice messages.
- *
- * @param $notice
- *   An associative array with 'message' and 'args' keys for the notice message
- *   and any arguments respectively.
- * @param $link
- *   A link to associate with the message.
- */
-function wd_msg($notice, $link = NULL) {
-  watchdog('release_history', $notice['message'], $notice['args'], WATCHDOG_NOTICE, $link);
-}
-
-/**
- * Wrapper function for watchdog() to log error messages.
- *
- * @param $error
- *   An associative array with 'message' and 'args' keys for the error message
- *   and any arguments respectively.
- * @param $link
- *   A link to associate with the message.
- */
-function wd_err($error, $link = NULL) {
-  watchdog('release_hist_err', $error['message'], $error['args'], WATCHDOG_ERROR, $link);
-}
-
-/**
- * Rename on Windows isn't atomic like it is on *nix systems.
- * See http://www.php.net/rename about this bug.
- */
-function _rename($oldfile, $newfile) {
-  if (substr(PHP_OS, 0, 3) == 'WIN') {
-    if (copy($oldfile, $newfile)) {
-      unlink($oldfile);
-      return TRUE;
-    }
-    return FALSE;
-  }
-  else {
-    return rename($oldfile, $newfile);
-  }
-}
-
-/**
- * Sorting function to ensure releases are in the right order in the XML file.
- *
- * Loop over the fields in the release node we care about, and the first field
- * that differs between the two releases determines the order.
- *
- * We first check the 'weight' (of the API version term) for when we're
- * building a single list of all versions, not a per-API version listing. In
- * this case, lower numbers should float to the top.
- *
- * We also need to special-case the 'rebuild' field, which is how we know if
- * it's a dev snapshot or official release. Rebuild == 1 should always come
- * last within a given major version, since that's how update_status expects
- * the ordering to ensure that we never recommend a -dev release if there's an
- * official release available. So, like weight, the lower number for 'rebuild'
- * should float to the top.
- *
- * For every other field, we want the bigger numbers come first.
- *
- * @see project_release_history_generate_project_xml()
- * @see usort()
- */
-function _release_sort($a, $b) {
-  // This array maps fields in the release node to the sort order, where -1
-  // means to sort like Drupal weights, and +1 means the bigger numbers are
-  // higher in the listing.
-  $fields = array(
-    'weight' => -1,
-    'version_major' => 1,
-    'rebuild' => -1,
-    'version_minor' => 1,
-    'version_patch' => 1,
-    'version_extra_weight' => 1,
-    'version_extra_delta' => 1,
-  );
-  foreach ($fields as $field => $sign) {
-    if (!isset($a->$field) && !isset($b->$field)) {
-      continue;
-    }
-    if ($a->$field == $b->$field) {
-      continue;
-    }
-    return ($a->$field < $b->$field) ? $sign : (-1 * $sign);
-  }
-}
-
-/**
- * Helper function to generate clean absolute links for the XML files.
- *
- * Relying on core's url() gives us crazy results when the script is invoked
- * with a full path, since the construction of $base_url during bootstrapping
- * is all wrong.
- *
- * @todo This doesn't handle sites installed in subdirectories that actually
- * define their own $base_url in settings.php...
- */
-function prch_url($path) {
-  static $base_url = NULL;
-  static $clean_url = NULL;
-  if (!isset($clean_url)) {
-    $clean_url = (bool)variable_get('clean_url', '0');
-  }
-
-  if (!isset($base_url)) {
-    $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
-    $base_url = $base_root .= '://'. $_SERVER['HTTP_HOST'] .'/';
-  }
-
-  $path = drupal_get_path_alias($path, '');
-  if ($clean_url) {
-    return $base_url . $path;
-  }
-  else {
-    return $base_url .'?q='. $path;
-  }
-}
 
diff --git a/release/project-release-private-download.php b/release/project-release-private-download.php
index cd7a10c..fc96096 100755
--- a/release/project-release-private-download.php
+++ b/release/project-release-private-download.php
@@ -109,13 +109,13 @@ $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
 $_SERVER['REQUEST_URI'] = '/' . $script_name;
 $_SERVER['SCRIPT_NAME'] = '/' . $script_name;
 $_SERVER['PHP_SELF'] = '/' . $script_name;
-$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] .'/'. $script_name;
+$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] . '/' . $script_name;
 $_SERVER['PATH_TRANSLATED'] = $_SERVER['SCRIPT_FILENAME'];
 
 // Actually do the bootstrap. Since we're relying on db_rewrite_sql() to
 // enforce the access checks on the release node, and since that invokes a
 // hook, we need a full bootstrap here, not just DRUPAL_BOOTSTRAP_DATABASE.
-include_once './includes/bootstrap.inc';
+include_once DRUPAL_ROOT . '/' . './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
 // Make sure we have the path argument for the file to download.
@@ -141,7 +141,8 @@ if (!is_file($full_path)) {
 // something.  Even if they managed to find a file that actually exists that
 // way, it's not going to match a valid release node.  So they're going to get
 // a 403, not the file they're trying to steal.
-$nid = db_result(db_query(db_rewrite_sql("SELECT n.nid FROM {node} n INNER JOIN {project_release_file} prf ON n.nid = prf.nid INNER JOIN {files} f ON prf.fid = f.fid WHERE n.status = 1 AND f.filepath = '%s'"), $path));
+// TODO Please convert this statement to the D7 database API syntax.
+$nid = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n INNER JOIN {project_release_file} prf ON n.nid = prf.nid INNER JOIN {files} f ON prf.fid = f.fid WHERE n.status = 1 AND f.filepath = '%s'"), $path)->fetchField();
 if (empty($nid)) {
   drupal_access_denied();
   exit(1);
@@ -153,7 +154,7 @@ $file_size = $stat[7];
 $file_mtime = $stat[9];
 header('Expires: 0');
 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-header('Last-Modified: '. gmdate('D, d M Y H:i:s', $file_mtime) .' GMT');
+header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $file_mtime) . ' GMT');
 header('Content-Type: application/octet-stream');
 header('Content-Description: File Transfer');
 header('Content-Disposition: attachment; filename="' . basename($path) . '"');
diff --git a/release/project-release-serve-history.php b/release/project-release-serve-history.php
index 2703acd..288b36b 100755
--- a/release/project-release-serve-history.php
+++ b/release/project-release-serve-history.php
@@ -65,9 +65,9 @@ $safe_project_name = preg_replace($whitelist_regexp, '#', $project_name);
 $safe_api_vers = preg_replace($whitelist_regexp, '#', $api_version);
 
 // Figure out the filename for the release history we want to serve.
-$project_dir = HISTORY_ROOT .'/'. $safe_project_name;
-$filename = $safe_project_name .'-'. $safe_api_vers .'.xml';
-$full_path = $project_dir .'/'. $filename;
+$project_dir = HISTORY_ROOT . '/' . $safe_project_name;
+$filename = $safe_project_name . '-' . $safe_api_vers . '.xml';
+$full_path = $project_dir . '/' . $filename;
 
 if (!is_file($full_path)) {
   if (!is_dir($project_dir)) {
@@ -82,7 +82,7 @@ if (!is_file($full_path)) {
 // we're going to need this as soon as we start collecting stats.
 $stat = stat($full_path);
 $mtime = $stat[9];
-header('Last-Modified: '. gmdate('D, d M Y H:i:s', $mtime) .' GMT');
+header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $mtime) . ' GMT');
 header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
 header("Cache-Control: store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", FALSE);
@@ -91,7 +91,7 @@ header("Cache-Control: post-check=0, pre-check=0", FALSE);
 $file = file_get_contents($full_path);
 // Old release xml files are missing the encoding. Prepend one if necessary.
 if (substr($file, 0, 5) != '<?xml') {
-  echo '<?xml version="1.0" encoding="utf-8"?>' ."\n";
+  echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
 }
 echo $file;
 
@@ -107,11 +107,11 @@ if (isset($_GET['site_key'])) {
   $_SERVER['REQUEST_URI'] = '/' . $script_name;
   $_SERVER['SCRIPT_NAME'] = '/' . $script_name;
   $_SERVER['PHP_SELF'] = '/' . $script_name;
-  $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] .'/'. $script_name;
+  $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] . '/' . $script_name;
   $_SERVER['PATH_TRANSLATED'] = $_SERVER['SCRIPT_FILENAME'];
 
   // Actually do the bootstrap.
-  include_once './includes/bootstrap.inc';
+  include_once DRUPAL_ROOT . '/' . './includes/bootstrap.inc';
   drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
 
   // We can't call module_exists without bootstrapping to a higher level so
@@ -123,13 +123,35 @@ if (isset($_GET['site_key'])) {
 
     // Compute a GMT timestamp for begining of the day. getdate() is
     // affected by the server's timezone so we need to cancel it out.
-    $now = time();
+    $now = REQUEST_TIME;
     $time_parts = getdate($now - date('Z', $now));
     $timestamp = gmmktime(0, 0, 0, $time_parts['mon'], $time_parts['mday'], $time_parts['year']);
 
-    db_query("UPDATE {project_usage_raw} SET api_version = '%s', project_version = '%s', ip_addr = '%s' WHERE project_uri = '%s' AND timestamp = %d AND site_key = '%s'", $api_version, $project_version, $ip_addr, $project_name, $timestamp, $site_key);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("UPDATE {project_usage_raw} SET api_version = '%s', project_version = '%s', ip_addr = '%s' WHERE project_uri = '%s' AND timestamp = %d AND site_key = '%s'", $api_version, $project_version, $ip_addr, $project_name, $timestamp, $site_key) */
+    db_update('project_usage_raw')
+  ->fields(array(
+      'api_version' => $api_version,
+      'project_version' => $project_version,
+      'ip_addr' => $ip_addr,
+    ))
+  ->condition('project_uri', $project_name)
+  ->condition('timestamp', $timestamp)
+  ->condition('site_key', $site_key)
+  ->execute();
     if (!db_affected_rows()) {
-      db_query("INSERT INTO {project_usage_raw} (project_uri, timestamp, site_key, api_version, project_version, ip_addr) VALUES ('%s', %d, '%s', '%s', '%s', '%s')", $project_name, $timestamp, $site_key, $api_version, $project_version, $ip_addr);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("INSERT INTO {project_usage_raw} (project_uri, timestamp, site_key, api_version, project_version, ip_addr) VALUES ('%s', %d, '%s', '%s', '%s', '%s')", $project_name, $timestamp, $site_key, $api_version, $project_version, $ip_addr) */
+      $id = db_insert('project_usage_raw')
+  ->fields(array(
+        'project_uri' => $project_name,
+        'timestamp' => $timestamp,
+        'site_key' => $site_key,
+        'api_version' => $api_version,
+        'project_version' => $project_version,
+        'ip_addr' => $ip_addr,
+      ))
+  ->execute();
     }
   }
 }
@@ -146,7 +168,7 @@ function _check_plain($text) {
  * Generate an error and exit.
  */
 function error($text) {
-  echo '<?xml version="1.0" encoding="utf-8"?>'. "\n";
-  echo '<error>'. $text ."</error>\n";
+  echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
+  echo '<error>' . $text . "</error>\n";
   exit(1);
 }
diff --git a/release/project_release.info b/release/project_release.info
index 0ea1e2d..290bf52 100644
--- a/release/project_release.info
+++ b/release/project_release.info
@@ -5,4 +5,5 @@ dependencies[] = project
 dependencies[] = taxonomy
 dependencies[] = upload
 dependencies[] = views
-core = 6.x
+core = 7.x
+
diff --git a/release/project_release.install b/release/project_release.install
index a8331d8..62df258 100644
--- a/release/project_release.install
+++ b/release/project_release.install
@@ -1,26 +1,45 @@
 <?php
+/**
+ * @file
+ * Install, update and uninstall functions for the project_release module.
+ *
+ */
 
+
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_install() {
   // Create the database tables.
-  drupal_install_schema('project_release');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('project_release')
 
   // Make this module heavier than the default module weight.
-  db_query("UPDATE {system} SET weight = %d WHERE name = 'project_release'", 2);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {system} SET weight = %d WHERE name = 'project_release'", 2) */
+  db_update('system')
+  ->fields(array(
+    'weight' => 2,
+  ))
+  ->condition('name', 'project_release')
+  ->execute();
 }
 
 /**
- * Implement hook_enable().
+ * Implements hook_enable().
  */
 function project_release_enable() {
   project_release_add_missing_projects();
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function project_release_uninstall() {
   // Drop database tables.
-  drupal_uninstall_schema('project_release');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('project_release')
 
   $variables = array(
     'project_release_active_compatibility_tids',
@@ -40,7 +59,7 @@ function project_release_uninstall() {
 }
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function project_release_schema() {
   $schema['project_release_nodes'] = array(
@@ -123,7 +142,7 @@ function project_release_schema() {
         'default' => 0,
       ),
       'version_api_tid' => array(
-        'description' => 'The denormalized {term_node}.tid of the API compatibility term for this release, or 0 if the release has no such term.',
+        'description' => 'The denormalized {taxonomy_term_node}.tid of the API compatibility term for this release, or 0 if the release has no such term.',
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
@@ -147,7 +166,7 @@ function project_release_schema() {
     ),
     'primary key' => array('nid'),
     'indexes' => array(
-      'project_releases_pid' => array('pid')
+      'project_releases_pid' => array('pid'),
     ),
   );
 
@@ -221,7 +240,7 @@ function project_release_schema() {
     ),
     'primary key' => array('nid'),
     'indexes' => array(
-      'project_release_projects_releases' => array('releases')
+      'project_release_projects_releases' => array('releases'),
     ),
   );
 
@@ -236,7 +255,7 @@ function project_release_schema() {
         'default' => 0,
       ),
       'tid' => array(
-        'description' => 'Primary Key: The {term_data}.tid of the API compatability version associated with a major version of a project.',
+        'description' => 'Primary Key: The {taxonomy_term_data}.tid of the API compatability version associated with a major version of a project.',
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
@@ -312,7 +331,7 @@ function project_release_schema() {
         'description' => 'The text of any error messages created by the packaging scripts.',
         'type' => 'text',
         'not null' => FALSE,
-      )
+      ),
     ),
     'primary key' => array('nid'),
   );
@@ -355,34 +374,34 @@ function project_release_schema() {
         'type' => 'int',
         'size' => 'small',
         'not null' => TRUE,
-        'default' => 0
+        'default' => 0,
       ),
     ),
     'primary key' => array('cid'),
     'indexes' => array(
-      'expire' => array('expire')
+      'expire' => array('expire'),
     ),
   );
 
   $schema['project_release_project_maintainer'] = array(
-    'description' => t('Users who have various per-project maintainer permissions.'),
+    'description' => 'Users who have various per-project maintainer permissions.',
     'fields' => array(
       'nid' => array(
-        'description' => t('Foreign key: {project_projects}.nid of the project.'),
+        'description' => 'Foreign key: {project_projects}.nid of the project.',
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
       'uid' => array(
-        'description' => t('Foreign key: {users}.uid of a user with any project maintainer permissions.'),
+        'description' => 'Foreign key: {users}.uid of a user with any project maintainer permissions.',
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
       'administer_releases' => array(
-        'description' => t('Can this user create and administer releases for the given project.'),
+        'description' => 'Can this user create and administer releases for the given project.',
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
@@ -400,9 +419,15 @@ function project_release_schema() {
  * {project_release_projects} table, and add them.
  */
 function project_release_add_missing_projects() {
-  $projects = db_query("SELECT n.nid FROM {node} n LEFT JOIN {project_release_projects} prp ON n.nid = prp.nid WHERE n.type = 'project_project' AND prp.nid IS NULL");
+  $projects = db_query("SELECT n.nid FROM {node} n LEFT JOIN {project_release_projects} prp ON n.nid = prp.nid WHERE n.type = :n.type AND prp.nid IS NULL", array(':n.type' => 'project_project'));
   while ($project = db_fetch_object($projects)) {
-    db_query("INSERT INTO {project_release_projects} (nid) VALUES (%d)", $project->nid);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("INSERT INTO {project_release_projects} (nid) VALUES (%d)", $project->nid) */
+    $id = db_insert('project_release_projects')
+  ->fields(array(
+      'nid' => $project->nid,
+    ))
+  ->execute();
   }
 }
 
@@ -415,7 +440,8 @@ function project_release_add_missing_projects() {
 function _project_release_check_security_updates(&$ret) {
   $security_update_tid = variable_get('project_release_security_update_tid', 0);
   if (!empty($security_update_tid)) {
-    $ret[] = update_sql("UPDATE {project_release_nodes} SET security_update = (SELECT tn.tid IS NOT NULL FROM node n LEFT JOIN term_node tn ON n.vid = tn.vid AND tn.tid = $security_update_tid WHERE n.nid = {project_release_nodes}.nid)");
+    // TODO update_sql has been removed. Use the database API for any schema or data changes.
+    $ret[] = array() /* update_sql("UPDATE {project_release_nodes} SET security_update = (SELECT tn.tid IS NOT NULL FROM node n LEFT JOIN term_node tn ON n.vid = tn.vid AND tn.tid = $security_update_tid WHERE n.nid = {project_release_nodes}.nid)") */;
   }
 }
 
@@ -429,10 +455,12 @@ function _project_release_update_version_extra_weights(&$ret) {
   $weights = project_release_get_version_extra_weight_map();
   foreach ($weights as $prefix => $weight) {
     if ($prefix == 'NULL') {
-      $ret[] = update_sql("UPDATE {project_release_nodes} SET version_extra_weight = $weight WHERE version_extra IS NULL");
+      // TODO update_sql has been removed. Use the database API for any schema or data changes.
+      $ret[] = array() /* update_sql("UPDATE {project_release_nodes} SET version_extra_weight = $weight WHERE version_extra IS NULL") */;
     }
     else {
-      $ret[] = update_sql("UPDATE {project_release_nodes} SET version_extra_weight = $weight WHERE LOWER(version_extra) LIKE '" . $prefix . "%'");
+      // TODO update_sql has been removed. Use the database API for any schema or data changes.
+      $ret[] = array() /* update_sql("UPDATE {project_release_nodes} SET version_extra_weight = $weight WHERE LOWER(version_extra) LIKE '" . $prefix . "%'") */;
     }
   }
 }
@@ -448,8 +476,11 @@ function project_release_update_6000() {
     'default' => 0,
     'not null' => TRUE,
   );
-  db_add_field($ret, 'cache_project_release', 'serialized', $spec);
-  return $ret;
+  db_add_field('cache_project_release', 'serialized', $spec);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -458,8 +489,11 @@ function project_release_update_6000() {
 function project_release_update_6001() {
   $ret = array();
   $schema = project_release_schema();
-  db_create_table($ret, 'project_release_file', $schema['project_release_file']);
-  return $ret;
+  db_create_table('project_release_file', $schema['project_release_file']);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -474,11 +508,11 @@ function project_release_update_6002() {
   // Multi-part update
   if (!isset($_SESSION['project_release_update_6002'])) {
     $_SESSION['project_release_update_6002'] = 0;
-    $_SESSION['project_release_update_6002_max'] = db_result(db_query("SELECT COUNT(prn.nid) FROM {project_release_nodes} prn INNER JOIN {node} n ON prn.nid = n.nid WHERE prn.file_path <> ''"));
+    $_SESSION['project_release_update_6002_max'] = db_query("SELECT COUNT(prn.nid) FROM {project_release_nodes} prn INNER JOIN {node} n ON prn.nid = n.nid WHERE prn.file_path <> :prn.file_path", array(':prn.file_path' => ''))->fetchField();
   }
 
   // Pull the next batch of files.
-  $files = db_query_range("SELECT prn.*, n.uid FROM {project_release_nodes} prn INNER JOIN {node} n ON prn.nid = n.nid WHERE prn.file_path <> '' ORDER BY prn.nid", $_SESSION['project_release_update_6002'], $limit);
+  $files = db_query_range("SELECT prn.*, n.uid FROM {project_release_nodes} prn INNER JOIN {node} n ON prn.nid = n.nid WHERE prn.file_path <> :prn.file_path ORDER BY prn.nid", array(':prn.file_path' => ''));
 
   // Loop through each file.
   while ($file = db_fetch_object($files)) {
@@ -487,9 +521,29 @@ function project_release_update_6002() {
       $filename = basename($file->file_path);
       $filesize = filesize(file_create_path($file->file_path));
       $filemime = file_get_mimetype($filename);
-      db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', %d, %d)", $file->uid, $filename, $file->file_path, $filemime, $filesize, FILE_STATUS_PERMANENT, $file->file_date);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', %d, %d)", $file->uid, $filename, $file->file_path, $filemime, $filesize, FILE_STATUS_PERMANENT, $file->file_date) */
+      $id = db_insert('files')
+  ->fields(array(
+        'uid' => $file->uid,
+        'filename' => $filename,
+        'filepath' => $file->file_path,
+        'filemime' => $filemime,
+        'filesize' => $filesize,
+        'status' => FILE_STATUS_PERMANENT,
+        'timestamp' => $file->file_date,
+      ))
+  ->execute();
       $fid = db_last_insert_id('files', 'fid');
-      db_query("INSERT INTO {project_release_file} (fid, nid, filehash) VALUES (%d, %d,'%s')", $fid, $file->nid, $file->file_hash);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("INSERT INTO {project_release_file} (fid, nid, filehash) VALUES (%d, %d,'%s')", $fid, $file->nid, $file->file_hash) */
+      $id = db_insert('project_release_file')
+  ->fields(array(
+        'fid' => $fid,
+        'nid' => $file->nid,
+        'filehash' => $file->file_hash,
+      ))
+  ->execute();
     }
     $_SESSION['project_release_update_6002']++;
   }
@@ -500,7 +554,10 @@ function project_release_update_6002() {
     unset($_SESSION['project_release_update_6002_max']);
     return array(array('success' => TRUE, 'query' => t('Converted release file attachments for @count releases', array('@count' => $count))));
   }
-  return array('#finished' => $_SESSION['project_release_update_6002'] / $_SESSION['project_release_update_6002_max']);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* array('#finished' => $_SESSION['project_release_update_6002'] / $_SESSION['project_release_update_6002_max']) */;
 
 }
 
@@ -509,10 +566,13 @@ function project_release_update_6002() {
  */
 function project_release_update_6003() {
   $ret = array();
-  db_drop_field($ret, 'project_release_nodes', 'file_path');
-  db_drop_field($ret, 'project_release_nodes', 'file_date');
-  db_drop_field($ret, 'project_release_nodes', 'file_hash');
-  return $ret;
+  db_drop_field('project_release_nodes', 'file_path');
+  db_drop_field('project_release_nodes', 'file_date');
+  db_drop_field('project_release_nodes', 'file_hash');
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -521,16 +581,22 @@ function project_release_update_6003() {
 function project_release_update_6004() {
   $ret = array('#finished' => 0);
   if (!isset($_SESSION['project_release_update_6004'])) {
-    $spec = array('type' => 'int', 'unsigned' => TRUE, 'default' => NULL, 'not null' => FALSE);
-    db_add_field($ret, 'project_release_supported_versions', 'recommended_release', $spec);
-    db_add_field($ret, 'project_release_supported_versions', 'latest_release', $spec);
+    $spec = array(
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'default' => NULL,
+      'not null' => FALSE,
+    );
+    db_add_field('project_release_supported_versions', 'recommended_release', $spec);
+    db_add_field('project_release_supported_versions', 'latest_release', $spec);
     $_SESSION['project_release_update_6004'] = 0;
-    $_SESSION['project_release_update_6004_max'] = db_result(db_query("SELECT COUNT(*) FROM {project_release_supported_versions}"));
+    $_SESSION['project_release_update_6004_max'] = db_query("SELECT COUNT(*) FROM {project_release_supported_versions}")->fetchField();
   }
 
   // Number of rows to convert per batch.
   $limit = 20;
-  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT * FROM {project_release_supported_versions} WHERE latest_release IS NULL", 0, 1))) {
+  // TODO Please convert this statement to the D7 database API syntax.
+  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT * FROM {project_release_supported_versions} WHERE latest_release IS NULL"))) {
     // We have a branch we haven't processed yet (latest_release is still
     // NULL), so we invoke project_release_check_supported_versions() to
     // run some queries to determine the recommended and latest releases on
@@ -541,15 +607,27 @@ function project_release_update_6004() {
     // ourselves for this branch to mark the new fields as 0 (not NULL) so
     // that we don't check this branch again.
     if (!project_release_check_supported_versions($item['nid'], $item['tid'], $item['major'], FALSE)) {
-      db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d WHERE nid = %d AND tid = %d AND major = %d", 0, 0, $item['nid'], $item['tid'], $item['major']);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d WHERE nid = %d AND tid = %d AND major = %d", 0, 0, $item['nid'], $item['tid'], $item['major']) */
+      db_update('project_release_supported_versions')
+  ->fields(array(
+        'recommended_release' => 0,
+        'latest_release' => 0,
+      ))
+  ->condition('nid', $item['nid'])
+  ->condition('tid', $item['tid'])
+  ->condition('major', $item['major'])
+  ->execute();
     }
     $_SESSION['project_release_update_6004']++;
   }
 
   if ($_SESSION['project_release_update_6004'] >= $_SESSION['project_release_update_6004_max']) {
     // We're done.  Set our new columns to default to 0 from here on out.
-    $ret[] = update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN recommended_release SET DEFAULT 0");
-    $ret[] = update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN latest_release SET DEFAULT 0");
+    // TODO update_sql has been removed. Use the database API for any schema or data changes.
+    $ret[] = array() /* update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN recommended_release SET DEFAULT 0") */;
+    // TODO update_sql has been removed. Use the database API for any schema or data changes.
+    $ret[] = array() /* update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN latest_release SET DEFAULT 0") */;
     unset($_SESSION['project_release_update_6004']);
     unset($_SESSION['project_release_update_6004_max']);
     $ret['#finished'] = 1;
@@ -557,7 +635,10 @@ function project_release_update_6004() {
   else {
     $ret['#finished'] = $_SESSION['project_release_update_6004'] / $_SESSION['project_release_update_6004_max'];
   }
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -567,19 +648,23 @@ function project_release_update_6005() {
   $ret = array();
 
   $spec = array(
-    'description' => 'The denormalized {term_node}.tid of the API compatibility term for this release, or 0 if the release has no such term.',
+    'description' => 'The denormalized {taxonomy_term_node}.tid of the API compatibility term for this release, or 0 if the release has no such term.',
     'type' => 'int',
     'unsigned' => TRUE,
     'not null' => FALSE,
     'default' => NULL,
   );
-  db_add_field($ret, 'project_release_nodes', 'version_api_tid', $spec);
+  db_add_field('project_release_nodes', 'version_api_tid', $spec);
 
-  // Populate the new column from {term_node}.
+  // Populate the new column from {taxonomy_term_node}.
   $api_vid = _project_release_get_api_vid();
-  $ret[] = update_sql("UPDATE {project_release_nodes} SET version_api_tid = (SELECT tn.tid FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid INNER JOIN {term_data} td ON tn.tid = td.tid WHERE n.nid = {project_release_nodes}.nid AND td.vid = $api_vid)");
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $ret[] = array() /* update_sql("UPDATE {project_release_nodes} SET version_api_tid = (SELECT tn.tid FROM {node} n INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {taxonomy_term_data} td ON tn.tid = td.tid WHERE n.nid = {project_release_nodes}.nid AND td.vid = $api_vid)") */;
 
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -596,10 +681,10 @@ function project_release_update_6006() {
     'not null' => TRUE,
     'default' => 0,
   );
-  db_add_field($ret, 'project_release_nodes', 'security_update', $spec);
+  db_add_field('project_release_nodes', 'security_update', $spec);
 
   if (module_exists('taxonomy')) {
-    // Populate the new column from {term_node}.
+    // Populate the new column from {taxonomy_term_node}.
     _project_release_check_security_updates($ret);
   }
 
@@ -610,11 +695,14 @@ function project_release_update_6006() {
     'not null' => TRUE,
     'default' => 0,
   );
-  db_add_field($ret, 'project_release_nodes', 'update_status', $spec);
+  db_add_field('project_release_nodes', 'update_status', $spec);
   // This will be initialized by project_release_check_supported_versions()
   // in project_release_update_6008(), so we don't need to do that here.
 
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -628,12 +716,15 @@ function project_release_update_6007() {
     'not null' => TRUE,
     'default' => 0,
   );
-  db_add_field($ret, 'project_release_nodes', 'version_extra_weight', $spec);
+  db_add_field('project_release_nodes', 'version_extra_weight', $spec);
 
   // Initialize the values in the DB based on the existing weights.
   _project_release_update_version_extra_weights($ret);
 
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -648,14 +739,15 @@ function project_release_update_6008() {
       'default' => NULL,
       'not null' => FALSE,
     );
-    db_add_field($ret, 'project_release_supported_versions', 'latest_security_release', $spec);
+    db_add_field('project_release_supported_versions', 'latest_security_release', $spec);
     $_SESSION['project_release_update_6008'] = 0;
-    $_SESSION['project_release_update_6008_max'] = db_result(db_query("SELECT COUNT(*) FROM {project_release_supported_versions}"));
+    $_SESSION['project_release_update_6008_max'] = db_query("SELECT COUNT(*) FROM {project_release_supported_versions}")->fetchField();
   }
 
   // Number of rows to convert per batch.
   $limit = 20;
-  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT * FROM {project_release_supported_versions} WHERE latest_security_release IS NULL", 0, 1))) {
+  // TODO Please convert this statement to the D7 database API syntax.
+  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT * FROM {project_release_supported_versions} WHERE latest_security_release IS NULL"))) {
     // We have a branch we haven't processed yet (latest_security_release is
     // still NULL), so we invoke project_release_check_supported_versions() to
     // run some queries to determine the recommended, latest, and latest
@@ -667,7 +759,16 @@ function project_release_update_6008() {
     // latest_security_release as 0 (not NULL) so that we don't check this
     // branch again.
     if (!project_release_check_supported_versions($item['nid'], $item['tid'], $item['major'], FALSE)) {
-      db_query("UPDATE {project_release_supported_versions} SET latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", 0, $item['nid'], $item['tid'], $item['major']);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {project_release_supported_versions} SET latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", 0, $item['nid'], $item['tid'], $item['major']) */
+      db_update('project_release_supported_versions')
+  ->fields(array(
+        'latest_security_release' => 0,
+      ))
+  ->condition('nid', $item['nid'])
+  ->condition('tid', $item['tid'])
+  ->condition('major', $item['major'])
+  ->execute();
       // If project_release_check_supported_versions() returned FALSE, there
       // are no releases on this branch, so there's nothing to initialize
       // {project_release_nodes}.update_status for.
@@ -677,7 +778,8 @@ function project_release_update_6008() {
 
   if ($_SESSION['project_release_update_6008'] >= $_SESSION['project_release_update_6008_max']) {
     // We're done.  Set our new columns to default to 0 from here on out.
-    $ret[] = update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN latest_security_release SET DEFAULT 0");
+    // TODO update_sql has been removed. Use the database API for any schema or data changes.
+    $ret[] = array() /* update_sql("ALTER TABLE {project_release_supported_versions} ALTER COLUMN latest_security_release SET DEFAULT 0") */;
     unset($_SESSION['project_release_update_6008']);
     unset($_SESSION['project_release_update_6008_max']);
     $ret['#finished'] = 1;
@@ -685,7 +787,10 @@ function project_release_update_6008() {
   else {
     $ret['#finished'] = $_SESSION['project_release_update_6008'] / $_SESSION['project_release_update_6008_max'];
   }
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -705,25 +810,40 @@ function project_release_update_6009() {
       'description' => 'The first span of digits found in version_extra. This is needed because we cannot natural sort natively without a stored procedure.',
     );
 
-    db_add_field($ret, 'project_release_nodes', 'version_extra_delta', $spec);
+    db_add_field('project_release_nodes', 'version_extra_delta', $spec);
 
     // Initialize version_extra_delta to -1 to identify the rows to process.
-    db_query('UPDATE {project_release_nodes} SET version_extra_delta = -1 WHERE version_extra IS NOT NULL');
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query('UPDATE {project_release_nodes} SET version_extra_delta = -1 WHERE version_extra IS NOT NULL') */
+    db_update('project_release_nodes')
+  ->fields(array(
+      'version_extra_delta' => -1,
+    ))
+  ->condition('version_extra IS NOT NULL', '')
+  ->execute();
 
     $_SESSION['project_release_update_6009'] = 0;
-    $_SESSION['project_release_update_6009_max'] = db_result(db_query("SELECT COUNT(*) FROM {project_release_nodes} WHERE version_extra IS NOT NULL"));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $_SESSION['project_release_update_6009_max'] = db_query("SELECT COUNT(*) FROM {project_release_nodes} WHERE version_extra IS NOT NULL")->fetchField();
   }
 
   // Number of rows to convert per batch.
   $limit = 20;
-  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT nid, pid, version_major, version_api_tid, version_extra FROM {project_release_nodes} WHERE version_extra_delta = -1", 0, 1))) {
+  while ($limit-- && $item = db_fetch_array(db_query_range("SELECT nid, pid, version_major, version_api_tid, version_extra FROM {project_release_nodes} WHERE version_extra_delta = :version_extra_delta", array(':version_extra_delta' => -1)))) {
     // Due to the new sorting method, the "recommended" and "latest" releases
     // will change on any releases affected by http://drupal.org/node/649254.
 
     // Determine the correct version_extra_delta and update it.
     $match = array();
     $nmatch = preg_match('/(\d+)/', $item['version_extra'], $match);
-    db_query('UPDATE {project_release_nodes} SET version_extra_delta = %d WHERE nid = %d', ($nmatch) ? $match[1] : 0, $item['nid']);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query('UPDATE {project_release_nodes} SET version_extra_delta = %d WHERE nid = %d', ($nmatch) ? $match[1] : 0, $item['nid']) */
+    db_update('project_release_nodes')
+  ->fields(array(
+      'version_extra_delta' => ($nmatch) ? $match[1] : 0,
+    ))
+  ->condition('nid', $item['nid'])
+  ->execute();
 
     // Finally, recheck the branch.
     // Note: this is ineffecient: we only really need to call this
@@ -745,7 +865,10 @@ function project_release_update_6009() {
   else {
     $ret['#finished'] = $_SESSION['project_release_update_6009'] / $_SESSION['project_release_update_6009_max'];
   }
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -781,20 +904,25 @@ function project_release_update_6010() {
     ),
     'primary key' => array('nid', 'uid'),
   );
-  db_create_table($ret, 'project_release_project_maintainer', $table);
+  db_create_table('project_release_project_maintainer', $table);
 
   // Initially populate the table so that every project owner has full
   // powers on their own projects.
-  $ret[] = update_sql("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) SELECT nid, uid, 1 FROM {node} WHERE type = 'project_project'");
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $ret[] = array() /* update_sql("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) SELECT nid, uid, 1 FROM {node} WHERE type = 'project_project'") */;
 
   // If CVS module is enabled, also populate the table from the
   // {cvs_project_maintainers} table so that anyone with CVS access
   // who is not the project owner can administer releases.
   if (module_exists('cvs')) {
-    $ret[] = update_sql("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) SELECT cpm.nid, cpm.uid, 1 FROM {cvs_project_maintainers} cpm INNER JOIN {node} n ON cpm.nid = n.nid WHERE cpm.uid != n.uid");
+    // TODO update_sql has been removed. Use the database API for any schema or data changes.
+    $ret[] = array() /* update_sql("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) SELECT cpm.nid, cpm.uid, 1 FROM {cvs_project_maintainers} cpm INNER JOIN {node} n ON cpm.nid = n.nid WHERE cpm.uid != n.uid") */;
   }
 
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -809,8 +937,11 @@ function project_release_update_6011() {
     'size' => 'tiny',
     'description' => 'Weight of this file in relation to other files in this release.',
   );
-  db_add_field($ret, 'project_release_file', 'weight', $spec);
-  return $ret;
+  db_add_field('project_release_file', 'weight', $spec);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -824,6 +955,9 @@ function project_release_update_6012() {
     'not null' => TRUE,
     'default' => 0,
   );
-  db_add_field($ret, 'project_release_file', 'downloads', $spec);
-  return $ret;
+  db_add_field('project_release_file', 'downloads', $spec);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
diff --git a/release/project_release.module b/release/project_release.module
index f94d8af..22a927e 100644
--- a/release/project_release.module
+++ b/release/project_release.module
@@ -15,21 +15,21 @@ define('PROJECT_RELEASE_UPDATE_STATUS_NOT_SECURE', 2);
  */
 
 /**
- * Implementation of hook_init().
+ * Implements hook_init().
  */
 function project_release_init() {
-  drupal_add_css(drupal_get_path('module', 'project_release') .'/project_release.css');
+  drupal_add_css(drupal_get_path('module', 'project_release') . '/project_release.css');
   project_release_get_api_taxonomy();
 
   // These constants are defined here since they use t() and the
   // global $locale variable needs to be initialized before calling
   // t() or you suffer a big performance hit.
   define('PROJECT_RELEASE_VERSION_FORMAT_VALID_MSG', t('The version format string can only contain letters, numbers, and the characters . _ and - (in addition to the special characters used for identifying variables: % ! and #).'));
-  define('PROJECT_RELEASE_VERSION_FORMAT_HELP', t("Available variables are: %api, %major, %minor, %patch, %extra. The percent sign ('%') at the front of the variable name indicates that a period ('.') should be inserted as a delimiter before the value of the variable. The '%' can be replaced with a hash mark ('#') to use a hyphen ('-') delimiter, or with an exclaimation point ('!') to have the value printed without a delimiter. Any variable in the format string that has no value will be removed entirely from the final string.") .' '. PROJECT_RELEASE_VERSION_FORMAT_VALID_MSG);
+  define('PROJECT_RELEASE_VERSION_FORMAT_HELP', t("Available variables are: %api, %major, %minor, %patch, %extra. The percent sign ('%') at the front of the variable name indicates that a period ('.') should be inserted as a delimiter before the value of the variable. The '%' can be replaced with a hash mark ('#') to use a hyphen ('-') delimiter, or with an exclaimation point ('!') to have the value printed without a delimiter. Any variable in the format string that has no value will be removed entirely from the final string.") . ' ' . PROJECT_RELEASE_VERSION_FORMAT_VALID_MSG);
 }
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_menu().
  * @ingroup project_release_core
  */
 function project_release_menu() {
@@ -79,7 +79,7 @@ function project_release_menu() {
 }
 
 /**
- * Implementation of hook_menu_alter().
+ * Implements hook_menu_alter().
  */
 function project_release_menu_alter(&$callbacks) {
   $callbacks['node/add/project-release']['page callback'] = 'drupal_get_form';
@@ -105,13 +105,13 @@ function project_release_project_settings_form_access($node) {
  */
 
 /**
- * Implementation of hook_access().
+ * Implements hook_node_access().
  * @ingroup project_release_node
  *
  * TODO: Maybe we should add new permissions for accessing release
  * nodes, but for now, we're just using the existing project perms.
  */
-function project_release_access($op, $node, $account) {
+function project_release_node_access($node, $op, $account) {
   switch ($op) {
     case 'view':
       // We want to use the identical logic for viewing projects,
@@ -139,21 +139,21 @@ function project_release_access($op, $node, $account) {
 }
 
 /**
- * Implementation of hook_node_info().
+ * Implements hook_node_info().
  * @ingroup project_release_node
  */
 function project_release_node_info() {
   return array(
     'project_release' => array(
       'name' => t('Project release'),
-      'module' => 'project_release',
+      'base' => 'project_release',
       'description' => t('A release of a project with a specific version number.'),
-     ),
+    ),
   );
 }
 
 /**
- * Implement hook_project_permission_info()
+ * Implements hook_project_permission_info().
  *
  * This advertises an 'Administer releases' permission if the site is
  * configured to allow sandboxes to have releases, if the project is not a
@@ -171,28 +171,48 @@ function project_release_project_permission_info($project = NULL) {
 }
 
 /**
- * Implement hook_project_maintainer_save()
+ * Implements hook_project_maintainer_save().
  */
 function project_release_project_maintainer_save($nid, $uid, $permissions = array()) {
-  db_query("UPDATE {project_release_project_maintainer} SET administer_releases = %d WHERE nid = %d AND uid = %d", !empty($permissions['administer releases']), $nid, $uid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {project_release_project_maintainer} SET administer_releases = %d WHERE nid = %d AND uid = %d", ! empty($permissions['administer releases']), $nid, $uid) */
+  db_update('project_release_project_maintainer')
+  ->fields(array(
+    'administer_releases' => ! empty($permissions['administer releases']),
+  ))
+  ->condition('nid', $nid)
+  ->condition('uid', $uid)
+  ->execute();
   if (!db_affected_rows()) {
     // If we didn't have a record to update, add this as a new maintainer.
-    db_query("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) VALUES (%d, %d, %d)", $nid, $uid, !empty($permissions['administer releases']));
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("INSERT INTO {project_release_project_maintainer} (nid, uid, administer_releases) VALUES (%d, %d, %d)", $nid, $uid, ! empty($permissions['administer releases'])) */
+    $id = db_insert('project_release_project_maintainer')
+  ->fields(array(
+      'nid' => $nid,
+      'uid' => $uid,
+      'administer_releases' => ! empty($permissions['administer releases']),
+    ))
+  ->execute();
   }
 }
 
 /**
- * Implement hook_project_maintainer_remove()
+ * Implements hook_project_maintainer_remove().
  */
 function project_release_project_maintainer_remove($nid, $uid) {
-  db_query("DELETE FROM {project_release_project_maintainer} WHERE nid = %d and uid = %d", $nid, $uid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {project_release_project_maintainer} WHERE nid = %d and uid = %d", $nid, $uid) */
+  db_delete('project_release_project_maintainer')
+  ->condition('nid', $nid)
+  ->execute();
 }
 
 /**
- * Implement hook_project_maintainer_project_load()
+ * Implements hook_project_maintainer_project_load().
  */
 function project_release_project_maintainer_project_load($nid, &$maintainers) {
-  $query = db_query('SELECT u.uid, u.name, prpm.administer_releases FROM {project_release_project_maintainer} prpm INNER JOIN {users} u ON prpm.uid = u.uid WHERE prpm.nid = %d', $nid);
+  $query = db_query('SELECT u.uid, u.name, prpm.administer_releases FROM {project_release_project_maintainer} prpm INNER JOIN {users} u ON prpm.uid = u.uid WHERE prpm.nid = :prpm.nid', array(':prpm.nid' => $nid));
   while ($maintainer = db_fetch_object($query)) {
     if (empty($maintainers[$maintainer->uid])) {
       $maintainers[$maintainer->uid]['name'] = $maintainer->name;
@@ -202,7 +222,7 @@ function project_release_project_maintainer_project_load($nid, &$maintainers) {
 }
 
 /**
- * Implement of hook_form() for project_release nodes.
+ * Implements hook_form() for project_release nodes().
  */
 function project_release_form(&$release, &$form_state) {
   module_load_include('inc', 'project_release', 'includes/release_node_form');
@@ -221,26 +241,30 @@ function project_release_node_form_validate(&$form, &$form_state) {
 
 
 /**
- * Implementation of hook_load().
+ * Implements hook_load().
  * @ingroup project_release_node
  */
-function project_release_load($node) {
-  $additions = db_fetch_array(db_query("SELECT * FROM {project_release_nodes} WHERE nid = %d", $node->nid));
-  // Add in file info.
-  $file_info = db_query("SELECT f.*, prf.filehash, prf.weight FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE prf.nid = %d", $node->nid);
-  $files = array();
-  while ($file = db_fetch_object($file_info)) {
-    $files[$file->fid] = $file;
-  }
-  $additions['files'] = $files;
+function project_release_load($nodes) {
+  foreach ($nodes as $nid => &$node) {
+    $additions = db_fetch_array(db_query("SELECT * FROM {project_release_nodes} WHERE nid = :nid", array(':nid' => $node->nid)));
+    // Add in file info.
+    $file_info = db_query("SELECT f.*, prf.filehash, prf.weight FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE prf.nid = :prf.nid", array(':prf.nid' => $node->nid));
+    $files = array();
+    while ($file = db_fetch_object($file_info)) {
+      $files[$file->fid] = $file;
+    }
+    $additions['files'] = $files;
 
-  $release = new stdClass;
-  $release->project_release = $additions;
-  return $release;
+    $release = new stdClass;
+    $release->project_release = $additions;
+    foreach ($release as $property => &$value) {
+      $node->$property = $value;
+    }
+  }
 }
 
 /**
- * Implementation of hook_insert().
+ * Implements hook_insert().
  *
  * @param $node
  *   Object containing form values from the project_release node form.  Even
@@ -256,7 +280,7 @@ function project_release_insert($node) {
 }
 
 /**
- * Implementation of hook_update().
+ * Implements hook_update().
  *
  * @param $node
  *   Object containing form values from the project_release node form.  Even
@@ -310,17 +334,42 @@ function project_release_check_supported_versions($pid, $tid, $major, $delete) {
     if (!empty($latest_release)) {
       // Since the node we just deleted might have been the latest or
       // recommended on the branch, update our record with the real values.
-      db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d, latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", $recommended_release, $latest_release, $latest_security_release, $pid, $tid, $major);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d, latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", $recommended_release, $latest_release, $latest_security_release, $pid, $tid, $major) */
+      db_update('project_release_supported_versions')
+  ->fields(array(
+        'recommended_release' => $recommended_release,
+        'latest_release' => $latest_release,
+        'latest_security_release' => $latest_security_release,
+      ))
+  ->condition('nid', $pid)
+  ->condition('tid', $tid)
+  ->condition('major', $major)
+  ->execute();
       $did_update = TRUE;
     }
     else {
       // No latest release -- remove the bogus record for this branch.
-      db_query("DELETE FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d AND major = %d", $pid, $tid, $major);
-
-      $num_recommended = db_result(db_query("SELECT COUNT(*) FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d AND supported = %d AND recommended = %d", $pid, $tid, 1, 1));
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("DELETE FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d AND major = %d", $pid, $tid, $major) */
+      db_delete('project_release_supported_versions')
+  ->condition('nid', $pid)
+  ->condition('tid', $tid)
+  ->condition('major', $major)
+  ->execute();
+
+      $num_recommended = db_query("SELECT COUNT(*) FROM {project_release_supported_versions} WHERE nid = :nid AND tid = :tid AND supported = :supported AND recommended = :recommended", array(':nid' => $pid, ':tid' => $tid, ':supported' => 1, ':recommended' => 1))->fetchField();
       if ($num_recommended > 1) {
         // Something seriously bogus, clear out the values and start over.
-        db_query("UPDATE {project_release_supported_versions} SET recommended = %d WHERE nid = %d AND tid = %d", 0, $pid, $tid);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("UPDATE {project_release_supported_versions} SET recommended = %d WHERE nid = %d AND tid = %d", 0, $pid, $tid) */
+        db_update('project_release_supported_versions')
+  ->fields(array(
+          'recommended' => 0,
+        ))
+  ->condition('nid', $pid)
+  ->condition('tid', $tid)
+  ->execute();
         $num_recommended = 0;
       }
     }
@@ -330,7 +379,7 @@ function project_release_check_supported_versions($pid, $tid, $major, $delete) {
     if (!empty($latest_release)) {
       // We have at least 1 published release, so make sure we have an entry
       // for this major version in {project_release_supported_versions}.
-      $current_branches = db_query("SELECT major FROM {project_release_supported_versions} WHERE nid = %d AND tid = %d", $pid, $tid);
+      $current_branches = db_query("SELECT major FROM {project_release_supported_versions} WHERE nid = :nid AND tid = :tid", array(':nid' => $pid, ':tid' => $tid));
       $have_current_branch = FALSE;
       $num_branches = 0;
       while (($branch = db_fetch_object($current_branches)) !== FALSE) {
@@ -343,13 +392,38 @@ function project_release_check_supported_versions($pid, $tid, $major, $delete) {
       if ($num_branches == 0 || !$have_current_branch) {
         // First entry for this API tid/major version pair, so add a new
         // record to the table as supported but not recommended.
-        db_query("INSERT INTO {project_release_supported_versions} (nid, tid, major, supported, recommended, snapshot, recommended_release, latest_release, latest_security_release) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d)", $pid, $tid, $major, 1, 0, 0, $recommended_release, $latest_release, $latest_security_release);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("INSERT INTO {project_release_supported_versions} (nid, tid, major, supported, recommended, snapshot, recommended_release, latest_release, latest_security_release) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d)", $pid, $tid, $major, 1, 0, 0, $recommended_release, $latest_release, $latest_security_release) */
+        $id = db_insert('project_release_supported_versions')
+  ->fields(array(
+          'nid' => $pid,
+          'tid' => $tid,
+          'major' => $major,
+          'supported' => 1,
+          'recommended' => 0,
+          'snapshot' => 0,
+          'recommended_release' => $recommended_release,
+          'latest_release' => $latest_release,
+          'latest_security_release' => $latest_security_release,
+        ))
+  ->execute();
       }
       else {
         // We already have this branch in the table, but the latest_release
         // and recommended_release fields might be stale based on whatever
         // node was just added or edited.
-        db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d, latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", $recommended_release, $latest_release, $latest_security_release, $pid, $tid, $major);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query("UPDATE {project_release_supported_versions} SET recommended_release = %d, latest_release = %d, latest_security_release = %d WHERE nid = %d AND tid = %d AND major = %d", $recommended_release, $latest_release, $latest_security_release, $pid, $tid, $major) */
+        db_update('project_release_supported_versions')
+  ->fields(array(
+          'recommended_release' => $recommended_release,
+          'latest_release' => $latest_release,
+          'latest_security_release' => $latest_security_release,
+        ))
+  ->condition('nid', $pid)
+  ->condition('tid', $tid)
+  ->condition('major', $major)
+  ->execute();
       }
       $did_update = TRUE;
     }
@@ -365,7 +439,7 @@ function project_release_check_supported_versions($pid, $tid, $major, $delete) {
 
   // Either way, clear the cache for the release table, since what we want to
   // display might have changed, too.
-  $cid = 'table:'. $pid .':';
+  $cid = 'table:' . $pid . ':';
   cache_clear_all($cid, 'cache_project_release', TRUE);
 
   return $did_update;
@@ -478,6 +552,7 @@ function project_release_compute_update_status($pid, $api_tid, $major) {
     foreach ($nid_update_map as $update_status => $nids) {
       if (!empty($nids)) {
         $placeholders = db_placeholders($nids);
+        // TODO Please convert this statement to the D7 database API syntax.
         db_query("UPDATE {project_release_nodes} SET update_status = %d WHERE nid IN ($placeholders)", array_merge(array($update_status), $nids));
         if ($update_status == PROJECT_RELEASE_UPDATE_STATUS_NOT_SECURE && module_exists('project_package')) {
           project_package_check_update_status($nids);
@@ -488,7 +563,7 @@ function project_release_compute_update_status($pid, $api_tid, $major) {
 }
 
 /**
- * Implementation of hook_delete().
+ * Implements hook_delete().
  * @ingroup project_release_node
  */
 function project_release_delete($node) {
@@ -497,8 +572,16 @@ function project_release_delete($node) {
       project_release_file_delete($file);
     }
   }
-  db_query("DELETE FROM {project_release_package_errors} WHERE nid = %d", $node->nid);
-  db_query("DELETE FROM {project_release_nodes} WHERE nid = %d", $node->nid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {project_release_package_errors} WHERE nid = %d", $node->nid) */
+  db_delete('project_release_package_errors')
+  ->condition('nid', $node->nid)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {project_release_nodes} WHERE nid = %d", $node->nid) */
+  db_delete('project_release_nodes')
+  ->condition('nid', $node->nid)
+  ->execute();
 }
 
 /**
@@ -508,8 +591,16 @@ function project_release_delete($node) {
  *   The file object to delete.
  */
 function project_release_file_delete($file) {
-  db_query("DELETE FROM {files} WHERE fid = %d", $file->fid);
-  db_query("DELETE FROM {project_release_file} WHERE fid = %d", $file->fid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {files} WHERE fid = %d", $file->fid) */
+  db_delete('files')
+  ->condition('fid', $file->fid)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {project_release_file} WHERE fid = %d", $file->fid) */
+  db_delete('project_release_file')
+  ->condition('fid', $file->fid)
+  ->execute();
   file_delete(file_create_path($file->filepath));
 }
 
@@ -527,7 +618,7 @@ function project_release_get_version_format($project) {
     return $project->project_release['version_format'];
   }
 
-  $db_format = db_result(db_query("SELECT version_format FROM {project_release_projects} WHERE nid = %d", $project->nid));
+  $db_format = db_query("SELECT version_format FROM {project_release_projects} WHERE nid = :nid", array(':nid' => $project->nid))->fetchField();
   if (!empty($db_format)) {
     return $db_format;
   }
@@ -575,8 +666,8 @@ function project_release_get_version($version, $project = NULL) {
     $var = "version_$field";
     if (isset($version->$var) && $version->$var !== '') {
       $variables["!$field"] = $version->$var;
-      $variables["%$field"] = '.'. $version->$var;
-      $variables["#$field"] = '-'. $version->$var;
+      $variables["%$field"] = '.' . $version->$var;
+      $variables["#$field"] = '-' . $version->$var;
     }
     else {
       $variables["!$field"] = '';
@@ -586,10 +677,10 @@ function project_release_get_version($version, $project = NULL) {
   }
   $vid = _project_release_get_api_vid();
   if (project_release_get_api_taxonomy() && isset($version->version_api_tid)) {
-    $term = taxonomy_get_term($version->version_api_tid);
+    $term = taxonomy_term_load($version->version_api_tid);
     $variables["!api"] = $term->name;
-    $variables["%api"] = '.'. $term->name;
-    $variables["#api"] = '-'. $term->name;
+    $variables["%api"] = '.' . $term->name;
+    $variables["#api"] = '-' . $term->name;
   }
   else {
     $variables["!api"] = '';
@@ -601,7 +692,7 @@ function project_release_get_version($version, $project = NULL) {
 }
 
 /**
- * Implementation of hook_view().
+ * Implements hook_view().
  * @ingroup project_release_node
  */
 function project_release_view($node, $teaser = FALSE, $page = FALSE) {
@@ -610,8 +701,8 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
 
   if ($page) {
     // Breadcrumb navigation
-    $breadcrumb[] = l($project->title, 'node/'. $project->nid);
-    $breadcrumb[] = l(t('Releases'), 'node/'. $project->nid .'/release');
+    $breadcrumb[] = l($project->title, 'node/' . $project->nid);
+    $breadcrumb[] = l(t('Releases'), 'node/' . $project->nid . '/release');
     project_project_set_breadcrumb($project, $breadcrumb);
   }
 
@@ -625,7 +716,7 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
       $max_file_timestamp = max($max_file_timestamp, $file->timestamp);
     }
     $node->content['release_file_info'] = array(
-      '#value' => '<div class="project-release-files">'. $output .'</div>',
+      '#value' => '<div class="project-release-files">' . $output . '</div>',
       '#weight' => -4,
     );
   }
@@ -633,10 +724,10 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
   $output = '';
   if (project_use_cvs($project) && isset($node->project_release['tag'])) {
     if (!empty($node->project_release['rebuild'])) {
-      $output .= t('Nightly development snapshot from CVS branch: @tag', array('@tag' => $node->project_release['tag'])) .'<br />';
+      $output .= t('Nightly development snapshot from CVS branch: @tag', array('@tag' => $node->project_release['tag'])) . '<br />';
     }
     else {
-      $output .= t('Official release from CVS tag: @tag', array('@tag' => $node->project_release['tag'])) .'<br />';
+      $output .= t('Official release from CVS tag: @tag', array('@tag' => $node->project_release['tag'])) . '<br />';
     }
   }
 
@@ -645,10 +736,10 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
   }
 
   if (module_exists('project_usage') && user_access('view project usage')) {
-    $output .= '<div class="usage-statistics-link">'. l(t('View usage statistics for this release'), 'project/usage/'. $node->nid) .'</div>';
+    $output .= '<div class="usage-statistics-link">' . l(t('View usage statistics for this release'), 'project/usage/' . $node->nid) . '</div>';
   }
   $node->content['release_info'] = array(
-    '#value' => '<div class="project-release-info">'. $output .'</div>',
+    '#value' => '<div class="project-release-info">' . $output . '</div>',
     '#weight' => -3,
   );
 
@@ -662,7 +753,7 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
     }
     if (!empty($output)) {
       $node->content['release_package_items'] = array(
-        '#value' => '<div class="project-release-package-items">'. $output .'</div>',
+        '#value' => '<div class="project-release-package-items">' . $output . '</div>',
         '#weight' => -2,
       );
     }
@@ -671,13 +762,13 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
   // Display packaging errors to admins.
   if (project_user_access($node->project_release['pid'], 'administer releases')) {
     $rows = array();
-    $result = db_query('SELECT * FROM {project_release_package_errors} WHERE nid = %d', $node->nid);
+    $result = db_query('SELECT * FROM {project_release_package_errors} WHERE nid = :nid', array(':nid' => $node->nid));
     $error = db_fetch_object($result);
     if (!empty($error)) {
       $rows = unserialize($error->messages);
       if (!empty($rows)) {
         $node->content['release_errors'] = array(
-          '#value' => theme('item_list', $rows, t('Packaging error messages')),
+          '#value' => theme('item_list', array('items' => $rows, 'title' => t('Packaging error messages'))),
           '#weight' => -1,
           '#prefix' => '<div class="messages error">',
           '#suffix' => '</div>',
@@ -689,21 +780,31 @@ function project_release_view($node, $teaser = FALSE, $page = FALSE) {
   return $node;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function project_release_load_file($fid) {
-  return db_fetch_object(db_query("SELECT f.*, prf.filehash, prf.weight FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE f.fid = %d", $fid));
+  return db_fetch_object(db_query("SELECT f.*, prf.filehash, prf.weight FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE f.fid = :f.fid", array(':f.fid' => $fid)));
 }
 
-function theme_project_release_download_file($file, $download_link = TRUE) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_project_release_download_file($variables) {
+  $file = $variables['file'];
+  $download_link = $variables['download_link'];
   $output = '';
   if ($download_link) {
-    $output .= '<small>'. t('Download: !file', array('!file' => theme('project_release_download_link', $file->filepath))) .'</small><br />';
+    $output .= '<small>' . t('Download: !file', array('!file' => theme('project_release_download_link', array('filepath' => $file->filepath)))) . '</small><br />';
   }
   else {
-    $output .= '<small>'. t('File: @filepath', array('@filepath' => $file->filepath)) .'</small><br />';
+    $output .= '<small>' . t('File: @filepath', array('@filepath' => $file->filepath)) . '</small><br />';
   }
-  $output .= '<small>'. t('Size: !size', array('!size' => format_size($file->filesize))) .'</small><br />';
-  $output .= '<small>'. t('md5_file hash: !filehash', array('!filehash' => $file->filehash)) .'</small><br />';
-  $output .= '<small>'. t('Last updated: !changed', array('!changed' => format_date($file->timestamp))) .'</small><br />';
+  $output .= '<small>' . t('Size: !size', array('!size' => format_size($file->filesize))) . '</small><br />';
+  $output .= '<small>' . t('md5_file hash: !filehash', array('!filehash' => $file->filehash)) . '</small><br />';
+  $output .= '<small>' . t('Last updated: !changed', array('!changed' => format_date($file->timestamp))) . '</small><br />';
   return $output;
 }
 
@@ -713,7 +814,7 @@ function theme_project_release_download_file($file, $download_link = TRUE) {
  the views module. however, it might be nice if we could replace this function
  with views as well just to use views's query builder.  Maybe that's a bad
  idea in terms of performance, however.
-*/
+ */
 /**
  * Get an array of release nodes
  * @ingroup project_release_api
@@ -735,7 +836,7 @@ function theme_project_release_download_file($file, $download_link = TRUE) {
  *   This is useful when this function is called by the project_issue
  *   module to allow a user to keep the version of an issue unchanged
  *   even if the release represented by the version is now unpublished.
-  * @return
+ * @return
  *   An array of releases.  The keys are the release node nids.  The values
  *   will either be release objects or release version strings, depending
  *   on the value of the $nodes parameter.
@@ -752,7 +853,7 @@ function project_release_get_releases($project, $nodes = TRUE, $sort_by = 'versi
   $args = array($project->nid);
   if (!project_user_access($project, 'administer releases')) {
     if (!empty($rids)) {
-      $where = "AND (n.status = %d OR n.nid IN (". db_placeholders($rids) ."))";
+      $where = "AND (n.status = %d OR n.nid IN (" . db_placeholders($rids) . "))";
       $args[] = 1;
       foreach ($rids as $rid) {
         $args[] = $rid;
@@ -767,6 +868,7 @@ function project_release_get_releases($project, $nodes = TRUE, $sort_by = 'versi
     }
   }
 
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query(db_rewrite_sql("SELECT n.nid, r.* FROM {node} n INNER JOIN {project_release_nodes} r $join ON r.nid = n.nid WHERE (r.pid = %d) $where ORDER BY $order_by DESC"), $args);
   $releases = array();
   while ($obj = db_fetch_object($result)) {
@@ -808,7 +910,7 @@ function project_release_compatibility_list() {
  */
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_form_alter().
  * @ingroup project_release_fapi
  */
 function project_release_form_alter(&$form, &$form_state, $form_id) {
@@ -971,7 +1073,14 @@ function project_release_alter_project_promote_confirm_form(&$form, &$form_state
  * Submit handler for project promote confirm form.
  */
 function project_release_project_promote_confirm_form_submit($form, &$form_state) {
-  db_query("UPDATE {project_release_projects} SET releases = %d WHERE nid = %d", $form_state['values']['releases'], $form_state['values']['nid']);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {project_release_projects} SET releases = %d WHERE nid = %d", $form_state['values']['releases'], $form_state['values']['nid']) */
+  db_update('project_release_projects')
+  ->fields(array(
+    'releases' => $form_state['values']['releases'],
+  ))
+  ->condition('nid', $form_state['values']['nid'])
+  ->execute();
   unset($_SESSION['project_promote_project_releases']);
 }
 
@@ -985,7 +1094,8 @@ function project_release_project_promote_confirm_form_submit($form, &$form_state
  * @ingroup project_release_nodeapi
  * @see project_release_project_nodeapi().
  */
-function project_release_nodeapi(&$node, $op, $arg) {
+function project_release_nodeapi_OLD(&$node, $op, $arg) {
+  // TODO Remaining code in this function needs to be moved to the appropriate new hook function.
   switch ($node->type) {
     case 'project_project':
       project_release_project_nodeapi($node, $op, $arg);
@@ -1021,13 +1131,13 @@ function project_release_project_nodeapi(&$node, $op, $arg) {
  * Loads project_release fields into the project node object.
  */
 function project_release_project_nodeapi_load(&$node) {
-  $project = db_fetch_object(db_query('SELECT * FROM {project_release_projects} WHERE nid = %d', $node->nid));
+  $project = db_fetch_object(db_query('SELECT * FROM {project_release_projects} WHERE nid = :nid', array(':nid' => $node->nid)));
   if (!empty($project)) {
     $fields = array('releases', 'version_format');
     foreach ($fields as $field) {
       $node->project_release[$field] = $project->$field;
     }
-    $wants_snapshots = db_result(db_query('SELECT tid FROM {project_release_supported_versions} WHERE nid = %d AND snapshot = %d LIMIT %d', $node->nid, 1, 1));
+    $wants_snapshots = db_query('SELECT tid FROM {project_release_supported_versions} WHERE nid = :nid AND snapshot = :snapshot LIMIT %d', array(':nid' => $node->nid, ':snapshot' => 1, '' => 1))->fetchField();
     if (isset($wants_snapshots)) {
       $node->project_release['project_release_show_snapshots'] = TRUE;
     }
@@ -1039,7 +1149,15 @@ function project_release_project_nodeapi_load(&$node) {
  */
 function project_release_project_nodeapi_insert(&$node) {
   $releases = (!variable_get('project_release_sandbox_allow_release', TRUE) && $node->project['sandbox']) ? 0 : 1;
-  db_query("INSERT INTO {project_release_projects} (nid, releases, version_format) VALUES (%d, %d, '%s')", $node->nid, $releases, '');
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("INSERT INTO {project_release_projects} (nid, releases, version_format) VALUES (%d, %d, '%s')", $node->nid, $releases, '') */
+  $id = db_insert('project_release_projects')
+  ->fields(array(
+    'nid' => $node->nid,
+    'releases' => $releases,
+    'version_format' => '',
+  ))
+  ->execute();
 }
 
 /**
@@ -1048,7 +1166,11 @@ function project_release_project_nodeapi_insert(&$node) {
 function project_release_project_nodeapi_delete(&$node) {
   // TODO: unpublish (delete?) all release nodes associated with
   // this project, too.
-  db_query('DELETE FROM {project_release_projects} WHERE nid = %d', $node->nid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {project_release_projects} WHERE nid = %d', $node->nid) */
+  db_delete('project_release_projects')
+  ->condition('nid', $node->nid)
+  ->execute();
 
 }
 
@@ -1097,7 +1219,7 @@ function project_release_release_nodeapi(&$node, $op, $arg) {
       if (!empty($node->project_release['files'])) {
         // RSS will only take the first file.
         $file = reset($node->project_release['files']);
-        $file_link = theme('project_release_download_link', $file->filepath, NULL, TRUE);
+        $file_link = theme('project_release_download_link', array('filepath' => $file->filepath, 'link_text' => NULL, 'as_array' => TRUE));
         return array(
           array(
             'key' => 'enclosure',
@@ -1105,8 +1227,8 @@ function project_release_release_nodeapi(&$node, $op, $arg) {
               'url' => $file_link['href'],
               'length' => $file->filesize,
               'type' => 'application/octet-stream',
-            )
-          )
+            ),
+          ),
         );
       }
       break;
@@ -1155,9 +1277,10 @@ function project_release_get_current_recommended($project_nid, $api_tid, $recomm
   }
   // Build the actual JOIN ON string by AND'ing all the clauses together.
   $prsv_join = implode(' AND ', $prsv_joins);
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query(db_rewrite_sql(
-    "SELECT n.nid, n.title, n.created, r.* FROM {node} n ".
-    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid ".
+    "SELECT n.nid, n.title, n.created, r.* FROM {node} n " .
+    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid " .
     "INNER JOIN {project_release_supported_versions} prsv ON $prsv_join "),
     $join_params);
   return db_fetch_object($result);
@@ -1282,10 +1405,10 @@ function project_release_query_releases_by_branch($project_nid, $api_tid, $major
   // etc), at least you'll get deterministic results.
   $order_bys[] = 'r.version_extra DESC';
 
-  $order_by = 'ORDER BY '. implode(', ', $order_bys);
+  $order_by = 'ORDER BY ' . implode(', ', $order_bys);
 
-  $sql = "SELECT n.nid, n.title, n.created, r.* FROM {node} n ".
-    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid ".
+  $sql = "SELECT n.nid, n.title, n.created, r.* FROM {node} n " .
+    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid " .
     "$where $order_by";
 
   // Only enforce node access via db_rewrite_sql() if the caller specifically
@@ -1294,17 +1417,19 @@ function project_release_query_releases_by_branch($project_nid, $api_tid, $major
     $sql = db_rewrite_sql($sql);
   }
 
+  // TODO Please convert this statement to the D7 database API syntax.
   return db_query($sql, $params);
 }
 
 /**
  * Theme the appropriate release download table for a project node.
  */
-function theme_project_release_project_download_table($node) {
+function theme_project_release_project_download_table($variables) {
+  $node = $variables['node'];
   if (empty($node->project_release['releases'])) {
     return;
   }
-  $output = '<h3 id="downloads">'. t('Downloads') .'</h3>';
+  $output = '<h3 id="downloads">' . t('Downloads') . '</h3>';
   $view_args = array($node->nid);
   $displays = array(
     'attachment_1' => array(
@@ -1357,6 +1482,7 @@ function project_release_project_page_link_alter(&$links, $node) {
   if (empty($node->project_release['releases'])) {
     return;
   }
+  // TODO Please change this theme call to use an associative array for the $variables parameter.
   $links['project_release'] = array(
     // NOTE:  The 'name' element of this array is not defined here because
     // it's actually printed as part of the output of the
@@ -1364,13 +1490,13 @@ function project_release_project_page_link_alter(&$links, $node) {
     'weight' => 2,
     'clear' => TRUE,
     'links' => array(
-      'view_all_releases' => l(t('View all releases'), 'node/'. $node->nid .'/release') . theme('project_feed_icon', url('node/'. $node->nid .'/release/feed'), t('RSS feed of all releases'))
+      'view_all_releases' => l(t('View all releases'), 'node/' . $node->nid . '/release') . theme('project_feed_icon', url('node/' . $node->nid . '/release/feed'), t('RSS feed of all releases')),
     ),
   );
 
   if (project_user_access($node->nid, 'administer releases')) {
-    $links['project_release']['links']['add_new_release'] = l(t('Add new release'), 'node/add/project_release/'. $node->nid);
-    $links['project_release']['links']['administer_releases'] = l(t('Administer releases'), 'node/'. $node->nid .'/edit/releases');
+    $links['project_release']['links']['add_new_release'] = l(t('Add new release'), 'node/add/project_release/' . $node->nid);
+    $links['project_release']['links']['administer_releases'] = l(t('Administer releases'), 'node/' . $node->nid . '/edit/releases');
   }
 }
 
@@ -1386,7 +1512,12 @@ function project_release_project_page_link_alter(&$links, $node) {
  * @see project_page_overview()
  * @see project_release_table()
  */
-function theme_project_release_table_overview($project, $table_type, $release_type, $title, $print_size) {
+function theme_project_release_table_overview($variables) {
+  $project = $variables['project'];
+  $table_type = $variables['table_type'];
+  $release_type = $variables['release_type'];
+  $title = $variables['title'];
+  $print_size = $variables['print_size'];
   return project_release_table($project, $table_type, $release_type, $title, $print_size);
 }
 
@@ -1426,7 +1557,7 @@ function project_release_table($project, $table_type = 'recommended', $release_t
   $can_edit = $check_edit ? node_access('update', $project) : FALSE;
 
   // Generate the cache ID.
-  $cid = 'table:'. $project->nid .':'. $table_type .':'. $release_type .':'. $title .':'. (int)$print_size .':'. (int)$can_edit;
+  $cid = 'table:' . $project->nid . ':' . $table_type . ':' . $release_type . ':' . $title . ':' . (int) $print_size . ':' . (int) $can_edit;
   if ($cached = cache_get($cid, 'cache_project_release')) {
     return $cached->data;
   }
@@ -1436,9 +1567,9 @@ function project_release_table($project, $table_type = 'recommended', $release_t
   $args = array();
   $tids = project_release_compatibility_list();
   if (!empty($tids)) {
-    $join = ' INNER JOIN {term_node} tn ON n.nid = tn.nid AND tn.tid in ('
-      . db_placeholders($tids) .') '
-      .' INNER JOIN {term_data} td ON td.tid = tn.tid ';
+    $join = ' INNER JOIN {taxonomy_term_node} tn ON n.nid = tn.nid AND tn.tid in ('
+      . db_placeholders($tids) . ') '
+      . ' INNER JOIN {taxonomy_term_data} td ON td.tid = tn.tid ';
     $args = array_keys($tids);
     $selects[] = 'tn.tid';
     $selects[] = 'td.name as api_term_name';
@@ -1463,8 +1594,8 @@ function project_release_table($project, $table_type = 'recommended', $release_t
   else {
     // TODO: someday (never?) when project_release doesn't require taxonomy.
   }
-  $args[] = $project->nid;  // Account for r.pid.
-  $args[] = 1;  // Account for n.status = 1.
+  $args[] = $project->nid; // Account for r.pid.
+  $args[] = 1; // Account for n.status = 1.
 
   switch ($release_type) {
     case 'official':
@@ -1498,22 +1629,23 @@ function project_release_table($project, $table_type = 'recommended', $release_t
   $orderby[] = 'r.version_patch DESC';
   $orderby[] = 'f.timestamp DESC';
 
-  $order_by = !empty($orderby) ? (' ORDER BY '. implode(', ', $orderby)) : '';
-  $select = !empty($selects) ? (implode(', ', $selects) .',') : '';
+  $order_by = !empty($orderby) ? (' ORDER BY ' . implode(', ', $orderby)) : '';
+  $select = !empty($selects) ? (implode(', ', $selects) . ',') : '';
 
   // TODO: we MUST rewrite this query when multiple files attachments
   // per release node lands, as it will return a non-unique result set.
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query(db_rewrite_sql(
-    "SELECT n.nid, n.created, f.filename, f.filepath, f.timestamp, ".
-    "f.filesize, $select r.* FROM {node} n ".
-    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid ".
-    "INNER JOIN {project_release_file} prf ON n.nid = prf.nid ".
-    "INNER JOIN {files} f ON prf.fid = f.fid$join ".
+    "SELECT n.nid, n.created, f.filename, f.filepath, f.timestamp, " .
+    "f.filesize, $select r.* FROM {node} n " .
+    "INNER JOIN {project_release_nodes} r ON r.nid = n.nid " .
+    "INNER JOIN {project_release_file} prf ON n.nid = prf.nid " .
+    "INNER JOIN {files} f ON prf.fid = f.fid$join " .
     "WHERE (r.pid = %d) AND (n.status = %d) $where $order_by"),
     $args);
 
-  $rows = array();  // Rows for the download table.
-  $seen = array();  // Keeps track of which versions we already saw.
+  $rows = array(); // Rows for the download table.
+  $seen = array(); // Keeps track of which versions we already saw.
   while ($release = db_fetch_object($result)) {
     $tid = $release->tid;
     $major = $release->version_major;
@@ -1549,7 +1681,7 @@ function project_release_table($project, $table_type = 'recommended', $release_t
       }
     }
     // If we're still here, we need to add the row to the table.
-    $rows[] = theme('project_release_download_table_row', $release, $recommended, $can_edit, $print_size);
+    $rows[] = theme('project_release_download_table_row', array('release' => $release, 'recommended' => $recommended, 'can_edit' => $can_edit, 'print_size' => $print_size));
   }
 
   $header = array(
@@ -1580,10 +1712,10 @@ function project_release_table($project, $table_type = 'recommended', $release_t
 
   $output = '';
   if (!empty($rows)) {
-    $output = theme('table', $header, $rows, array('class' => 'releases'));
+    $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => 'releases')));
   }
   // Default cache time is 12 hours - will be cleared by the packaging script
-  cache_set($cid, $output, 'cache_project_release', time() + 43200);
+  cache_set($cid, $output, 'cache_project_release', REQUEST_TIME + 43200);
   return $output;
 }
 
@@ -1601,7 +1733,11 @@ function project_release_table($project, $table_type = 'recommended', $release_t
  * @param $print_size
  *   Boolean indicating if the size of the download should be printed.
  */
-function theme_project_release_download_table_row($release, $recommended = false, $can_edit = false, $print_size = true) {
+function theme_project_release_download_table_row($variables) {
+  $release = $variables['release'];
+  $recommended = $variables['recommended'];
+  $can_edit = $variables['can_edit'];
+  $print_size = $variables['print_size'];
   static $icons = array();
   if (empty($icons)) {
     $icons = array(
@@ -1612,7 +1748,7 @@ function theme_project_release_download_table_row($release, $recommended = false
   }
   $links = array();
   if (!empty($release->filepath)) {
-    $links['project_release_download'] = theme('project_release_download_link', $release->filepath, t('Download'), TRUE);
+    $links['project_release_download'] = theme('project_release_download_link', array('filepath' => $release->filepath, 'link_text' => t('Download'), 'as_array' => TRUE));
   }
   $links['project_release_notes'] = array(
     'title' => t('Release notes'),
@@ -1628,30 +1764,30 @@ function theme_project_release_download_table_row($release, $recommended = false
   $row_class = $release->rebuild ? 'release-dev' : 'release';
   // Now, set the row color and help text, based on the release attributes.
   if (!$release->supported) {
-    $text = theme('project_release_download_text_unsupported', $release, 'summary');
-    $message = theme('project_release_download_text_unsupported', $release, 'message');
+    $text = theme('project_release_download_text_unsupported', array('release' => $release, 'text_type' => 'summary'));
+    $message = theme('project_release_download_text_unsupported', array('release' => $release, 'text_type' => 'message'));
     $classification = 'error';
   }
   elseif ($release->rebuild) {
-    $reason = theme('project_release_download_text_snapshot', $release, 'summary');
-    $message = theme('project_release_download_text_snapshot', $release, 'message');
+    $reason = theme('project_release_download_text_snapshot', array('release' => $release, 'text_type' => 'summary'));
+    $message = theme('project_release_download_text_snapshot', array('release' => $release, 'text_type' => 'message'));
     $classification = 'error';
   }
   elseif ($recommended) {
-    $reason = theme('project_release_download_text_recommended', $release, 'summary');
-    $message = theme('project_release_download_text_recommended', $release, 'message');
+    $reason = theme('project_release_download_text_recommended', array('release' => $release, 'text_type' => 'summary'));
+    $message = theme('project_release_download_text_recommended', array('release' => $release, 'text_type' => 'message'));
     $classification = 'ok';
   }
   else {
     // Supported, but not recommened, official release.
-    $reason = theme('project_release_download_text_supported', $release, 'summary');
-    $message = theme('project_release_download_text_supported', $release, 'message');
+    $reason = theme('project_release_download_text_supported', array('release' => $release, 'text_type' => 'summary'));
+    $message = theme('project_release_download_text_supported', array('release' => $release, 'text_type' => 'message'));
     $classification = 'warning';
   }
 
   $row = array(
     // class of <tr>
-    'class' => $row_class .' '. $classification,
+    'class' => $row_class . ' ' . $classification,
     'data' => array(
       array(
         'class' => 'release-title',
@@ -1667,11 +1803,11 @@ function theme_project_release_download_table_row($release, $recommended = false
     $row['data'][] = array(
       'class' => 'release-size',
       'data' => !empty($release->filepath) ? format_size($release->filesize) : t('n/a'),
-      );
+    );
   }
   $row['data'][] = array(
     'class' => 'release-links',
-    'data' => theme('links', $links),
+    'data' => theme('links', array('links' => $links)),
   );
   $row['data'][] = array(
     'class' => 'release-reason',
@@ -1679,7 +1815,7 @@ function theme_project_release_download_table_row($release, $recommended = false
   );
   $row['data'][] = array(
     'class' => 'release-icon',
-    'data' => theme('image', $icons[$classification], $message, $message),
+    'data' => theme('image', array('path' => $icons[$classification], 'width' => $message, 'height' => $message)),
   );
   return $row;
 }
@@ -1696,7 +1832,9 @@ function theme_project_release_download_table_row($release, $recommended = false
  *   text to include directly on the project node, or 'message' for the text
  *   to put in the title and alt attributes of the icon.
  */
-function theme_project_release_download_text_recommended($release, $text_type) {
+function theme_project_release_download_text_recommended($variables) {
+  $release = $variables['release'];
+  $text_type = $variables['text_type'];
   if ($text_type == 'summary') {
     return t('Recommended for %api_term_name', array('%api_term_name' => $release->api_term_name));
   }
@@ -1708,7 +1846,9 @@ function theme_project_release_download_text_recommended($release, $text_type) {
  *
  * @see theme_project_release_download_text_recommended
  */
-function theme_project_release_download_text_supported($release, $text_type) {
+function theme_project_release_download_text_supported($variables) {
+  $release = $variables['release'];
+  $text_type = $variables['text_type'];
   if ($text_type == 'summary') {
     return t('Supported for %api_term_name', array('%api_term_name' => $release->api_term_name));
   }
@@ -1720,7 +1860,9 @@ function theme_project_release_download_text_supported($release, $text_type) {
  *
  * @see theme_project_release_download_text_recommended
  */
-function theme_project_release_download_text_snapshot($release, $text_type) {
+function theme_project_release_download_text_snapshot($variables) {
+  $release = $variables['release'];
+  $text_type = $variables['text_type'];
   if ($text_type == 'summary') {
     return t('Development snapshot');
   }
@@ -1732,7 +1874,9 @@ function theme_project_release_download_text_snapshot($release, $text_type) {
  *
  * @see theme_project_release_download_text_recommended
  */
-function theme_project_release_download_text_unsupported($release, $text_type) {
+function theme_project_release_download_text_unsupported($variables) {
+  $release = $variables['release'];
+  $text_type = $variables['text_type'];
   if ($text_type == 'summary') {
     return t('Unsupported');
   }
@@ -1740,10 +1884,10 @@ function theme_project_release_download_text_unsupported($release, $text_type) {
 }
 
 /**
- * Implementation of hook_taxonomy().
+ * Implements hook_taxonomy().
  */
 function project_release_taxonomy($op, $type, $array = NULL) {
-  if ($op == 'delete' && $type == 'vocabulary') {
+  if ($op == 'delete' && $type == 'taxonomy_vocabulary') {
     if ($array['vid'] == _project_release_get_api_vid()) {
       variable_del('project_release_api_vocabulary');
     }
@@ -1856,7 +2000,8 @@ function project_release_exists($version) {
   }
   // we put pid as the first WHERE, so stick it on the front
   $values = array_merge(array('pid' => $version->pid), $values);
-  return db_result(db_query($sql, $values));
+  // TODO Please convert this statement to the D7 database API syntax.
+  return db_query($sql, $values)->fetchField();
 }
 
 /**
@@ -1874,7 +2019,10 @@ function project_release_exists($version) {
  * @return
  *   The link itself, as a structured array.
  */
-function theme_project_release_download_link($filepath, $link_text = NULL, $as_array = FALSE) {
+function theme_project_release_download_link($variables) {
+  $filepath = $variables['filepath'];
+  $link_text = $variables['link_text'];
+  $as_array = $variables['as_array'];
   if (empty($link_text)) {
     $link_text = basename($filepath);
   }
@@ -1897,7 +2045,7 @@ function theme_project_release_download_link($filepath, $link_text = NULL, $as_a
 }
 
 /**
- * Implementation of hook_file_download().
+ * Implements hook_file_download().
  *
  * @param $filename
  *   The name of the file to download.
@@ -1906,14 +2054,14 @@ function theme_project_release_download_link($filepath, $link_text = NULL, $as_a
  */
 function project_release_file_download($filename) {
   $filepath = file_create_path($filename);
-  $result = db_query("SELECT prf.nid FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE f.filepath = '%s'", $filepath);
-  if ($nid = db_result($result)) {
+  $result = db_query("SELECT prf.nid FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE f.filepath = :f.filepath", array(':f.filepath' => $filepath));
+  if ($nid = $result->fetchField()) {
     $node = node_load($nid);
     if (node_access('view', $node)) {
       return array(
         'Content-Type: application/octet-stream',
-        'Content-Length: '. filesize($filepath),
-        'Content-Disposition: attachment; filename="'. mime_header_encode($filename) .'"',
+        'Content-Length: ' . filesize($filepath),
+        'Content-Disposition: attachment; filename="' . mime_header_encode($filename) . '"',
       );
     }
     return -1;
@@ -1921,7 +2069,7 @@ function project_release_file_download($filename) {
 }
 
 /**
- * Implementation of hook_flush_caches().
+ * Implements hook_flush_caches().
  */
 function project_release_flush_caches() {
   return array('cache_project_release');
@@ -1931,7 +2079,7 @@ function project_release_flush_caches() {
  * Menu callback to select a project when creating a new release.
  */
 function project_release_pick_project_page($type_name) {
-  drupal_set_title(t('Submit @name', array('@name' => $type_name)));
+  drupal_set_title(t('Submit @name', array('@name' => $type_name)), PASS_THROUGH);
   $project = arg(3);
   if (!empty($project)) {
     // If there's any argument at all and we hit this form, it's from a
@@ -1945,25 +2093,25 @@ function project_release_pick_project_page($type_name) {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function project_release_theme() {
   return array(
     'project_release_download_file' => array(
-      'arguments' => array(
+      'variables' => array(
         'file' => NULL,
         'download_link' => TRUE,
       ),
     ),
     'project_release_download_link' => array(
-      'arguments' => array(
+      'variables' => array(
         'filepath' => NULL,
         'link_text' => NULL,
         'as_array' => FALSE,
       ),
     ),
     'project_release_download_table_row' => array(
-      'arguments' => array(
+      'variables' => array(
         'release' => NULL,
         'recommended' => FALSE,
         'can_edit' => FALSE,
@@ -1971,48 +2119,44 @@ function project_release_theme() {
       ),
     ),
     'project_release_download_text_recommended' => array(
-      'arguments' => array(
+      'variables' => array(
         'release' => NULL,
         'text_type' => NULL,
       ),
     ),
     'project_release_download_text_snapshot' => array(
-      'arguments' => array(
+      'variables' => array(
         'release' => NULL,
         'text_type' => NULL,
       ),
     ),
     'project_release_download_text_supported' => array(
-      'arguments' => array(
+      'variables' => array(
         'release' => NULL,
         'text_type' => NULL,
       ),
     ),
     'project_release_download_text_unsupported' => array(
-      'arguments' => array(
+      'variables' => array(
         'release' => NULL,
         'text_type' => NULL,
       ),
     ),
     'project_release_form_value' => array(
       'file' => 'includes/release_node_form.inc',
-      'arguments' => array(
-        'element' => NULL,
-      ),
+      'render element' => 'element',
     ),
     'project_release_project_download_table' => array(
-      'arguments' => array(
+      'variables' => array(
         'node' => NULL,
       ),
     ),
     'project_release_project_edit_form' => array(
       'file' => 'includes/release_node_form.inc',
-      'arguments' => array(
-        'form' => NULL,
-      ),
+      'render element' => 'form',
     ),
     'project_release_table_overview' => array(
-      'arguments' => array(
+      'variables' => array(
         'project' => NULL,
         'table_type' => NULL,
         'release_type' => NULL,
@@ -2021,27 +2165,30 @@ function project_release_theme() {
       ),
     ),
     'project_release_node_form_version_elements' => array(
-      'arguments' => array(
-        'form' => NULL,
-      ),
+      'render element' => 'form',
     ),
     'project_release_update_status_icon' => array(
-      'arguments' => array(
+      'variables' => array(
         'status' => NULL,
       ),
     ),
   );
 }
 
-function theme_project_release_node_form_version_elements($form) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_project_release_node_form_version_elements($variables) {
+  $form = $variables['form'];
   $output = '<div class="version-elements">';
-  $output .= drupal_render($form);
+  $output .= drupal_render_children($form);
   $output .= '</div>';
   return $output;
 }
 
 /**
- * Implement hook_token_list() (from token.module)
+ * Implements hook_token_list() (from token.module)().
  */
 function project_release_token_list($type) {
   if ($type == 'node') {
@@ -2066,7 +2213,7 @@ function project_release_token_list($type) {
 }
 
 /**
- * Implement hook_token_values() (from token.module).
+ * Implements hook_token_values() (from token.module)().
  */
 function project_release_token_values($type = 'all', $object = NULL) {
   if ($type == 'node') {
@@ -2097,7 +2244,7 @@ function project_release_token_values($type = 'all', $object = NULL) {
       $values['project_release_version_patch'] = check_plain($object->project_release['version_patch']);
       $values['project_release_version_extra'] = check_plain($object->project_release['version_extra']);
       if (!empty($object->project_release['version_api_tid'])) {
-        $term = taxonomy_get_term($object->project_release['version_api_tid']);
+        $term = taxonomy_term_load($object->project_release['version_api_tid']);
         $values['project_release_version_api_tid'] = check_plain($term->tid);
         $values['project_release_version_api_term'] = check_plain($term->name);
       }
@@ -2114,7 +2261,7 @@ function project_release_use_taxonomy() {
 }
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function project_release_help($section) {
   switch ($section) {
@@ -2148,22 +2295,22 @@ function _project_release_taxonomy_help($vid = 0, $vocab_link = TRUE) {
     return;
   }
   $vocabulary = taxonomy_vocabulary_load($vid);
-  $text = '<p>'. t('The Project release module makes special use of the taxonomy (category) system. A special vocabulary, %vocabulary_name, has been created automatically.', array('%vocabulary_name' => $vocabulary->name)) .'</p>';
-  $text .= '<p>'. t('To categorize project releases by their compatibility with a version of some outside software (eg. a library or API of some sort), add at least one term to this vocabulary. For example, you might add the following terms: "5.x", "6.x", "7.x".') .'</p>';
-  $text .='<p>'. t('For more information, please see !url.', array('!url' => l('http://drupal.org/node/116544', 'http://drupal.org/node/116544'))) .'</p>';
+  $text = '<p>' . t('The Project release module makes special use of the taxonomy (category) system. A special vocabulary, %vocabulary_name, has been created automatically.', array('%vocabulary_name' => $vocabulary->name)) . '</p>';
+  $text .= '<p>' . t('To categorize project releases by their compatibility with a version of some outside software (eg. a library or API of some sort), add at least one term to this vocabulary. For example, you might add the following terms: "5.x", "6.x", "7.x".') . '</p>';
+  $text .= '<p>' . t('For more information, please see !url.', array('!url' => l('http://drupal.org/node/116544', 'http://drupal.org/node/116544'))) . '</p>';
   if ($vocab_link) {
-    $text .= '<p>'. t('Use the <a href="@taxonomy-admin">vocabulary admininistration page</a> to view and add terms.', array('@taxonomy-admin' => url('admin/content/taxonomy/'. $vid))) .'</p>';
+    $text .= '<p>' . t('Use the <a href="@taxonomy-admin">vocabulary admininistration page</a> to view and add terms.', array('@taxonomy-admin' => url('admin/structure/taxonomy/' . $vid))) . '</p>';
   }
   return $text;
 }
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function project_release_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'project_release') .'/views',
+    'path' => drupal_get_path('module', 'project_release') . '/views',
   );
 }
 
@@ -2229,20 +2376,21 @@ function project_release_update_status($status = NULL) {
  * @return
  *   Icon to use for the given update status code.
  */
-function theme_project_release_update_status_icon($status) {
+function theme_project_release_update_status_icon($variables) {
+  $status = $variables['status'];
   $label = project_release_update_status($status);
   $icon = '';
   switch ($status) {
     case PROJECT_RELEASE_UPDATE_STATUS_CURRENT:
-      $icon = theme('image', 'misc/watchdog-ok.png', $label, $label);
+      $icon = theme('image', array('path' => 'misc/watchdog-ok.png', 'width' => $label, 'height' => $label));
       break;
 
     case PROJECT_RELEASE_UPDATE_STATUS_NOT_CURRENT:
-      $icon = theme('image', 'misc/watchdog-warning.png', $label, $label);
+      $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'width' => $label, 'height' => $label));
       break;
 
     case PROJECT_RELEASE_UPDATE_STATUS_NOT_SECURE:
-      $icon = theme('image', 'misc/watchdog-error.png', $label, $label);
+      $icon = theme('image', array('path' => 'misc/watchdog-error.png', 'width' => $label, 'height' => $label));
       break;
   }
 
@@ -2250,7 +2398,7 @@ function theme_project_release_update_status_icon($status) {
 }
 
 /**
- * Implement hook_preprocess_views_view_table().
+ * Implements hook_preprocess_views_view_table().
  *
  * Handles the logic for conditionally adding row classes based on release
  * update_status, and has a hack for hiding the update_status column entirely
@@ -2278,16 +2426,16 @@ function project_release_preprocess_views_view_table($variables) {
 }
 
 /**
- * Implement hook_views_default_views_alter().
+ * Implements hook_views_default_views_alter().
  */
 function project_release_views_default_views_alter(&$views) {
   $path = drupal_get_path('module', 'project_release');
-  require_once("$path/views/project_release.views_default.inc");
+  require_once DRUPAL_ROOT . '/' . "$path/views/project_release.views_default.inc";
   _project_release_views_default_views_alter($views);
 }
 
 /**
- * Implementation of hook_ctools_plugin_directory().
+ * Implements hook_ctools_plugin_directory().
  */
 function project_release_ctools_plugin_directory($module, $plugin) {
   if ($module == 'sampler') {
diff --git a/release/views/default_views/project_release_by_project.view.php b/release/views/default_views/project_release_by_project.view.php
index 9a5b021..22f7663 100644
--- a/release/views/default_views/project_release_by_project.view.php
+++ b/release/views/default_views/project_release_by_project.view.php
@@ -130,7 +130,7 @@ $handler->override_option('filters', array(
     'type' => 'select',
     'reduce_duplicates' => TRUE,
     'id' => 'project_release_api_version',
-    'table' => 'term_node',
+    'table' => 'taxonomy_term_node',
     'field' => 'project_release_api_version',
     'hierarchy' => 0,
     'relationship' => 'none',
diff --git a/release/views/default_views/project_release_download_table.view.php b/release/views/default_views/project_release_download_table.view.php
index 99b71b4..48ad95e 100644
--- a/release/views/default_views/project_release_download_table.view.php
+++ b/release/views/default_views/project_release_download_table.view.php
@@ -192,7 +192,7 @@ $handler->override_option('sorts', array(
   'weight' => array(
     'order' => 'ASC',
     'id' => 'weight',
-    'table' => 'term_data',
+    'table' => 'taxonomy_term_data',
     'field' => 'weight',
     'relationship' => 'version_api_tid',
   ),
diff --git a/release/views/default_views/project_release_new_releases.view.php b/release/views/default_views/project_release_new_releases.view.php
index 8a9897a..d31e4da 100644
--- a/release/views/default_views/project_release_new_releases.view.php
+++ b/release/views/default_views/project_release_new_releases.view.php
@@ -1,150 +1,150 @@
 <?php
 
 if (module_exists('sampler')) {
-$view = new view;
-$view->name = 'project_release_new_releases';
-$view->description = 'Sparkline showing count of new releases over time for a given project';
-$view->tag = 'Metrics';
-$view->view_php = '';
-$view->base_table = 'sampler_project_release_new_releases';
-$view->is_cacheable = FALSE;
-$view->api_version = 2;
-$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-$handler = $view->new_display('default', 'Defaults', 'default');
-$handler->override_option('fields', array(
-  'timestamp' => array(
-    'label' => 'Timestamp',
-    'alter' => array(
-      'alter_text' => 0,
-      'text' => '',
-      'make_link' => 0,
-      'path' => '',
-      'link_class' => '',
-      'alt' => '',
-      'prefix' => '',
-      'suffix' => '',
-      'target' => '',
-      'help' => '',
-      'trim' => 0,
-      'max_length' => '',
-      'word_boundary' => 1,
-      'ellipsis' => 1,
-      'html' => 0,
-      'strip_tags' => 0,
+  $view = new view;
+  $view->name = 'project_release_new_releases';
+  $view->description = 'Sparkline showing count of new releases over time for a given project';
+  $view->tag = 'Metrics';
+  $view->view_php = '';
+  $view->base_table = 'sampler_project_release_new_releases';
+  $view->is_cacheable = FALSE;
+  $view->api_version = 2;
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'timestamp' => array(
+      'label' => 'Timestamp',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'date_format' => 'small',
+      'custom_date_format' => '',
+      'exclude' => 0,
+      'id' => 'timestamp',
+      'table' => 'sampler_project_release_new_releases',
+      'field' => 'timestamp',
+      'relationship' => 'none',
     ),
-    'empty' => '',
-    'hide_empty' => 0,
-    'empty_zero' => 0,
-    'date_format' => 'small',
-    'custom_date_format' => '',
-    'exclude' => 0,
-    'id' => 'timestamp',
-    'table' => 'sampler_project_release_new_releases',
-    'field' => 'timestamp',
-    'relationship' => 'none',
-  ),
-  'value_0' => array(
-    'label' => 'New release count',
-    'alter' => array(
-      'alter_text' => 0,
-      'text' => '',
-      'make_link' => 0,
-      'path' => '',
-      'link_class' => '',
-      'alt' => '',
+    'value_0' => array(
+      'label' => 'New release count',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'set_precision' => FALSE,
+      'precision' => 0,
+      'decimal' => '.',
+      'separator' => ',',
       'prefix' => '',
       'suffix' => '',
-      'target' => '',
-      'help' => '',
-      'trim' => 0,
-      'max_length' => '',
-      'word_boundary' => 1,
-      'ellipsis' => 1,
-      'html' => 0,
-      'strip_tags' => 0,
+      'exclude' => 0,
+      'id' => 'value_0',
+      'table' => 'sampler_project_release_new_releases',
+      'field' => 'value_0',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'timestamp' => array(
+      'order' => 'ASC',
+      'granularity' => 'second',
+      'id' => 'timestamp',
+      'table' => 'sampler_project_release_new_releases',
+      'field' => 'timestamp',
+      'relationship' => 'none',
     ),
-    'empty' => '',
-    'hide_empty' => 0,
-    'empty_zero' => 0,
-    'set_precision' => FALSE,
-    'precision' => 0,
-    'decimal' => '.',
-    'separator' => ',',
-    'prefix' => '',
-    'suffix' => '',
-    'exclude' => 0,
-    'id' => 'value_0',
-    'table' => 'sampler_project_release_new_releases',
-    'field' => 'value_0',
-    'relationship' => 'none',
-  ),
-));
-$handler->override_option('sorts', array(
-  'timestamp' => array(
-    'order' => 'ASC',
-    'granularity' => 'second',
-    'id' => 'timestamp',
-    'table' => 'sampler_project_release_new_releases',
-    'field' => 'timestamp',
-    'relationship' => 'none',
-  ),
-));
-$handler->override_option('arguments', array(
-  'object_id' => array(
-    'default_action' => 'not found',
-    'style_plugin' => 'default_summary',
-    'style_options' => array(),
-    'wildcard' => 'all',
-    'wildcard_substitution' => 'All',
-    'title' => 'New releases for %1',
-    'breadcrumb' => '',
-    'default_argument_type' => 'node',
-    'default_argument' => '',
-    'validate_type' => 'project_nid',
-    'validate_fail' => 'not found',
-    'break_phrase' => 0,
-    'not' => 0,
-    'id' => 'object_id',
-    'table' => 'sampler_project_release_new_releases',
-    'field' => 'object_id',
-    'relationship' => 'none',
-  ),
-));
-$handler->override_option('filters', array(
-  'timestamp' => array(
-    'operator' => 'between',
-    'value' => array(
-      'type' => 'offset',
-      'value' => '',
-      'min' => '-1 year',
-      'max' => 'today',
+  ));
+  $handler->override_option('arguments', array(
+    'object_id' => array(
+      'default_action' => 'not found',
+      'style_plugin' => 'default_summary',
+      'style_options' => array(),
+      'wildcard' => 'all',
+      'wildcard_substitution' => 'All',
+      'title' => 'New releases for %1',
+      'breadcrumb' => '',
+      'default_argument_type' => 'node',
+      'default_argument' => '',
+      'validate_type' => 'project_nid',
+      'validate_fail' => 'not found',
+      'break_phrase' => 0,
+      'not' => 0,
+      'id' => 'object_id',
+      'table' => 'sampler_project_release_new_releases',
+      'field' => 'object_id',
+      'relationship' => 'none',
     ),
-    'group' => '0',
-    'exposed' => FALSE,
-    'expose' => array(
-      'operator' => FALSE,
-      'label' => '',
+  ));
+  $handler->override_option('filters', array(
+    'timestamp' => array(
+      'operator' => 'between',
+      'value' => array(
+        'type' => 'offset',
+        'value' => '',
+        'min' => '-1 year',
+        'max' => 'today',
+      ),
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'timestamp',
+      'table' => 'sampler_project_release_new_releases',
+      'field' => 'timestamp',
+      'relationship' => 'none',
     ),
-    'id' => 'timestamp',
-    'table' => 'sampler_project_release_new_releases',
-    'field' => 'timestamp',
-    'relationship' => 'none',
-  ),
-));
-$handler->override_option('access', array(
-  'type' => 'none',
-));
-$handler->override_option('cache', array(
-  'type' => 'none',
-));
-$handler->override_option('items_per_page', 0);
-$handler->override_option('style_plugin', 'views_sparkline');
-$handler->override_option('style_options', array(
-  'grouping' => '',
-  'x_field' => 'timestamp',
-  'y_field' => 'value_0',
-  'width' => '300px',
-  'height' => '30px',
-  'color' => '#336699',
-));
+  ));
+  $handler->override_option('access', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('items_per_page', 0);
+  $handler->override_option('style_plugin', 'views_sparkline');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'x_field' => 'timestamp',
+    'y_field' => 'value_0',
+    'width' => '300px',
+    'height' => '30px',
+    'color' => '#336699',
+  ));
 } // module_exists('sampler')
diff --git a/release/views/handlers/project_release_handler_field_download_table.inc b/release/views/handlers/project_release_handler_field_download_table.inc
index 9342a86..3b21b5c 100644
--- a/release/views/handlers/project_release_handler_field_download_table.inc
+++ b/release/views/handlers/project_release_handler_field_download_table.inc
@@ -13,7 +13,10 @@ class project_release_handler_field_download_table extends views_handler_field {
 
     $this->additional_fields = array();
     $this->additional_fields['nid'] = 'nid';
-    $this->additional_fields['format'] = array('table' => 'node_revisions', 'field' => 'format');
+    $this->additional_fields['format'] = array(
+      'table' => 'node_revisions',
+      'field' => 'format',
+    );
     $this->additional_fields['uid'] = 'uid';
     $this->additional_fields['type'] = 'type';
   }
@@ -38,7 +41,7 @@ class project_release_handler_field_download_table extends views_handler_field {
    * @return
    *   An array of possible types.
    */
-  function get_type_options($type){
+  function get_type_options($type) {
     $types = array(
       'release' => array(
         'default' => 'official',
@@ -114,27 +117,27 @@ class project_release_handler_field_download_table extends views_handler_field {
       '#type' => 'radios',
       '#prefix' => '<div class="clear-block">',
       '#suffix' => '</div>',
-      '#title'=> t('Table type'),
+      '#title' => t('Table type'),
       '#options' => $this->radios_get_options($this->get_type_options('table')),
-      '#default_value'=> $this->options['table_type'],
+      '#default_value' => $this->options['table_type'],
     );
     $release_types = $this->get_type_options('release');
     $form['release_type'] = array(
       '#type' => 'radios',
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
-      '#title'=> t('Release type'),
+      '#title' => t('Release type'),
       '#options' => $this->radios_get_options($release_types),
       '#default_value' => $this->options['release_type'],
     );
-    $form['first_column_title']= array(
+    $form['first_column_title'] = array(
       '#type' => 'textfield',
       '#prefix' => '<div class="views-left-50">',
       '#suffix' => '</div>',
       '#title' => t('Title of first column of table'),
       '#max_length' => 20,
       '#default_value' => empty($this->options['first_column_title']) ? $release_types['options'][$this->options['release_type']]['default_title'] : $this->options['first_column_title'],
-   );
+    );
   }
 
   /**
diff --git a/release/views/handlers/project_release_handler_field_files.inc b/release/views/handlers/project_release_handler_field_files.inc
index 309d3ee..ddf83e7 100644
--- a/release/views/handlers/project_release_handler_field_files.inc
+++ b/release/views/handlers/project_release_handler_field_files.inc
@@ -89,16 +89,17 @@ class project_release_handler_field_files extends views_handler_field_prerender_
       $wheres[] = 'prf.nid IN (' . implode(', ', $nids) . ')';
       if (is_numeric($this->options['max_weight'])) {
         // We just checked it's numeric, but to be extra safe, cast to an int.
-        $wheres[] = 'prf.weight <= ' . (int)$this->options['max_weight'];
+        $wheres[] = 'prf.weight <= ' . (int) $this->options['max_weight'];
       }
       $where = implode(' AND ', $wheres);
+      // TODO Please convert this statement to the D7 database API syntax.
       $result = db_query("SELECT prf.nid, prf.fid, prf.filehash, prf.weight, f.uid, f.filename, f.filepath, f.filesize, f.filemime, f.timestamp FROM {project_release_file} prf LEFT JOIN {files} f ON prf.fid = f.fid WHERE $where ORDER BY $order_by");
       while ($file = db_fetch_array($result)) {
         $file['filename'] = check_plain($file['filename']);
         $file['filemime'] = check_plain($file['filemime']);
         $file['filesize'] = format_size($file['filesize']);
         $file['timestamp'] = format_date($file['timestamp']);
-        $file_link = theme('project_release_download_link', $file['filepath'], NULL, TRUE);
+        $file_link = theme('project_release_download_link', array('filepath' => $file['filepath'], 'link_text' => NULL, 'as_array' => TRUE));
         $file['filepath'] = $file_link['href'];
         if (!empty($this->options['link_to_file']) ) {
           $file['make_link'] = TRUE;
diff --git a/release/views/handlers/project_release_handler_field_release_file_name.inc b/release/views/handlers/project_release_handler_field_release_file_name.inc
index 918fc2e..e8e8165 100644
--- a/release/views/handlers/project_release_handler_field_release_file_name.inc
+++ b/release/views/handlers/project_release_handler_field_release_file_name.inc
@@ -10,9 +10,15 @@ class project_release_handler_field_release_file_name extends views_handler_fiel
    */
   function init(&$view, &$options) {
     parent::init($view, $options);
-    $this->additional_fields['filename'] = array('table' => 'files', 'field' => 'filename');
+    $this->additional_fields['filename'] = array(
+      'table' => 'files',
+      'field' => 'filename',
+    );
     if (!empty($options['link_to_file'])) {
-      $this->additional_fields['filepath'] = array('table' => 'files', 'field' => 'filepath');
+      $this->additional_fields['filepath'] = array(
+        'table' => 'files',
+        'field' => 'filepath',
+      );
     }
   }
 
@@ -27,7 +33,7 @@ class project_release_handler_field_release_file_name extends views_handler_fiel
     if (!empty($this->options['link_to_file']) && $data !== NULL && $data !== '') {
       $this->options['alter']['make_link'] = TRUE;
       $filepath = $values->{$this->aliases['filepath']};
-      $link = theme('project_release_download_link', $filepath, NULL, TRUE);
+      $link = theme('project_release_download_link', array('filepath' => $filepath, 'link_text' => NULL, 'as_array' => TRUE));
       $this->options['alter']['path'] = $link['href'];
     }
     return check_plain($values->{$this->aliases['filename']});
diff --git a/release/views/handlers/project_release_handler_field_release_file_timestamp.inc b/release/views/handlers/project_release_handler_field_release_file_timestamp.inc
index 6639edb..d6853fe 100644
--- a/release/views/handlers/project_release_handler_field_release_file_timestamp.inc
+++ b/release/views/handlers/project_release_handler_field_release_file_timestamp.inc
@@ -34,6 +34,7 @@ class project_release_handler_field_release_file_timestamp extends views_handler
       $function = $this->options['file_order'];
       $placeholders = db_placeholders($nids);
       $sql = "SELECT $function(f.timestamp) as timestamp, prf.nid FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid WHERE prf.nid IN ($placeholders) GROUP BY prf.nid";
+      // TODO Please convert this statement to the D7 database API syntax.
       $query = db_query($sql, $nids);
       while ($file = db_fetch_object($query)) {
         $this->items[$file->nid] = $file->timestamp;
diff --git a/release/views/handlers/project_release_handler_field_release_update_status.inc b/release/views/handlers/project_release_handler_field_release_update_status.inc
index 6e0d958..2c18619 100644
--- a/release/views/handlers/project_release_handler_field_release_update_status.inc
+++ b/release/views/handlers/project_release_handler_field_release_update_status.inc
@@ -67,13 +67,14 @@ class project_release_handler_field_release_update_status extends views_handler_
         $recommended_nids[] = $nid;
       }
       if (!empty($this->options["show_icon_$status"])) {
-        $this->items[$nid]['icon'] = theme('project_release_update_status_icon', $status);
+        $this->items[$nid]['icon'] = theme('project_release_update_status_icon', array('status' => $status));
       }
     }
 
     // See if we need to query for any recommended releases, too.
     if (!empty($recommended_nids)) {
       $placeholders = db_placeholders($recommended_nids);
+      // TODO Please convert this statement to the D7 database API syntax.
       $query = db_query("SELECT prn.nid, r_prn.nid as recommended_nid, r_prn.version as recommended_version FROM {project_release_nodes} prn INNER JOIN {project_release_supported_versions} prsv ON prsv.nid = prn.pid AND prsv.tid = prn.version_api_tid AND prsv.major = prn.version_major INNER JOIN {project_release_nodes} r_prn ON prsv.recommended_release = r_prn.nid WHERE prn.nid IN ($placeholders)", $recommended_nids);
       while ($release = db_fetch_object($query)) {
         $recommended_link = l($release->recommended_version, 'node/' . $release->recommended_nid);
@@ -109,24 +110,24 @@ class project_release_handler_field_release_update_status extends views_handler_
     return $output;
   }
 
-/*
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-text' . ']'] = t('The text to use for this status.');
-    $tokens['[' . $this->options['id'] . '-icon' . ']'] = t('The icon to display for this status.');
-    $tokens['[' . $this->options['id'] . '-recommended-version' . ']'] = t('The recommended release based on this status');
-    $tokens['[' . $this->options['id'] . '-recommended-text' . ']'] = t('The test to display the recommended release based on this status');
-  }
+  /*
+   function document_self_tokens(&$tokens) {
+   $tokens['[' . $this->options['id'] . '-text' . ']'] = t('The text to use for this status.');
+   $tokens['[' . $this->options['id'] . '-icon' . ']'] = t('The icon to display for this status.');
+   $tokens['[' . $this->options['id'] . '-recommended-version' . ']'] = t('The recommended release based on this status');
+   $tokens['[' . $this->options['id'] . '-recommended-text' . ']'] = t('The test to display the recommended release based on this status');
+   }
 
-  function add_self_tokens(&$tokens, $item) {
-    // TODO: This doesn't work, yet.
-    $tokens['[' . $this->options['id'] . '-text' . ']'] = $item['text'];
-    $tokens['[' . $this->options['id'] . '-icon' . ']'] = $item['icon'];
+   function add_self_tokens(&$tokens, $item) {
+   // TODO: This doesn't work, yet.
+   $tokens['[' . $this->options['id'] . '-text' . ']'] = $item['text'];
+   $tokens['[' . $this->options['id'] . '-icon' . ']'] = $item['icon'];
 
-    $tokens['[' . $this->options['id'] . '-recommended-version' . ']'] = $item['recommended'];
-    // TODO: could make this another configuration knob.
-    $tokens['[' . $this->options['id'] . '-recommended-text' . ']'] = t('Recommended: !recommended', array('!recommended' => $item['recommended']));
-  }
-*/
+   $tokens['[' . $this->options['id'] . '-recommended-version' . ']'] = $item['recommended'];
+   // TODO: could make this another configuration knob.
+   $tokens['[' . $this->options['id'] . '-recommended-text' . ']'] = t('Recommended: !recommended', array('!recommended' => $item['recommended']));
+   }
+   */
 
 }
 
diff --git a/release/views/handlers/project_release_handler_filter_version_api_tid.inc b/release/views/handlers/project_release_handler_filter_version_api_tid.inc
index 9707f61..86dbd0e 100644
--- a/release/views/handlers/project_release_handler_filter_version_api_tid.inc
+++ b/release/views/handlers/project_release_handler_filter_version_api_tid.inc
@@ -4,7 +4,9 @@
  * Filter release nodes based on their API compatibility term.
  */
 class project_release_handler_filter_version_api_tid extends views_handler_filter_in_operator {
-  function has_extra_options() { return TRUE; }
+  function has_extra_options() {
+    return TRUE;
+  }
 
   function option_definition() {
     $options = parent::option_definition();
diff --git a/release/views/handlers/project_release_handler_sort_most_recent_release.inc b/release/views/handlers/project_release_handler_sort_most_recent_release.inc
index 14eb436..1b0e130 100644
--- a/release/views/handlers/project_release_handler_sort_most_recent_release.inc
+++ b/release/views/handlers/project_release_handler_sort_most_recent_release.inc
@@ -11,7 +11,7 @@ class project_release_handler_sort_most_recent_release extends views_handler_sor
   function query() {
     $this->ensure_my_table();
     $table_alias = !empty($this->relationship) ? $this->relationship : $this->table_alias;
-    $field =  $table_alias. '.' . $this->real_field;
+    $field =  $table_alias . '.' . $this->real_field;
     $max_field_alias = !empty($this->relationship) ? $this->relationship . '_max' : $this->table_alias . '_' . $this->real_field . '_max';
     switch ($this->options['granularity']) {
       case 'second':
diff --git a/release/views/plugins/project_release_table_plugin_style.inc b/release/views/plugins/project_release_table_plugin_style.inc
index 7452053..c230ff8 100644
--- a/release/views/plugins/project_release_table_plugin_style.inc
+++ b/release/views/plugins/project_release_table_plugin_style.inc
@@ -10,6 +10,5 @@
  *
  */
 
-class project_release_table_plugin_style extends views_plugin_style_table {
-}
+class project_release_table_plugin_style extends views_plugin_style_table { }
 
diff --git a/release/views/project_release.views.inc b/release/views/project_release.views.inc
index 128ad7f..94475ef 100644
--- a/release/views/project_release.views.inc
+++ b/release/views/project_release.views.inc
@@ -83,7 +83,7 @@ function project_release_views_data() {
     'field' => array(
       'handler' => 'views_handler_field_node',
       'click sortable' => TRUE,
-     ),
+    ),
     'sort' => array(
       'handler' => 'views_handler_sort',
     ),
@@ -102,7 +102,7 @@ function project_release_views_data() {
     'field' => array(
       'handler' => 'views_handler_field_node',
       'click sortable' => TRUE,
-     ),
+    ),
     'sort' => array(
       'handler' => 'views_handler_sort',
     ),
@@ -143,7 +143,7 @@ function project_release_views_data() {
     'field' => array(
       'handler' => 'project_release_handler_field_release_file_timestamp',
       'click sortable' => FALSE,
-     ),
+    ),
   );
 
   // rebuild
@@ -303,7 +303,7 @@ function project_release_views_data() {
         'handler' => 'views_handler_argument_numeric',
       ),
       'relationship' => array(
-        'base' => 'term_data',
+        'base' => 'taxonomy_term_data',
         'field' => 'tid',
         // Again, dynamic labels here make exported views yucky.
         'label' => t('API compatibility term'),
@@ -338,7 +338,7 @@ function project_release_views_data() {
     'field' => array(
       'handler' => 'project_release_handler_field_release_update_status',
       'click sortable' => TRUE,
-     ),
+    ),
     'sort' => array(
       'handler' => 'views_handler_sort',
     ),
@@ -634,7 +634,7 @@ function project_release_views_data_alter(&$data) {
   // We could just use the Taxonomy: Term ID in taxonomy.views.inc except
   // that we want to only display terms the admin has indicated as being
   // active on the Project release module settings page.
-  $data['term_node']['project_release_api_version'] = array(
+  $data['taxonomy_term_node']['project_release_api_version'] = array(
     'group' => t('Project release'),
     'title' => t('API compatability term'),
     'help' => t('The project release API compatability term (version).'),
@@ -645,7 +645,7 @@ function project_release_views_data_alter(&$data) {
     ),
     'argument' => array(
       'handler' => 'views_handler_argument_term_node_tid',
-      'name table' => 'term_data',
+      'name table' => 'taxonomy_term_data',
       'name field' => 'name',
       'empty name field' => t('Uncategorized'),
       'numeric' => TRUE,
@@ -653,7 +653,7 @@ function project_release_views_data_alter(&$data) {
     'filter' => array(
       'field' => 'tid',
       'handler' => 'project_release_handler_filter_project_release_api_version',
-      'hierarchy table' => 'term_hierarchy',
+      'hierarchy table' => 'taxonomy_term_hierarchy',
       'numeric' => TRUE,
     ),
   );
@@ -676,7 +676,7 @@ function project_release_views_data_alter(&$data) {
 function project_release_views_handlers() {
   return array(
     'info' => array(
-      'path' => drupal_get_path('module', 'project_release') .'/views/handlers',
+      'path' => drupal_get_path('module', 'project_release') . '/views/handlers',
     ),
     'handlers' => array(
       'project_release_handler_field_download_table' => array(
diff --git a/release/views/project_release.views_default.inc b/release/views/project_release.views_default.inc
index 595c065..055e5c1 100644
--- a/release/views/project_release.views_default.inc
+++ b/release/views/project_release.views_default.inc
@@ -10,11 +10,11 @@
  */
 function project_release_views_default_views() {
   // Search the "default_views" subdirectory for files ending in .view.php.
-  $files = file_scan_directory(drupal_get_path('module', 'project_release'). '/views/default_views', '/view\.php$/');
+  $files = file_scan_directory(drupal_get_path('module', 'project_release') . '/views/default_views', '@/view\.php$/@');
   foreach ($files as $absolute => $file) {
     // This is not require_once because it's possible that
     // hook_views_default_views() gets called more than once.
-    require $absolute;
+    require DRUPAL_ROOT . '/' . $absolute;
     if (isset($view)) {
       // $file->name has the ".php" stripped off, but still has the ".view".
       $view_name = substr($file->name, 0, strrpos($file->name, '.'));
@@ -25,7 +25,7 @@ function project_release_views_default_views() {
 }
 
 /**
- * Implement hook_views_default_views_alter().
+ * Implements hook_views_default_views_alter().
  *
  * This injects project_release-specific features into views provided
  * by the project.module.
