xoops forums

wishcraft

Module Developer
Posted on: 2009/3/21 10:16
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1

Testing: Multisite Module 1.17 RC for XOOPS 2.3

Resized Image


Download Multisite for XOOPS 2.3.x, it allows for multiple site to be run from the one xoops, many XOOPS - One Code Base.

This is an early module, will remain a download forever.

Download now xoops2.3_multisite_1.17rc.zip (155 Kb).

You will need to install and change the mainfile in the following way after installing:


//Line 33-45

    // XOOPS Protocol (URL)
    
if (!empty($_SERVER['HTTPS']))
        if (
$_SERVER['HTTPS']=='on')
           
define('XOOPS_PROT''https://');
        else
           
define('XOOPS_PROT''http://');        
    else
        
define('XOOPS_PROT''http://');        

    
// XOOPS Virtual Path (URL)
    // Virtual path to your main XOOPS directory WITHOUT trailing slash
    // Example: define( 'XOOPS_URL', XOOPS_PROT.'www.xoops.org' );   
    
define'XOOPS_URL'''.strtolower(XOOPS_PROT.$_SERVER['HTTP_HOST'].'').'' );

// Footer Line - Loading of the common.

    
if (!isset($xoopsOption["nocommon"]) && XOOPS_ROOT_PATH != "") {
        
//include XOOPS_ROOT_PATH."/modules/multisite/pre.load.php";
        
include XOOPS_ROOT_PATH."/include/common.php";
        
//include_once XOOPS_ROOT_PATH."/modules/multisite/post.load.php";
    
}



There is also a hack to header.php to see if an object exists already..

header.php
//line 43

   
global $xoopsOption$xoopsConfig$xoopsModule$xoopsThemeFactory$xoTheme;

  
// line 57 - 58

  
if(!is_object($xoopsThemeFactory))
    
$xoopsThemeFactory =& new xos_opal_ThemeFactory();

  
// Line 65 - 68
  
if(!is_object($xoTheme))
    
$xoTheme =& $xoopsThemeFactory->createInstance( array(
    
'contentTemplate' => @$xoopsOption['template_main'],
    ) );


Some more suggested code changes is to

/kernel/config.php
/**
     * Get configs from a certain category
     *
     * @param    int $category   ID of a category
     * @param    int $module     ID of a module
     *
     * @return    array   array of {@link XoopsConfig}s
     */
    
function &getConfigsByCat($category$module 0)
    {
        static 
$_cachedConfigs;
        if (!empty(
$_cachedConfigs[$module][$category])) {
            return 
$_cachedConfigs[$module][$category];
        } else {
            
$domain_handler =& xoops_getmodulehandler('domain''multisite');
            
$ret $domain_handler->getConfigByDomainCat($category$ret$module);
            if (!
is_array($ret))
            {
                
$ret = array();
                
$criteria = new CriteriaCompo(new Criteria('conf_modid'intval($module)));
                if (!empty(
$category)) {
                    
$criteria->add(new Criteria('conf_catid'intval($category)));
                }
                
$configs $this->getConfigs($criteriatrue);
                if (
is_array($configs)) {
                    foreach (
array_keys($configs) as $i) {
                        
$ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
                    }
                }
            }
            
$_cachedConfigs[$module][$category] = $ret;
            return 
$_cachedConfigs[$module][$category];
        }
    }

not for the faint hearted. These are core changes so far.
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies

harry0725

Just popping in
Posted on: 2009/3/21 19:00
harry0725
harry0725 (Show more)
Just popping in
Posts: 6
Since: 2009/3/19
#2

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

i do that by steps
and get the following:

Fatal error: XoopsDatabaseFactory::require_once() [function.require]: Failed opening required 'C:/AppServ/www/dae/class/database/XOOPS_DB_TYPEdatabase.php' (include_path='.;C:\php5\pear') in C:\AppServ\www\dae\class\database\databasefactory.php on line 24

im so unhappy..

wishcraft

Module Developer
Posted on: 2009/3/22 1:27
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#3

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

--- harry0725 ---

[quote]
Fatal error: XoopsDatabaseFactory::require_once() [function.require]: Failed opening required 'C:/AppServ/www/dae/class/database/XOOPS_DB_TYPEdatabase.php' (include_path='.;C:\php5\pear') in C:\AppServ\www\dae\class\database\databasefactory.php on line 24
[quote]

The problem is you have put the footer tag in the wrong place your mainfile.php should look something like this, remember the passwords and details will be different but it should be this layout.

/**
 * XOOPS main configuration file
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     http://www.fsf.org/copyleft/gpl.html& ...  public license
 * @version     $Id: mainfile.dist.php 2634 2009-01-10 03:38:45Z phppp $
 */

if ( !defined("XOOPS_MAINFILE_INCLUDED") ) {
    
define("XOOPS_MAINFILE_INCLUDED"1);

    
// XOOPS Physical Paths
    
    // Physical path to the XOOPS documents (served) directory WITHOUT trailing slash
    
define'XOOPS_ROOT_PATH''C:/wamp/www/xoops233' );

    
// For forward compatibility
    // Physical path to the XOOPS library directory WITHOUT trailing slash
    
define'XOOPS_PATH''C:/wamp/www/xoops233/xoops_lib' );
    
// Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
    
define'XOOPS_VAR_PATH''C:/wamp/www/xoops233/xoops_data' );
    
// Alias of XOOPS_PATH, for compatibility, temporary solution
    
define("XOOPS_TRUST_PATH"XOOPS_PATH);

    
// XOOPS Protocol (URL)
    
if (!empty($_SERVER['HTTPS']))
        if (
$_SERVER['HTTPS']=='on')
           
define('XOOPS_PROT''https://');
        else
           
define('XOOPS_PROT''http://');        
    else
        
define('XOOPS_PROT''http://');        

    
// XOOPS Virtual Path (URL)
    // Virtual path to your main XOOPS directory WITHOUT trailing slash
    // Example: define( 'XOOPS_URL', XOOPS_PROT.'www.xoops.org' );   
    
define'XOOPS_URL'''.strtolower(XOOPS_PROT.$_SERVER['HTTP_HOST'].'/xoops233').'' );

    
// Shall be handled later, don't forget!
    
define("XOOPS_CHECK_PATH"0);
    
// Protect against external scripts execution if safe mode is not enabled
    
if ( XOOPS_CHECK_PATH && !@ini_get("safe_mode") ) {
        if ( 
function_exists("debug_backtrace") ) {
            
$xoopsScriptPath debug_backtrace();
            if ( !
count($xoopsScriptPath) ) {
                 die(
"XOOPS path check: this file cannot be requested directly");
            }
            
$xoopsScriptPath $xoopsScriptPath[0]["file"];
        } else {
            
$xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] :  $_SERVER["SCRIPT_FILENAME"];
        }
        if ( 
DIRECTORY_SEPARATOR != "/" ) {
            
// IIS6 may double the  chars
            
$xoopsScriptPath str_replacestrpos$xoopsScriptPath"\") ? "\" DIRECTORY_SEPARATOR"/"$xoopsScriptPath);
        }
        if ( 
strcasecmpsubstr($xoopsScriptPath0strlen(XOOPS_ROOT_PATH)), str_replaceDIRECTORY_SEPARATOR"/"XOOPS_ROOT_PATH)) ) {
             exit(
"XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
        }
    }

    
// Database
    // Choose the database to be used
    
define'XOOPS_DB_TYPE''mysql' );

    
// Set the database charset if applicable
    
if (defined("XOOPS_DB_CHARSET")) die();
    
define'XOOPS_DB_CHARSET''utf8' );

    
// Table Prefix
    // This prefix will be added to all new tables created to avoid name conflict in the database. If you are unsure, just use the default "xoops".
    
define'XOOPS_DB_PREFIX''x2r1' );

    
// Database Hostname
    // Hostname of the database server. If you are unsure, "localhost" works in most cases.
    
define'XOOPS_DB_HOST''localhost' );

    
// Database Username
    // Your database user account on the host
    
define'XOOPS_DB_USER''xoops233' );

    
// Database Password
    // Password for your database user account
    
define'XOOPS_DB_PASS''x00ps233' );

    
// Database Name
    // The name of database on the host. The installer will attempt to create the database if not exist
    
define'XOOPS_DB_NAME''xoops233' );

    
// Use persistent connection? (Yes=1 No=0)
    // Default is "Yes". Choose "Yes" if you are unsure.
    
define'XOOPS_DB_PCONNECT');

    
define'XOOPS_GROUP_ADMIN''1' );
    
define'XOOPS_GROUP_USERS''2' );
    
define'XOOPS_GROUP_ANONYMOUS''3' );
    
    if (!isset(
$xoopsOption["nocommon"]) && XOOPS_ROOT_PATH != "") {
        
//include XOOPS_ROOT_PATH."/modules/multisite/pre.load.php";
        
include XOOPS_ROOT_PATH."/include/common.php";
        include_once 
XOOPS_ROOT_PATH."/modules/multisite/post.load.php";
    }
}
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies

sockmonkey

Just popping in
Posted on: 2009/3/25 14:34
sockmonkey
sockmonkey (Show more)
Just popping in
Posts: 21
Since: 2008/6/4 1
#4

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

I love the direction you're taking this, wishcraft. The flexibility this affords is fantastic. I'm experiencing a couple problems, though.

First, when I try to set preferences for a domain I get the following error:
Quote:
You don't have permission to access /scms/modules/multisite/admin.php on this server.

All of the rest of the admin tabs work fine, so I don't know why I should have a problem with that one.

Second, when I click on any link on the top page of either of the two domains I have in the pool I'm getting this error:
Quote:
Fatal error: Call to a member function getVar() on a non-object in /home/sockmonk/public_html/swetnamcentral/scms/modules/multisite/class/domain.php on line 283

I don't know if these are bugs or if I just have something set wrong, but I thought I should Let you know.

pablo103

Not too shy to talk
Posted on: 2009/3/25 18:33
pablo103
pablo103 (Show more)
Not too shy to talk
Posts: 181
Since: 2008/2/3 1
#5

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

the same error!

on top of this after changing the kernel/config.php file i am getting an error
Quote:
Fatal error: Call to a member function getVar() on a non-object in modules/multisite/class/domain.php on line 283

harry0725

Just popping in
Posted on: 2009/3/25 19:34
harry0725
harry0725 (Show more)
Just popping in
Posts: 6
Since: 2009/3/19
#6

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

I got the same problem too

wishcraft

Module Developer
Posted on: 2009/3/26 13:28
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#7

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

Hi all sorry I haven't been by for the past day or two, been taking a breather... Going to be writting the multisite module from simple-xoops.de in soon. but here is a code update for you..

/**
     * Get domains from a certain category
     *
     * @param    int $category   ID of a category
     * @param    int $module     ID of a module
     *
     * @return    array   array of {@link MultisiteDomain}s
     */
    
function &getConfigByDomainCat($category$preset$module=0)
    {


        
$confcat_handler =& xoops_gethandler('configcategory');
        
$confcat =& $confcat_handler->get($category);

        if (
is_object($confcat))
        {
            
$domcat_handler =& xoops_getmodulehandler('domaincategory','multisite');
            
$criteria = new CriteriaCompo();
            
$criteria->add(new Criteria('domcat_name'$confcat->getVar('confcat_name')));
            
$domcat $domcat_handler->getObjects($criteria);
        }
        
        if (
is_object($domcat[0]))
        {
            
$domain_handler =& xoops_getmodulehandler('domain','multisite');
            
$criteria = new CriteriaCompo();
            
$criteria->add(new Criteria('dom_pid'$this->_domain_id));
            
$criteria->add(new Criteria('dom_modid'$module));
            
$criteria->add(new Criteria('dom_catid'$domcat[0]->getVar('domcat_id')));
            if (
$domain_handler->getDomainCount($criteria)>0)
                if (!empty(
$domcat[0])&&is_object($domcat[0]))
                {
                    
$category intval($domcat[0]->getVar('domcat_id'));
                    
                    static 
$_cacheddomains;
                    if (!empty(
$_cacheddomains[$module][$category])) {
                        return 
$_cacheddomains[$module][$category];
                    } else {
                        
$ret = array();
                        
$criteria = new CriteriaCompo(new Criteria('dom_modid'intval($module)));
                        
$criteria->add(new Criteria('dom_pid'intval($this->_domain_id)));
                        if (!empty(
$category)) {
                            
$criteria->add(new Criteria('dom_catid'intval($category)));
                        }
                        
$domains $this->getdomains($criteriatrue);
                        if (
is_array($domains)) {
                            foreach (
array_keys($domains) as $i) {
                                
$ret[$domains[$i]->getVar('dom_name')] = $domains[$i]->getConfValueForOutput();
                            }
                        }
                        
$_cacheddomains[$module][$category] = $ret;
                        return 
$_cacheddomains[$module][$category];
                    }
                } else {
                    return 
$preset;
                }
            else
                return 
$preset;
        }
    }


This function is found in the domain.php class library. You will notice the edition in it with the if clause around the error this is all that needs to be done to fix this for fluid transparency. The error is cause by XOOPS referencing for a preference that is not populated in the database yet.
Quote:

if (is_object($confcat))
{
$domcat_handler =& xoops_getmodulehandler('domaincategory','multisite');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('domcat_name', $confcat->getVar('confcat_name')));
$domcat = $domcat_handler->getObjects($criteria);
}


This is the part that has changed.
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies

unsinner

Just popping in
Posted on: 2009/3/27 4:14
unsinner
unsinner (Show more)
Just popping in
Posts: 87
Since: 2006/3/15
#8

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

I made the changes to the mainfile and the header but when I go to make a new domain well take a look at the screen shot

Resized Image


OR HERE

harry0725

Just popping in
Posted on: 2009/3/27 5:36
harry0725
harry0725 (Show more)
Just popping in
Posts: 6
Since: 2009/3/19
#9

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

you know what..
i got the same problem with unsinner since beginning

unsinner

Just popping in
Posted on: 2009/3/27 10:02
unsinner
unsinner (Show more)
Just popping in
Posts: 87
Since: 2006/3/15
#10

Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3

with me