Index: modules/project/project.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/project/project.module,v
retrieving revision 1.239.2.13
diff -u -r1.239.2.13 project.module
--- modules/project/project.module	7 Sep 2006 19:25:39 -0000	1.239.2.13
+++ modules/project/project.module	16 Dec 2006 23:04:52 -0000
@@ -17,6 +17,7 @@
     case 'node/add#project_project':
       return t('A project is anything that has releases which can be downloaded');
     case 'node/add/project_project':
+      $help = '';
       if (project_use_taxonomy()) {
         $tree = taxonomy_get_tree(_project_get_vid());
         // Extract the different project types, and, for the first type, up to three categories.
@@ -425,15 +426,16 @@
 
 function project_page_overview($termname = NULL, $sort_method = NULL) {
   global $form_values;
+  $output = '';
 
   $breadcrumb = array(l(t('Home'), NULL));
   $sort_methods = module_invoke_all('project_sort_methods', 'methods');
 
   // Read in requested version, if any.
-  if ($_POST['edit']['rid']) {
+  if (!empty($_POST['edit']['rid'])) {
     $version = $_POST['edit']['rid'];
   }
-  else if ($_SESSION['project_version']) {
+  else if (!empty($_SESSION['project_version'])) {
     $version = $_SESSION['project_version'];
   }
   else {
@@ -441,7 +443,7 @@
   }
   $form = project_version_filter_form($version);
   $version_form = drupal_get_form('project_version_filter_form', $form);
-  if ($_POST['edit']['rid']) {
+  if (!empty($_POST['edit']['rid'])) {
     $_SESSION['project_version'] = $form_values['rid'];
   }
   if (variable_get('project_browse_releases', 0)) {
@@ -645,6 +647,7 @@
     }
     $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, nr.teaser, nr.format$ISSUES FROM {node} n INNER JOIN {node_revisions} nr ON n.vid = nr.vid $ISSUE_JOIN WHERE n.status = 1 AND n.type = 'project_project' ORDER BY n.title ASC"));
   }
+  $projects = '';
   $class = 'even';
   while ($project = db_fetch_object($result)) {
     $project->body = check_markup($project->teaser, $project->format, FALSE);
@@ -659,7 +662,7 @@
     }
 
     // Make sure we have the latest release
-    if ($project->release_count > 1) {
+    if (isset($project->release_count) && $project->release_count > 1) {
       $latest = db_fetch_object(db_query_range("SELECT path, version FROM {project_releases} WHERE nid = %d AND version LIKE '%s%%' ORDER BY version DESC", $project->nid, $version, 0, 1));
       $project->path = $latest->path;
       $project->version = $latest->version;
@@ -667,7 +670,7 @@
 
     $project->links = array();
 
-    if ($project->path) {
+    if (isset($project->path) && $project->path) {
       $project->links[] = '<a href="'. base_path() . $project->path .'">' . t('Download') . '</a>';
     }
     $project->links[] = l(t('Find out more'), "node/$project->nid");
@@ -675,7 +678,7 @@
     if ($project->issues) {
       $project->links[] = l(t('Bugs and feature requests'), "project/issues/$project->nid");
     }
-    if (module_invoke($module, 'project_sort_methods', 'group by date', $sort_method) && $date = _project_date($project->changed)) {
+    if (isset($module) && module_invoke($module, 'project_sort_methods', 'group by date', $sort_method) && $date = _project_date($project->changed)) {
       $projects .= "<h3>$date</h3>";
     }
     $project->class = ($class == 'even') ? 'odd': 'even';
@@ -683,9 +686,9 @@
     $class = $project->class;
   }
 
-  $output .= '<div class="project" id="project-overview">' . $projects . '</div>';
+  $output .= '<div class="project" id="project-overview">' . (isset($projects) ? $projects : '') . '</div>';
 
-  if ($pager) {
+  if (!empty($pager)) {
     $output .= theme('pager', NULL, variable_get('project_browse_nodes', 30));
   }
   drupal_set_breadcrumb($breadcrumb);
@@ -922,12 +925,12 @@
 function theme_project_summary($project) {
   $output = '<div class="' . $project->class . '">';
   $output .= '<h2>'. l($project->title, "node/$project->nid") .'</h2>';
-  if ($project->changed) {
+  if (!empty($project->changed)) {
     $output .= '<p><small>' . t('Last changed: %interval ago', array('%interval' => format_interval(time() - $project->changed, 2))) . '</small></p>';
   }
   $output .= $project->body;
   $output .= theme('links', $project->links);
-  if ($project->terms) {
+  if (!empty($project->terms)) {
     $output .= '<br />' . theme('links', $project->terms);
   }
   $output .= '</div>';
