Implemented the user friendly screenshot submitting feature

This commit is contained in:
Jonathan Ernst
2004-12-18 06:06:46 +00:00
committed by WineHQ
parent c89531e4c1
commit a8ba02e76d
7 changed files with 485 additions and 156 deletions

242
admin/adminAppDataQueue.php Normal file
View File

@@ -0,0 +1,242 @@
<?php
/********************************************************/
/* code to view and approve new application data */
/********************************************************/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
apidb_header("Admin Application Data Queue");
// deny access if not logged in
if(!loggedin())
{
errorpage("You need to be logged in to use this page.");
exit;
}
// shows the list of appdata in queue
if (!$_REQUEST['queueId'])
{
//get available appData
$query = "SELECT queueId, queueappId, queueversionId,".
"queuetype, queuedescription,".
"queueurl,queuecontent,queueuserId,".
"UNIX_TIMESTAMP(submitTime) as submitTime ".
"from appDataQueue;";
$result = mysql_query($query);
if(!$result || !mysql_num_rows($result))
{
//no appData in queue
echo html_frame_start("","90%");
echo '<p><b>The App Data Queue is empty.</b></p>',"\n";
echo '<p>There is nothing for you to do. Check back later.</p>',"\n";
echo html_frame_end("&nbsp;");
}
else
{
//help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "<p>This is a list of app data submitted by users.\n";
echo "Please inspect carefully these data before to accept it.\n";
echo "</td></tr></table></div>\n\n";
//show applist
echo html_frame_start("","90%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
echo "<tr class=color4>\n";
echo " <td><font color=white>Submission Date</font></td>\n";
echo " <td><font color=white>Queue Id</font></td>\n";
echo " <td><font color=white>Username (e-mail)</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>Type</font></td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
{
if(isMaintainer($ob->queueappId,$ob->queueversionId) || havepriv("admin")) {
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n";
echo " <td><a href='adminAppDataQueue.php?queueId=$ob->queueId'>$ob->queueId</a></td>\n";
if($ob->queueuserId)
echo " <td>".lookupUsername($ob->queueuserId)." (".lookupEmail($ob->queueuserId).")</td>\n";
else
echo " <td>Anonymous</td>\n";
echo "<td>".appIdToName($ob->queueappId)."</td>\n";
echo "<td>".versionIdToName($ob->queueversionId)."</td>\n";
echo "<td>".$ob->queuetype."</td>\n";
echo "</tr>\n\n";
$c++;
}
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
} else // shows a particular appdata
{
if(!(havepriv("admin") || isMaintainer($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 '<form name="qform" action="adminAppDataQueue.php" method="get">',"\n";
// help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "Please enter an accurate and personalized reply anytime a submitted scrrenshot is rejected.\n";
echo "It is not polite to reject someones attempt at trying to help out without explaining why.\n";
echo "</td></tr></table></div>\n\n";
// view application details
echo html_frame_start("New Application Data Form",600,"",0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
// app name
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
echo "<td>".appIdToName($obj_row->queueappId)."</td></tr>\n";
// version
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
echo "<td>".versionIdToName($obj_row->queueversionId)."</td></tr>\n";
//dataDescription
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
echo '<td><textarea name="description" rows=10 cols=35>'.stripslashes($obj_row->queuedescription).'</textarea></td></tr>',"\n";
//data
if($obj_row->queuetype == "image")
{
$tmpfname = rand()."screenshotQueue".$obj_row->queueId;
$handle = fopen("../data/screenshots/".$tmpfname, "wb");
fwrite($handle, $obj_row->queuecontent);
fclose($handle);
echo '<tr valign=top><td class=color0><b>Submited image</b></td>',"\n";
echo '<td><img src="screenshotQueue.php?file='.$tmpfname.'" title="'.stripslashes($obj_row->queueurl).'" /></td></tr>',"\n";
} elseif($obj_row->queuetype == "url")
{
echo '<tr valign=top><td class=color0><b>Submitted link</b></td>',"\n";
echo '<td><textarea name="content" rows=10 cols=35>'.stripslashes($obj_row->queueurl).'</textarea></td></tr>',"\n";
}
//email response
echo '<tr valign=top><td class=color0><b>Email reply</b></td>',"\n";
echo "<td><textarea name='replyText' rows=10 cols=35>Enter a personalized reason for acceptance or rejection of the submitted application data here</textarea></td></tr>\n";
/* Add button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
echo '<input type=submit name=add value=" Add data to this application " class=button /> </td></tr>',"\n";
/* Reject button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
echo '<input type=submit name=reject value=" Reject this request " class=button /></td></tr>',"\n";
echo '</table>',"\n";
echo '<input type=hidden name="sub" value="inside_form" />',"\n";
echo '<input type=hidden name="queueId" value="'.$_REQUEST['queueId'].'" />',"\n";
echo '</form>';
} 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("<p align=center><b>query:</b> $query </p>","green");
if (mysql_query($query))
{
$statusMessage = "<p>The application data was successfully added into the database</p>\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 = "<p><b>Database Error!<br>".mysql_error()."</b></p>\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 "<p><b>$statusMessage</b></p>\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 "<p>Internal Error: unable to delete selected maintainer application!</p>\n";
}
else
{
//success
echo "<p>Application data was successfully deleted from the Queue.</p>\n";
}
}
}
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminAppDataQueue.php');
apidb_footer();
?>

16
admin/screenshotQueue.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
/************************************************/
/* code to show an image stored in mysql */
/************************************************/
include("path.php");
require(BASE."include/"."incl.php");
if($info=getimagesize("../data/screenshots/".$_REQUEST['file']))
{
header('Content-type: '.$info['mime']);
$handle = fopen("../data/screenshots/".$_REQUEST['file'], "rb");
echo fread($handle, filesize("../data/screenshots/".$_REQUEST['file']));
fclose($handle);
}
unlink("../data/screenshots/".$_REQUEST['file']);
?>

View File

@@ -16,6 +16,7 @@ function global_admin_menu() {
$g->addmisc("&nbsp;"); $g->addmisc("&nbsp;");
$g->add("List Users", $apidb_root."admin/"); $g->add("List Users", $apidb_root."admin/");
$g->add("View App Queue (".getQueuedAppCount().")", $apidb_root."admin/adminAppQueue.php"); $g->add("View App Queue (".getQueuedAppCount().")", $apidb_root."admin/adminAppQueue.php");
$g->add("View App Data Queue (".getQueuedAppDataCount().")", $apidb_root."admin/adminAppDataQueue.php");
$g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", $apidb_root."admin/adminMaintainerQueue.php"); $g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", $apidb_root."admin/adminMaintainerQueue.php");
$g->add("View Maintainers (".getMaintainerCount().")", $apidb_root."admin/adminMaintainers.php"); $g->add("View Maintainers (".getMaintainerCount().")", $apidb_root."admin/adminMaintainers.php");

View File

@@ -242,6 +242,15 @@ function getQueuedAppCount()
return $ob->queued_apps; return $ob->queued_apps;
} }
/* get the number of applications in the appQueue table */
function getQueuedAppDataCount()
{
$qstring = "SELECT count(*) as queued_appdata FROM appDataQueue";
$result = mysql_query($qstring);
$ob = mysql_fetch_object($result);
return $ob->queued_appdata;
}
/* get the number of applications in the appQueue table */ /* get the number of applications in the appQueue table */
function getQueuedMaintainerCount() function getQueuedMaintainerCount()
{ {

View File

@@ -33,7 +33,10 @@ are logged in. Some of the benefits of membership are:<p>
stomping out Wine issues will be greatly appreciated.</p> stomping out Wine issues will be greatly appreciated.</p>
<p> <p>
If you have anything to contribute (screenshots, howtos), contact us at: If you have screenshots or links to contribute, please browse the database and use the AppDB interface to send us your contributions.
</p>
<p>
If you have anything else to contribute (howtos, etc.), contact us at:
<a href="mailto:appdb@winehq.org">appdb@winehq.org</a><br /> <a href="mailto:appdb@winehq.org">appdb@winehq.org</a><br />
Note that this address is not for end-user support, for end user support please contact the Note that this address is not for end-user support, for end user support please contact the
wine-users mailing list or the wine newsgroup, for more information visit wine-users mailing list or the wine newsgroup, for more information visit

View File

@@ -14,189 +14,226 @@ require(BASE."include/"."application.php");
if($_REQUEST['cmd']) if($_REQUEST['cmd'])
{ {
if(havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))
{
//process screenshot upload //process screenshot upload
if($_REQUEST['cmd'] == "screenshot_upload") if($_REQUEST['cmd'] == "screenshot_upload")
{ {
if(!copy($_FILES['imagefile']['tmp_name'], "data/screenshots/".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name']))) if(havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))
{ {
// whoops, copy failed. do something if(!copy($_FILES['imagefile']['tmp_name'], "data/screenshots/".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])))
errorpage("debug: copy failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
exit;
}
$query = "INSERT INTO appData VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].", 'image', ".
"'".addslashes($_REQUEST['screenshot_desc'])."', '".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])."')";
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>",green);
if (mysql_query($query))
{
//success
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
{ {
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']); // whoops, copy failed. do something
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n"; errorpage("debug: copy failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
$ms .= "\n"; exit;
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added screenshot ".$_REQUEST['screenshot_desc']." to ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
} }
addmsg("mesage sent to: ".$email, green);
addmsg("The image was successfully added into the database", "green"); $query = "INSERT INTO appData VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].", 'image', ".
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'])); "'".addslashes($_REQUEST['screenshot_desc'])."', '".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])."')";
}
else if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>","green");
{
//error if (mysql_query($query))
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n"; {
addmsg($statusMessage, "red"); //success
} $email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
} else if($email)
{
if($_REQUEST['cmd'] == "delete")
{
$result = mysql_query("DELETE FROM appData WHERE id = ".$_REQUEST['imageId']);
if($result)
{ {
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']); $fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
if($email) $ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
{ $ms .= "\n";
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']); $ms .= $_SESSION['current']->username." added screenshot ".$_REQUEST['screenshot_desc']." to ".$fullAppName."\n";
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n"; $ms .= "\n";
$ms .= "\n"; $ms .= STANDARD_NOTIFY_FOOTER;
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted screenshot from ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
{
$email = "no one";
}
addmsg("mesage sent to: ".$email, green);
addmsg("Image deleted", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
} else } else
{ {
addmsg("Failed to delete image: ".mysql_error(), "red"); $email = "no one";
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
} }
addmsg("mesage sent to: ".$email, "green");
addmsg("The image was successfully added into the database", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
} }
} else
} {
//error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($statusMessage, "red");
}
} else // we are a normal user or an anonymous and submitted a screenshot
{
if(!$str_data = addslashes(fread(fopen($_FILES['imagefile']['tmp_name'], "rb"), filesize($_FILES['imagefile']['tmp_name']))))
{
// whoops, copy failed. do something
errorpage("debug: reading of file failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
exit;
}
$str_query = "INSERT INTO appDataQueue VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].", 'image', ".
"'".addslashes($_REQUEST['screenshot_desc'])."', '".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])."', '$str_data', '".$_SESSION['current']->userid."', NOW())";
if(debugging()) addmsg("<p align=center><b>query:</b> $str_query </p>","green");
if (mysql_query($str_query))
{
//success
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."admin/adminAppDataQueue.php?queueId=".mysql_insert_id()."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "an anonymous user")." submitted a screenshot ".$_REQUEST['screenshot_desc']." for ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
}
addmsg("mesage sent to: ".$email, "green");
addmsg("The image you submitted will be added to the database database after being reviewed", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}
else
{
//error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($statusMessage, "red");
}
}
} elseif($_REQUEST['cmd'] == "delete")
{
if(havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))
{
$result = mysql_query("DELETE FROM appData WHERE id = ".$_REQUEST['imageId']);
if($result)
{
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted screenshot from ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
}
addmsg("mesage sent to: ".$email, "green");
addmsg("Image deleted", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
} else
{
addmsg("Failed to delete image: ".mysql_error(), "red");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}
}
}
exit; exit;
} }
// we didn't issue any command
if($_REQUEST['versionId']) if($_REQUEST['versionId'])
$result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = ".$_REQUEST['appId']." AND versionId = ".$_REQUEST['versionId']); $result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = ".$_REQUEST['appId']." AND versionId = ".$_REQUEST['versionId']);
else else
$result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = ".$_REQUEST['appId']." ORDER BY versionId"); $result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = ".$_REQUEST['appId']." ORDER BY versionId");
if((!$result || !mysql_num_rows($result)) && (!havepriv("admin") && !isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))) $app=new Application($_REQUEST['appId']);
apidb_header("Screenshots");
if($result && mysql_num_rows($result))
{ {
errorpage("No Screenshots Found","There are no screenshots currently linked to this application."); echo html_frame_start("Screenshot Gallery for ".$app->data->appName,500);
exit;
} else
{
$app=new Application($_REQUEST['appId']);
apidb_header("Screenshots");
if($result && mysql_num_rows($result))
{
echo html_frame_start("Screenshot Gallery for ".$app->data->appName,500);
// display thumbnails // display thumbnails
$c = 1; $c = 1;
echo "<div align=center><table><tr>\n"; echo "<div align=center><table><tr>\n";
while($ob = mysql_fetch_object($result)) while($ob = mysql_fetch_object($result))
{
if(!$_REQUEST['versionId'] && $ob->versionId!=$currentVersionId)
{ {
if(!$_REQUEST['versionId'] && $ob->versionId!=$currentVersionId) if($currentVersionId)
{ {
if($currentVersionId) echo "</tr></table></div>\n";
{ echo html_frame_end();
echo "</tr></table></div>\n"; $c=1;
echo html_frame_end();
}
$currentVersionId=$ob->versionId;
echo html_frame_start("Version ".lookupVersionName($_REQUEST['appId'], $currentVersionId));
echo "<div align=center><table><tr>\n";
} }
// set img tag $currentVersionId=$ob->versionId;
$imgSRC = '<img src="appimage.php?imageId='.$ob->id.'&width=128&height=128" alt="'.$ob->description.'">'; echo html_frame_start("Version ".lookupVersionName($_REQUEST['appId'], $currentVersionId));
echo "<div align=center><table><tr>\n";
// get image size
$size = getimagesize("data/screenshots/".$ob->url);
// generate random tag for popup window
$randName = generate_passwd(5);
// set image link based on user pref
$img = '<a href="javascript:openWin(\'appimage.php?imageId='.$ob->id.'\',\''.$randName.'\','.$size[0].','.$size[1].');">'.$imgSRC.'</a>';
if (loggedin())
{
if ($_SESSION['current']->getpref("window:screenshot") == "no")
{
$img = '<a href="appimage.php?imageId='.$ob->id.'">'.$imgSRC.'</a>';
}
}
// display image
echo "<td>\n";
echo html_frame_start(substr(stripslashes($ob->description),0,20),128,"",0);
echo $img;
//show admin delete link
if(loggedin() && (havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId'])))
{
echo "<div align=center>[<a href='screenshots.php?cmd=delete&imageId=$ob->id&appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."'>Delete Image</a>]</div>";
}
echo html_frame_end("&nbsp;");
echo "</td>\n";
// end row if counter of 3
if ($c % 3 == 0) echo "</tr><tr>\n";
$c++;
} }
echo "</tr></table></div><br>\n"; // set img tag
$imgSRC = '<img src="appimage.php?imageId='.$ob->id.'&width=128&height=128" border=0 alt="'.$ob->description.'">';
// get image size
$size = getimagesize("data/screenshots/".$ob->url);
echo html_frame_end("Click thumbnail to view image in new window."); // generate random tag for popup window
$randName = generate_passwd(5);
// set image link based on user pref
$img = '<a href="javascript:openWin(\'appimage.php?imageId='.$ob->id.'\',\''.$randName.'\','.$size[0].','.$size[1].');">'.$imgSRC.'</a>';
if (loggedin())
{
if ($_SESSION['current']->getpref("window:screenshot") == "no")
{
$img = '<a href="appimage.php?imageId='.$ob->id.'">'.$imgSRC.'</a>';
}
}
// display image
echo "<td>\n";
echo html_frame_start(substr(stripslashes($ob->description),0,20),128,"",0);
echo $img;
//show admin delete link
if(loggedin() && (havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId'])))
{
echo "<div align=center>[<a href='screenshots.php?cmd=delete&imageId=$ob->id&appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."'>Delete Image</a>]</div>";
}
echo html_frame_end("&nbsp;");
echo "</td>\n";
// end row if counter of 3
if ($c % 3 == 0) echo "</tr><tr>\n";
$c++;
} }
if((havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId'])) echo "</tr></table></div><br>\n";
&& $_REQUEST['versionId'])
{
//image upload box
echo '<form enctype="multipart/form-data" action="screenshots.php" name=imageForm method="post">',"\n";
echo html_frame_start("Upload Screenshot","400","",0);
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
echo '<tr><td class=color1>Image</td><td class=color0><input name="imagefile" type="file"></td></tr>',"\n";
echo '<tr><td class=color1>Description</td><td class=color0><input type="text" name="screenshot_desc"></td></tr>',"\n";
echo '<tr><td colspan=2 align=center class=color3><input type="submit" value="Send File"></td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo '<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />',"\n";
echo '<input type="hidden" name="cmd" value="screenshot_upload" />',"\n";
echo '<input type="hidden" name="appId" value="'.$_REQUEST['appId'].'" />',"\n";
echo '<input type="hidden" name="versionId" value="'.$_REQUEST['versionId'].'"></form />',"\n";
}
echo html_back_link(1);
apidb_footer();
echo html_frame_end("Click thumbnail to view image in new window.");
} else {
echo "<p align=\"center\">There are currently no screenshot for the selected version of this application.";
echo "<br />Please consider submitting a screenshot for the selected version yourself.</p>";
} }
if($_REQUEST['versionId'])
{
//image upload box
echo '<form enctype="multipart/form-data" action="screenshots.php" name=imageForm method="post">',"\n";
echo html_frame_start("Upload Screenshot","400","",0);
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
echo '<tr><td class=color1>Image</td><td class=color0><input name="imagefile" type="file"></td></tr>',"\n";
echo '<tr><td class=color1>Description</td><td class=color0><input type="text" name="screenshot_desc"></td></tr>',"\n";
echo '<tr><td colspan=2 align=center class=color3><input type="submit" value="Send File"></td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo '<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />',"\n";
echo '<input type="hidden" name="cmd" value="screenshot_upload" />',"\n";
echo '<input type="hidden" name="appId" value="'.$_REQUEST['appId'].'" />',"\n";
echo '<input type="hidden" name="versionId" value="'.$_REQUEST['versionId'].'"></form />',"\n";
}
echo html_back_link(1);
apidb_footer();
?> ?>

View File

@@ -13,6 +13,7 @@ drop table if exists catHitStats;
drop table if exists appOwners; drop table if exists appOwners;
drop table if exists appComments; drop table if exists appComments;
drop table if exists appData; drop table if exists appData;
drop table if exists appDataQueue;
drop table if exists appQueue; drop table if exists appQueue;
drop table if exists appCrosslink; drop table if exists appCrosslink;
drop table if exists appBundle; drop table if exists appBundle;
@@ -201,6 +202,26 @@ create table appData (
); );
/*
* links to screenshots and other stuff waiting to be accepted
*/
create table appDataQueue (
queueid int not null auto_increment,
queueappId int not null,
queueversionId int default 0,
queuetype enum('image', 'url'),
queuedescription text,
queueurl varchar(255),
queuecontent longblob,
queueuserId int not null,
submitTime timestamp,
key(queueid),
index(queueappId),
index(queueversionId)
);
/* /*
* allow users to vote for apps, as in, request that an app gets better support * allow users to vote for apps, as in, request that an app gets better support
*/ */