The App Data Queue is empty.',"\n";
echo 'There is nothing for you to do. Check back later.
',"\n";
echo html_frame_end(" ");
}
else
{
//help
echo "| \n\n";
echo " This is a list of app data submitted by users.\n";
echo "Please inspect carefully these data before to accept it.\n";
echo " |
\n\n";
//show applist
echo html_frame_start("","90%","",0);
echo "\n\n";
echo "\n";
echo " | Submission Date | \n";
echo " Queue Id | \n";
echo " Username (e-mail) | \n";
echo " Application Name | \n";
echo " Version | \n";
echo " Type | \n";
echo "
\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
{
if($_SESSION['current']->is_maintainer($ob->queueappId,
$ob->queueversionId)
|| havepriv("admin"))
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "\n";
echo " | ".date("Y-n-t h:i:sa", $ob->submitTime)." | \n";
echo " $ob->queueId | \n";
if($ob->queueuserId)
echo " ".lookupUsername($ob->queueuserId)." (".lookupEmail($ob->queueuserId).") | \n";
else
echo " Anonymous | \n";
echo "".appIdToName($ob->queueappId)." | \n";
echo "".versionIdToName($ob->queueversionId)." | \n";
echo "".$ob->queuetype." | \n";
echo "
\n\n";
$c++;
}
}
echo "
\n\n";
echo html_frame_end(" ");
}
} else // shows a particular appdata
{
if(!(havepriv("admin") ||
$_SESSION['current']->is_maintainer($obj_row->queueAppId,
$obj_row->queueVersionId)))
{
errorpage("You don't have sufficient priviledges to use this page.");
exit;
}
$str_request="SELECT * FROM appDataQueue WHERE queueId='".$_REQUEST['queueId']."'";
$res_result=mysql_query($str_request);
$obj_row=mysql_fetch_object($res_result);
if(!$_REQUEST['sub']=="inside_form")
{
echo '';
} elseif ($_REQUEST['add']) // we accepted the request
{
$statusMessage = "";
$goodtogo = 0;
if($obj_row->queuetype == "image")
{
// we write the content in a realfile
$fname = $obj_row->queuappId."-".$obj_row->queueversionId."-".$obj_row->queueurl;
$handle = fopen("../data/screenshots/".$fname, "wb");
fwrite($handle, $obj_row->queuecontent);
fclose($handle);
$query = "INSERT INTO appData VALUES (null, ".$obj_row->queueappId.", ".$obj_row->queueversionId.", 'image', ".
"'".addslashes($_REQUEST['description'])."', '".$fname."')";
}
elseif ($obj_row->queuetype == "url") {
$query = "INSERT INTO appData VALUES (null, ".$obj_row->queueappId.", ".$obj_row->queueversionId.", 'url', ".
"'".addslashes($_REQUEST['description'])."', '".$obj_row->url."')";
}
if(debugging()) addmsg("query: $query
","green");
if (mysql_query($query))
{
$statusMessage = "The application data was successfully added into the database
\n";
//delete the item from the queue
mysql_query("DELETE from appDataQueue where queueId = ".$_REQUEST['queueId'].";");
$goodtogo = 1; /* set to 1 so we send the response email */
} else
{
//error
$statusMessage = "Database Error!
".mysql_error()."
\n";
}
//Send Status Email
if (lookupEmail($obj_row->queueuserId) && $goodtogo)
{
$ms = "Application Data Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your submission of an application data for ".appIdToName($obj_row->queueappId).versionIdToName($obj_row->queueversionId)." has been accepted. ";
$ms .= $_REQUEST['replyText'];
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
$ms .= "Thanks!\n";
$ms .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($obj_row->queueuserId)),'[AppDB] Application Data Request Report',$ms);
}
//done
echo html_frame_start("Submit App Data","600");
echo "$statusMessage
\n";
} elseif ($_REQUEST['reject'])
{
if (lookupEmail($obj_row->userId))
{
$ms = "Application Data Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." was rejected. ";
$ms .= $_REQUEST['replyText'];
$ms .= "";
$ms .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($obj_row->queueuserId)),'[AppDB] Application Data Request Report',$ms);
}
//delete main item
$query = "DELETE from appDataQueue where queueId = ".$_REQUEST['queueId'].";";
$result = mysql_query($query);
echo html_frame_start("Delete application data submission",400,"",0);
if(!$result)
{
//error
echo "Internal Error: unable to delete selected maintainer application!
\n";
}
else
{
//success
echo "Application data was successfully deleted from the Queue.
\n";
}
}
}
echo html_frame_end(" ");
echo html_back_link(1,'adminAppDataQueue.php');
apidb_footer();
?>