1
wishcraft
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
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

2
harry0725
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/21 19:00

  • harry0725

  • Just popping in

  • Posts: 6

  • Since: 2009/3/19


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..

3
wishcraft
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 GNU 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
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

4
sockmonkey
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/25 14:34

  • sockmonkey

  • Just popping in

  • Posts: 21

  • Since: 2008/6/4 1


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.

5
pablo103
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/25 18:33

  • pablo103

  • Not too shy to talk

  • Posts: 181

  • Since: 2008/2/3 1


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

6
harry0725
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/25 19:34

  • harry0725

  • Just popping in

  • Posts: 6

  • Since: 2009/3/19


I got the same problem too

7
wishcraft
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
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

8
unsinner
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/27 4:14

  • unsinner

  • Just popping in

  • Posts: 87

  • Since: 2006/3/15


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

9
harry0725
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/27 5:36

  • harry0725

  • Just popping in

  • Posts: 6

  • Since: 2009/3/19


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

10
unsinner
Re: Testing: Multisite Module 1.17 RC for XOOPS 2.3
  • 2009/3/27 10:02

  • unsinner

  • Just popping in

  • Posts: 87

  • Since: 2006/3/15


with me

Login

Who's Online

329 user(s) are online (196 user(s) are browsing Support Forums)


Members: 0


Guests: 329


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