diff --git a/appview.php b/appview.php
index b1fb693..42773f1 100644
--- a/appview.php
+++ b/appview.php
@@ -1,4 +1,4 @@
-
+$imgFile";
- else
- $img .= $imgFile;
+ $img .= "$imgFile";
$img .= html_frame_end()."
";
return $img;
@@ -640,4 +637,4 @@ else if($appId && $versionId)
apidb_footer();
-?>
\ No newline at end of file
+?>
diff --git a/screenshots.php b/screenshots.php
index e21462e..9b309ab 100644
--- a/screenshots.php
+++ b/screenshots.php
@@ -1,77 +1,71 @@
-
+query: $query
",green); }
-
- if (mysql_query($query))
- {
- //success
- $email = getNotifyEmailAddressList($appId, $versionId);
- if($email)
- {
- $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
- $ms .= APPDB_ROOT."screenshots.php?appId=$appId&versionId=$versionId"."\n";
- $ms .= "\n";
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added screenshot ".$screenshot_desc." to ".$fullAppName."\n";
- $ms .= "\n";
- $ms .= STANDARD_NOTIFY_FOOTER;
+ {
+ if(!copy($imagefile, "data/screenshots/".$appId."-".$versionId."-".basename($imagefile_name)))
+ {
+ // whoops, copy failed. do something
+ errorpage("debug: copy failed; $imagefile; $imagefile_name");
+ exit;
+ }
- mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
+ $query = "INSERT INTO appData VALUES (null, $appId, $versionId, 'image', ".
+ "'".addslashes($screenshot_desc)."', '".$appId."-".$versionId."-".basename($imagefile_name)."')";
- } else
- {
+ if(debugging()) addmsg("query: $query
",green);
+
+ if (mysql_query($query))
+ {
+ //success
+ $email = getNotifyEmailAddressList($appId, $versionId);
+ if($email)
+ {
+ $fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
+ $ms .= APPDB_ROOT."screenshots.php?appId=$appId&versionId=$versionId"."\n";
+ $ms .= "\n";
+ $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added screenshot ".$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("mesage sent to: ".$email, green);
- addmsg("The image was successfully added into the database", "green");
- redirect(apidb_fullurl("screenshots.php?appId=$appId&versionId=$versionId"));
- }
- else
- {
- //error
- $statusMessage = "Database Error!
".mysql_error()."
\n";
- addmsg($statusMessage, "red");
- }
-
- } else
- {
- if($cmd == "delete")
- {
- $result = mysql_query("DELETE FROM appData WHERE id = $imageId");
- if($result)
+ addmsg("The image was successfully added into the database", "green");
+ redirect(apidb_fullurl("screenshots.php?appId=$appId&versionId=$versionId"));
+ }
+ else
+ {
+ //error
+ $statusMessage = "Database Error!
".mysql_error()."
\n";
+ addmsg($statusMessage, "red");
+ }
+ } else
+ {
+ if($cmd == "delete")
+ {
+ $result = mysql_query("DELETE FROM appData WHERE id = $imageId");
+ if($result)
{
$email = getNotifyEmailAddressList($appId, $versionId);
if($email)
@@ -93,81 +87,94 @@ if($cmd)
addmsg("Image deleted", "green");
redirect(apidb_fullurl("screenshots.php?appId=$appId&versionId=$versionId"));
-
} else
{
addmsg("Failed to delete image: ".mysql_error(), "red");
redirect(apidb_fullurl("screenshots.php?appId=$appId&versionId=$versionId"));
}
- }
- }
+ }
+ }
}
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 "\n";
while($ob = mysql_fetch_object($result))
{
- //set img tag
- $imgSRC = '
';
-
- //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 = ''.$imgSRC.'';
- if (loggedin())
- {
- if ($_SESSION['current']->getpref("window:screenshot") == "no")
- {
- $img = ''.$imgSRC.'';
- }
- }
-
- //display image
- echo "\n";
+ if(!$_REQUEST['versionId'] && $ob->versionId!=$currentVersionId)
+ {
+ if($currentVersionId)
+ {
+ echo " |
\n";
+ echo html_frame_end();
+ }
+ $currentVersionId=$ob->versionId;
+ echo html_frame_start("Version ".$app->getAppVersion($ob->versionId)->versionName);
+ echo "\n";
+ }
+ // set img tag
+ $imgSRC = '
';
+
+ // 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 = ''.$imgSRC.'';
+ if (loggedin())
+ {
+ if ($_SESSION['current']->getpref("window:screenshot") == "no")
+ {
+ $img = ''.$imgSRC.'';
+ }
+ }
+
+ // display image
+ echo "\n";
echo html_frame_start(substr(stripslashes($ob->description),0,20),128,"",0);
echo $img;
-
+
//show admin delete link
if(loggedin() && (havepriv("admin") || isMaintainer($appId, $versionId)))
{
echo "";
}
-
+
echo html_frame_end(" ");
echo " | \n";
-
- //end row if counter of 3
- if ($c % 3 == 0) { echo "
\n"; }
-
+
+ // end row if counter of 3
+ if ($c % 3 == 0) echo "
\n";
+
$c++;
}
echo "
\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 '