Не помню выкладывал или нет.
Универсальный хак избавления от редиректа для RUNCMS 2
1 шаг
В корневом файле
/index.php
PHP код:
<?php
/**
*
* @ Copyright: Copyright (C) Farsus Design. All rights reserved.
* @ Package: ScarPoX / shortterm SPX
* @ Subpackage: RUNCMS
* @ License: http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
*/
include_once("mainfile.php");
//check if start page is defined
if ( !empty($rcxConfig['startpage']) && $rcxConfig['startpage'] != '-1' && $rcxConfig['startpage'] != '--' ) {
$url = "modules/".$rcxConfig['startpage']."/";
header('Status: 302 Found');
header("Location: $url");
?>
<html>
<head><meta http-equiv="Refresh" content="0; URL=<?php echo $url;?>" /></head>
<body></body>
</html>
<?php
exit();
} else {
$rcxOption['show_rblock'] = 1;
include_once('./header.php');
make_cblock();
include_once('./footer.php');
}
?>
Заменить на
PHP код:
<?php
/**
*
* @ Copyright: Copyright (C) Farsus Design. All rights reserved.
* @ Package: ScarPoX / shortterm SPX
* @ Subpackage: RUNCMS
* @ License: http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
*/
include_once("mainfile.php");
//check if start page is defined
if ( !empty($rcxConfig['startpage']) && $rcxConfig['startpage'] != '-1' && $rcxConfig['startpage'] != '--' ) {
if ($rcxConfig['no_redirect'] == 1 && defined("RCX_STARTPAGE_REDIRECTED")) {
///////////////////////////////////////////////////
// hack set Module for your start page to index.php
///////////////////////////////////////////////////
include(RCX_ROOT_PATH . '/modules/' . $rcxConfig['startpage'] . '/index.php');
///////////////////////////////////////////////////////
// end hack set Module for your start page to index.php
///////////////////////////////////////////////////////
} else {
$url = "modules/".$rcxConfig['startpage']."/";
header('Status: 302 Found');
header("Location: $url");
?>
<html>
<head><meta http-equiv="Refresh" content="0; URL=<?php echo $url;?>" /></head>
<body></body>
</html>
<?php
}
exit();
} else {
$rcxOption['show_rblock'] = 1;
include_once('./header.php');
make_cblock();
include_once('./footer.php');
}
?>
2 шаг
Открываем файл
/include/common.php
Ищем строку
48
PHP код:
include_once(RCX_ROOT_PATH.'/modules/system/cache/config.php');
и
после нее добавляем
PHP код:
///////////////////////////////////////////////////
// hack set Module for your start page to index.php
///////////////////////////////////////////////////
$rcxConfig['no_redirect'] = 1;
if ($_SERVER['PHP_SELF'] == '/index.php' && $rcxConfig['no_redirect'] == 1) {
define("RCX_STARTPAGE_REDIRECTED", 1);
chdir('modules/'.$rcxConfig['startpage'].'/');
$parsed = parse_url(RCX_URL);
$url = isset($parsed['scheme']) ? $parsed['scheme'].'://' : 'http://';
if (isset( $parsed['host'])) {
$url .= $parsed['host'];
if (isset( $parsed['port'])) {
$url .= ':' . $parsed['port'];
}
} else {
$url .= $_SERVER['HTTP_HOST'];
}
$_SERVER['REQUEST_URI'] = substr(RCX_URL, strlen($url)) . '/modules/' . $rcxConfig['startpage'] . '/index.php';
$_SERVER['PHP_SELF'] = '/modules/' . $rcxConfig['startpage'] . '/index.php';
}
///////////////////////////////////////////////////////
// end hack set Module for your start page to index.php
///////////////////////////////////////////////////////
3 шаг
Открываем файл
/include/functions.php
Находим функцию
rcx_header() и
после 47 строки
PHP код:
<title><?php echo $meta['title'];?></title>
Добавляем
PHP код:
<?php if ($rcxConfig['no_redirect'] == 1 && defined("RCX_STARTPAGE_REDIRECTED")): ?><base href="<?php echo RCX_URL;?>/modules/<?php echo $rcxConfig['startpage'];?>/">
<?php endif;?>
$rcxConfig['no_redirect'] добавлена для возможности отключения хака.