Skip to content

Commit

Permalink
- replaced index.html by index.php
Browse files Browse the repository at this point in the history
 - added replacement of tabs by 4 spaces in devtools
  • Loading branch information
ggoffy committed Apr 4, 2021
1 parent c8a39be commit 1ce4644
Show file tree
Hide file tree
Showing 122 changed files with 248 additions and 97 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Screenshot:
Clear version

# Require:
- XOOPS 2.5.10;
- XOOPS 2.5.11;
- XOOPS Admin 1.2;
- PHP 7.3 or higher;
- MySQL 5.5; -> Minimum Recommended Using InnoDB Version 5.1 or Later
Expand All @@ -43,14 +43,16 @@ Clear version
# Info
ModuleBuilder is a module that create other basic modules for XOOPS CMS.

**ModuleBuilder is tested with PHP 8. Created modules are ready for PHP 8.0**

Tested with XOOPS 2.5.11, you can not use it with earlier versions, unless because you don't fit some core files in the background and after some tests.

That is ahead XOOPS versions, and goes to 2.6.0, you should download XOOPS 2.5 and use with this latest version.

Therefore recommended not to use modulebuilder 3.x, with previous versions of XOOPS 2.5.10

# System - Tests
PHP = 7.3, 7.4
PHP = 7.3, 7.4, 8.0

MySQL = 5.6.20, 5.7.11

Expand Down
20 changes: 0 additions & 20 deletions _TODO.txt
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@

TODOs:

Permissions:
implement autoapprove

check error handling for upload image list (// Set Var tf_imagelist)


*****************************
Open questions:
***************

search.php:
what should this file do, additionally to regular search?
UserSearch has to be adapted


Parent:
what is the idea behind this?
15 changes: 15 additions & 0 deletions admin/devtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@
$GLOBALS['xoopsTpl']->assign('clresults', $resultCheck);
$GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);

break;
case 'tab_replacer':
$tabModule = Request::getString('tab_module');
$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);

Devtools::function_tabreplacer($src_path, $dst_path, $tabModule);
\redirect_header('devtools.php', 3, _AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS);
break;
case 'list':
default:
Expand All @@ -165,6 +176,10 @@
$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);

break;
Expand Down
1 change: 0 additions & 1 deletion admin/index.html

This file was deleted.

1 change: 0 additions & 1 deletion assets/css/admin/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/css/admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/css/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/css/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/fonts/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/fonts/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/icons/16/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/icons/16/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/icons/24/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/icons/24/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/icons/32/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/icons/32/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/icons/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/icons/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/images/logos/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/images/logos/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions assets/images/modules/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion assets/js/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions assets/js/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion class/Common/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions class/Common/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
86 changes: 70 additions & 16 deletions class/Devtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
*/
class Devtools
{

/* function to add function qualifier to module */
/**
* @param $src_path
* @param $dst_path
* @param $moduleName
*/
public static function function_qualifier($src_path, $dst_path, $moduleName) {

$functions = [];
Expand Down Expand Up @@ -239,14 +244,27 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) {

}

/* function to add function qualifier to module */
/**
* @param $src_path
* @param $dst_path
* @param $moduleName
*/
public static function function_tabreplacer($src_path, $dst_path, $moduleName) {
$patKeys = [];
$patValues = [];
Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues, true);
}

// recursive cloning script
/**
* @param $src_path
* @param $dst_path
* @param array $patKeys
* @param array $patValues
* @param bool $replaceTabs
*/
public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues =[])
public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues =[], $replaceTabs = false)
{
// open the source directory
$dir = \opendir($src_path);
Expand All @@ -257,9 +275,9 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat
if (( $file != '.' ) && ( $file != '..' )) {
if ( \is_dir($src_path . '/' . $file) ) {
// Recursively calling custom copy function for sub directory
Devtools::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues);
Devtools::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs);
} else {
Devtools::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues);
Devtools::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs);
}
}
}
Expand All @@ -271,8 +289,10 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat
* @param $dst_file
* @param array $patKeys
* @param array $patValues
* @param array $patValues
* @param bool $replaceTabs
*/
private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[])
private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[], $replaceTabs = false)
{
$replace_code = false;
$changeExtensions = ['php'];
Expand All @@ -286,7 +306,11 @@ private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValue
if ($replace_code) {
// file, read it and replace text
$content = \file_get_contents($src_file);
$content = \str_replace($patKeys, $patValues, $content);
if ($replaceTabs) {
$content = \preg_replace("/[\t]+/", " ", $content);
} else {
$content = \str_replace($patKeys, $patValues, $content);
}
//check file name whether it contains replace code
$path_parts = \pathinfo($dst_file);
$path = $path_parts['dirname'];
Expand All @@ -312,20 +336,21 @@ public static function getFormModulesFq($action = false)
\xoops_load('XoopsFormLoader');
$form = new \XoopsSimpleForm('', 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Form Table projects
$resPro_idSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_FQ_MODULE, 'fq_module', '');
// Form Select Module
$modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_FQ_MODULE, 'fq_module', '');
$modulesArr = \XoopsLists::getModulesList();
$resPro_idSelect->addOption('', ' ');
$modulesSelect->addOption('', ' ');
foreach ($modulesArr as $mod) {
$resPro_idSelect->addOption($mod, $mod);
$modulesSelect->addOption($mod, $mod);
}
$form->addElement($resPro_idSelect, true);
$form->addElement($modulesSelect, true);
// To Save
$form->addElement(new \XoopsFormHidden('op', 'fq'));
$form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));

return $form;
}

/**
* get form with all existing modules
* @param bool $action
Expand All @@ -340,18 +365,47 @@ public static function getFormModulesCl($action = false)
\xoops_load('XoopsFormLoader');
$form = new \XoopsSimpleForm('', 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Form Table projects
$resPro_idSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_CL_MODULE, 'cl_module', '');
// Form Select Module
$modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_CL_MODULE, 'cl_module', '');
$modulesArr = \XoopsLists::getModulesList();
$resPro_idSelect->addOption('', ' ');
$modulesSelect->addOption('', ' ');
foreach ($modulesArr as $mod) {
$resPro_idSelect->addOption($mod, $mod);
$modulesSelect->addOption($mod, $mod);
}
$form->addElement($resPro_idSelect, true);
$form->addElement($modulesSelect, true);
// To Save
$form->addElement(new \XoopsFormHidden('op', 'check_lang'));
$form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));

return $form;
}

/**
* get form with all existing modules
* @param bool $action
* @return \XoopsThemeForm
*/
public static function getFormModulesTab($action = false)
{
if (!$action) {
$action = $_SERVER['REQUEST_URI'];
}
// Get Theme Form
\xoops_load('XoopsFormLoader');
$form = new \XoopsSimpleForm('', 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Form Select Module
$modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_TAB_MODULE, 'tab_module', '');
$modulesArr = \XoopsLists::getModulesList();
$modulesSelect->addOption('', ' ');
foreach ($modulesArr as $mod) {
$modulesSelect->addOption($mod, $mod);
}
$form->addElement($modulesSelect, true);
// To Save
$form->addElement(new \XoopsFormHidden('op', 'tab_replacer'));
$form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));

return $form;
}
}
2 changes: 2 additions & 0 deletions class/Files/Admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Assets/Css/Admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Assets/Css/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Assets/Js/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion class/Files/Assets/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions class/Files/Assets/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Blocks/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Classes/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Config/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 1 addition & 1 deletion class/Files/CreateArchitecture.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function setBaseFoldersFiles($module)
}
if (1 == $module->getVar('mod_admin')) {
// Creation of "admin" folder and index.php file
$this->makeDirAndCopyFile('admin', $indexFile, 'index.php');
$this->makeDirInModule('admin');
}
if (1 == $module->getVar('mod_blocks')) {
// Creation of "blocks" folder and index.php file
Expand Down
2 changes: 2 additions & 0 deletions class/Files/Docs/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion class/Files/Includes/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions class/Files/Includes/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Language/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Sql/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Templates/Admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion class/Files/Templates/Blocks/Defstyle/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions class/Files/Templates/Blocks/Defstyle/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
2 changes: 2 additions & 0 deletions class/Files/Templates/Blocks/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');
1 change: 0 additions & 1 deletion class/Files/Templates/User/Defstyle/index.html

This file was deleted.

1 change: 0 additions & 1 deletion class/Files/Templates/User/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions class/Files/Templates/User/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
header('HTTP/1.0 404 Not Found');

0 comments on commit 1ce4644

Please sign in to comment.