diff --git a/.atoum.php b/.atoum.php index e9c8ba6c..902a12dc 100644 --- a/.atoum.php +++ b/.atoum.php @@ -1,4 +1,5 @@ -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)); @@ -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 = []; @@ -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); @@ -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)) { @@ -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 diff --git a/admin/devtools.php b/admin/devtools.php index 8f4ac5fa..27a50a51 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -1,4 +1,4 @@ -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) { @@ -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; @@ -91,24 +90,24 @@ //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; } } @@ -116,16 +115,16 @@ 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; } @@ -133,8 +132,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; } @@ -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; } @@ -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); @@ -171,7 +170,7 @@ 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(); @@ -179,19 +178,17 @@ $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'; - - - - diff --git a/admin/feedback.php b/admin/feedback.php index 44598b97..01306dc2 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck * @author Wedega - Email: * @author Fernando Santos (topet05) */ diff --git a/admin/fields.php b/admin/fields.php index ff621407..82f953dc 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -1,4 +1,4 @@ -queryF($sql); if (!$result instanceof \mysqli_result) { -// echo '_AM_MODULEBUILDER_ERROR_DATABASE'; -// echo '_AM_MODULEBUILDER_ERROR_SQL' . $GLOBALS['xoopsDB']->error(); + // echo '_AM_MODULEBUILDER_ERROR_DATABASE'; + // echo '_AM_MODULEBUILDER_ERROR_SQL' . $GLOBALS['xoopsDB']->error(); \trigger_error($GLOBALS['xoopsDB']->error()); } diff --git a/admin/index.php b/admin/index.php index 9cbe408c..13c16d96 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,4 +1,4 @@ - - * */ require __DIR__ . '/header.php'; $funct = \Xmf\Request::getString('funct', '', 'GET'); @@ -36,7 +35,7 @@ /** * @param string $val */ -function phpFunction($val = '') +function phpFunction($val = ''): void { // create php function here echo $val; diff --git a/admin/menu.php b/admin/menu.php index b68be2f0..11f358be 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -1,4 +1,4 @@ - // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // -// Project: XOOPS Project // -// ------------------------------------------------------------------------- // + + * @author Michael Beck + */ use Xmf\Request; use XoopsModules\Modulebuilder; @@ -38,18 +27,18 @@ $adminObject->displayNavigation(\basename(__FILE__)); echo << -
- -
-
- -
-
- -
- -EOF; +
+
+ +
+
+ +
+
+ +
+
+ EOF; //XoopsLoad::load('migrate', 'newbb'); diff --git a/admin/modules.php b/admin/modules.php index 3295f769..13ac8978 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -1,4 +1,4 @@ - - * */ use Xmf\Request; @@ -29,6 +28,7 @@ }; /** @var Helper $helper */ +/** @var Admin $adminObject */ // Define main template $templateMain = 'modulebuilder_modules.tpl'; @@ -91,7 +91,6 @@ $form = $modulesObj->getFormModules(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; - case 'modules_import': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); @@ -103,7 +102,6 @@ $GLOBALS['xoopsTpl']->assign('tables_list', $result['tables']); } break; - case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { \redirect_header('modules.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); @@ -301,7 +299,7 @@ if (!$resultTables instanceof \mysqli_result) { \trigger_error($GLOBALS['xoopsDB']->error()); } - $num_rows1 = $GLOBALS['xoopsDB']->getRowsNum($resultTables); + $num_rows1 = $GLOBALS['xoopsDB']->getRowsNum($resultTables); if ($num_rows1 > 0) { while (false !== ($myTables = $GLOBALS['xoopsDB']->fetchArray($resultTables))) { $tableIdSource = $myTables['table_id']; @@ -333,7 +331,7 @@ if (!$resultFields instanceof \mysqli_result) { \trigger_error($GLOBALS['xoopsDB']->error()); } - $num_rows2 = $GLOBALS['xoopsDB']->getRowsNum($resultFields); + $num_rows2 = $GLOBALS['xoopsDB']->getRowsNum($resultFields); if ($num_rows2 > 0) { while (false !== ($myField = $GLOBALS['xoopsDB']->fetchArray($resultFields))) { $fieldIdSource = $myField['field_id']; diff --git a/admin/morefiles.php b/admin/morefiles.php index 315b5556..4d1cce46 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -1,4 +1,4 @@ - - * */ // Define main template diff --git a/admin/settings.php b/admin/settings.php index 4e4247f7..8062178d 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,4 +1,4 @@ - - * */ // Define main template diff --git a/admin/tables.php b/admin/tables.php index 388517be..406fac93 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -1,4 +1,4 @@ - * @package Modulebuilder * @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = '') + public function addLink($title = '', $link = ''): void { $this->bread[] = [ 'link' => $link, diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index ff79b02a..5435ccd9 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,4 +1,4 @@ - - Website: @@ -85,7 +84,6 @@ public function getFormConfirm() $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); } if ('' === $this->label) { - $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); } @@ -104,6 +102,7 @@ public function getFormConfirm() $buttonBack->setExtra('onclick="history.go(-1);return true;"'); $buttonTray->addElement($buttonBack); $form->addElement($buttonTray); + return $form; } } diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 1243352b..6c450a96 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -1,4 +1,4 @@ - */ trait FilesManagement @@ -27,7 +27,7 @@ trait FilesManagement * @return void * @throws \RuntimeException */ - public static function createFolder($folder) + public static function createFolder($folder): void { try { if (!\file_exists($folder)) { @@ -43,11 +43,11 @@ public static function createFolder($folder) } /** - * @param $file - * @param $folder + * @param string $file + * @param string $folder * @return bool */ - public static function copyFile($file, $folder) + public static function copyFile(string $file, string $folder): bool { return \copy($file, $folder); } @@ -56,7 +56,7 @@ public static function copyFile($file, $folder) * @param $src * @param $dst */ - public static function recurseCopy($src, $dst) + public static function recurseCopy($src, $dst): void { $dir = \opendir($src); // @\mkdir($dst); @@ -82,7 +82,7 @@ public static function recurseCopy($src, $dst) * @return bool Returns true on success, false on failure * @author Aidan Lister * @version 1.0.1 - * @link http://aidanlister.com/2004/04/recursively-copying-directories-in-php/ + * @link https://aidanlister.com/2004/04/recursively-copying-directories-in-php/ */ public static function xcopy($source, $dest) { @@ -208,6 +208,7 @@ public static function rrmdir($src) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } @@ -248,6 +249,7 @@ public static function rmove($src, $dest) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 42dd2113..5e46abac 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -1,4 +1,4 @@ - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ - class Migrate extends \Xmf\Database\Migrate { private $renameTables; @@ -44,7 +43,7 @@ public function __construct(Common\Configurator $configurator = null) /** * change table prefix if needed */ - private function changePrefix() + private function changePrefix(): void { foreach ($this->renameTables as $oldName => $newName) { if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { @@ -59,7 +58,7 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + private function convertIPAddresses($tableName, $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); @@ -77,7 +76,7 @@ private function convertIPAddresses($tableName, $columnName) /** * Move do* columns from newbb_posts to newbb_posts_text table */ - private function moveDoColumns() + private function moveDoColumns(): void { $tableName = 'newbb_posts_text'; $srcTableName = 'newbb_posts'; @@ -101,7 +100,7 @@ private function moveDoColumns() * table and column renames * data conversions */ - protected function preSyncActions() + protected function preSyncActions(): void { /* // change 'bb' table prefix to 'newbb' diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php index 76e8b806..f4b68532 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck * @author Wedega - Email: * @author Fernando Santos (topet05) */ @@ -48,7 +48,7 @@ public function __construct() * * @param null */ - public static function getInstance() + public static function getInstance(): void { static $instance = false; if (!$instance) { diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 5f28a252..7fb40989 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck */ trait ModuleStats { diff --git a/class/Common/Resizer.php b/class/Common/Resizer.php index c87b384b..5d58d672 100644 --- a/class/Common/Resizer.php +++ b/class/Common/Resizer.php @@ -1,4 +1,4 @@ - - Website: @@ -65,8 +64,8 @@ public function resizeImage() if ($width > $this->maxWidth || $height > $this->maxHeight) { // recalc image size based on this->maxWidth/this->maxHeight - $new_width = 0; - $new_height = 0; + $new_width = 0; + $new_height = 0; if ($width > $height) { if ($width < $this->maxWidth) { $new_width = $width; @@ -184,7 +183,7 @@ public function resizeAndCrop() return true; } - public function mergeImage() + public function mergeImage(): void { $dest = \imagecreatefromjpeg($this->endFile); $src = \imagecreatefromjpeg($this->sourceFile); diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 04c0dd74..7227cb9b 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,4 +1,4 @@ - */ trait ServerStats diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index f71d56c1..e8d4d9de 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -1,4 +1,4 @@ - * @author Mamba */ -use MyTextSanitizer; -use XoopsFormDhtmlTextArea; -use XoopsFormTextArea; -use XoopsModules\Modulebuilder; use XoopsModules\Modulebuilder\Helper; /** @@ -50,7 +45,6 @@ class SysUtility * Access the only instance of this class * * @return object - * */ public static function getInstance() { diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index b1f73a02..1ef283d7 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -1,4 +1,4 @@ - * @copyright 2021 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ - class TableChecker extends \XoopsObject { - /** * @var mixed */ private $after = null; - /** * @var mixed */ private $mydirname = null; - /** * @var mixed */ private $result = []; - /** * @var mixed */ @@ -50,10 +45,10 @@ class TableChecker extends \XoopsObject public const CHECKTYPE_UPDATE = 1; //update only public const CHECKTYPE_UPDATE_REPORT = 2; //update and report - /** * @param \XoopsModules\Modulebuilder\Common\TableChecker|null - * @param int $checktype + * @param mixed $mydirname + * @param mixed $checktype */ public function __construct($mydirname, $checktype = 0) { @@ -62,12 +57,8 @@ public function __construct($mydirname, $checktype = 0) $this->result = []; } - /** - * - */ public function processSQL() { - $tabledefs = $this->readSQLFile(); $this->result[] = 'Tables found in sql:' . \count($tabledefs); @@ -103,9 +94,6 @@ public function processSQL() } } - /** - * - */ private function readSQLFile() { $tabledefs = []; @@ -121,11 +109,11 @@ private function readSQLFile() $sqlutil = new \SqlUtility(); $pieces = []; $sql_query = \trim(file_get_contents($sql_file_path)); - $sqlutil->splitMySqlFile($pieces, $sql_query); + $sqlutil::splitMySqlFile($pieces, $sql_query); $countTable = 0; foreach ($pieces as $piece) { - $singleSql = $sqlutil->prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); + $singleSql = $sqlutil::prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); $lines = \preg_split('/\r\n|\n|\r/', $piece); //var_dump($lines); $needle1 = 'create table'; @@ -139,14 +127,14 @@ private function readSQLFile() $needle2 = 'primary key'; $needle3 = 'unique key'; $needle4 = 'key'; - if (0 === \stripos(\trim($line), $needle2)) { + if (0 === \mb_stripos(\trim($line), $needle2)) { $tabledefs[$countTable][$needle2] = $line; - } elseif (0 === \stripos(\trim($line), $needle3)) { + } elseif (0 === \mb_stripos(\trim($line), $needle3)) { $tabledefs[$countTable][$needle3] = $line; - } elseif (0 === \stripos(\trim($line), $needle4)) { + } elseif (0 === \mb_stripos(\trim($line), $needle4)) { $tabledefs[$countTable][$needle4] = $line; } else { - if (\strpos($line, '`') > 0) { + if (\mb_strpos($line, '`') > 0) { $tabledefs[$countTable]['fields'][] = $this->extractField($line); } } @@ -164,19 +152,19 @@ private function readSQLFile() return $tabledefs; } - - private function extractKey($line) { + private function extractKey($line) + { //todo: split string into single keys $needle = '('; - $key_text = \substr($line, \strpos($line, $needle) + 1); + $key_text = \substr($line, \strpos($line, $needle, 0) + 1); $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle)); + $key_text = \substr($key_text, 0, \strpos($key_text, $needle, 0)); return $key_text; - } - private function extractField($line) { + private function extractField($line) + { //todo $counter = 0; $clean = mb_substr(\trim($line), 0, -1); @@ -211,7 +199,6 @@ private function extractField($line) { $this->after = $field['name']; return $field; - } private function checkTableFields($table, $fields) diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index c601834f..a8db9c77 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -1,6 +1,4 @@ - * @copyright {@link https://xoops.org/ XOOPS Project} - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ use Xmf\Request; use Xmf\Yaml; use XoopsModules\Modulebuilder\Helper; + /** @var Helper $helper */ /** @@ -32,16 +30,19 @@ */ class TestdataButtons { - //functions for import buttons - public static function loadButtonConfig($adminObject) + /** + * @param \Xmf\Module\Admin $adminObject + * @return void + */ + public static function loadButtonConfig(\Xmf\Module\Admin $adminObject) { - $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; - $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps - $displaySampleButton = $config['displaySampleButton']; - $helper = Helper::getInstance(); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $config[] = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $displaySampleButton = $config[0]['displaySampleButton']; + $helper = Helper::getInstance(); if (1 == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); @@ -56,18 +57,18 @@ public static function loadButtonConfig($adminObject) } } - public static function hideButtons() + public static function hideButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 0; Yaml::save($app, $yamlFile); \redirect_header('index.php', 0); } - public static function showButtons() + public static function showButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 1; Yaml::save($app, $yamlFile); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index b52d89b7..9c0bee7f 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -1,4 +1,4 @@ - */ trait VersionChecks diff --git a/class/Common/index.php b/class/Common/index.php index 6a505435..e5ee0725 100644 --- a/class/Common/index.php +++ b/class/Common/index.php @@ -1,2 +1,2 @@ - - Website: @@ -29,41 +28,41 @@ interface Constants { // Constants for morefiles - const MORE_FILES_TYPE_EMPTY = 1; - const MORE_FILES_TYPE_COPY = 2; + public const MORE_FILES_TYPE_EMPTY = 1; + public const MORE_FILES_TYPE_COPY = 2; - const FIRST_FIELDELEMENT_TABLE = 31; + public const FIRST_FIELDELEMENT_TABLE = 31; // ------------------- Field elements --------------------------------- // --------- The values MUST BE IDENTICAL to fieldelement_id ---------- - const FIELD_ELE_TEXT = 2; - const FIELD_ELE_TEXTAREA = 3; - const FIELD_ELE_DHTMLTEXTAREA = 4; - const FIELD_ELE_CHECKBOX = 5; - const FIELD_ELE_RADIOYN = 6; - const FIELD_ELE_SELECTBOX = 7; - const FIELD_ELE_SELECTUSER = 8; - const FIELD_ELE_COLORPICKER = 9; - const FIELD_ELE_IMAGELIST = 10; - const FIELD_ELE_SELECTFILE = 11; - const FIELD_ELE_URLFILE = 12; - const FIELD_ELE_UPLOADIMAGE = 13; - const FIELD_ELE_UPLOADFILE = 14; - const FIELD_ELE_TEXTDATESELECT = 15; - const FIELD_ELE_SELECTSTATUS = 16; - const FIELD_ELE_PASSWORD = 17; - const FIELD_ELE_SELECTCOUNTRY = 18; - const FIELD_ELE_SELECTLANG = 19; - const FIELD_ELE_RADIO = 20; - const FIELD_ELE_DATETIME = 21; - const FIELD_ELE_SELECTCOMBO = 22; - const FIELD_ELE_TEXTUUID = 23; - const FIELD_ELE_TEXTIP = 24; - const FIELD_ELE_TEXTCOMMENTS = 25; - const FIELD_ELE_TEXTRATINGS = 26; - const FIELD_ELE_TEXTVOTES = 27; - const FIELD_ELE_TEXTREADS = 28; - const FIELD_ELE_TEXTINTEGER = 29; - const FIELD_ELE_TEXTFLOAT = 30; + public const FIELD_ELE_TEXT = 2; + public const FIELD_ELE_TEXTAREA = 3; + public const FIELD_ELE_DHTMLTEXTAREA = 4; + public const FIELD_ELE_CHECKBOX = 5; + public const FIELD_ELE_RADIOYN = 6; + public const FIELD_ELE_SELECTBOX = 7; + public const FIELD_ELE_SELECTUSER = 8; + public const FIELD_ELE_COLORPICKER = 9; + public const FIELD_ELE_IMAGELIST = 10; + public const FIELD_ELE_SELECTFILE = 11; + public const FIELD_ELE_URLFILE = 12; + public const FIELD_ELE_UPLOADIMAGE = 13; + public const FIELD_ELE_UPLOADFILE = 14; + public const FIELD_ELE_TEXTDATESELECT = 15; + public const FIELD_ELE_SELECTSTATUS = 16; + public const FIELD_ELE_PASSWORD = 17; + public const FIELD_ELE_SELECTCOUNTRY = 18; + public const FIELD_ELE_SELECTLANG = 19; + public const FIELD_ELE_RADIO = 20; + public const FIELD_ELE_DATETIME = 21; + public const FIELD_ELE_SELECTCOMBO = 22; + public const FIELD_ELE_TEXTUUID = 23; + public const FIELD_ELE_TEXTIP = 24; + public const FIELD_ELE_TEXTCOMMENTS = 25; + public const FIELD_ELE_TEXTRATINGS = 26; + public const FIELD_ELE_TEXTVOTES = 27; + public const FIELD_ELE_TEXTREADS = 28; + public const FIELD_ELE_TEXTINTEGER = 29; + public const FIELD_ELE_TEXTFLOAT = 30; } diff --git a/class/Devtools.php b/class/Devtools.php index 11571c99..d430211e 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -1,4 +1,4 @@ - @@ -34,13 +33,14 @@ 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) { - + public static function function_qualifier($src_path, $dst_path, $moduleName): void + { $functions = []; $constants = []; @@ -321,22 +321,24 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { $patKeys = \array_keys($patterns); $patValues = \array_values($patterns); - Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues); - + self::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues); } /* function to add function qualifier to module */ + /** * @param $src_path * @param $dst_path */ - public static function function_tabreplacer($src_path, $dst_path) { + public static function function_tabreplacer($src_path, $dst_path): void + { $patKeys = []; $patValues = []; - Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues, true); + self::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues, true); } // recursive cloning script + /** * @param $src_path * @param $dst_path @@ -344,7 +346,7 @@ public static function function_tabreplacer($src_path, $dst_path) { * @param array $patValues * @param bool $replaceTabs */ - public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues =[], $replaceTabs = false) + public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues = [], $replaceTabs = false): void { // open the source directory $dir = \opendir($src_path); @@ -355,9 +357,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, $replaceTabs); + self::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs); } else { - Devtools::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs); + self::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs); } } } @@ -369,16 +371,16 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat * @param $dst_file * @param array $patKeys * @param array $patValues - * @param bool $replaceTabs + * @param bool $replaceTabs */ - private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[], $replaceTabs = false) + private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues = [], $replaceTabs = false): void { $replace_code = false; $changeExtensions = ['php']; if (\in_array(\mb_strtolower(\pathinfo($src_file, PATHINFO_EXTENSION)), $changeExtensions)) { $replace_code = true; } - if (\strpos( $dst_file, \basename(__FILE__)) > 0) { + if (\mb_strpos($dst_file, \basename(__FILE__)) > 0) { //skip myself $replace_code = false; } @@ -386,7 +388,7 @@ private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValue // file, read it and replace text $content = \file_get_contents($src_file); if ($replaceTabs) { - $content = \preg_replace("/[\t]+/", " ", $content); + $content = \preg_replace("/[\t]+/", ' ', $content); } else { $content = \str_replace($patKeys, $patValues, $content); } diff --git a/class/Fieldattributes.php b/class/Fieldattributes.php index b7366d37..23723c3e 100644 --- a/class/Fieldattributes.php +++ b/class/Fieldattributes.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/FieldattributesHandler.php b/class/FieldattributesHandler.php index a4da21c3..88290684 100644 --- a/class/FieldattributesHandler.php +++ b/class/FieldattributesHandler.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/Fieldelements.php b/class/Fieldelements.php index 37f0a8fd..35273654 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -1,4 +1,4 @@ - - * */ /** @@ -55,7 +54,7 @@ public function __construct() */ public function __call($method, $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } diff --git a/class/FieldelementsHandler.php b/class/FieldelementsHandler.php index 40ce8220..6426927a 100644 --- a/class/FieldelementsHandler.php +++ b/class/FieldelementsHandler.php @@ -1,4 +1,4 @@ - - * */ /** @@ -143,9 +142,10 @@ public function getFieldelementsList($crFieldElemsCriteria, $start = 0, $limit = if (1 == $i) { $fieldele[$i] = '...'; } else { - $fieldele[$i] = constant ('\_AM_MODULEBUILDER_FIELD_ELE_' . $stuFeName); + $fieldele[$i] = constant('\_AM_MODULEBUILDER_FIELD_ELE_' . $stuFeName); } } + return $fieldele; } } diff --git a/class/Fieldkey.php b/class/Fieldkey.php index 4d7b61e0..8bdc1622 100644 --- a/class/Fieldkey.php +++ b/class/Fieldkey.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/FieldkeyHandler.php b/class/FieldkeyHandler.php index 9711aee9..72e7c22f 100644 --- a/class/FieldkeyHandler.php +++ b/class/FieldkeyHandler.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/Fieldnull.php b/class/Fieldnull.php index c45ced00..2b368711 100644 --- a/class/Fieldnull.php +++ b/class/Fieldnull.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/FieldnullHandler.php b/class/FieldnullHandler.php index c4358abb..727d2492 100644 --- a/class/FieldnullHandler.php +++ b/class/FieldnullHandler.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/Fields.php b/class/Fields.php index dbdb0d67..c54a074c 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** @@ -75,7 +74,7 @@ public function __construct() */ public function __call($method, $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -179,7 +178,7 @@ public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null * @param $fName * @param $tableAutoincrement */ - private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $tableAutoincrement) + private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $tableAutoincrement): void { $helper = Modulebuilder\Helper::getInstance(); $fieldElements = $helper->getHandler('Fieldelements')->getAll(); diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index e4d26e76..2f1baaaf 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/Fieldtype.php b/class/Fieldtype.php index 67c310e8..673ef289 100644 --- a/class/Fieldtype.php +++ b/class/Fieldtype.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/FieldtypeHandler.php b/class/FieldtypeHandler.php index 4b930ebc..feab00c1 100644 --- a/class/FieldtypeHandler.php +++ b/class/FieldtypeHandler.php @@ -1,4 +1,4 @@ - - * */ /** diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 94d4f9ab..e0dd7a6c 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -110,7 +109,7 @@ private function getAdminHeader($moduleDirname) if (\is_object($table) && '' != $table->getVar('table_name')) { $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get instance of module'); - $ret .= $this->xc->getXcEqualsOperator("\$helper", "\XoopsModules\\{$ucfModuleDirname}\Helper::getInstance()"); + $ret .= $this->xc->getXcEqualsOperator('$helper', "\XoopsModules\\{$ucfModuleDirname}\Helper::getInstance()"); } if (\is_array($tables)) { foreach (\array_keys($tables) as $i) { @@ -121,7 +120,7 @@ private function getAdminHeader($moduleDirname) $ret .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); $ret .= $this->pc->getPhpCodeCommentLine(); $template = $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/template', true, false, 'require', "\t"); - $template .= $this->xc->getXcEqualsOperator('$xoopsTpl', 'new \XoopsTpl()', null,"\t"); + $template .= $this->xc->getXcEqualsOperator('$xoopsTpl', 'new \XoopsTpl()', null, "\t"); $ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!\is_object($xoopsTpl)', $template, false); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Load languages'); diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 00ff84d8..b5e8b1a4 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -1,4 +1,4 @@ -getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $language = $this->getLanguage($moduleDirname, 'AM'); @@ -153,7 +149,7 @@ private function getAdminIndex($module) $condIf .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'testdata/index', true, '','',"\t"); $condIf .= $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_ADD_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=load', $type = 'samplebutton', $t = "\t"); $condIf .= $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_SAVE_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=save', $type = 'samplebutton', $t = "\t"); - $condIf .= "//" . $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_EXPORT_SCHEMA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=exportschema', $type = 'samplebutton', $t = "\t"); + $condIf .= '//' . $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_EXPORT_SCHEMA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=exportschema', $type = 'samplebutton', $t = "\t"); $condIf .= $this->axc->getAdminDisplayButton('left', "\t"); $cond = $this->xc->getXcGetConfig('displaySampleButton'); $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf, false); diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index 571a2d7b..99908120 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -83,11 +82,11 @@ private function getAdminMenuArray($param = [], $adminObject = false) { $ret = ''; if ($adminObject) { - $ret .= $this->getSimpleString("\$adminmenu[] = ["); + $ret .= $this->getSimpleString('$adminmenu[] = ['); foreach ($param as $key => $value) { $ret .= $this->getSimpleString("\t'{$key}' => {$value},"); } - $ret .= $this->getSimpleString("];"); + $ret .= $this->getSimpleString('];'); } else { foreach ($param as $key => $value) { $ret .= $this->xc->getXcEqualsOperator((string)$key, (string)$value); diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 4097055d..43d70667 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -1,4 +1,4 @@ -pc->getPhpCodeUnset('permform'); $elseInter = $this->xc->getXcRedirectHeader("'permissions.php'", '', '3', "{$language}NO_PERMISSIONS_SET", false, "\t"); - $elseInter .= $this->getSimpleString("exit();", "\t"); + $elseInter .= $this->getSimpleString('exit();', "\t"); $ret .= $this->pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter, false); return $ret; diff --git a/class/Files/Admin/index.php b/class/Files/Admin/index.php index 6a505435..e5ee0725 100644 --- a/class/Files/Admin/index.php +++ b/class/Files/Admin/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); @@ -78,10 +77,10 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, '@charset "UTF-8";'); $content .= <<<'EOT' -img { - max-width: 200px; -} -EOT; + img { + max-width: 200px; + } + EOT; $this->create($moduleDirname, 'assets/css/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); diff --git a/class/Files/Assets/Css/Admin/index.php b/class/Files/Assets/Css/Admin/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Assets/Css/Admin/index.php +++ b/class/Files/Assets/Css/Admin/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); @@ -78,28 +77,28 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, '@charset "UTF-8";'); $content .= << li { - display: inline-block; -} + ul.menu > li { + display: inline-block; + } -ul.menu > li + li:before { - content: "|\a0"; -} + ul.menu > li + li:before { + content: "|\a0"; + } -.printOnly { - display: none; -} + .printOnly { + display: none; + } -img { - max-width: 300px; -} -EOT; + img { + max-width: 300px; + } + EOT; $this->create($moduleDirname, 'assets/css', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); diff --git a/class/Files/Assets/Css/index.php b/class/Files/Assets/Css/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Assets/Css/index.php +++ b/class/Files/Assets/Css/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); @@ -76,13 +75,13 @@ public function write($module, $filename) public function getJavascriptJQueryButtons() { $ret = << -EOT; + // + EOT; return $ret; } diff --git a/class/Files/Assets/Js/JsJquery.php b/class/Files/Assets/Js/JsJquery.php index 7c8742c6..973b7f6f 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -86,13 +85,13 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, true); $content .= <<<'EOT' -$(document).ready(function(){ - $( "button, input:button, input:submit, input:file, input:reset" ).css("color","inherit").button(); - $( ".check" ).css("color","#fff").button(); - $( ".radio" ).css("color","#fff").buttonset(); - $( ".toolbar" ).css("color","#000").buttonset(); -}); -EOT; + $(document).ready(function(){ + $( "button, input:button, input:submit, input:file, input:reset" ).css("color","inherit").button(); + $( ".check" ).css("color","#fff").button(); + $( ".radio" ).css("color","#fff").buttonset(); + $( ".toolbar" ).css("color","#000").buttonset(); + }); + EOT; $this->tdmcfile->create($moduleDirname, 'assets/js', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Assets/Js/index.php b/class/Files/Assets/Js/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Assets/Js/index.php +++ b/class/Files/Assets/Js/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setTable($table); @@ -120,12 +116,12 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $contIf .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", "{$moduleDirname}_block_addCatSelect(\$options)", "'IN'", true); $contIf2 = $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t"); - $contIf .= $this->pc->getPhpCodeConditions('1 != (\count(\$options) && 0 == \$options[0])', null, null, $contIf2, false, "\t"); + $contIf .= $this->pc->getPhpCodeConditions('1 != (\count(\$options) && 0 == \$options[0])', '', '', $contIf2, false, "\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); $contIf2 = $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t"); $contIf2 .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'", "\t\t"); $contIf2 .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'", "\t\t"); - $contIf .= $this->pc->getPhpCodeConditions('$typeBlock', null, null, $contIf2, false, "\t"); + $contIf .= $this->pc->getPhpCodeConditions('$typeBlock', '', '', $contIf2, false, "\t"); //content else: parent //search for SelectStatus field @@ -159,7 +155,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case1[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case2[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} new",'',"\t\t\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time() - 604800', "'>='", true); - $case2[] = $this->pc->getPhpCodeCommentLine("new since last week: 7 * 24 * 60 * 60 = 604800",'',"\t\t\t"); + $case2[] = $this->pc->getPhpCodeCommentLine('new since last week: 7 * 24 * 60 * 60 = 604800', '', "\t\t\t"); $case2[] = $this->xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time()', "'<='", true); $case2[] = $this->xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); @@ -241,7 +237,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->getSimpleString('return $block;',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_show", '$options', $func, '', false); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_show", '$options', $func, '', false, ""); return $ret; } @@ -298,10 +294,9 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->getSimpleString('return $form;', "\t"); $func .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, ''); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, '', false, ""); return $ret; - } /** diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php index a4265f13..d571ef69 100644 --- a/class/Files/Blocks/BlocksFilesSpotlight.php +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -1,4 +1,4 @@ -xc->getXcCriteria('', "'{$fieldId}'", "'(' . \implode(',', \$options) . ')'", "'IN'", true); $contIf = $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t"); $contIf .= $this->xc->getXcEqualsOperator('$limit', '0', '',"\t\t"); - $func .= $this->pc->getPhpCodeConditions('\count($options) > 0 && (int)$options[0] > 0', null, '', $contIf, false, "\t"); + $func .= $this->pc->getPhpCodeConditions('\count($options) > 0 && (int)$options[0] > 0', '', '', $contIf, false, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); diff --git a/class/Files/Blocks/index.php b/class/Files/Blocks/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Blocks/index.php +++ b/class/Files/Blocks/index.php @@ -1,2 +1,2 @@ -modId = $module->getVar('mod_id'); $this->tables = $this->cf->getTableTables($this->modId); - $this->infos = []; + $this->infos = []; $this->getCheckBlock(); $this->getCheckBroken(); @@ -100,7 +94,7 @@ public function getCheckPreBuilding($module) $this->getCheckUserpage(); $this->getCheckRating(); $this->getCheckReads(); - $this->getCheckSQL(); + $this->getCheckSql(); return $this->infos; } @@ -114,9 +108,9 @@ private function getCheckBroken() { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_broken')) { - $tableId = $this->tables[$t]->getVar('table_id'); - $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); $fieldSatus = ''; foreach (\array_keys($fields) as $f) { @@ -127,7 +121,7 @@ private function getCheckBroken() } // check whether each table with handling "broken" has also a field "status" if ('' == $fieldSatus) { - $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_BROKEN1); + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_BROKEN1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } @@ -145,20 +139,20 @@ private function getCheckUserpage() { //check field params: minimum one param is selected foreach (\array_keys($this->tables) as $t) { - $tableId = $this->tables[$t]->getVar('table_id'); + $tableId = $this->tables[$t]->getVar('table_id'); $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $fields = $this->cf->getTableFields($this->modId, $tableId); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); // check fields for parameters if ($f > 0) { $fieldParams = (int)$fields[$f]->getVar('field_parent') + (int)$fields[$f]->getVar('field_admin') + (int)$fields[$f]->getVar('field_inlist') + (int)$fields[$f]->getVar('field_inform') - + (int)$fields[$f]->getVar('field_user') + (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot') - + (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot') + (int)$fields[$f]->getVar('field_block') - + (int)$fields[$f]->getVar('field_main') + (int)$fields[$f]->getVar('field_search') + (int)$fields[$f]->getVar('field_required'); + + (int)$fields[$f]->getVar('field_user') + (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot') + + (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot') + (int)$fields[$f]->getVar('field_block') + + (int)$fields[$f]->getVar('field_main') + (int)$fields[$f]->getVar('field_search') + (int)$fields[$f]->getVar('field_required'); if (0 == $fieldParams) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS1); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } @@ -167,9 +161,9 @@ private function getCheckUserpage() //check field params: user file no usage in index or item foreach (\array_keys($this->tables) as $t) { - $tableId = $this->tables[$t]->getVar('table_id'); + $tableId = $this->tables[$t]->getVar('table_id'); $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $fields = $this->cf->getTableFields($this->modId, $tableId); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -177,9 +171,9 @@ private function getCheckUserpage() // check fields for parameters if ($f > 0) { $fieldParams = (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot') - + (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot'); + + (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot'); if (0 == $fieldParams) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS2); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS2); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } @@ -189,9 +183,9 @@ private function getCheckUserpage() //check field params: user file index multiple usage //check field params: user file item multiple usage foreach (\array_keys($this->tables) as $t) { - $tableId = $this->tables[$t]->getVar('table_id'); + $tableId = $this->tables[$t]->getVar('table_id'); $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $fields = $this->cf->getTableFields($this->modId, $tableId); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -200,12 +194,12 @@ private function getCheckUserpage() if ($f > 0) { $fieldParams = (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot'); if ($fieldParams > 1) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS3); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS3); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } $fieldParams = (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot'); if ($fieldParams > 1) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS3); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS3); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } @@ -217,7 +211,7 @@ private function getCheckUserpage() foreach (\array_keys($this->tables) as $t) { $tableName = $this->tables[$t]->getVar('table_name'); if ((0 == $this->tables[$t]->getVar('table_user')) && (1 == $this->tables[$t]->getVar('table_submit') || 1 == $this->tables[$t]->getVar('table_broken') || 1 == $this->tables[$t]->getVar('table_rate'))) { - $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_USERPAGE1); + $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_USERPAGE1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } @@ -239,27 +233,27 @@ private function getCheckUserpage() if (1 == $fields[$f]->getVar('field_user')) { // check fields for parameters if ($f > 0) { - $fieldParams = (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot'); + $fieldParams = (int)$fields[$f]->getVar('field_ihead') + (int)$fields[$f]->getVar('field_ibody') + (int)$fields[$f]->getVar('field_ifoot'); $fieldParamsIndex += $fieldParams; if ($fieldParams >= 1 && 0 == $tableIndex) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS5); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS5); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } - $fieldParams = (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot'); + $fieldParams = (int)$fields[$f]->getVar('field_thead') + (int)$fields[$f]->getVar('field_tbody') + (int)$fields[$f]->getVar('field_tfoot'); $fieldParamsUser += $fieldParams; if ($fieldParams >= 1 && 0 == $tableUser) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS7); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS7); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } } } if (0 == $fieldParamsIndex && 1 == $tableIndex) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS4); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS4); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } if (0 == $fieldParamsUser && 1 == $tableUser) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS6); + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS6); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } @@ -276,10 +270,10 @@ private function getCheckBlock() { //use in block but no field selected foreach (\array_keys($this->tables) as $t) { - $tableId = $this->tables[$t]->getVar('table_id'); + $tableId = $this->tables[$t]->getVar('table_id'); $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); - $count = 0; + $fields = $this->cf->getTableFields($this->modId, $tableId); + $count = 0; if (1 == $this->tables[$t]->getVar('table_blocks')) { foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_block')) { @@ -287,14 +281,14 @@ private function getCheckBlock() } } if (0 == $count) { - $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK1); + $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK1); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } } //use in block but no field date foreach (\array_keys($this->tables) as $t) { - $tableId = $this->tables[$t]->getVar('table_id'); + $tableId = $this->tables[$t]->getVar('table_id'); $tableName = $this->tables[$t]->getVar('table_name'); $count = 0; @@ -306,7 +300,7 @@ private function getCheckBlock() } } if (0 == $count) { - $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK2); + $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK2); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } @@ -333,15 +327,15 @@ private function getCheckComments() } if ($count > 1) { $tablesComments = \implode(', ', $tableComments); - $info = \str_replace('%t', $tablesComments, \_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS1); - $this->infos[] = ['icon' => 'error', 'info' => $info]; + $info = \str_replace('%t', $tablesComments, \_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS1); + $this->infos[] = ['icon' => 'error', 'info' => $info]; } foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_comments')) { - $tableId = $this->tables[$t]->getVar('table_id'); - $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); $fieldComments = 0; foreach (\array_keys($fields) as $f) { if (Constants::FIELD_ELE_TEXTCOMMENTS == (int)$fields[$f]->getVar('field_element')) { @@ -350,7 +344,7 @@ private function getCheckComments() } // check whether each table with handling "comments" has also a field "comments" if (0 == $fieldComments) { - $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS2); + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS2); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } @@ -368,11 +362,11 @@ private function getCheckRating() { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_rate')) { - $tableId = $this->tables[$t]->getVar('table_id'); - $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); $fieldRatings = 0; - $fieldVotes = 0; + $fieldVotes = 0; foreach (\array_keys($fields) as $f) { if (Constants::FIELD_ELE_TEXTRATINGS == (int)$fields[$f]->getVar('field_element')) { $fieldRatings++; @@ -383,12 +377,12 @@ private function getCheckRating() } // check whether each table with handling "rating" has also a field "rating" if (0 == (int)$fieldRatings) { - $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS1); + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } // check whether each table with handling "rating" has also a field "votes" if (0 == (int)$fieldVotes) { - $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS2); + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS2); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } @@ -406,9 +400,9 @@ private function getCheckReads() { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_reads')) { - $tableId = $this->tables[$t]->getVar('table_id'); - $tableName = $this->tables[$t]->getVar('table_name'); - $fields = $this->cf->getTableFields($this->modId, $tableId); + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); $fieldReads = 0; foreach (\array_keys($fields) as $f) { if (Constants::FIELD_ELE_TEXTREADS == (int)$fields[$f]->getVar('field_element')) { @@ -417,7 +411,7 @@ private function getCheckReads() } // check whether each table with handling "reads" has also a field "reads" if (0 == (int)$fieldReads) { - $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_READS1); + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_READS1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } @@ -442,13 +436,13 @@ private function getCheckSql() $fieldType = $fields[$f]->getVar('field_type'); if (6 == $fieldType || 7 == $fieldType || 8 == $fieldType) { $fieldValue = $fields[$f]->getVar('field_value'); - if (0 == \strpos($fieldValue,',')) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_SQL1); + if (0 == \mb_strpos($fieldValue, ',')) { + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_SQL1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } $fieldDefault = $fields[$f]->getVar('field_default'); - if (0 == \strpos($fieldDefault,'.')) { - $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_SQL2); + if (0 == \mb_strpos($fieldDefault, '.')) { + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_SQL2); $this->infos[] = ['icon' => 'warning', 'info' => $info]; } } diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index d60b14d0..43bfd0a1 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -109,9 +104,7 @@ public function write($module, $table, $tables, $filename) */ private function getInitVar($fieldName, $type = 'INT') { - return $this->cxc->getClassInitVar($fieldName, $type); - } /** @@ -372,7 +365,7 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) $contIf .= $this->cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$fullList', false, "\t\t\t"); $contIf .= $this->cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$fullList', false, "\t\t\t"); - $ret .= $this->pc->getPhpCodeConditions('$this->isNew()', null, null, $contIf, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$this->isNew()', '', '', $contIf, $contElse, "\t\t"); $ret .= $this->pc->getPhpCodeCommentLine('To Approve', '', "\t\t"); $ret .= $this->cxc->getClassAddOptionArray('groupsCanApproveCheckbox', '$groupList'); $ret .= $this->cxc->getClassAddElement('form', '$groupsCanApproveCheckbox'); @@ -413,9 +406,9 @@ private function getValuesInObject($moduleDirname, $table, $fields) foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $len = \strlen($rpFieldName); + $len = \mb_strlen($rpFieldName); if (3 == $fields[$f]->getVar('field_element') || 4 == $fields[$f]->getVar('field_element')) { - $len = $len + \strlen('_short'); + $len = $len + \mb_strlen('_short'); } $lenMaxName = max($len, $lenMaxName); } @@ -423,7 +416,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); - $spacer = str_repeat(' ', $lenMaxName - \strlen($rpFieldName)); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName)); switch ($fieldElement) { case 3: $getValues .= $this->pc->getPhpCodeStripTags("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); @@ -432,7 +425,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $configMaxchar = 1; } $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; - $spacer = str_repeat(' ', $lenMaxName - \strlen($rpFieldName) - \strlen('_short')); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName) - \mb_strlen('_short')); $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t"); $helper = 1; $utility = 1; @@ -444,7 +437,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $configMaxchar = 1; } $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; - $spacer = str_repeat(' ', $lenMaxName - \strlen($rpFieldName) - \strlen('_short')); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName) - \mb_strlen('_short')); $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t"); $helper = 1; $utility = 1; @@ -459,9 +452,9 @@ private function getValuesInObject($moduleDirname, $table, $fields) $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 's', "\t\t"); break; case 16: - $spacer = str_repeat(' ', $lenMaxName - \strlen('status') + 7); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen('status') + 7); $getValues .= $this->xc->getXcGetVar("status{$spacer}", 'this', $fieldName, false, "\t\t"); - $spacer = str_repeat(' ', $lenMaxName - \strlen('status')); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen('status')); $getValues .= $this->xc->getXcEqualsOperator("\$ret['status']{$spacer}", '$status', false, "\t\t"); $contCase1 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_NONE', false, "\t\t\t\t"); $cases[$this->xc->getXcGetConstants('STATUS_NONE')] = [$contCase1]; @@ -479,7 +472,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) } $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t\t\t", true); $getValues .= $this->pc->getPhpCodeSwitch('status', $contentSwitch, "\t\t"); - $len = $lenMaxName - \strlen('status_text'); + $len = $lenMaxName - \mb_strlen('status_text'); $spacer = $len > 0 ? str_repeat(' ', $len) : ''; $getValues .= $this->xc->getXcEqualsOperator("\$ret['status_text']{$spacer}", '$status_text', false, "\t\t"); break; diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 8e023f61..f85749d1 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -171,12 +163,11 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f $ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); $ret .= $this->pc->getPhpCodeArray('editorConfigs'); $getConfig = $this->xc->getXcGetConfig('editor_admin'); - $contIf = $this->xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t"); + $contIf = $this->xc->getXcEqualsOperator('$editor', $getConfig, null, "\t\t\t"); $getConfig = $this->xc->getXcGetConfig('editor_user'); - $contElse = $this->xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t"); + $contElse = $this->xc->getXcEqualsOperator('$editor', $getConfig, null, "\t\t\t"); $ret .= $this->pc->getPhpCodeConditions('$isAdmin','','', $contIf, $contElse, "\t\t"); - $configs = [ 'name' => "'{$fieldName}'", 'value' => "\$this->getVar('{$fieldName}', 'e')", @@ -214,7 +205,7 @@ private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fi if (\in_array(5, $fieldElementId) > 1) { $ret = $this->pc->getPhpCodeCommentLine('Form Check Box', 'List Options ' . $ccFieldName, $t); $ret .= $this->xc->getXcEqualsOperator('$checkOption', '$this->getOptions()'); - $foreach = $this->cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, '
', $tableSoleName . '_option', '$checkOption', false, $t . "\t"); + $foreach = $this->cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, '
', $tableSoleName . '_option', '$checkOption', false, $t . "\t"); $foreach .= $this->cxc->getClassSetDescription('check' . $ucfFieldName, "{$language}{$stuTableSoleName}_OPTIONS_DESC", $t . "\t"); $foreach .= $this->cxc->getClassAddOption('check' . $ucfFieldName, "\$option, {$language}{$stuTableSoleName}_ . strtoupper(\$option)", $t . "\t"); $ret .= $this->pc->getPhpCodeForeach("{$tableSoleName}All", false, false, 'option', $foreach, $t); @@ -265,7 +256,7 @@ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $r { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form Frameworks Images', 'Files ' . $ccFieldName, $t); $ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Select Uploaded Image', $t); @@ -313,7 +304,7 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form File', $ccFieldName, $t); $ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Select Uploaded File ', $t); @@ -330,7 +321,7 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ //$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . \XOOPS_URL . \"\\\")'\""; //$ret .= $cc->getClassSetExtra('fileSelect', $setExtraParam, $t); $ret .= $this->cxc->getClassAddElement('fileTray', '$fileSelect, false', $t); - //$paramLabel = "\"
\""; + //$paramLabel = "\"
\""; //$xoopsFormLabel = $cc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); //$ret .= $cc->getClassAddElement('fileTray', $xoopsFormLabel, $t); $ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Upload new file', $t); @@ -343,7 +334,7 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ $contIf .= $this->cxc->getClassAddElement('fileTray', $labelInfo1, $t . "\t"); $formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); $contElse = $this->cxc->getClassAddElement('fileTray', $formHidden, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $contIf, $contElse, "\t\t"); $ret .= $this->cxc->getClassAddElement('form', "\$fileTray{$required}", $t); return $ret; @@ -364,7 +355,7 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form Url', 'Text File ' . $ccFieldName, $t); $ret .= $this->cxc->getClassXoopsFormElementTray('formUrlFile', $language, '
', $t); @@ -394,7 +385,7 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form Image', $ccFieldName, $t); $ret .= $this->pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Select Uploaded Image ', $t); @@ -429,7 +420,7 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo3, $t . "\t"); $formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); $contElse = $this->cxc->getClassAddElement('imageTray', $formHidden, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $contIf, $contElse, "\t\t"); $ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); return $ret; @@ -450,7 +441,7 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form File:', 'Upload ' . $ccFieldName, "\t\t"); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "''", "\$this->getVar('{$fieldName}')", "\t\t"); @@ -459,7 +450,7 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ $sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); $xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', $sprintf, $ccFieldName, true, "\t\t", true); $condIf = $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormLabel, $t . "\t"); - $uForm .= $this->pc->getPhpCodeConditions('!$this->isNew()', null, null, $condIf, false, "\t\t\t"); + $uForm .= $this->pc->getPhpCodeConditions('!$this->isNew()', '', '', $condIf, false, "\t\t\t"); $getConfig = $this->xc->getXcGetConfig('maxsize_file'); $uForm .= $this->xc->getXcEqualsOperator('$maxsize', $getConfig,'', "\t\t\t"); $xoopsFormFile = $this->cxc->getClassXoopsFormFile('', "''", $fieldName, '$maxsize', true, ''); @@ -471,7 +462,7 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ $formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, "\t\t", true); $contElse = $this->cxc->getClassAddElement('form', $formHidden, $t); - $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $uForm, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $uForm, $contElse, "\t\t"); return $ret; } @@ -622,7 +613,7 @@ private function getXoopsFormDateTime($language, $fieldName, $required = 'false' private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Status ' . $ccFieldName, $t); if (1 == $tablePermissions) { @@ -721,7 +712,7 @@ private function getXoopsFormSelectLang($language, $fieldName, $required = 'fals private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Form Radio', $ccFieldName, $t); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '0', "\$this->getVar('{$fieldName}')", $t); @@ -750,7 +741,7 @@ private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, { $ucfTableName = \ucfirst($tableName); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine($ucfTableName, 'Handler', $t); $ret .= $this->xc->getXcHandlerLine($tableName, $t); @@ -817,7 +808,7 @@ private function getXoopsFormTopic($language, $topicTableName, $fieldId, $fieldP $contIf .= $this->cxc->getClassXoopsMakeSelBox($ccFieldPid, $stlTopicTableName . 'Tree', $fieldPid, $fieldMain, '--', $fieldPid, $t . "\t"); $formLabel = $this->cxc->getClassXoopsFormLabel('', $language, "\${$ccFieldPid}", true, ''); $contIf .= $this->cxc->getClassAddElement('form', $formLabel, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$stlTopicTableName}Count", null, null, $contIf, false, $t); + $ret .= $this->pc->getPhpCodeConditions("\${$stlTopicTableName}Count", '', '', $contIf, false, $t); $ret .= $this->pc->getPhpCodeUnset('cr' . $ucfTopicTableName, $t); return $ret; @@ -863,7 +854,6 @@ private function getXoopsFormTextUuid($language, $fieldName, $required = 'false' $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 150, $ccFieldName, true); $ret .= $this->cxc->getClassAddElement('form', $formText . $required); - return $ret; } diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 5c3efcee..6137f32a 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 53d24dea..660488e8 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -126,20 +122,20 @@ public function renderClass() /** * @public function getGlobalPerms - * @param null + * @param mixed $permId * * @return bool|string */ public function getGlobalPerms($permId) { - $module = $this->getModule(); - $moduleDirname = $module->getVar('mod_dirname'); + $module = $this->getModule(); + $moduleDirname = $module->getVar('mod_dirname'); - $returnTrue = $this->getSimpleString("return true;", "\t\t\t"); - $right = ''; - $cond = ''; - $funcname = ''; - $comment = ''; + $returnTrue = $this->getSimpleString('return true;', "\t\t\t"); + $right = ''; + $cond = ''; + $funcname = ''; + $comment = ''; switch ($permId) { case 4: $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalApprove', 'returns' => 'right for global approve', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); @@ -166,23 +162,23 @@ public function getGlobalPerms($permId) default: break; } - $functions = $comment; - $globalContent = $this->xc->getXcGetGlobal(['xoopsUser', 'xoopsModule'], "\t\t"); - $globalContent .= $this->xc->getXcEqualsOperator('$currentuid', '0', null, "\t\t"); + $functions = $comment; + $globalContent = $this->xc->getXcGetGlobal(['xoopsUser', 'xoopsModule'], "\t\t"); + $globalContent .= $this->xc->getXcEqualsOperator('$currentuid', '0', null, "\t\t"); - $contIf = $this->pc->getPhpCodeConditions("\$xoopsUser->isAdmin(\$xoopsModule->mid())", '', '', "\t" . $returnTrue, false, "\t\t\t"); - $contIf .= $this->xc->getXcEqualsOperator('$currentuid', '$xoopsUser->uid()', null, "\t\t\t"); - $globalContent .= $this->pc->getPhpCodeConditions('isset($xoopsUser)', ' && ', '\is_object($xoopsUser)', $contIf, false, "\t\t"); - $globalContent .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); - $globalContent .= $this->xc->getXcEqualsOperator('$mid', '$xoopsModule->mid()', null, "\t\t"); - $globalContent .= $this->xc->getXcXoopsHandler('member', "\t\t"); + $contIf = $this->pc->getPhpCodeConditions('$xoopsUser->isAdmin($xoopsModule->mid())', '', '', "\t" . $returnTrue, false, "\t\t\t"); + $contIf .= $this->xc->getXcEqualsOperator('$currentuid', '$xoopsUser->uid()', null, "\t\t\t"); + $globalContent .= $this->pc->getPhpCodeConditions('isset($xoopsUser)', ' && ', '\is_object($xoopsUser)', $contIf, false, "\t\t"); + $globalContent .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); + $globalContent .= $this->xc->getXcEqualsOperator('$mid', '$xoopsModule->mid()', null, "\t\t"); + $globalContent .= $this->xc->getXcXoopsHandler('member', "\t\t"); - $contIfInt = $this->xc->getXcEqualsOperator('$my_group_ids', '[\XOOPS_GROUP_ANONYMOUS]', null, "\t\t\t"); - $contElseInt = $this->xc->getXcEqualsOperator('$my_group_ids', '$memberHandler->getGroupsByUser($currentuid)', null, "\t\t\t"); - $globalContent .= $this->pc->getPhpCodeConditions('$currentuid', ' == ', '0', $contIfInt, $contElseInt, "\t\t"); - $globalContent .= $cond; - $globalContent .= $this->getSimpleString("return false;", "\t\t"); - $functions .= $this->pc->getPhpCodeFunction($funcname, '', $globalContent, 'public ', false, "\t"); + $contIfInt = $this->xc->getXcEqualsOperator('$my_group_ids', '[\XOOPS_GROUP_ANONYMOUS]', null, "\t\t\t"); + $contElseInt = $this->xc->getXcEqualsOperator('$my_group_ids', '$memberHandler->getGroupsByUser($currentuid)', null, "\t\t\t"); + $globalContent .= $this->pc->getPhpCodeConditions('$currentuid', ' == ', '0', $contIfInt, $contElseInt, "\t\t"); + $globalContent .= $cond; + $globalContent .= $this->getSimpleString('return false;', "\t\t"); + $functions .= $this->pc->getPhpCodeFunction($funcname, '', $globalContent, 'public ', false, "\t"); return $functions; } @@ -195,23 +191,23 @@ public function getGlobalPerms($permId) */ public function renderPermissionsHandler() { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $content = $this->getHeaderFilesComments($module, null, $namespace); - $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); - $content .= $this->pc->getPhpCodeDefined(); - $content .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $this->className]); + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); + $content = $this->getHeaderFilesComments($module, null, $namespace); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); + $content .= $this->pc->getPhpCodeDefined(); + $content .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $this->className]); - $constr = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); - $constr .= $this->pc->getPhpCodeFunction('__construct', '', '', 'public ', false, "\t"); - $functions = $constr; - $functions .= $this->getGlobalPerms(4); - $functions .= $this->getGlobalPerms(8); - $functions .= $this->getGlobalPerms(16); + $constr = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); + $constr .= $this->pc->getPhpCodeFunction('__construct', '', '', 'public ', false, "\t"); + $functions = $constr; + $functions .= $this->getGlobalPerms(4); + $functions .= $this->getGlobalPerms(8); + $functions .= $this->getGlobalPerms(16); - $content .= $this->pc->getPhpCodeClass($this->className, $functions, '\XoopsPersistableObjectHandler'); + $content .= $this->pc->getPhpCodeClass($this->className, $functions, '\XoopsPersistableObjectHandler'); $this->create($moduleDirname, 'class', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); @@ -234,48 +230,48 @@ public function renderConstantsInterface() $tablePermissions[] = $tables[$t]->getVar('table_permissions'); $tableRate[] = $tables[$t]->getVar('table_rate'); } - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $contentFile = $this->getHeaderFilesComments($module, null, $namespace); - $contentFile .= $this->pc->getPhpCodeCommentMultiLine(['Interface ' => $this->className]); + $moduleDirname = $module->getVar('mod_dirname'); + $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); + $contentFile = $this->getHeaderFilesComments($module, null, $namespace); + $contentFile .= $this->pc->getPhpCodeCommentMultiLine(['Interface ' => $this->className]); - $contentClass = $this->pc->getPhpCodeBlankLine(); + $contentClass = $this->pc->getPhpCodeBlankLine(); $contentClass .= $this->pc->getPhpCodeCommentLine('Constants for tables', '', "\t"); foreach (\array_keys($tables) as $t) { - $tablePermissions[] = $tables[$t]->getVar('table_permissions'); - $stuTableName = \mb_strtoupper($tables[$t]->getVar('table_name')); - $contentClass .= $this->pc->getPhpCodeConstant("TABLE_" . $stuTableName, $t, "\t",'public const'); + $tablePermissions[] = $tables[$t]->getVar('table_permissions'); + $stuTableName = \mb_strtoupper($tables[$t]->getVar('table_name')); + $contentClass .= $this->pc->getPhpCodeConstant('TABLE_' . $stuTableName, $t, "\t", 'public const'); } $contentClass .= $this->pc->getPhpCodeBlankLine(); $contentClass .= $this->pc->getPhpCodeCommentLine('Constants for status', '', "\t"); - $contentClass .= $this->pc->getPhpCodeConstant("STATUS_NONE ", 0, "\t",'public const'); - $contentClass .= $this->pc->getPhpCodeConstant("STATUS_OFFLINE ", 1, "\t",'public const'); - $contentClass .= $this->pc->getPhpCodeConstant("STATUS_SUBMITTED", 2, "\t",'public const'); - $contentClass .= $this->pc->getPhpCodeConstant("STATUS_APPROVED ", 3, "\t",'public const'); - $contentClass .= $this->pc->getPhpCodeConstant("STATUS_BROKEN ", 4, "\t",'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('STATUS_NONE ', 0, "\t", 'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('STATUS_OFFLINE ', 1, "\t", 'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('STATUS_SUBMITTED', 2, "\t", 'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('STATUS_APPROVED ', 3, "\t", 'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('STATUS_BROKEN ', 4, "\t", 'public const'); if (\in_array(1, $tablePermissions)) { - $constPerm = $this->pc->getPhpCodeBlankLine(); - $constPerm .= $this->pc->getPhpCodeCommentLine('Constants for permissions', '', "\t"); - $constPerm .= $this->pc->getPhpCodeConstant("PERM_GLOBAL_NONE ", 0, "\t",'public const'); - $constPerm .= $this->pc->getPhpCodeConstant("PERM_GLOBAL_VIEW ", 1, "\t", 'public const'); - $constPerm .= $this->pc->getPhpCodeConstant("PERM_GLOBAL_SUBMIT ", 2, "\t", 'public const'); - $constPerm .= $this->pc->getPhpCodeConstant("PERM_GLOBAL_APPROVE", 3, "\t", 'public const'); + $constPerm = $this->pc->getPhpCodeBlankLine(); + $constPerm .= $this->pc->getPhpCodeCommentLine('Constants for permissions', '', "\t"); + $constPerm .= $this->pc->getPhpCodeConstant('PERM_GLOBAL_NONE ', 0, "\t", 'public const'); + $constPerm .= $this->pc->getPhpCodeConstant('PERM_GLOBAL_VIEW ', 1, "\t", 'public const'); + $constPerm .= $this->pc->getPhpCodeConstant('PERM_GLOBAL_SUBMIT ', 2, "\t", 'public const'); + $constPerm .= $this->pc->getPhpCodeConstant('PERM_GLOBAL_APPROVE', 3, "\t", 'public const'); $contentClass .= $constPerm; } if (\in_array(1, $tableRate)) { - $constRate = $this->pc->getPhpCodeBlankLine(); - $constRate .= $this->pc->getPhpCodeCommentLine('Constants for rating', '', "\t"); - $constRate .= $this->pc->getPhpCodeConstant("RATING_NONE ", 0, "\t",'public const'); - $constRate .= $this->pc->getPhpCodeConstant("RATING_5STARS ", 1, "\t", 'public const'); - $constRate .= $this->pc->getPhpCodeConstant("RATING_10STARS ", 2, "\t", 'public const'); - $constRate .= $this->pc->getPhpCodeConstant("RATING_LIKES ", 3, "\t", 'public const'); - $constRate .= $this->pc->getPhpCodeConstant("RATING_10NUM ", 4, "\t", 'public const'); + $constRate = $this->pc->getPhpCodeBlankLine(); + $constRate .= $this->pc->getPhpCodeCommentLine('Constants for rating', '', "\t"); + $constRate .= $this->pc->getPhpCodeConstant('RATING_NONE ', 0, "\t", 'public const'); + $constRate .= $this->pc->getPhpCodeConstant('RATING_5STARS ', 1, "\t", 'public const'); + $constRate .= $this->pc->getPhpCodeConstant('RATING_10STARS ', 2, "\t", 'public const'); + $constRate .= $this->pc->getPhpCodeConstant('RATING_LIKES ', 3, "\t", 'public const'); + $constRate .= $this->pc->getPhpCodeConstant('RATING_10NUM ', 4, "\t", 'public const'); $contentClass .= $constRate; } - $contentClass .= $this->pc->getPhpCodeBlankLine(); + $contentClass .= $this->pc->getPhpCodeBlankLine(); - $contentFile .= $this->pc->getPhpCodeInterface($this->className, $contentClass); + $contentFile .= $this->pc->getPhpCodeInterface($this->className, $contentClass); $this->create($moduleDirname, 'class', $filename, $contentFile, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index 5a31b14d..d8d5f1c3 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -1,4 +1,4 @@ -getXcGetVar('', 'this', $param4, true); if (false === $isParam) { $ret = "{$t}\${$var} = {$user}{$param1}, '{$param2}', {$param3}, {$ccFieldName});\n"; diff --git a/class/Files/Classes/index.php b/class/Files/Classes/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Classes/index.php +++ b/class/Files/Classes/index.php @@ -1,2 +1,2 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -70,10 +68,10 @@ public static function getInstance() /** * @public function write * @param string $module - * @param $tables + * @param $tables * @param string $filename */ - public function write($module, $tables, $filename) + public function write($module, $tables, $filename): void { $this->setModule($module); $this->setTables($tables); @@ -88,63 +86,63 @@ private function getConfigCode() { $tables = $this->getTables(); - $ret = $this->pc->getPhpCodeCommentMultiLine(['return' => 'object']); - $ret .= $this->getSimpleString(''); - $ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', '\basename(\dirname(__DIR__))'); - $ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper ', '\mb_strtoupper($moduleDirName)'); - - $ret .= $this->getSimpleString('return (object)['); - $ret .= $this->getSimpleString("'name' => \mb_strtoupper(\$moduleDirName) . ' Module Configurator',", "\t"); - $ret .= $this->getSimpleString("'paths' => [", "\t"); - $ret .= $this->getSimpleString("'dirname' => \$moduleDirName,", "\t\t"); - $ret .= $this->getSimpleString("'admin' => \XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName . '/admin',", "\t\t"); - $ret .= $this->getSimpleString("'modPath' => \XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName,", "\t\t"); - $ret .= $this->getSimpleString("'modUrl' => \XOOPS_URL . '/modules/' . \$moduleDirName,", "\t\t"); - $ret .= $this->getSimpleString("'uploadPath' => \XOOPS_UPLOAD_PATH . '/' . \$moduleDirName,", "\t\t"); - $ret .= $this->getSimpleString("'uploadUrl' => \XOOPS_UPLOAD_URL . '/' . \$moduleDirName,", "\t\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'uploadFolders' => [", "\t"); - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName,", "\t\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['return' => 'object']); + $ret .= $this->getSimpleString(''); + $ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', '\basename(\dirname(__DIR__))'); + $ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper ', '\mb_strtoupper($moduleDirName)'); + + $ret .= $this->getSimpleString('return (object)['); + $ret .= $this->getSimpleString("'name' => \mb_strtoupper(\$moduleDirName) . ' Module Configurator',", "\t"); + $ret .= $this->getSimpleString("'paths' => [", "\t"); + $ret .= $this->getSimpleString("'dirname' => \$moduleDirName,", "\t\t"); + $ret .= $this->getSimpleString("'admin' => \XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName . '/admin',", "\t\t"); + $ret .= $this->getSimpleString("'modPath' => \XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName,", "\t\t"); + $ret .= $this->getSimpleString("'modUrl' => \XOOPS_URL . '/modules/' . \$moduleDirName,", "\t\t"); + $ret .= $this->getSimpleString("'uploadPath' => \XOOPS_UPLOAD_PATH . '/' . \$moduleDirName,", "\t\t"); + $ret .= $this->getSimpleString("'uploadUrl' => \XOOPS_UPLOAD_URL . '/' . \$moduleDirName,", "\t\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'uploadFolders' => [", "\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName,", "\t\t"); foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images',", "\t\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images',", "\t\t"); foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/files',", "\t\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/files',", "\t\t"); foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/files/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/temp',", "\t\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'copyBlankFiles' => [", "\t"); - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images',", "\t\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/temp',", "\t\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'copyBlankFiles' => [", "\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images',", "\t\t"); foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'copyTestFolders' => [", "\t"); - $ret .= $this->getSimpleString("[\XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName . '/testdata/uploads',", "\t\t"); - $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName],", "\t\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'templateFolders' => [", "\t"); - $ret .= $this->getSimpleString("'/templates/',", "\t\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'oldFiles' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'oldFolders' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'renameTables' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'moduleStats' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); - $ret .= $this->getSimpleString("'modCopyright' => \"XOOPS Project\",", "\t"); - $ret .= $this->getSimpleString('];'); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'copyTestFolders' => [", "\t"); + $ret .= $this->getSimpleString("[\XOOPS_ROOT_PATH . '/modules/' . \$moduleDirName . '/testdata/uploads',", "\t\t"); + $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName],", "\t\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'templateFolders' => [", "\t"); + $ret .= $this->getSimpleString("'/templates/',", "\t\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'oldFiles' => [", "\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'oldFolders' => [", "\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'renameTables' => [", "\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'moduleStats' => [", "\t"); + $ret .= $this->getSimpleString('],', "\t"); + $ret .= $this->getSimpleString("'modCopyright' => \"XOOPS Project\",", "\t"); + $ret .= $this->getSimpleString('];'); return $ret; } diff --git a/class/Files/Config/index.php b/class/Files/Config/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Config/index.php +++ b/class/Files/Config/index.php @@ -1,2 +1,2 @@ -module = $module; @@ -83,7 +82,7 @@ public function getModule() * * @param mixed $table */ - public function setTable($table) + public function setTable($table): void { if (\is_object($table) && ($table instanceof Modulebuilder\Tables)) { $this->table = $table; @@ -105,7 +104,7 @@ public function getTable() * * @param mixed $tables */ - public function setTables($tables) + public function setTables($tables): void { if (\is_array($tables)) { $this->tables = $tables; @@ -127,7 +126,7 @@ public function getTables() * * @param mixed $fields */ - public function setFields($fields) + public function setFields($fields): void { if (\is_object($fields) && ($fields instanceof Modulebuilder\Fields)) { $this->fields = $fields; diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 56d71845..dec24346 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -1,4 +1,4 @@ -getVar('mod_id'); @@ -428,7 +427,7 @@ public function setFilesToBuilding($module) $src_file = TDMC_UPLOAD_FILES_PATH . '/' . $files[$t]->getVar('file_upload'); $dst_file = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleDirname) . '/'; if ('' !== $fileInfolder) { - if ('/' !== \substr($fileInfolder, -1)) { + if ('/' !== \mb_substr($fileInfolder, -1)) { $fileInfolder .= '/'; } $dst_file .= $fileInfolder; @@ -788,7 +787,7 @@ public function setFilesToBuilding($module) * * @param $module */ - public function setCommonFiles($module) + public function setCommonFiles($module): void { $moduleName = $module->getVar('mod_dirname'); $upl_path = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleName); @@ -864,7 +863,7 @@ public function setCommonFiles($module) * * @param $moduleName */ - private function CopyRatingFiles($moduleName) + private function CopyRatingFiles($moduleName): void { $upl_path = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleName); diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index c427a55c..7205ac17 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -1,9 +1,7 @@ -setFileName($fileName); $this->created = $created; @@ -149,7 +147,7 @@ public function create($moduleDirname, $subdir = null, $fileName = null, $conten * @private function setRepositoryPath * @param string $moduleDirname */ - private function setRepositoryPath($moduleDirname) + private function setRepositoryPath($moduleDirname): void { $this->uploadPath = TDMC_UPLOAD_REPOSITORY_PATH . '/' . $moduleDirname; } @@ -168,7 +166,7 @@ private function getRepositoryPath() * @private function setSubDir * @param $subdir */ - private function setSubDir($subdir) + private function setSubDir($subdir): void { $this->subdir = $subdir; } @@ -188,7 +186,7 @@ private function getSubDir() * * @param $fileName */ - public function setFileName($fileName) + public function setFileName($fileName): void { $this->fileName = $fileName; } @@ -207,7 +205,7 @@ public function getFileName() * @private function setContent * @param $content */ - private function setContent($content) + private function setContent($content): void { //replace tabs by 4 spaces $this->content = \preg_replace('/\t/', $this->tab, $content); @@ -283,7 +281,7 @@ private function getNotCreated() * @private function setMode * @param $mode */ - private function setMode($mode) + private function setMode($mode): void { $this->mode = $mode; } @@ -331,7 +329,7 @@ public function getLanguage($moduleDirname, $prefix = '', $suffix = '', $addFq = */ public function getLeftString($string) { - return \mb_substr($string, 0, mb_strpos($string, '_')); + return \mb_substr($string, 0, (int)\mb_strpos($string, '_')); } /** @@ -488,7 +486,7 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = //$subversion = $module->getVar('mod_subversion'); //$date = date('D Y-m-d H:i:s'); if (null === $noPhpFile) { - $ret = "xf->write($this->getContent(), $mode, true)) { $ret .= \sprintf($notCreated, $fileName, $folderName); $GLOBALS['xoopsTpl']->assign('created', false); + return $ret; } // Created diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index c227a4e3..d208954a 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -1,4 +1,4 @@ -{$n}"; } - } elseif ($multiLine) { + } elseif ($multiLine) { $ret = "{$t}<{$tag}{$attr}>{$n}"; $ret .= "{$content}"; $ret .= "{$t}{$n}"; @@ -127,7 +126,7 @@ public function getHtmlComment($htmlComment = '', $t = '', $n = '') /** * @public function getHtmlBr - * @param int $brNumb + * @param int $brNumb * @param string $htmlClass * @param string $t * @param string $n @@ -167,7 +166,7 @@ public function getHtmlHNumb($content = '', $l = '1', $htmlHClass = '', $t = '', * @param string $divClass * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ public function getHtmlDiv($content = '', $divClass = '', $t = '', $n = "\n", $split = true) @@ -175,11 +174,11 @@ public function getHtmlDiv($content = '', $divClass = '', $t = '', $n = "\n", $s $rDivClass = ('' != $divClass) ? " class='{$divClass}'" : ''; if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; + $ret = "{$t}{$n}"; + $ret .= "{$content}"; + $ret .= "{$t}{$n}"; } else { - $ret = "{$t}{$content}{$n}"; + $ret = "{$t}{$content}{$n}"; } return $ret; @@ -209,7 +208,7 @@ public function getHtmlPre($content = '', $preClass = '', $t = '', $n = "\n") * @param string $spanClass * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ public function getHtmlSpan($content = '', $spanClass = '', $t = '', $n = "\n", $split = false) @@ -258,7 +257,7 @@ public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n" public function getHtmlI($content = '', $iClass = '', $iId = '', $t = '', $n = "\n") { $rIClass = ('' != $iClass) ? " class='{$iClass}'" : ''; - $rIId = ('' != $iId) ? " id='{$iId}'" : ''; + $rIId = ('' != $iId) ? " id='{$iId}'" : ''; $ret = "{$t}{$content}{$n}"; return $ret; @@ -306,18 +305,18 @@ public function getHtmlOl($content = '', $olClass = '', $t = '', $n = "\n") * @param string $liClass * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ - public function getHtmlLi($content = '', $liClass = '', $t = '', $n = "\n", $split = false) + public function getHtmlLi($content = '', $liClass = '', $t = '', $n = "\n", $split = false) { $rLiClass = ('' != $liClass) ? " class='{$liClass}'" : ''; if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; + $ret = "{$t}{$n}"; + $ret .= "{$content}"; + $ret .= "{$t}{$n}"; } else { - $ret = "{$t}{$content}{$n}"; + $ret = "{$t}{$content}{$n}"; } return $ret; @@ -338,7 +337,7 @@ public function getHtmlStrong($content = '', $strongClass = '', $t = '', $n = '' return "{$t}{$content}{$n}"; } - /** + /** * @public function getHtmlAnchor * @param string $url * @param string $content @@ -365,7 +364,7 @@ public function getHtmlAnchor($url = '#', $content = ' ', $title = '', $tar * @param string $alt * @param string $imgClass * @param string $t - * @param string $n + * @param string $n * @return string */ public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', $t = '', $n = '') @@ -438,18 +437,18 @@ public function getHtmlTableTbody($content = '', $tbodyClass = '', $t = '', $n = * * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ public function getHtmlTableTfoot($content = '', $tfootClass = '', $t = '', $n = "\n", $split = true) { $rTfootClass = ('' != $tfootClass) ? " class='{$tfootClass}'" : ''; if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; + $ret = "{$t}{$n}"; + $ret .= "{$content}"; + $ret .= "{$t}{$n}"; } else { - $ret = "{$t}{$content}{$n}"; + $ret = "{$t}{$content}{$n}"; } return $ret; @@ -480,7 +479,7 @@ public function getHtmlTableRow($content = '', $trClass = '', $t = '', $n = "\n" * @param string $colspan * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t = '', $n = "\n", $split = false) @@ -488,12 +487,13 @@ public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t $rThClass = ('' != $thClass) ? " class='{$thClass}'" : ''; $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; + $ret = "{$t}{$n}"; + $ret .= "{$content}"; + $ret .= "{$t}{$n}"; } else { $ret = "{$t}{$content}{$n}"; } + return $ret; } @@ -504,7 +504,7 @@ public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t * @param string $colspan * @param string $t * @param string $n - * @param bool $split + * @param bool $split * @return string */ public function getHtmlTableData($content = '', $tdClass = '', $colspan = '', $t = '', $n = "\n", $split = false) @@ -512,12 +512,13 @@ public function getHtmlTableData($content = '', $tdClass = '', $colspan = '', $t $rTdClass = ('' != $tdClass) ? " class='{$tdClass}'" : ''; $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; + $ret = "{$t}{$n}"; + $ret .= "{$content}"; + $ret .= "{$t}{$n}"; } else { $ret = "{$t}{$content}{$n}"; } + return $ret; } } diff --git a/class/Files/CreateMoreFiles.php b/class/Files/CreateMoreFiles.php index 0ce054b7..23de008f 100644 --- a/class/Files/CreateMoreFiles.php +++ b/class/Files/CreateMoreFiles.php @@ -1,4 +1,4 @@ -{$n}"; } @@ -177,9 +176,9 @@ public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = "") * @public function getSmartyIncludeFile * @param $moduleDirname * @param string $fileName - * @param bool $admin + * @param bool $admin * - * @param bool $q + * @param bool $q * @param string $t * @param string $n * @param string $attributes @@ -203,10 +202,10 @@ public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admi /** * @public function getSmartyIncludeFileListSection - * @param $moduleDirname - * @param $fileName - * @param $itemName - * @param $arrayName + * @param $moduleDirname + * @param $fileName + * @param $itemName + * @param $arrayName * @param string $t * @param string $n * @return string @@ -218,9 +217,9 @@ public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $item /** * @public function getSmartyIncludeFileListForeach - * @param $moduleDirname - * @param $fileName - * @param $tableFieldName + * @param $moduleDirname + * @param $fileName + * @param $tableFieldName * @param string $t * @param string $n * @return string @@ -236,13 +235,13 @@ public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tabl * @param string $operator * @param string $type * @param string $contentIf - * @param mixed $contentElse - * @param bool $count - * @param bool $noSimbol + * @param mixed $contentElse + * @param bool $count + * @param bool $noSimbol * @param string $t * @param string $n - * @param bool $split - * @param mixed $default + * @param bool $split + * @param mixed $default * @return string */ public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n", $split = true, $default = 'string') @@ -258,7 +257,7 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', if ('string' === $default) { $ret .= "|default:''"; } elseif ('int' === $default) { - $ret .= "|default:0"; + $ret .= '|default:0'; } $ret .= "{$operator}{$type}}>{$ns}"; } elseif (!$noSimbol) { @@ -266,7 +265,7 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', if ('string' === $default) { $ret .= "|default:''"; } elseif ('int' === $default) { - $ret .= "|default:0"; + $ret .= '|default:0'; } $ret .= "{$operator}{$type}}>{$ns}"; } else { @@ -279,7 +278,6 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', } $ret .= "{$ts}<{/if}>{$n}"; - return $ret; } @@ -333,8 +331,8 @@ public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = * @param string $name * @param string $loop * @param string $content - * @param int $start - * @param int $step + * @param int $start + * @param int $step * @param string $t * @param string $n * @return string diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index d9d9fb23..b0e7e6f3 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -1,4 +1,4 @@ -uploadPath = $path; } @@ -87,7 +86,7 @@ protected function setUploadPath($path) /** * @protected function getUploadPath * - * @return string $path + * @return string */ protected function getUploadPath() { @@ -98,7 +97,7 @@ protected function getUploadPath() * @protected function setModuleName * @param $moduleName */ - protected function setModuleName($moduleName) + protected function setModuleName($moduleName): void { $this->moduleName = $moduleName; } @@ -106,7 +105,7 @@ protected function setModuleName($moduleName) /** * @protected function getModuleName * - * @return string $moduleName + * @return string */ protected function getModuleName() { @@ -118,14 +117,14 @@ protected function getModuleName() * * @param $folderName */ - private function setFolderName($folderName) + private function setFolderName($folderName): void { $this->folderName = $folderName; } /** * @private function getFolderName - * @return string $folderName + * @return string */ private function getFolderName() { @@ -137,7 +136,7 @@ private function getFolderName() * * @param $fileName */ - private function setFileName($fileName) + private function setFileName($fileName): void { $this->fileName = $fileName; } @@ -145,7 +144,7 @@ private function setFileName($fileName) /** * @private function getFileName * - * @return string $fileName + * @return string */ private function getFileName() { @@ -157,7 +156,7 @@ private function getFileName() * * @param $dname */ - public function isDir($dname) + public function isDir($dname): void { if (!\is_dir($dname)) { if (!\mkdir($dname, 0755) && !\is_dir($dname)) { @@ -174,7 +173,7 @@ public function isDir($dname) * * @param string $dir */ - protected function makeDir($dir) + protected function makeDir($dir): void { $this->isDir(\trim($dir)); } @@ -228,7 +227,7 @@ private function addFolderPath($folderName, $fileName = false) * * @param string $dirName */ - public function makeDirInModule($dirName) + public function makeDirInModule($dirName): void { $fname = $this->addFolderPath($dirName); $this->makeDir($fname); @@ -241,7 +240,7 @@ public function makeDirInModule($dirName) * @param string $fromFile * @param string $toFile */ - public function makeDirAndCopyFile($folderName, $fromFile, $toFile) + public function makeDirAndCopyFile($folderName, $fromFile, $toFile): void { $dname = $this->addFolderPath($folderName); $this->makeDir($dname); @@ -255,7 +254,7 @@ public function makeDirAndCopyFile($folderName, $fromFile, $toFile) * @param string $fromFile * @param string $toFile */ - public function copyFile($folderName, $fromFile, $toFile) + public function copyFile($folderName, $fromFile, $toFile): void { $dname = $this->addFolderPath($folderName); $fname = $this->addFolderPath($folderName, $toFile); @@ -269,7 +268,7 @@ public function copyFile($folderName, $fromFile, $toFile) * @param string $fromFile * @param string $fname */ - public function setCopy($dname, $fromFile, $fname) + public function setCopy($dname, $fromFile, $fname): void { if (\is_dir($dname)) { chmod($dname, 0777); diff --git a/class/Files/CreateTableFields.php b/class/Files/CreateTableFields.php index 4e48dd70..c368672a 100644 --- a/class/Files/CreateTableFields.php +++ b/class/Files/CreateTableFields.php @@ -1,4 +1,4 @@ -getPhpCodeCommentLine('Get', $tableNameTopic . ' Handler', $t . "\t"); - $parentTopic .= $this->getXcHandlerLine($tableNameTopic, $t . "\t"); - $elseGroups = $this->getXcEqualsOperator('$groups', '\XOOPS_GROUP_ANONYMOUS'); - $ret = $pc->getPhpCodeConditions("!isset(\${$tableNameTopic}Handler", '', '', $parentTopic, $elseGroups); - $ret .= $this->getXcGetVarFromID("\${$lpFieldName}['{$rpFieldName}']", $tableNameTopic, $tableSoleNameTopic, $tableName, $fieldNameParent, $t); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $parentTopic = $pc->getPhpCodeCommentLine('Get', $tableNameTopic . ' Handler', $t . "\t"); + $parentTopic .= $this->getXcHandlerLine($tableNameTopic, $t . "\t"); + $elseGroups = $this->getXcEqualsOperator('$groups', '\XOOPS_GROUP_ANONYMOUS'); + $ret = $pc->getPhpCodeConditions("!isset(\${$tableNameTopic}Handler", '', '', $parentTopic, $elseGroups); + $ret .= $this->getXcGetVarFromID("\${$lpFieldName}['{$rpFieldName}']", $tableNameTopic, $tableSoleNameTopic, $tableName, $fieldNameParent, $t); return $ret; } @@ -593,10 +592,10 @@ public function getXcGetFieldParentId($fields) */ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields) { - $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); - $ret = ''; - $fieldMain = ''; - $countUploader = 0; + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + $ret = ''; + $fieldMain = ''; + $countUploader = 0; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -706,7 +705,7 @@ public function getXcCheckRight($anchor, $permString = '', $var = '', $groups = * @param string $permString * @param string $mid * @param string $var - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string @@ -718,18 +717,20 @@ public function getXcDeleteRight($anchor, $permString = '', $mid = '', $var = '' } else { $ret = "\${$anchor}->deleteByModule({$mid}, '{$permString}', {$var})"; } + return $ret; } /** * @public function getXcHandlerLine - * @param $tableName + * @param $tableName * @param string $t * @return string */ public function getXcHandlerLine($tableName, $t = '') { $ucfTableName = \ucfirst($tableName); + return "{$t}\${$tableName}Handler = \$helper->getHandler('{$ucfTableName}');\n"; } @@ -970,11 +971,11 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, */ public function getXcSecurity($tableName, $t = '') { - $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $securityError = $this->getXcXoopsSecurityErrors(); - $implode = $pc->getPhpCodeImplode(',', $securityError); - $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '', 3, $implode, false, $t); - $securityCheck = $this->getXcXoopsSecurityCheck(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $securityError = $this->getXcXoopsSecurityErrors(); + $implode = $pc->getPhpCodeImplode(',', $securityError); + $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '', 3, $implode, false, $t); + $securityCheck = $this->getXcXoopsSecurityCheck(); return $pc->getPhpCodeConditions('!' . $securityCheck, '', '', $content, $t); } @@ -1045,6 +1046,7 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $ret = $xc->getXcEqualsOperator('$customConfirm', $confirm, '', $t); $ret .= $xc->getXcEqualsOperator('$form', '$customConfirm->getFormConfirm()', '', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + return $ret; } @@ -1187,7 +1189,6 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f $countUploader = 0; $fieldLines = ''; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -1271,7 +1272,7 @@ public function getXcPageNav($tableName, $t = '', $paramStart = 'start', $paramO */ public function getXcGetGlobal($globals, $t = '') { - $ret = $t . "global "; + $ret = $t . 'global '; $detail = ''; foreach ($globals as $global) { if ($detail !== '') { @@ -1279,7 +1280,7 @@ public function getXcGetGlobal($globals, $t = '') } $detail .= '$' . $global; } - $ret .= $detail . ";\n"; + $ret .= $detail . ";\n"; return $ret; } @@ -1338,6 +1339,7 @@ public function getXcCriteriaAdd($var, $param, $t = '', $n = "\n", $condition = if ('' !== $condition) { $condition = ", {$condition}"; } + return "{$t}\${$var}->add({$param}{$condition});{$n}"; } @@ -1422,7 +1424,6 @@ public function getXcXoopsFormGroupPerm($varLeft = '', $formTitle = '', $moduleI return "{$t}\${$varLeft} = new \XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; } - /** * @public function getXoopsFormSelectExtraOptions * @param string $varSelect @@ -1453,12 +1454,13 @@ public function getXoopsFormSelectExtraOptions($varSelect = '', $caption = '', $ /*************************************************************/ /** * @public function getXcGetConstants - * @param null + * @param mixed $const * @return string */ public function getXcGetConstants($const) { $ret = "Constants::{$const}"; + return $ret; } @@ -1542,7 +1544,7 @@ public function getXcXoopsListImgListArray($return, $var, $t = '') /** * @public function getXcXoopsListLangList - * @param $return + * @param $return * @param string $t * * @return string @@ -1554,7 +1556,7 @@ public function getXcXoopsListLangList($return, $t = '') /** * @public function getXcXoopsListCountryList - * @param $return + * @param $return * @param string $t * * @return string @@ -1690,13 +1692,12 @@ public function getXcXoopsModuleGetInfo($left, $string, $isParam = false, $t = ' return $ret; } - /** * @public function getXcXoThemeAddStylesheet * @param string $style * * @param string $t - * @param bool $isString + * @param bool $isString * @return string */ public function getXcXoThemeAddStylesheet($style = 'style', $t = '', $isString = true) @@ -1706,6 +1707,7 @@ public function getXcXoThemeAddStylesheet($style = 'style', $t = '', $isString = $ret .= '$'; } $ret .= "{$style}, null);\n"; + return $ret; } @@ -1755,8 +1757,8 @@ public function getXcXoopsHandler($left, $t = '', $n = "\n") */ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') { - $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); @@ -1776,8 +1778,8 @@ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') */ public function getXcCommonPagesNew($tableName, $t = '') { - $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Form Create', null, $t); $ret .= $xc->getXcHandlerCreateObj($tableName, $t); @@ -1796,8 +1798,8 @@ public function getXcCommonPagesNew($tableName, $t = '') */ public function getXcCommonPagesClone($tableName, $ccFieldId, $t = '') { - $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId . 'Source', 'ObjSource', $tableName . 'Handler', false, $t); @@ -1808,17 +1810,16 @@ public function getXcCommonPagesClone($tableName, $ccFieldId, $t = '') return $ret; } - /** * @public function getXcCommonPagesDelete * @param $language * @param $tableName - * @param $tableSoleName + * @param $tableSoleName * @param $fieldId * @param $fieldMain - * @param $tableNotifications + * @param $tableNotifications * @param string $t - * @param bool $admin + * @param bool $admin * @return string */ public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, $t = '', $admin = false) @@ -1827,8 +1828,8 @@ public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $f $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $cf = Modulebuilder\Files\CreateFile::getInstance(); - $ccFieldId = $cf->getCamelCase($fieldId, false, true); - $ccFieldMain = $cf->getCamelCase($fieldMain, false, true); + $ccFieldId = $cf->getCamelCase($fieldId, false, true); + $ccFieldMain = $cf->getCamelCase($fieldMain, false, true); $ret = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); $ret .= $xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t); @@ -1840,7 +1841,7 @@ public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $f $redirectHeaderErrors = $xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t\t"); $delete = $xc->getXcHandlerDelete($tableName, $tableName, 'Obj'); $condition = $pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectHeaderErrors, false, $t . "\t"); - $contInsert = ''; + $contInsert = ''; if (!$admin && 1 == $tableNotifications) { $contInsert .= $pc->getPhpCodeCommentLine('Event delete notification', null, $t . "\t\t"); $contInsert .= $pc->getPhpCodeArray('tags', [], false, $t . "\t\t"); diff --git a/class/Files/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index e0124720..0ac46d81 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -79,11 +78,11 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $date = date('Y/m/d G:i:s'); $content = <<getVar('mod_version')} [{$date}] -============================================================== - - Original release {$moduleDirname} ({$module->getVar('mod_author')}) -EOT; + ============================================================== + {$module->getVar('mod_version')} [{$date}] + ============================================================== + - Original release {$moduleDirname} ({$module->getVar('mod_author')}) + EOT; $this->create($moduleDirname, 'docs', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); diff --git a/class/Files/Docs/DocsFiles.php b/class/Files/Docs/DocsFiles.php index b2a845dc..2648f8c7 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -93,11 +92,11 @@ public function getChangeLogFile($moduleDirname, $mod_version, $mod_author) { $date = date('Y/m/d G:i:s'); $ret = <<xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -74,7 +72,7 @@ public static function getInstance() * @param mixed $table * @param $filename */ - public function write($module, $table, $filename) + public function write($module, $table, $filename): void { $this->setModule($module); $this->setTable($table); @@ -84,20 +82,20 @@ public function write($module, $table, $filename) /** * @public function getCommentBody * @param string $module - * @param mixed $table + * @param mixed $table * @return string */ public function getCommentBody($module, $table) { - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $tableFieldName = $table->getVar('table_fieldname'); - $fieldId = ''; - $ccFieldId = ''; - $ccFieldMain = ''; - $fieldMain = ''; - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableFieldName = $table->getVar('table_fieldname'); + $fieldId = ''; + $ccFieldId = ''; + $ccFieldMain = ''; + $fieldMain = ''; + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { @@ -105,8 +103,8 @@ public function getCommentBody($module, $table) $ccFieldId = $this->getCamelCase($fieldId, false, true); } if (1 == $fields[$f]->getVar('field_main')) { - $fieldMain = $fieldName; // fieldMain = fields parameters main field - $ccFieldMain = $this->getCamelCase($fieldMain, false, true); + $fieldMain = $fieldName; // fieldMain = fields parameters main field + $ccFieldMain = $this->getCamelCase($fieldMain, false, true); } } @@ -118,28 +116,28 @@ public function getCommentBody($module, $table) $func1 .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); $func1 .= $this->xc->getXcSetVarObj($tableName, $tableFieldName . '_comments', '(int)$itemNumb', $t); $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); - $contIf = $this->getSimpleString('return true;',$t . "\t"); + $contIf = $this->getSimpleString('return true;', $t . "\t"); $func1 .= $this->pc->getPhpCodeConditions($insert, '', '', $contIf, false, $t); - $func1 .= $this->getSimpleString('return false;',$t); + $func1 .= $this->getSimpleString('return false;', $t); $ret .= $this->pc->getPhpCodeFunction($moduleDirname . 'CommentsUpdate', '$itemId, $itemNumb', $func1); $ret .= $this->pc->getPhpCodeCommentMultiLine(['CommentsApprove' => '', '' => '', '@param mixed' => '$comment', '@return' => 'bool']); - $func2 = $this->pc->getPhpCodeCommentLine('Notification event','',$t); + $func2 = $this->pc->getPhpCodeCommentLine('Notification event', '', $t); $func2 .= $this->xc->getXcHelperGetInstance($moduleDirname, $t); $func2 .= $this->xc->getXcHandlerLine($tableName, $t); - $func2 .= $this->xc->getXcGetVar($ccFieldId, "comment", "com_itemid", false, $t); + $func2 .= $this->xc->getXcGetVar($ccFieldId, 'comment', 'com_itemid', false, $t); $func2 .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); $func2 .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t); $func2 .= $this->pc->getPhpCodeBlankLine(); $func2 .= $this->pc->getPhpCodeArray('tags', [], false, $t); $func2 .= $this->xc->getXcEqualsOperator("\$tags['ITEM_NAME']", "\${$ccFieldMain}", '', $t); - $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; + $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; $func2 .= $this->xc->getXcEqualsOperator("\$tags['ITEM_URL'] ", $url, '', $t); $func2 .= $this->xc->getXcXoopsHandler('notification', $t); $func2 .= $this->pc->getPhpCodeCommentLine('Event modify notification', null, $t); $func2 .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_comment', \$tags);", $t); $func2 .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \${$ccFieldId}, '{$tableSoleName}_comment', \$tags);", $t); - $func2 .= $this->getSimpleString('return true;',$t); + $func2 .= $this->getSimpleString('return true;', $t); $func2 .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeFunction($moduleDirname . 'CommentsApprove', '$comment', $func2); @@ -157,9 +155,9 @@ public function render() $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); - $filename = $this->getFileName(); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getCommentBody($module, $table); + $filename = $this->getFileName(); + $content = $this->getHeaderFilesComments($module); + $content .= $this->getCommentBody($module, $table); $this->create($moduleDirname, 'include', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Includes/IncludeComments.php b/class/Files/Includes/IncludeComments.php index 1abe3c76..12ef9880 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index f5fdb982..221c208f 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -1,4 +1,4 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); } /** @@ -80,7 +77,7 @@ public static function getInstance() * @param object $table * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $table, $filename): void { $this->setModule($module); $this->setTable($table); @@ -116,9 +113,9 @@ private function getCommonCode($module) $moduleAuthorImage = \str_replace(' ', '', \mb_strtolower($moduleAuthor)); $contIf = $this->pc->getPhpCodeDefine('XOOPS_ICONS32_PATH', "\XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'", "\t"); - $ret = $this->pc->getPhpCodeConditions("!\defined('XOOPS_ICONS32_PATH')", '','', $contIf, false); + $ret = $this->pc->getPhpCodeConditions("!\defined('XOOPS_ICONS32_PATH')", '', '', $contIf, false); $contIf = $this->pc->getPhpCodeDefine('XOOPS_ICONS32_URL', "\XOOPS_URL . '/Frameworks/moduleclasses/icons/32'", "\t"); - $ret .= $this->pc->getPhpCodeConditions("!\defined('XOOPS_ICONS32_URL')", '','', $contIf, false); + $ret .= $this->pc->getPhpCodeConditions("!\defined('XOOPS_ICONS32_URL')", '', '', $contIf, false); $ret .= $this->getCommonDefines($moduleDirname, 'DIRNAME', "'{$moduleDirname}'"); $ret .= $this->getCommonDefines($moduleDirname, 'PATH', "\XOOPS_ROOT_PATH . '/modules/' . \\{$stuModuleDirname}_DIRNAME"); $ret .= $this->getCommonDefines($moduleDirname, 'URL', "\XOOPS_URL . '/modules/' . \\{$stuModuleDirname}_DIRNAME"); @@ -130,21 +127,21 @@ private function getCommonCode($module) $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_URL', "\XOOPS_UPLOAD_URL . '/' . \\{$stuModuleDirname}_DIRNAME"); if (\is_object($table)) { - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $fieldElement = []; foreach (\array_keys($fields) as $f) { $fieldElement[] = $fields[$f]->getVar('field_element'); } } - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_FILES_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/files'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_FILES_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/files'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_IMAGE_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/images'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_IMAGE_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/images'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_SHOTS_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/images/shots'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_SHOTS_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/images/shots'"); - $ret .= $this->getCommonDefines($moduleDirname, 'ADMIN', "\\{$stuModuleDirname}_URL . '/admin/index.php'"); - $ret .= $this->xc->getXcEqualsOperator('$localLogo', "\\{$stuModuleDirname}_IMAGE_URL . '/{$moduleAuthorImage}_logo.png'"); - $ret .= $this->pc->getPhpCodeCommentLine('Module Information'); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_FILES_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/files'"); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_FILES_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/files'"); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_IMAGE_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/images'"); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_IMAGE_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/images'"); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_SHOTS_PATH', "\\{$stuModuleDirname}_UPLOAD_PATH . '/images/shots'"); + $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_SHOTS_URL', "\\{$stuModuleDirname}_UPLOAD_URL . '/images/shots'"); + $ret .= $this->getCommonDefines($moduleDirname, 'ADMIN', "\\{$stuModuleDirname}_URL . '/admin/index.php'"); + $ret .= $this->xc->getXcEqualsOperator('$localLogo', "\\{$stuModuleDirname}_IMAGE_URL . '/{$moduleAuthorImage}_logo.png'"); + $ret .= $this->pc->getPhpCodeCommentLine('Module Information'); $img = $this->hc->getHtmlImage('" . $localLogo . "', $moduleAuthorWebsiteName); $anchor = $this->hc->getHtmlAnchor($moduleAuthorWebsiteUrl, $img, $moduleAuthorWebsiteName, '_blank', '', '', '', "\n"); diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index 07746a1e..f587980e 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -91,14 +89,14 @@ private function getFunctionBlock($moduleDirname) $t = "\t"; $ret = $this->pc->getPhpCodeCommentMultiLine(['function' => 'add selected cats to block', '' => '', '@param $cats' => '', '@return' => 'string']); $func = $this->xc->getXcEqualsOperator('$cat_sql', "'('", '', $t); - $contIf = $this->xc->getXcEqualsOperator('$cat_sql', "current(\$cats)", '.',$t. "\t"); - $contIf .= $this->getSimpleString("array_shift(\$cats);", $t. "\t"); + $contIf = $this->xc->getXcEqualsOperator('$cat_sql', 'current($cats)', '.', $t . "\t"); + $contIf .= $this->getSimpleString('array_shift($cats);', $t . "\t"); $contFe = $this->getSimpleString("\$cat_sql .= ',' . \$cat;", $t . "\t\t"); - $contIf .= $this->pc->getPhpCodeForeach('cats', false,false,'cat', $contFe, $t. "\t"); - $func .= $this->pc->getPhpCodeConditions('\is_array($cats)','','', $contIf, false, $t); + $contIf .= $this->pc->getPhpCodeForeach('cats', false, false, 'cat', $contFe, $t . "\t"); + $func .= $this->pc->getPhpCodeConditions('\is_array($cats)', '', '', $contIf, false, $t); $func .= $this->xc->getXcEqualsOperator('$cat_sql', "')'", '.', $t); - $func .= $this->getSimpleString('return $cat_sql;', $t); - $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}_block_addCatSelect", '$cats', $func); + $func .= $this->getSimpleString('return $cat_sql;', $t); + $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}_block_addCatSelect", '$cats', $func); return $ret; } @@ -113,17 +111,17 @@ private function getFunctionGetMyItemIds($moduleDirname) { $t = "\t"; $ret = $this->pc->getPhpCodeCommentMultiLine(['Get the permissions ids' => '', '' => '', '@param $permtype' => '', '@param $dirname' => '', '@return' => 'mixed $itemIds']); - $func = $this->xc->getXcGetGlobal(['xoopsUser'], $t); - $func .= $this->xc->getXcEqualsOperator('static $permissions', "[]", '', $t); + $func = $this->xc->getXcGetGlobal(['xoopsUser'], $t); + $func .= $this->xc->getXcEqualsOperator('static $permissions', '[]', '', $t); $contIf = $this->getSimpleString('return $permissions[$permtype];', $t . "\t"); - $func .= $this->pc->getPhpCodeConditions('\is_array($permissions) && \array_key_exists($permtype, $permissions)','','', $contIf, false, $t); - $func .= $this->xc->getXcXoopsHandler('module', $t); - $func .= $this->xc->getXcEqualsOperator("\${$moduleDirname}Module", '$moduleHandler->getByDirname($dirname)', '', $t); - $func .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object($xoopsUser)', '$xoopsUser->getGroups()', '\XOOPS_GROUP_ANONYMOUS', $t); - $func .= $this->xc->getXcXoopsHandler('groupperm', $t); - $func .= $this->xc->getXcEqualsOperator('$itemIds', "\$grouppermHandler->getItemIds(\$permtype, \$groups, \${$moduleDirname}Module->getVar('mid'))", '', $t); - $func .= $this->getSimpleString('return $itemIds;', $t); - $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}GetMyItemIds", '$permtype, $dirname', $func); + $func .= $this->pc->getPhpCodeConditions('\is_array($permissions) && \array_key_exists($permtype, $permissions)', '', '', $contIf, false, $t); + $func .= $this->xc->getXcXoopsHandler('module', $t); + $func .= $this->xc->getXcEqualsOperator("\${$moduleDirname}Module", '$moduleHandler->getByDirname($dirname)', '', $t); + $func .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object($xoopsUser)', '$xoopsUser->getGroups()', '\XOOPS_GROUP_ANONYMOUS', $t); + $func .= $this->xc->getXcXoopsHandler('groupperm', $t); + $func .= $this->xc->getXcEqualsOperator('$itemIds', "\$grouppermHandler->getItemIds(\$permtype, \$groups, \${$moduleDirname}Module->getVar('mid'))", '', $t); + $func .= $this->getSimpleString('return $itemIds;', $t); + $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}GetMyItemIds", '$permtype, $dirname', $func); return $ret; } @@ -140,7 +138,7 @@ private function getFunctionGetMyItemIds($moduleDirname) */ private function getFunctionNumbersOfEntries($moduleDirname, $tableMid, $tableId, $tableName) { - $fields = $this->getTableFields($tableMid, $tableId); + $fields = $this->getTableFields($tableMid, $tableId); $fieldId = ''; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -149,33 +147,33 @@ private function getFunctionNumbersOfEntries($moduleDirname, $tableMid, $tableId } } $ret = <<getAllChild(\$cid); - foreach (\array_keys(\$entries) as \$i) { - if (\$entries[\$i]->getVar('{$fieldId}') == \$cid){ - \$count++; - } - foreach (\array_keys(\$child) as \$j) { - if (\$entries[\$i]->getVar('{$fieldId}') == \$j){ - \$count++; + \n/** + * Get the number of {$tableName} from the sub categories of a category or sub topics of or topic + * @param \$mytree + * @param \${$tableName} + * @param \$entries + * @param \$cid + * @return int + */ + function {$moduleDirname}NumbersOfEntries(\$mytree, \${$tableName}, \$entries, \$cid) + { + \$count = 0; + if(\in_array(\$cid, \${$tableName})) { + \$child = \$mytree->getAllChild(\$cid); + foreach (\array_keys(\$entries) as \$i) { + if (\$entries[\$i]->getVar('{$fieldId}') == \$cid){ + \$count++; + } + foreach (\array_keys(\$child) as \$j) { + if (\$entries[\$i]->getVar('{$fieldId}') == \$j){ + \$count++; + } + } + } } - } - } - } - return \$count; -}\n -EOT; + return \$count; + }\n + EOT; return $ret; } @@ -190,23 +188,23 @@ function {$moduleDirname}NumbersOfEntries(\$mytree, \${$tableName}, \$entries, \ private function getFunctionMetaKeywords($moduleDirname) { $ret = <<undoHtmlSpecialChars(\$myts->displayTarea(\$content)); - if(isset(\$xoTheme) && \is_object(\$xoTheme)) { - \$xoTheme->addMeta( 'meta', 'keywords', \strip_tags(\$content)); - } else { // Compatibility for old Xoops versions - \$xoopsTpl->assign('xoops_meta_keywords', \strip_tags(\$content)); - } -}\n -EOT; + \n/** + * Add content as meta tag to template + * @param \$content + * @return void + */ + \nfunction {$moduleDirname}MetaKeywords(\$content) + { + global \$xoopsTpl, \$xoTheme; + \$myts = MyTextSanitizer::getInstance(); + \$content= \$myts->undoHtmlSpecialChars(\$myts->displayTarea(\$content)); + if(isset(\$xoTheme) && \is_object(\$xoTheme)) { + \$xoTheme->addMeta( 'meta', 'keywords', \strip_tags(\$content)); + } else { // Compatibility for old Xoops versions + \$xoopsTpl->assign('xoops_meta_keywords', \strip_tags(\$content)); + } + }\n + EOT; return $ret; } @@ -221,23 +219,23 @@ private function getFunctionMetaKeywords($moduleDirname) private function getFunctionMetaDescription($moduleDirname) { $ret = <<undoHtmlSpecialChars(\$myts->displayTarea(\$content)); - if(isset(\$xoTheme) && \is_object(\$xoTheme)) { - \$xoTheme->addMeta( 'meta', 'description', \strip_tags(\$content)); - } else { // Compatibility for old Xoops versions - \$xoopsTpl->assign('xoops_meta_description', \strip_tags(\$content)); - } -}\n -EOT; + \n/** + * Add content as meta description to template + * @param \$content + * @return void + */ + \nfunction {$moduleDirname}MetaDescription(\$content) + { + global \$xoopsTpl, \$xoTheme; + \$myts = MyTextSanitizer::getInstance(); + \$content = \$myts->undoHtmlSpecialChars(\$myts->displayTarea(\$content)); + if(isset(\$xoTheme) && \is_object(\$xoTheme)) { + \$xoTheme->addMeta( 'meta', 'description', \strip_tags(\$content)); + } else { // Compatibility for old Xoops versions + \$xoopsTpl->assign('xoops_meta_description', \strip_tags(\$content)); + } + }\n + EOT; return $ret; } @@ -254,96 +252,96 @@ private function getRewriteUrl($moduleDirname, $tableName) { $ucfModuleDirname = \ucfirst($moduleDirname); $ret = <<getHandler('{$tableName}'); - \$lenght_id = \$helper->getConfig('lenght_id'); - \$rewrite_url = \$helper->getConfig('rewrite_url'); - - if (0 != \$lenght_id) { - \$id = \$array['content_id']; - while (\strlen(\$id) < \$lenght_id) { - \$id = '0' . \$id; - } - } else { - \$id = \$array['content_id']; - } - - if (isset(\$array['topic_alias']) && \$array['topic_alias']) { - \$topic_name = \$array['topic_alias']; - } else { - \$topic_name = {$moduleDirname}_Filter(xoops_getModuleOption('static_name', \$module)); - } - - switch (\$rewrite_url) { - - case 'none': - if(\$topic_name) { - \$topic_name = 'topic=' . \$topic_name . '&'; - } - \$rewrite_base = '/modules/'; - \$page = 'page=' . \$array['content_alias']; - return \XOOPS_URL . \$rewrite_base . \$module . '/' . \$type . '.php?' . \$topic_name . 'id=' . \$id . '&' . \$page . \$comment; - break; - - case 'rewrite': - if(\$topic_name) { - \$topic_name .= '/'; - } - \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); - \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); - \$module_name = ''; - if(xoops_getModuleOption('rewrite_name', \$module)) { - \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; - } - \$page = \$array['content_alias']; - \$type .= '/'; - \$id .= '/'; - if ('content/' === \$type) { - \$type = ''; - } - if ('comment-edit/' === \$type || 'comment-reply/' === \$type || 'comment-delete/' === \$type) { - return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; - } + \n/** + * Rewrite all url + * + * @param string \$module module name + * @param array \$array array + * @param string \$type type + * @return null|string \$type string replacement for any blank case + */ + function {$moduleDirname}_RewriteUrl(\$module, \$array, \$type = 'content') + { + \$comment = ''; + \$helper = \XoopsModules\\{$ucfModuleDirname}\Helper::getInstance(); + \${$tableName}Handler = \$helper->getHandler('{$tableName}'); + \$lenght_id = \$helper->getConfig('lenght_id'); + \$rewrite_url = \$helper->getConfig('rewrite_url'); + + if (0 != \$lenght_id) { + \$id = \$array['content_id']; + while (\strlen(\$id) < \$lenght_id) { + \$id = '0' . \$id; + } + } else { + \$id = \$array['content_id']; + } - return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$id . \$page . \$rewrite_ext; - break; + if (isset(\$array['topic_alias']) && \$array['topic_alias']) { + \$topic_name = \$array['topic_alias']; + } else { + \$topic_name = {$moduleDirname}_Filter(xoops_getModuleOption('static_name', \$module)); + } - case 'short': - if(\$topic_name) { - \$topic_name .= '/'; - } - \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); - \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); - \$module_name = ''; - if(xoops_getModuleOption('rewrite_name', \$module)) { - \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; - } - \$page = \$array['content_alias']; - \$type .= '/'; - if ('content/' === \$type) { - \$type = ''; - } - if ('comment-edit/' === \$type || 'comment-reply/' === \$type || 'comment-delete/' === \$type) { - return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; + switch (\$rewrite_url) { + + case 'none': + if(\$topic_name) { + \$topic_name = 'topic=' . \$topic_name . '&'; + } + \$rewrite_base = '/modules/'; + \$page = 'page=' . \$array['content_alias']; + return \XOOPS_URL . \$rewrite_base . \$module . '/' . \$type . '.php?' . \$topic_name . 'id=' . \$id . '&' . \$page . \$comment; + break; + + case 'rewrite': + if(\$topic_name) { + \$topic_name .= '/'; + } + \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); + \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); + \$module_name = ''; + if(xoops_getModuleOption('rewrite_name', \$module)) { + \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; + } + \$page = \$array['content_alias']; + \$type .= '/'; + \$id .= '/'; + if ('content/' === \$type) { + \$type = ''; + } + if ('comment-edit/' === \$type || 'comment-reply/' === \$type || 'comment-delete/' === \$type) { + return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; + } + + return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$id . \$page . \$rewrite_ext; + break; + + case 'short': + if(\$topic_name) { + \$topic_name .= '/'; + } + \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); + \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); + \$module_name = ''; + if(xoops_getModuleOption('rewrite_name', \$module)) { + \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; + } + \$page = \$array['content_alias']; + \$type .= '/'; + if ('content/' === \$type) { + \$type = ''; + } + if ('comment-edit/' === \$type || 'comment-reply/' === \$type || 'comment-delete/' === \$type) { + return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; + } + + return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$page . \$rewrite_ext; + break; + } + return null; } - - return \XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$page . \$rewrite_ext; - break; - } - return null; -} -EOT; + EOT; return $ret; } @@ -360,30 +358,30 @@ private function getRewriteFilter($moduleDirname, $tableName) { $ucfModuleDirname = \ucfirst($moduleDirname); $ret = <<getHandler('{$tableName}'); - \$regular_expression = \$helper->getConfig('regular_expression'); - - \$url = \strip_tags(\$url); - \$url .= \preg_replace('`\[.*\]`U', '', \$url); - \$url .= \preg_replace('`&(amp;)?#?[a-z0-9]+;`i', '-', \$url); - \$url .= \htmlentities(\$url, ENT_COMPAT, 'utf-8'); - \$url .= \preg_replace('`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", \$url); - \$url .= \preg_replace([\$regular_expression, '`[-]+`'], '-', \$url); - \$url = ('' == \$url) ? \$type : \strtolower(\\trim(\$url, '-')); - return \$url; -} -EOT; + \n/** + * Replace all escape, character, ... for display a correct url + * + * @param string \$url string to transform + * @param string \$type string replacement for any blank case + * @return string \$url + */ + function {$moduleDirname}_Filter(\$url, \$type = '') { + + // Get regular expression from module setting. default setting is : `[^a-z0-9]`i + \$helper = \XoopsModules\\{$ucfModuleDirname}\Helper::getInstance(); + \${$tableName}Handler = \$helper->getHandler('{$tableName}'); + \$regular_expression = \$helper->getConfig('regular_expression'); + + \$url = \strip_tags(\$url); + \$url .= \preg_replace('`\[.*\]`U', '', \$url); + \$url .= \preg_replace('`&(amp;)?#?[a-z0-9]+;`i', '-', \$url); + \$url .= \htmlentities(\$url, ENT_COMPAT, 'utf-8'); + \$url .= \preg_replace('`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", \$url); + \$url .= \preg_replace([\$regular_expression, '`[-]+`'], '-', \$url); + \$url = ('' == \$url) ? \$type : \strtolower(\\trim(\$url, '-')); + return \$url; + } + EOT; return $ret; } diff --git a/class/Files/Includes/IncludeJquery.php b/class/Files/Includes/IncludeJquery.php index 977231f5..d273139d 100644 --- a/class/Files/Includes/IncludeJquery.php +++ b/class/Files/Includes/IncludeJquery.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -85,13 +84,13 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); //$content = $this->getHeaderFilesComments($module, $filename); $content = <<<'EOT' -$(document).ready(function(){ - $( "button, input:button, input:submit, input:file, input:reset" ).css("color","inherit").button(); - $( ".check" ).css("color","#fff").button(); - $( ".radio" ).css("color","#fff").buttonset(); - $( ".toolbar" ).css("color","#000").buttonset(); -}); -EOT; + $(document).ready(function(){ + $( "button, input:button, input:submit, input:file, input:reset" ).css("color","inherit").button(); + $( ".check" ).css("color","#fff").button(); + $( ".radio" ).css("color","#fff").buttonset(); + $( ".toolbar" ).css("color","#000").buttonset(); + }); + EOT; $this->tdmcfile->create($moduleDirname, 'assets/js', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); diff --git a/class/Files/Includes/IncludeNotifications.php b/class/Files/Includes/IncludeNotifications.php index 5e904b4c..9441b6f9 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTables($tables); @@ -91,18 +89,18 @@ public function getNotificationsFunction($moduleDirname) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $tables = $this->getTables(); - $t = "\t"; - $ret = $this->pc->getPhpCodeCommentMultiLine(['comment' => 'callback functions','' => '', '@param $category' => '', '@param $item_id' => '', '@return' => 'array item|null']); - $func = $this->xc->getXcGetGlobal(['xoopsDB'], $t); - $func .= $this->pc->getPhpCodeBlankLine(); - $contIf = $this->pc->getPhpCodeDefine($stuModuleDirname . '_URL',"\XOOPS_URL . '/modules/{$moduleDirname}'", $t . "\t"); - $func .= $this->pc->getPhpCodeConditions("!\defined('{$stuModuleDirname}_URL')", '','',$contIf, false, $t); - $func .= $this->pc->getPhpCodeBlankLine(); - - $case[] = $this->xc->getXcEqualsOperator("\$item['name']", "''",'',$t . "\t\t"); - $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "''",'',$t . "\t\t"); - $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); - $cases = [ + $t = "\t"; + $ret = $this->pc->getPhpCodeCommentMultiLine(['comment' => 'callback functions', '' => '', '@param $category' => '', '@param $item_id' => '', '@return' => 'array item|null']); + $func = $this->xc->getXcGetGlobal(['xoopsDB'], $t); + $func .= $this->pc->getPhpCodeBlankLine(); + $contIf = $this->pc->getPhpCodeDefine($stuModuleDirname . '_URL', "\XOOPS_URL . '/modules/{$moduleDirname}'", $t . "\t"); + $func .= $this->pc->getPhpCodeConditions("!\defined('{$stuModuleDirname}_URL')", '', '', $contIf, false, $t); + $func .= $this->pc->getPhpCodeBlankLine(); + + $case[] = $this->xc->getXcEqualsOperator("\$item['name']", "''", '', $t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "''", '', $t . "\t\t"); + $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); + $cases = [ 'global' => $case, ]; $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); @@ -132,18 +130,18 @@ public function getNotificationsFunction($moduleDirname) } else { $tableSingle = $tableName; } - $case[] = $this->xc->getXcEqualsOperator('$sql ', "'SELECT {$fieldMain} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fieldId} = '. \$item_id",'',$t . "\t\t"); - $case[] = $this->xc->getXcEqualsOperator('$result ', '$xoopsDB->query($sql)','',$t . "\t\t"); - $case[] = $this->xc->getXcEqualsOperator('$result_array', '$xoopsDB->fetchArray($result)','',$t . "\t\t"); - $case[] = $this->xc->getXcEqualsOperator("\$item['name']", "\$result_array['{$fieldMain}']",'',$t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator('$sql ', "'SELECT {$fieldMain} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fieldId} = '. \$item_id", '', $t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator('$result ', '$xoopsDB->query($sql)', '', $t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator('$result_array', '$xoopsDB->fetchArray($result)', '', $t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator("\$item['name']", "\$result_array['{$fieldMain}']", '', $t . "\t\t"); if ($fieldParent) { - $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "\\{$stuModuleDirname}_URL . '/{$tableSingle}.php?{$fieldParent}=' . \$result_array['{$fieldParent}'] . '&{$fieldId}=' . \$item_id",'',$t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "\\{$stuModuleDirname}_URL . '/{$tableSingle}.php?{$fieldParent}=' . \$result_array['{$fieldParent}'] . '&{$fieldId}=' . \$item_id", '', $t . "\t\t"); } else { - $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "\\{$stuModuleDirname}_URL . '/{$tableName}.php?{$fieldId}=' . \$item_id",'',$t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator("\$item['url'] ", "\\{$stuModuleDirname}_URL . '/{$tableName}.php?{$fieldId}=' . \$item_id", '', $t . "\t\t"); } - $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); - $cases = [ + $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); + $cases = [ $tableName => $case, ]; $contentSwitch .= $this->pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); @@ -152,7 +150,7 @@ public function getNotificationsFunction($moduleDirname) } $func .= $this->pc->getPhpCodeSwitch('category', $contentSwitch, $t); - $func .= $this->getSimpleString('return null;', $t ); + $func .= $this->getSimpleString('return null;', $t); $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}_notify_iteminfo", '$category, $item_id', $func); return $ret; diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index c54b1424..2b71f6de 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -97,31 +94,31 @@ public function getSearchFunction($moduleDirname) { $ucfModuleDirname = \ucfirst($moduleDirname); $tables = $this->getTables(); - $t = "\t"; - $ret = $this->pc->getPhpCodeCommentMultiLine(['search callback functions' => '', '' => '', '@param $queryarray' => '', '@param $andor' => '', '@param $limit' => '', '@param $offset' => '', '@param $userid' => '', '@return' => 'array $itemIds']); - $func = $this->xc->getXcEqualsOperator('$ret', "[]", '', $t); - $func .= $this->xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", $t); + $t = "\t"; + $ret = $this->pc->getPhpCodeCommentMultiLine(['search callback functions' => '', '' => '', '@param $queryarray' => '', '@param $andor' => '', '@param $limit' => '', '@param $offset' => '', '@param $userid' => '', '@return' => 'array $itemIds']); + $func = $this->xc->getXcEqualsOperator('$ret', '[]', '', $t); + $func .= $this->xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", $t); if (\is_array($tables)) { foreach (\array_keys($tables) as $i) { - if(1 === (int) $tables[$i]->getVar('table_search')) { + if (1 === (int)$tables[$i]->getVar('table_search')) { $tableId = $tables[$i]->getVar('table_id'); $tableMid = $tables[$i]->getVar('table_mid'); $tableName = $tables[$i]->getVar('table_name'); $tableFieldname = $tables[$i]->getVar('table_fieldname'); - $func .= $this->pc->getPhpCodeCommentLine('search in table', $tableName, $t); - $func .= $this->pc->getPhpCodeCommentLine('search keywords', '', $t); - $func .= $this->xc->getXcEqualsOperator('$elementCount', '0', '', $t); - $func .= $this->xc->getXcHandlerLine($tableName, $t); - $contIf = $this->xc->getXcEqualsOperator('$elementCount', '\count($queryarray)', '', $t . "\t"); - $func .= $this->pc->getPhpCodeConditions('\is_array($queryarray)', '', '', $contIf, false, $t); - $contIf = $this->xc->getXcCriteriaCompo('crKeywords', $t . "\t"); - $for = $this->xc->getXcCriteriaCompo('crKeyword', $t . "\t\t"); - - $fields = $this->getTableFields($tableMid, $tableId); - $fieldId = ''; - $fieldMain = ''; - $fieldDate = ''; + $func .= $this->pc->getPhpCodeCommentLine('search in table', $tableName, $t); + $func .= $this->pc->getPhpCodeCommentLine('search keywords', '', $t); + $func .= $this->xc->getXcEqualsOperator('$elementCount', '0', '', $t); + $func .= $this->xc->getXcHandlerLine($tableName, $t); + $contIf = $this->xc->getXcEqualsOperator('$elementCount', '\count($queryarray)', '', $t . "\t"); + $func .= $this->pc->getPhpCodeConditions('\is_array($queryarray)', '', '', $contIf, false, $t); + $contIf = $this->xc->getXcCriteriaCompo('crKeywords', $t . "\t"); + $for = $this->xc->getXcCriteriaCompo('crKeyword', $t . "\t\t"); + + $fields = $this->getTableFields($tableMid, $tableId); + $fieldId = ''; + $fieldMain = ''; + $fieldDate = ''; $countField = 0; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -144,7 +141,7 @@ public function getSearchFunction($moduleDirname) $for .= $this->xc->getXcCriteriaAdd('crKeywords', '$crKeyword', $t . "\t\t", "\n", '$andor'); } $for .= $this->pc->getPhpCodeUnset('crKeyword', $t . "\t\t"); - $contIf .= $this->pc->getPhpCodeFor( 'i', $for, 'elementCount', '0', ' < ', $t . "\t"); + $contIf .= $this->pc->getPhpCodeFor('i', $for, 'elementCount', '0', ' < ', $t . "\t"); $func .= $this->pc->getPhpCodeConditions('$elementCount', ' > ', '0', $contIf, false, $t); $func .= $this->pc->getPhpCodeCommentLine('search user(s)', '', $t); $contIf = $this->xc->getXcEqualsOperator('$userid', "array_map('\intval', \$userid)", '', $t . "\t"); @@ -162,15 +159,15 @@ public function getSearchFunction($moduleDirname) $contIf = $this->xc->getXcCriteriaAdd('crSearch', '$crUser', $t . "\t", "\n", "'AND'"); $cond = $this->pc->getPhpCodeIsset('crUser'); $func .= $this->pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t); - $func .= $this->xc->getXcCriteriaSetStart( 'crSearch', '$offset', $t); - $func .= $this->xc->getXcCriteriaSetLimit( 'crSearch', '$limit', $t); + $func .= $this->xc->getXcCriteriaSetStart('crSearch', '$offset', $t); + $func .= $this->xc->getXcCriteriaSetLimit('crSearch', '$limit', $t); if ('' !== $fieldDate) { - $func .= $this->xc->getXcCriteriaSetSort( 'crSearch', "'{$fieldDate}'", $t); + $func .= $this->xc->getXcCriteriaSetSort('crSearch', "'{$fieldDate}'", $t); } else { - $func .= $this->xc->getXcCriteriaSetSort( 'crSearch', "'{$fieldId}_date'", $t); + $func .= $this->xc->getXcCriteriaSetSort('crSearch', "'{$fieldId}_date'", $t); } - $func .= $this->xc->getXcCriteriaSetOrder( 'crSearch', "'DESC'", $t); - $func .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$crSearch', $t); + $func .= $this->xc->getXcCriteriaSetOrder('crSearch', "'DESC'", $t); + $func .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$crSearch', $t); $contentForeach = $t . "\t\$ret[] = [\n"; $contentForeach .= $t . "\t\t'image' => 'assets/icons/16/{$tableName}.png',\n"; $contentForeach .= $t . "\t\t'link' => '{$tableName}.php?op=show&{$fieldId}=' . \${$tableName}All[\$i]->getVar('{$fieldId}'),\n"; @@ -179,11 +176,11 @@ public function getSearchFunction($moduleDirname) $contentForeach .= $t . "\t\t'time' => \${$tableName}All[\$i]->getVar('{$fieldDate}')\n"; } $contentForeach .= $t . "\t];\n"; - $func .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t"); - $func .= $this->pc->getPhpCodeUnset('crKeywords', $t); - $func .= $this->pc->getPhpCodeUnset('crKeyword', $t); - $func .= $this->pc->getPhpCodeUnset('crUser', $t); - $func .= $this->pc->getPhpCodeUnset('crSearch', $t); + $func .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t"); + $func .= $this->pc->getPhpCodeUnset('crKeywords', $t); + $func .= $this->pc->getPhpCodeUnset('crKeyword', $t); + $func .= $this->pc->getPhpCodeUnset('crUser', $t); + $func .= $this->pc->getPhpCodeUnset('crSearch', $t); } $func .= $this->pc->getPhpCodeBlankLine(); } diff --git a/class/Files/Includes/index.php b/class/Files/Includes/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Includes/index.php +++ b/class/Files/Includes/index.php @@ -1,2 +1,2 @@ -ld = LanguageDefines::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->pc = Files\CreatePhpCode::getInstance(); } /** @@ -76,7 +76,7 @@ public static function getInstance() * @param string $tables * @param string $filename */ - public function write($module, $table, $tables, $filename) + public function write($module, $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); @@ -196,7 +196,7 @@ public function getLanguageAdminClass($language, $tables) $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); if ($fieldElement >= Constants::FIRST_FIELDELEMENT_TABLE) { - $fieldElements = Modulebuilder\Helper::getInstance()->getHandler('Fieldelements')->get($fieldElement); + $fieldElements = Helper::getInstance()->getHandler('Fieldelements')->get($fieldElement); $fieldElementName = $fieldElements->getVar('fieldelement_name'); $fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); $fieldNameDesc = \str_replace(': ', '', $fieldNameDesc); diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 0781e0dd..b7721fec 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -98,17 +97,17 @@ private function getLanguageBlock($language) $ucfTableSoleName = \ucfirst($tableSoleName); $stuTableName = \mb_strtoupper($tableName); $stuTableSoleName = \mb_strtoupper($tableSoleName); - $ret .= $this->ld->getAboveDefines($ucfTableName); - $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); - $ret .= $this->ld->getDefine($language, $stuTableName . '_TO_DISPLAY', $ucfTableName . ' to Display'); - $ret .= $this->ld->getDefine($language, 'ALL_' . $stuTableName, 'All ' . $ucfTableName); + $ret .= $this->ld->getAboveDefines($ucfTableName); + $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); + $ret .= $this->ld->getDefine($language, $stuTableName . '_TO_DISPLAY', $ucfTableName . ' to Display'); + $ret .= $this->ld->getDefine($language, 'ALL_' . $stuTableName, 'All ' . $ucfTableName); foreach (\array_keys($fields) as $f) { if (1 === (int)$fields[$f]->getVar('field_block')) { - $fieldName = $fields[$f]->getVar('field_name'); - $stuFieldName = \mb_strtoupper($fieldName); - $rpFieldName = $this->getRightString($fieldName); + $fieldName = $fields[$f]->getVar('field_name'); + $stuFieldName = \mb_strtoupper($fieldName); + $rpFieldName = $this->getRightString($fieldName); $fieldNameDesc = \ucfirst($rpFieldName); - $ret .= $this->ld->getDefine($language, $stuFieldName, $fieldNameDesc); + $ret .= $this->ld->getDefine($language, $stuFieldName, $fieldNameDesc); } } $ret .= $this->ld->getDefine($language, $stuTableSoleName . '_GOTO', 'Goto ' . $ucfTableSoleName); diff --git a/class/Files/Language/LanguageDefines.php b/class/Files/Language/LanguageDefines.php index 1a273fe8..a97d3248 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -86,34 +85,34 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $language = $GLOBALS['xoopsConfig']['language']; $content = << -

Help: - {$moduleName} Back to the Administration of {$moduleName} -

- -

Description

-

- The {$moduleName} module can be used to modules in XOOPS

-

-

Install/uninstall

-

-No special measures necessary, follow the standard installation process and extract the {$moduleDirname} folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

-Detailed instructions on installing modules are available in the XOOPS Operations Manual -

-

Features

-

- The ModuleBuilder module continues to expand, to get to the conditions to create modules, more and more sophisticated.
- For this reason, I invite all developers to report and send in svn any changes or additions to this module, so that we can jointly contribute to the development

-

-

Tutorial

-

- You can find a more detailed to this Video Tutorial here -

- - -EOT; +
+

Help: + {$moduleName} Back to the Administration of {$moduleName} +

+ +

Description

+

+ The {$moduleName} module can be used to modules in XOOPS

+

+

Install/uninstall

+

+ No special measures necessary, follow the standard installation process and extract the {$moduleDirname} folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

+ Detailed instructions on installing modules are available in the XOOPS Operations Manual +

+

Features

+

+ The ModuleBuilder module continues to expand, to get to the conditions to create modules, more and more sophisticated.
+ For this reason, I invite all developers to report and send in svn any changes or additions to this module, so that we can jointly contribute to the development

+

+

Tutorial

+

+ You can find a more detailed to this Video Tutorial here +

+ +
+ EOT; if ('english' !== $language) { $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); } diff --git a/class/Files/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index 6a9903cb..baca80da 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -372,7 +371,7 @@ public function render() case 'global_new_notify.tpl': $content .= $this->getTemplateGlobalNew($line); break; - case'global_modify_notify.tpl': + case 'global_modify_notify.tpl': $content .= $this->getTemplateGlobalModify($line); break; case 'global_delete_notify.tpl': diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index 8ef36357..ce518e36 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -208,6 +206,7 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getAboveHeadDefines('Print'); $ret .= $this->ld->getDefine($language, 'PRINT', 'Print'); } + return $ret; } diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index f6f22ae5..c0854574 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -1,4 +1,4 @@ -ld->getBlankLine(); - $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__','common', true); + $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'common', true); $ret .= $this->ld->getBlankLine(); $ret .= $this->ld->getAboveHeadDefines('Admin Main'); $ret .= $this->ld->getDefine($language, 'NAME', (string)$module->getVar('mod_name')); @@ -131,7 +129,7 @@ private function getLanguageMenu($module, $language) } if (\in_array(1, $tableBroken)) { ++$menu; - $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Broken items'); + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Broken items'); } if (\in_array(1, $tablePermissions)) { ++$menu; @@ -216,8 +214,8 @@ private function getLanguageBlocks($tables, $language) $stuTableSoleName = \mb_strtoupper($tableSoleName); $ucfTableName = \ucfirst($tableName); $ucfTableSoleName = \ucfirst($stuTableSoleName); - $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block"); - $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description"); if (1 == $tables[$i]->getVar('table_category')) { $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); @@ -289,7 +287,7 @@ private function getLanguageConfig($language, $tables) if (13 == $fieldElement) { $fieldImage = true; } - if (14 == $fieldElement) { + if (14 == $fieldElement) { $fieldFile = true; } } @@ -321,7 +319,7 @@ private function getLanguageConfig($language, $tables) $ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image'); $ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE_DESC', 'Set the max height to which uploaded images should be scaled (in pixel)
0 means, that images keeps the original size.
If an image is smaller than maximum value then the image will be not enlarge, it will be save in original height'); } - if ($fieldFile) { + if ($fieldFile) { $ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE', 'Max size file'); $ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); $ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE', 'Mime types file'); @@ -332,24 +330,24 @@ private function getLanguageConfig($language, $tables) $ret .= $this->ld->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes'); } $getDefinesConf = [ - 'NUMB_COL' => 'Number Columns', - 'NUMB_COL_DESC' => 'Number Columns to View', - 'DIVIDEBY' => 'Divide By', - 'DIVIDEBY_DESC' => 'Divide by columns number', - 'TABLE_TYPE' => 'Table Type', - 'TABLE_TYPE_DESC' => 'Table Type is the bootstrap html table', - 'PANEL_TYPE' => 'Panel Type', - 'PANEL_TYPE_DESC' => 'Panel Type is the bootstrap html div', - 'IDPAYPAL' => 'Paypal ID', - 'IDPAYPAL_DESC' => 'Insert here your PayPal ID for donations', - 'SHOW_BREADCRUMBS' => 'Show breadcrumb navigation', - 'SHOW_BREADCRUMBS_DESC' => 'Show breadcrumb navigation which displays the current page in context within the site structure', - 'ADVERTISE' => 'Advertisement Code', - 'ADVERTISE_DESC' => 'Insert here the advertisement code', - 'MAINTAINEDBY' => 'Maintained By', - 'MAINTAINEDBY_DESC' => 'Allow url of support site or community', - 'BOOKMARKS' => 'Social Bookmarks', - 'BOOKMARKS_DESC' => 'Show Social Bookmarks in the single page', + 'NUMB_COL' => 'Number Columns', + 'NUMB_COL_DESC' => 'Number Columns to View', + 'DIVIDEBY' => 'Divide By', + 'DIVIDEBY_DESC' => 'Divide by columns number', + 'TABLE_TYPE' => 'Table Type', + 'TABLE_TYPE_DESC' => 'Table Type is the bootstrap html table', + 'PANEL_TYPE' => 'Panel Type', + 'PANEL_TYPE_DESC' => 'Panel Type is the bootstrap html div', + 'IDPAYPAL' => 'Paypal ID', + 'IDPAYPAL_DESC' => 'Insert here your PayPal ID for donations', + 'SHOW_BREADCRUMBS' => 'Show breadcrumb navigation', + 'SHOW_BREADCRUMBS_DESC' => 'Show breadcrumb navigation which displays the current page in context within the site structure', + 'ADVERTISE' => 'Advertisement Code', + 'ADVERTISE_DESC' => 'Insert here the advertisement code', + 'MAINTAINEDBY' => 'Maintained By', + 'MAINTAINEDBY_DESC' => 'Allow url of support site or community', + 'BOOKMARKS' => 'Social Bookmarks', + 'BOOKMARKS_DESC' => 'Show Social Bookmarks in the single page', //'FACEBOOK_COMMENTS' => 'Facebook comments', //'FACEBOOK_COMMENTS_DESC' => 'Allow Facebook comments in the single page', //'DISQUS_COMMENTS' => 'Disqus comments', @@ -365,27 +363,27 @@ private function getLanguageConfig($language, $tables) /** * @private function getLanguageNotificationsGlobal * @param $language - * @param $tableBroken - * @param $tableComment + * @param $tableBroken + * @param $tableComment * @return string */ private function getLanguageNotificationsGlobal($language, $tableBroken, $tableComment) { - $ret = $this->ld->getAboveDefines('Global notifications'); - $getDefinesNotif = [ - 'NOTIFY_GLOBAL' => 'Global notification', - 'NOTIFY_GLOBAL_NEW' => 'Any new item', - 'NOTIFY_GLOBAL_NEW_CAPTION' => 'Notify me about any new item', - 'NOTIFY_GLOBAL_NEW_SUBJECT' => 'Notification about new item', - 'NOTIFY_GLOBAL_MODIFY' => 'Any modified item', - 'NOTIFY_GLOBAL_MODIFY_CAPTION' => 'Notify me about any item modification', - 'NOTIFY_GLOBAL_MODIFY_SUBJECT' => 'Notification about modification', - 'NOTIFY_GLOBAL_DELETE' => 'Any deleted item', - 'NOTIFY_GLOBAL_DELETE_CAPTION' => 'Notify me about any deleted item', - 'NOTIFY_GLOBAL_DELETE_SUBJECT' => 'Notification about deleted item', - 'NOTIFY_GLOBAL_APPROVE' => 'Any item to approve', - 'NOTIFY_GLOBAL_APPROVE_CAPTION' => 'Notify me about any item waiting for approvement', - 'NOTIFY_GLOBAL_APPROVE_SUBJECT' => 'Notification about item waiting for approvement', + $ret = $this->ld->getAboveDefines('Global notifications'); + $getDefinesNotif = [ + 'NOTIFY_GLOBAL' => 'Global notification', + 'NOTIFY_GLOBAL_NEW' => 'Any new item', + 'NOTIFY_GLOBAL_NEW_CAPTION' => 'Notify me about any new item', + 'NOTIFY_GLOBAL_NEW_SUBJECT' => 'Notification about new item', + 'NOTIFY_GLOBAL_MODIFY' => 'Any modified item', + 'NOTIFY_GLOBAL_MODIFY_CAPTION' => 'Notify me about any item modification', + 'NOTIFY_GLOBAL_MODIFY_SUBJECT' => 'Notification about modification', + 'NOTIFY_GLOBAL_DELETE' => 'Any deleted item', + 'NOTIFY_GLOBAL_DELETE_CAPTION' => 'Notify me about any deleted item', + 'NOTIFY_GLOBAL_DELETE_SUBJECT' => 'Notification about deleted item', + 'NOTIFY_GLOBAL_APPROVE' => 'Any item to approve', + 'NOTIFY_GLOBAL_APPROVE_CAPTION' => 'Notify me about any item waiting for approvement', + 'NOTIFY_GLOBAL_APPROVE_SUBJECT' => 'Notification about item waiting for approvement', //'CATEGORY_NOTIFY' => 'Category notification', //'CATEGORY_NOTIFY_DESC' => 'Category notification desc', //'CATEGORY_NOTIFY_CAPTION' => 'Category notification caption', @@ -415,29 +413,29 @@ private function getLanguageNotificationsGlobal($language, $tableBroken, $tableC /** * @private function getLanguageNotificationsTable * @param $language - * @param $tableName + * @param $tableName * @param mixed $tableSoleName * - * @param $tableBroken - * @param $tableComment + * @param $tableBroken + * @param $tableComment * @return string */ private function getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment) { $stuTableSoleName = \mb_strtoupper($tableSoleName); $ucfTableSoleName = \ucfirst($tableSoleName); - $ret = $this->ld->getAboveDefines($ucfTableSoleName . ' notifications'); + $ret = $this->ld->getAboveDefines($ucfTableSoleName . ' notifications'); $getDefinesNotif = [ - 'NOTIFY_' . $stuTableSoleName => $ucfTableSoleName . ' notification', - 'NOTIFY_' . $stuTableSoleName . '_MODIFY' => "{$ucfTableSoleName} modification", - 'NOTIFY_' . $stuTableSoleName . '_MODIFY_CAPTION' => "Notify me about {$tableSoleName} modification", - 'NOTIFY_' . $stuTableSoleName . '_MODIFY_SUBJECT' => "Notification about modification", - 'NOTIFY_' . $stuTableSoleName . '_DELETE' => "{$ucfTableSoleName} deleted", - 'NOTIFY_' . $stuTableSoleName . '_DELETE_CAPTION' => "Notify me about deleted {$tableName}", - 'NOTIFY_' . $stuTableSoleName . '_DELETE_SUBJECT' => "Notification delete {$tableSoleName}", - 'NOTIFY_' . $stuTableSoleName . '_APPROVE' => "{$ucfTableSoleName} approve", - 'NOTIFY_' . $stuTableSoleName . '_APPROVE_CAPTION' => "Notify me about {$tableName} waiting for approvement", - 'NOTIFY_' . $stuTableSoleName . '_APPROVE_SUBJECT' => "Notification {$tableSoleName} waiting for approvement", + 'NOTIFY_' . $stuTableSoleName => $ucfTableSoleName . ' notification', + 'NOTIFY_' . $stuTableSoleName . '_MODIFY' => "{$ucfTableSoleName} modification", + 'NOTIFY_' . $stuTableSoleName . '_MODIFY_CAPTION' => "Notify me about {$tableSoleName} modification", + 'NOTIFY_' . $stuTableSoleName . '_MODIFY_SUBJECT' => 'Notification about modification', + 'NOTIFY_' . $stuTableSoleName . '_DELETE' => "{$ucfTableSoleName} deleted", + 'NOTIFY_' . $stuTableSoleName . '_DELETE_CAPTION' => "Notify me about deleted {$tableName}", + 'NOTIFY_' . $stuTableSoleName . '_DELETE_SUBJECT' => "Notification delete {$tableSoleName}", + 'NOTIFY_' . $stuTableSoleName . '_APPROVE' => "{$ucfTableSoleName} approve", + 'NOTIFY_' . $stuTableSoleName . '_APPROVE_CAPTION' => "Notify me about {$tableName} waiting for approvement", + 'NOTIFY_' . $stuTableSoleName . '_APPROVE_SUBJECT' => "Notification {$tableSoleName} waiting for approvement", ]; if (1 == $tableBroken) { $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN'] = "{$ucfTableSoleName} broken"; @@ -475,7 +473,6 @@ private function getLanguagePermissionsGroups($language) return $ret; } - /** * @private function getLanguagePermissionsGroups * @param $language @@ -550,12 +547,11 @@ public function render() if (1 === (int)$tables[$t]->getVar('table_notifications')) { $notifTable .= $this->getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment); } - } - $content = $this->getHeaderFilesComments($module); - $content .= $this->getLanguageMain($language, $module); - $content .= $this->getLanguageMenu($module, $language); + $content = $this->getHeaderFilesComments($module); + $content .= $this->getLanguageMain($language, $module); + $content .= $this->getLanguageMenu($module, $language); if (\in_array(1, $tableAdmin)) { $content .= $this->getLanguageAdmin($language); } @@ -574,7 +570,7 @@ public function render() } $content .= $this->getLanguageConfig($language, $tables); if (\in_array(1, $tableNotifications)) { - $content .= $this->getLanguageNotificationsGlobal($language, \in_array(1, $tableBrokens), \in_array(1, $tableComments)); + $content .= $this->getLanguageNotificationsGlobal($language, \in_array(1, $tableBrokens, true), \in_array(1, $tableComments)); $content .= $notifTable; } if (\in_array(1, $tablePermissions)) { diff --git a/class/Files/Language/index.php b/class/Files/Language/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Language/index.php +++ b/class/Files/Language/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); @@ -90,7 +89,7 @@ private function getHeaderSqlComments($moduleName) $arrayServerInfo = [ "# SQL Dump for {$moduleName} module", '# PhpMyAdmin Version: 4.0.4', - '# http://www.phpmyadmin.net', + '# https://www.phpmyadmin.net', '#', "# Host: {$serverName}", "# Generated on: {$date} to {$time}", diff --git a/class/Files/Sql/index.php b/class/Files/Sql/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Sql/index.php +++ b/class/Files/Sql/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index cd9925ed..3d7156f6 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTables($tables); diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index 9cc8fa14..c6db7d4d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -91,14 +89,14 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $supportName = $module->getVar('mod_support_name'); $language = $this->getLanguage($moduleDirname, 'AM', '', false); - $singleNoVar = $this->sc->getSmartyNoSimbol('xoModuleIcons32 xoopsmicrobutton.gif'); - $img = $this->hc->getHtmlTag('img', ['src' => $singleNoVar, 'alt' => 'XOOPS'], '', true, '',''); - $anchor = $this->hc->getHtmlTag('a', ['href' => 'https://xoops.org/', 'title' => 'Visit XOOPS', 'target' => '_blank'], $img) ; - $content = $this->hc->getHtmlTag('div', ['class' => 'center'], "\n\t" . $anchor); - $tree = $this->hc->getHtmlTag('strong', [], $moduleName, false, '', ''); - $tree .= $this->sc->getSmartyConst($language, 'MAINTAINEDBY'); - $tree .= $this->hc->getHtmlTag('a', ['href' => '<{$maintainedby}>', 'title' => 'Visit ' . $supportName, 'class' => 'tooltip', 'rel' => 'external'], $supportName); - $content .= $this->hc->getHtmlTag('div', ['class' => 'center smallsmall italic pad5'], "\n\t" . $tree); + $singleNoVar = $this->sc->getSmartyNoSimbol('xoModuleIcons32 xoopsmicrobutton.gif'); + $img = $this->hc->getHtmlTag('img', ['src' => $singleNoVar, 'alt' => 'XOOPS'], '', true, '', ''); + $anchor = $this->hc->getHtmlTag('a', ['href' => 'https://xoops.org/', 'title' => 'Visit XOOPS', 'target' => '_blank'], $img); + $content = $this->hc->getHtmlTag('div', ['class' => 'center'], "\n\t" . $anchor); + $tree = $this->hc->getHtmlTag('strong', [], $moduleName, false, '', ''); + $tree .= $this->sc->getSmartyConst($language, 'MAINTAINEDBY'); + $tree .= $this->hc->getHtmlTag('a', ['href' => '<{$maintainedby}>', 'title' => 'Visit ' . $supportName, 'class' => 'tooltip', 'rel' => 'external'], $supportName); + $content .= $this->hc->getHtmlTag('div', ['class' => 'center smallsmall italic pad5'], "\n\t" . $tree); $this->create($moduleDirname, 'templates/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/Admin/TemplatesAdminHeader.php b/class/Files/Templates/Admin/TemplatesAdminHeader.php index fba84aee..6945885d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 75028045..97542018 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index f38cef8c..5ef9fe4f 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index 32d51814..8eff4b1b 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -98,6 +97,7 @@ private function getTemplatesAdminPermissions() { $form = $this->sc->getSmartySingleVar('form'); $ret = $this->hc->getHtmlTag('div', ['class' => 'spacer'], $form, '', '', "\n\n"); + return $ret; } diff --git a/class/Files/Templates/Admin/index.php b/class/Files/Templates/Admin/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Templates/Admin/index.php +++ b/class/Files/Templates/Admin/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setTable($table); @@ -86,13 +84,13 @@ public function write($module, $table, $filename) * @param $tableId * @param $tableMid * @param string $language - * @param $tableAutoincrement + * @param $tableAutoincrement * @return string */ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) { - $th = ''; - if (1 == $tableAutoincrement) { + $th = ''; + if (1 == $tableAutoincrement) { $th .= $this->hc->getHtmlTableHead(' ', '', '', "\t\t\t"); } $fields = $this->getTableFields($tableMid, $tableId); @@ -122,12 +120,12 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t */ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) { - $td = ''; - $fieldId = ''; + $td = ''; + $fieldId = ''; $stuTableSoleName = \mb_strtoupper($tableSoleName); if (1 == $tableAutoincrement) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); } $fields = $this->getTableFields($tableMid, $tableId); foreach (\array_keys($fields) as $f) { @@ -143,24 +141,24 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi case 9: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $span = $this->hc->getHtmlTag('span', [], $double); - $td .= $this->hc->getHtmlTableData($span, 'center', '', "\t\t\t"); + $td .= $this->hc->getHtmlTableData($span, 'center', '', "\t\t\t"); break; case 10: $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); - $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; case 13: $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $img = $this->hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName], '', true, '', ''); - $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); } break; } @@ -168,27 +166,27 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi } } // TODO: allow edit only for admins - // $lang = $this->sc->getSmartyConst('', '_EDIT'); - // $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - // $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32 edit.png'); - // $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); - // $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); - // $lang = $this->sc->getSmartyConst('', '_DELETE'); - // $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - // $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32 delete.png'); - // $img = $this->hc->getHtmlTag('img', ['src' => $src . $double, 'alt' => $tableName], '', true, '', ''); - // $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); - // $td .= $this->hc->getHtmlTag('td', ['class' => 'center'], "\n" . $anchor . "\t\t\t", false, "\t\t\t"); + // $lang = $this->sc->getSmartyConst('', '_EDIT'); + // $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + // $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32 edit.png'); + // $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); + // $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); + // $lang = $this->sc->getSmartyConst('', '_DELETE'); + // $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + // $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32 delete.png'); + // $img = $this->hc->getHtmlTag('img', ['src' => $src . $double, 'alt' => $tableName], '', true, '', ''); + // $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); + // $td .= $this->hc->getHtmlTag('td', ['class' => 'center'], "\n" . $anchor . "\t\t\t", false, "\t\t\t"); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $lang = $this->sc->getSmartyConst($language, $stuTableSoleName . '_GOTO'); $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $double, $lang, $lang); - $td .= $this->hc->getHtmlTableData($anchor, 'center', '', "\t\t\t"); - $cycle = $this->sc->getSmartyNoSimbol('cycle values="odd, even"'); - $tr = $this->hc->getHtmlTableRow($td, $cycle, "\t\t"); - $foreach = $this->sc->getSmartyForeach($tableSoleName, 'block', $tr, '','', "\t\t"); - $tbody = $this->hc->getHtmlTableTbody($foreach,'' , "\t"); + $td .= $this->hc->getHtmlTableData($anchor, 'center', '', "\t\t\t"); + $cycle = $this->sc->getSmartyNoSimbol('cycle values="odd, even"'); + $tr = $this->hc->getHtmlTableRow($td, $cycle, "\t\t"); + $foreach = $this->sc->getSmartyForeach($tableSoleName, 'block', $tr, '', '', "\t\t"); + $tbody = $this->hc->getHtmlTableTbody($foreach, '', "\t"); - return $this->sc->getSmartyConditions("block", '', '', $tbody, false, true, true, "\t"); + return $this->sc->getSmartyConditions('block', '', '', $tbody, false, true, true, "\t"); } /** @@ -197,7 +195,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi */ private function getTemplatesBlocksTableTfoot() { - $td = $this->hc->getHtmlTag('td', [], " ", false, '', ''); + $td = $this->hc->getHtmlTag('td', [], ' ', false, '', ''); $tr = $this->hc->getHtmlTag('tr', [], $td, false, '', ''); return $this->hc->getHtmlTag('tfoot', [], $tr, false, "\t"); diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index a107dca6..66595e36 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index e90dc886..2fdb4b33 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -1,10 +1,9 @@ -setModule($module); $this->setTable($table); @@ -88,7 +85,6 @@ public function write($module, $table, $filename) */ private function getTemplatesUserCategoriesHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname) . PHP_EOL; } @@ -206,7 +202,6 @@ private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $ta */ private function getTemplatesUserCategoriesFooter($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); } diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index c0ca48ac..aa422fd4 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -1,10 +1,9 @@ -setModule($module); $this->setTable($table); @@ -87,9 +85,9 @@ public function write($module, $table, $filename) private function getTemplatesUserCategoriesListStartTable() { $ret = << - \n -EOT; +
+
\n + EOT; return $ret; } @@ -102,9 +100,9 @@ private function getTemplatesUserCategoriesListStartTable() private function getTemplatesUserCategoriesListThead($table) { $ret = << - \n -EOT; + + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_user')) { @@ -112,15 +110,15 @@ private function getTemplatesUserCategoriesListThead($table) $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; + \n + EOT; } } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -136,9 +134,9 @@ private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = << - \n -EOT; + + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldElement = $fields[$f]->getVar('field_element'); @@ -150,15 +148,15 @@ private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; case 13: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; case 2: case 3: @@ -166,17 +164,17 @@ private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; + \n + EOT; break; } } } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -190,9 +188,9 @@ private function getTemplatesUserCategoriesListTfoot($table) { $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $ret = << - \n -EOT; + + \n + EOT; foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_user')) { @@ -200,15 +198,15 @@ private function getTemplatesUserCategoriesListTfoot($table) $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; + \n + EOT; } } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -222,9 +220,9 @@ private function getTemplatesUserCategoriesListTfoot($table) private function getTemplatesUserCategoriesListEndTable() { $ret = << -\n -EOT; +
<{\$list.{$rpFieldName}}>
{$tableName}{$tableName}<{\$list.{$rpFieldName}}>
<{\$list.{$rpFieldName}}>
+ \n + EOT; return $ret; } diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index cc311d53..b0a47d6a 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -119,20 +116,19 @@ private function getTemplateUserFooterContent($language) $contIf = $this->hc->getHtmlDiv("<{\$smarty.const.{$language}ADMIN}>", 'text-center bold', "\t", "\n", false); $ret .= $this->sc->getSmartyConditions('xoops_isadmin', '', '', $contIf); $ret .= $this->hc->getHtmlEmpty("\n"); - $contIf = $this->sc->getSmartyIncludeFile('system_comments','flat',false, false,"\t\t\t"); - $contIf .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>',"\t\t"); - $contIf .= $this->sc->getSmartyIncludeFile('system_comments','thread',false, false,"\t\t\t"); - $contIf .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>',"\t\t"); - $contIf .= $this->sc->getSmartyIncludeFile('system_comments','nest',false, false,"\t\t\t"); - $contDiv = $this->sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '','',"\t\t", "\n", true, false); + $contIf = $this->sc->getSmartyIncludeFile('system_comments', 'flat', false, false, "\t\t\t"); + $contIf .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>', "\t\t"); + $contIf .= $this->sc->getSmartyIncludeFile('system_comments', 'thread', false, false, "\t\t\t"); + $contIf .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>', "\t\t"); + $contIf .= $this->sc->getSmartyIncludeFile('system_comments', 'nest', false, false, "\t\t\t"); + $contDiv = $this->sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '', '', "\t\t", "\n", true, false); $contIf = $this->hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t", "\n", true); $ret .= $this->sc->getSmartyConditions('comment_mode', '', '', $contIf); - $ret .= $this->sc->getSmartyIncludeFile('system_notification','select'); + $ret .= $this->sc->getSmartyIncludeFile('system_notification', 'select'); return $ret; } - /** * @public function render * @param null diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index 1857ce54..e32d998d 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index f327a12a..0d394d3d 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -90,7 +88,6 @@ public function write($module, $table, $tables, $filename) */ public function getTemplateUserIndexHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, false); } @@ -156,7 +153,7 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole $ret = $this->hc->getHtmlDiv($double, "{$moduleDirname}-linetitle", $t, "\n", false); $table = $this->hc->getHtmlComment("Start show new {$tableName} in index",$t . "\t", "\n"); $include = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName, $t . "\t\t\t\t\t", "\n"); - $td = $this->hc->getHtmlTableData($include, "col_width<{\$numb_col}> top center", '', $t . "\t\t\t\t", "\n", true); + $td = $this->hc->getHtmlTableData($include, 'col_width<{$numb_col}> top center', '', $t . "\t\t\t\t", "\n", true); $tr = $this->hc->getHtmlEmpty('', $t . "\t\t\t\t\t", "\n"); $td .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $tr, false, false, false, $t . "\t\t\t\t", "\n", true, false); $foreach = $this->hc->getHtmlComment('Start new link loop',$t . "\t\t\t", "\n"); diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index d0ab18fe..2aba6ea2 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -83,10 +82,10 @@ public function write($module, $folder, $filename, $extension) private function getTemplatesUserMoreFile() { $ret = <<<'EOT' -
- Pleace! Enter here your template code here -
-EOT; +
+ Pleace! Enter here your template code here +
+ EOT; return $ret; } diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index b3672f89..d65e4fc6 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -154,7 +152,7 @@ private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $ta */ private function getTemplatesUserPagesTableTfoot() { - $td = $this->hc->getHtmlTableData(" ", '', '', '', ''); + $td = $this->hc->getHtmlTableData(' ', '', '', '', ''); $tr = $this->hc->getHtmlTableRow($td, '', '', ''); return $this->hc->getHtmlTableTfoot($tr, '', "\t\t", "\n", false); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 5aeb2d78..6348694a 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index 0eed0268..c016cec4 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -161,7 +159,6 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table } } - $ret .= $this->hc->getHtmlDiv($retElem, 'panel-body'); $retFoot = ''; foreach (\array_keys($fields) as $f) { diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index 7d53906e..efe83790 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -93,11 +92,11 @@ public function write($module, $table, $filename) */ private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) { - $fields = $this->getTableFields($tableMid, $tableId); - $ret = ''; + $fields = $this->getTableFields($tableMid, $tableId); + $ret = ''; $content_header = $this->sc->getSmartySingleVar('content_header'); - $ret .= $this->hc->getHtmlDiv($content_header, 'panel-heading', '',"\n", false); - $retElem = ''; + $ret .= $this->hc->getHtmlDiv($content_header, 'panel-heading', '', "\n", false); + $retElem = ''; foreach (\array_keys($fields) as $f) { $fieldElement = $fields[$f]->getVar('field_element'); if (1 == $fields[$f]->getVar('field_user')) { @@ -106,26 +105,26 @@ private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $t $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $retElem .= $this->hc->getHtmlDiv($lang . ': ' , 'col-sm-3',"\t", "\n", false); + $retElem .= $this->hc->getHtmlDiv($lang . ': ', 'col-sm-3', "\t", "\n", false); switch ($fieldElement) { default: //case 3: //case 4: - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false); break; case 10: - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlDiv($img, 'col-sm-8', "\t", "\n", false); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retElem .= $this->hc->getHtmlDiv($img, 'col-sm-8', "\t", "\n", false); unset($img); break; case 13: - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlDiv($img, 'col-sm-9',"\t", "\n", false); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retElem .= $this->hc->getHtmlDiv($img, 'col-sm-9', "\t", "\n", false); unset($img); break; } @@ -147,13 +146,13 @@ public function render() $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $table = $this->getTable(); + $table = $this->getTable(); $language = $this->getLanguage($moduleDirname, 'MA', '', false); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $content = $this->getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $content = $this->getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php index c8a7fedd..b5c69ec8 100644 --- a/class/Files/Templates/User/Defstyle/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -83,25 +82,25 @@ public function write($module, $table, $filename) private function getTemplatesUserRateHeader($moduleDirname, $table, $language) { $ret = << - - - \n -EOT; + <{include file="db:{$moduleDirname}_header.tpl"}> +
+ + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $langStuFieldName = $language . \mb_strtoupper($fieldName); if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { $ret .= <<<{\$smarty.const.{$langStuFieldName}}>\n -EOT; + \n + EOT; } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -117,10 +116,10 @@ private function getTemplatesUserRateBody($moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = << - <{foreach item=list from=\${$tableName}}> - \n -EOT; + + <{foreach item=list from=\${$tableName}}> + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -130,33 +129,33 @@ private function getTemplatesUserRateBody($moduleDirname, $table) switch ($fieldElement) { case Constants::FIELD_ELE_COLORPICKER: $ret .= <<\t\t\n -EOT; + \n + EOT; break; case Constants::FIELD_ELE_IMAGELIST: $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; case Constants::FIELD_ELE_UPLOADIMAGE: $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; default: $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; + \n + EOT; break; } } } $ret .= << - <{/foreach}> - -
<{\$smarty.const.{$langStuFieldName}}>
\t\t{$tableName}{$tableName}<{\$list.{$rpFieldName}}>
\n -EOT; + + <{/foreach}> + + \n + EOT; return $ret; } @@ -172,10 +171,10 @@ private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = << - <{foreach item=list from=\${$tableName}}> - \n -EOT; + + <{foreach item=list from=\${$tableName}}> + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -184,28 +183,28 @@ private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table) switch ($fieldElement) { case Constants::FIELD_ELE_COLORPICKER: $ret .= <<\n -EOT; + \n + EOT; break; case Constants::FIELD_ELE_UPLOADIMAGE: $ret .= <<{$tableName}\n -EOT; + {$tableName}\n + EOT; break; default: $ret .= <<<{\$list.{$fieldName}}>\n -EOT; + <{\$list.{$fieldName}}>\n + EOT; break; } } } $ret .= << - <{/foreach}> - -\n -EOT; + + <{/foreach}> + + \n + EOT; return $ret; } @@ -219,8 +218,8 @@ private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table) private function getTemplatesUserRateFooter($moduleDirname) { $ret = << -EOT; + <{include file="db:{$moduleDirname}_footer.tpl"}> + EOT; return $ret; } diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php index d34fe849..bd2b08e2 100644 --- a/class/Files/Templates/User/Defstyle/Rss.php +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -75,40 +74,40 @@ public function write($module, $filename) private function getTemplatesUserRssXml() { $ret = << - - - <{\$channel_title}> - <{\$channel_link}> - <{\$channel_desc}> - <{\$channel_lastbuild}> - http://backend.userland.com/rss/ - <{\$channel_generator}> - <{\$channel_category}> - <{\$channel_editor}> - <{\$channel_webmaster}> - <{\$channel_language}> - <{if \$image_url != ""}> - - <{\$channel_title}> - <{\$image_url}> - <{\$channel_link}> - <{\$image_width}> - <{\$image_height}> - - <{/if}> - <{foreach item=item from=\$items}> - - <{\$item.title}> - <{\$item.link}> - <{\$item.description}> - <{\$item.pubdate}> - <{\$item.guid}> - - <{/foreach}> - -\n -EOT; + + + + <{\$channel_title}> + <{\$channel_link}> + <{\$channel_desc}> + <{\$channel_lastbuild}> + https://backend.userland.com/rss/ + <{\$channel_generator}> + <{\$channel_category}> + <{\$channel_editor}> + <{\$channel_webmaster}> + <{\$channel_language}> + <{if \$image_url != ""}> + + <{\$channel_title}> + <{\$image_url}> + <{\$channel_link}> + <{\$image_width}> + <{\$image_height}> + + <{/if}> + <{foreach item=item from=\$items}> + + <{\$item.title}> + <{\$item.link}> + <{\$item.description}> + <{\$item.pubdate}> + <{\$item.guid}> + + <{/foreach}> + + \n + EOT; return $ret; } diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php index 9978a23a..d83e8add 100644 --- a/class/Files/Templates/User/Defstyle/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -80,25 +79,25 @@ public function write($module, $table, $filename) private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) { $ret = << - - - \n -EOT; + <{include file="db:{$moduleDirname}_header.tpl"}> +
+ + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $langStuFieldName = $language . \mb_strtoupper($fieldName); if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { $ret .= <<<{\$smarty.const.{$langStuFieldName}}>\n -EOT; + \n + EOT; } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -114,10 +113,10 @@ private function getTemplatesUserSearchBody($moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = << - <{foreach item=list from=\${$tableName}}> - \n -EOT; + + <{foreach item=list from=\${$tableName}}> + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -127,33 +126,33 @@ private function getTemplatesUserSearchBody($moduleDirname, $table) switch ($fieldElement) { case 9: $ret .= <<\t\t\n -EOT; + \n + EOT; break; case 10: $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; case 13: $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; default: $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; + \n + EOT; break; } } } $ret .= << - <{/foreach}> - -
<{\$smarty.const.{$langStuFieldName}}>
\t\t{$tableName}{$tableName}<{\$list.{$rpFieldName}}>
\n -EOT; + + <{/foreach}> + + \n + EOT; return $ret; } @@ -169,10 +168,10 @@ private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table { $tableName = $table->getVar('table_name'); $ret = << - <{foreach item=list from=\${$tableName}}> - \n -EOT; + + <{foreach item=list from=\${$tableName}}> + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -181,28 +180,28 @@ private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table switch ($fieldElement) { case 9: $ret .= <<\n -EOT; + \n + EOT; break; case 13: $ret .= <<{$tableName}\n -EOT; + {$tableName}\n + EOT; break; default: $ret .= <<<{\$list.{$fieldName}}>\n -EOT; + <{\$list.{$fieldName}}>\n + EOT; break; } } } $ret .= << - <{/foreach}> - -\n -EOT; + + <{/foreach}> + + \n + EOT; return $ret; } @@ -215,8 +214,8 @@ private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table private function getTemplatesUserSearchFooter($moduleDirname) { $ret = << -EOT; + <{include file="db:{$moduleDirname}_footer.tpl"}> + EOT; return $ret; } diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index eaf88aa8..2848dadc 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Templates/User/index.php b/class/Files/Templates/User/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Templates/User/index.php +++ b/class/Files/Templates/User/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index 2cd8e058..e52d2932 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -100,12 +97,12 @@ private function getUserHeader($moduleDirname) $stuModuleDirname = \mb_strtoupper($moduleDirname); $tables = $this->getTables(); - $ret = $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__, 2)', 'mainfile'); - $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'include/common'); - $ret .= $this->xc->getXcEqualsOperator('$moduleDirName', '\basename(__DIR__)'); - $ret .= $this->pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $this->pc->getPhpCodeArray('xoBreadcrumbs', null, false, ''); - $ret .= $this->xc->getXcHelperGetInstance($moduleDirname); + $ret = $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__, 2)', 'mainfile'); + $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'include/common'); + $ret .= $this->xc->getXcEqualsOperator('$moduleDirName', '\basename(__DIR__)'); + $ret .= $this->pc->getPhpCodeCommentLine('Breadcrumbs'); + $ret .= $this->pc->getPhpCodeArray('xoBreadcrumbs', null, false, ''); + $ret .= $this->xc->getXcHelperGetInstance($moduleDirname); $permissions = 0; $ratings = 0; if (\is_array($tables)) { @@ -130,7 +127,7 @@ private function getUserHeader($moduleDirname) $ret .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); $ret .= $this->pc->getPhpCodeCommentLine('Default Css Style'); $ret .= $this->xc->getXcEqualsOperator('$style', "\\{$stuModuleDirname}_URL . '/assets/css/style.css'"); - $ret .= $this->pc->getPhpCodeCommentLine('Smarty Default'); + $ret .= $this->pc->getPhpCodeCommentLine('Smarty Default'); $ret .= $this->xc->getXcXoopsModuleGetInfo('sysPathIcon16', 'sysicons16'); $ret .= $this->xc->getXcXoopsModuleGetInfo('sysPathIcon32', 'sysicons32'); $ret .= $this->xc->getXcXoopsModuleGetInfo('pathModuleAdmin', 'dirmoduleadmin'); diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index 67c0f1eb..3e55b44d 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -1,4 +1,4 @@ -getTable(); - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $ucfTableName = \ucfirst($tableName); + $table = $this->getTable(); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $ret = $this->pc->getPhpCodeCommentLine('Tables'); $ret .= $this->xc->getXcHandlerCountObj($tableName); @@ -189,18 +188,18 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $fieldMain = $fieldName; // fieldMain = fields parameters main field } } - $foreach .= $this->xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, "\t\t"); - $foreach .= $this->getSimpleString('++$count;', "\t\t"); - $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, "\t"); - $condIf .= $this->xc->getXcXoopsTplAssign($tableName, '$' . $tableName, true, "\t"); - $condIf .= $this->pc->getPhpCodeUnset($tableName, "\t"); - $condIf .= $this->xc->getXcPageNav($tableName, "\t"); - $thereare = $this->pc->getPhpCodeSprintf("{$language}INDEX_THEREARE", "\${$tableName}Count"); - $condIf .= $this->xc->getXcXoopsTplAssign('lang_thereare', $thereare, true, "\t"); - $divideby = $this->xc->getXcGetConfig('divideby'); - $condIf .= $this->xc->getXcXoopsTplAssign('divideby', $divideby, true, "\t"); - $numb_col = $this->xc->getXcGetConfig('numb_col'); - $condIf .= $this->xc->getXcXoopsTplAssign('numb_col', $numb_col, true, "\t"); + $foreach .= $this->xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, "\t\t"); + $foreach .= $this->getSimpleString('++$count;', "\t\t"); + $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, "\t"); + $condIf .= $this->xc->getXcXoopsTplAssign($tableName, '$' . $tableName, true, "\t"); + $condIf .= $this->pc->getPhpCodeUnset($tableName, "\t"); + $condIf .= $this->xc->getXcPageNav($tableName, "\t"); + $thereare = $this->pc->getPhpCodeSprintf("{$language}INDEX_THEREARE", "\${$tableName}Count"); + $condIf .= $this->xc->getXcXoopsTplAssign('lang_thereare', $thereare, true, "\t"); + $divideby = $this->xc->getXcGetConfig('divideby'); + $condIf .= $this->xc->getXcXoopsTplAssign('divideby', $divideby, true, "\t"); + $numb_col = $this->xc->getXcGetConfig('numb_col'); + $condIf .= $this->xc->getXcXoopsTplAssign('numb_col', $numb_col, true, "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf); $ret .= $this->pc->getPhpCodeUnset('count'); $tableType = $this->xc->getXcGetConfig('table_type'); @@ -218,15 +217,15 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) private function getUserIndexFooter($moduleDirname, $language) { $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->pc->getPhpCodeCommentLine('Keywords'); - $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); - $ret .= $this->pc->getPhpCodeUnset('keywords'); - $ret .= $this->pc->getPhpCodeCommentLine('Description'); - $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/index.php'"); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_icons32_url', '\XOOPS_ICONS32_URL'); - $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); - $ret .= $this->getRequire('footer'); + $ret = $this->pc->getPhpCodeCommentLine('Keywords'); + $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); + $ret .= $this->pc->getPhpCodeUnset('keywords'); + $ret .= $this->pc->getPhpCodeCommentLine('Description'); + $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language); + $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/index.php'"); + $ret .= $this->xc->getXcXoopsTplAssign('xoops_icons32_url', '\XOOPS_ICONS32_URL'); + $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); + $ret .= $this->getRequire('footer'); return $ret; } @@ -238,11 +237,11 @@ private function getUserIndexFooter($moduleDirname, $language) */ public function render() { - $module = $this->getModule(); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); + $module = $this->getModule(); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module); $content .= $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); diff --git a/class/Files/User/UserListTag.php b/class/Files/User/UserListTag.php index df6cc089..abd98e55 100644 --- a/class/Files/User/UserListTag.php +++ b/class/Files/User/UserListTag.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/User/UserNotificationUpdate.php b/class/Files/User/UserNotificationUpdate.php index 40ad4fc8..5a34ef8b 100644 --- a/class/Files/User/UserNotificationUpdate.php +++ b/class/Files/User/UserNotificationUpdate.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 2ca12a57..7854ae2b 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -1,4 +1,4 @@ -pc->getPhpCodeCommentLine('Permissions'); if (1 == $tablePermissions) { $ret .= $this->xc->getXcEqualsOperator('$permEdit', '$permissionsHandler->getPermGlobalSubmit()'); - $ret .= $this->xc->getXcXoopsTplAssign("permEdit", '$permEdit'); + $ret .= $this->xc->getXcXoopsTplAssign('permEdit', '$permEdit'); } - $ret .= $this->xc->getXcXoopsTplAssign("showItem", "\${$ccFieldId} > 0"); + $ret .= $this->xc->getXcXoopsTplAssign('showItem', "\${$ccFieldId} > 0"); $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; @@ -226,25 +223,22 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $condIf .= $this->xc->getXcXoopsTplAssign('numb_col', $numbCol, true, $t . "\t"); $stripTags = $this->pc->getPhpCodeStripTags('', "\${$ccFieldMain} . ' - ' . " . "\$GLOBALS['xoopsModule']->getVar('name')", true); $condIf2 = $this->xc->getXcXoopsTplAssign('xoops_pagetitle', $stripTags, true, $t . "\t\t"); - $condIf .= $this->pc->getPhpCodeConditions("'show' == \$op && '' != \${$ccFieldMain}", '', "", $condIf2, false, $t . "\t"); + $condIf .= $this->pc->getPhpCodeConditions("'show' == \$op && '' != \${$ccFieldMain}", '', '', $condIf2, false, $t . "\t"); if ('' !== $fieldReads) { $condIf3 = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t\t"); - $getVar = $this->xc->getXcGetVar('', "{$tableName}Obj", $fieldReads, true); - $condIf3 .= $this->xc->getXcEqualsOperator("\${$ccFieldReads}", "(int)" . $getVar . ' + 1', false, $t . "\t\t"); + $condIf3 .= $this->xc->getXcEqualsOperator("\${$ccFieldReads}", '(int)' . $getVar . ' + 1', false, $t . "\t\t"); $condIf3 .= $this->xc->getXcSetVarObj($tableName, $fieldReads, "\${$ccFieldReads}", $t . "\t\t"); $condIf3 .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t . "\t\t"); $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); $condIf3 .= $this->getSimpleString($insert .';',$t . "\t\t"); //$contentInsert = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&{$fieldId}=' . \${$ccFieldId}", '', '5', "\${$tableName}Obj->getHtmlErrors()", false, $t . "\t\t\t"); //$condIf3 .= $this->pc->getPhpCodeConditions('!' . $insert, '', '', $contentInsert, false, $t . "\t\t"); - $condIf .= $this->pc->getPhpCodeConditions("'show' == \$op", '', "", $condIf3, false, $t . "\t"); - + $condIf .= $this->pc->getPhpCodeConditions("'show' == \$op", '', '', $condIf3, false, $t . "\t"); } - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, false, $t); return $ret; @@ -391,7 +385,7 @@ private function getPermissionsSave($moduleDirname, $ucfFieldId, $perm = 'view') $ret .= $this->xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', "\$new{$ucfFieldId}", false, "\t\t\t"); $content = $this->xc->getXcAddRight('grouppermHandler', "{$moduleDirname}_{$perm}", "\$new{$ucfFieldId}", '$onegroupId', '$mid', false, "\t\t\t\t\t"); $foreach = $this->pc->getPhpCodeForeach("_POST['groups_{$perm}']", false, false, 'onegroupId', $content, "\t\t\t\t"); - $ret .= $this->pc->getPhpCodeConditions("isset(\$_POST['groups_{$perm}'])", null, null, $foreach, false, "\t\t\t"); + $ret .= $this->pc->getPhpCodeConditions("isset(\$_POST['groups_{$perm}'])", '', '', $foreach, false, "\t\t\t"); return $ret; } @@ -464,7 +458,7 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, '\_NOPERM', true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); } - $ret .= $this->pc->getPhpCodeCommentLine("Request source", '', $t); + $ret .= $this->pc->getPhpCodeCommentLine('Request source', '', $t); $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index 8834c0ce..d3461fd9 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -167,9 +164,9 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie break; } } - $ret .= $this->pc->getPhpCodeStripTags("pdfData['title'] ", "\$myts->undoHtmlSpecialChars(\$title)"); + $ret .= $this->pc->getPhpCodeStripTags("pdfData['title'] ", '$myts->undoHtmlSpecialChars($title)'); $ret .= $this->pc->getPhpCodeStripTags("pdfData['subject'] ", '$subject'); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['content'] ", "\$myts->undoHtmlSpecialChars(\$content)"); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['content'] ", '$myts->undoHtmlSpecialChars($content)'); $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontname']", 'PDF_FONT_NAME_MAIN'); $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontsize']", 'PDF_FONT_SIZE_MAIN'); $ret .= $this->pc->getPhpCodeBlankLine(); @@ -242,7 +239,7 @@ private function getUserPdfFooter($moduleDirname, $tableName) $ret = $this->pc->getPhpCodeCommentLine('Add Page document'); $ret .= $this->getSimpleString('$pdf->AddPage();'); $ret .= $this->pc->getPhpCodeCommentLine('Output'); - $ret .= $this->xc->getXcEqualsOperator('$template_path', '\\' . \strtoupper($moduleDirname) . "_PATH . '/templates/" . $moduleDirname . '_' . $tableName . "_pdf.tpl'"); + $ret .= $this->xc->getXcEqualsOperator('$template_path', '\\' . \mb_strtoupper($moduleDirname) . "_PATH . '/templates/" . $moduleDirname . '_' . $tableName . "_pdf.tpl'"); $ret .= $this->xc->getXcEqualsOperator('$content', '$pdfTpl->fetch($template_path)'); $ret .= $this->getSimpleString("\$pdf->writeHTMLCell(\$w=0, \$h=0, \$x='', \$y='', \$content, \$border=0, \$ln=1, \$fill=0, \$reseth=true, \$align='', \$autopadding=true);"); $ret .= $this->getSimpleString("\$pdf->Output(\$pdfFilename, 'I');"); diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 9fcab0b0..2434b333 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index ef719f43..2eb27ff8 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -1,4 +1,4 @@ -pc->getPhpCodeCommentLine('Get Error', null, $t); $ret .= $this->getSimpleString("echo 'Error: ' . \$ratingsObj->getHtmlErrors();", $t); - return $ret; } diff --git a/class/Files/User/UserRss.php b/class/Files/User/UserRss.php index a9301653..4643fa54 100644 --- a/class/Files/User/UserRss.php +++ b/class/Files/User/UserRss.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -121,84 +120,84 @@ public function getUserRss($moduleDirname) $ret .= <<xoops_setCaching(2); //1 = Cache global, 2 = Cache individual (for template) -\$tpl->xoops_setCacheTime(\$helper->getConfig('timecacherss')*60); // Time of the cache on seconds -\$categories = {$moduleDirname}MyGetItemIds('{$moduleDirname}_view', '{$moduleDirname}'); -\$criteria = new \CriteriaCompo(); - -\$criteria->add(new \Criteria('cat_status', 0, '!=')); -\$criteria->add(new \Criteria('{$fppf}', '(' . \implode(',', \$categories) . ')','IN')); -if (0 != \${$fppf}){ - \$criteria->add(new \Criteria('{$fppf}', \${$fppf})); - \${$tableName} = \${$tableName}Handler->get(\${$fppf}); - \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name') . ' - ' . \${$tableName}->getVar('{$fpmf}'); -} else { - \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name'); -} -\$criteria->setLimit(\$helper->getConfig('perpagerss')); -\$criteria->setSort('date'); -\$criteria->setOrder('DESC'); -\${$tableName}Arr = \${$tableName}Handler->getAll(\$criteria); -unset(\$criteria); - -if (!\$tpl->is_cached('db:{$moduleDirname}_rss.tpl', \${$fppf})) { - \$tpl->assign('channel_title', \htmlspecialchars(\$title, ENT_QUOTES)); - \$tpl->assign('channel_link', \XOOPS_URL.'/'); - \$tpl->assign('channel_desc', \htmlspecialchars(\$xoopsConfig['slogan'], ENT_QUOTES)); - \$tpl->assign('channel_lastbuild', \\formatTimestamp(\time(), 'rss')); - \$tpl->assign('channel_webmaster', \$xoopsConfig['adminmail']); - \$tpl->assign('channel_editor', \$xoopsConfig['adminmail']); - \$tpl->assign('channel_category', 'Event'); - \$tpl->assign('channel_generator', 'XOOPS - ' . \htmlspecialchars(\$xoopsModule->getVar('{$fpmf}'), ENT_QUOTES)); - \$tpl->assign('channel_language', _LANGCODE); - if ( 'fr' == _LANGCODE ) { - \$tpl->assign('docs', 'http://www.scriptol.fr/rss/RSS-2.0.html'); - } else { - \$tpl->assign('docs', 'http://cyber.law.harvard.edu/rss/rss.html'); - } - \$tpl->assign('image_url', \XOOPS_URL . \$xoopsModuleConfig['logorss']); - \$dimention = \getimagesize(\XOOPS_ROOT_PATH . \$xoopsModuleConfig['logorss']); - if (empty(\$dimention[0])) { - \$width = 88; - } else { - \$width = (\$dimention[0] > 144) ? 144 : \$dimention[0]; - } - if (empty(\$dimention[1])) { - \$height = 31; - } else { - \$height = (\$dimention[1] > 400) ? 400 : \$dimention[1]; - } - \$tpl->assign('image_width', \$width); - \$tpl->assign('image_height', \$height); - foreach (\array_keys(\${$tableName}Arr) as \$i) { - \$description = \${$tableName}Arr[\$i]->getVar('description'); - //permet d'afficher uniquement la description courte - if (false == \strpos(\$description,'[pagebreak]')){ - \$description_short = \$description; - } else { - \$description_short = \substr(\$description,0,\strpos(\$description,'[pagebreak]')); - } - \$tpl->append('items', ['title' => \htmlspecialchars(\${$tableName}Arr[\$i]->getVar('{$fpmf}'), ENT_QUOTES), - 'link' => \XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'), - 'guid' => \XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'), - 'pubdate' => \\formatTimestamp(\${$tableName}Arr[\$i]->getVar('date'), 'rss'), - 'description' => \htmlspecialchars(\$description_short, ENT_QUOTES) - ]); - } -} -header('Content-Type:text/xml; charset=' . _CHARSET); -\$tpl->display('db:{$moduleDirname}_rss.tpl', \${$fppf}); + \${$fppf} = Request::getInt('{$fppf}', 0, 'GET'); + require_once \XOOPS_ROOT_PATH.'/class/template.php'; + if (\\function_exists('mb_http_output')) { + mb_http_output('pass'); + } + //header ('Content-Type:text/xml; charset=UTF-8'); + \$xoopsModuleConfig['utf8'] = false; + + \$tpl = new \XoopsTpl(); + \$tpl->xoops_setCaching(2); //1 = Cache global, 2 = Cache individual (for template) + \$tpl->xoops_setCacheTime(\$helper->getConfig('timecacherss')*60); // Time of the cache on seconds + \$categories = {$moduleDirname}MyGetItemIds('{$moduleDirname}_view', '{$moduleDirname}'); + \$criteria = new \CriteriaCompo(); + + \$criteria->add(new \Criteria('cat_status', 0, '!=')); + \$criteria->add(new \Criteria('{$fppf}', '(' . \implode(',', \$categories) . ')','IN')); + if (0 != \${$fppf}){ + \$criteria->add(new \Criteria('{$fppf}', \${$fppf})); + \${$tableName} = \${$tableName}Handler->get(\${$fppf}); + \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name') . ' - ' . \${$tableName}->getVar('{$fpmf}'); + } else { + \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name'); + } + \$criteria->setLimit(\$helper->getConfig('perpagerss')); + \$criteria->setSort('date'); + \$criteria->setOrder('DESC'); + \${$tableName}Arr = \${$tableName}Handler->getAll(\$criteria); + unset(\$criteria); + + if (!\$tpl->is_cached('db:{$moduleDirname}_rss.tpl', \${$fppf})) { + \$tpl->assign('channel_title', \htmlspecialchars(\$title, ENT_QUOTES)); + \$tpl->assign('channel_link', \XOOPS_URL.'/'); + \$tpl->assign('channel_desc', \htmlspecialchars(\$xoopsConfig['slogan'], ENT_QUOTES)); + \$tpl->assign('channel_lastbuild', \\formatTimestamp(\time(), 'rss')); + \$tpl->assign('channel_webmaster', \$xoopsConfig['adminmail']); + \$tpl->assign('channel_editor', \$xoopsConfig['adminmail']); + \$tpl->assign('channel_category', 'Event'); + \$tpl->assign('channel_generator', 'XOOPS - ' . \htmlspecialchars(\$xoopsModule->getVar('{$fpmf}'), ENT_QUOTES)); + \$tpl->assign('channel_language', _LANGCODE); + if ( 'fr' == _LANGCODE ) { + \$tpl->assign('docs', 'https://www.scriptol.fr/rss/RSS-2.0.html'); + } else { + \$tpl->assign('docs', 'https://cyber.law.harvard.edu/rss/rss.html'); + } + \$tpl->assign('image_url', \XOOPS_URL . \$xoopsModuleConfig['logorss']); + \$dimention = \getimagesize(\XOOPS_ROOT_PATH . \$xoopsModuleConfig['logorss']); + if (empty(\$dimention[0])) { + \$width = 88; + } else { + \$width = (\$dimention[0] > 144) ? 144 : \$dimention[0]; + } + if (empty(\$dimention[1])) { + \$height = 31; + } else { + \$height = (\$dimention[1] > 400) ? 400 : \$dimention[1]; + } + \$tpl->assign('image_width', \$width); + \$tpl->assign('image_height', \$height); + foreach (\array_keys(\${$tableName}Arr) as \$i) { + \$description = \${$tableName}Arr[\$i]->getVar('description'); + //permet d'afficher uniquement la description courte + if (false === \strpos(\$description,'[pagebreak]')){ + \$description_short = \$description; + } else { + \$description_short = \substr(\$description,0,\strpos(\$description,'[pagebreak]')); + } + \$tpl->append('items', ['title' => \htmlspecialchars(\${$tableName}Arr[\$i]->getVar('{$fpmf}'), ENT_QUOTES), + 'link' => \XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'), + 'guid' => \XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'), + 'pubdate' => \\formatTimestamp(\${$tableName}Arr[\$i]->getVar('date'), 'rss'), + 'description' => \htmlspecialchars(\$description_short, ENT_QUOTES) + ]); + } + } + header('Content-Type:text/xml; charset=' . _CHARSET); + \$tpl->display('db:{$moduleDirname}_rss.tpl', \${$fppf}); -EOT; + EOT; return $ret; } diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index d17cd166..9dbe1f9f 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index f101a80c..50165012 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -1,4 +1,4 @@ -pc->getPhpCodeCommentLine('Breadcrumbs', '', $t); + $stuTableName = \mb_strtoupper($tableName); + $stuOp = ''; + $ret = $this->pc->getPhpCodeCommentLine('Breadcrumbs', '', $t); if ('' !== $op) { $stuOp = ''; if ('' !== $tableName) { @@ -151,9 +150,9 @@ public function getUserBreadcrumbs($language, $tableName = 'index', $op = '', $l $stuOp .= \mb_strtoupper($op); } if ('' === $link) { - $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}"]; + $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}"]; } else { - $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}", "'link'" => "'{$link}'"]; + $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}", "'link'" => "'{$link}'"]; } $ret .= $this->pc->getPhpCodeArray('xoBreadcrumbs[]', $arrBCrumb, false, $t); @@ -176,12 +175,12 @@ public function getUserBreadcrumbsFooterFile() /** * @public function getUserModVersionArray * - * @param int $eleArray - * @param $descriptions - * @param null $name - * @param null $index - * @param bool $num - * @param string $t + * @param int $eleArray + * @param string|array $descriptions + * @param null $name + * @param null $index + * @param bool $num + * @param string $t * * @return string */ @@ -198,7 +197,7 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ $n = "\n"; } if (0 === $eleArray) { - $ret .= " = "; + $ret .= ' = '; } elseif (1 === $eleArray || 11 === $eleArray) { $ret .= "['{$name}'] = "; } elseif (2 === $eleArray) { @@ -207,21 +206,21 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ $ret .= "['{$name}'][{$index}][{$num}] = "; } if ($isArray) { - $ret .= "["; + $ret .= '['; } $ret .= $n; //search for longest key $len = 0; foreach ($descs as $key => $desc) { - $len = \strlen($key) > $len ? \strlen($key) : $len; + $len = \mb_strlen((string)$key) > $len ? \mb_strlen((string)$key) : $len; } foreach ($descs as $key => $desc) { - $space = str_repeat(' ', $len - \strlen($key)); + $space = str_repeat(' ', $len - \mb_strlen((string)$key)); if ($eleArray < 4) { $ret .= $t . "\t'{$key}'{$space} => {$desc},{$n}"; } elseif (11 === $eleArray) { - if ('/' === \substr($desc, 1, 1)) { + if ('/' === \mb_substr($desc, 1, 1)) { $ret .= $t . "\t{$desc}"; } else { $ret .= $t . "\t{$desc},{$n}"; @@ -232,9 +231,10 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ } $ret .= $t; if ($isArray) { - $ret .= "]"; + $ret .= ']'; } $ret .= ";\n"; + return $ret; } @@ -255,7 +255,7 @@ public function getUserModVersionText($eleArray, $text, $name = null, $index = n $ret = $t . '$modversion'; if (0 === $eleArray) { - $ret .= " = "; + $ret .= ' = '; } elseif (1 === $eleArray) { $ret .= "['{$name}'] = "; } elseif (2 === $eleArray) { @@ -265,6 +265,7 @@ public function getUserModVersionText($eleArray, $text, $name = null, $index = n } $ret .= $t . "{$text};\n"; + return $ret; } } diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index b1f46fd7..c58abea3 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -102,7 +98,7 @@ public function write($module, $table, $tables, $filename) * @public function setKeywords * @param mixed $keywords */ - public function setKeywords($keywords) + public function setKeywords($keywords): void { if (\is_array($keywords)) { $this->kw = $keywords; @@ -136,8 +132,8 @@ private function getXoopsVersionHeader($module, $language) $ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', '\basename(__DIR__)'); $ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper', '\mb_strtoupper($moduleDirName)'); $ret .= $this->getDashComment('Informations'); - $ha = (1 == $module->getVar('mod_admin')) ? 1 : 0; - $hm = (1 == $module->getVar('mod_user')) ? 1 : 0; + $ha = (1 == $module->getVar('mod_admin')) ? '1' : '0'; + $hm = (1 == $module->getVar('mod_user')) ? '1' : '0'; $descriptions = [ 'name' => "{$language}NAME", @@ -268,7 +264,7 @@ private function getXoopsVersionComments($moduleDirname, $tables) } } $ret = $this->getDashComment('Comments'); - $ret .= $this->uxc->getUserModVersionText(1, "1", 'hasComments'); + $ret .= $this->uxc->getUserModVersionText(1, '1', 'hasComments'); $ret .= $this->uxc->getUserModVersionText(2, "'{$tableName}.php'", 'comments', "'pageName'"); $ret .= $this->uxc->getUserModVersionText(2, "'{$fieldId}'", 'comments', "'itemName'"); $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Comment callback functions'); @@ -376,7 +372,7 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer'); } - $ret .= $this->uxc->getUserModVersionArray(11, $item, "templates"); + $ret .= $this->uxc->getUserModVersionArray(11, $item, 'templates'); return $ret; } @@ -734,7 +730,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'description' => "'{$language}RATINGBARS_DESC'", 'formtype' => "'select'", 'valuetype' => "'int'", - 'default' => "0", + 'default' => '0', 'options' => "['{$language}RATING_NONE' => 0, '{$language}RATING_5STARS' => 1, '{$language}RATING_10STARS' => 2, '{$language}RATING_LIKES' => 3, '{$language}RATING_10NUM' => 4]", ]; $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); @@ -1078,7 +1074,6 @@ private function getXoopsVersionNotifications($module, $language) $ret .= $notifyCategory . $notifyEventGlobal . $notifyEventTable; - return $ret; } @@ -1108,7 +1103,6 @@ private function getXoopsVersionNotificationGlobal($language, $type, $name, $tit return $ret; } - /** * @private function getXoopsVersionNotificationTableName * @param $language @@ -1185,7 +1179,7 @@ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') $ret .= $this->pc->getPhpCodeIncludeDir("__DIR__ . '/include/xoops_version.inc.php'", '',true,true); $ret .= $this->xc->getXcEqualsOperator('$iniPostMaxSize ', "{$moduleDirname}ReturnBytes(\ini_get('post_max_size'))"); $ret .= $this->xc->getXcEqualsOperator('$iniUploadMaxFileSize', "{$moduleDirname}ReturnBytes(\ini_get('upload_max_filesize'))"); - $ret .= $this->xc->getXcEqualsOperator('$maxSize ', "min(\$iniPostMaxSize, \$iniUploadMaxFileSize)"); + $ret .= $this->xc->getXcEqualsOperator('$maxSize ', 'min($iniPostMaxSize, $iniUploadMaxFileSize)'); $cond = $this->xc->getXcEqualsOperator('$increment', '500', null, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' > ', '10000 * 1048576', $cond, false, $t); $cond = $this->xc->getXcEqualsOperator('$increment', '200', null, $t . "\t"); diff --git a/class/Files/User/index.php b/class/Files/User/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/User/index.php +++ b/class/Files/User/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index a698c130..d22309d3 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -1,8 +1,7 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + $this->xc = Files\CreateXoopsCode::getInstance(); + $this->pc = Files\CreatePhpCode::getInstance(); + $this->axc = Files\Admin\AdminXoopsCode::getInstance(); } /** @@ -232,7 +228,7 @@ private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, { $stuTableName = \mb_strtoupper($tableName); $stuTableSoleName = \mb_strtoupper($tableSoleName); - $ccFieldId = $this->getCamelCase($fieldId, false, true); + $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); $navigation = $this->axc->getAdminDisplayNavigation($tableName); $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); @@ -242,7 +238,7 @@ private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $ret .= $this->axc->getAdminItemButton($language, $tableName, $stuTableSoleName, '?op=new', 'add', $t); $ret .= $this->xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } - $ret .= $this->pc->getPhpCodeCommentLine("Request source", '', $t); + $ret .= $this->pc->getPhpCodeCommentLine('Request source', '', $t); $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t); @@ -262,7 +258,7 @@ private function getPermissionsSave($moduleDirname, $perm = 'view') $ret .= $this->xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); $content = $this->xc->getXcAddRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$permId', '$onegroupId', '$mid', false, "\t\t\t\t\t"); $foreach = $this->pc->getPhpCodeForeach("_POST['groups_{$perm}']", false, false, 'onegroupId', $content, "\t\t\t\t"); - $ret .= $this->pc->getPhpCodeConditions("isset(\$_POST['groups_{$perm}'])", null, null, $foreach, false, "\t\t\t"); + $ret .= $this->pc->getPhpCodeConditions("isset(\$_POST['groups_{$perm}'])", '', '', $foreach, false, "\t\t\t"); return $ret; } @@ -276,21 +272,21 @@ private function getPermissionsSave($moduleDirname, $perm = 'view') * @param $fields * @param $fieldId * @param $fieldMain - * @param $tablePerms + * @param $tablePerms * @param string $t * @return string */ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, $t = '') { $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret = $this->pc->getPhpCodeCommentLine('Security Check','', $t); + $ret = $this->pc->getPhpCodeCommentLine('Security Check', '', $t); $xoopsSecurityCheck = $this->xc->getXcXoopsSecurityCheck('!'); $securityError = $this->xc->getXcXoopsSecurityErrors(); $implode = $this->pc->getPhpCodeImplode(',', $securityError); $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, $t); - $contentIf = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); + $contentIf = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); $contentElse = $this->xc->getXcHandlerCreateObj($tableName, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contentIf, $contentElse, $t); $ret .= $this->pc->getPhpCodeCommentLine('Set Vars', null, $t); @@ -359,7 +355,7 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ if ($countUploader > 0) { $errIf = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=edit&{$fieldId}=' . \${$ccFieldId}", '', '5', '$uploaderErrors', false, $t . "\t\t"); $errElse = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); - $contentInsert .= $this->pc->getPhpCodeConditions('$uploaderErrors', ' !== ',"''" , $errIf, $errElse, $t . "\t"); + $contentInsert .= $this->pc->getPhpCodeConditions('$uploaderErrors', ' !== ', "''", $errIf, $errElse, $t . "\t"); } else { $contentInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); } @@ -384,11 +380,11 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ */ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, $t = '') { - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $stuTableName = \mb_strtoupper($tableName); - $stuTableSoleName = \mb_strtoupper($tableSoleName); - $ccFieldId = $this->getCamelCase($fieldId, false, true); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $stuTableName = \mb_strtoupper($tableName); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); $navigation = $this->axc->getAdminDisplayNavigation($tableName); @@ -412,7 +408,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, * @param $language * @param $fieldId * @param $fieldMain - * @param $tableNotifications + * @param $tableNotifications * @param string $t * @return string */ @@ -433,7 +429,7 @@ private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, */ public function render() { - $tf = Modulebuilder\Files\CreateFile::getInstance(); + $tf = Files\CreateFile::getInstance(); $new = $clone = $save = $edit = ''; $module = $this->getModule(); diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index e90175da..183d5951 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -1,4 +1,4 @@ -addItemButton('; switch ($type) { - case 'add'; + case 'add': $ret = $aM . "{$language}ADD_{$stuTableSoleName}, '{$tableName}.php{$op}');\n"; break; - case 'samplebutton'; + case 'samplebutton': $ret = $aM . "{$language}, '{$op}', 'add');\n"; break; case 'default': @@ -242,7 +240,7 @@ public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $post = $this->pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; $fetchMedia = $this->getAxcFetchMedia('uploader', $post); $expr = '/^.+\.([^.]+)$/sU'; - $ifelse = $this->pc->getPhpCodePregFunzions('extension', $expr, '', "\$filename", 'replace', false, $t . "\t"); + $ifelse = $this->pc->getPhpCodePregFunzions('extension', $expr, '', '$filename', 'replace', false, $t . "\t"); $ifelse .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; $ifelse .= $t . "\t{$fetchMedia};\n"; @@ -264,7 +262,7 @@ public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $contElseInt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
' . \$uploader->getErrors()", '.', $t . "\t\t"); $ifelse .= $this->pc->getPhpCodeConditions('$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); $ifelseExt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
' . \$uploader->getErrors()", '.', $t . "\t\t"); - $contElseExt = $this->pc->getPhpCodeConditions("\$filename", ' > ', "''", $ifelseExt, false, $t . "\t"); + $contElseExt = $this->pc->getPhpCodeConditions('$filename', ' > ', "''", $ifelseExt, false, $t . "\t"); $contElseExt .= $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); @@ -321,7 +319,7 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format $post = $this->pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; $fetchMedia = $this->getAxcFetchMedia('uploader', $post); $expr = '/^.+\.([^.]+)$/sU'; - $ifelse = $this->pc->getPhpCodePregFunzions('extension', $expr, '', "\$filename", 'replace', false, $t . "\t"); + $ifelse = $this->pc->getPhpCodePregFunzions('extension', $expr, '', '$filename', 'replace', false, $t . "\t"); $ifelse .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; $ifelse .= $t . "\t{$fetchMedia};\n"; @@ -329,7 +327,7 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format $contElseInt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
' . \$uploader->getErrors()", '.', $t . "\t\t"); $ifelse .= $this->pc->getPhpCodeConditions('$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); $ifelseExt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
' . \$uploader->getErrors()", '.', $t . "\t\t"); - $contElseExt = $this->pc->getPhpCodeConditions("\$filename", ' > ', "''", $ifelseExt, false, $t . "\t"); + $contElseExt = $this->pc->getPhpCodeConditions('$filename', ' > ', "''", $ifelseExt, false, $t . "\t"); $contElseExt .= $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); @@ -355,7 +353,6 @@ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') return $ret; } - /** * @public function getAxcSetVarMisc * @param $tableName diff --git a/class/Files/index.php b/class/Files/index.php index 6a505435..e5ee0725 100644 --- a/class/Files/index.php +++ b/class/Files/index.php @@ -1,2 +1,2 @@ - - * */ class FormRadio extends \XoopsFormRadio { @@ -54,7 +53,7 @@ public function render() if (isset($ele_value) && $value == $ele_value) { $ret .= ' checked'; } - $ret .= $ele_extra . ' />' . "' . $ele_delimeter; + $ret .= $ele_extra . '>' . "' . $ele_delimeter; if (!empty($this->columns)) { $ret .= ''; if (0 == ++$i % $this->columns) { diff --git a/class/Form/FormRaw.php b/class/Form/FormRaw.php index 13d31d01..221feef4 100644 --- a/class/Form/FormRaw.php +++ b/class/Form/FormRaw.php @@ -1,4 +1,4 @@ - * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.6.0 diff --git a/class/Form/FormTab.php b/class/Form/FormTab.php index 36cfcd6a..03420d21 100644 --- a/class/Form/FormTab.php +++ b/class/Form/FormTab.php @@ -1,4 +1,4 @@ - * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.0.0 @@ -50,6 +50,7 @@ public function __construct($caption, $name) public function render() { $ret = ''; + /** @var \XoopsFormElement $ele */ foreach ($this->getElements() as $ele) { $ret .= NWLINE; $ret .= '' . NWLINE; diff --git a/class/Form/FormTabTray.php b/class/Form/FormTabTray.php index acba7f4a..5198a0a9 100644 --- a/class/Form/FormTabTray.php +++ b/class/Form/FormTabTray.php @@ -1,4 +1,4 @@ - * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.0.0 diff --git a/class/Form/SimpleForm.php b/class/Form/SimpleForm.php index be516480..6f48230a 100644 --- a/class/Form/SimpleForm.php +++ b/class/Form/SimpleForm.php @@ -1,4 +1,4 @@ - - * */ defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/class/Form/index.php b/class/Form/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Form/index.php +++ b/class/Form/index.php @@ -1,2 +1,2 @@ -getObjects($criteria, false, true); $moduleId = $moduleObject[0]->getVar('mod_id'); $tables = self::importTables($moduleId, $moduleName); - if (false === $tables ) { + if (null === $tables) { $ret['result'] = false; $ret['error'] = \_AM_MODULEBUILDER_ERROR_IMPTABLES; } else { @@ -87,15 +88,16 @@ public static function importModule() $ret['result'] = false; $ret['error'] = \_AM_MODULEBUILDER_ERROR_MCREATE . $GLOBALS['xoopsDB']->error(); } + return $ret; } /** * @param $moduleId * @param $moduleName - * @return array|false + * @return array|null */ - public static function importTables($moduleId, $moduleName) + public static function importTables($moduleId, $moduleName): ?array { $helper = Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); @@ -106,10 +108,11 @@ public static function importTables($moduleId, $moduleName) $module = $moduleHandler->getByDirname($moduleName); $moduleTables = $module->getInfo('tables'); - $tables = []; + $tables = null; if (false !== $moduleTables && is_array($moduleTables)) { $currentTableNumber = 0; + $tables = []; foreach ($moduleTables as $table) { //create a new tablesholder $newTable = $tablesHandler->create(); @@ -135,7 +138,6 @@ public static function importTables($moduleId, $moduleName) $fieldsObj->setVar('field_order', $currentFieldNumber); $fieldsObj->setVar('field_name', $t['Field']); - $type = '1'; if (isset($t['Type'])) { $types = [ @@ -162,7 +164,7 @@ public static function importTables($moduleId, $moduleName) 22 => 'TIME', 23 => 'YEAR', ]; - $type = array_search(strtolower($t['Type']), array_map('strtolower', $types)); + $type = array_search(mb_strtolower($t['Type']), array_map('strtolower', $types), true); } $fieldsObj->setVar('field_type', $type); $fieldsObj->setVar('field_value', $t['Len']); @@ -176,7 +178,7 @@ public static function importTables($moduleId, $moduleName) 5 => 'SMALLINT', 6 => 'CURRENT_TIMESTAMP', ]; - $attr = array_search(strtolower($t['Signed']), array_map('strtolower', $attribs)); + $attr = array_search(mb_strtolower($t['Signed']), array_map('strtolower', $attribs), true); } $fieldsObj->setVar('field_attribute', $attr); @@ -199,20 +201,19 @@ public static function importTables($moduleId, $moduleName) 5 => 'IND', 6 => 'FUL', ]; - $key = array_search(strtolower($t['Key']), array_map('strtolower', $keys)); + $key = array_search(mb_strtolower($t['Key']), array_map('strtolower', $keys), true); } $fieldsObj->setVar('field_key', $key); $fieldsObj->setVar('field_element', $t['Field']); //if ($currentFieldNumber < $countFields - 1) { - // //} if (0 == $currentFieldNumber) { - if (in_array($t['Type'], ['blob', 'text', 'mediumblob', 'mediumtext', 'longblob', 'longtext', 'enum', 'set',])) { + if (in_array($t['Type'], ['blob', 'text', 'mediumblob', 'mediumtext', 'longblob', 'longtext', 'enum', 'set'])) { // XoopsFormTextArea $fieldsObj->setVar('field_element', '3'); - } elseif (in_array($t['Type'], ['int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'real', 'char', 'varchar',])) { + } elseif (in_array($t['Type'], ['int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'real', 'char', 'varchar'])) { //XoopsFormText $fieldsObj->setVar('field_element', '2'); } elseif ('datetime' === $t['Type']) { @@ -223,10 +224,10 @@ public static function importTables($moduleId, $moduleName) $fieldsObj->setVar('field_element', '15'); } } elseif ($currentFieldNumber > 0) { - if (in_array($t['Type'], ['blob', 'text', 'mediumblob', 'mediumtext', 'longblob', 'longtext', 'enum', 'set',])) { + if (in_array($t['Type'], ['blob', 'text', 'mediumblob', 'mediumtext', 'longblob', 'longtext', 'enum', 'set'])) { //XoopsFormTextArea $fieldsObj->setVar('field_element', '3'); - } elseif (in_array($t['Type'], ['int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'real', 'char', 'varchar',])) { + } elseif (in_array($t['Type'], ['int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'real', 'char', 'varchar'])) { //XoopsFormText $fieldsObj->setVar('field_element', '2'); } elseif ('datetime' === $t['Type']) { @@ -247,14 +248,13 @@ public static function importTables($moduleId, $moduleName) ++$currentTableNumber; } - } else { - return false; } + return $tables; } /** - * @param $tableName + * @param string $tableName * * @return array */ @@ -269,7 +269,7 @@ public static function importFields($tableName) } $tFields = []; - while ($data = $GLOBALS['xoopsDB']->fetchBoth($result)) { + while (false !== ($data = $GLOBALS['xoopsDB']->fetchBoth($result))) { $t = []; $t['Field'] = $data['Field']; $t['Type'] = $data['Type']; @@ -285,24 +285,25 @@ public static function importFields($tableName) $t['Label'] = $data['Label'] ?? ''; - $h = strpos($data['Type'], '('); - $i = strpos($data['Type'], ')'); + $h = mb_strpos($data['Type'], '('); + $i = mb_strpos($data['Type'], ')'); if (false === $h) { $t['Len'] = 0; } else { - $t['Type'] = substr($data['Type'], 0, $h); + $t['Type'] = mb_substr($data['Type'], 0, $h); if ('double' === $t['Type'] || 'float' === $t['Type'] || 'real' === $t['Type']) { - $t['Len'] = substr($data['Type'], $h + 1, $i - 1 - $h); + $t['Len'] = mb_substr($data['Type'], $h + 1, $i - 1 - $h); } else { - $t['Len'] = (int)substr($data['Type'], $h + 1, $i - 1 - $h); + $t['Len'] = (int)mb_substr($data['Type'], $h + 1, $i - 1 - $h); } - if (strlen($data['Type']) > $i) { - $t['Signed'] = substr($data['Type'], $i + 2); + if (mb_strlen($data['Type']) > $i) { + $t['Signed'] = mb_substr($data['Type'], $i + 2); } } $tFields[$t['Field']] = $t; } + return $tFields; } } diff --git a/class/Logo.php b/class/Logo.php index 2f302b63..2cf921ad 100644 --- a/class/Logo.php +++ b/class/Logo.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index 39ec3316..fabc0f0e 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -1,4 +1,6 @@ - - - * + * @author Txmod Xoops - */ /** @@ -104,7 +103,7 @@ public function __construct() */ public function __call($method, $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -187,12 +186,12 @@ public function getFormModules($action = false) $form = new \XoopsThemeForm($title, 'moduleform', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $modName = $isNew ? $set['name'] : $this->getVar('mod_name'); + $modName = $isNew ? $set['name'] : $this->getVar('mod_name'); $modNameText = new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_NAME, 'mod_name', 50, 255, $modName); $modNameText->setDescription(\_AM_MODULEBUILDER_MODULE_NAME_DESC); $form->addElement($modNameText, true); - $modDirname = $isNew ? $set['dirname'] : $this->getVar('mod_dirname'); + $modDirname = $isNew ? $set['dirname'] : $this->getVar('mod_dirname'); $modDirnameText = new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_DIRNAME, 'mod_dirname', 25, 255, $modDirname); $modDirnameText->setDescription(\_AM_MODULEBUILDER_MODULE_DIRNAME_DESC); $form->addElement($modDirnameText, true); @@ -260,7 +259,7 @@ public function getFormModules($action = false) } $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"mod_image\", \"" . $uploadDirectory . '", "", "' . \XOOPS_URL . "\")'"); $imgtray->addElement($imageselect); - $imgtray->addElement(new \XoopsFormLabel('', "

")); + $imgtray->addElement(new \XoopsFormLabel('', "

")); $fileseltray = new \XoopsFormElementTray('', '
'); $fileseltray->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); @@ -285,7 +284,7 @@ public function getFormModules($action = false) } $iconSelect->setExtra(" onchange='showImgSelected2(\"image4\", \"tables_img\", \"" . $uploadDirectory . '", "", "' . XOOPS_URL . "\")' "); $createLogoTray->addElement($iconSelect); - $createLogoTray->addElement(new \XoopsFormLabel('', "
")); + $createLogoTray->addElement(new \XoopsFormLabel('', "
")); // Create preview and submit buttons $buttonLogoGenerator4 = new \XoopsFormButton('', 'button4', \_AM_MODULEBUILDER_MODULE_CREATENEWLOGO, 'button'); $buttonLogoGenerator4->setExtra(" onclick='createNewModuleLogo(\"" . TDMC_URL . "\")' "); diff --git a/class/ModulesHandler.php b/class/ModulesHandler.php index dfcf2cff..b25656c9 100644 --- a/class/ModulesHandler.php +++ b/class/ModulesHandler.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/Morefiles.php b/class/Morefiles.php index 0136c694..65d13d05 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /* @@ -61,7 +60,7 @@ public function __construct() */ public function __call($method, $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -127,14 +126,13 @@ public function getFormMorefiles($action = false) $fileExtension->setDescription(\_AM_MODULEBUILDER_MORE_FILES_EXTENSION_DESC); $form->addElement($fileExtension); - - $fileUpload = $this->isNew() ? '' : $this->getVar('file_upload'); - $fileTray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_MORE_FILES_UPLOAD, '
' ); + $fileUpload = $this->isNew() ? '' : $this->getVar('file_upload'); + $fileTray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_MORE_FILES_UPLOAD, '
'); $fileDirectory = '/uploads/modulebuilder/files'; - $fileSelect = new \XoopsFormSelect( ".{$fileDirectory}/", 'file_upload', $fileUpload, 5); - $filesArray = \XoopsLists::getFileListAsArray( TDMC_UPLOAD_FILES_PATH); + $fileSelect = new \XoopsFormSelect(".{$fileDirectory}/", 'file_upload', $fileUpload, 5); + $filesArray = \XoopsLists::getFileListAsArray(TDMC_UPLOAD_FILES_PATH); $fileSelect->addOption('', ' - '); - foreach($filesArray as $file1) { + foreach ($filesArray as $file1) { if ('index.html' !== $file1 && 'index.php' !== $file1) { $fileSelect->addOption("{$file1}", $file1); } @@ -142,7 +140,6 @@ public function getFormMorefiles($action = false) $fileTray->addElement($fileSelect, false); $form->addElement($fileTray); - $fileInfolder = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); $fileInfolder->setDescription(\_AM_MODULEBUILDER_MORE_FILES_INFOLDER_DESC); $form->addElement($fileInfolder, true); @@ -172,7 +169,7 @@ public function getValuesMorefiles($keys = null, $format = null, $maxDepth = nul $ret['type'] = $this->getVar('file_type') == Constants::MORE_FILES_TYPE_EMPTY ? \_AM_MODULEBUILDER_MORE_FILES_TYPE_EMPTY : \_AM_MODULEBUILDER_MORE_FILES_TYPE_COPY; $ret['name'] = $this->getVar('file_name'); $ret['extension'] = $this->getVar('file_extension'); - $ret['upload'] = $this->getVar('file_upload'); + $ret['upload'] = $this->getVar('file_upload'); $ret['infolder'] = $this->getVar('file_infolder'); return $ret; diff --git a/class/MorefilesHandler.php b/class/MorefilesHandler.php index ec429caa..74ecac64 100644 --- a/class/MorefilesHandler.php +++ b/class/MorefilesHandler.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/Session.php b/class/Session.php index 351f558b..27cb300e 100644 --- a/class/Session.php +++ b/class/Session.php @@ -1,4 +1,4 @@ - * @author Harry Fuecks (PHP Anthology Volume II) - * */ /** @@ -69,7 +68,7 @@ public static function getInstance() * @param string $name name of variable * @param mixed $value value of variable */ - public function setSession($name, $value) + public function setSession($name, $value): void { $_SESSION[$name] = $value; } @@ -95,7 +94,7 @@ public function getSession($name) * * @param string $name name of variable */ - public function deleteSession($name) + public function deleteSession($name): void { unset($_SESSION[$name]); } @@ -103,7 +102,7 @@ public function deleteSession($name) /** * Destroys the whole session. */ - public function destroySession() + public function destroySession(): void { $_SESSION = []; session_destroy(); diff --git a/class/Settings.php b/class/Settings.php index 87dde86b..1ad122b6 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -1,4 +1,4 @@ -getVar($method, $arg); } @@ -194,7 +193,7 @@ public function getFormSettings($action = false) } $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"set_image\", \"" . $uploadDirectory . '", "", "' . \XOOPS_URL . "\")'"); $imgtray->addElement($imageSelect); - $imgtray->addElement(new \XoopsFormLabel('', "

")); + $imgtray->addElement(new \XoopsFormLabel('', "

")); $fileseltray = new \XoopsFormElementTray('', '
'); $fileseltray->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); diff --git a/class/SettingsHandler.php b/class/SettingsHandler.php index 001ac2e8..1a7fbead 100644 --- a/class/SettingsHandler.php +++ b/class/SettingsHandler.php @@ -1,4 +1,4 @@ -. + * . */ /** * SplClassLoader implementation that implements the technical interoperability * standards for PHP 5.3 namespaces and class names. * - * http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 + * https://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 * * // Example which loads classes for the Doctrine Common package in the * // Doctrine\Common namespace. * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); * $classLoader->register(); * - * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @license https://www.opensource.org/licenses/mit-license.html MIT License * @author Jonathan H. Wage * @author Roman S. Borschel * @author Matthew Weier O'Phinney @@ -63,7 +63,7 @@ public function __construct($ns = null, $includePath = null) * * @param string $sep The separator to use */ - public function setNamespaceSeparator($sep) + public function setNamespaceSeparator($sep): void { $this->_namespaceSeparator = $sep; } @@ -81,7 +81,7 @@ public function getNamespaceSeparator() * * @param string $includePath */ - public function setIncludePath($includePath) + public function setIncludePath($includePath): void { $this->_includePath = $includePath; } @@ -89,7 +89,7 @@ public function setIncludePath($includePath) /** * Gets the base include path for all class files in the namespace of this class loader. * - * @return string $includePath + * @return string */ public function getIncludePath() { @@ -101,7 +101,7 @@ public function getIncludePath() * * @param string $fileExtension */ - public function setFileExtension($fileExtension) + public function setFileExtension($fileExtension): void { $this->_fileExtension = $fileExtension; } @@ -109,7 +109,7 @@ public function setFileExtension($fileExtension) /** * Gets the file extension of class files in the namespace of this class loader. * - * @return string $fileExtension + * @return string */ public function getFileExtension() { @@ -119,7 +119,7 @@ public function getFileExtension() /** * Installs this class loader on the SPL autoload stack. */ - public function register() + public function register(): void { spl_autoload_register([$this, 'loadClass']); } @@ -127,7 +127,7 @@ public function register() /** * Uninstalls this class loader from the SPL autoloader stack. */ - public function unregister() + public function unregister(): void { spl_autoload_unregister([$this, 'loadClass']); } @@ -137,7 +137,7 @@ public function unregister() * * @param string $className The name of the class to load */ - public function loadClass($className) + public function loadClass($className): void { if (null === $this->_namespace || $this->_namespace . $this->_namespaceSeparator === mb_substr($className, 0, mb_strlen($this->_namespace . $this->_namespaceSeparator))) { $fileName = ''; diff --git a/class/Tables.php b/class/Tables.php index 34388775..b6a81f42 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** @@ -103,7 +102,7 @@ public function __construct() */ public function __call($method, $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -194,7 +193,7 @@ public function getFormTables($action = false) } $imageSelect1->setExtra("onchange='showImgSelected(\"image1\", \"table_image\", \"" . $iconsDirectory . '", "", "' . \XOOPS_URL . "\")'"); $imgtray1->addElement($imageSelect1, false); - $imgtray1->addElement(new \XoopsFormLabel('', "
")); + $imgtray1->addElement(new \XoopsFormLabel('', "
")); $fileseltray1 = new \XoopsFormElementTray('', '
'); $fileseltray1->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); $fileseltray1->addElement(new \XoopsFormLabel('')); diff --git a/class/TablesHandler.php b/class/TablesHandler.php index 01993a32..54d6bd4f 100644 --- a/class/TablesHandler.php +++ b/class/TablesHandler.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** diff --git a/class/Utility.php b/class/Utility.php index b02e38dd..20f7ade0 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -1,4 +1,4 @@ - * @author Mamba @@ -27,7 +26,6 @@ */ use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Common; /** * Class Utility diff --git a/class/autoload.php b/class/autoload.php index 4ca947e3..f7a4aab4 100644 --- a/class/autoload.php +++ b/class/autoload.php @@ -1,4 +1,4 @@ - [ [ \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/images', - \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', ], // [ // \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', diff --git a/config/icons.php b/config/icons.php index fccce32a..d89bb2f8 100644 --- a/config/icons.php +++ b/config/icons.php @@ -1,4 +1,4 @@ - - Website: @@ -61,8 +60,8 @@ } $patterns = [ - \mb_strtolower(\MODULEBUILDER_DIRNAME) => \mb_strtolower($clone), - \mb_strtoupper(\MODULEBUILDER_DIRNAME) => \mb_strtoupper($clone), + \mb_strtolower(\MODULEBUILDER_DIRNAME) => \mb_strtolower($clone), + \mb_strtoupper(\MODULEBUILDER_DIRNAME) => \mb_strtoupper($clone), \ucfirst(\mb_strtolower(\MODULEBUILDER_DIRNAME)) => \ucfirst(\mb_strtolower($clone)), ]; @@ -95,13 +94,13 @@ /** * @param $path */ -function cloneFileFolder($path) +function cloneFileFolder($path): void { global $patKeys; global $patValues; //remove \XOOPS_ROOT_PATH and add after replace, otherwise there can be a bug if \XOOPS_ROOT_PATH contains same pattern - $newPath = \XOOPS_ROOT_PATH . \str_replace($patKeys[0], $patValues[0], \substr($path, \strlen(\XOOPS_ROOT_PATH))); + $newPath = \XOOPS_ROOT_PATH . \str_replace($patKeys[0], $patValues[0], \mb_substr($path, \mb_strlen(\XOOPS_ROOT_PATH))); if (\is_dir($path)) { // create new dir @@ -121,7 +120,7 @@ function cloneFileFolder($path) } } else { $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf']; - if (\in_array(\mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions, true)) { + if (\in_array(\mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions)) { // image \copy($path, $newPath); } else { @@ -188,4 +187,4 @@ function createLogo($dirname) \imagedestroy($imageModule); return true; -} \ No newline at end of file +} diff --git a/files/commonfiles/admin/feedback.php b/files/commonfiles/admin/feedback.php index 44598b97..01306dc2 100644 --- a/files/commonfiles/admin/feedback.php +++ b/files/commonfiles/admin/feedback.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck * @author Wedega - Email: * @author Fernando Santos (topet05) */ diff --git a/files/commonfiles/class/Common/Breadcrumb.php b/files/commonfiles/class/Common/Breadcrumb.php index 1f6a884d..dbd19c3b 100644 --- a/files/commonfiles/class/Common/Breadcrumb.php +++ b/files/commonfiles/class/Common/Breadcrumb.php @@ -1,4 +1,4 @@ - * @package Modulebuilder * @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = '') + public function addLink($title = '', $link = ''): void { $this->bread[] = [ 'link' => $link, diff --git a/files/commonfiles/class/Common/Configurator.php b/files/commonfiles/class/Common/Configurator.php index ff79b02a..5435ccd9 100644 --- a/files/commonfiles/class/Common/Configurator.php +++ b/files/commonfiles/class/Common/Configurator.php @@ -1,4 +1,4 @@ - - Website: @@ -85,7 +85,6 @@ public function getFormConfirm() $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); } if ('' === $this->label) { - $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); } @@ -104,6 +103,7 @@ public function getFormConfirm() $buttonBack->setExtra('onclick="history.go(-1);return true;"'); $buttonTray->addElement($buttonBack); $form->addElement($buttonTray); + return $form; } } diff --git a/files/commonfiles/class/Common/DirectoryChecker.php b/files/commonfiles/class/Common/DirectoryChecker.php index 1243352b..6c450a96 100644 --- a/files/commonfiles/class/Common/DirectoryChecker.php +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -1,4 +1,4 @@ - */ trait FilesManagement @@ -27,7 +27,7 @@ trait FilesManagement * @return void * @throws \RuntimeException */ - public static function createFolder($folder) + public static function createFolder($folder): void { try { if (!\file_exists($folder)) { @@ -43,11 +43,11 @@ public static function createFolder($folder) } /** - * @param $file - * @param $folder + * @param string $file + * @param string $folder * @return bool */ - public static function copyFile($file, $folder) + public static function copyFile(string $file, string $folder): bool { return \copy($file, $folder); } @@ -56,7 +56,7 @@ public static function copyFile($file, $folder) * @param $src * @param $dst */ - public static function recurseCopy($src, $dst) + public static function recurseCopy($src, $dst): void { $dir = \opendir($src); // @\mkdir($dst); @@ -82,7 +82,7 @@ public static function recurseCopy($src, $dst) * @return bool Returns true on success, false on failure * @author Aidan Lister * @version 1.0.1 - * @link http://aidanlister.com/2004/04/recursively-copying-directories-in-php/ + * @link https://aidanlister.com/2004/04/recursively-copying-directories-in-php/ */ public static function xcopy($source, $dest) { @@ -208,6 +208,7 @@ public static function rrmdir($src) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } @@ -248,6 +249,7 @@ public static function rmove($src, $dest) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } diff --git a/files/commonfiles/class/Common/Migrate.php b/files/commonfiles/class/Common/Migrate.php index 42dd2113..5e46abac 100644 --- a/files/commonfiles/class/Common/Migrate.php +++ b/files/commonfiles/class/Common/Migrate.php @@ -1,4 +1,4 @@ - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ - class Migrate extends \Xmf\Database\Migrate { private $renameTables; @@ -44,7 +43,7 @@ public function __construct(Common\Configurator $configurator = null) /** * change table prefix if needed */ - private function changePrefix() + private function changePrefix(): void { foreach ($this->renameTables as $oldName => $newName) { if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { @@ -59,7 +58,7 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + private function convertIPAddresses($tableName, $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); @@ -77,7 +76,7 @@ private function convertIPAddresses($tableName, $columnName) /** * Move do* columns from newbb_posts to newbb_posts_text table */ - private function moveDoColumns() + private function moveDoColumns(): void { $tableName = 'newbb_posts_text'; $srcTableName = 'newbb_posts'; @@ -101,7 +100,7 @@ private function moveDoColumns() * table and column renames * data conversions */ - protected function preSyncActions() + protected function preSyncActions(): void { /* // change 'bb' table prefix to 'newbb' diff --git a/files/commonfiles/class/Common/ModuleFeedback.php b/files/commonfiles/class/Common/ModuleFeedback.php index 76e8b806..f4b68532 100644 --- a/files/commonfiles/class/Common/ModuleFeedback.php +++ b/files/commonfiles/class/Common/ModuleFeedback.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck * @author Wedega - Email: * @author Fernando Santos (topet05) */ @@ -48,7 +48,7 @@ public function __construct() * * @param null */ - public static function getInstance() + public static function getInstance(): void { static $instance = false; if (!$instance) { diff --git a/files/commonfiles/class/Common/ModuleStats.php b/files/commonfiles/class/Common/ModuleStats.php index 5f28a252..7fb40989 100644 --- a/files/commonfiles/class/Common/ModuleStats.php +++ b/files/commonfiles/class/Common/ModuleStats.php @@ -1,4 +1,4 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck */ trait ModuleStats { diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php index 106fa07d..5d58d672 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -1,4 +1,4 @@ - - Website: @@ -184,7 +183,7 @@ public function resizeAndCrop() return true; } - public function mergeImage() + public function mergeImage(): void { $dest = \imagecreatefromjpeg($this->endFile); $src = \imagecreatefromjpeg($this->sourceFile); diff --git a/files/commonfiles/class/Common/ServerStats.php b/files/commonfiles/class/Common/ServerStats.php index 04c0dd74..7227cb9b 100644 --- a/files/commonfiles/class/Common/ServerStats.php +++ b/files/commonfiles/class/Common/ServerStats.php @@ -1,4 +1,4 @@ - */ trait ServerStats diff --git a/files/commonfiles/class/Common/SysUtility.php b/files/commonfiles/class/Common/SysUtility.php index f71d56c1..e8d4d9de 100644 --- a/files/commonfiles/class/Common/SysUtility.php +++ b/files/commonfiles/class/Common/SysUtility.php @@ -1,4 +1,4 @@ - * @author Mamba */ -use MyTextSanitizer; -use XoopsFormDhtmlTextArea; -use XoopsFormTextArea; -use XoopsModules\Modulebuilder; use XoopsModules\Modulebuilder\Helper; /** @@ -50,7 +45,6 @@ class SysUtility * Access the only instance of this class * * @return object - * */ public static function getInstance() { diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index b52d89b7..9c0bee7f 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -1,4 +1,4 @@ - */ trait VersionChecks diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 007c8d6f..87696bf4 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -1,4 +1,4 @@ - * @author Mamba diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index fa1ac8f7..be97430e 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -1,4 +1,4 @@ - - Website: XOOPS Project (www.xoops.org) $ diff --git a/files/commonfiles/include/uninstall.php b/files/commonfiles/include/uninstall.php index 81024446..ae7758ed 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -1,10 +1,11 @@ - - Website: * @version $Id: 1.0 update.php 1 Mon 2018-03-19 10:04:53Z XOOPS Project (www.xoops.org) $ * @copyright module for xoops - * @license GPL 2.0 or later + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ /** @@ -39,7 +38,7 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) $ret = modulebuilder_check_db($module); //check upload directory - require_once __DIR__ . '/install.php'; + require_once __DIR__ . '/install.php'; $ret = xoops_module_install_modulebuilder($module); $errors = $module->getErrors(); @@ -48,7 +47,6 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) } return $ret; - } // irmtfan bug fix: solve templates duplicate issue @@ -64,7 +62,7 @@ function update_modulebuilder_v10($module) 'SELECT t1.tpl_id FROM ' . $xoopsDB->prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id' ); $tplids = []; - while (list($tplid) = $xoopsDB->fetchRow($result)) { + while ([$tplid] = $xoopsDB->fetchRow($result)) { $tplids[] = $tplid; } if (\count($tplids) > 0) { @@ -84,7 +82,7 @@ function update_modulebuilder_v10($module) return false; } $ret = []; - while ($myrow = $xoopsDB->fetchArray($result)) { + while (false !== ($myrow = $xoopsDB->fetchArray($result))) { $ret[] = $myrow; } if (!empty($ret)) { @@ -113,7 +111,7 @@ function update_modulebuilder_v10($module) function modulebuilder_check_db($module) { $ret = true; - //insert here code for database check + //insert here code for database check /* // Example: update table (add new field) diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index 15757bdc..b2a521d9 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -1,4 +1,4 @@ - diff --git a/files/commonfiles/preloads/autoloader.php b/files/commonfiles/preloads/autoloader.php index 041829fc..65bd73cf 100644 --- a/files/commonfiles/preloads/autoloader.php +++ b/files/commonfiles/preloads/autoloader.php @@ -1,15 +1,15 @@ -add(new \Criteria('gperm_modid', Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); $skipColumns[] = 'gperm_id'; TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); @@ -138,7 +138,7 @@ function saveSampleData() \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); } -function exportSchema() +function exportSchema(): void { $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -152,7 +152,6 @@ function exportSchema() } catch (\Exception $e) { exit(\constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } - } /** @@ -169,21 +168,21 @@ function exportSchema() */ function loadTableFromArrayWithReplace($table, $data, $search, $replace) { - /** @var \XoopsDatabase */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); + /** @var \XoopsDatabase $db */ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); $prefixedTable = $db->prefix($table); - $count = 0; - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); + $count = 0; + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); $db->queryF($sql); foreach ($data as $row) { - $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; + $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; $valueClause = ' VALUES ('; - $first = true; + $first = true; foreach ($row as $column => $value) { if ($first) { $first = false; } else { - $insertInto .= ', '; + $insertInto .= ', '; $valueClause .= ', '; } $insertInto .= $column; @@ -193,7 +192,7 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) $valueClause .= $db->quote($value); } } - $sql = $insertInto . ') ' . $valueClause . ')'; + $sql = $insertInto . ') ' . $valueClause . ')'; $result = $db->queryF($sql); if (false !== $result) { ++$count; diff --git a/files/ratingfiles/assets/css/rating.css b/files/ratingfiles/assets/css/rating.css index 8179d315..9fa2f66d 100644 --- a/files/ratingfiles/assets/css/rating.css +++ b/files/ratingfiles/assets/css/rating.css @@ -13,7 +13,7 @@ * modulebuilder module for xoops * * @copyright module for xoops - * @license GPL 2.0 or later + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package modulebuilder * @since 1.0 * @min_xoops 2.5.9 diff --git a/files/ratingfiles/class/Ratings.php b/files/ratingfiles/class/Ratings.php index 3486cbfe..c696072b 100644 --- a/files/ratingfiles/class/Ratings.php +++ b/files/ratingfiles/class/Ratings.php @@ -1,4 +1,4 @@ - - Website: XOOPS Project (www.xoops.org) $ @@ -99,7 +98,7 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) // --- COPY page_copy.png --------------- // needed for clone feature of by modulebuilder created modules - $dest =\XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32/page_copy.png'; + $dest = \XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32/page_copy.png'; if (!\file_exists($dest)) { $file = \dirname(__DIR__) . '/assets/images/icons/32/page_copy.png'; $utility::copyFile($file, $dest); diff --git a/include/update.php b/include/update.php index f28f771f..6d032dea 100644 --- a/include/update.php +++ b/include/update.php @@ -1,4 +1,4 @@ -prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id' ); $tplids = []; - while (list($tplid) = $xoopsDB->fetchRow($result)) { + while ([$tplid] = $xoopsDB->fetchRow($result)) { $tplids[] = $tplid; } if (\count($tplids) > 0) { @@ -90,7 +88,7 @@ function update_modulebuilder_v191($module) } $sql = 'SHOW INDEX FROM ' . $xoopsDB->prefix('tplfile') . " WHERE KEY_NAME = 'tpl_refid_module_set_file_type'"; if (!$result = $xoopsDB->queryF($sql)) { - xoops_error($xoopsDB->error() . '
' . $sql); + xoops_error($xoopsDB->error() . '
' . $sql); return false; } @@ -107,7 +105,7 @@ function update_modulebuilder_v191($module) } $sql = 'ALTER TABLE ' . $xoopsDB->prefix('tplfile') . ' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )'; if (!$result = $xoopsDB->queryF($sql)) { - xoops_error($xoopsDB->error() . '
' . $sql); + xoops_error($xoopsDB->error() . '
' . $sql); $module->setErrors( "'tpl_refid_module_set_file_type' unique index is not added to 'tplfile' table. Warning: do not use XOOPS until you add this unique index." ); @@ -117,6 +115,7 @@ function update_modulebuilder_v191($module) return true; } + // irmtfan bug fix: solve templates duplicate issue /** @@ -145,7 +144,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -177,7 +176,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -209,7 +208,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -241,7 +240,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -273,7 +272,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -305,7 +304,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -337,7 +336,7 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); //add existing element at end of table $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}')"; $result = $xoopsDB->query($sql); @@ -482,20 +481,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 23 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 23 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } @@ -517,20 +522,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 23 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 23 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } @@ -562,20 +573,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 25 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 25 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } @@ -596,20 +613,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 26 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 26 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } @@ -630,20 +653,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 27 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 27 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } @@ -664,20 +693,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - list($fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue) = $xoopsDB->fetchRow($result); + [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); //add existing element at end of table - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}')"; $result = $xoopsDB->query($sql); // update table fields to new id of previous 28 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; $result = $xoopsDB->query($sql); // update 28 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}', `fieldelement_sort` = '{$fsort}', `fieldelement_deftype` = '{$fdeftype}', `fieldelement_defvalue` = '{$fdefvalue}' WHERE `fieldelement_id` = {$fid};"; $result = $xoopsDB->query($sql); } else { //add missing element - $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; + $sql = 'INSERT INTO `' + . $xoopsDB->prefix('modulebuilder_fieldelements') + . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}')"; $result = $xoopsDB->query($sql); } } diff --git a/index.php b/index.php index 6a505435..e5ee0725 100644 --- a/index.php +++ b/index.php @@ -1,2 +1,2 @@ -Select one or all items to add specific addon in this new module" + 'Select one or all items to add specific addon in this new module' ); // Common / List headers in templates \define('_AM_MODULEBUILDER_ID', 'Id'); @@ -150,11 +149,11 @@ \define('_AM_MODULEBUILDER_MODULE_NOTIMPORTANT', "Optional - Information"); \define('_AM_MODULEBUILDER_MODULE_ID', 'Id'); \define('_AM_MODULEBUILDER_MODULE_NAME', 'Name'); -\define('_AM_MODULEBUILDER_MODULE_NAME_DESC', "The module name can contain spaces and special characters such as accents.
An example would be: My Simple Module"); +\define('_AM_MODULEBUILDER_MODULE_NAME_DESC', "The module name can contain spaces and special characters such as accents.
An example would be: My Simple Module"); \define('_AM_MODULEBUILDER_MODULE_DIRNAME', 'Directory Name'); \define( '_AM_MODULEBUILDER_MODULE_DIRNAME_DESC', - "The module directory can not contain spaces or special characters such as accents.
An example would be: mysimplemodule.
In case you write the module directory with uppercase characters, they are replaced automatically with lowercase, and if there are spaces they will also be automatically deleted." + "The module directory can not contain spaces or special characters such as accents.
An example would be: mysimplemodule.
In case you write the module directory with uppercase characters, they are replaced automatically with lowercase, and if there are spaces they will also be automatically deleted." ); \define('_AM_MODULEBUILDER_MODULE_VERSION', 'Version'); \define('_AM_MODULEBUILDER_MODULE_SINCE', 'Since'); @@ -193,7 +192,7 @@ \define('_AM_MODULEBUILDER_MODULE_MIN_XOOPS', 'Minimum XOOPS'); \define('_AM_MODULEBUILDER_MODULE_MIN_ADMIN', 'Minimum Admin'); \define('_AM_MODULEBUILDER_MODULE_MIN_MYSQL', 'Minimum Database'); -// + \define('_AM_MODULEBUILDER_MODULE_FORM_CREATED_OK', "The module %s is successfully created"); \define('_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK', "The module %s is successfully updated"); \define('_AM_MODULEBUILDER_MODULE_BUTTON_NEW_LOGO', 'Create new Logo'); @@ -215,7 +214,7 @@ \define('_AM_MODULEBUILDER_TABLE_SOLENAME', 'Table Singular Name'); \define('_AM_MODULEBUILDER_TABLE_SOLENAME_DESC', "Singular Name: It's recommended to use singular word (i.e.: category for admin buttons)"); \define('_AM_MODULEBUILDER_TABLE_CATEGORY', 'This table is a category or topic?'); -\define('_AM_MODULEBUILDER_TABLE_CATEGORY_DESC', "WARNING: Once you have used this option for this module, and edit this table,
will not be displayed following the creation of other tables
"); +\define('_AM_MODULEBUILDER_TABLE_CATEGORY_DESC', "WARNING: Once you have used this option for this module, and edit this table,
will not be displayed following the creation of other tables
"); \define('_AM_MODULEBUILDER_TABLE_NBFIELDS', 'Number fields'); \define('_AM_MODULEBUILDER_TABLE_NBFIELDS_DESC', 'Number of fields for this table'); \define('_AM_MODULEBUILDER_TABLE_ORDER', 'Order tables'); @@ -223,9 +222,9 @@ \define('_AM_MODULEBUILDER_TABLE_FIELDNAME', 'Prefix Field Name'); \define( '_AM_MODULEBUILDER_TABLE_FIELDNAME_DESC', - "This is the prefix of field name (optional)
If you leave the field blank, doesn't appear anything in the fields of the next screen,
otherwise you'll see all the fields with a prefix type (i.e.: cat of table categories).
WARNING: It's recommended to use singular word" + "This is the prefix of field name (optional)
If you leave the field blank, doesn't appear anything in the fields of the next screen,
otherwise you'll see all the fields with a prefix type (i.e.: cat of table categories).
WARNING: It's recommended to use singular word" ); -\define('_AM_MODULEBUILDER_TABLE_OPTIONS_CHECKS_DESC', 'For each table created during building prcedure the relevant files will be created on behalf of this.
Selecting one or more of these options to decide which functions and condition should be implemented in your module for this table.'); +\define('_AM_MODULEBUILDER_TABLE_OPTIONS_CHECKS_DESC', 'For each table created during building prcedure the relevant files will be created on behalf of this.
Selecting one or more of these options to decide which functions and condition should be implemented in your module for this table.'); \define('_AM_MODULEBUILDER_TABLE_ALL', 'Check All'); \define('_AM_MODULEBUILDER_TABLE_IMAGE', 'Table Logo'); //\define('_AM_MODULEBUILDER_TABLE_IMAGE_DESC', "You can choose an image from the list, or upload a new one from your computer"); @@ -329,9 +328,9 @@ // others \define('_AM_MODULEBUILDER_BUILDING_DIRECTORY', "Files created in the directory uploads/modulebuilder/repository/ of the module %s"); \define('_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT', "
Created module was also copied to %s"); -\define('_AM_MODULEBUILDER_BUILDING_COMMON', "Copied common files and created folder for test data"); +\define('_AM_MODULEBUILDER_BUILDING_COMMON', 'Copied common files and created folder for test data'); \define('_AM_MODULEBUILDER_BUILDING_DELETED_CACHE_FILES', 'Cache Files Are Deleted Succefully'); -\define('_AM_MODULEBUILDER_BUILDING_INROOT_COPY', "Create copy of this module in root/modules
Pay attention: if yes, then an existing module with same name will be overwritten irreversible!"); +\define('_AM_MODULEBUILDER_BUILDING_INROOT_COPY', "Create copy of this module in root/modules
Pay attention: if yes, then an existing module with same name will be overwritten irreversible!"); \define('_AM_MODULEBUILDER_BUILDING_TEST', 'Save and restore test data of selected module'); \define('_AM_MODULEBUILDER_BUILDING_TEST_DESC', '
If you create copy of this module in root/modules then all data of previous module will be deleted.
If you select this option, then data of selected module will be stored temporary and copied back as test data to new build module'); \define('_AM_MODULEBUILDER_BUILDING_CHECK', 'Run data check for errors/inconsistencies before building the module'); @@ -358,7 +357,7 @@ \define('_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS1', "The table '%t' should use rating functionality, but the table do not have a field of type 'Ratings Textbox', which is obligatory for this function"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS2', "The table '%t' should use rating functionality, but the table do not have a field of type 'Votes Textbox', which is obligatory for this function"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_READS1', "The table '%t' should use count reads functionality, but the table do not have a field of type 'Reads Textbox', which is obligatory for this function"); -\define('_AM_MODULEBUILDER_BUILDING_RATING', "Copied rating files"); +\define('_AM_MODULEBUILDER_BUILDING_RATING', 'Copied rating files'); \define('_AM_MODULEBUILDER_BUILDING_CHECK_USERPAGE1', "The table '%t' should use submit or rate or broken functionality, but the table is not selected for user files"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_SQL1', "The field '%f' in table '%t' is type DECIMAL, FLOAT or DOUBLE. The value should be '{digits in total},{digits after the decimal point}', e.g. '16,2'"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_SQL2', "The field '%f' in table '%t' is type DECIMAL, FLOAT or DOUBLE. The default value should be related to precision, e.g. '0.00' if value is '16,2'"); @@ -394,49 +393,49 @@ \define('_AM_MODULEBUILDER_FORM_ACTION', 'Action'); // // ------------------- Field elements --------------------------------- // -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXT', "Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTAREA', "Plain TextArea Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_DHTMLTEXTAREA', "Selectable Editor (Dhtml)"); -\define('_AM_MODULEBUILDER_FIELD_ELE_CHECKBOX', "CheckBox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_RADIOYN', "Radio Yes/No"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTBOX', "Select Listbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTUSER', "Select User Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_COLORPICKER', "Color Picker Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_IMAGELIST', "Image List"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTFILE', "Select File Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_URLFILE', "Url File Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_UPLOADIMAGE', "Upload Image Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_UPLOADFILE', "Upload File Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTDATESELECT', "Date Select Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTSTATUS', "Select Status Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_PASSWORD', "Password Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTCOUNTRY', "Select Country List"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTLANG', "Select Language List"); -\define('_AM_MODULEBUILDER_FIELD_ELE_DATETIME', "Date/Time Select Field"); -\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTCOMBO', "Select Combobox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO', "Radio"); -\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO_1', "Radio Value 1"); -\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO_2', "Radio Value 2"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTUUID', "UUID Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTIP', "IP Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTCOMMENTS', "Comments Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTRATINGS', "Ratings Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTVOTES', "Votes Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTREADS', "Reads Textbox"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTINTEGER', "Textbox Integer"); -\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTFLOAT', "Textbox Float"); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXT', 'Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTAREA', 'Plain TextArea Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_DHTMLTEXTAREA', 'Selectable Editor (Dhtml)'); +\define('_AM_MODULEBUILDER_FIELD_ELE_CHECKBOX', 'CheckBox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_RADIOYN', 'Radio Yes/No'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTBOX', 'Select Listbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTUSER', 'Select User Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_COLORPICKER', 'Color Picker Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_IMAGELIST', 'Image List'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTFILE', 'Select File Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_URLFILE', 'Url File Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_UPLOADIMAGE', 'Upload Image Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_UPLOADFILE', 'Upload File Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTDATESELECT', 'Date Select Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTSTATUS', 'Select Status Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_PASSWORD', 'Password Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTCOUNTRY', 'Select Country List'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTLANG', 'Select Language List'); +\define('_AM_MODULEBUILDER_FIELD_ELE_DATETIME', 'Date/Time Select Field'); +\define('_AM_MODULEBUILDER_FIELD_ELE_SELECTCOMBO', 'Select Combobox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO', 'Radio'); +\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO_1', 'Radio Value 1'); +\define('_AM_MODULEBUILDER_FIELD_ELE_RADIO_2', 'Radio Value 2'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTUUID', 'UUID Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTIP', 'IP Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTCOMMENTS', 'Comments Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTRATINGS', 'Ratings Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTVOTES', 'Votes Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTREADS', 'Reads Textbox'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTINTEGER', 'Textbox Integer'); +\define('_AM_MODULEBUILDER_FIELD_ELE_TEXTFLOAT', 'Textbox Float'); // // ------------------- Misc --------------------------------- // \define('_AM_MODULEBUILDER_THEREARE_DATABASE1', "There are %s"); \define('_AM_MODULEBUILDER_THEREARE_DATABASE2', 'in the database'); \define('_AM_MODULEBUILDER_THEREARE_PENDING', "There are %s"); \define('_AM_MODULEBUILDER_THEREARE_PENDING2', 'waiting'); -// + \define('_AM_MODULEBUILDER_CHANGE_DISPLAY', 'Change Display'); \define('_AM_MODULEBUILDER_CHANGE_SETTINGS', 'Change Settings'); \define('_AM_MODULEBUILDER_TOGGLE_SUCCESS', 'Successfully Changed Display'); \define('_AM_MODULEBUILDER_TOGGLE_FAILED', 'Changing Display Failed'); -// + \define('_AM_MODULEBUILDER_ABOUT_WEBSITE_FORUM', 'Forum Website'); \define('_AM_MODULEBUILDER_ABOUT_MAKE_DONATION', 'Make a Donation to support this module'); \define('_AM_MODULEBUILDER_MAINTAINED', '%s is maintained by the '); @@ -479,4 +478,3 @@ \define('_AM_MODULEBUILDER_ERROR_IMPTABLES', 'Error: import tables failed'); \define('_AM_MODULEBUILDER_SUCCESS_IMPTABLES', 'Table has been imported: '); \define('_AM_MODULEBUILDER_ERROR_MCREATE', 'Error creating imported module'); - diff --git a/language/english/common.php b/language/english/common.php index 69c0924e..c9eede3f 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -1,4 +1,4 @@ - */ - $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); diff --git a/language/english/filechecker.php b/language/english/filechecker.php index 13b2747a..c483bd8b 100644 --- a/language/english/filechecker.php +++ b/language/english/filechecker.php @@ -1,4 +1,4 @@ -Help: ModuleBuilder Back to the Administration of ModuleBuilder + alt="Back to the Administration of ModuleBuilder">

Description

- The ModuleBuilder module can be used to create new modules in XOOPS

+ The ModuleBuilder module can be used to create new modules in XOOPS

Install/uninstall

- No special measures necessary, follow the standard installation process and extract the ModuleBuilder folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

- Detailed instructions on installing modules are available in the XOOPS Operations Manual + No special measures necessary, follow the standard installation process and extract the ModuleBuilder folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

+ Detailed instructions on installing modules are available in the XOOPS Operations Manual

Operating instructions

- The module ModuleBuilder is just to create other modules for xoops his first creation in version 1.1 of the Team Developement Module.

- Basically you need to:

- 1) Create the module from the Modules tab.

- 2) Click on the Add New Module button.

- 3) In the screen that appears, read the descriptions of the fields to be filled in to create your own module.

- 4) Once you have created the module, if you want you can add tables for use with the database if necessary, always following the descriptions of the fields on the left of the Tables tab.

- 5) Once the table is created, you will be automatically redirected to a list or form to the creation of the fields of the table.

- 6) When you have saved all fields of the table just built them according to the instructions on the screen, you will be directed to the list of modules and related tables created.

- 7) The last step is to go to the tab Buil Module to choose which module to compile and choose in the list of your modules.

- 8) When will it be completed or will your modules, go to the folder ModuleBuilder/modules and copy and paste your new module to test it in the modules section of the root of your web space or better usually does this in localhost.

+ The module ModuleBuilder is just to create other modules for xoops his first creation in version 1.1 of the Team Developement Module.

+ Basically you need to:

+ 1) Create the module from the Modules tab.

+ 2) Click on the Add New Module button.

+ 3) In the screen that appears, read the descriptions of the fields to be filled in to create your own module.

+ 4) Once you have created the module, if you want you can add tables for use with the database if necessary, always following the descriptions of the fields on the left of the Tables tab.

+ 5) Once the table is created, you will be automatically redirected to a list or form to the creation of the fields of the table.

+ 6) When you have saved all fields of the table just built them according to the instructions on the screen, you will be directed to the list of modules and related tables created.

+ 7) The last step is to go to the tab Buil Module to choose which module to compile and choose in the list of your modules.

+ 8) When will it be completed or will your modules, go to the folder ModuleBuilder/modules and copy and paste your new module to test it in the modules section of the root of your web space or better usually does this in localhost.

Features

- The ModuleBuilder module continues to expand, to get to the conditions to create modules, more and more sophisticated.
- For this reason, I invite all developers to report and send in svn any changes or additions to this module, so that we can jointly contribute to the development

+ The ModuleBuilder module continues to expand, to get to the conditions to create modules, more and more sophisticated.
+ For this reason, I invite all developers to report and send in svn any changes or additions to this module, so that we can jointly contribute to the development

Support

If you liked the module ModuleBuilder and thanks to the long process for giving the opportunity to the new module to be created in a moment, consider making a donation to keep the module ModuleBuilder and make a donation using this button Button Donations

Thanks! + href="https://xoops.org/modules/xdonations/index.php" title="Donation To Txmod Xoops">Button Donations

Thanks!

Tutorial

- You can find a more detailed to this Video Tutorial here + You can find a more detailed to this Video Tutorial here

Translate

diff --git a/language/english/help/index.php b/language/english/help/index.php index 4ae18fd0..e5ee0725 100644 --- a/language/english/help/index.php +++ b/language/english/help/index.php @@ -1,2 +1,2 @@ - <{includeq file="db:modulebuilder_header.tpl"}> -
+
<{if $building_directory|default:''}> @@ -15,24 +15,24 @@ <{if $base_architecture}> - + <{else}> - + <{/if}> <{foreach item=build from=$builds}> <{if $created}> - + <{else}> - + <{/if}> <{/foreach}> @@ -41,22 +41,22 @@
<{$smarty.const._AM_MODULEBUILDER_OK_ARCHITECTURE}>  <{$smarty.const._AM_MODULEBUILDER_NOTOK_ARCHITECTURE}>  
<{$build.list}>  <{$build.list}>  
-
+
<{else}> <{if $checkResults|default:''}>

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_RESULT}>

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_FOUND}>

<{foreach item=check from=$checkResults}> -

<{$check.info}>

+

<{$check.info}>

<{/foreach}>

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_SOLVE}>



------------------------------------------------------------------------------------------------------------------ -
<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_ERROR_DESC}>
<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_WARNING_DESC}>
+
<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_ERROR_DESC}>
<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_WARNING_DESC}>

<{/if}> <{if $checkResultsNice|default:''}>

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_RESULT}>

-

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_NOERRORS}>

+

<{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_NOERRORS}>

<{/if}> <{if $form|default:''}> <{$form}> diff --git a/templates/admin/modulebuilder_devtools.tpl b/templates/admin/modulebuilder_devtools.tpl index 8ed114ae..36e70e79 100644 --- a/templates/admin/modulebuilder_devtools.tpl +++ b/templates/admin/modulebuilder_devtools.tpl @@ -45,11 +45,11 @@

<{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_LEGEND}>

- <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS}> + <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS}> <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS}> <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS_DESCR}>

- <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED}> + <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED}> <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED}>

@@ -57,7 +57,7 @@

<{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_FILE}> <{$key}>

    <{foreach item=clresult from=$clresultfile}> -
  • <{if $clresult.first}><{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS}><{else}><{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED}><{/if}> <{$clresult.define}> <{if $clresult.first}>(<{$clresult.first}>)<{/if}>
  • +
  • <{if $clresult.first}><{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS}><{else}><{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED}><{/if}> <{$clresult.define}> <{if $clresult.first}>(<{$clresult.first}>)<{/if}>
  • <{/foreach}>
<{/foreach}> diff --git a/templates/admin/modulebuilder_fields.tpl b/templates/admin/modulebuilder_fields.tpl index 13d3d83f..8338dfc8 100644 --- a/templates/admin/modulebuilder_fields.tpl +++ b/templates/admin/modulebuilder_fields.tpl @@ -26,30 +26,30 @@ <{if $table.id > 0}> (<{$table.lid}>) - Toggle + Toggle <{$table.name}> (<{$table.module}>) - <{$table.name}> + <{$table.name}> <{$table.nbfields}> - - - - - - - - - + + + + + + + + + - <{$smarty.const._AM_MODULEBUILDER_TABLES_EDIT}> + <{$smarty.const._AM_MODULEBUILDER_TABLES_EDIT}> - <{$smarty.const._AM_MODULEBUILDER_FIELDS_EDIT}> + <{$smarty.const._AM_MODULEBUILDER_FIELDS_EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> @@ -60,8 +60,8 @@ <{/foreach}> -
-
+
+
 
<{if $pagenav|default:''}> diff --git a/templates/admin/modulebuilder_fields_item.tpl b/templates/admin/modulebuilder_fields_item.tpl index 2a46f4a9..bcfeb3d2 100644 --- a/templates/admin/modulebuilder_fields_item.tpl +++ b/templates/admin/modulebuilder_fields_item.tpl @@ -3,70 +3,70 @@ <{foreach item=field from=$table.fields key=field_id}> <{if $field.id > 0}> - [<{$field.lid}>] <{$field.name}> + [<{$field.lid}>] <{$field.name}> <{$field.name}> - Empty - Empty - Empty + Empty + <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_SYSTEM_LOADING}><{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - Empty + Empty <{/if}> <{/foreach}> diff --git a/templates/admin/modulebuilder_footer.tpl b/templates/admin/modulebuilder_footer.tpl index 5d066ed0..37cdf169 100644 --- a/templates/admin/modulebuilder_footer.tpl +++ b/templates/admin/modulebuilder_footer.tpl @@ -1,7 +1,7 @@ -
+
- Xoops Logo + Xoops Logo
diff --git a/templates/admin/modulebuilder_modules.tpl b/templates/admin/modulebuilder_modules.tpl index 6abca4f2..3be5dbfe 100644 --- a/templates/admin/modulebuilder_modules.tpl +++ b/templates/admin/modulebuilder_modules.tpl @@ -24,69 +24,69 @@ <{$module.id}> <{$module.name}> <{$module.version}> - + <{$module.release}> <{$module.status}> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> - <{$smarty.const._CLONE}> + <{$smarty.const._CLONE}> <{/foreach}> -
-
+
+
 
<{if $pagenav|default:''}> diff --git a/templates/admin/modulebuilder_morefiles.tpl b/templates/admin/modulebuilder_morefiles.tpl index 293ccb64..08da6ff0 100644 --- a/templates/admin/modulebuilder_morefiles.tpl +++ b/templates/admin/modulebuilder_morefiles.tpl @@ -24,17 +24,17 @@ <{$file.upload}> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> <{/foreach}> -
-
+
+
 
<{if $pagenav|default:''}> diff --git a/templates/admin/modulebuilder_settings.tpl b/templates/admin/modulebuilder_settings.tpl index 6e012011..b9ad8305 100644 --- a/templates/admin/modulebuilder_settings.tpl +++ b/templates/admin/modulebuilder_settings.tpl @@ -19,7 +19,7 @@ <{$set.id}> <{$set.name}> <{$set.version}> - + <{$set.release}> <{$set.status}> @@ -27,32 +27,32 @@ <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}>"> <{else}> <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}>"> <{/if}> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> <{/foreach}> -
-
- +
+
+
 
<{if $pagenav|default:''}>
<{$pagenav}>
diff --git a/templates/admin/modulebuilder_tables.tpl b/templates/admin/modulebuilder_tables.tpl index f7c7020f..7a647db3 100644 --- a/templates/admin/modulebuilder_tables.tpl +++ b/templates/admin/modulebuilder_tables.tpl @@ -25,69 +25,69 @@ <{if $module.id > 0}> (<{$module.id}>) - Toggle + Toggle <{$module.name}> - - 16 - + 16 + <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - Submenu - Submenu + <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> - <{$smarty.const._ADD}> + <{$smarty.const._ADD}> <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> -
-
+
+
 
<{if $pagenav|default:''}> diff --git a/templates/admin/modulebuilder_tables_item.tpl b/templates/admin/modulebuilder_tables_item.tpl index 62847a46..3e1391d4 100644 --- a/templates/admin/modulebuilder_tables_item.tpl +++ b/templates/admin/modulebuilder_tables_item.tpl @@ -3,74 +3,74 @@ <{foreach item=table from=$module.tables key=table_id}> <{if $table.id > 0}> - [<{$table.lid}>] <{$table.name}> + [<{$table.lid}>] <{$table.name}> <{$table.name}> - <{$table.name}> + <{$table.name}> <{$table.nbfields}> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}> + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>">
- <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> diff --git a/templates/index.php b/templates/index.php index 4ae18fd0..e5ee0725 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,2 +1,2 @@ -check()) { + redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + clearSampleData(); + } else { + xoops_cp_header(); + xoops_confirm(['ok' => 1, 'op' => 'clear'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_cp_footer(); + } break; } // XMF TableLoad for SAMPLE data -function loadSampleData() +function loadSampleData(): void { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); @@ -103,7 +112,7 @@ function loadSampleData() \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); } -function saveSampleData() +function saveSampleData(): void { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); @@ -133,7 +142,7 @@ function saveSampleData() \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); } -function exportSchema() +function exportSchema(): void { $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -202,10 +211,11 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) } } } + return $count; } -function clearSampleData() +function clearSampleData(): void { $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); diff --git a/xoops_version.php b/xoops_version.php index 3f8f05fc..b7f581a9 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -1,4 +1,4 @@ -