Hi Mithrandir,
Please find hereafter:
- a summary of what have to be modified in common.php, cp_header.php, functions.php and checklogin.php (even this was already explained in my previous posts
)
- a short list of recommendations for module developpers
Core file modifications1. XOOPS_ROOT_PATH/include/common.php - around line 236 (Xoops 2.0.5.2)Replace
Quote:
$url_arr = explode('/', str_replace(str_replace('https://', 'http://', XOOPS_URL.'/modules/'), '', 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'].$xoopsRequestUri));
by
Quote:
$url_arr = explode('/',strstr($xoopsRequestUri,'/modules/'));
... and modify the line 1 line after
Quote:
$xoopsModule =& $module_handler->getByDirname($url_arr[2]);
2. XOOPS_ROOT_PATH/include/cp_header.php - around line 9 (Xoops 2.0.5.2)Replace
Quote:
$url_arr = explode('/', str_replace(str_replace('https://', 'http://', XOOPS_URL.'/modules/'), '', 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'].$xoopsRequestUri));
by
Quote:
$url_arr = explode('/',strstr($xoopsRequestUri,'/modules/'));
... and modify the line 1 line after
Quote:
$xoopsModule =& $module_handler->getByDirname($url_arr[2]);
3. XOOPS_ROOT_PATH/include/functions.php - around line 137 (Xoops 2.0.5.2)Modify the xoops_refcheck function
Quote:
function xoops_refcheck($docheck=1)
{
$ref = stristr(str_replace('https://','',str_replace('http://','',xoops_getenv('REQUEST_URI'))),'/');
$xurl = stristr(str_replace('https://','',str_replace('http://','',XOOPS_URL)),'/');
if ($docheck == 0) {
return true;
}
if ($ref == '') {
return false;
}
if (strpos($ref, $xurl) !== 0 ) {
return false;
}
return true;
}
4. XOOPS_ROOT_PATH/include/checklogin.php - around line 76 (Xoops 2.0.5.2)add the following "elseif" condition before the "else"
Quote:
if (!empty($HTTP_POST_VARS['xoops_redirect']) && !strpos($HTTP_POST_VARS['xoops_redirect'], 'register')) {
$parsed = parse_url(XOOPS_URL);
$url = isset($parsed['scheme']) ? $parsed['scheme'].'://' : 'http://';
if (isset($parsed['host'])) {
$url .= isset($parsed['port']) ?$parsed['host'].':'.$parsed['port'].trim($HTTP_POST_VARS['xoops_redirect']): $parsed['host'].trim($HTTP_POST_VARS['xoops_redirect']);
} elseif(substr(trim(XOOPS_URL),0,1)=="/") {
$url = trim($HTTP_POST_VARS['xoops_redirect']);
}
else {
$url = xoops_getenv('HTTP_HOST').trim($HTTP_POST_VARS['xoops_redirect']);
}
} else {
$url = XOOPS_URL.'/index.php';
}
RecommendationsIn order to make XOOPS and modules available and working properly from behind a proxy (or other configurations allowing you to access your site from different URLs), you have to ensure that:
- you
only use XOOPS_URL for simple HTML anchors or redirections
- All notification messages (system or modules ones) should be adapted to use a "default" domain name in links (to prepend to XOOPS_URL). This could be achieved by creating a new constant in mainfile.php - XOOPS_DEFAULT_DOMAIN or proposing a list of valid URLs(array constant in mainfile.php). This is mandatory because you never know from where a mail is read...
Examples:
mainfile.php
XOOPS_URL = "/mysite"; // or simply "/"
XOOPS_DEFAULT_DOMAIN = "http://www.mycompany.com";
php code snippet
$comment_tags['X_COMMENT_URL'] =
XOOPS_DEFAULT_DOMAIN.XOOPS_URL . '/modules/'..........
Of course, if you defined a complete XOOPS_URL (current way of working today), you will have to leave XOOPS_DEFAULT_DOMAIN empty !!!
OK, I know you will ask me which system files have to be modified...
- mainfile.php (new constant)
- /kernel/notification.php, /class/xoopsmailer.php, /include/comment_post.php, /lostpass.php and /register.php => prepend XOOPS_DEFAULT_DOMAIN to all XOOPS_URL usage
OK, would you like the same info for some basic modules (NON exaustive - main examples => prepend XOOPS_DEFAULT_DOMAIN to all XOOPS_URL usage)?
News: look for STORY_URL and WAITINGSTORIES_URL in news/submit.php
NewBB: look for POST_URL, THREAD_URL and FORUM_URL in newbb/post.php and newbb/include/notification.inc.php
Download: look for FILE_URL, CATEGORY_URL, BROKENREPORTS_URL, MODIFYREPORTS_URL and WAITINGFILES_URL in /download/submit.php, /download/admin/index.php, /download/brokenfile.php and /download/modfile.php
And I repeat it:
THESE MODIFICATIONS ARE FULLY COMPATIBLE WITH CURRENT XOOPS BEHAVIOR.
I hope this will help. This is just a summary and you can always read the all story for details and justifications.
Benoit