[AppDB] fix situation when AppDB is not at DocumentRoot (patch 3
of 3)
Tony Lambregts
tony.lambregts at gmail.com
Sat Jul 23 21:25:24 CDT 2005
These patch are to meant address situations like mine when the AppDB is located
a http://localhost/appdb instead of http://localhost/. These patches can be
applied independatly from my other patches.
Change Log: fix situation when AppDB is not at DocumentRoot.
Files Changed: include/screenshot.php
-------------- next part --------------
Index: include/screenshot.php
===================================================================
RCS file: /home/wine/appdb/include/screenshot.php,v
retrieving revision 1.27
diff -u -r1.27 screenshot.php
--- include/screenshot.php 23 Jun 2005 03:00:10 -0000 1.27
+++ include/screenshot.php 23 Jul 2005 22:31:48 -0000
@@ -4,6 +4,10 @@
/******************************************/
require(BASE."include/image.php");
+// Offset of AppDB directory from DocumentRoot in httpd.config
+if (!defined("APPDB_OFFSET"))
+ define("APPDB_OFFSET","");
+
// load the watermark
$watermark = new image("/images/watermark.png");
@@ -134,7 +138,7 @@
{
$this->oScreenshotImage->delete();
$this->oThumbnailImage->delete();
- unlink($_SERVER['DOCUMENT_ROOT']."/data/screenshots/originals/".$this->iScreenshotId);
+ unlink($_SERVER['DOCUMENT_ROOT'].APPDB_OFFSET."/data/screenshots/originals/".$this->iScreenshotId);
if(!$bSilent)
$this->mailMaintainers(true);
}
@@ -208,7 +212,7 @@
}
$this->oThumbnailImage->make_thumb(0,0,1,'#000000');
// store the image
- $this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/thumbnails/".$this->sUrl);
+ $this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT'].APPDB_OFFSET."/data/screenshots/thumbnails/".$this->sUrl);
// now we'll process the screenshot image for watermarking
// load the screenshot
@@ -217,7 +221,7 @@
// resize the image
$this->oScreenshotImage->make_full();
// store the resized image
- $this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$this->sUrl);
+ $this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT'].APPDB_OFFSET."/data/screenshots/".$this->sUrl);
// reload the resized screenshot
$this->oScreenshotImage = new Image("/data/screenshots/".$this->sUrl);
if(!$this->oScreenshotImage->isLoaded()) return false;
@@ -225,7 +229,7 @@
// add the watermark to the screenshot
$this->oScreenshotImage->add_watermark($watermark->get_image_resource());
// store the watermarked image
- $this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$this->sUrl);
+ $this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT'].APPDB_OFFSET."/data/screenshots/".$this->sUrl);
return true;
}
@@ -321,7 +325,7 @@
}
if(!$hResult || !mysql_num_rows($hResult))
{
- $sImgFile = '<center><img src="'.BASE.'images/no_screenshot.png" alt="No Screenshot" /></center>';
+ $sImgFile = '<center><img src="'.APPDB_OFFSET.'images/no_screenshot.png" alt="No Screenshot" /></center>';
} else
{
$oRow = mysql_fetch_object($hResult);
More information about the wine-patches
mailing list