Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .atoum.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
<?php declare(strict_types=1);

//.atoum.php

use mageekguy\atoum;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)

![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png)
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp81.png)

# Support

Expand Down
4 changes: 2 additions & 2 deletions admin/about.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

/*
You may not change or alter any portion of this comment or credits
Expand All @@ -18,7 +18,7 @@
*
* @since 2.5.0
*
* @author Txmod Xoops https://xoops.org
* @author Txmod Xoops https://xoops.org
* Goffy https://myxoops.org
*/
require __DIR__ . '/header.php';
Expand Down
22 changes: 11 additions & 11 deletions admin/building.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

/*
You may not change or alter any portion of this comment or credits
Expand All @@ -9,6 +9,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
* modulebuilder module.
*
Expand All @@ -17,14 +18,13 @@
*
* @since 2.5.0
*
* @author Txmod Xoops https://xoops.org
* @author Txmod Xoops https://xoops.org
* Goffy https://myxoops.org
*
*/

use Xmf\Request;
use XoopsModules\Modulebuilder;
use XoopsModules\Modulebuilder\Files;
use Xmf\Request;

$templateMain = 'modulebuilder_building.tpl';

Expand All @@ -36,7 +36,7 @@
$checkData = Request::hasVar('check_data');
$moduleObj = $helper->getHandler('Modules')->get($mid);

$cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_';
$cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_';
if (!\is_dir($cachePath)) {
if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) {
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath));
Expand All @@ -59,7 +59,7 @@
case 'check_data':
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php'));
$GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);
$checkdata = Modulebuilder\Files\CheckData::getInstance();
$checkdata = Modulebuilder\Files\CheckData::getInstance();

// check data for inconsistences
$checkResults = [];
Expand All @@ -85,7 +85,7 @@
//save test data of selected module before building new version
if (1 === $testdataRestore) {
// Directories for copy from
$fromDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata';
$fromDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata';
if (\is_dir($fromDir)) {
// Directories for copy to
$toDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname);
Expand Down Expand Up @@ -132,14 +132,14 @@
unset($build);

// Get common files
$resCommon = $architecture->setCommonFiles($moduleObj);
$resCommon = $architecture->setCommonFiles($moduleObj);
$build['list'] = \_AM_MODULEBUILDER_BUILDING_COMMON;
$GLOBALS['xoopsTpl']->append('builds', $build);
unset($build);

// Directory to saved all files
$building_directory = \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname);
$building_directory = \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname);

// Copy this module in root modules
if (1 === $inrootCopy) {
if (isset($moduleDirname)) {
Expand All @@ -152,7 +152,7 @@
}
}
$building->copyDir($fromDir, $toDir);
$building_directory .= \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir);
$building_directory .= \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir);
}
if (1 === $testdataRestore) {
// Directories for copy from to
Expand Down
73 changes: 35 additions & 38 deletions admin/devtools.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

/*
You may not change or alter any portion of this comment or credits
Expand All @@ -19,7 +19,6 @@
* @since 2.5.5
*
* @author Goffy https://myxoops.org
*
*/

use Xmf\Request;
Expand All @@ -33,27 +32,27 @@

require __DIR__ . '/header.php';
// Recovered value of argument op in the URL $
$op = Request::getString('op', 'list');
$op = Request::getString('op', 'list');

switch ($op) {
case 'fq':
$fqModule = Request::getString('fq_module');
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $fqModule;
$dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/' . $fqModule;

$patKeys = [];
$patKeys = [];
$patValues = [];
//Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues);
Devtools::function_qualifier($src_path, $dst_path, $fqModule);
\redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS);
break;
case 'check_lang':
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
$clModuleName = Request::getString('cl_module');
$clModuleName = Request::getString('cl_module');
$clModuleNameUpper = \mb_strtoupper($clModuleName);

//scan language files
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/';
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/';
$langfiles = [];
foreach (scandir($src_path) as $scan) {
if (is_file($src_path . $scan) && 'index.html' !== $scan) {
Expand All @@ -69,19 +68,19 @@
}
$constantsAfterInclude = getUserDefinedConstants();
foreach ($constantsAfterInclude as $constKey => $constValue) {
if (strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) {
if (mb_strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) {
$moduleConstants[$constKey] = $constKey;
}
}

//get all php and tpl files from module
$check_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName;
$Directory = new RecursiveDirectoryIterator($check_path);
$Iterator = new RecursiveIteratorIterator($Directory);
$Directory = new RecursiveDirectoryIterator($check_path);
$Iterator = new RecursiveIteratorIterator($Directory);
$regexFiles = new RegexIterator($Iterator, '/^.+\.(php|tpl)$/i', RecursiveRegexIterator::GET_MATCH);
//$files = new RegexIterator($flattened, '#^(?:[A-Z]:)?(?:/(?!\.Trash)[^/]+)+/[^/]+\.(?:php|html)$#Di');
$modfiles = [];
foreach($regexFiles as $regexFiles) {
foreach ($regexFiles as $regexFiles) {
$file = str_replace('\\', '/', $regexFiles[0]);
if (!\in_array($file, $langfiles)) {
$modfiles[] = $file;
Expand All @@ -91,50 +90,50 @@
//check all constants in all files
$resultCheck = [];
foreach ($moduleConstants as $constKey) {
$foundMod = 0;
$first = '';
$foundMod = 0;
$first = '';
$foundLang = 'not defined';
//search for complete string
foreach($modfiles as $modfile) {
if( strpos(file_get_contents($modfile),$constKey) !== false) {
foreach ($modfiles as $modfile) {
if (mb_strpos(file_get_contents($modfile), $constKey) !== false) {
$foundMod = 1;
$first = $modfile;
$first = $modfile;
break;
}
}
if (0 == $foundMod) {
//search for concatenated string
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
foreach($modfiles as $modfile) {
if( strpos(file_get_contents($modfile),$needle) !== false) {
foreach ($modfiles as $modfile) {
if (mb_strpos(file_get_contents($modfile), $needle) !== false) {
$foundMod = 1;
$first = $modfile;
$first = $modfile;
break;
}
}
}
if (0 == $foundMod) {
//search for concatenated string
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
foreach($modfiles as $modfile) {
if( strpos(file_get_contents($modfile),$needle) !== false) {
foreach ($modfiles as $modfile) {
if (mb_strpos(file_get_contents($modfile), $needle) !== false) {
$foundMod = 1;
$first = $modfile;
$first = $modfile;
break;
}
}
}
foreach($langfiles as $langfile) {
if( strpos(file_get_contents($langfile),$constKey) !== false) {
foreach ($langfiles as $langfile) {
if (mb_strpos(file_get_contents($langfile), $constKey) !== false) {
$foundLang = $langfile;
break;
}
}
if ('' == $foundLang) {
//search for concatenated string
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
foreach($langfiles as $langfile) {
if( strpos(file_get_contents($langfile),$needle) !== false) {
foreach ($langfiles as $langfile) {
if (mb_strpos(file_get_contents($langfile), $needle) !== false) {
$foundLang = $langfile;
break;
}
Expand All @@ -143,8 +142,8 @@
if ('' == $foundLang) {
//search for concatenated string
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
foreach($langfiles as $langfile) {
if( strpos(file_get_contents($langfile),$needle) !== false) {
foreach ($langfiles as $langfile) {
if (mb_strpos(file_get_contents($langfile), $needle) !== false) {
$foundLang = $langfile;
break;
}
Expand All @@ -158,8 +157,8 @@
break;
case 'tab_replacer':
$tabModule = Request::getString('tab_module');
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule;
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule;
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
@\mkdir($dst_path);
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/' . $tabModule;
@\mkdir($dst_path);
Expand All @@ -171,27 +170,25 @@
default:
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
$dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/';
$GLOBALS['xoopsTpl']->assign('fq_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC));
$GLOBALS['xoopsTpl']->assign('fq_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC));
$fq_form = Devtools::getFormModulesFq();
$GLOBALS['xoopsTpl']->assign('fq_form', $fq_form->render());
$cl_form = Devtools::getFormModulesCl();
$GLOBALS['xoopsTpl']->assign('cl_form', $cl_form->render());
$tab_form = Devtools::getFormModulesTab();
$GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render());
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
$GLOBALS['xoopsTpl']->assign('tab_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC));
$GLOBALS['xoopsTpl']->assign('devtools_list',true);
$GLOBALS['xoopsTpl']->assign('tab_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC));
$GLOBALS['xoopsTpl']->assign('devtools_list', true);

break;
}

function getUserDefinedConstants() {
function getUserDefinedConstants()
{
$constants = get_defined_constants(true);
return (isset($constants['user']) ? $constants['user'] : []);

return ($constants['user'] ?? []);
}

require __DIR__ . '/footer.php';




6 changes: 3 additions & 3 deletions admin/feedback.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
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
Expand All @@ -13,8 +13,8 @@
* Feedback plugin for xoops modules
*
* @copyright XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Michael Beck <mambax7@gmailc.com>
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Michael Beck <mambax7@gmail.com>
* @author Wedega - Email:<webmaster@wedega.com>
* @author Fernando Santos (topet05) <fernando@mastop.com.br>
*/
Expand Down
5 changes: 2 additions & 3 deletions admin/fields.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

/*
You may not change or alter any portion of this comment or credits
Expand Down Expand Up @@ -27,9 +27,8 @@
*
* @since 2.5.0
*
* @author Txmod Xoops https://xoops.org
* @author Txmod Xoops https://xoops.org
* Goffy https://myxoops.org
*
*/

// Define main template
Expand Down
5 changes: 2 additions & 3 deletions admin/footer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

/*
You may not change or alter any portion of this comment or credits
Expand All @@ -18,9 +18,8 @@
*
* @since 2.5.0
*
* @author Txmod Xoops https://xoops.org
* @author Txmod Xoops https://xoops.org
* Goffy https://myxoops.org
*
*/
$pathIcon32 = Xmf\Module\Admin::iconUrl();

Expand Down
5 changes: 2 additions & 3 deletions admin/header.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
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
Expand All @@ -17,9 +17,8 @@
*
* @since 2.5.0
*
* @author Txmod Xoops https://xoops.org
* @author Txmod Xoops https://xoops.org
* Goffy https://myxoops.org
*
*/
require \dirname(__DIR__) . '/preloads/autoloader.php';

Expand Down
Loading