1
Saganxis
Xoops MultiSite beta Release
  • 2007/9/20 17:18

  • Saganxis

  • Just popping in

  • Posts: 25

  • Since: 2006/7/20


We anounce the first beta version of the MultiSite Proyect for XOOPS (Multix).
This is the 2.0.17 XOOPS version modified to allow multiple sites in one root directory, with the posibility
to share tables, groups, sessions and more. Also you can use some configurations files that will help you to
administer some functionality aspects of each site.

The link to the proyect in sourceforge is http://sourceforge.net/projects/multixoops/. You can download from here.

We hope Multix would be helpfull for you and the feedback help Multix to grow and be better!!

2
script_fu
Re: Xoops MultiSite beta Release

So how do you install this and setup the extra domains?

3
nekro
Re: Xoops MultiSite beta Release
  • 2007/9/21 3:14

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


Hi... i am the other "author" of the hack...

to install a site here are the steps.

1- Configure your http server virtual host... to see all the same folder using diferent URL

Example: (using xoops.org)

http://www.xoops.org
dev.xoops.org
devteam.xoops.org
modules.xoops.org
themes.xoops.org

2- Give 777 rights to the "sites" folder.
3- Enter your first site URL in the browser.
4- Follow the steps of the installer.
5- When the installer ask for the sitename... there will be a red cross or a green mark, if the cross is shown... under the text box... there is a link... wich will make all the necessary folders ...
6- follow all the other steps... like a common installation...
7- Use your first site... ;)
8- Make your second site... repeating the steps for the first site.
Write the URL of the second site in the Web Browser.. and etc... etc ... etc... :P

When you get ready configured the multi sites ... we will teach you how to share tables... and admin modules, themes, and groups... but today is very late... and i have a great headacke!!!


In other way ... we found a stupid first bug... now corrected... we dont commented something in the line 78 of "includes/checklogin.php" (is a RC ... the bugs are acepted :P )

change the "includes/checklogin.php" with the next code...

if (!defined('XOOPS_ROOT_PATH')) {
    exit();
}
include_once 
XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php';
$uname = !isset($_POST['uname']) ? '' trim($_POST['uname']);
$pass = !isset($_POST['pass']) ? '' trim($_POST['pass']);
if (
$uname == '' || $pass == '') {
    
redirect_header(XOOPS_URL.'/user.php'1_US_INCORRECTLOGIN);
    exit();
}
$member_handler =& xoops_gethandler('member');
$myts =& MyTextsanitizer::getInstance();

include_once 
XOOPS_ROOT_PATH.'/class/auth/authfactory.php';
include_once 
XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/auth.php';
$xoopsAuth =& XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname));
$user $xoopsAuth->authenticate($myts->addSlashes($uname), $myts->addSlashes($pass));

if (
false != $user) {
    if (
== $user->getVar('level')) {
        
redirect_header(XOOPS_URL.'/index.php'5_US_NOACTTPADM);
        exit();
    }
    if (
$xoopsConfig['closesite'] == 1) {
        
$allowed false;
        foreach (
$user->getGroups() as $group) {
            if (
in_array($group$xoopsConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) {
                
$allowed true;
                break;
            }
        }
        if (!
$allowed) {
            
redirect_header(XOOPS_URL.'/index.php'1_NOPERM);
            exit();
        }
    }
    
$user->setVar('last_login'time());
    if (!
$member_handler->insertUser($user)) {
    }
    
// Regenrate a new session id and destroy old session
    //    
    //session_regenerate_id(true);
    //

    
$_SESSION = array();
    
$_SESSION['xoopsUserId'] = $user->getVar('uid');
    
$_SESSION['xoopsUserGroups'] = $user->getGroups();
    if (
$xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {
        
setcookie($xoopsConfig['session_name'], session_id(), time()+(60 $xoopsConfig['session_expire']), '/',  ''0);
    }
    
$user_theme $user->getVar('theme');
    if (
in_array($user_theme$xoopsConfig['theme_set_allowed'])) {
        
$_SESSION['xoopsUserTheme'] = $user_theme;
    }
    if (!empty(
$_POST['xoops_redirect']) && !strpos($_POST['xoops_redirect'], 'register')) {
        
$_POST['xoops_redirect'] = trim$_POST['xoops_redirect'] );
        
$parsed parse_url(XOOPS_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'];
        }
        if ( @
$parsed['path'] ) {
            if ( 
strncmp$parsed['path'], $_POST['xoops_redirect'], strlen$parsed['path'] ) ) ) {
                
$url .= $parsed['path'];
            }
        }
        
$url .= $_POST['xoops_redirect'];
    } else {
        
$url XOOPS_URL.'/index.php';
    }
    
//
    //to keep the same session for all sites, it is posible with the session table shared
    
if (definedDOMAIN_TO_SHARE )){
        if( isset(
$xoopsConfig['use_mysession']) ){
            
$xoops_cookie_path defined('XOOPS_COOKIE_PATH') ? XOOPS_COOKIE_PATH preg_replace'?http://[^/]+(/.*)$?' "$1" XOOPS_URL ) ;
            if( 
$xoops_cookie_path == XOOPS_URL )
                
$xoops_cookie_path '/' ;
            if (isset(
$_COOKIE['PHPSESSID'])) {
                
$expire time() + ( defined('XOOPS_AUTOLOGIN_LIFETIME') ? XOOPS_AUTOLOGIN_LIFETIME 18000 ) ; // 5 hours default
                
setcookie('shared_sess'$_COOKIE['PHPSESSID'], $expire$xoops_cookie_pathDOMAIN_TO_SHARE0);
            }
        }
    }
    
//
    // RMV-NOTIFY
    // Perform some maintenance of notification records
    
$notification_handler =& xoops_gethandler('notification');
    
$notification_handler->doLoginMaintenance($user->getVar('uid'));

    
redirect_header($url1sprintf(_US_LOGGINGU$user->getVar('uname')), false);
}elseif(empty(
$_POST['xoops_redirect'])){
    
redirect_header(XOOPS_URL.'/user.php'5$xoopsAuth->getHtmlErrors());
}else{
    
redirect_header(XOOPS_URL.'/user.php?xoops_redirect='.urlencode(trim($_POST['xoops_redirect'])), 5$xoopsAuth->getHtmlErrors(), false);
}
exit();

?>


Gaby corregilo en SF.net please :P ... arrancamos con el pie izquierdo!

4
Saganxis
Re: Xoops MultiSite beta Release
  • 2007/9/21 4:43

  • Saganxis

  • Just popping in

  • Posts: 25

  • Since: 2006/7/20


I will try to explain how Multix work.

I'll explain the installation proccess al the end.

Once you have installed yoursite1.com you see the /sites folder as follow:

/sites/
all/
xoops-config.php
xoops-mod.php
xoops-tbl.php
xoops-thm.php
xoops-grp.php


yoursite.com/
cache
templates_c
uploads
xoops-config.php
xoops-mod.php
xoops-tbl.php
xoops-thm.php
xoops-grp.php


xoops-sites.php

*****************************
File xoops-sites.php
*****************************
In the file xoops-sites.php we find the name of each site in the following format:

$xoops_site["yoursite.com"] = "yoursite.com";

If we want to add an alias we can do this:

$xoops_site["www.yoursite.com"] = "yoursite.com";

This happens because we take the key of the $xoops_site array to refer to the host requested.

*****************************
yoursite.com folder
*****************************

For each site you install you will have the same directory structure as yoursite.com.


########### xoops-mod.php file ###########


In this file we specify the modules will be loaded in each site. We use the following format:

$xoops_mod[ 'dirname_module' ] = option;

option:
0->Just the admin group can view this module
1->All groups can view this module

The option 0 was thought for admin modules like protector. If we let someone to manage any site
and we assign this person to a group with admin priviligies this person wouldn't view or admin this module.

I.e.:

$xoops_mod[ 'news' ] = 1;


########### xoops-tbl.php file ###########

In this file we specify the tables will be shared in each site. We use the following format:

$xoops_tbl["table_name"]["database"] = "database_to_share";
$xoops_tbl["table_name"]["prefix"] = "prefix_of_database_to_share";


If we want in the site2 link to the "table_X" which is in the site1 we procced as follows:

We don't touch the /sites/site1/xoops-tbl.php file.

We modify the /sites/site2/xoops-tbl.php file adding this:

$xoops_tbl["table_X"]["database"] = "database_to_share";
$xoops_tbl["table_X"]["prefix"] = "prefix_of_database_to_share";



########### xoops-thm.php file ###########


In this file we specify the themes will be able to choose in each site. We use the following format:

$xoops_thm['theme_name'] = 'theme_name';


########### xoops-grp.php file ###########


IMPORTANT: To share 'groups' between sites we need to share the tables:

users
groups
groups_users_link

By this way we can share users and groups (not permissions) for the sites we specify.


########### xoops-config.php file ###########


Take a look at the xoops-config.php file. We have some constants which are very important for
some configurations aspects of each site.

Look at XOOPS_GLOBAL_CONFIG, MODULES_FROM_ALL, THEMES_FROM_ALL, GROUPS_FROM_ALL, TABLES_FROM_ALL constants.

If we set XOOPS_GLOBAL_CONFIG to '1' we will load a "common" configuration which are in the
/sites/all/xoops-config.php file. If not we can specify a custom configuration for each site.

If we set MODULES_FROM_ALL to '1' we will load the modules which are in the /sites/all/xoops-mod.php
file. Althougt we can specify a module to be loaded in the /sites/yoursite.com/xoops-mod.php file.
Latter I will explain what i want to say when i talk about "load a module".

We obtain the same functionality with the other constants.

If we set TABLES_FROM_ALL to '1' we will be able to share the same tables which are in the
/sites/all/xoops-tbl.php file for all sites.

There is something that you need to understand.
Supose that we need to share the "avatars" table in almost all sites (supose we have 8 sites).
For example, we need the same table in 6 sites but diferents ones in the others 2 sites. We proceed as follow:

Add this to the /sites/all/xoops-tbl.php file:

$xoops_tbl["avatars"]["database"] = "database_to_share";
$xoops_tbl["avatars"]["prefix"] = "prefix_of_database_to_share";

In the 6 sites set TABLES_FROM_ALL to '1' in the /sites/site_name/xoops-config.php file.
But in the others 2 sites set this constant to '0'.

5
urbanspacema
Re: Xoops MultiSite beta Release

i want to know....

this installation allows to have one 'core' in one server and example http://www.website1.com http://www.website2.com http://www.website3.it with separated user, modules, template, theme...??

to upgrade all site with new versions of XOOPS it would be enough to update single Core...

sorry for bad english.

Urban

6
Saganxis
Re: Xoops MultiSite beta Release
  • 2007/9/21 13:15

  • Saganxis

  • Just popping in

  • Posts: 25

  • Since: 2006/7/20


Yes the installation allows you to have one core for all sites. Users, modules and so on, you have it in the db so they would be different. But the directory module will be the same for all sites.

7
trabis
Re: Xoops MultiSite beta Release
  • 2007/9/22 22:22

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hello! I had problems installing multix with php4 because scandir() is not suported.

I recomend you add this function in:
..install/page_pathsettings.php

function scandir$source ) {
    
$dir opendir$source );
    while (
false !== ($filename readdir$dir ))) {
        
$files[] = $filename;
    }
    return 
$files;
}


And search:
foreach ( scandir$source ) as $file ) {


And replace for:
foreach ( $this->scandir$source ) as $file ) {



Also:
Morphogenesis stoped working after replaciong the files.
It would be great to include it in multix!

I´ll keep on testing this... Thank you all!

8
Saganxis
Re: Xoops MultiSite beta Release
  • 2007/9/25 16:13

  • Saganxis

  • Just popping in

  • Posts: 25

  • Since: 2006/7/20


Thanks to all!!!I'm working to improve the coding to meke it more easy to update.
Hi trabis, i'll take care of that in the following version, thank you.

9
Saganxis
Re: Xoops MultiSite beta Release
  • 2007/9/25 23:14

  • Saganxis

  • Just popping in

  • Posts: 25

  • Since: 2006/7/20


Has anyone been testing multix??? Do you have any suggestion to include in the next version???

10
Georgeaha
Re: Xoops MultiSite beta Release
  • 2007/9/27 21:16

  • Georgeaha

  • Just popping in

  • Posts: 5

  • Since: 2007/1/4 1


Just a quick question.

While I am not sure how the module works are you able to set a sitemap for each of the domains.

Do you think by creating a number of sites based on the same content that google will penalise.?

Can I pay someone to install the multix on my solution.?

Do you have to be running 2.0.17?

Great work though guys... You rock !!!

Login

Who's Online

337 user(s) are online (217 user(s) are browsing Support Forums)


Members: 0


Guests: 337


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits