16
Update:
mainfile.php (in the XOOPS root) defines the constants XOOPS_URL and XOOPS_ROOT_PATH. Most people probably have a value in XOOPS_URL liks "/xoops/html". However, since I am using a test subdomain, which points directly to my xoops/html directory, my XOOPS_URL is '' (empty string). These problems are happening w/ newbb because XOOPS_URL is ''.
So, the problem is not exactly with the lines I pasted earlier, although that will fix the problem, too. The 'real' problem is the str_replace line just about the lines I pasted here.
The str_replace doesn't work when XOOPS_URL is empty. The newbb module is trying to provide a real pathname to file_exists() and getimagesize(), but the str_replace has no effect. Again, I think this will only cause problems when XOOPS_URL is ''.
Add some logic around your str_replace like this, and see if that works, too.
[in include/functions.php]
Quote:
.
.
.
$image .= '.'.$image_type;
// 2005-09-14: REH: added logic to test for XOOPS_URL. Without it, the str_replace has no effect when
// XOOPS_URL is empty.
if (XOOPS_URL != '') {
$imageuri=str_replace(XOOPS_URL,XOOPS_ROOT_PATH,$image);
} else {
$imageuri= XOOPS_ROOT_PATH.$image;
}
if(file_exists($imageuri)){
$size=@getimagesize($imageuri);
.
.
.
The file also has a snafu like this one. Look for the line:
Quote:
$indeximage_select->setExtra("onchange=\"showImgSelected('img', 'indeximage', '/".$imgdir."/', '', '" . XOOPS_URL . "')\"")
and replace that line with this:
Quote:
// 2005-09-14: REH: added logic to test for XOOPS_URL. Without it, the str_replace has no effect when
// XOOPS_URL is empty.
if (XOOPS_URL != '') {
$indeximage_select->setExtra("onchange=\"showImgSelected('img', 'indeximage', '/".$imgdir."/', '', '" . XOOPS_URL . "')\"")
;
} else {
$indeximage_select->setExtra("onchange=\"showImgSelected('img', 'indeximage', '/".$imgdir."/', '', '../../..')\"");
}
The magic is in that last line. Note: This only works for me since '../../..' gets me back to the XOOPS root from where I have this module installed. your mileage may vary. Hopefully the author can patch the module so we can get rid of my spaghetti code. .