Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#130 UPLOAD_DIR hack

open
nobody
5
2014-02-16
2005-09-12
batdevis
No

Replace the string {X_SITEURL} with the site url in ALL
submitted forms,
like in blocks editing.
With this hack you don't have to change all the [img]
tags inserted with the image manager
when you change the url of you site (ex from
http://localhost/testsite to http://www.yourlivesite.com ).
(See
http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=39095&forum=27&post_id=181059#forumpost181059)

ATTENTION:
This hack was tested on xoops 2.0.13.1
NOT TESTED ON XOOPS 2.2*

INSTALLATION
- method 01:
unpack the file in your XOOPS_ROOT_PATH
- method 02:
manually copy the changes.
You must choose this way if you have apply other hacks
(ex multilanguage)
on file /imagemanager.php, /include/common.php, or
/class/module.textsanitizer.php .
Here's the code changes:

-------------------------------------------------------------------------
/imagemanager.php   line 107:
-------------------------------------------------------------------------
/*
$lcode = '[img

align=left]'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$code =
'[img]'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$rcode = '[img
align=right]
'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
*/
$lcode = '[img
align=left]
'."{X_SITEURL}".'/'.XOOPS_UPLOAD_DIR.'/'.$images[$i]->getVar('image_name').'[/img]';
$code =
'[img]'."{X_SITEURL}".'/'.XOOPS_UPLOAD_DIR.'/'.$images[$i]->getVar('image_name').'[/img]';
$rcode = '[img
align=right]
'."{X_SITEURL}".'/'.XOOPS_UPLOAD_DIR.'/'.$images[$i]->getVar('image_name').'[/img]';

-------------------------------------------------------------------------
/include/common.php line 59:
-------------------------------------------------------------------------
define("XOOPS_UPLOAD_DIR", "uploads");
//define("XOOPS_UPLOAD_PATH", XOOPS_ROOT_PATH."/uploads");
define("XOOPS_UPLOAD_PATH",

XOOPS_ROOT_PATH."/".XOOPS_UPLOAD_DIR);

-------------------------------------------------------------------------
/class/module.textsanitizer.php line 204:
-------------------------------------------------------------------------
$patterns[] = "{{X_SITEURL}}";
$replacements[] = XOOPS_URL;

Discussion

  • batdevis
    batdevis
    2005-09-12

    UPLOAD_DIR hack