Add support for application wide maintainers, super maintainers, that are
maintainers for all versions of a particular application.
This commit is contained in:
@@ -28,7 +28,7 @@ if ($sub)
|
||||
{
|
||||
//get data
|
||||
$query = "SELECT queueId, appId, versionId,".
|
||||
"userId, maintainReason,".
|
||||
"userId, maintainReason, superMaintainer,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"FROM appMaintainerQueue WHERE queueId = $queueId;";
|
||||
$result = mysql_query($query);
|
||||
@@ -61,14 +61,45 @@ if ($sub)
|
||||
// Show the other maintainers of this application, if there are any
|
||||
echo '<tr valign=top><td class=color0><b>Other maintainers of this app:</b></td>',"\n";
|
||||
|
||||
$foundMaintainers = false;
|
||||
|
||||
$firstDisplay = true; /* if false we need to fix up table rows appropriately */
|
||||
|
||||
$other_users = getMaintainersUserIdsFromAppIdVersionId($ob->appId, $ob->versionId);
|
||||
if($other_users)
|
||||
{
|
||||
$foundMaintainers = true;
|
||||
while(list($index, list($userIdValue)) = each($other_users))
|
||||
{
|
||||
echo "<td>".lookupUsername($userIdValue)."</td></tr>\n";
|
||||
if($firstDisplay)
|
||||
{
|
||||
echo "<td>".lookupUsername($userIdValue)."</td></tr>\n";
|
||||
$firstDisplay = false;
|
||||
} else
|
||||
{
|
||||
echo "<tr><td class=color0></td><td>".lookupUsername($userIdValue)."</td></tr>\n";
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
|
||||
$other_users = getSuperMaintainersUserIdsFromAppId($ob->appId);
|
||||
if($other_users)
|
||||
{
|
||||
$foundMaintainers = true;
|
||||
while(list($index, list($userIdValue)) = each($other_users))
|
||||
{
|
||||
if($firstDisplay)
|
||||
{
|
||||
echo "<td>".lookupUsername($userIdValue)."*</td></tr>\n";
|
||||
$firstDisplay = false;
|
||||
} else
|
||||
{
|
||||
echo "<tr><td class=color0></td><td>".lookupUsername($userIdValue)."*</td></tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$foundMaintainers)
|
||||
{
|
||||
echo "<td>No other maintainers</td></tr>\n";
|
||||
}
|
||||
@@ -76,12 +107,26 @@ if ($sub)
|
||||
// Show which other apps the user maintains
|
||||
echo '<tr valign=top><td class=color0><b>This user also maintains these apps:</b></td>',"\n";
|
||||
|
||||
$firstDisplay = true;
|
||||
$other_apps = getAppsFromUserId($ob->userId);
|
||||
if($other_apps)
|
||||
{
|
||||
while(list($index, list($appId, $versionId)) = each($other_apps))
|
||||
while(list($index, list($appIdOther, $versionIdOther, $superMaintainerOther)) = each($other_apps))
|
||||
{
|
||||
echo "<td>".appIdToName($appIdOther).versionIdToName($versionIdOther)."</td></tr>\n";
|
||||
if($firstDisplay)
|
||||
{
|
||||
$firstDisplay = false;
|
||||
if($superMaintainerOther)
|
||||
echo "<td>".appIdToName($appIdOther)."*</td></tr>\n";
|
||||
else
|
||||
echo "<td>".appIdToName($appIdOther).versionIdToName($versionIdOther)."</td></tr>\n";
|
||||
} else
|
||||
{
|
||||
if($superMaintainerOther)
|
||||
echo "<td class=color0></td><td>".appIdToName($appIdOther)."*</td></tr>\n";
|
||||
else
|
||||
echo "<td class=color0></td><td>".appIdToName($appIdOther).versionIdToName($versionIdOther)."</td></tr>\n";
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
@@ -133,6 +178,7 @@ if ($sub)
|
||||
"$ob->appId,".
|
||||
"$ob->versionId,".
|
||||
"$ob->userId,".
|
||||
"$ob->superMaintainer,".
|
||||
"NOW());";
|
||||
|
||||
if (mysql_query($query))
|
||||
@@ -213,6 +259,7 @@ else /* display the list of all outstanding maintainer requests */
|
||||
//get available maintainers
|
||||
$query = "SELECT queueId, appId, versionId,".
|
||||
"userId, maintainReason,".
|
||||
"superMaintainer,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"from appMaintainerQueue;";
|
||||
$result = mysql_query($query);
|
||||
@@ -243,6 +290,7 @@ else /* display the list of all outstanding maintainer requests */
|
||||
echo " <td><font color=white>Username</font></td>\n";
|
||||
echo " <td><font color=white>Application Name</font></td>\n";
|
||||
echo " <td><font color=white>Version</font></td>\n";
|
||||
echo " <td><font color=white>Super maintainer?</font></td>\n";
|
||||
echo " <td><font color=white>Submitter Email</font></td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
@@ -256,7 +304,17 @@ else /* display the list of all outstanding maintainer requests */
|
||||
echo " <td><a href='adminMaintainerQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueId</a></td>\n";
|
||||
echo " <td>".lookupUsername($ob->userId)."</td>\n";
|
||||
echo " <td>".appIdToName($ob->appId)."</td>\n";
|
||||
echo " <td>".versionIdToName($ob->versionId)." </td>\n";
|
||||
|
||||
if($ob->superMaintainer)
|
||||
{
|
||||
echo "<td>N/A</td>\n";
|
||||
echo "<td>Yes</td>\n";
|
||||
} else
|
||||
{
|
||||
echo "<td>".versionIdToName($ob->versionId)." </td>\n";
|
||||
echo "<td>No</td>\n";
|
||||
}
|
||||
|
||||
echo " <td>".lookupEmail($ob->userId)." </td>\n";
|
||||
echo " <td>[<a href='adminMaintainerQueue.php?sub=reject&queueId=$ob->queueId'>reject</a>]</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
@@ -69,6 +69,7 @@ if ($sub)
|
||||
echo " <td><font color=white>Username</font></td>\n";
|
||||
echo " <td><font color=white>Application Name</font></td>\n";
|
||||
echo " <td><font color=white>Version</font></td>\n";
|
||||
echo " <td><font color=white>Super maintainer?</font></td>\n";
|
||||
echo " <td></td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
@@ -80,10 +81,20 @@ if ($sub)
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." </td>\n";
|
||||
echo " <td>".lookupUsername($ob->userId)."</td>\n";
|
||||
echo " <td>".appIdToName($ob->appId)."</td>\n";
|
||||
echo " <td><a href='".$apidb_root."appview.php?appId=$ob->appId&versionId=$ob->versionId'>".versionIdToName($ob->versionId)."</a> </td>\n";
|
||||
|
||||
if(isSuperMaintainer($ob->appId))
|
||||
{
|
||||
echo " <td><a href='".$apidb_root."appview.php?appId=$ob->appId'>".appIdToName($ob->appId)."</a></td>\n";
|
||||
echo " <td>".versionIdToName($ob->versionId)." </td>\n";
|
||||
} else
|
||||
{
|
||||
echo " <td>".appIdToName($ob->appId)."</td>\n";
|
||||
echo " <td><a href='".$apidb_root."appview.php?appId=$ob->appId&versionId=$ob->versionId'>".versionIdToName($ob->versionId)."</a> </td>\n";
|
||||
}
|
||||
|
||||
echo " <td>".lookupEmail($ob->userId)." </td>\n";
|
||||
echo " <td>[<a href='adminMaintainers.php?sub=delete&maintainerId=$ob->maintainerId'>delete</a>]</td>\n";
|
||||
echo " <td>
|
||||
echo "</tr>\n\n";
|
||||
$c++;
|
||||
}
|
||||
|
||||
300
appview.php
300
appview.php
@@ -31,32 +31,29 @@ function admin_menu()
|
||||
$m = new htmlmenu("Admin");
|
||||
if($versionId)
|
||||
{
|
||||
$m->add("Add Note", $apidb_root."admin/addAppNote.php?appId=$appId&versionId=$versionId");
|
||||
$m->addmisc(" ");
|
||||
$m->add("Add Note", $apidb_root."admin/addAppNote.php?appId=$appId&versionId=$versionId");
|
||||
$m->addmisc(" ");
|
||||
|
||||
$m->add("Edit Version", $apidb_root."admin/editAppVersion.php?appId=$appId&versionId=$versionId");
|
||||
$m->add("Edit Version", $apidb_root."admin/editAppVersion.php?appId=$appId&versionId=$versionId");
|
||||
|
||||
$url = $apidb_root."admin/deleteAny.php?what=appVersion&versionId=$versionId&confirmed=yes";
|
||||
$m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
|
||||
|
||||
}
|
||||
else
|
||||
$url = $apidb_root."admin/deleteAny.php?what=appVersion&versionId=$versionId&confirmed=yes";
|
||||
$m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
|
||||
} else
|
||||
{
|
||||
$m->add("Add Version", $apidb_root."admin/addAppVersion.php?appId=$appId");
|
||||
$m->addmisc(" ");
|
||||
$m->add("Add Version", $apidb_root."admin/addAppVersion.php?appId=$appId");
|
||||
$m->addmisc(" ");
|
||||
|
||||
$m->add("Edit App", $apidb_root."admin/editAppFamily.php?appId=$appId");
|
||||
$m->add("Edit App", $apidb_root."admin/editAppFamily.php?appId=$appId");
|
||||
|
||||
// global admin options
|
||||
if(havepriv("admin"))
|
||||
{
|
||||
$url = $apidb_root."admin/deleteAny.php?what=appFamily&appId=$appId&confirmed=yes";
|
||||
$m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
|
||||
$m->addmisc(" ");
|
||||
$m->add("Edit Owners", $apidb_root."admin/editAppOwners.php?appId=$appId");
|
||||
$m->add("Edit Bundle", $apidb_root."admin/editBundle.php?bundleId=$appId");
|
||||
// global admin options
|
||||
if(havepriv("admin"))
|
||||
{
|
||||
$url = $apidb_root."admin/deleteAny.php?what=appFamily&appId=$appId&confirmed=yes";
|
||||
$m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")");
|
||||
$m->addmisc(" ");
|
||||
$m->add("Edit Owners", $apidb_root."admin/editAppOwners.php?appId=$appId");
|
||||
$m->add("Edit Bundle", $apidb_root."admin/editBundle.php?bundleId=$appId");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$m->done();
|
||||
@@ -74,7 +71,7 @@ function get_screenshot_img($appId, $versionId)
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
$imgFile = "<img src='".$apidb_root."images/no_screenshot.gif' border=0 alt='No Screenshot'>";
|
||||
$imgFile = "<img src='".$apidb_root."images/no_screenshot.gif' border=0 alt='No Screenshot'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -154,7 +151,7 @@ function display_notes($appId, $versionId = 0)
|
||||
if(!$result || mysql_num_rows($result) == 0)
|
||||
{
|
||||
// do nothing
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
echo "<tr class=color1><td valign=top align=right> <b>Notes</b></td><td>\n";
|
||||
@@ -172,10 +169,10 @@ function display_notes($appId, $versionId = 0)
|
||||
}
|
||||
|
||||
//display row
|
||||
if (havepriv("admin") || isMaintainer($appId,$versionId) )
|
||||
echo " <a href='admin/editAppNote.php?noteId=".$ob->noteId."&appId=$appId".$versionLink."'> $c. ".substr(stripslashes($ob->noteTitle),0,30)."</a><br>\n";
|
||||
else
|
||||
echo " <a href='noteview.php?noteId=".$ob->noteId."&appId=$appId".$versionLink."'> $c. ".substr(stripslashes($ob->noteTitle),0,30)."</a><br>\n";
|
||||
if (havepriv("admin") || isMaintainer($appId,$versionId) )
|
||||
echo " <a href='admin/editAppNote.php?noteId=".$ob->noteId."&appId=$appId".$versionLink."'> $c. ".substr(stripslashes($ob->noteTitle),0,30)."</a><br>\n";
|
||||
else
|
||||
echo " <a href='noteview.php?noteId=".$ob->noteId."&appId=$appId".$versionLink."'> $c. ".substr(stripslashes($ob->noteTitle),0,30)."</a><br>\n";
|
||||
$c++;
|
||||
}
|
||||
|
||||
@@ -187,7 +184,6 @@ function display_versions($appId, $versions)
|
||||
{
|
||||
if ($versions)
|
||||
{
|
||||
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
@@ -200,33 +196,33 @@ function display_versions($appId, $versions)
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c = 0;
|
||||
while(list($idx, $ver) = each($versions))
|
||||
{
|
||||
//set row color
|
||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||
while(list($idx, $ver) = each($versions))
|
||||
{
|
||||
//set row color
|
||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||
|
||||
//format desc
|
||||
$desc = substr(stripslashes($ver->description),0,75);
|
||||
if(strlen($desc) == 75)
|
||||
$desc .= " ...";
|
||||
//format desc
|
||||
$desc = substr(stripslashes($ver->description),0,75);
|
||||
if(strlen($desc) == 75)
|
||||
$desc .= " ...";
|
||||
|
||||
//get ratings
|
||||
$r_win = rating_stars_for_version($ver->versionId, "windows");
|
||||
$r_fake = rating_stars_for_version($ver->versionId, "fake");
|
||||
//get ratings
|
||||
$r_win = rating_stars_for_version($ver->versionId, "windows");
|
||||
$r_fake = rating_stars_for_version($ver->versionId, "fake");
|
||||
|
||||
//count comments
|
||||
$r_count = count_comments($appId,$ver->versionId);
|
||||
//count comments
|
||||
$r_count = count_comments($appId,$ver->versionId);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td><a href='appview.php?appId=$appId&versionId=$ver->versionId'>".$ver->versionName."</a></td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td align=center>$r_win</td>\n";
|
||||
echo " <td align=center>$r_fake</td>\n";
|
||||
echo " <td align=center>$r_count</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td><a href='appview.php?appId=$appId&versionId=$ver->versionId'>".$ver->versionName."</a></td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td align=center>$r_win</td>\n";
|
||||
echo " <td align=center>$r_fake</td>\n";
|
||||
echo " <td align=center>$r_count</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c++;
|
||||
$c++;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
@@ -247,108 +243,160 @@ if(!is_numeric($appId))
|
||||
|
||||
if($appId && !$versionId)
|
||||
{
|
||||
$app = new Application($appId);
|
||||
$data = $app->data;
|
||||
if(!$data) {
|
||||
// Oops! application not found or other error. do something
|
||||
errorpage('Internal Database Access Error');
|
||||
exit;
|
||||
}
|
||||
$app = new Application($appId);
|
||||
$data = $app->data;
|
||||
if(!$data)
|
||||
{
|
||||
// Oops! application not found or other error. do something
|
||||
errorpage('Internal Database Access Error');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Show Vote Menu
|
||||
if(loggedin())
|
||||
apidb_sidebar_add("vote_menu");
|
||||
// Show Vote Menu
|
||||
if(loggedin())
|
||||
apidb_sidebar_add("vote_menu");
|
||||
|
||||
// Show Admin Menu
|
||||
if(loggedin() && (havepriv("admin") || $current->ownsApp($appId))) {
|
||||
apidb_sidebar_add("admin_menu");
|
||||
}
|
||||
// Show Admin Menu
|
||||
if(loggedin() && (havepriv("admin") || $current->ownsApp($appId)))
|
||||
apidb_sidebar_add("admin_menu");
|
||||
|
||||
// header
|
||||
apidb_header("Viewing App - ".$data->appName);
|
||||
// header
|
||||
apidb_header("Viewing App - ".$data->appName);
|
||||
|
||||
//cat display
|
||||
display_catpath($app->data->catId);
|
||||
//cat display
|
||||
display_catpath($app->data->catId);
|
||||
|
||||
//set Vendor
|
||||
$vendor = $app->getVendor();
|
||||
//set Vendor
|
||||
$vendor = $app->getVendor();
|
||||
|
||||
//set URL
|
||||
$appLinkURL = ($data->webPage) ? "<a href='$data->webPage'>".substr(stripslashes($data->webPage),0,30)."</a>": " ";
|
||||
//set URL
|
||||
$appLinkURL = ($data->webPage) ? "<a href='$data->webPage'>".substr(stripslashes($data->webPage),0,30)."</a>": " ";
|
||||
|
||||
//set Image
|
||||
$img = get_screenshot_img($appId, $versionId);
|
||||
//set Image
|
||||
$img = get_screenshot_img($appId, $versionId);
|
||||
|
||||
//start display application
|
||||
echo html_frame_start("","98%","",0);
|
||||
//start display application
|
||||
echo html_frame_start("","98%","",0);
|
||||
|
||||
echo '<tr><td class=color4 valign=top>',"\n";
|
||||
echo '<table width="250" border=0 cellpadding=3 cellspacing=1">',"\n";
|
||||
echo "<tr class=color0 valign=top><td width='100' align=right> <b>Name</b></td><td width='100%'> ".stripslashes($data->appName)." </td>\n";
|
||||
echo "<tr class=color1 valign=top><td align=right> <b>Vendor</b></td><td> ".
|
||||
" <a href='vendorview.php?vendorId=$vendor->vendorId'> ".stripslashes($vendor->vendorName)." </a> \n";
|
||||
echo "<tr class=color0 valign=top><td align=right> <b>BUGS</b></td><td> ".
|
||||
" <a href='bugs.php?appId=$data->appId.'> Check for bugs in bugzilla </a> \n";
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td class=color4 valign=top>\n";
|
||||
echo " <table>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
echo ' <table width="250" border=0 cellpadding=3 cellspacing=1">',"\n";
|
||||
echo " <tr class=color0 valign=top><td width='100' align=right> <b>Name</b></td><td width='100%'> ".stripslashes($data->appName)." </td>\n";
|
||||
echo " <tr class=color1 valign=top><td align=right> <b>Vendor</b></td><td> ".
|
||||
" <a href='vendorview.php?vendorId=$vendor->vendorId'> ".stripslashes($vendor->vendorName)." </a> \n";
|
||||
echo " <tr class=color0 valign=top><td align=right> <b>BUGS</b></td><td> ".
|
||||
" <a href='bugs.php?appId=$data->appId.'> Check for bugs in bugzilla </a> \n";
|
||||
echo " </td></tr>\n";
|
||||
|
||||
//display notes
|
||||
display_notes($appId);
|
||||
|
||||
//main URL
|
||||
echo "<tr class=color1 valign=top><td align=right> <b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
||||
echo " <tr class=color1 valign=top><td align=right> <b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
||||
|
||||
//optional links
|
||||
$result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND type = 'url'");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo "<tr class=color1><td valign=top align=right> <b>Links</b></td><td>\n";
|
||||
{
|
||||
echo " <tr class=color1><td valign=top align=right> <b>Links</b></td><td>\n";
|
||||
while($ob = mysql_fetch_object($result))
|
||||
{
|
||||
echo " <a href='$ob->url'>".substr(stripslashes($ob->description),0,30)."</a> <br>\n";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
{
|
||||
echo " <a href='$ob->url'>".substr(stripslashes($ob->description),0,30)."</a> <br>\n";
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
}
|
||||
|
||||
// display app owner
|
||||
$result = mysql_query("SELECT * FROM appOwners WHERE appId = $appId");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo "<tr class=color0><td valign=top align=right> <b>Owner</b></td><td>\n";
|
||||
{
|
||||
echo " <tr class=color0><td valign=top align=right> <b>Owner</b></td>\n";
|
||||
echo " <td>\n";
|
||||
while($ob = mysql_fetch_object($result))
|
||||
{
|
||||
$inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId");
|
||||
{
|
||||
$inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId");
|
||||
if ($inResult && mysql_num_rows($inResult) > 0)
|
||||
{
|
||||
$foo = mysql_fetch_object($inResult);
|
||||
echo " <a href='mailto:$foo->email'>".substr(stripslashes($foo->username),0,30)."</a> <br>\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo " <a href='mailto:$foo->email'>".substr(stripslashes($foo->username),0,30)."</a> <br>\n";
|
||||
}
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
}
|
||||
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
||||
|
||||
echo "<tr><td colspan = 2><center>";
|
||||
echo "<a href='appsubmit.php?appId=$data->appId&apptype=2'> Submit New Version </a> \n";
|
||||
echo "</center></td></tr>";
|
||||
echo " </td></tr>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
echo "</table></td><td class=color2 valign=top width='100%'>\n";
|
||||
// Display all supermaintainers maintainers of this application
|
||||
echo " <table class=color4 width=250 border=1>\n";
|
||||
echo " <tr><td align=left><b>Super maintainers:</b></td></tr>\n";
|
||||
$other_maintainers = getSuperMaintainersUserIdsFromAppId($appId);
|
||||
if($other_maintainers)
|
||||
{
|
||||
while(list($index, list($userIdValue)) = each($other_maintainers))
|
||||
{
|
||||
echo " <tr><td align=left>\n";
|
||||
echo " <li>".lookupUsername($userIdValue)."</td></tr>\n";
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo " <tr><td align=right>No maintainers.Volunteer today!</td></tr>\n";
|
||||
}
|
||||
|
||||
//Desc
|
||||
echo "<table width='100%' border=0><tr><td width='100%' valign=top><b>Description</b><br>\n";
|
||||
echo add_br(stripslashes($data->description));
|
||||
// Display the app maintainer button
|
||||
echo " <tr><td><center>\n";
|
||||
if(loggedin())
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if(isSuperMaintainer($appId, $versionId)) /* yep */
|
||||
{
|
||||
echo ' <form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class=button>';
|
||||
} else /* nope */
|
||||
{
|
||||
echo ' <form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a super maintainer of this app" class=button>';
|
||||
}
|
||||
|
||||
echo "</td></tr></table>\n";
|
||||
|
||||
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
||||
echo " <input type=hidden name='appId' value=$appId>";
|
||||
echo " <input type=hidden name='versionId' value=$versionId>";
|
||||
echo " <input type=hidden name='superMaintainer' value=1>"; /* set superMaintainer to 1 because we are at the appFamily level */
|
||||
echo " </form>";
|
||||
} else
|
||||
{
|
||||
echo ' <input type=submit value="Log in to become a super maintainer" class=button>';
|
||||
}
|
||||
echo " </center></td></tr>\n";
|
||||
echo " </table>\n"; /* close of super maintainers table */
|
||||
|
||||
//display versions
|
||||
display_versions($appId,$app->getAppVersionList());
|
||||
echo " </td></tr>\n";
|
||||
|
||||
//display bundle
|
||||
display_bundle($appId);
|
||||
echo " <tr><td>\n";
|
||||
echo " <center><a href='appsubmit.php?appId=$data->appId&apptype=2'> Submit New Version </a> <center>\n";
|
||||
echo " </td></tr>\n";
|
||||
|
||||
// disabled for now
|
||||
//log_application_visit($appId);
|
||||
echo " </td></tr>\n";
|
||||
|
||||
echo " </table>\n"; /* close the table that contains the whole left hand side of the upper table */
|
||||
|
||||
//Desc
|
||||
echo " <td class=color2 valign=top width='100%'>\n";
|
||||
echo " <table width='100%' border=0><tr><td width='100%' valign=top><b>Description</b><br>\n";
|
||||
echo add_br(stripslashes($data->description));
|
||||
|
||||
echo " </td></tr></table>\n";
|
||||
|
||||
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
||||
|
||||
//display versions
|
||||
display_versions($appId,$app->getAppVersionList());
|
||||
|
||||
//display bundle
|
||||
display_bundle($appId);
|
||||
|
||||
// disabled for now
|
||||
//log_application_visit($appId);
|
||||
}
|
||||
else if($appId && $versionId)
|
||||
{
|
||||
@@ -436,13 +484,23 @@ else if($appId && $versionId)
|
||||
echo "<tr><td colspan = 2><center>";
|
||||
if(loggedin())
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if(isMaintainer($appId, $versionId)) /* yep */
|
||||
/* is this user a maintainer of this version by virtue of being a super maintainer */
|
||||
/* of this app family? */
|
||||
if(isSuperMaintainer($appId) && !isMaintainer($appId, $versionId))
|
||||
{
|
||||
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a maintainer" class=button>';
|
||||
} else /* nope */
|
||||
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a supermaintainer" class=button>';
|
||||
echo "<input type=hidden name='superMaintainer' value=1>";
|
||||
} else
|
||||
{
|
||||
echo '<form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a maintainer for this app" class=button>';
|
||||
/* are we already a maintainer? */
|
||||
if(isMaintainer($appId, $versionId)) /* yep */
|
||||
{
|
||||
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a maintainer" class=button>';
|
||||
echo "<input type=hidden name='superMaintainer' value=0>";
|
||||
} else /* nope */
|
||||
{
|
||||
echo '<form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a maintainer for this app" class=button>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "<input type=hidden name='appId' value=$appId>";
|
||||
|
||||
@@ -37,6 +37,8 @@ function forum_lookup_user ($userid)
|
||||
*/
|
||||
function view_app_comment($ob)
|
||||
{
|
||||
global $apidb_root;
|
||||
|
||||
echo html_frame_start('','98%');
|
||||
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1">',"\n";
|
||||
|
||||
@@ -69,10 +71,11 @@ function view_app_comment($ob)
|
||||
if(havepriv("admin") || isMaintainer($ob->appId, $ob->versionId))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo '<td><form method=post name=message action="deletecomment.php"><input type=submit value="Delete" class=button> ',"\n";
|
||||
echo "<td><form method=post name=message action=$apidb_root/deletecomment.php><input type=submit value='Delete' class=button>\n";
|
||||
echo "<input type=hidden name='commentId' value=$ob->commentId>";
|
||||
echo "<input type=hidden name='appId' value=$ob->appId>";
|
||||
echo "<input type=hidden name='versionId' value=$ob->versionId></form></td>","\n";
|
||||
echo "blahblahblah $apidb_root";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
function getAppsFromUserId($userId)
|
||||
{
|
||||
$result = mysql_query("SELECT appId, versionId FROM ".
|
||||
$result = mysql_query("SELECT appId, versionId, superMaintainer FROM ".
|
||||
"appMaintainers WHERE userId = '$userId'");
|
||||
if(mysql_num_rows($result) == 0)
|
||||
return;
|
||||
@@ -14,7 +14,7 @@ function getAppsFromUserId($userId)
|
||||
$c = 0;
|
||||
while($row = mysql_fetch_object($result))
|
||||
{
|
||||
$retval[$c] = array($row->appId, $row->versionId);
|
||||
$retval[$c] = array($row->appId, $row->versionId, $row->superMaintainer);
|
||||
$c++;
|
||||
}
|
||||
|
||||
@@ -44,4 +44,27 @@ function getMaintainersUserIdsFromAppIdVersionId($appId, $versionId)
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* get the userIds of super maintainers for this appId
|
||||
*/
|
||||
function getSuperMaintainersUserIdsFromAppId($appId)
|
||||
{
|
||||
$query = "SELECT userId FROM ".
|
||||
"appMaintainers WHERE appId = '$appId' " .
|
||||
"AND superMaintainer = '1';";
|
||||
$result = mysql_query($query);
|
||||
if(mysql_num_rows($result) == 0)
|
||||
return; // no sub categories
|
||||
|
||||
$retval = array();
|
||||
$c = 0;
|
||||
while($row = mysql_fetch_object($result))
|
||||
{
|
||||
$retval[$c] = array($row->userId);
|
||||
$c++;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -28,9 +28,12 @@ function global_sidebar_login() {
|
||||
{
|
||||
$g->addmisc("");
|
||||
$g->addmisc("You maintain:\n");
|
||||
while(list($index, list($appId, $versionId)) = each($apps_user_maintains))
|
||||
while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains))
|
||||
{
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId&versionId=$versionId'>".appIdToName($appId)." ".versionIdToName($versionId)."</a>", "center");
|
||||
if($superMaintainer)
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId'>".appIdToName($appId)."*</a>", "center");
|
||||
else
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId&versionId=$versionId'>".appIdToName($appId)." ".versionIdToName($versionId)."</a>", "center");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,6 +226,13 @@ class User {
|
||||
if(!loggedin() || !$this->userid)
|
||||
return false;
|
||||
|
||||
/* if this user is a super maintainer of this appid then they */
|
||||
/* are a maintainer of all of the versionId's of it as well */
|
||||
if($this->is_super_maintainer($appId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND versionId = '$versionId'";
|
||||
$result = mysql_query($query, $this->link);
|
||||
if(!$result)
|
||||
@@ -233,6 +240,22 @@ class User {
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
/*
|
||||
* check if this user is an maintainer of a given appId/versionId
|
||||
*/
|
||||
function is_super_maintainer($appId)
|
||||
{
|
||||
global $current;
|
||||
if(!loggedin() || !$this->userid)
|
||||
return false;
|
||||
|
||||
$query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND superMaintainer = 1";
|
||||
$result = mysql_query($query, $this->link);
|
||||
if(!$result)
|
||||
return 0;
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
function addpriv($priv)
|
||||
{
|
||||
if(!$this->userid || !$priv)
|
||||
@@ -302,6 +325,16 @@ function isMaintainer($appId, $versionId)
|
||||
return $current->is_maintainer($appId, $versionId);
|
||||
}
|
||||
|
||||
function isSuperMaintainer($appId)
|
||||
{
|
||||
global $current;
|
||||
|
||||
if(!loggedin())
|
||||
return false;
|
||||
|
||||
return $current->is_super_maintainer($appId);
|
||||
}
|
||||
|
||||
function debugging()
|
||||
{
|
||||
global $current;
|
||||
|
||||
@@ -16,9 +16,14 @@ opendb();
|
||||
$appId = strip_tags($_POST['appId']);
|
||||
$versionId = strip_tags($_POST['versionId']);
|
||||
$confirmed = strip_tags($_POST['confirmed']);
|
||||
$superMaintainer = strip_tags($_POST['superMaintainer']);
|
||||
|
||||
// header
|
||||
apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId));
|
||||
|
||||
if($superMaintainer)
|
||||
apidb_header("Confirm supermaintainer resignation of ".appIdToName($appId));
|
||||
else
|
||||
apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId));
|
||||
|
||||
if($confirmed)
|
||||
{
|
||||
@@ -26,11 +31,20 @@ if($confirmed)
|
||||
|
||||
echo html_frame_start("Removing",400,"",0);
|
||||
|
||||
$query = "DELETE FROM appMaintainers WHERE appId = '$appId' AND versionId = '$versionId' AND userId = '$current->userid';";
|
||||
if($superMaintainer)
|
||||
$query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND superMaintainer = '$superMaintainer';";
|
||||
else
|
||||
$query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND versionId = '$versionId' AND superMaintainer = '$superMaintainer';";
|
||||
|
||||
echo "$query";
|
||||
|
||||
$result = mysql_query($query);
|
||||
if($result)
|
||||
{
|
||||
echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId);
|
||||
if($superMaintainer)
|
||||
echo "You were removed as a supermaintainer of ".appIdToName($appId);
|
||||
else
|
||||
echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId);
|
||||
} else
|
||||
{
|
||||
//error
|
||||
@@ -44,9 +58,19 @@ if($confirmed)
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo "<input type=hidden name='appId' value=$appId>";
|
||||
echo "<input type=hidden name='versionId' value=$versionId>";
|
||||
echo "<input type=hidden name='superMaintainer' value=$superMaintainer>";
|
||||
echo "<input type=hidden name='confirmed' value=1>";
|
||||
echo "<tr><td>Are you sure that you want to be removed as a maintainer of this application?</tr></td>\n";
|
||||
echo '<tr><td align=center><input type=submit value=" Confirm resignation as maintainer " class=button>', "\n";
|
||||
|
||||
if($superMaintainer)
|
||||
{
|
||||
echo "<tr><td>Are you sure that you want to be removed as a super maintainer of this application?</tr></td>\n";
|
||||
echo '<tr><td align=center><input type=submit value=" Confirm resignation as supermaintainer " class=button>', "\n";
|
||||
} else
|
||||
{
|
||||
echo "<tr><td>Are you sure that you want to be removed as a maintainer of this application?</tr></td>\n";
|
||||
echo '<tr><td align=center><input type=submit value=" Confirm resignation as maintainer " class=button>', "\n";
|
||||
}
|
||||
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ opendb();
|
||||
|
||||
$appId = strip_tags($_POST['appId']);
|
||||
$versionId = strip_tags($_POST['versionId']);
|
||||
$superMaintainer = strip_tags($_POST['superMaintainer']);
|
||||
|
||||
/* if the user is already a maintainer don't add them again */
|
||||
if(isMaintainer($appId, $versionId))
|
||||
@@ -44,6 +45,13 @@ if(isMaintainer($appId, $versionId))
|
||||
exit;
|
||||
}
|
||||
|
||||
/* if this user is a super maintainer they maintain all of the versionIds of this appId */
|
||||
if(isSuperMaintainer($appId))
|
||||
{
|
||||
echo "You are already a supermaintainer of the whole application family!";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_REQUEST['maintainReason'])
|
||||
{
|
||||
// check the input for empty/invalid fields
|
||||
@@ -55,14 +63,18 @@ if($_REQUEST['maintainReason'])
|
||||
}
|
||||
|
||||
// header
|
||||
apidb_header("Submit Maintainer Request");
|
||||
if($superMaintainer)
|
||||
apidb_header("Submit SuperMaintainer Request");
|
||||
else
|
||||
apidb_header("Submit Maintainer Request");
|
||||
|
||||
// add to queue
|
||||
$query = "INSERT INTO appMaintainerQueue VALUES (null, '".
|
||||
addslashes($_REQUEST['appId'])."', '".
|
||||
addslashes($_REQUEST['versionId'])."', '".
|
||||
addslashes($current->userid)."', '".
|
||||
addslashes($_REQUEST['maintainReason'])."',".
|
||||
addslashes($_REQUEST['maintainReason'])."', '".
|
||||
addslashes($_REQUEST['superMaintainer'])."',".
|
||||
"NOW()".");";
|
||||
|
||||
mysql_query($query);
|
||||
@@ -105,9 +117,21 @@ if($_REQUEST['maintainReason'])
|
||||
echo "appdb admins to identify people that are best suited for the job. Your request\n";
|
||||
echo "may be denied if there are already a handful of maintainers for this app or if you\n";
|
||||
echo "don't have the experience with wine that is necessary to help other users out.\n";
|
||||
echo "<br>";
|
||||
|
||||
/* Special message for super maintainer applications */
|
||||
if($superMaintainer)
|
||||
{
|
||||
echo "<p>As a super maintainer you are expected to do all of this but for EVERY version of\n";
|
||||
echo "this application. We don't expect you to run every version but at least to help keep\n";
|
||||
echo "the forums clean of stale or out-of-date information\n";
|
||||
}
|
||||
echo "<br><br>";
|
||||
|
||||
echo html_frame_start("New Maintainer Form",400,"",0);
|
||||
if($superMaintainer)
|
||||
echo html_frame_start("New Super Maintainer Form",400,"",0);
|
||||
else
|
||||
echo html_frame_start("New Maintainer Form",400,"",0);
|
||||
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo "<tr valign=top><td class=color0>";
|
||||
@@ -115,7 +139,13 @@ if($_REQUEST['maintainReason'])
|
||||
echo '</td></tr>',"\n";
|
||||
echo "<input type=hidden name='appId' value=$appId>";
|
||||
echo "<input type=hidden name='versionId' value=$versionId>";
|
||||
echo '<tr valign=top><td class=color0><b>Why you want to and should be an app maintainer</b></td><td><textarea name="maintainReason" rows=15 cols=70></textarea></td></tr>',"\n";
|
||||
echo "<input type=hidden name='superMaintainer' value=$superMaintainer>";
|
||||
|
||||
if($superMaintainer)
|
||||
echo '<tr valign=top><td class=color0><b>Why you want to and should be an app supermaintainer</b></td><td><textarea name="maintainReason" rows=15 cols=70></textarea></td></tr>',"\n";
|
||||
else
|
||||
echo '<tr valign=top><td class=color0><b>Why you want to and should be an app maintainer</b></td><td><textarea name="maintainReason" rows=15 cols=70></textarea></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2> <input type=submit value=" Submit Maintainer Request " class=button> </td></tr>',"\n";
|
||||
echo '</table>',"\n";
|
||||
|
||||
|
||||
@@ -252,11 +252,12 @@ create table appNotes (
|
||||
* care for an application.
|
||||
*/
|
||||
create table appMaintainers (
|
||||
maintainerId int not null auto_increment,
|
||||
appId int,
|
||||
versionId int,
|
||||
userId int,
|
||||
submitTime datetime,
|
||||
maintainerId int not null auto_increment,
|
||||
appId int,
|
||||
versionId int,
|
||||
userId int,
|
||||
superMaintainer bool,
|
||||
submitTime datetime,
|
||||
key(maintainerId)
|
||||
);
|
||||
|
||||
@@ -270,6 +271,7 @@ create table appMaintainerQueue (
|
||||
versionId int,
|
||||
userId int,
|
||||
maintainReason text,
|
||||
superMaintainer bool,
|
||||
submitTime datetime,
|
||||
key(queueId)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user