From 9bad35ad0a02364783b85d54028b22ec0c0e44bf Mon Sep 17 00:00:00 2001 From: Jonathan Ernst Date: Sat, 25 Dec 2004 20:23:10 +0000 Subject: [PATCH] - 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 --- appview.php | 38 +------------------------------------- bugs.php | 28 +--------------------------- include/screenshot.php | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 64 deletions(-) create mode 100644 include/screenshot.php diff --git a/appview.php b/appview.php index ca8cf1b..bfd8eef 100644 --- a/appview.php +++ b/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 = "No Screenshot"; - } - else - { - $ob = mysql_fetch_object($result); - $imgFile = ""; - } - - $img = html_frame_start("",'128','',2); - if($versionId || mysql_num_rows($result)) - $img .= "$imgFile"; - else // no link for adding app screenshot as screenshots are linked to versions - $img .= $imgFile; - $img .= html_frame_end()."
"; - - return $img; -} - - /** * TODO: what does it do ? */ diff --git a/bugs.php b/bugs.php index a7ef631..990da8b 100644 --- a/bugs.php +++ b/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 = "No Screenshot"; - } - else - { - $ob = mysql_fetch_object($result); - $imgFile = ""; - } - - $img = html_frame_start("",'128','',2); - $img .= "$imgFile"; - $img .= html_frame_end()."
"; - - return $img; -} - - function display_catpath($catId, $appId, $versionId = '') { $cat = new Category($catId); diff --git a/include/screenshot.php b/include/screenshot.php new file mode 100644 index 0000000..3f70303 --- /dev/null +++ b/include/screenshot.php @@ -0,0 +1,40 @@ +"; + } + else + { + $ob = mysql_fetch_object($result); + $imgFile = ""; + } + + $img = html_frame_start("",'128','',2); + if($versionId || mysql_num_rows($result)) + $img .= "$imgFile"; + else // no link for adding app screenshot as screenshots are linked to versions + $img .= $imgFile; + $img .= html_frame_end()."
"; + + return $img; +} +?>