Skip to content

XOOPS 2.4.x Series

Legacy documentation for XOOPS 2.4.x (2011-2012).


⚠️ Legacy Notice

This documentation is for historical reference only. XOOPS 2.4.x is no longer supported. For current development, see Core Concepts.


Overview

XOOPS 2.4 served as a transitional release bridging older versions to the modern 2.5 series:

  • PHP 5.2+ Requirement: Dropped PHP 4 support
  • Improved Installer: Redesigned installation wizard
  • Module Cloning: Clone modules with different configurations
  • Enhanced Multilingual: Better i18n support
  • Security Hardening: Additional security layers

Key Features

PHP 5 Migration

XOOPS 2.4 fully embraced PHP 5 features:

<?php
// PHP 5 constructor pattern (2.4+)
class MyObject extends XoopsObject
{
    public function __construct()
    {
        parent::__construct();
        $this->initVar('id', XOBJ_DTYPE_INT, null, false);
        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', true, 255);
    }
}

// Visibility modifiers
class MyHandler extends XoopsObjectHandler
{
    protected $db;
    private $cache;
    public $table;

    public function __construct($db)
    {
        parent::__construct($db);
        $this->table = $this->db->prefix('mytable');
    }
}

Module Cloning

flowchart LR
    A[Original Module] --> B[Clone Wizard]
    B --> C{New Module Name}
    C --> D[Copy Files]
    D --> E[Rename Classes]
    E --> F[Update Database Prefix]
    F --> G[Cloned Module]

    style A fill:#f9f,stroke:#333
    style G fill:#9f9,stroke:#333

Module cloning allowed running multiple instances:

<?php
// Clone configuration in xoops_version.php
$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin';
$modversion['onInstall']      = 'include/oninstall.php';
$modversion['onUpdate']       = 'include/onupdate.php';
$modversion['onUninstall']    = 'include/onuninstall.php';

Improved Installer

sequenceDiagram
    participant U as User
    participant I as Installer
    participant D as Database
    participant F as Filesystem

    U->>I: Start Installation
    I->>F: Check Requirements
    F-->>I: Requirements OK
    I->>U: Show Database Form
    U->>I: Submit Credentials
    I->>D: Test Connection
    D-->>I: Connection OK
    I->>D: Create Tables
    I->>F: Write mainfile.php
    I->>D: Create Admin User
    I-->>U: Installation Complete

Enhanced Security

<?php
// Security improvements in 2.4.x

// Input filtering
$myts = MyTextSanitizer::getInstance();
$cleanTitle = $myts->htmlSpecialChars($_POST['title']);
$cleanContent = $myts->displayTarea($_POST['content']);

// Token validation
if (!$GLOBALS['xoopsSecurity']->checkReferer()) {
    die('Invalid request origin');
}

// Password hashing (improved)
$hashedPassword = md5($password);  // Still MD5 in 2.4
// Note: 2.5+ uses more secure hashing

Database Schema Changes

-- New system tables in 2.4
CREATE TABLE `xoops_system_permission` (
    `perm_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `perm_type` varchar(30) NOT NULL DEFAULT '',
    `perm_item` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `perm_modid` smallint(5) unsigned NOT NULL DEFAULT '0',
    `perm_groupid` smallint(5) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`perm_id`),
    KEY `perm_type` (`perm_type`,`perm_item`,`perm_modid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Template Improvements

{* XOOPS 2.4 template enhancements *}

{* Improved modifier support *}
<{$item.content|truncate:200:'...'}>

{* Better date formatting *}
<{$item.created|date_format:'%Y-%m-%d %H:%M'}>

{* Conditional blocks *}
<{if $xoops_isuser}>
    Welcome, <{$xoops_user.uname}>!
<{else}>
    <a href="<{$xoops_url}>/register.php">Register</a>
<{/if}>

Multilingual Improvements

<?php
// language/english/modinfo.php (2.4 style)
define('_MI_MYMODULE_NAME', 'My Module');
define('_MI_MYMODULE_DESC', 'Module description');

// language/english/main.php
define('_MD_MYMODULE_TITLE', 'Title');
define('_MD_MYMODULE_CONTENT', 'Content');

// Using constants
echo _MI_MYMODULE_NAME;

// Multilingual content storage
$item->setVar('title', $_POST['title']);
// Each language stored separately via mlcontent module

Module Configuration

<?php
// xoops_version.php config section (2.4 style)

$modversion['config'][] = [
    'name'        => 'editor',
    'title'       => '_MI_MYMODULE_EDITOR',
    'description' => '_MI_MYMODULE_EDITOR_DESC',
    'formtype'    => 'select',
    'valuetype'   => 'text',
    'default'     => 'dhtmltextarea',
    'options'     => [
        '_MI_MYMODULE_EDITOR_DHTML' => 'dhtmltextarea',
        '_MI_MYMODULE_EDITOR_TEXTAREA' => 'textarea',
        '_MI_MYMODULE_EDITOR_TINYMCE' => 'tinymce'
    ]
];

$modversion['config'][] = [
    'name'        => 'dateformat',
    'title'       => '_MI_MYMODULE_DATEFORMAT',
    'description' => '_MI_MYMODULE_DATEFORMAT_DESC',
    'formtype'    => 'textbox',
    'valuetype'   => 'text',
    'default'     => 'Y-m-d H:i'
];

Key Differences: 2.4 vs 2.5

Feature 2.4.x 2.5.x
PHP Support 5.2-5.4 5.3-8.x
Namespaces None Full support
Autoloading Manual PSR-4
Framework Built-in XMF integrated
Password Hash MD5 bcrypt/Argon2
Composer None Supported

Migration Path to 2.5

When migrating from 2.4 to 2.5:

  1. Update PHP syntax: Use __construct() consistently
  2. Add namespaces: Move classes to XoopsModules\ModuleName\
  3. Update autoloading: Implement PSR-4
  4. Modernize forms: Use XMF form elements
  5. Security update: Replace MD5 password handling

See: Full Migration Guide



xoops #legacy #2.4 #archive #history