PHP Classes

File: htdocs/xoops_lib/modules/protector/admin/admin_header.php

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/xoops_lib/modules/protector/admin/admin_header.php   Download  
File: htdocs/xoops_lib/modules/protector/admin/admin_header.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change: copyright update
Protector changes
fix for Smarty deprecated strtime()
Merge pull request #1239 from Andrew-Staves-Activ/notificationhandler_subscribe_success

Fix pagenav in protector center

center.php actually rendered the pagenav before it did the
typical admin xoops_cp_header() that establishees it as a
control panel themed page.
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: 2,929 bytes
 

Contents

Class file image Download
<?php
/**
 * Private message
 *
 * 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)
 * @package             pm
 * @since               2.3.0
 * @author              Taiwen Jiang <phppp@users.sourceforge.net>
 */

//include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
include_once XOOPS_ROOT_PATH . '/mainfile.php';

include_once XOOPS_ROOT_PATH . '/include/cp_header.php';
include_once XOOPS_ROOT_PATH . '/include/cp_functions.php';

//include XOOPS_ROOT_PATH . '/include/cp_header.php';
//require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/include/functions.php';

if (file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) {
    include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
    //return true;
} else {
    redirect_header(XOOPS_ROOT_PATH . '/admin.php', 5, _AM_MODULEADMIN_MISSING, false);
    //return false;
}

$myts = \MyTextSanitizer::getInstance();

$moduleInfo = $module_handler->get($xoopsModule->getVar('mid'));
$pathIcon16 = XOOPS_URL . '/' . $moduleInfo->getInfo('icons16');
$pathIcon32 = XOOPS_URL . '/' . $moduleInfo->getInfo('icons32');

if ($xoopsUser) {
    /** @var XoopsGroupPermHandler $moduleperm_handler */
    $moduleperm_handler = xoops_getHandler('groupperm');
    if (!$moduleperm_handler->checkRight('module_admin', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
        redirect_header(XOOPS_URL, 1, _NOPERM);
    }
} else {
    redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM);
}

if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
    include_once(XOOPS_ROOT_PATH . '/class/template.php');
    $xoopsTpl = new XoopsTpl();
}

$xoopsTpl->assign('pathIcon16', $pathIcon16);

// Load language files

$moduleDir = $xoopsModule->getVar('dirname');
$language = $xoopsConfig['language'];

// List of language files to include
$languageFiles = ['admin.php', 'modinfo.php', 'main.php'];

foreach ($languageFiles as $file) {
    $languageFile = XOOPS_TRUST_PATH . "/modules/{$moduleDir}/language/{$language}/{$file}";
    $englishFile = XOOPS_TRUST_PATH . "/modules/{$moduleDir}/language/english/{$file}";

    // Attempt to include the language-specific file, fallback to English if not found
    if (file_exists($languageFile)) {
        include_once $languageFile;
    } else {
        include_once $englishFile;
    }
}