- 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:
@@ -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;
|
||||
|
||||
@@ -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,35 +98,49 @@ if($cmd)
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = mysql_query("SELECT * FROM appData WHERE type = 'image' AND appId = $appId AND versionId = $versionId");
|
||||
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))
|
||||
{
|
||||
//set img tag
|
||||
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.'">';
|
||||
|
||||
//get image size
|
||||
// get image size
|
||||
$size = getimagesize("data/screenshots/".$ob->url);
|
||||
|
||||
//generate random tag for popup window
|
||||
// generate random tag for popup window
|
||||
$randName = generate_passwd(5);
|
||||
|
||||
//set image link based on user pref
|
||||
// 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())
|
||||
{
|
||||
@@ -143,7 +150,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
//display image
|
||||
// display image
|
||||
echo "<td>\n";
|
||||
echo html_frame_start(substr(stripslashes($ob->description),0,20),128,"",0);
|
||||
echo $img;
|
||||
@@ -157,17 +164,17 @@ else
|
||||
echo html_frame_end(" ");
|
||||
echo "</td>\n";
|
||||
|
||||
//end row if counter of 3
|
||||
if ($c % 3 == 0) { echo "</tr><tr>\n"; }
|
||||
// end row if counter of 3
|
||||
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";
|
||||
|
||||
Reference in New Issue
Block a user