- displays an app screenshot gallery when one of the random screeshot is clicked

- tabs removed
- indentation fixed in screenshots.php
This commit is contained in:
Jonathan Ernst
2004-12-11 22:33:01 +00:00
committed by WineHQ
parent 2306c4be83
commit c4809941b3
2 changed files with 106 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
<?
<?php
/**********************************/
/* code to display an application */
/**********************************/
@@ -84,10 +84,7 @@ function get_screenshot_img($appId, $versionId="")
}
$img = html_frame_start("",'128','',2);
if($versionId)
$img .= "<a href='screenshots.php?appId=$appId&versionId=$versionId'>$imgFile</a>";
else
$img .= $imgFile;
$img .= html_frame_end()."<br />";
return $img;

View File

@@ -1,21 +1,17 @@
<?
<?php
/*******************************************************************/
/* this script expects appId and optionnaly versionId as arguments */
/* OR */
/* cmd and imageId */
/*******************************************************************/
/**
* APPLICATION ENVIRONMENT
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
/*=========================================================================
*
* this script expects appId and versionId as arguments
*
* OR
*
* cmd and imageId
*/
if($cmd)
{
if(havepriv("admin") || isMaintainer($appId, $versionId))
@@ -26,14 +22,14 @@ if($cmd)
if(!copy($imagefile, "data/screenshots/".$appId."-".$versionId."-".basename($imagefile_name)))
{
// whoops, copy failed. do something
errorpage('debug: copy failed; $imagefile; $imagefile_name');
errorpage("debug: copy failed; $imagefile; $imagefile_name");
exit;
}
$query = "INSERT INTO appData VALUES (null, $appId, $versionId, 'image', ".
"'".addslashes($screenshot_desc)."', '".$appId."-".$versionId."-".basename($imagefile_name)."')";
if(debugging()) { addmsg("<p align=center><b>query:</b> $query </p>",green); }
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>",green);
if (mysql_query($query))
{
@@ -49,7 +45,6 @@ if($cmd)
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
@@ -65,7 +60,6 @@ if($cmd)
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($statusMessage, "red");
}
} else
{
if($cmd == "delete")
@@ -93,7 +87,6 @@ if($cmd)
addmsg("Image deleted", "green");
redirect(apidb_fullurl("screenshots.php?appId=$appId&versionId=$versionId"));
} else
{
addmsg("Failed to delete image: ".mysql_error(), "red");
@@ -105,25 +98,39 @@ if($cmd)
exit;
}
if($_REQUEST['versionId'])
$result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = $appId AND versionId = $versionId");
else
$result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = $appId ORDER BY versionId");
if((!$result || !mysql_num_rows($result)) && (!havepriv("admin") && !isMaintainer($appId, $versionId)))
{
errorpage("No Screenshots Found","There are no screenshots currently linked to this application.");
exit;
}
else
} else
{
$app=new Application($appId);
apidb_header("Screenshots");
if($result && mysql_num_rows($result))
{
echo html_frame_start("Screenshot Gallery",500);
echo html_frame_start("Screenshot Gallery for ".$app->data->appName,500);
// display thumbnails
$c = 1;
echo "<div align=center><table><tr>\n";
while($ob = mysql_fetch_object($result))
{
if(!$_REQUEST['versionId'] && $ob->versionId!=$currentVersionId)
{
if($currentVersionId)
{
echo "</tr></table></div>\n";
echo html_frame_end();
}
$currentVersionId=$ob->versionId;
echo html_frame_start("Version ".$app->getAppVersion($ob->versionId)->versionName);
echo "<div align=center><table><tr>\n";
}
// set img tag
$imgSRC = '<img src="appimage.php?imageId='.$ob->id.'&width=128&height=128" border=0 alt="'.$ob->description.'">';
@@ -158,16 +165,16 @@ else
echo "</td>\n";
// end row if counter of 3
if ($c % 3 == 0) { echo "</tr><tr>\n"; }
if ($c % 3 == 0) echo "</tr><tr>\n";
$c++;
}
echo "</tr></table></div><br>\n";
echo html_frame_end("Click thumbnail to view image in new window.");
}
if(havepriv("admin") || isMaintainer($appId, $versionId))
if((havepriv("admin") || isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))
&& $_REQUEST['versionId'])
{
//image upload box
echo '<form enctype="multipart/form-data" action="screenshots.php" name=imageForm method="post">',"\n";