- removed get_screenshot_img() function definition from appview.php
- removed get_screenshot_img() function definition from bugs.php - created include/screenshot.php which contains removed get_screenshot_img() function definition
This commit is contained in:
38
appview.php
38
appview.php
@@ -15,7 +15,7 @@ require(BASE."include/"."appdb.php");
|
||||
require(BASE."include/"."vote.php");
|
||||
require(BASE."include/"."rating.php");
|
||||
require(BASE."include/"."category.php");
|
||||
|
||||
require(BASE."include/"."screenshot.php");
|
||||
require(BASE."include/"."maintainer.php");
|
||||
|
||||
|
||||
@@ -54,42 +54,6 @@ function admin_menu()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a random image for a particular version of an app.
|
||||
* If the version is not set, get a random app image
|
||||
*/
|
||||
function get_screenshot_img($appId, $versionId="")
|
||||
{
|
||||
if($versionId)
|
||||
{
|
||||
$result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image' ORDER BY rand");
|
||||
}
|
||||
else {
|
||||
$result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND type = 'image' ORDER BY rand");
|
||||
}
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
$imgFile = "<img src='".BASE."images/no_screenshot.gif' alt='No Screenshot' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ob = mysql_fetch_object($result);
|
||||
$imgFile = "<img src='appimage.php?imageId=$ob->id&width=128&height=128' ".
|
||||
"alt='$ob->description' />";
|
||||
}
|
||||
|
||||
$img = html_frame_start("",'128','',2);
|
||||
if($versionId || mysql_num_rows($result))
|
||||
$img .= "<a href='screenshots.php?appId=$appId&versionId=$versionId'>$imgFile</a>";
|
||||
else // no link for adding app screenshot as screenshots are linked to versions
|
||||
$img .= $imgFile;
|
||||
$img .= html_frame_end()."<br />";
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: what does it do ?
|
||||
*/
|
||||
|
||||
28
bugs.php
28
bugs.php
@@ -11,37 +11,11 @@ require(BASE."include/"."incl.php");
|
||||
require(BASE."include/"."application.php");
|
||||
require(BASE."include/"."comments.php");
|
||||
require(BASE."include/"."appdb.php");
|
||||
|
||||
require(BASE."include/"."screenshot.php");
|
||||
require(BASE."include/"."rating.php");
|
||||
require(BASE."include/"."category.php");
|
||||
|
||||
|
||||
function get_screenshot_img($appId, $versionId)
|
||||
{
|
||||
if(!$versionId)
|
||||
$versionId = 0;
|
||||
|
||||
$result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image'");
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
$imgFile = "<img src='".BASE."images/no_screenshot.gif' alt='No Screenshot'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ob = mysql_fetch_object($result);
|
||||
$imgFile = "<img src='appimage.php?appId=$appId&versionId=$versionId&width=128&height=128' ".
|
||||
"alt='$ob->description'>";
|
||||
}
|
||||
|
||||
$img = html_frame_start("",'128','',2);
|
||||
$img .= "<a href='screenshots.php?appId=$appId&versionId=$versionId'>$imgFile</a>";
|
||||
$img .= html_frame_end()."<br>";
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
|
||||
function display_catpath($catId, $appId, $versionId = '')
|
||||
{
|
||||
$cat = new Category($catId);
|
||||
|
||||
40
include/screenshot.php
Normal file
40
include/screenshot.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/********************************/
|
||||
/* screenshot related functions */
|
||||
/********************************/
|
||||
|
||||
/**
|
||||
* Get a random image for a particular version of an app.
|
||||
* If the version is not set, get a random app image
|
||||
*/
|
||||
function get_screenshot_img($appId, $versionId="")
|
||||
{
|
||||
if($versionId)
|
||||
{
|
||||
$result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image' ORDER BY rand");
|
||||
}
|
||||
else {
|
||||
$result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND type = 'image' ORDER BY rand");
|
||||
}
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
$imgFile = "<img src='".BASE."images/no_screenshot.gif' alt='No Screenshot' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ob = mysql_fetch_object($result);
|
||||
$imgFile = "<img src='appimage.php?imageId=$ob->id&width=128&height=128' ".
|
||||
"alt='$ob->description' />";
|
||||
}
|
||||
|
||||
$img = html_frame_start("",'128','',2);
|
||||
if($versionId || mysql_num_rows($result))
|
||||
$img .= "<a href='screenshots.php?appId=$appId&versionId=$versionId'>$imgFile</a>";
|
||||
else // no link for adding app screenshot as screenshots are linked to versions
|
||||
$img .= $imgFile;
|
||||
$img .= html_frame_end()."<br />";
|
||||
|
||||
return $img;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user