PHP Classes

File: htdocs/mainfile.dist.php

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/mainfile.dist.php   Download  
File: htdocs/mainfile.dist.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change: Merge pull request #1586 from mambax7/feature/Cannot_use_bool_as_array

fix for Cannot use bool as array
Merge pull request #1577 from ggoffy/master

added groups to member list
copyright update
Merge pull request #1521 from mambax7/feature/#1519

fix for #1519
set default to https://
Null coalescing operator
Merge branch 'master' into feature/remove_error_suppression_operator
Merge branch 'feature/php8_templates' of https://github.com/mambax7/XoopsCore25 into feature/php8_templates

# Conflicts:
# htdocs/themes/xswatch4/modules/publisher/publisher_item.tpl
Merge xswatch4
Date: 10 months ago
Size: 3,898 bytes
 

Contents

Class file image Download
<?php
/**
 * 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       (c) 2000-2025 XOOPS Project (https://xoops.org)
 * @license             GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
 */

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', '');

    // For forward compatibility
    // Physical path to the XOOPS library directory WITHOUT trailing slash
    define('XOOPS_PATH', '');
    // Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
    define('XOOPS_VAR_PATH', '');
    // Alias of XOOPS_PATH, for compatibility, temporary solution
    define('XOOPS_TRUST_PATH', XOOPS_PATH);

    // URL Association for SSL and Protocol Compatibility
    $http = 'http://';
    if (!empty($_SERVER['HTTPS'])) {
        $http = ($_SERVER['HTTPS'] === 'on') ? 'https://' : 'http://';
    }
    define('XOOPS_PROT', $http);

    // XOOPS Virtual Path (URL)
    // Virtual path to your main XOOPS directory WITHOUT trailing slash
    // Example: define("XOOPS_URL", "http://url_to_xoops_directory");
    define('XOOPS_URL', 'https://');

    // in mainfile.php - add this if it doesn't exist
    if (!defined('XOOPS_COOKIE_DOMAIN_USE_PSL')) {
        define('XOOPS_COOKIE_DOMAIN_USE_PSL', true);
    }

    // XOOPS Cookie Domain to specify when creating cookies. May be blank (i.e. for IP address host),
    // full host from XOOPS_URL (i.e. www.example.com) or just the registered domain (i.e. example.com)
    // to share cookies across multiple subdomains (i.e. www.example.com and blog.example.com)
    define('XOOPS_COOKIE_DOMAIN', '');

    // 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) {
        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 = $_SERVER['PATH_TRANSLATED'] ?? $_SERVER['SCRIPT_FILENAME'];
        }
        if (DIRECTORY_SEPARATOR !== '/') {
            // IIS6 may double the \ chars
            $xoopsScriptPath = str_replace(strpos($xoopsScriptPath, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);
        }
        if (strcasecmp(substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace(DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH))) {
            exit('XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.');
        }
    }

    // Production: disable logging for performance
    define('XOOPS_DB_LEGACY_LOG', false);
    define('XOOPS_DEBUG', false);

    // Development/Staging: enable to track legacy usage
    //    define('XOOPS_DB_LEGACY_LOG', true);
    //    define('XOOPS_DEBUG', true); // Also shows E_USER_DEPRECATED notices

    // Secure file
    require XOOPS_VAR_PATH . '/data/secure.php';

    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 . '/include/common.php';
    }
}