# # # patch "www/index.php" # from [2e34c6a413fe3b880f2178e45f6fb486551deb8e] # to [9d0bd97119310288fdec4f9f264b6decdadc652a] # ============================================================ --- www/index.php 2e34c6a413fe3b880f2178e45f6fb486551deb8e +++ www/index.php 9d0bd97119310288fdec4f9f264b6decdadc652a @@ -43,32 +43,59 @@ } # First, display those maintained by the logged in user, if any +$projcnt = 0; if ($validuser) { # $query = "SELECT name, directory FROM projects WHERE name IN (SELECT project FROM permissions WHERE username = '%s')"; $query= "SELECT name FROM projects WHERE name IN (SELECT project FROM permissions WHERE username=?)"; $result = $db->Execute($query, array($username)); - if (!$result) {printf("ERROR"); } - $rows = $result->RecordCount(); - if ($rows > 0) { - printf("

Projects you help maintain:

"); - while (!$result->EOF) { - $row = $result->FetchRow(); - display_project_summary($row, 1); + if (!$result) { + printf("ERROR"); + } else { + $rows = $result->RecordCount(); + if ($rows > 0) { + printf("

Projects you help maintain:

"); + while (!$result->EOF) { + $row = $result->FetchRow(); + display_project_summary($row, 1); + $projcnt++; + } } } -} -#$query = "SELECT name, directory FROM projects WHERE name NOT IN (SELECT project FROM permissions WHERE username = '%s')"; -$query = "SELECT name FROM projects WHERE name NOT IN (SELECT project FROM permissions WHERE username=?)"; -$result = $db->Execute($query, array($username)); -if (!$result) - printf("ERROR"); -else { - printf("

Projects you don't help maintain:

"); - while (!$result->EOF) { - $row = $result->FetchRow(); - display_project_summary($row, 0); + +# $query = "SELECT name, directory FROM projects WHERE name NOT IN (SELECT project FROM permissions WHERE username = '%s')"; + $query = "SELECT name FROM projects WHERE name NOT IN (SELECT project FROM permissions WHERE username=?)"; + $result = $db->Execute($query, array($username)); + if (!$result) { + printf("ERROR"); + } else { + $rows = $result->RecordCount(); + if ($rows > 0) { + printf("

Projects you don't help maintain:

"); + while ($row = $result->FetchRot()) { + display_project_summary($row, 0); + $projcnt++; + } + } } +} else { + $query = "SELECT name FROM projects"; + $result = $db->Execute($query); + if (!$result) { + printf("ERROR"); + } else { + $rows = $result->RecordCount(); + if ($rows > 0) { + printf("

Projects:

"); + while ($row = $result->FetchRot()) { + display_project_summary($row, 0); + $projcnt++; + } + } + } } +if ($projcnt == 0) { + printf("No projects\n"); +} $db->Close(); ?>